import type { V2Registration } from "./v2-types.js"; /** * The v2 host's real tool surface — observed, not assumed. * * Why this exists: every decision on the v2 line is currently being made against * a DESCRIPTION of the host (does `permission.evaluate` fire for `shell`? what are * the native browser tools named, and do their calls reach our hooks at all? is * the native `read` output reachable from `execute.after`?), and the type package * this repo has installed is 1.18.25 while the host that runs is 2.0.16. Reading * node_modules cannot answer a question about a different build. * * So this module asks the running host and writes down what it says. It registers * the same hooks the guards register, mutates NOTHING, and reports only NAMES: * tool ids, agent ids, action ids, the key names of an input object, the COUNT of * resources plus whether any of them parses as a URL. It never records a resource * VALUE, a command line, a path or an env face — the same privacy red line the R6 * audit log holds itself to (tool name + category + verdict, never content). A * diagnostic that leaked the user's command lines into a probe file would be a * worse bug than the one it was written to answer. * * The file dump is off unless `TM_V2_PROBE` names one. The name sets fill either * way and a compact snapshot rides the trajectory, because that is what lets * `tm_stats` answer "which half of the plugin is running, and what did it see" * from inside a session — and the snapshot is written WHILE THE PROCESS LIVES, not * only from its cleanup: a first live run proved a hard exit never reaches * `dispose`, so counters that only land at teardown are counters that do not exist. */ export interface V2ProbeReport { /** agent ids seen in a session context */ agentsSeen: string[]; toolNames: string[]; /** ids reaching tool.execute.before / after */ executed: string[]; executedAfter: string[]; /** actions reaching permission.evaluate */ actions: string[]; /** shape facts about the message list a request carries: how many messages, how * many look like the host's injected `` envelope, * and how long the biggest one is. LENGTHS ONLY — the body of a sub-agent reply * is the most private payload in the product, which is exactly why Plan B keeps * it off disk. This is what decides whether the v2 offload has anything to hook * onto, and it must not be guessed from the v1 shape. */ messages: number; taskEnvelopes: number; maxEnvelopeChars: number; /** key names of the first messages the context hook carried (shape, not text) */ messageShapes: Array>; /** which host envelope spellings were seen — "v1-task" vs "v2-subagent" */ envelopeForms: Set; /** permission evaluations whose resources carried a URL (count, never the URL) */ urlResources: number; evaluations: number; /** hook points the ctx did not expose — a missing entry is a host fact */ hooksMissing: string[]; /** the ctx domains the host actually handed us. This is what decides whether an * event-driven rebuild is even possible: a plugin cannot subscribe to a channel * that was never given, and "we should rebuild tm_join on ctx.event" is only a * plan if ctx.event exists. */ ctxDomains: string[]; /** whether TM_V2_PROBE reached THIS process. Without this line, "no browser * tools were seen" and "nobody was listening" are the same answer. */ probeTarget: string; lines: number; } export interface V2Probe { readonly enabled: boolean; readonly report: V2ProbeReport; readonly registrations: V2Registration[]; /** Push the current counters to `onSummary`. Throttled unless `force` — this is * called from the session context hook, which fires before EVERY model request. */ flush: (force?: boolean) => void; } interface ProbeOptions { env?: Record; /** safety valve: a pathological session must not fill a disk */ maxLines?: number; /** where a throttled snapshot goes (the trajectory) */ onSummary?: (summary: Record) => void; flushMs?: number; } export declare function applyV2Probe(ctx: unknown, opts?: ProbeOptions): Promise; /** Compact form for the trajectory — names are safe, values never are. */ export declare function probeSummary(report: V2ProbeReport): Record; export {}; //# sourceMappingURL=v2-probe.d.ts.map