import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; interface DecisionAllow { behavior: 'allow'; updatedInput?: Record; } interface DecisionDeny { behavior: 'deny'; message?: string; } type Decision = DecisionAllow | DecisionDeny; interface ReminderResult { ok: boolean; result?: unknown; error?: string; } type MemoResult = ReminderResult; type GoalResult = ReminderResult; type A2aOutputFile = { name: string; bytes: number; mtime: string; }; type A2aSuccess = { ok: true; result: string; jobId: number; agent: string; durationMs: number; artifactsDir?: string; outputs?: A2aOutputFile[]; warnings?: string[]; }; type A2aFailure = { ok: false; error: string; }; type A2aResult = A2aSuccess | A2aFailure; type PushResult = ReminderResult; type MemoryResult = ReminderResult; interface AskOk { ok: true; result: { index: number; label: string; via: 'button' | 'text'; raw: string; selectionMode?: 'single' | 'multi'; indexes?: number[]; labels?: string[]; customText?: string; }; } interface AskFail { ok: false; error: string; reason?: 'timeout' | 'cancelled' | 'invalid' | 'no-messenger'; } type AskResult = AskOk | AskFail; type SkillResult = ReminderResult; type NativeToolResult = ReminderResult; declare class ApprovalClient { private readonly socketPath; private readonly runId; private socket; private buf; private pending; private pendingReminders; private pendingMemos; private pendingA2A; private pendingPush; private pendingMemory; private pendingAsk; private pendingSkill; private pendingGoal; private pendingNativeTools; private connectErr; private closed; private connectPromise; constructor(socketPath: string, runId: string); private connect; private onData; private dispatch; private onClose; /** * Send an approval request and wait for the decision. If the bus is * unreachable or the connection has dropped, returns a deny synchronously. */ request(args: { toolName: string; input: Record; toolUseId: string; }): Promise; /** * Send a reminder RPC and wait for the result. Same socket as approvals, * different message type. Bus delegates to reminder-rpc.ts which actually * touches reminders.db. */ requestReminder(op: string, payload: Record): Promise; /** Stage 3 / P0 #3 — skills loader RPC. op ∈ 'read'|'list'|'refresh'. */ requestSkill(op: string, payload: Record): Promise; /** * Native tool bridge for MCP-only agents. The bus resolves runId → IM * context, asks the user to approve mutation tools, then dispatches the * native implementation inside Agim. */ requestNativeTool(name: string, args: Record): Promise; /** v1.5 — long-term memory ops via approval-bus. */ requestMemory(op: string, payload: Record): Promise; /** v1.3 — agent-initiated push to an IM thread. */ requestPush(payload: Record): Promise; /** P0 #5 — agent asks the user a question, waits for the reply. */ requestAsk(payload: Record): Promise; /** v1.2.63 — goal RPC. op ∈ 'long_task' | 'complete_goal'. */ requestGoal(op: string, payload: Record): Promise; /** Same shape as requestReminder, different message type. Bus delegates * to memo-rpc.ts which actually writes memos.db. */ requestMemo(op: string, payload: Record): Promise; /** A2A — ask the bus to invoke another agent. Bus resolves the * caller via runId → RunContext, validates depth + self-call, runs * the callee via a2a.callAgentByName, and writes back the result. * * L2 additions (all optional): * inputs — file payloads dropped into the callee's * _agim-input/ before it runs. * expectOutputs — filenames the callee is expected to produce; * misses become warnings, not failures. */ requestCallAgent(payload: { agent: string; prompt: string; timeoutMs?: number; inputs?: Array<{ name: string; fromCallerOutput: string; } | { name: string; fromAbsolutePath: string; } | { name: string; content: string; }>; expectOutputs?: string[]; }): Promise; close(): Promise; } /** * Build the MCP server. Exposed as a function (rather than top-level `await`) * so tests can construct it without spinning up stdio. */ export declare function buildServer(client: ApprovalClient): McpServer; export { ApprovalClient }; //# sourceMappingURL=mcp-approval-server.d.ts.map