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,29 @@
import {
compactBoundaryOutput,
type RunnerCompaction,
} from './output-protocol.js';
export function compactBoundaryFromMessage(
message: unknown,
log: (message: string) => void,
): RunnerCompaction | undefined {
if (
!(
typeof message === 'object' &&
message !== null &&
(message as { type?: string }).type === 'system' &&
(message as { subtype?: string }).subtype === 'compact_boundary'
)
) {
return undefined;
}
const meta = (
message as {
compact_metadata?: { trigger?: string; pre_tokens?: number };
}
).compact_metadata;
log(
`Compact boundary — trigger=${meta?.trigger || '?'} pre_tokens=${meta?.pre_tokens ?? '?'}`,
);
return compactBoundaryOutput(meta?.trigger);
}