/** Terminal user choice at the approval gate. */ export type ApprovalDecision = "allow-once" | "allow-always" | "deny" | "timeout"; /** * Telemetry seam for the MCP tool approval gate. * * Injected into {@link registerToolApprovalGate} so the gate stays unit-testable * (tests pass a fake and assert on it) while production wires the real event/ * metric planes. Mirrors how `span-hooks` reaches `emitToolCalled` / * `recordToolCall` directly, and how `index.ts` emits `runtime.scanners_unwired` * through a dedicated OTel-backed `createLogger` (the plugin's own * `PluginLogger` has no `event()`). */ export interface GateTelemetry { /** * Audit EVERY gate decision — the only place the approve path is recorded, so * we know whether the user chose `allow-once` vs `allow-always` (and, for the * deny path, `deny` vs `timeout`). Emits the `tool_approval.resolved` event * (info for allows, warn for deny/timeout) + `tool_approval.decisions` metric, * so allow-always adoption and deny/timeout rates per tool are chartable. */ resolved(toolName: string, decision: ApprovalDecision, isTrade: boolean): void; /** * A user deny or a 10-minute timeout — a state-changing tool the user did NOT * authorize, so it did not run. Recorded on the origin-uniform `tool.called` * event + `tool.calls` metric with the reserved `denied` outcome, so * deny-rate and timeout-deny-rate land on the existing tool dashboards. A * timeout-deny is a product signal (the user missed the prompt and their * trade silently didn't execute). Complements {@link resolved}, which lives * on the separate gate-decision plane. */ denied(toolName: string, reason: "user_denied" | "approval_timeout"): void; /** * The gate's fail-open catch fired: the gate hit an internal bug and let the * tool through ungated. Catalogued as `tool_approval.gate_error` at error * level so it can sit behind an alert instead of a log grep. */ gateError(err: unknown, toolName: string | undefined): void; } /** Production wiring: real event + metric planes. */ export declare const defaultGateTelemetry: GateTelemetry; //# sourceMappingURL=telemetry.d.ts.map