/** * Permission decision span helpers. * * Tracks the full permission evaluation pipeline: * PERMISSION_REQUESTED → RULES_COLLECTED → INPUT_NORMALIZED * → POLICY_EVALUATED → MODE_EVALUATED → SESSION_OVERRIDE_EVALUATED * → SAFETY_CHECKED → DECISION_EMITTED * * One span per permission decision. Child of the active tool span * when a parentSpanId is supplied. */ import type { Span, SpanAttributes } from '../types.js'; import type { RuntimeTracer } from '../tracer.js'; /** Context supplied when starting a permission decision span. */ export interface PermissionSpanContext { /** Tool call ID this permission decision covers. */ readonly callId: string; /** Tool name being evaluated. */ readonly tool: string; /** Permission category (e.g. 'filesystem', 'network'). */ readonly category: string; /** Trace ID for cross-span correlation. */ readonly traceId: string; /** * Optional parent span ID for nesting under a tool span. * When provided, this permission span becomes a child of the tool span. */ readonly parentSpanId?: string | undefined; } /** Phase transitions recordable on a permission decision span. */ export type PermissionPhase = 'rules_collected' | 'input_normalized' | 'policy_evaluated' | 'mode_evaluated' | 'session_override_evaluated' | 'safety_checked'; /** Result context supplied when ending a permission decision span. */ export interface PermissionSpanEndContext { /** Whether the tool call was approved. */ readonly approved: boolean; /** Decision source (e.g. 'policy', 'mode', 'session_override', 'safety'). */ readonly source: string; /** Whether the input was deemed safe. */ readonly safe?: boolean | undefined; /** Safety warnings if any were raised. */ readonly warnings?: string[] | undefined; } /** * Start a permission decision span. * * @param tracer - RuntimeTracer instance. * @param ctx - Context from PERMISSION_REQUESTED event. */ export declare function startPermissionSpan(tracer: RuntimeTracer, ctx: PermissionSpanContext): Span; /** * Record a permission evaluation phase transition. * * @param span - The active permission decision span. * @param phase - The phase reached. * @param attrs - Optional additional attributes. */ export declare function recordPermissionPhase(span: Span, phase: PermissionPhase, attrs?: SpanAttributes): void; /** * End a permission decision span. * * @param span - The span returned by `startPermissionSpan`. * @param ctx - Permission decision end context. */ export declare function endPermissionSpan(span: Span, ctx: PermissionSpanEndContext): void; //# sourceMappingURL=permission.d.ts.map