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