refactor: split Claude agent runner entrypoint (#200)

This commit is contained in:
Eyejoker
2026-05-30 01:47:41 +09:00
committed by GitHub
parent 35988d9797
commit 1531482363
8 changed files with 864 additions and 705 deletions

View File

@@ -0,0 +1,35 @@
import { describe, expect, it, vi } from 'vitest';
import { compactBoundaryFromMessage } from '../src/compaction-boundary.js';
describe('compactBoundaryFromMessage', () => {
it('extracts compact boundary metadata from SDK system messages', () => {
const log = vi.fn();
const compaction = compactBoundaryFromMessage(
{
type: 'system',
subtype: 'compact_boundary',
compact_metadata: {
trigger: 'manual',
pre_tokens: 1234,
},
},
log,
);
expect(compaction).toEqual({
completed: true,
trigger: 'manual',
});
expect(log).toHaveBeenCalledWith(
'Compact boundary — trigger=manual pre_tokens=1234',
);
});
it('ignores unrelated SDK messages', () => {
expect(
compactBoundaryFromMessage({ type: 'assistant' }, vi.fn()),
).toBeUndefined();
});
});