@@ -42,6 +42,20 @@ import { NOOP_APPROVAL_LOG, type ApprovalLog, type ApprovalOutcomeKind } from ".
4242// Closes out an operator prompt: ends the wait span and records the outcome.
4343// buildRequests yields at most one request per tool call, and the two prompt
4444// sites below are mutually exclusive, so this runs once per prompt shown.
45+ function finishApprovalWait (
46+ telemetry : Telemetry ,
47+ waitSpanId : string ,
48+ tool : string ,
49+ outcome : ApprovalOutcome | undefined ,
50+ ) : void {
51+ const decision = outcome !== undefined && outcome . allow ? "allow" : "deny" ;
52+ end ( waitSpanId , outcome !== undefined ? { decision } : undefined ) ;
53+ telemetry . capture ( "permission_prompt" , {
54+ decision,
55+ permission_kind : classifyPermissionKind ( tool ) ,
56+ } ) ;
57+ }
58+
4559// Classifies a settled ApprovalOutcome into the approval-log taxonomy.
4660// gate-wire.ts's timeout/abort auto-denies carry a fixed message text (see
4761// autoDeny in gate-wire.ts and the timeout branch in tui/request-approval.ts's
@@ -58,20 +72,6 @@ function classifyOutcome(outcome: ApprovalOutcome | undefined): ApprovalOutcomeK
5872 return outcome . persist !== undefined ? "allow-with-scope" : "allow-once" ;
5973}
6074
61- function finishApprovalWait (
62- telemetry : Telemetry ,
63- waitSpanId : string ,
64- tool : string ,
65- outcome : ApprovalOutcome | undefined ,
66- ) : void {
67- const decision = outcome !== undefined && outcome . allow ? "allow" : "deny" ;
68- end ( waitSpanId , outcome !== undefined ? { decision } : undefined ) ;
69- telemetry . capture ( "permission_prompt" , {
70- decision,
71- permission_kind : classifyPermissionKind ( tool ) ,
72- } ) ;
73- }
74-
7575export type GateVerdict = { allowed : true } | { allowed : false ; reason : string } ;
7676
7777// One shell segment's forced-ask guard: a secret-path reference or a
0 commit comments