Harden audio transcription arg hydration and add rewrite audit event

This commit is contained in:
William Valentin
2026-02-22 18:56:22 -08:00
parent 7d0d8abec6
commit db4e52dd7e
10 changed files with 1183 additions and 16 deletions
+6
View File
@@ -8,6 +8,7 @@ import type {
ToolErrorEvent,
ToolDeniedEvent,
ToolApprovalEvent,
ToolArgsRewrittenEvent,
SkillsInstallerExecutionBlockedEvent,
SkillsInstallerCommandResultEvent,
SkillsScanEvent,
@@ -104,6 +105,11 @@ export class AuditLogger {
this.write({ level: 'debug', event_type: 'tool.approval', event: event as unknown as Record<string, unknown> });
}
toolArgsRewritten(event: ToolArgsRewrittenEvent): void {
if (!this.shouldLog('tools', 'debug')) {return;}
this.write({ level: 'debug', event_type: 'tool.args_rewritten', event: event as unknown as Record<string, unknown> });
}
skillsInstallerExecutionBlocked(event: SkillsInstallerExecutionBlockedEvent): void {
if (!this.shouldLog('tools', 'warn')) {return;}
this.write({
+12 -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.approval'
| 'tool.start' | 'tool.success' | 'tool.error' | 'tool.denied' | 'tool.approval' | 'tool.args_rewritten'
// Security
| 'security.elevation.enabled' | 'security.elevation.disabled' | 'security.elevation.expired'
// Skills scan
@@ -110,6 +110,17 @@ export interface ToolApprovalEvent {
session_id?: string;
}
export interface ToolArgsRewrittenEvent {
tool_name: string;
session_id?: string;
source: 'latest_turn' | 'persisted' | 'history';
reason: 'latest_audio_preferred' | 'voice_turn_fallback' | 'invalid_model_args' | 'missing_model_args';
original_has_data: boolean;
original_has_url: boolean;
original_mime_type?: string;
final_mime_type?: string;
}
export interface SkillsInstallerExecutionBlockedEvent {
skill_name: string;
phase: 'install' | 'execute';