/** * Context Pack MCP Tools * * Provides MCP tools for AI to: * - Refresh context pack (compile full context) * - Pin/unpin facts (persistent memory) * - Append/search events (activity journal) * - List/read artifacts (experiment outputs) * * Based on ADR-002: Context Pack * * NO `status: 'executed'` IN A PAYLOAD. It used to appear on five outputs here * as a constant — a literal type with one value, saying only that the call ran, * which `isError` and the wire envelope's `ok` already say. And it collided: * /call wraps a payload as {status: 'executed', ...payload, ok: true}, so the * field was indistinguishable from the envelope's own marker, and the thin * client (which strips that marker) deleted it outright. The same call answered * differently on stdio and over HTTP — S4 found it. The meaningful statuses here * ('pinned', 'unpinned', 'appended') stay: they carry domain information, and * `ok` is what tells a caller the call succeeded. */ import { CallerRole } from './dojoPolicy.js'; export interface ContextBaseInput { projectId?: string; caller_role?: CallerRole; agent_id?: string; } export interface ContextRefreshInput extends ContextBaseInput { scope?: string; sections?: string[]; max_bytes?: number; } export interface ContextRefreshOutput { context_pack: Record; } export interface ContextPinInput extends ContextBaseInput { title: string; body?: string; trust?: 'high' | 'medium' | 'low'; refs?: string[]; } export interface ContextPinOutput { status: 'pinned'; id: string; } export interface ContextUnpinInput extends ContextBaseInput { id: string; } export interface ContextUnpinOutput { status: 'unpinned'; } export interface ContextListInput extends ContextBaseInput { } export interface PinnedFact { id: string; title: string; body?: string; trust: string; refs?: string[]; pinned_at: string; } export interface ContextListOutput { facts: PinnedFact[]; } export interface EventAppendInput extends ContextBaseInput { title: string; body?: string; tags?: string[]; } export interface EventAppendOutput { status: 'appended'; event_id: string; } export interface EventSearchInput extends ContextBaseInput { query: string; limit?: number; } export interface EventRecord { id: string; title: string; body?: string; tags: string[]; timestamp: string; } export interface EventSearchOutput { results: EventRecord[]; } export interface ArtifactListInput extends ContextBaseInput { run_id: string; } export interface ArtifactInfo { name: string; size: number; ref: string; } export interface ArtifactListOutput { run_id: string; artifacts: ArtifactInfo[]; } export interface ArtifactReadInput extends ContextBaseInput { run_id: string; name: string; } export interface ArtifactReadOutput { run_id: string; name: string; content: string; mime_type: string; } export interface ContextError { status: 'error'; error: string; exitCode: number; } /** * Refresh context pack - compile full context */ export declare function contextRefresh(input: ContextRefreshInput): Promise; /** * Pin a fact to persistent memory */ export declare function contextPin(input: ContextPinInput): Promise; /** * Unpin a fact from persistent memory */ export declare function contextUnpin(input: ContextUnpinInput): Promise; /** * List pinned facts */ export declare function contextList(input: ContextListInput): Promise; /** * Append an event to the journal */ export declare function eventAppend(input: EventAppendInput): Promise; /** * Search events in the journal */ export declare function eventSearch(input: EventSearchInput): Promise; /** * List artifacts for a run */ export declare function artifactList(input: ArtifactListInput): Promise; /** * Read an artifact by run_id and name */ export declare function artifactRead(input: ArtifactReadInput): Promise; /** * Type guard for ContextError */ export declare function isContextError(result: unknown): result is ContextError; //# sourceMappingURL=context.d.ts.map