/** * Per-async-frame metadata identifying which extension triggered the current * execution path and whether that path was initiated by a user action (slash * command) or by a hook auto-firing. Read by the LLM-call telemetry wrapper * so each ext_llm_calls row can answer "who burned these tokens, and was the * user aware?". */ export interface ExtCallerContext { extensionName: string; /** * Short scope label, e.g. "command:/recap --smart" or "hook:before_agent_start". * Format is consumer-readable; bounded length (≤128 chars). */ callerContext: string; /** * True when the path was initiated by the user typing a slash command; * false when the path was initiated by an extension hook auto-firing. * This is the field SQL dashboards group on to catch idle-thinking-class * bugs (hooks silently calling LLMs the user never asked for). */ isUserInitiated: boolean; sessionId?: string | null; runId?: string | null; variant?: string | null; } /** * Run `fn` with `ctx` accessible to any descendant async frame via * getExtCallerContext(). The context is automatically cleared when the * returned promise settles. */ export declare function runWithExtCallerContext(ctx: ExtCallerContext, fn: () => Promise | T): Promise; export declare function getExtCallerContext(): ExtCallerContext | undefined;