@ai-devkit/agent-manager 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -3
- package/.swcrc +0 -27
- package/dist/__tests__/AgentManager.test.js +0 -1727
- package/dist/__tests__/AgentManager.test.js.map +0 -1
- package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js +0 -486
- package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js.map +0 -1
- package/dist/__tests__/adapters/adapterProcessImports.test.js +0 -52
- package/dist/__tests__/adapters/adapterProcessImports.test.js.map +0 -1
- package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js +0 -247
- package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js.map +0 -1
- package/dist/__tests__/capacity/anthropic.test.js +0 -115
- package/dist/__tests__/capacity/anthropic.test.js.map +0 -1
- package/dist/__tests__/capacity/boundaries.test.js +0 -45
- package/dist/__tests__/capacity/boundaries.test.js.map +0 -1
- package/dist/__tests__/capacity/claude.test.js +0 -485
- package/dist/__tests__/capacity/claude.test.js.map +0 -1
- package/dist/__tests__/capacity/codex.test.js +0 -339
- package/dist/__tests__/capacity/codex.test.js.map +0 -1
- package/dist/__tests__/capacity/devin.test.js +0 -239
- package/dist/__tests__/capacity/devin.test.js.map +0 -1
- package/dist/__tests__/capacity/index.test.js +0 -53
- package/dist/__tests__/capacity/index.test.js.map +0 -1
- package/dist/__tests__/capacity/openai.test.js +0 -687
- package/dist/__tests__/capacity/openai.test.js.map +0 -1
- package/dist/__tests__/capacity/wham.test.js +0 -159
- package/dist/__tests__/capacity/wham.test.js.map +0 -1
- package/dist/__tests__/capacity/zai.test.js +0 -212
- package/dist/__tests__/capacity/zai.test.js.map +0 -1
- package/dist/__tests__/fixtures.test.js +0 -218
- package/dist/__tests__/fixtures.test.js.map +0 -1
- package/dist/__tests__/harnesses/BoundedSummarySkip.test.js +0 -568
- package/dist/__tests__/harnesses/BoundedSummarySkip.test.js.map +0 -1
- package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js +0 -1089
- package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js.map +0 -1
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js +0 -143
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js.map +0 -1
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js +0 -462
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/builtinAdapters.test.js +0 -33
- package/dist/__tests__/harnesses/builtinAdapters.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js +0 -79
- package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js +0 -1881
- package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js +0 -425
- package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js +0 -314
- package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js +0 -49
- package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js +0 -76
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js +0 -173
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js +0 -181
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexAdapter.test.js +0 -685
- package/dist/__tests__/harnesses/codex/CodexAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js +0 -463
- package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js +0 -86
- package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js +0 -254
- package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js +0 -121
- package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js +0 -84
- package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js +0 -128
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js +0 -246
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js +0 -384
- package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js +0 -659
- package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js +0 -290
- package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinAdapter.test.js +0 -597
- package/dist/__tests__/harnesses/devin/DevinAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js +0 -99
- package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js +0 -192
- package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js +0 -407
- package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/fixtures.js +0 -95
- package/dist/__tests__/harnesses/devin/fixtures.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js +0 -1454
- package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js +0 -491
- package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js +0 -399
- package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js +0 -56
- package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js +0 -421
- package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js +0 -167
- package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js +0 -133
- package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js +0 -301
- package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js +0 -662
- package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseAdapter.test.js +0 -247
- package/dist/__tests__/harnesses/muse/MuseAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js +0 -81
- package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js +0 -185
- package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js +0 -328
- package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js +0 -213
- package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js +0 -108
- package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js +0 -94
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js +0 -147
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiAdapter.test.js +0 -367
- package/dist/__tests__/harnesses/pi/PiAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js +0 -382
- package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiSessionParser.test.js +0 -416
- package/dist/__tests__/harnesses/pi/PiSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js +0 -108
- package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js +0 -70
- package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js +0 -43
- package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js +0 -192
- package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js +0 -119
- package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js +0 -382
- package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js +0 -34
- package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js +0 -446
- package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js.map +0 -1
- package/dist/__tests__/harnesses/runtimeProfiles.test.js +0 -101
- package/dist/__tests__/harnesses/runtimeProfiles.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgent.test.js +0 -15
- package/dist/__tests__/print/DurableAgent.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js +0 -186
- package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgentRepository.test.js +0 -249
- package/dist/__tests__/print/DurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/readiness-fixtures.test.js +0 -54
- package/dist/__tests__/readiness-fixtures.test.js.map +0 -1
- package/dist/__tests__/runtime/AgentRuntime.test.js +0 -13
- package/dist/__tests__/runtime/AgentRuntime.test.js.map +0 -1
- package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js +0 -164
- package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js.map +0 -1
- package/dist/__tests__/runtime/HerdrAgentRuntime.test.js +0 -488
- package/dist/__tests__/runtime/HerdrAgentRuntime.test.js.map +0 -1
- package/dist/__tests__/runtime/ManagedAgentRuntime.test.js +0 -637
- package/dist/__tests__/runtime/ManagedAgentRuntime.test.js.map +0 -1
- package/dist/__tests__/terminal/GhosttyBackend.test.js +0 -334
- package/dist/__tests__/terminal/GhosttyBackend.test.js.map +0 -1
- package/dist/__tests__/terminal/TerminalFocusManager.test.js +0 -253
- package/dist/__tests__/terminal/TerminalFocusManager.test.js.map +0 -1
- package/dist/__tests__/terminal/TmuxManager.test.js +0 -168
- package/dist/__tests__/terminal/TmuxManager.test.js.map +0 -1
- package/dist/__tests__/terminal/TtyWriter.test.js +0 -386
- package/dist/__tests__/terminal/TtyWriter.test.js.map +0 -1
- package/dist/__tests__/utils/AgentRegistry.test.js +0 -636
- package/dist/__tests__/utils/AgentRegistry.test.js.map +0 -1
- package/dist/__tests__/utils/IncrementalJsonlSummary.test.js +0 -650
- package/dist/__tests__/utils/IncrementalJsonlSummary.test.js.map +0 -1
- package/dist/__tests__/utils/agent-requests.test.js +0 -90
- package/dist/__tests__/utils/agent-requests.test.js.map +0 -1
- package/dist/__tests__/utils/conversationTail.bench.test.js +0 -258
- package/dist/__tests__/utils/conversationTail.bench.test.js.map +0 -1
- package/dist/__tests__/utils/conversationTailParity.test.js +0 -588
- package/dist/__tests__/utils/conversationTailParity.test.js.map +0 -1
- package/dist/__tests__/utils/jsonlTail.test.js +0 -360
- package/dist/__tests__/utils/jsonlTail.test.js.map +0 -1
- package/dist/__tests__/utils/matching.test.js +0 -324
- package/dist/__tests__/utils/matching.test.js.map +0 -1
- package/dist/__tests__/utils/matchingConstants.test.js +0 -35
- package/dist/__tests__/utils/matchingConstants.test.js.map +0 -1
- package/dist/__tests__/utils/process.test.js +0 -818
- package/dist/__tests__/utils/process.test.js.map +0 -1
- package/dist/__tests__/utils/session.test.js +0 -175
- package/dist/__tests__/utils/session.test.js.map +0 -1
- package/project.json +0 -29
- package/scripts/benchmark-cold-start.mjs +0 -350
- package/src/AgentManager.ts +0 -559
- package/src/__tests__/AgentManager.test.ts +0 -1578
- package/src/__tests__/adapters/IncrementalSessionRefresh.test.ts +0 -437
- package/src/__tests__/adapters/adapterProcessImports.test.ts +0 -58
- package/src/__tests__/adapters/adapterSnapshotCandidates.test.ts +0 -243
- package/src/__tests__/capacity/anthropic.test.ts +0 -105
- package/src/__tests__/capacity/boundaries.test.ts +0 -36
- package/src/__tests__/capacity/claude.test.ts +0 -462
- package/src/__tests__/capacity/codex.test.ts +0 -311
- package/src/__tests__/capacity/devin.test.ts +0 -210
- package/src/__tests__/capacity/fixtures/claude-credentials.json +0 -7
- package/src/__tests__/capacity/fixtures/claude-usage-malformed.json +0 -1
- package/src/__tests__/capacity/fixtures/claude-usage-partial.json +0 -15
- package/src/__tests__/capacity/fixtures/claude-usage.json +0 -63
- package/src/__tests__/capacity/fixtures/devin-config.json +0 -6
- package/src/__tests__/capacity/fixtures/devin-credentials.toml +0 -4
- package/src/__tests__/capacity/fixtures/devin-quota-nonplan.json +0 -5
- package/src/__tests__/capacity/fixtures/devin-quota.json +0 -10
- package/src/__tests__/capacity/fixtures/openai-auth.json +0 -6
- package/src/__tests__/capacity/fixtures/openai-codex-auth.json +0 -9
- package/src/__tests__/capacity/fixtures/openai-usage-completions.json +0 -67
- package/src/__tests__/capacity/fixtures/openai-usage-responses.json +0 -20
- package/src/__tests__/capacity/fixtures/wham-usage.json +0 -45
- package/src/__tests__/capacity/fixtures/zai-auth.json +0 -6
- package/src/__tests__/capacity/fixtures/zai-quota-invalid.json +0 -7
- package/src/__tests__/capacity/fixtures/zai-quota.json +0 -38
- package/src/__tests__/capacity/index.test.ts +0 -54
- package/src/__tests__/capacity/openai.test.ts +0 -571
- package/src/__tests__/capacity/wham.test.ts +0 -122
- package/src/__tests__/capacity/zai.test.ts +0 -151
- package/src/__tests__/fixtures.test.ts +0 -245
- package/src/__tests__/harnesses/BoundedSummarySkip.test.ts +0 -496
- package/src/__tests__/harnesses/SessionSummaryEquivalence.test.ts +0 -726
- package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.ts +0 -133
- package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.ts +0 -396
- package/src/__tests__/harnesses/builtinAdapters.test.ts +0 -33
- package/src/__tests__/harnesses/claude/ClaudeAgentMapper.test.ts +0 -84
- package/src/__tests__/harnesses/claude/ClaudeCodeAdapter.test.ts +0 -1793
- package/src/__tests__/harnesses/claude/ClaudeSessionLocator.test.ts +0 -423
- package/src/__tests__/harnesses/claude/ClaudeSessionParser.test.ts +0 -300
- package/src/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.ts +0 -34
- package/src/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.ts +0 -61
- package/src/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.ts +0 -129
- package/src/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.ts +0 -152
- package/src/__tests__/harnesses/codex/CodexAdapter.test.ts +0 -652
- package/src/__tests__/harnesses/codex/CodexSessionLocator.test.ts +0 -419
- package/src/__tests__/harnesses/codex/CodexSessionMapping.test.ts +0 -63
- package/src/__tests__/harnesses/codex/CodexSessionParser.test.ts +0 -192
- package/src/__tests__/harnesses/codex/durable/CodexCliProbe.test.ts +0 -80
- package/src/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.ts +0 -65
- package/src/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.ts +0 -104
- package/src/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.ts +0 -201
- package/src/__tests__/harnesses/codex/durable/CodexPrintRunner.test.ts +0 -299
- package/src/__tests__/harnesses/copilot/CopilotAdapter.test.ts +0 -614
- package/src/__tests__/harnesses/copilot/CopilotRefreshIO.test.ts +0 -270
- package/src/__tests__/harnesses/devin/DevinAdapter.test.ts +0 -290
- package/src/__tests__/harnesses/devin/DevinAgentMapper.test.ts +0 -101
- package/src/__tests__/harnesses/devin/DevinSessionLocator.test.ts +0 -139
- package/src/__tests__/harnesses/devin/DevinSessionParser.test.ts +0 -212
- package/src/__tests__/harnesses/devin/fixtures.ts +0 -144
- package/src/__tests__/harnesses/gemini/GeminiCliAdapter.test.ts +0 -1336
- package/src/__tests__/harnesses/gemini/GeminiSessionJsonl.test.ts +0 -402
- package/src/__tests__/harnesses/gemini/GeminiSessionLocator.test.ts +0 -396
- package/src/__tests__/harnesses/grok/GrokAgentMapper.test.ts +0 -57
- package/src/__tests__/harnesses/grok/GrokCliAdapter.test.ts +0 -376
- package/src/__tests__/harnesses/grok/GrokIncrementalRefresh.test.ts +0 -170
- package/src/__tests__/harnesses/grok/GrokSessionLocator.test.ts +0 -106
- package/src/__tests__/harnesses/grok/GrokSessionParser.test.ts +0 -230
- package/src/__tests__/harnesses/kiro/KiroAdapter.test.ts +0 -552
- package/src/__tests__/harnesses/muse/MuseAdapter.test.ts +0 -197
- package/src/__tests__/harnesses/muse/MuseAgentMapper.test.ts +0 -83
- package/src/__tests__/harnesses/muse/MuseSessionLocator.test.ts +0 -177
- package/src/__tests__/harnesses/muse/MuseSessionParser.test.ts +0 -279
- package/src/__tests__/harnesses/opencode/OpenCodeAdapter.test.ts +0 -215
- package/src/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.ts +0 -101
- package/src/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.ts +0 -84
- package/src/__tests__/harnesses/opencode/OpenCodeSessionParser.test.ts +0 -149
- package/src/__tests__/harnesses/pi/PiAdapter.test.ts +0 -325
- package/src/__tests__/harnesses/pi/PiDiscoveryIO.test.ts +0 -337
- package/src/__tests__/harnesses/pi/PiSessionParser.test.ts +0 -280
- package/src/__tests__/harnesses/pi/PiSessionTracker.test.ts +0 -79
- package/src/__tests__/harnesses/pi/durable/PiCliProbe.test.ts +0 -50
- package/src/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.ts +0 -33
- package/src/__tests__/harnesses/pi/durable/PiPrintAgentService.test.ts +0 -138
- package/src/__tests__/harnesses/pi/durable/PiPrintProtocol.test.ts +0 -71
- package/src/__tests__/harnesses/pi/durable/PiPrintRunner.test.ts +0 -252
- package/src/__tests__/harnesses/pi/durable/PiStreamParser.test.ts +0 -26
- package/src/__tests__/harnesses/readiness/AgentReadiness.test.ts +0 -362
- package/src/__tests__/harnesses/runtimeProfiles.test.ts +0 -123
- package/src/__tests__/print/DurableAgent.test.ts +0 -15
- package/src/__tests__/print/DurableAgentRepository.sqlite.test.ts +0 -128
- package/src/__tests__/print/DurableAgentRepository.test.ts +0 -184
- package/src/__tests__/readiness-fixtures.test.ts +0 -79
- package/src/__tests__/runtime/AgentRuntime.test.ts +0 -8
- package/src/__tests__/runtime/HerdrAgentDiscovery.test.ts +0 -131
- package/src/__tests__/runtime/HerdrAgentRuntime.test.ts +0 -377
- package/src/__tests__/runtime/ManagedAgentRuntime.test.ts +0 -590
- package/src/__tests__/terminal/GhosttyBackend.test.ts +0 -271
- package/src/__tests__/terminal/TerminalFocusManager.test.ts +0 -280
- package/src/__tests__/terminal/TmuxManager.test.ts +0 -185
- package/src/__tests__/terminal/TtyWriter.test.ts +0 -454
- package/src/__tests__/utils/AgentRegistry.test.ts +0 -532
- package/src/__tests__/utils/IncrementalJsonlSummary.test.ts +0 -414
- package/src/__tests__/utils/agent-requests.test.ts +0 -94
- package/src/__tests__/utils/conversationTail.bench.test.ts +0 -193
- package/src/__tests__/utils/conversationTailParity.test.ts +0 -365
- package/src/__tests__/utils/jsonlTail.test.ts +0 -317
- package/src/__tests__/utils/matching.test.ts +0 -234
- package/src/__tests__/utils/matchingConstants.test.ts +0 -40
- package/src/__tests__/utils/process.test.ts +0 -596
- package/src/__tests__/utils/session.test.ts +0 -158
- package/src/adapters/AgentAdapter.ts +0 -255
- package/src/capacity/index.ts +0 -127
- package/src/capacity/providers/anthropic.ts +0 -198
- package/src/capacity/providers/devin.ts +0 -121
- package/src/capacity/providers/openai-platform.ts +0 -150
- package/src/capacity/providers/openai-subscription.ts +0 -184
- package/src/capacity/providers/zai.ts +0 -155
- package/src/capacity/sources/claude.ts +0 -30
- package/src/capacity/sources/codex.ts +0 -251
- package/src/capacity/sources/devin.ts +0 -49
- package/src/capacity/sources/pi.ts +0 -131
- package/src/capacity/types.ts +0 -29
- package/src/database/connection.ts +0 -96
- package/src/database/index.ts +0 -7
- package/src/database/migrations/001_initial.sql +0 -12
- package/src/database/migrations/002_pins.sql +0 -1
- package/src/database/migrations/003_durable_agents.sql +0 -43
- package/src/database/migrations/004_codex_durable_sessions.sql +0 -1
- package/src/database/migrations/005_agent_runtime.sql +0 -2
- package/src/database/schema.ts +0 -64
- package/src/durable/DurableAgent.ts +0 -139
- package/src/durable/DurableAgentRepository.ts +0 -485
- package/src/durable/process.ts +0 -29
- package/src/durable/run.ts +0 -84
- package/src/durable/utils.ts +0 -66
- package/src/fixtures/bundle.ts +0 -130
- package/src/fixtures/capture.ts +0 -364
- package/src/harnesses/antigravity/AntigravityAgentMapper.ts +0 -34
- package/src/harnesses/antigravity/AntigravityCliAdapter.ts +0 -126
- package/src/harnesses/antigravity/AntigravitySessionLocator.ts +0 -75
- package/src/harnesses/antigravity/AntigravitySessionParser.ts +0 -252
- package/src/harnesses/claude/ClaudeAgentMapper.ts +0 -55
- package/src/harnesses/claude/ClaudeCodeAdapter.ts +0 -175
- package/src/harnesses/claude/ClaudeSessionLocator.ts +0 -358
- package/src/harnesses/claude/ClaudeSessionParser.ts +0 -524
- package/src/harnesses/claude/credentials.ts +0 -122
- package/src/harnesses/claude/durable/ClaudeCliProbe.ts +0 -57
- package/src/harnesses/claude/durable/ClaudePrintAgentService.ts +0 -79
- package/src/harnesses/claude/durable/ClaudePrintRunner.ts +0 -102
- package/src/harnesses/claude/durable/ClaudeStreamParser.ts +0 -108
- package/src/harnesses/claude/readiness.ts +0 -69
- package/src/harnesses/codex/CodexAdapter.ts +0 -337
- package/src/harnesses/codex/CodexAgentMapper.ts +0 -26
- package/src/harnesses/codex/CodexSessionLocator.ts +0 -509
- package/src/harnesses/codex/CodexSessionMapping.ts +0 -89
- package/src/harnesses/codex/CodexSessionParser.ts +0 -462
- package/src/harnesses/codex/credentials.ts +0 -81
- package/src/harnesses/codex/durable/CodexCliProbe.ts +0 -68
- package/src/harnesses/codex/durable/CodexPrintAgentService.ts +0 -79
- package/src/harnesses/codex/durable/CodexPrintRunner.ts +0 -104
- package/src/harnesses/codex/durable/CodexStreamParser.ts +0 -117
- package/src/harnesses/codex/readiness.ts +0 -72
- package/src/harnesses/copilot/CopilotAdapter.ts +0 -161
- package/src/harnesses/copilot/CopilotAgentMapper.ts +0 -27
- package/src/harnesses/copilot/CopilotSessionLocator.ts +0 -161
- package/src/harnesses/copilot/CopilotSessionParser.ts +0 -380
- package/src/harnesses/copilot/readiness.ts +0 -33
- package/src/harnesses/devin/DevinAdapter.ts +0 -212
- package/src/harnesses/devin/DevinAgentMapper.ts +0 -39
- package/src/harnesses/devin/DevinSessionLocator.ts +0 -230
- package/src/harnesses/devin/DevinSessionParser.ts +0 -227
- package/src/harnesses/devin/credentials.ts +0 -88
- package/src/harnesses/devin/readiness.ts +0 -36
- package/src/harnesses/gemini/GeminiAgentMapper.ts +0 -27
- package/src/harnesses/gemini/GeminiCliAdapter.ts +0 -272
- package/src/harnesses/gemini/GeminiSessionLocator.ts +0 -394
- package/src/harnesses/gemini/GeminiSessionParser.ts +0 -395
- package/src/harnesses/gemini/fileSignature.ts +0 -10
- package/src/harnesses/grok/GrokAgentMapper.ts +0 -32
- package/src/harnesses/grok/GrokCliAdapter.ts +0 -126
- package/src/harnesses/grok/GrokSessionLocator.ts +0 -179
- package/src/harnesses/grok/GrokSessionParser.ts +0 -251
- package/src/harnesses/index.ts +0 -32
- package/src/harnesses/kiro/KiroAdapter.ts +0 -143
- package/src/harnesses/kiro/KiroAgentMapper.ts +0 -34
- package/src/harnesses/kiro/KiroSessionLocator.ts +0 -143
- package/src/harnesses/kiro/KiroSessionParser.ts +0 -376
- package/src/harnesses/muse/MuseAdapter.ts +0 -157
- package/src/harnesses/muse/MuseAgentMapper.ts +0 -33
- package/src/harnesses/muse/MuseSessionLocator.ts +0 -286
- package/src/harnesses/muse/MuseSessionParser.ts +0 -435
- package/src/harnesses/muse/readiness.ts +0 -38
- package/src/harnesses/opencode/OpenCodeAdapter.ts +0 -110
- package/src/harnesses/opencode/OpenCodeAgentMapper.ts +0 -49
- package/src/harnesses/opencode/OpenCodeSessionLocator.ts +0 -151
- package/src/harnesses/opencode/OpenCodeSessionParser.ts +0 -146
- package/src/harnesses/opencode/readiness.ts +0 -48
- package/src/harnesses/pi/PiAdapter.ts +0 -197
- package/src/harnesses/pi/PiAgentMapper.ts +0 -27
- package/src/harnesses/pi/PiSessionLocator.ts +0 -288
- package/src/harnesses/pi/PiSessionParser.ts +0 -488
- package/src/harnesses/pi/PiSessionTracker.ts +0 -87
- package/src/harnesses/pi/credentials.ts +0 -129
- package/src/harnesses/pi/durable/PiCliProbe.ts +0 -56
- package/src/harnesses/pi/durable/PiPrintAgentService.ts +0 -77
- package/src/harnesses/pi/durable/PiPrintProtocol.ts +0 -41
- package/src/harnesses/pi/durable/PiPrintRunner.ts +0 -95
- package/src/harnesses/pi/durable/PiStreamParser.ts +0 -94
- package/src/harnesses/pi/readiness.ts +0 -104
- package/src/harnesses/readiness/AgentReadiness.ts +0 -91
- package/src/harnesses/readiness/checks.ts +0 -336
- package/src/harnesses/readiness/types.ts +0 -90
- package/src/harnesses/runtimeProfiles.ts +0 -105
- package/src/harnesses/shared.ts +0 -124
- package/src/index.ts +0 -71
- package/src/runtime/ManagedAgentRuntime.ts +0 -253
- package/src/runtime/RuntimeFactory.ts +0 -13
- package/src/runtime/errors.ts +0 -50
- package/src/runtime/herdr/HerdrAgentDiscovery.ts +0 -166
- package/src/runtime/herdr/HerdrAgentRuntime.ts +0 -216
- package/src/runtime/herdr/HerdrCliClient.ts +0 -78
- package/src/runtime/herdr/HerdrErrors.ts +0 -9
- package/src/runtime/herdr/HerdrResponseParsers.ts +0 -86
- package/src/runtime/herdr/HerdrRuntimeRef.ts +0 -41
- package/src/runtime/tmux/PidPolling.ts +0 -34
- package/src/runtime/tmux/TmuxAgentRuntime.ts +0 -113
- package/src/runtime/tmux/TmuxManager.ts +0 -102
- package/src/runtime/tmux/TmuxRuntimeRef.ts +0 -9
- package/src/runtime/types.ts +0 -56
- package/src/terminal/TerminalFocusManager.ts +0 -52
- package/src/terminal/TtyWriter.ts +0 -26
- package/src/terminal/backends/ghostty.ts +0 -180
- package/src/terminal/backends/index.ts +0 -23
- package/src/terminal/backends/iterm2.ts +0 -126
- package/src/terminal/backends/shared.ts +0 -47
- package/src/terminal/backends/terminal-app.ts +0 -122
- package/src/terminal/backends/tmux.ts +0 -62
- package/src/terminal/backends/wezterm.ts +0 -65
- package/src/terminal/types.ts +0 -23
- package/src/utils/AgentRegistry.ts +0 -351
- package/src/utils/IncrementalJsonlSummary.ts +0 -306
- package/src/utils/agent-requests.ts +0 -28
- package/src/utils/applescript.ts +0 -10
- package/src/utils/jsonlTail.ts +0 -349
- package/src/utils/matching.ts +0 -96
- package/src/utils/matchingConstants.ts +0 -15
- package/src/utils/process.ts +0 -604
- package/src/utils/session.ts +0 -144
- package/src/utils/sortAgents.ts +0 -54
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -20
|
@@ -1,726 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Equivalence between the incremental session summaries used on refresh and
|
|
3
|
-
* the full-file parse of Claude, Codex, Kiro and Antigravity transcripts.
|
|
4
|
-
*
|
|
5
|
-
* `legacyClaudeReadSession` / `legacyCodexReadSession` are verbatim copies of
|
|
6
|
-
* the pre-incremental `readSession` algorithms, kept here as an oracle. Kiro
|
|
7
|
-
* and Antigravity are checked against their own full `readSession`.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import * as fs from "fs";
|
|
11
|
-
import * as os from "os";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
|
|
14
|
-
import { AntigravitySessionParser } from "../../harnesses/antigravity/AntigravitySessionParser.js";
|
|
15
|
-
import { ClaudeSessionParser } from "../../harnesses/claude/ClaudeSessionParser.js";
|
|
16
|
-
import { CodexSessionParser } from "../../harnesses/codex/CodexSessionParser.js";
|
|
17
|
-
import { KiroSessionParser } from "../../harnesses/kiro/KiroSessionParser.js";
|
|
18
|
-
import { parseTimestamp, truncate } from "../../harnesses/shared.js";
|
|
19
|
-
|
|
20
|
-
const CONVERSATION_ENTRY_TYPES = new Set(["user", "assistant", "system", "progress", "thinking"]);
|
|
21
|
-
|
|
22
|
-
function legacyClaudeReadSession(
|
|
23
|
-
parser: ClaudeSessionParser,
|
|
24
|
-
filePath: string,
|
|
25
|
-
projectPath: string,
|
|
26
|
-
) {
|
|
27
|
-
const p = parser as any;
|
|
28
|
-
const sessionId = path.basename(filePath, ".jsonl");
|
|
29
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
30
|
-
const allLines = content.trim().split("\n");
|
|
31
|
-
|
|
32
|
-
let sessionStart: Date | null = null;
|
|
33
|
-
try {
|
|
34
|
-
const firstEntry = JSON.parse(allLines[0]);
|
|
35
|
-
const rawTs: string | undefined = firstEntry.timestamp || firstEntry.snapshot?.timestamp;
|
|
36
|
-
if (rawTs && !Number.isNaN(new Date(rawTs).getTime())) sessionStart = new Date(rawTs);
|
|
37
|
-
} catch {
|
|
38
|
-
/* malformed first line */
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let lastEntryType: string | undefined;
|
|
42
|
-
let lastActive: Date | undefined;
|
|
43
|
-
let lastCwd: string | undefined;
|
|
44
|
-
let isInterrupted = false;
|
|
45
|
-
let lastUserMessage: string | undefined;
|
|
46
|
-
let firstUserMessage: string | undefined;
|
|
47
|
-
|
|
48
|
-
for (const line of allLines) {
|
|
49
|
-
try {
|
|
50
|
-
const entry = JSON.parse(line);
|
|
51
|
-
if (entry.timestamp) {
|
|
52
|
-
const ts = new Date(entry.timestamp);
|
|
53
|
-
if (!Number.isNaN(ts.getTime())) lastActive = ts;
|
|
54
|
-
}
|
|
55
|
-
if (typeof entry.cwd === "string" && entry.cwd.trim().length > 0) lastCwd = entry.cwd;
|
|
56
|
-
if (entry.type && CONVERSATION_ENTRY_TYPES.has(entry.type)) {
|
|
57
|
-
lastEntryType = entry.type;
|
|
58
|
-
if (entry.type === "user") {
|
|
59
|
-
const msgContent = entry.message?.content;
|
|
60
|
-
isInterrupted =
|
|
61
|
-
Array.isArray(msgContent) &&
|
|
62
|
-
msgContent.some(
|
|
63
|
-
(c: any) =>
|
|
64
|
-
(c.type === "text" && c.text?.includes("[Request interrupted")) ||
|
|
65
|
-
(c.type === "tool_result" && c.content?.includes("[Request interrupted")),
|
|
66
|
-
);
|
|
67
|
-
const text = p.extractUserMessageText(msgContent);
|
|
68
|
-
if (text) {
|
|
69
|
-
lastUserMessage = text;
|
|
70
|
-
if (!firstUserMessage) firstUserMessage = text;
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
isInterrupted = false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
sessionId,
|
|
83
|
-
projectPath: projectPath || lastCwd || "",
|
|
84
|
-
lastCwd,
|
|
85
|
-
sessionStart: sessionStart || lastActive || new Date(),
|
|
86
|
-
lastActive: lastActive || new Date(),
|
|
87
|
-
lastEntryType,
|
|
88
|
-
isInterrupted,
|
|
89
|
-
lastUserMessage,
|
|
90
|
-
firstUserMessage,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function legacyCodexReadSession(parser: CodexSessionParser, filePath: string) {
|
|
95
|
-
const p = parser as any;
|
|
96
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
97
|
-
const allLines = content.trim().split("\n");
|
|
98
|
-
if (!allLines[0]) return null;
|
|
99
|
-
|
|
100
|
-
let metaEntry: any;
|
|
101
|
-
try {
|
|
102
|
-
metaEntry = JSON.parse(allLines[0]);
|
|
103
|
-
} catch {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
if (metaEntry?.type !== "session_meta" || !metaEntry.payload?.id) return null;
|
|
107
|
-
|
|
108
|
-
const entries: any[] = [];
|
|
109
|
-
for (const line of allLines) {
|
|
110
|
-
try {
|
|
111
|
-
entries.push(JSON.parse(line));
|
|
112
|
-
} catch {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
let lastEntry: any;
|
|
118
|
-
for (let i = entries.length - 1; i >= 0; i--) {
|
|
119
|
-
if (entries[i] && typeof entries[i].type === "string") {
|
|
120
|
-
lastEntry = entries[i];
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
let summary = "Codex session active";
|
|
125
|
-
for (let i = entries.length - 1; i >= 0; i--) {
|
|
126
|
-
const message = p.extractEntryText(entries[i]);
|
|
127
|
-
if (message) {
|
|
128
|
-
summary = truncate(message, 120);
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const lastActive =
|
|
134
|
-
parseTimestamp(lastEntry?.timestamp) ||
|
|
135
|
-
parseTimestamp(metaEntry.payload.timestamp) ||
|
|
136
|
-
fs.statSync(filePath).mtime;
|
|
137
|
-
const sessionStart = parseTimestamp(metaEntry.payload.timestamp) || lastActive;
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
sessionId: metaEntry.payload.id,
|
|
141
|
-
projectPath: metaEntry.payload.cwd || "",
|
|
142
|
-
summary,
|
|
143
|
-
sessionStart,
|
|
144
|
-
lastActive,
|
|
145
|
-
lastPayloadType: lastEntry ? p.normalizedPayloadType(lastEntry) : undefined,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const text = (value: string) => [{ type: "text", text: value }];
|
|
150
|
-
|
|
151
|
-
/** Synthetic transcripts covering the shapes used by the existing Claude fixtures. */
|
|
152
|
-
const claudeFixtures: Record<string, unknown[]> = {
|
|
153
|
-
basic: [
|
|
154
|
-
{
|
|
155
|
-
type: "user",
|
|
156
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
157
|
-
cwd: "/my/project",
|
|
158
|
-
message: { content: "hello" },
|
|
159
|
-
},
|
|
160
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z", message: { content: text("hi") } },
|
|
161
|
-
],
|
|
162
|
-
interrupted: [
|
|
163
|
-
{ type: "assistant", timestamp: "2026-03-10T10:00:00Z" },
|
|
164
|
-
{
|
|
165
|
-
type: "user",
|
|
166
|
-
timestamp: "2026-03-10T10:01:00Z",
|
|
167
|
-
message: { content: text("[Request interrupted by user for tool use]") },
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
interruptedToolResult: [
|
|
171
|
-
{
|
|
172
|
-
type: "user",
|
|
173
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
174
|
-
message: { content: [{ type: "tool_result", content: "[Request interrupted by user]" }] },
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
metadataTail: [
|
|
178
|
-
{ type: "user", timestamp: "2026-03-10T10:00:00Z", message: { content: text("question") } },
|
|
179
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z" },
|
|
180
|
-
{ type: "last-prompt", timestamp: "2026-03-10T10:02:00Z" },
|
|
181
|
-
{ type: "file-history-snapshot", timestamp: "2026-03-10T10:03:00Z" },
|
|
182
|
-
],
|
|
183
|
-
snapshotFirst: [
|
|
184
|
-
{ type: "file-history-snapshot", snapshot: { timestamp: "2026-03-10T09:59:00Z" } },
|
|
185
|
-
{
|
|
186
|
-
type: "user",
|
|
187
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
188
|
-
cwd: "/repo",
|
|
189
|
-
message: { content: "start" },
|
|
190
|
-
},
|
|
191
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z" },
|
|
192
|
-
],
|
|
193
|
-
multipleUsers: [
|
|
194
|
-
{
|
|
195
|
-
type: "user",
|
|
196
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
197
|
-
message: { content: text("first question") },
|
|
198
|
-
},
|
|
199
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z" },
|
|
200
|
-
{
|
|
201
|
-
type: "user",
|
|
202
|
-
timestamp: "2026-03-10T10:02:00Z",
|
|
203
|
-
message: { content: text("second question") },
|
|
204
|
-
},
|
|
205
|
-
{ type: "assistant", timestamp: "2026-03-10T10:03:00Z" },
|
|
206
|
-
],
|
|
207
|
-
commandsAndSkills: [
|
|
208
|
-
{
|
|
209
|
-
type: "user",
|
|
210
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
211
|
-
message: {
|
|
212
|
-
content:
|
|
213
|
-
"<command-message>review</command-message><command-name>/review</command-name><command-args>src</command-args>",
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: "user",
|
|
218
|
-
timestamp: "2026-03-10T10:01:00Z",
|
|
219
|
-
message: {
|
|
220
|
-
content: text("Base directory for this skill: /skills/x\n\nARGUMENTS: do the thing"),
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
{ type: "user", timestamp: "2026-03-10T10:02:00Z", message: { content: "Tool loaded." } },
|
|
224
|
-
{
|
|
225
|
-
type: "user",
|
|
226
|
-
timestamp: "2026-03-10T10:03:00Z",
|
|
227
|
-
message: { content: "This session is being continued from a previous one" },
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
uiStateTail: [
|
|
231
|
-
{ type: "user", timestamp: "2026-05-30T06:17:57.189Z", message: { content: "hello" } },
|
|
232
|
-
{
|
|
233
|
-
type: "attachment",
|
|
234
|
-
timestamp: "2026-05-30T06:17:57.200Z",
|
|
235
|
-
attachment: { type: "task_reminder", content: [] },
|
|
236
|
-
},
|
|
237
|
-
{ type: "permission-mode", timestamp: "2026-05-30T06:17:57.210Z", permissionMode: "default" },
|
|
238
|
-
{ type: "ai-title", timestamp: "2026-05-30T06:17:57.220Z" },
|
|
239
|
-
],
|
|
240
|
-
progressAndSystem: [
|
|
241
|
-
{ type: "user", timestamp: "2026-03-10T10:00:00Z", message: { content: "go" } },
|
|
242
|
-
{ type: "progress", timestamp: "2026-03-10T10:00:01Z" },
|
|
243
|
-
{ type: "thinking", timestamp: "2026-03-10T10:00:02Z" },
|
|
244
|
-
{ type: "system", timestamp: "2026-03-10T10:00:03Z", cwd: " " },
|
|
245
|
-
],
|
|
246
|
-
noTimestamps: [{ type: "assistant" }, { type: "user", message: { content: "no time" } }],
|
|
247
|
-
invalidTimestamp: [
|
|
248
|
-
{ type: "user", timestamp: "not-a-date", message: { content: "bad time" } },
|
|
249
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z" },
|
|
250
|
-
],
|
|
251
|
-
cwdChanges: [
|
|
252
|
-
{ type: "user", timestamp: "2026-03-10T10:00:00Z", cwd: "/a" },
|
|
253
|
-
{ type: "assistant", timestamp: "2026-03-10T10:01:00Z", cwd: "/b" },
|
|
254
|
-
],
|
|
255
|
-
empty: [],
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/** Synthetic transcripts covering the shapes used by the existing Codex fixtures. */
|
|
259
|
-
const codexFixtures: Record<string, unknown[]> = {
|
|
260
|
-
legacyEvents: [
|
|
261
|
-
{
|
|
262
|
-
type: "session_meta",
|
|
263
|
-
payload: { id: "sess-1", timestamp: "2026-03-18T15:00:00Z", cwd: "/repo" },
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
type: "event",
|
|
267
|
-
timestamp: "2026-03-18T15:01:00Z",
|
|
268
|
-
payload: { type: "agent_reasoning", message: "Working on feature" },
|
|
269
|
-
},
|
|
270
|
-
],
|
|
271
|
-
responseItems: [
|
|
272
|
-
{
|
|
273
|
-
type: "session_meta",
|
|
274
|
-
payload: { id: "sess-2", cwd: "/repo", timestamp: "2026-03-27T10:00:00Z" },
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
type: "response_item",
|
|
278
|
-
timestamp: "2026-03-27T10:00:01Z",
|
|
279
|
-
payload: {
|
|
280
|
-
type: "message",
|
|
281
|
-
role: "user",
|
|
282
|
-
content: [{ type: "input_text", text: "Fix the bug" }],
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
type: "event_msg",
|
|
287
|
-
timestamp: "2026-03-27T10:00:02Z",
|
|
288
|
-
payload: { type: "user_message", message: "Fix the bug" },
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
type: "response_item",
|
|
292
|
-
timestamp: "2026-03-27T10:00:03Z",
|
|
293
|
-
payload: {
|
|
294
|
-
type: "message",
|
|
295
|
-
role: "assistant",
|
|
296
|
-
content: [{ type: "output_text", text: "Done. ".repeat(40) }],
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
{ type: "event_msg", timestamp: "2026-03-27T10:00:04Z", payload: { type: "token_count" } },
|
|
300
|
-
],
|
|
301
|
-
itemCompleted: [
|
|
302
|
-
{ type: "session_meta", payload: { id: "sess-3", cwd: "/repo" } },
|
|
303
|
-
{
|
|
304
|
-
type: "event_msg",
|
|
305
|
-
timestamp: "2026-03-27T10:00:01Z",
|
|
306
|
-
payload: { type: "item_completed", item: { type: "UserMessage", content: "hello" } },
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
type: "event_msg",
|
|
310
|
-
timestamp: "2026-03-27T10:00:02Z",
|
|
311
|
-
payload: {
|
|
312
|
-
type: "item_completed",
|
|
313
|
-
item: { type: "AgentMessage", content: [{ type: "text", text: "answer" }] },
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
{ type: "event_msg", payload: { type: "item_completed", item: { type: "Reasoning" } } },
|
|
317
|
-
],
|
|
318
|
-
turnAborted: [
|
|
319
|
-
{ type: "session_meta", payload: { id: "sess-4", timestamp: "2026-03-18T15:00:00Z" } },
|
|
320
|
-
{
|
|
321
|
-
type: "event_msg",
|
|
322
|
-
timestamp: "2026-03-18T15:01:00Z",
|
|
323
|
-
payload: { type: "task_complete", message: "finished" },
|
|
324
|
-
},
|
|
325
|
-
{ type: "event_msg", timestamp: "2026-03-18T15:02:00Z", payload: { type: "turn_aborted" } },
|
|
326
|
-
],
|
|
327
|
-
untypedTail: [
|
|
328
|
-
{ type: "session_meta", payload: { id: "sess-5", timestamp: "2026-03-18T15:00:00Z" } },
|
|
329
|
-
{
|
|
330
|
-
type: "event",
|
|
331
|
-
timestamp: "2026-03-18T15:01:00Z",
|
|
332
|
-
payload: { type: "agent_message", message: "hi" },
|
|
333
|
-
},
|
|
334
|
-
{ payload: { message: "untyped trailing line" } },
|
|
335
|
-
],
|
|
336
|
-
metaOnlyNoTimestamp: [{ type: "session_meta", payload: { id: "sess-6" } }],
|
|
337
|
-
notSessionMeta: [{ type: "event", payload: {} }],
|
|
338
|
-
metaWithoutId: [{ type: "session_meta", payload: { cwd: "/repo" } }],
|
|
339
|
-
empty: [],
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const kiroText = (value: string) => [{ kind: "text", data: value }];
|
|
343
|
-
const kiroFixtures: Record<string, unknown[]> = {
|
|
344
|
-
promptAndReply: [
|
|
345
|
-
{ kind: "Prompt", data: { content: kiroText("first"), meta: { timestamp: 1781098057 } } },
|
|
346
|
-
{
|
|
347
|
-
kind: "AssistantMessage",
|
|
348
|
-
timestamp: "2026-06-10T13:28:00Z",
|
|
349
|
-
data: { content: kiroText("ok") },
|
|
350
|
-
},
|
|
351
|
-
{ kind: "Prompt", data: { content: kiroText("second"), meta: { timestamp: 1781098200 } } },
|
|
352
|
-
],
|
|
353
|
-
toolUseLast: [
|
|
354
|
-
{ kind: "Prompt", data: { content: kiroText("read it"), meta: { timestamp: 1781098057 } } },
|
|
355
|
-
{
|
|
356
|
-
kind: "AssistantMessage",
|
|
357
|
-
data: { content: [{ kind: "toolUse", data: { name: "fs_read", input: { path: "a" } } }] },
|
|
358
|
-
},
|
|
359
|
-
{ kind: "ToolResults", data: { content: [{ kind: "toolResult", data: { result: "x" } }] } },
|
|
360
|
-
],
|
|
361
|
-
untimedWithNonObjects: [
|
|
362
|
-
{ kind: "Prompt", data: { content: kiroText("no clock") } },
|
|
363
|
-
null,
|
|
364
|
-
[1, 2],
|
|
365
|
-
"a string",
|
|
366
|
-
{ kind: "AssistantMessage", data: { content: kiroText("reply") } },
|
|
367
|
-
],
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const agyFixtures: Record<string, unknown[]> = {
|
|
371
|
-
requestAndReply: [
|
|
372
|
-
{
|
|
373
|
-
type: "USER_INPUT",
|
|
374
|
-
created_at: "2026-09-28T10:00:00Z",
|
|
375
|
-
content: "<USER_REQUEST>\nfirst\n</USER_REQUEST>",
|
|
376
|
-
},
|
|
377
|
-
{ type: "RUN_COMMAND", created_at: "2026-09-28T10:00:05Z", content: "ls" },
|
|
378
|
-
{ type: "PLANNER_RESPONSE", created_at: "2026-09-28T10:00:09Z", content: "done" },
|
|
379
|
-
{ type: "USER_INPUT", created_at: "2026-09-28T10:01:00Z", content: [{ text: "second" }] },
|
|
380
|
-
],
|
|
381
|
-
outOfOrderTimestamps: [
|
|
382
|
-
{ type: "USER_INPUT", created_at: "2026-09-28T10:05:00Z", content: "late" },
|
|
383
|
-
{ type: "PLANNER_RESPONSE", created_at: "2026-09-28T10:01:00Z", content: "early" },
|
|
384
|
-
],
|
|
385
|
-
untimedWithNonObjects: [
|
|
386
|
-
{ type: "USER_INPUT", content: " " },
|
|
387
|
-
null,
|
|
388
|
-
{ type: "USER_INPUT", content: "<USER_REQUEST></USER_REQUEST>" },
|
|
389
|
-
"a string",
|
|
390
|
-
{ type: "PLANNER_RESPONSE", content: "reply" },
|
|
391
|
-
],
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
type Fixture = { name: string; lines: string[]; trailingNewline: boolean };
|
|
395
|
-
|
|
396
|
-
function variants(fixtures: Record<string, unknown[]>): Fixture[] {
|
|
397
|
-
const out: Fixture[] = [];
|
|
398
|
-
for (const [name, entries] of Object.entries(fixtures)) {
|
|
399
|
-
const lines = entries.map((entry) => JSON.stringify(entry));
|
|
400
|
-
out.push({ name, lines, trailingNewline: true });
|
|
401
|
-
out.push({ name: `${name} (no trailing newline)`, lines, trailingNewline: false });
|
|
402
|
-
if (lines.length > 1) {
|
|
403
|
-
const noisy = [...lines];
|
|
404
|
-
noisy.splice(1, 0, "{not json", "", " ");
|
|
405
|
-
out.push({ name: `${name} (malformed + blank lines)`, lines: noisy, trailingNewline: true });
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return out;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function render(fixture: Fixture): Buffer {
|
|
412
|
-
return Buffer.from(fixture.lines.join("\n") + (fixture.trailingNewline ? "\n" : ""));
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/** Byte offsets to split an append at: every line boundary plus mid-line offsets. */
|
|
416
|
-
function splitPoints(buffer: Buffer): number[] {
|
|
417
|
-
const points = new Set<number>([0, buffer.length]);
|
|
418
|
-
for (let i = 0; i < buffer.length; i++) {
|
|
419
|
-
if (buffer[i] === 0x0a) {
|
|
420
|
-
points.add(i);
|
|
421
|
-
points.add(i + 1);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
for (let i = 1; i < 8; i++) points.add(Math.floor((buffer.length * i) / 8));
|
|
425
|
-
return [...points].sort((a, b) => a - b);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
describe("incremental session summaries match the full-file parse", () => {
|
|
429
|
-
let tmpDir: string;
|
|
430
|
-
|
|
431
|
-
beforeEach(() => {
|
|
432
|
-
vi.useFakeTimers({ toFake: ["Date"] });
|
|
433
|
-
vi.setSystemTime(new Date("2026-09-28T00:00:00Z"));
|
|
434
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "summary-equivalence-"));
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
afterEach(() => {
|
|
438
|
-
vi.useRealTimers();
|
|
439
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
it.each(variants(claudeFixtures))("Claude: $name", (fixture) => {
|
|
443
|
-
const buffer = render(fixture);
|
|
444
|
-
const filePath = path.join(tmpDir, "11111111-2222-3333-4444-555555555555.jsonl");
|
|
445
|
-
|
|
446
|
-
fs.writeFileSync(filePath, buffer);
|
|
447
|
-
const oracle = legacyClaudeReadSession(new ClaudeSessionParser(), filePath, "");
|
|
448
|
-
expect(new ClaudeSessionParser().readSession(filePath, "")).toEqual(oracle);
|
|
449
|
-
|
|
450
|
-
for (const split of splitPoints(buffer)) {
|
|
451
|
-
const parser = new ClaudeSessionParser();
|
|
452
|
-
fs.writeFileSync(filePath, buffer.subarray(0, split));
|
|
453
|
-
parser.readSessionIncremental(filePath, "");
|
|
454
|
-
fs.appendFileSync(filePath, buffer.subarray(split));
|
|
455
|
-
expect(parser.readSessionIncremental(filePath, ""), `split at ${split}`).toEqual(oracle);
|
|
456
|
-
expect(parser.readSessionIncremental(filePath, "")).toEqual(oracle);
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
it.each(variants(codexFixtures))("Codex: $name", (fixture) => {
|
|
461
|
-
const buffer = render(fixture);
|
|
462
|
-
const filePath = path.join(tmpDir, "rollout.jsonl");
|
|
463
|
-
|
|
464
|
-
fs.writeFileSync(filePath, buffer);
|
|
465
|
-
const oracle = legacyCodexReadSession(new CodexSessionParser(), filePath);
|
|
466
|
-
expect(new CodexSessionParser().readSession(filePath)).toEqual(oracle);
|
|
467
|
-
|
|
468
|
-
for (const split of splitPoints(buffer)) {
|
|
469
|
-
const parser = new CodexSessionParser();
|
|
470
|
-
fs.writeFileSync(filePath, buffer.subarray(0, split));
|
|
471
|
-
parser.readSessionIncremental(filePath);
|
|
472
|
-
fs.appendFileSync(filePath, buffer.subarray(split));
|
|
473
|
-
const expected = legacyCodexReadSession(parser, filePath);
|
|
474
|
-
expect(parser.readSessionIncremental(filePath), `split at ${split}`).toEqual(expected);
|
|
475
|
-
expect(parser.readSessionIncremental(filePath)).toEqual(expected);
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
it.each(variants(kiroFixtures))("Kiro: $name", (fixture) => {
|
|
480
|
-
const buffer = render(fixture);
|
|
481
|
-
const paths = {
|
|
482
|
-
sessionId: "kiro-session",
|
|
483
|
-
transcriptPath: path.join(tmpDir, "kiro-session.jsonl"),
|
|
484
|
-
metadataPath: path.join(tmpDir, "kiro-session.json"),
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
for (const split of splitPoints(buffer)) {
|
|
488
|
-
const parser = new KiroSessionParser();
|
|
489
|
-
fs.writeFileSync(paths.transcriptPath, buffer.subarray(0, split));
|
|
490
|
-
parser.readSessionIncremental(paths, "/repo");
|
|
491
|
-
fs.appendFileSync(paths.transcriptPath, buffer.subarray(split));
|
|
492
|
-
const expected = new KiroSessionParser().readSession(paths, "/repo");
|
|
493
|
-
expect(parser.readSessionIncremental(paths, "/repo"), `split at ${split}`).toEqual(expected);
|
|
494
|
-
expect(parser.readSessionIncremental(paths, "/repo")).toEqual(expected);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
it.each(variants(agyFixtures))("Antigravity: $name", (fixture) => {
|
|
499
|
-
const buffer = render(fixture);
|
|
500
|
-
const filePath = path.join(tmpDir, "transcript.jsonl");
|
|
501
|
-
const read = (parser: AntigravitySessionParser, incremental: boolean) =>
|
|
502
|
-
incremental
|
|
503
|
-
? parser.readSessionIncremental("conv", filePath, "/repo")
|
|
504
|
-
: parser.readSession("conv", filePath, "/repo");
|
|
505
|
-
|
|
506
|
-
for (const split of splitPoints(buffer)) {
|
|
507
|
-
const parser = new AntigravitySessionParser();
|
|
508
|
-
fs.writeFileSync(filePath, buffer.subarray(0, split));
|
|
509
|
-
read(parser, true);
|
|
510
|
-
fs.appendFileSync(filePath, buffer.subarray(split));
|
|
511
|
-
const expected = read(new AntigravitySessionParser(), false);
|
|
512
|
-
expect(read(parser, true), `split at ${split}`).toEqual(expected);
|
|
513
|
-
expect(read(parser, true)).toEqual(expected);
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Bounded cold start: `[fixture, neutral padding, fixture]` is larger than the
|
|
520
|
-
* head + tail windows, each window covers one full copy of the fixture, and
|
|
521
|
-
* the padding never changes a summary field. The bounded summary (which skips
|
|
522
|
-
* the middle) must therefore equal the full-file parse.
|
|
523
|
-
*/
|
|
524
|
-
describe("bounded cold-start summaries match the full-file parse", () => {
|
|
525
|
-
let tmpDir: string;
|
|
526
|
-
|
|
527
|
-
beforeEach(() => {
|
|
528
|
-
vi.useFakeTimers({ toFake: ["Date"] });
|
|
529
|
-
vi.setSystemTime(new Date("2026-09-28T00:00:00Z"));
|
|
530
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "bounded-equivalence-"));
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
afterEach(() => {
|
|
534
|
-
vi.useRealTimers();
|
|
535
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
function mirrored(fixture: Fixture, padLine: string) {
|
|
539
|
-
const window = Buffer.byteLength(fixture.lines.join("\n") + "\n") + 16;
|
|
540
|
-
const padCount = Math.ceil((2 * window) / padLine.length) + 4;
|
|
541
|
-
const padding = Array.from({ length: padCount }, () => padLine);
|
|
542
|
-
const buffer = render({ ...fixture, lines: [...fixture.lines, ...padding, ...fixture.lines] });
|
|
543
|
-
expect(buffer.length).toBeGreaterThan(2 * window);
|
|
544
|
-
return { buffer, bounds: { headBytes: window, tailBytes: window } };
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
it.each(variants(claudeFixtures))("Claude: $name", (fixture) => {
|
|
548
|
-
const { buffer, bounds } = mirrored(fixture, JSON.stringify({ type: "attachment" }));
|
|
549
|
-
const filePath = path.join(tmpDir, "11111111-2222-3333-4444-555555555555.jsonl");
|
|
550
|
-
fs.writeFileSync(filePath, buffer);
|
|
551
|
-
|
|
552
|
-
const parser = new ClaudeSessionParser({ summaryBounds: bounds });
|
|
553
|
-
const oracle = legacyClaudeReadSession(parser, filePath, "");
|
|
554
|
-
|
|
555
|
-
expect(parser.readSessionIncremental(filePath, "")).toEqual(oracle);
|
|
556
|
-
expect((parser as any).sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
it.each(variants(codexFixtures))("Codex: $name", (fixture) => {
|
|
560
|
-
const { buffer, bounds } = mirrored(fixture, JSON.stringify({ payload: {} }));
|
|
561
|
-
const filePath = path.join(tmpDir, "rollout.jsonl");
|
|
562
|
-
fs.writeFileSync(filePath, buffer);
|
|
563
|
-
|
|
564
|
-
const parser = new CodexSessionParser({ summaryBounds: bounds });
|
|
565
|
-
const oracle = legacyCodexReadSession(parser, filePath);
|
|
566
|
-
|
|
567
|
-
expect(parser.readSessionIncremental(filePath)).toEqual(oracle);
|
|
568
|
-
expect((parser as any).sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
it.each(variants(kiroFixtures))("Kiro: $name", (fixture) => {
|
|
572
|
-
const { buffer, bounds } = mirrored(fixture, JSON.stringify({ kind: "Checkpoint" }));
|
|
573
|
-
const paths = {
|
|
574
|
-
sessionId: "kiro-session",
|
|
575
|
-
transcriptPath: path.join(tmpDir, "kiro-session.jsonl"),
|
|
576
|
-
metadataPath: path.join(tmpDir, "kiro-session.json"),
|
|
577
|
-
};
|
|
578
|
-
fs.writeFileSync(paths.transcriptPath, buffer);
|
|
579
|
-
|
|
580
|
-
const parser = new KiroSessionParser({ summaryBounds: bounds });
|
|
581
|
-
|
|
582
|
-
expect(parser.readSessionIncremental(paths, "/repo")).toEqual(
|
|
583
|
-
new KiroSessionParser().readSession(paths, "/repo"),
|
|
584
|
-
);
|
|
585
|
-
expect((parser as any).sessionCache.read(paths.transcriptPath).skippedBytes).toBeGreaterThan(0);
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
it.each(variants(agyFixtures))("Antigravity: $name", (fixture) => {
|
|
589
|
-
const { buffer, bounds } = mirrored(fixture, JSON.stringify({ type: "CHECKPOINT" }));
|
|
590
|
-
const filePath = path.join(tmpDir, "transcript.jsonl");
|
|
591
|
-
fs.writeFileSync(filePath, buffer);
|
|
592
|
-
|
|
593
|
-
const parser = new AntigravitySessionParser({ summaryBounds: bounds });
|
|
594
|
-
|
|
595
|
-
expect(parser.readSessionIncremental("conv", filePath, "/repo")).toEqual(
|
|
596
|
-
new AntigravitySessionParser().readSession("conv", filePath, "/repo"),
|
|
597
|
-
);
|
|
598
|
-
expect((parser as any).sessionCache.read(filePath).skippedBytes).toBeGreaterThan(0);
|
|
599
|
-
});
|
|
600
|
-
});
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Documented fallbacks when an entry lies only in the skipped middle of a
|
|
604
|
-
* bounded cold start: the field stays undefined (or its existing default); it
|
|
605
|
-
* is never filled from a later entry and never by a full scan.
|
|
606
|
-
*/
|
|
607
|
-
describe("bounded cold start: cap-reached fallbacks", () => {
|
|
608
|
-
const bounds = { headBytes: 256, tailBytes: 256 };
|
|
609
|
-
const filler = (n: number, entry: unknown) =>
|
|
610
|
-
Array.from({ length: n }, () => JSON.stringify(entry));
|
|
611
|
-
const claudeFile = "11111111-2222-3333-4444-555555555555.jsonl";
|
|
612
|
-
let tmpDir: string;
|
|
613
|
-
|
|
614
|
-
beforeEach(() => {
|
|
615
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "bounded-fallback-"));
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
afterEach(() => {
|
|
619
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
function write(name: string, entries: unknown[]): string {
|
|
623
|
-
const filePath = path.join(tmpDir, name);
|
|
624
|
-
fs.writeFileSync(filePath, entries.map((entry) => JSON.stringify(entry)).join("\n") + "\n");
|
|
625
|
-
return filePath;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
it("Claude: a first user message beyond the head cap stays undefined", () => {
|
|
629
|
-
const pad = filler(20, { type: "attachment", note: "x".repeat(40) }).map((l) => JSON.parse(l));
|
|
630
|
-
const filePath = write(claudeFile, [
|
|
631
|
-
{ type: "file-history-snapshot", snapshot: { timestamp: "2026-03-10T09:00:00Z" } },
|
|
632
|
-
...pad,
|
|
633
|
-
{ type: "user", timestamp: "2026-03-10T10:00:00Z", message: { content: "first" } },
|
|
634
|
-
...pad,
|
|
635
|
-
{ type: "user", timestamp: "2026-03-10T11:00:00Z", message: { content: "latest" } },
|
|
636
|
-
{ type: "assistant", timestamp: "2026-03-10T11:01:00Z", cwd: "/repo" },
|
|
637
|
-
]);
|
|
638
|
-
|
|
639
|
-
const session = new ClaudeSessionParser({ summaryBounds: bounds }).readSessionIncremental(
|
|
640
|
-
filePath,
|
|
641
|
-
"",
|
|
642
|
-
);
|
|
643
|
-
|
|
644
|
-
expect(new ClaudeSessionParser().readSession(filePath, "")?.firstUserMessage).toBe("first");
|
|
645
|
-
expect(session).toMatchObject({
|
|
646
|
-
firstUserMessage: undefined,
|
|
647
|
-
lastUserMessage: "latest",
|
|
648
|
-
sessionStart: new Date("2026-03-10T09:00:00Z"),
|
|
649
|
-
lastActive: new Date("2026-03-10T11:01:00Z"),
|
|
650
|
-
lastEntryType: "assistant",
|
|
651
|
-
lastCwd: "/repo",
|
|
652
|
-
});
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
it("Claude: latest fields before the tail window stay undefined", () => {
|
|
656
|
-
const pad = filler(40, { type: "attachment", note: "x".repeat(40) }).map((l) => JSON.parse(l));
|
|
657
|
-
const filePath = write(claudeFile, [
|
|
658
|
-
{
|
|
659
|
-
type: "user",
|
|
660
|
-
timestamp: "2026-03-10T10:00:00Z",
|
|
661
|
-
cwd: "/repo",
|
|
662
|
-
message: { content: "only" },
|
|
663
|
-
},
|
|
664
|
-
...pad,
|
|
665
|
-
]);
|
|
666
|
-
|
|
667
|
-
const session = new ClaudeSessionParser({ summaryBounds: bounds }).readSessionIncremental(
|
|
668
|
-
filePath,
|
|
669
|
-
"",
|
|
670
|
-
);
|
|
671
|
-
|
|
672
|
-
// The head still supplies the session start and the first user message
|
|
673
|
-
expect(session).toMatchObject({
|
|
674
|
-
firstUserMessage: "only",
|
|
675
|
-
lastUserMessage: undefined,
|
|
676
|
-
lastEntryType: undefined,
|
|
677
|
-
lastCwd: undefined,
|
|
678
|
-
isInterrupted: false,
|
|
679
|
-
sessionStart: new Date("2026-03-10T10:00:00Z"),
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
it("Codex: keeps session_meta from the head and defaults fields missing from the tail", () => {
|
|
684
|
-
const pad = filler(40, { payload: { note: "x".repeat(40) } }).map((l) => JSON.parse(l));
|
|
685
|
-
const filePath = write("rollout.jsonl", [
|
|
686
|
-
{
|
|
687
|
-
type: "session_meta",
|
|
688
|
-
payload: { id: "sess-1", cwd: "/repo", timestamp: "2026-03-18T15:00:00Z" },
|
|
689
|
-
},
|
|
690
|
-
{
|
|
691
|
-
type: "event_msg",
|
|
692
|
-
timestamp: "2026-03-18T15:01:00Z",
|
|
693
|
-
payload: { type: "agent_message", message: "early" },
|
|
694
|
-
},
|
|
695
|
-
...pad,
|
|
696
|
-
]);
|
|
697
|
-
|
|
698
|
-
const session = new CodexSessionParser({ summaryBounds: bounds }).readSessionIncremental(
|
|
699
|
-
filePath,
|
|
700
|
-
);
|
|
701
|
-
|
|
702
|
-
expect(session).toMatchObject({
|
|
703
|
-
sessionId: "sess-1",
|
|
704
|
-
projectPath: "/repo",
|
|
705
|
-
summary: "Codex session active",
|
|
706
|
-
lastPayloadType: undefined,
|
|
707
|
-
sessionStart: new Date("2026-03-18T15:00:00Z"),
|
|
708
|
-
lastActive: new Date("2026-03-18T15:00:00Z"),
|
|
709
|
-
});
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
it("Codex: a session_meta line longer than the head cap yields no session", () => {
|
|
713
|
-
const pad = filler(40, {
|
|
714
|
-
type: "event_msg",
|
|
715
|
-
payload: { type: "agent_message", message: "hi" },
|
|
716
|
-
});
|
|
717
|
-
const filePath = write("rollout.jsonl", [
|
|
718
|
-
{ type: "session_meta", payload: { id: "sess-1", base: "x".repeat(400) } },
|
|
719
|
-
...pad.map((l) => JSON.parse(l)),
|
|
720
|
-
]);
|
|
721
|
-
|
|
722
|
-
expect(
|
|
723
|
-
new CodexSessionParser({ summaryBounds: bounds }).readSessionIncremental(filePath),
|
|
724
|
-
).toBeNull();
|
|
725
|
-
});
|
|
726
|
-
});
|