import { type LoopStopReason, type ToolCallTrace } from "./agent-loop.js"; import type { ComputeMessage, ComputeNamespace, DataProvider } from "./compute.js"; import type { EthosNamespace } from "./ethos.js"; /** * An additional MCP server the developer brings to the loop (U13). The SDK * does not own its lifecycle — pass a CONNECTED client (stdio, HTTP, or * in-memory transport, your choice) and close it yourself afterwards. */ export interface AgentMcpServer { /** Diagnostic label (collision notices, traces). */ readonly name?: string; /** A connected `@modelcontextprotocol/sdk` Client. */ readonly client: McpClientLike; } /** The slice of the MCP SDK `Client` the loop consumes (keeps fakes easy). */ export interface McpClientLike { listTools(): Promise<{ tools: ReadonlyArray<{ name: string; description?: string; inputSchema?: Record; }>; }>; callTool(params: { name: string; arguments: Record; }): Promise; } export interface AgentRunArgs { /** Mandate id — optional for owner sessions, required for delegate sessions. */ readonly mandateId?: string; /** * Subject DID whose ethos the agent reads/writes. Defaults to the signed-in * owner, or (delegate session) the mandate's subject. */ readonly subjectDid?: string; readonly model: string; /** Initial conversation (plain string turns). */ readonly messages: readonly ComputeMessage[]; readonly system?: string; /** * Subset of Aithos tool names to expose (canonical D1 names). Omit for the * host's full supported surface. Ignored when `readOnly` is set. */ readonly tools?: readonly string[]; /** Expose only non-mutating tools. */ readonly readOnly?: boolean; /** Cap on proxy turns (each is a billed call). Default 6, hard max 12. */ readonly maxIterations?: number; readonly maxTokens?: number; readonly temperature?: number; /** Optional gamma reader. Present → the canonical `data_query` tool is served. */ readonly dataProvider?: DataProvider; /** Additional MCP servers whose tools join the loop (U13). */ readonly mcpServers?: readonly AgentMcpServer[]; /** * Per-write auto-commit (pre-P2 behaviour): every write persists its own * edition immediately; `ethos_commit` / `ethos_discard` are not served. * DEFAULT IS TRANSACTIONAL (D3): writes stage on the EthosClient buffer * and the model seals them with ONE `ethos_commit` (one edition, one * batched gamma anchor). A run that ends without commit publishes nothing. */ readonly autoCommit?: boolean; readonly signal?: AbortSignal; } export interface AgentRunResult { readonly content: string; readonly stopReason: LoopStopReason; readonly iterations: number; readonly usage: { readonly inputTokens: number; readonly outputTokens: number; }; readonly toolCalls: readonly ToolCallTrace[]; /** Sum of per-turn charges (per-turn cumulative billing, unchanged). */ readonly creditsCharged: number; readonly walletBalance: number; readonly auditId: string; readonly fundedBy?: "sponsored" | "grant" | "purchase"; readonly receiptId?: string; } export interface AgentNamespaceDeps { readonly compute: ComputeNamespace; readonly ethos: EthosNamespace; } export declare class AgentNamespace { #private; constructor(deps: AgentNamespaceDeps); /** * Run an agentic conversation: per-turn inference through the compute proxy * (signed + billed per turn, idempotency unchanged), tools dispatched to an * in-process Aithos MCP server over `InMemoryTransport` — reads decrypt * locally, writes stage + publish with the session's own keys. Keys and * plaintext never leave the client; the proxy does pure inference. * * @throws {AithosSDKError} `sdk_no_signer`, `sdk_no_delegate_for_mandate`, * `network`, `http`, or any proxy code. Tool-level failures do NOT throw — * they return to the model as `tool_result.is_error` so it can recover. */ run(args: AgentRunArgs): Promise; } //# sourceMappingURL=agent.d.ts.map