feat(subagents): complete queue, budgets, audit, and inspection controls

This commit is contained in:
William Valentin
2026-02-26 13:28:10 -08:00
parent b679261683
commit 3cc9e16ef5
23 changed files with 741 additions and 51 deletions
+26
View File
@@ -123,6 +123,26 @@ describe('AuditLogger', () => {
reason: 'no_match',
candidate_count: 4,
});
logger.subagentLifecycle({
parent_session_id: 'telegram:123',
subagent_id: 'planner',
trace_id: 'trace-planner',
action: 'spawn',
agent: 'research',
tier: 'complex',
queue_mode: 'followup',
tool_profile: 'minimal',
});
logger.subagentTurn({
parent_session_id: 'telegram:123',
subagent_id: 'planner',
trace_id: 'trace-planner',
action: 'complete',
queue_mode: 'followup',
duration_ms: 88,
input_chars: 42,
output_chars: 120,
});
await logger.close();
await waitForFlush();
@@ -135,6 +155,8 @@ describe('AuditLogger', () => {
expect(eventTypes).toContain('run.cancel');
expect(eventTypes).toContain('reaction.match');
expect(eventTypes).toContain('reaction.skip');
expect(eventTypes).toContain('subagent.lifecycle');
expect(eventTypes).toContain('subagent.turn');
const runError = events.find((event) => (
event.event_type === 'run.state'
@@ -145,6 +167,10 @@ describe('AuditLogger', () => {
const reactionSkip = events.find((event) => event.event_type === 'reaction.skip');
expect(reactionSkip?.level).toBe('debug');
expect(reactionSkip?.event.reason).toBe('no_match');
const subagentLifecycle = events.find((event) => event.event_type === 'subagent.lifecycle');
expect(subagentLifecycle?.level).toBe('info');
expect(subagentLifecycle?.event.action).toBe('spawn');
} finally {
if (previousHome === undefined) {
delete process.env.HOME;