65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
|
|
import { buildSubagentProjectionForEntry } from '../src/modules/netaclaw/session-tree/subagent_projection.js';
|
||
|
|
import type { SessionTreeEntry } from '../src/modules/netaclaw/session-tree/types.js';
|
||
|
|
|
||
|
|
describe('session tree subagent task replay projection', () => {
|
||
|
|
it('omits tool call and result events from task replay after folding them into tool executions', () => {
|
||
|
|
const entry: SessionTreeEntry = {
|
||
|
|
id: 'entry-result',
|
||
|
|
parentId: 'parent',
|
||
|
|
timestamp: '2026-04-22T10:00:00.000Z',
|
||
|
|
type: 'subagent_result',
|
||
|
|
content: {
|
||
|
|
batchId: 'batch-task-replay',
|
||
|
|
status: 'completed',
|
||
|
|
parentEntryId: 'parent',
|
||
|
|
results: [
|
||
|
|
{
|
||
|
|
id: 11,
|
||
|
|
status: 'completed',
|
||
|
|
summary: 'done',
|
||
|
|
resultPayload: {
|
||
|
|
processEvents: [
|
||
|
|
{
|
||
|
|
type: 'run_start',
|
||
|
|
runId: 'subagent-11',
|
||
|
|
timestamp: '2026-04-22T10:00:01.000Z',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'tool_call',
|
||
|
|
runId: 'subagent-11',
|
||
|
|
timestamp: '2026-04-22T10:00:02.000Z',
|
||
|
|
toolCallId: 'call-images',
|
||
|
|
name: 'bash',
|
||
|
|
args: { command: 'find ~/Desktop -maxdepth 1 -type f -iname "*.jpg"' },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'tool_result',
|
||
|
|
runId: 'subagent-11',
|
||
|
|
timestamp: '2026-04-22T10:00:03.000Z',
|
||
|
|
toolCallId: 'call-images',
|
||
|
|
name: 'bash',
|
||
|
|
result: '111.jpg',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'token',
|
||
|
|
runId: 'subagent-11',
|
||
|
|
timestamp: '2026-04-22T10:00:04.000Z',
|
||
|
|
text: 'done',
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
const projection = buildSubagentProjectionForEntry(entry);
|
||
|
|
|
||
|
|
expect(projection?.taskPanels[0].toolExecutions).toHaveLength(1);
|
||
|
|
expect(projection?.taskPanels[0].processEvents.map(event => event.type)).toEqual([
|
||
|
|
'run_start',
|
||
|
|
'token',
|
||
|
|
]);
|
||
|
|
});
|
||
|
|
});
|