fix(events): tighten timeline and runtime contracts
This commit is contained in:
parent
edc36dae00
commit
9810ebf619
@ -81,7 +81,7 @@ describe('agent runtime contract baseline', () => {
|
||||
runId: 'run_flow_1',
|
||||
sessionId: 'sess_flow_1',
|
||||
productId: 'flowmonk',
|
||||
status: 'running',
|
||||
status: 'waiting-approval',
|
||||
startedAt: '2026-04-03T17:01:00.000Z',
|
||||
completedAt: null,
|
||||
checkpointArtifactId: 'art_plan_1',
|
||||
@ -112,6 +112,7 @@ describe('agent runtime contract baseline', () => {
|
||||
});
|
||||
|
||||
expect(dispatch.dispatchContext.dispatchMode).toBe('scheduled');
|
||||
expect(run.status).toBe('waiting-approval');
|
||||
expect(run.checkpointArtifactId).toBe('art_plan_1');
|
||||
expect(todo.status).toBe('in-progress');
|
||||
expect(actionLog.eventName).toBe('agent.run.started');
|
||||
|
||||
@ -65,6 +65,7 @@ export const AgentTodoSchema = z.object({
|
||||
export const AgentRunStatusSchema = z.enum([
|
||||
'running',
|
||||
'paused',
|
||||
'waiting-approval',
|
||||
'completed',
|
||||
'failed',
|
||||
'cancelled',
|
||||
|
||||
@ -71,6 +71,7 @@ describe('timeline contract baseline', () => {
|
||||
expect(items[1]?.title).toBe('Cowork audit report for task task_phase3');
|
||||
expect(items[2]?.summary).toBe('plan status: draft');
|
||||
expect(items[3]?.summary).toContain('microphone transcript captured');
|
||||
expect(items[0]?.relatedEventIds).toEqual(['evt_note_linked_1']);
|
||||
});
|
||||
|
||||
it('exposes a stable timeline item schema', () => {
|
||||
|
||||
@ -88,8 +88,12 @@ function summaryForEvent(event: EventLike): string | null {
|
||||
}
|
||||
|
||||
function relatedEventIdsForEvent(event: EventLike): string[] {
|
||||
return [event.trace.parentEventId, event.trace.causationId].filter(
|
||||
(value): value is string => typeof value === 'string' && value.length > 0
|
||||
return Array.from(
|
||||
new Set(
|
||||
[event.trace.parentEventId, event.trace.causationId].filter(
|
||||
(value): value is string => typeof value === 'string' && value.length > 0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user