/** * Default per-field character cap when serializing content text. Bounds * the contribution of any single content field so a giant tool_call args * payload cannot dominate the BM25 corpus (or blow up an embedding pipeline * by tokenizing megabytes of code). 2048 chars is empirically chosen to * preserve most natural-language content while truncating large blobs. */ export declare const DEFAULT_FIELD_CAP = 2048; export interface ExtractIndexableTextOptions { /** Maximum characters drawn from any single content field (default 2048). */ fieldCap?: number; } /** * Observation content per the EmitInput Zod schema in services/atrib-emit. * Indexable fields: `what`, `why_noted`, `intent`, `rationale`, `topics`. * `informed_by` is a list of sha256 record_hash refs (not human-readable * text) and is omitted from the indexable surface. */ export interface ObservationContent { what?: unknown; why_noted?: unknown; intent?: unknown; rationale?: unknown; topics?: unknown; informed_by?: unknown; source?: unknown; span_kind?: unknown; span_name?: unknown; trace_id?: unknown; span_id?: unknown; tool_name?: unknown; input?: unknown; output?: unknown; agent_name?: unknown; model_name?: unknown; prompt?: unknown; prompt_messages?: unknown; prompt_tools?: unknown; prompt_tool_choice?: unknown; prompt_template?: unknown; prompt_template_variables?: unknown; prompt_version?: unknown; prompt_id?: unknown; prompt_url?: unknown; invocation_parameters?: unknown; usage_details?: unknown; cost_details?: unknown; score_details?: unknown; metadata?: unknown; } /** * Annotation content per services/atrib-annotate. The agent (or a separate * curator) tags a past record with `importance` + `summary` + `topics`. * `annotates` is a sha256 ref to the target record and is omitted from the * indexable surface. */ export interface AnnotationContent { annotates?: unknown; importance?: unknown; summary?: unknown; topics?: unknown; } /** * Revision content per services/atrib-revise. The agent supersedes a prior * position with a stated reason; indexable fields are `prior_position`, * `new_position`, `reason`, `topics`. `revises` is a sha256 ref and is * omitted from the indexable surface. */ export interface RevisionContent { revises?: unknown; prior_position?: unknown; new_position?: unknown; reason?: unknown; topics?: unknown; } /** * Tool-call content per @atrib/mcp wrapper. The wrapper signs each MCP * tool invocation; sidecar typically carries tool_name + args + result. * Args and result are accepted under several legacy field names because * different host frameworks (Claude Agent SDK, Vercel AI SDK, LangChain) * historically wrote different keys. JSON-stringified args/result are * truncated to the field cap per `ExtractIndexableTextOptions.fieldCap`. */ export interface ToolCallContent { tool_name?: unknown; args?: unknown; input?: unknown; arguments?: unknown; result?: unknown; output?: unknown; response?: unknown; } /** * Transaction content per payment-protocol adapters (x402, ACP, UCP, etc.). * Counterparty + memo are typically the most indexable fields; amounts are * numeric and don't tokenize usefully so they're omitted. */ export interface TransactionContent { counterparty?: unknown; recipient?: unknown; merchant?: unknown; to?: unknown; memo?: unknown; description?: unknown; protocol?: unknown; via?: unknown; } /** * Directory-anchor content per directory operators (spec §6.2.4). Mostly * structural (tree_root, epoch_id); indexable text is minimal but preserved * for completeness so anchors are at least surface-able by tree_root. */ export interface DirectoryAnchorContent { tree_root?: unknown; root?: unknown; epoch_id?: unknown; } /** * Extract indexable text from a sidecar content payload. * * Dispatches on the event_type URI to the per-event_type extractor for * normative event types; falls back to a recursive string-walk for * extension URIs. Returns `""` when content is undefined / not an object / * structurally malformed (silent failure per §5.8 degradation). * * Suitable for tokenization (BM25, embeddings) or for display synthesis. * Per-field length caps prevent giant tool_call payloads from dominating * the corpus. * * @param eventTypeUri - the record's `event_type` field (absolute URI per §1.2.4) * @param content - the D062 sidecar `_local.content` payload (typed * `unknown` because shape varies per event_type; * runtime shape-checking handles malformed input) * @param opts.fieldCap - max characters per single content field (default 2048) */ export declare function extractIndexableText(eventTypeUri: string, content: unknown, opts?: ExtractIndexableTextOptions): string; export declare function extractObservationText(c: ObservationContent, cap: number): string; export declare function extractAnnotationText(c: AnnotationContent, cap: number): string; export declare function extractRevisionText(c: RevisionContent, cap: number): string; export declare function extractToolCallText(c: ToolCallContent, cap: number): string; export declare function extractTransactionText(c: TransactionContent, cap: number): string; export declare function extractDirectoryAnchorText(c: DirectoryAnchorContent, cap: number): string; //# sourceMappingURL=content-shapes.d.ts.map