/** * _meta emission for local-mcp-toolbelt tool responses. * * Keys are namespaced under the reverse-DNS prefix `dev.localmcptoolbelt/*`, * matching the MCP SDK's own convention (`io.modelcontextprotocol/related-task` * in types.d.ts L6/L40). This avoids collision with future MCP spec additions * or other MCP servers mounted side-by-side. * * Always-emitted keys (every tool call): * dev.localmcptoolbelt/model — resolved model id (`mlx-http:`) * dev.localmcptoolbelt/tier — tier key: "B" | "C" * dev.localmcptoolbelt/latency_ms — end-to-end wall-clock ms * dev.localmcptoolbelt/prompt_tokens — prompt token count * dev.localmcptoolbelt/completion_tokens — completion token count * * Conditional keys (set only when the relevant feature ran): * dev.localmcptoolbelt/defender/tier — "1" | "1+2" | "off" * dev.localmcptoolbelt/defender/score — Tier-2 float score (if ran) * dev.localmcptoolbelt/defender/risk — Tier-1 risk level (if flagged) * dev.localmcptoolbelt/schema_validation — "passed" | "failed" (F2 only) * dev.localmcptoolbelt/schema_stripped — string[] of stripped constraints * dev.localmcptoolbelt/saved_input_tokens_estimate * — rough token savings estimate when * source_uri was used (F5/F2). * Formula: floor(sourceBytes/4) - completionTokens. * Only present when source_uri was supplied. */ import type { ChatResult } from '../llm/backend.js'; import type { Tier } from '../config/tiers.js'; export declare const META_NS: "dev.localmcptoolbelt"; /** Input for buildMeta(). Always-required fields + optional conditional ones. */ export interface MetaInput { /** Resolved model tag (e.g. "qwen3:4b-instruct-2507-q4_K_M"). */ model: string; /** Tier key used for routing ("B" | "C"). */ tier: Tier; /** End-to-end wall-clock latency in milliseconds. */ latencyMs: number; /** Token counts from the model response. */ result: Pick; defender?: { /** Which tiers of @stackone/defender ran. */ tier: '1' | '1+2' | 'off'; /** Tier-2 MiniLM float confidence score (0-1), if Tier-2 ran. */ score?: number; /** Tier-1 risk level string if an injection was detected. */ risk?: string; }; /** Whether the sanitized-schema output passed a full Zod safeParse. */ schemaValidation?: 'passed' | 'failed'; /** List of JSON schema constraint keys that were stripped before forwarding. */ schemaStripped?: string[]; /** * Estimated tokens saved by having the bridge read source directly via * source_uri (F2) instead of the frontier passing the full text as a * tool argument. Formula: floor(sourceBytes / 4) − completionTokens. * Only set when source_uri was used; undefined otherwise (footer omits field). */ savedInputTokensEstimate?: number; /** Stats from a map-reduce chunked summarize job. Set only by `summarize-long-chunked`. */ chunked?: { /** Number of chunks the source was split into. 1 means fast-path was taken. */ chunksProcessed: number; /** REDUCE pass count (0 for fast-path; ≥1 for normal flow). */ reduceDepth: number; /** True when recursion hit MAX_RECURSION_DEPTH and the result is incomplete. */ partial: boolean; /** Chunks whose MAP call timed out or errored. */ chunksFailed: number; /** REDUCE-pass calls that timed out or errored. */ reduceFailed: number; }; } /** * Build the `_meta` record for a tool response. * Returns a plain object with string keys; caller spreads it into the MCP * response as `{ content: [...], _meta: buildMeta(input) }`. */ export declare function buildMeta(input: MetaInput): Record; //# sourceMappingURL=meta.d.ts.map