import type { Provider, ProviderMessage } from "../providers/ProviderTypes.js"; import type { CodaliGatewayClassifierOutput, CodaliGatewayPlannerOutput, CodaliGatewayRequest, CodaliGatewayValidationIssue } from "./CodaliGatewayTypes.js"; import { type GatewayPolicyCompilation } from "./GatewayPolicyCompiler.js"; export interface CodaliGatewayPlannerToolDescriptor { name: string; description?: string; inputSchema?: Record; outputSchema?: Record; /** Capability group used for two-level tool exposure. See ToolExposure.ts. */ capability?: string; readOnly?: boolean; } export interface GatewayPlannerInput { request: CodaliGatewayRequest; policyCompilation?: GatewayPolicyCompilation; toolDescriptions?: Record; } export interface CodaliGatewayPlanningResult { policyCompilation: GatewayPolicyCompilation; classifier: CodaliGatewayClassifierOutput; planner: CodaliGatewayPlannerOutput; warnings: string[]; classifierRepairAttempts: number; plannerRepairAttempts: number; classifierRawContent: string; plannerRawContent: string; } export interface CodaliGatewayPlannerOptions { maxRepairAttempts?: number; maxTokens?: number; temperature?: number; } export declare class CodaliGatewayPlannerError extends Error { readonly code: string; readonly issues?: CodaliGatewayValidationIssue[]; constructor(code: string, message: string, issues?: CodaliGatewayValidationIssue[]); } export declare const CODALI_GATEWAY_CLASSIFIER_SCHEMA: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["queryType", "needsPrivateData", "needsFreshData", "needsDocdex", "needsAppTools", "needsImageWorker"]; readonly properties: { readonly queryType: { readonly type: "string"; readonly minLength: 1; }; readonly needsPrivateData: { readonly type: "boolean"; }; readonly needsFreshData: { readonly type: "boolean"; }; readonly needsDocdex: { readonly type: "boolean"; }; readonly needsAppTools: { readonly type: "boolean"; }; readonly needsImageWorker: { readonly type: "boolean"; }; readonly directAnswerCandidate: { readonly type: "string"; }; readonly capabilities: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly needsClarification: { readonly type: "string"; }; readonly rationale: { readonly type: "string"; }; readonly confidence: { readonly enum: readonly ["high", "medium", "low"]; }; readonly metadata: { readonly type: "object"; }; }; }; export declare const CODALI_GATEWAY_PLANNER_SCHEMA: { readonly type: "object"; readonly additionalProperties: true; readonly required: readonly ["queryType", "subquestions", "workerTasks"]; readonly properties: { readonly runId: { readonly type: "string"; }; readonly queryType: { readonly type: "string"; readonly minLength: 1; }; readonly summary: { readonly type: "string"; }; readonly subquestions: { readonly type: "array"; readonly items: { readonly type: "object"; readonly additionalProperties: true; readonly required: readonly ["id", "question"]; readonly properties: { readonly id: { readonly type: "string"; readonly minLength: 1; }; readonly question: { readonly type: "string"; readonly minLength: 1; }; readonly rationale: { readonly type: "string"; }; readonly priority: { readonly type: "number"; }; }; }; }; readonly workerTasks: { readonly type: "array"; readonly items: { readonly type: "object"; readonly additionalProperties: true; readonly required: readonly ["id", "workerRole", "objective", "toolsAllowed", "outputFormat"]; readonly properties: { readonly id: { readonly type: "string"; readonly minLength: 1; }; readonly workerRole: { readonly type: "string"; readonly minLength: 1; }; readonly objective: { readonly type: "string"; readonly minLength: 1; }; readonly query: { readonly type: "string"; }; readonly toolsAllowed: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly outputFormat: { readonly type: "string"; readonly minLength: 1; }; readonly expectedSources: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly constraints: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly priority: { readonly type: "number"; }; readonly metadata: { readonly type: "object"; }; }; }; }; readonly expectedEvidenceCount: { readonly type: "number"; }; readonly maxIterations: { readonly type: "number"; }; readonly requiresFinalLargeModel: { readonly type: "boolean"; }; readonly metadata: { readonly type: "object"; }; }; }; /** * Matches a tool name the planner wrote against the tools that actually exist. * * Registered names are namespaced — `http:logmira_tenant_records:daily_logs`, * `mcp:github:list_issues` — and a model asked to repeat one routinely writes * the last segment instead, or drops the transport prefix. Compared exactly, * that name matches nothing, and a task whose tools do not resolve is rejected * whole: the run then calls no tools at all, returns no sources, and reports * that the context pack was empty. * * It reached production. A declared HTTP connector was registered, visible and * undropped, while the planner in the same run happily called `docdex_search` * — a name short enough to reproduce exactly. The connector was never called * once. * * Only unambiguous matches are accepted. Two tools ending in the same segment * resolve to neither, because guessing between them would call the wrong * system, and that is worse than reporting the tool as unavailable. */ export declare const resolveToolNameAgainst: (candidate: string, available: readonly string[]) => string | undefined; export declare const buildCodaliGatewayClassifierMessages: (input: GatewayPlannerInput) => ProviderMessage[]; export declare const buildCodaliGatewayPlannerMessages: (input: GatewayPlannerInput, classifier: CodaliGatewayClassifierOutput) => ProviderMessage[]; export declare const sanitizePlannerOutput: (planner: CodaliGatewayPlannerOutput, input: GatewayPlannerInput) => { planner: CodaliGatewayPlannerOutput; warnings: string[]; }; export declare class CodaliGatewayPlanner { private readonly provider; private readonly options; private readonly maxRepairAttempts; constructor(provider: Provider, options?: CodaliGatewayPlannerOptions); classify(input: GatewayPlannerInput): Promise<{ classifier: CodaliGatewayClassifierOutput; repairAttempts: number; rawContent: string; warnings: string[]; }>; plan(input: GatewayPlannerInput): Promise; private generateValidated; } export declare const createCodaliGatewayPlanner: (provider: Provider, options?: CodaliGatewayPlannerOptions) => CodaliGatewayPlanner; //# sourceMappingURL=GatewayPlanner.d.ts.map