feat(observer): emit chain_ref in primary_rationale

This commit is contained in:
Дмитрий
2026-05-21 04:48:21 +03:00
parent 28671cb012
commit f943b229c0
2 changed files with 28 additions and 0 deletions
+19
View File
@@ -106,6 +106,25 @@ describe('parseTranscript', () => {
expect(parseTranscript(t).primary_rationale.node_chosen).toBe('direct');
});
it('attaches chain_ref for a node that belongs to a chain', () => {
const t = jsonl([
userPrompt('go', '2026-05-19T10:00:00Z'),
assistantTurn(
[{ type: 'tool_use', id: 't1', name: 'Skill', input: { skill: 'billing-audit' } }],
'2026-05-19T10:01:00Z'
),
]);
expect(parseTranscript(t).primary_rationale.chain_ref).toEqual(['L13']);
});
it('sets chain_ref null for a direct episode', () => {
const t = jsonl([
userPrompt('go', '2026-05-19T10:00:00Z'),
assistantTurn([{ type: 'tool_use', id: 't1', name: 'Read', input: {} }], '2026-05-19T10:01:00Z'),
]);
expect(parseTranscript(t).primary_rationale.chain_ref).toBeNull();
});
it('hard_floor invoked when a superpowers skill is used', () => {
const t = jsonl([
userPrompt('go', '2026-05-19T10:00:00Z'),