import { attachMcpTools } from "../connectors/mcp/McpToolSource.js"; import { type ImageGenerationConfig } from "../connectors/media/ImageGenerationTool.js"; import { createProviderForAssignment } from "../gateway/LocalGatewayProvider.js"; import { getAgentInventory } from "../agents/AgentInventory.js"; import { ToolRegistry } from "../tools/ToolRegistry.js"; import type { RunContext } from "../runcontext/RunContextResolver.js"; import type { CodaliArtifactRef, CodaliGatewayMode, CodaliGatewaySource, CodaliGatewayStatus } from "../gateway/CodaliGatewayTypes.js"; /** * The canonical Codali API. * * This is the contract products integrate against — okacam AI chat, line items, * badges, employee daily-log review. One entry point, one result shape, the * same behaviour the CLI gets, so a product never has to reimplement routing, * tool selection, evidence handling, or budget enforcement. * * Everything a run is allowed to touch arrives on the request as `runContext`. * Codali does not call back into the host to fetch tenant configuration: the * authenticated host already holds it, and a callback would make every request * a circular distributed dependency. */ export interface CodaliMessage { role: "system" | "user" | "assistant"; content: string; } export interface CodaliRequest { messages: CodaliMessage[]; /** Tenant scope, tools, credentials, agent bindings, limits. */ runContext?: RunContext; /** * Permits falling back to the operator's own configuration when no context * is supplied — `~/.codali/config.json` and `~/.codali/.creds`. * * Off by default, and it must stay that way. Those files hold the operator's * GitHub, Jira and Microsoft tokens, so a tenant request that forgot its * context would be answered from the wrong account. It would not error: it * would return a plausible answer against someone else's data, and in * development, where the operator is the tenant, it would look correct. * * Set it only where the caller genuinely is the operator: the CLI, and a * server the operator runs for themselves. */ allowOperatorConfigFallback?: boolean; /** JSON Schema the answer must satisfy. Enforced, with one repair attempt. */ responseSchema?: Record; responseMode?: "text" | "json" | "artifact"; mode?: CodaliGatewayMode; /** Workspace the run resolves paths against. Defaults to `process.cwd()`. */ workspaceRoot?: string; requestId?: string; product?: { name?: string; version?: string; surface?: string; }; /** Image generation config; absent means the media tool is not offered. */ media?: ImageGenerationConfig; budgets?: { maxRounds?: number; maxToolCalls?: number; maxModelCalls?: number; deadlineMs?: number; }; } export interface CodaliSourceRef extends CodaliGatewaySource { } export interface CodaliResult { status: CodaliGatewayStatus; /** Text answer, or the clarifying question when status is needs_clarification. */ answer: string; /** Schema-conformant structured output when a responseSchema was supplied. */ output: unknown; sources: CodaliSourceRef[]; artifacts: CodaliArtifactRef[]; warnings: string[]; traceId: string; } /** Flattens a message list into the single query the gateway plans against. */ export declare const messagesToQuery: (messages: readonly CodaliMessage[]) => string; export interface CodaliRunDependencies { loadInventory?: typeof getAgentInventory; resolveRunContext?: (workspaceRoot: string) => Promise; buildRegistry?: (workspaceRoot: string, context: RunContext) => ToolRegistry; createProvider?: typeof createProviderForAssignment; attachMcp?: typeof attachMcpTools; } /** * Runs one Codali request end to end. * * The same code path the CLI uses, so a product and the terminal cannot drift. */ export declare const runCodali: (request: CodaliRequest, deps?: CodaliRunDependencies) => Promise; //# sourceMappingURL=CodaliApi.d.ts.map