"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isThreadPrompt = exports.isStringPrompt = exports.isAiAgentToolName = exports.isAiAgentMcpToolName = exports.GITHUB_MCP_SERVER_NAME = exports.GITHUB_MCP_SERVER_URL = exports.hasAiAgentAccessToSpace = exports.baseAgentSchema = void 0;
const tslib_1 = require("tslib");
const zod_1 = require("zod");
const visualizations_1 = require("./schemas/visualizations");
tslib_1.__exportStar(require("./adminTypes"), exports);
tslib_1.__exportStar(require("./aiEvalAssessment"), exports);
tslib_1.__exportStar(require("./chartConfig/slack"), exports);
tslib_1.__exportStar(require("./chartConfig/web"), exports);
tslib_1.__exportStar(require("./constants"), exports);
tslib_1.__exportStar(require("./coder"), exports);
tslib_1.__exportStar(require("./dashboardContext"), exports);
tslib_1.__exportStar(require("./aiAgentReviewClassifierTypes"), exports);
tslib_1.__exportStar(require("./documentTypes"), exports);
tslib_1.__exportStar(require("./filterExploreByTags"), exports);
tslib_1.__exportStar(require("./followUpTools"), exports);
tslib_1.__exportStar(require("./projectContext"), exports);
tslib_1.__exportStar(require("./requestTypes"), exports);
tslib_1.__exportStar(require("./schemas"), exports);
tslib_1.__exportStar(require("./schemas/agentReadiness"), exports);
tslib_1.__exportStar(require("./schemas/agentSuggestions"), exports);
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./utils"), exports);
tslib_1.__exportStar(require("./validators"), exports);
exports.baseAgentSchema = zod_1.z.object({
    uuid: zod_1.z.string(),
    projectUuid: zod_1.z.string(),
    organizationUuid: zod_1.z.string(),
    name: zod_1.z.string(),
    description: zod_1.z.string().nullable(),
    imageUrl: zod_1.z.string().url().nullable(),
    imageUrlSource: zod_1.z.enum(['upload', 'url']).nullable(),
    tags: zod_1.z.array(zod_1.z.string()).nullable(),
    integrations: zod_1.z.array(zod_1.z.object({
        type: zod_1.z.literal('slack'),
        channelId: zod_1.z.string(),
    })),
    createdAt: zod_1.z.coerce.date(),
    updatedAt: zod_1.z.coerce.date(),
    instruction: zod_1.z
        .string()
        .max(8192, // 8kb
    'Custom instruction is too long. Maximum allowed is 8,100 characters.')
        .nullable(),
    provider: zod_1.z.string(),
    model: zod_1.z.string(),
    groupAccess: zod_1.z.array(zod_1.z.string()),
    userAccess: zod_1.z.array(zod_1.z.string()),
    spaceAccess: zod_1.z.array(zod_1.z.string()),
    enableDataAccess: zod_1.z.boolean(),
    enableSelfImprovement: zod_1.z.boolean(),
    enableContentTools: zod_1.z.boolean(),
    enableUserContext: zod_1.z.boolean(),
    adminOnly: zod_1.z.boolean(),
    modelConfig: zod_1.z.custom().nullable(),
    version: zod_1.z.number(),
});
// An empty spaceAccess list means the agent is unrestricted (all spaces).
const hasAiAgentAccessToSpace = (agent, spaceUuid) => agent.spaceAccess.length === 0 || agent.spaceAccess.includes(spaceUuid);
exports.hasAiAgentAccessToSpace = hasAiAgentAccessToSpace;
// The hosted GitHub MCP server. The one-click "Connect GitHub" flow points the
// MCP server here and authenticates with the org's GitHub App installation
// token (minted server-side), so no separate OAuth/PAT step is needed.
exports.GITHUB_MCP_SERVER_URL = 'https://api.githubcopilot.com/mcp/';
exports.GITHUB_MCP_SERVER_NAME = 'GitHub';
const isAiAgentMcpToolName = (toolName) => toolName.startsWith('mcp_');
exports.isAiAgentMcpToolName = isAiAgentMcpToolName;
const isAiAgentToolName = (toolName) => visualizations_1.ToolNameSchema.safeParse(toolName).success ||
    (0, exports.isAiAgentMcpToolName)(toolName);
exports.isAiAgentToolName = isAiAgentToolName;
/**
 * Type guard to check if a CreateEvaluationPrompt is a string prompt
 */
const isStringPrompt = (prompt) => 'prompt' in prompt;
exports.isStringPrompt = isStringPrompt;
/**
 * Type guard to check if a CreateEvaluationPrompt is a thread reference
 */
const isThreadPrompt = (prompt) => 'promptUuid' in prompt && 'threadUuid' in prompt;
exports.isThreadPrompt = isThreadPrompt;
//# sourceMappingURL=index.js.map