feat(audit): add correlation ids and redaction

This commit is contained in:
William Valentin
2026-02-15 10:16:58 -08:00
parent 67058c8719
commit 28304ac397
3 changed files with 167 additions and 1 deletions
+28 -1
View File
@@ -2,7 +2,7 @@ export type AuditLevel = 'debug' | 'info' | 'warn' | 'error';
export type AuditEventType =
// Tool execution
| 'tool.start' | 'tool.success' | 'tool.error' | 'tool.denied'
| 'tool.start' | 'tool.success' | 'tool.error' | 'tool.denied' | 'tool.approval'
// Skills installer
| 'skills.installer.execution_blocked' | 'skills.installer.command_result'
// Session lifecycle
@@ -49,6 +49,10 @@ export interface AuditQuery {
export interface ToolStartEvent {
tool_name: string;
tool_args: unknown;
execution_id?: string;
execution_environment?: 'host' | 'sandbox';
skill_name?: string;
redactions_applied?: number;
session_id?: string;
channel?: string;
sender?: string;
@@ -59,6 +63,10 @@ export interface ToolSuccessEvent {
tool_name: string;
result: { success: boolean; output: string; error?: string };
duration_ms: number;
execution_id?: string;
execution_environment?: 'host' | 'sandbox';
skill_name?: string;
redactions_applied?: number;
session_id?: string;
}
@@ -67,16 +75,35 @@ export interface ToolErrorEvent {
error: string;
duration_ms: number;
reason?: string;
execution_id?: string;
execution_environment?: 'host' | 'sandbox';
skill_name?: string;
redactions_applied?: number;
session_id?: string;
}
export interface ToolDeniedEvent {
tool_name: string;
reason: string;
execution_id?: string;
execution_environment?: 'host' | 'sandbox';
skill_name?: string;
redactions_applied?: number;
session_id?: string;
denial_type: 'policy' | 'hook' | 'not_found' | 'autonomy_override';
}
export interface ToolApprovalEvent {
tool_name: string;
approved: boolean;
reason?: string;
execution_id?: string;
execution_environment?: 'host' | 'sandbox';
skill_name?: string;
redactions_applied?: number;
session_id?: string;
}
export interface SkillsInstallerExecutionBlockedEvent {
skill_name: string;
phase: 'install' | 'execute';