/** Shape of one jsonl line. Stable wire schema for analyzer consumption. */ export interface ReadPrimitiveCallLogEntry { /** ms since epoch when the handler was entered. */ invoked_at: number; /** Session/context_id derived via resolveEnvContextId; null if unresolvable. */ session_id: string | null; /** Tool name as registered in the MCP server (e.g. "recall_my_attribution_history"). */ primitive: string; /** * Top-level keys of the input that were set (truthy) by the caller. * Captures query shape without leaking values. Sorted lex. */ query_shape: string[]; /** * Count of record_hash values found in the response. null when the * handler errored OR the result shape is not extractable. The companion * `errored` field distinguishes the two cases for analyzer consumers. */ result_count: number | null; /** Elapsed wall time in ms from handler entry to instrumentation write. */ elapsed_ms: number; /** * Up to SAMPLE_HASH_LIMIT record_hash values from the response. The * analyzer correlates these against fires.jsonl top_k.record_hash to * answer "did surfacing drive reads?" without rebuilding result sets. */ sample_result_hashes: string[]; /** True if the handler threw / returned an error. */ errored: boolean; } /** * Wrap a read-primitive handler to log per-call instrumentation. * * Usage: * server.registerTool('recall_my_attribution_history', { ... }, * async (args) => logReadPrimitiveCall( * 'recall_my_attribution_history', * args, * async () => handlerImpl(args), * extractRecordHashes, * ), * ) */ export declare function logReadPrimitiveCall(primitive: string, args: TArgs, handler: () => Promise, extractHashes: (result: TResult) => string[]): Promise; /** * Convenience extractor: given an MCP tool response of the standard shape * { content: [{ type: 'text', text: '' }] }, parse the text and pull * record_hash-like values out via deep traversal. * * Each read primitive's response shape is different; rather than asking each * call site to write a bespoke extractor, this default walks for any string * matching sha256:<64-hex> and dedupes. Caller-supplied extractors override * when they know a tighter path (e.g. trace's visited[].record_hash). */ export declare function extractRecordHashesFromMcpResult(result: unknown): string[]; //# sourceMappingURL=read-instrumentation.d.ts.map