web: add heartbeat and bounded reconnect tuning

This commit is contained in:
Peter Steinberger
2025-11-26 02:34:43 +01:00
parent e482e7768b
commit baf20af17f
19 changed files with 541 additions and 63 deletions

View File

@@ -36,7 +36,10 @@ function makeRunner(result: RunnerResult, capture: ReplyPayload[] = []) {
}
const enqueueImmediate = vi.fn(
async <T>(task: () => Promise<T>, opts?: { onWait?: (ms: number, ahead: number) => void }) => {
async <T>(
task: () => Promise<T>,
opts?: { onWait?: (ms: number, ahead: number) => void },
) => {
opts?.onWait?.(25, 2);
return task();
},
@@ -49,7 +52,7 @@ describe("summarizeClaudeMetadata", () => {
num_turns: 3,
total_cost_usd: 0.012345,
usage: { server_tool_use: { a: 1, b: 2 } },
modelUsage: { "claude-3": 2, "haiku": 1 },
modelUsage: { "claude-3": 2, haiku: 1 },
});
expect(meta).toContain("duration=1200ms");
expect(meta).toContain("turns=3");