@ai-devkit/agent-manager 0.43.0 → 0.44.1
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/dist/harnesses/pi/PiAdapter.d.ts.map +1 -1
- package/dist/harnesses/pi/PiAdapter.js +9 -4
- package/dist/harnesses/pi/PiAdapter.js.map +1 -1
- 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,435 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import type { ConversationMessage, ConversationOptions } from "../../adapters/AgentAdapter.js";
|
|
4
|
-
import { AgentStatus } from "../../adapters/AgentAdapter.js";
|
|
5
|
-
import {
|
|
6
|
-
IncrementalJsonlSummary,
|
|
7
|
-
reduceJsonlContent,
|
|
8
|
-
type JsonlSummaryReducer,
|
|
9
|
-
} from "../../utils/IncrementalJsonlSummary.js";
|
|
10
|
-
import { JsonlTailReader, normalizeTail } from "../../utils/jsonlTail.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A single unwrapped inner record from a Muse session frame.
|
|
14
|
-
*
|
|
15
|
-
* Each session.jsonl line is one of: a direct inner record, a
|
|
16
|
-
* `{ record_json: string }` envelope, or a `retained_frame` wrapper whose
|
|
17
|
-
* `children[]` carry `record_json` strings. Inner records dispatch on
|
|
18
|
-
* `payload_type`; timestamps (`recorded_at`) are microseconds.
|
|
19
|
-
*/
|
|
20
|
-
export interface MuseInnerRecord {
|
|
21
|
-
stream?: { kind?: string; id?: string };
|
|
22
|
-
sequence?: number;
|
|
23
|
-
recorded_at?: number;
|
|
24
|
-
record_type?: string;
|
|
25
|
-
payload_type?: string;
|
|
26
|
-
payload?: Record<string, unknown>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Parsed session state extracted from a Muse transcript. */
|
|
30
|
-
export interface MuseSession {
|
|
31
|
-
sessionId: string;
|
|
32
|
-
projectPath: string;
|
|
33
|
-
/** Last display name from `session.name.changed`, when present. */
|
|
34
|
-
displayName?: string;
|
|
35
|
-
modelId?: string;
|
|
36
|
-
sessionStart: Date;
|
|
37
|
-
lastActive: Date;
|
|
38
|
-
/** Last conversation signal: user-intent, assistant reply, approval, tool batch… */
|
|
39
|
-
lastSignal?: string;
|
|
40
|
-
lastUserMessage?: string;
|
|
41
|
-
/** First meaningful user prompt in the session. */
|
|
42
|
-
firstUserMessage?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface MuseSummaryState {
|
|
46
|
-
seenFirstLine: boolean;
|
|
47
|
-
pastHead?: boolean;
|
|
48
|
-
sessionStartMs?: number;
|
|
49
|
-
lastActiveMs?: number;
|
|
50
|
-
workspaceRoot?: string;
|
|
51
|
-
modelId?: string;
|
|
52
|
-
displayName?: string;
|
|
53
|
-
lastSignal?: string;
|
|
54
|
-
lastUserMessage?: string;
|
|
55
|
-
firstUserMessage?: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Conversation-relevant shape of one inner record. Both the summary fold and
|
|
60
|
-
* the message reader switch on this instead of re-matching payload shapes.
|
|
61
|
-
*/
|
|
62
|
-
type MuseRecordKind =
|
|
63
|
-
| "metadata"
|
|
64
|
-
| "name-changed"
|
|
65
|
-
| "user-intent"
|
|
66
|
-
| "assistant"
|
|
67
|
-
| "tool-calls"
|
|
68
|
-
| "approval-started"
|
|
69
|
-
| "approval-settled"
|
|
70
|
-
| "input-requested"
|
|
71
|
-
| "input-settled"
|
|
72
|
-
| "run-terminal"
|
|
73
|
-
| "other";
|
|
74
|
-
|
|
75
|
-
function classifyRecord(record: MuseInnerRecord): MuseRecordKind {
|
|
76
|
-
const payload = record.payload;
|
|
77
|
-
if (!isRecord(payload)) return "other";
|
|
78
|
-
switch (record.payload_type) {
|
|
79
|
-
case "runtime.session.metadata":
|
|
80
|
-
return "metadata";
|
|
81
|
-
case "session.name.changed":
|
|
82
|
-
return "name-changed";
|
|
83
|
-
case "runtime.user_intent.accepted":
|
|
84
|
-
case "runtime.user_intent.materialized":
|
|
85
|
-
return "user-intent";
|
|
86
|
-
case "runtime.session":
|
|
87
|
-
break;
|
|
88
|
-
default:
|
|
89
|
-
return "other";
|
|
90
|
-
}
|
|
91
|
-
if (!isRecord(payload.event) || typeof payload.event.kind !== "string") return "other";
|
|
92
|
-
if (payload.kind === "run") {
|
|
93
|
-
switch (payload.event.kind) {
|
|
94
|
-
case "assistant_message_committed":
|
|
95
|
-
return "assistant";
|
|
96
|
-
case "assistant_tool_calls_committed":
|
|
97
|
-
return "tool-calls";
|
|
98
|
-
case "terminal":
|
|
99
|
-
return "run-terminal";
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
switch (payload.event.kind) {
|
|
103
|
-
case "approval_wait.effect.started":
|
|
104
|
-
return "approval-started";
|
|
105
|
-
case "approval_wait.effect.terminal":
|
|
106
|
-
return "approval-settled";
|
|
107
|
-
case "user_input_prompt_requested":
|
|
108
|
-
return "input-requested";
|
|
109
|
-
case "user_input_prompt_settled":
|
|
110
|
-
return "input-settled";
|
|
111
|
-
default:
|
|
112
|
-
return "other";
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const MICROSECONDS_THRESHOLD = 1_000_000_000_000_000;
|
|
117
|
-
|
|
118
|
-
/** `recorded_at` microseconds → epoch ms; null when invalid. */
|
|
119
|
-
export function museTimestampToMs(value: unknown): number | null {
|
|
120
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
121
|
-
const ms = value >= MICROSECONDS_THRESHOLD ? Math.floor(value / 1000) : value;
|
|
122
|
-
return ms >= 0 ? ms : null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Unwrap one raw frame line into zero or more inner records. */
|
|
126
|
-
export function unwrapFrameRecords(line: string): MuseInnerRecord[] {
|
|
127
|
-
let outer: unknown;
|
|
128
|
-
try {
|
|
129
|
-
outer = JSON.parse(line);
|
|
130
|
-
} catch {
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
return unwrapOuterRecords(outer);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** Unwrap an already-parsed frame value into zero or more inner records. */
|
|
137
|
-
export function unwrapOuterRecords(outer: unknown): MuseInnerRecord[] {
|
|
138
|
-
if (!outer || typeof outer !== "object") return [];
|
|
139
|
-
const obj = outer as { record_json?: unknown; children?: unknown };
|
|
140
|
-
if (typeof obj.record_json === "string") {
|
|
141
|
-
try {
|
|
142
|
-
const inner = JSON.parse(obj.record_json) as MuseInnerRecord;
|
|
143
|
-
return [inner];
|
|
144
|
-
} catch {
|
|
145
|
-
return [];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (Array.isArray(obj.children)) {
|
|
149
|
-
const out: MuseInnerRecord[] = [];
|
|
150
|
-
for (const child of obj.children) {
|
|
151
|
-
if (
|
|
152
|
-
child &&
|
|
153
|
-
typeof child === "object" &&
|
|
154
|
-
typeof (child as { record_json?: unknown }).record_json === "string"
|
|
155
|
-
) {
|
|
156
|
-
try {
|
|
157
|
-
out.push(JSON.parse((child as { record_json: string }).record_json));
|
|
158
|
-
} catch {
|
|
159
|
-
/* skip malformed child */
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return out;
|
|
164
|
-
}
|
|
165
|
-
return [obj as MuseInnerRecord];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
169
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function nonEmptyText(value: unknown): string | null {
|
|
173
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/** Collect `{ kind: "text", text }` strings from intent/model message blocks. */
|
|
177
|
-
function collectTextBlocks(value: unknown): string[] {
|
|
178
|
-
const out: string[] = [];
|
|
179
|
-
if (Array.isArray(value)) {
|
|
180
|
-
for (const block of value) {
|
|
181
|
-
if (isRecord(block) && block.kind === "text") {
|
|
182
|
-
const text = nonEmptyText(block.text);
|
|
183
|
-
if (text) out.push(text);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return out;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** User turn text from an intent payload (`refill_blocks` then `model_messages`). */
|
|
191
|
-
function intentText(payload: Record<string, unknown>): string | null {
|
|
192
|
-
const refill = collectTextBlocks(payload.refill_blocks);
|
|
193
|
-
if (refill.length > 0) return refill.join("\n");
|
|
194
|
-
const modelMessages = payload.model_messages;
|
|
195
|
-
if (Array.isArray(modelMessages)) {
|
|
196
|
-
const parts: string[] = [];
|
|
197
|
-
for (const message of modelMessages) {
|
|
198
|
-
if (isRecord(message)) parts.push(...collectTextBlocks(message.content));
|
|
199
|
-
}
|
|
200
|
-
if (parts.length > 0) return parts.join("\n");
|
|
201
|
-
}
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/** Assistant reply text from a `run.assistant_message_committed` event. */
|
|
206
|
-
function assistantEventText(event: Record<string, unknown>): string | null {
|
|
207
|
-
return nonEmptyText(event.text);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export class MuseSessionParser {
|
|
211
|
-
private readonly tailReader = new JsonlTailReader();
|
|
212
|
-
private readonly sessionCache: IncrementalJsonlSummary<MuseSummaryState>;
|
|
213
|
-
|
|
214
|
-
constructor() {
|
|
215
|
-
this.sessionCache = new IncrementalJsonlSummary(this.summaryReducer, {});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
readSession(filePath: string, projectPath: string): MuseSession | null {
|
|
219
|
-
let content: string;
|
|
220
|
-
try {
|
|
221
|
-
content = fs.readFileSync(filePath, "utf-8");
|
|
222
|
-
} catch {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
if (!content.trim()) return null;
|
|
226
|
-
return this.toSession(filePath, projectPath, reduceJsonlContent(this.summaryReducer, content));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
readSessionIncremental(filePath: string, projectPath: string): MuseSession | null {
|
|
230
|
-
const result = this.sessionCache.read(filePath);
|
|
231
|
-
return result ? this.toSession(filePath, projectPath, result.state) : null;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
pruneSessionCache(): void {
|
|
235
|
-
this.sessionCache.prune();
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
private readonly summaryReducer: JsonlSummaryReducer<MuseSummaryState> = {
|
|
239
|
-
initial: () => ({ seenFirstLine: false }),
|
|
240
|
-
reduce: (state, value) => {
|
|
241
|
-
const next: MuseSummaryState = { ...state, seenFirstLine: true };
|
|
242
|
-
// Session start comes from the first line only; the first user message
|
|
243
|
-
// may come from anywhere before a bounded-skip (mirrors Claude semantics).
|
|
244
|
-
const flags = { isHead: !state.seenFirstLine, canBeFirst: !state.pastHead };
|
|
245
|
-
for (const record of unwrapOuterRecords(value)) {
|
|
246
|
-
this.foldRecord(next, record, flags);
|
|
247
|
-
}
|
|
248
|
-
return next;
|
|
249
|
-
},
|
|
250
|
-
skip: (state) => ({
|
|
251
|
-
seenFirstLine: true,
|
|
252
|
-
pastHead: true,
|
|
253
|
-
sessionStartMs: state.sessionStartMs,
|
|
254
|
-
firstUserMessage: state.firstUserMessage,
|
|
255
|
-
}),
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Fold one inner record into the summary. `isHead` marks the first line
|
|
260
|
-
* (session start only); `canBeFirst` allows the first user message from any
|
|
261
|
-
* line read before a bounded-skip.
|
|
262
|
-
*/
|
|
263
|
-
private foldRecord(
|
|
264
|
-
next: MuseSummaryState,
|
|
265
|
-
record: MuseInnerRecord,
|
|
266
|
-
flags: { isHead: boolean; canBeFirst: boolean },
|
|
267
|
-
): void {
|
|
268
|
-
const { isHead, canBeFirst } = flags;
|
|
269
|
-
const atMs = museTimestampToMs(record.recorded_at);
|
|
270
|
-
if (atMs !== null) {
|
|
271
|
-
if (isHead && next.sessionStartMs === undefined) next.sessionStartMs = atMs;
|
|
272
|
-
next.lastActiveMs = atMs;
|
|
273
|
-
}
|
|
274
|
-
const payload = record.payload;
|
|
275
|
-
if (!isRecord(payload)) return;
|
|
276
|
-
switch (classifyRecord(record)) {
|
|
277
|
-
case "metadata": {
|
|
278
|
-
if (!isRecord(payload.record)) return;
|
|
279
|
-
const root = nonEmptyText(payload.record.workspace_root);
|
|
280
|
-
if (root) next.workspaceRoot = root;
|
|
281
|
-
const model = nonEmptyText(payload.record.model_id);
|
|
282
|
-
if (model) next.modelId = model;
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
case "name-changed": {
|
|
286
|
-
const name = nonEmptyText(payload.new_name);
|
|
287
|
-
if (name) next.displayName = name;
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
case "user-intent": {
|
|
291
|
-
next.lastSignal = "user-intent";
|
|
292
|
-
const text = intentText(payload);
|
|
293
|
-
if (text) {
|
|
294
|
-
next.lastUserMessage = text;
|
|
295
|
-
if (canBeFirst && !next.firstUserMessage) next.firstUserMessage = text;
|
|
296
|
-
}
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
case "assistant":
|
|
300
|
-
next.lastSignal = "assistant";
|
|
301
|
-
return;
|
|
302
|
-
case "approval-started":
|
|
303
|
-
next.lastSignal = "approval-wait";
|
|
304
|
-
return;
|
|
305
|
-
case "approval-settled":
|
|
306
|
-
if (next.lastSignal === "approval-wait") next.lastSignal = "assistant";
|
|
307
|
-
return;
|
|
308
|
-
case "input-requested":
|
|
309
|
-
next.lastSignal = "input-requested";
|
|
310
|
-
return;
|
|
311
|
-
case "input-settled":
|
|
312
|
-
if (next.lastSignal === "input-requested") next.lastSignal = "assistant";
|
|
313
|
-
return;
|
|
314
|
-
case "run-terminal":
|
|
315
|
-
next.lastSignal = "run-terminal";
|
|
316
|
-
return;
|
|
317
|
-
default:
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
private toSession(filePath: string, projectPath: string, state: MuseSummaryState): MuseSession {
|
|
323
|
-
const sessionStartMs = state.sessionStartMs ?? state.lastActiveMs;
|
|
324
|
-
return {
|
|
325
|
-
sessionId: path.basename(path.dirname(filePath)),
|
|
326
|
-
projectPath: projectPath || state.workspaceRoot || "",
|
|
327
|
-
displayName: state.displayName,
|
|
328
|
-
modelId: state.modelId,
|
|
329
|
-
sessionStart: sessionStartMs !== undefined ? new Date(sessionStartMs) : new Date(),
|
|
330
|
-
lastActive: state.lastActiveMs !== undefined ? new Date(state.lastActiveMs) : new Date(),
|
|
331
|
-
lastSignal: state.lastSignal,
|
|
332
|
-
lastUserMessage: state.lastUserMessage,
|
|
333
|
-
firstUserMessage: state.firstUserMessage,
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Status mapping over the last conversation signal:
|
|
339
|
-
* - user-intent → RUNNING (agent is processing the new turn)
|
|
340
|
-
* - assistant → WAITING (reply committed, awaiting user)
|
|
341
|
-
* - approval-wait / input-requested → WAITING (blocked on the user)
|
|
342
|
-
* - run-terminal → IDLE; no signal → UNKNOWN.
|
|
343
|
-
*/
|
|
344
|
-
determineStatus(session: MuseSession): AgentStatus {
|
|
345
|
-
switch (session.lastSignal) {
|
|
346
|
-
case "user-intent":
|
|
347
|
-
return AgentStatus.RUNNING;
|
|
348
|
-
case "assistant":
|
|
349
|
-
case "approval-wait":
|
|
350
|
-
case "input-requested":
|
|
351
|
-
return AgentStatus.WAITING;
|
|
352
|
-
case "run-terminal":
|
|
353
|
-
return AgentStatus.IDLE;
|
|
354
|
-
default:
|
|
355
|
-
return AgentStatus.UNKNOWN;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[] {
|
|
360
|
-
const verbose = options?.verbose ?? false;
|
|
361
|
-
const tail = normalizeTail(options?.tail);
|
|
362
|
-
if (tail !== undefined) {
|
|
363
|
-
return this.tailReader.read(
|
|
364
|
-
sessionFilePath,
|
|
365
|
-
tail,
|
|
366
|
-
{ parseLine: (line) => this.lineToMessage(line, verbose) },
|
|
367
|
-
String(verbose),
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
let content: string;
|
|
371
|
-
try {
|
|
372
|
-
content = fs.readFileSync(sessionFilePath, "utf-8");
|
|
373
|
-
} catch {
|
|
374
|
-
return [];
|
|
375
|
-
}
|
|
376
|
-
const messages: ConversationMessage[] = [];
|
|
377
|
-
for (const line of content.trim().split("\n")) {
|
|
378
|
-
messages.push(...this.linesToMessages(line, verbose));
|
|
379
|
-
}
|
|
380
|
-
return messages;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/** One raw frame line → conversation messages (usually zero or one). */
|
|
384
|
-
private linesToMessages(line: string, verbose: boolean): ConversationMessage[] {
|
|
385
|
-
const out: ConversationMessage[] = [];
|
|
386
|
-
for (const record of unwrapFrameRecords(line)) {
|
|
387
|
-
const message = this.recordToMessage(record, verbose);
|
|
388
|
-
if (message) out.push(message);
|
|
389
|
-
}
|
|
390
|
-
return out;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* One raw frame line → its first conversation message, for tail reads.
|
|
395
|
-
* A retained frame can theoretically hold several messages; the tail
|
|
396
|
-
* window counts lines, so a boundary line keeps only its first message.
|
|
397
|
-
*/
|
|
398
|
-
private lineToMessage(line: string, verbose: boolean): ConversationMessage | null {
|
|
399
|
-
return this.linesToMessages(line, verbose)[0] ?? null;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
private recordToMessage(record: MuseInnerRecord, verbose: boolean): ConversationMessage | null {
|
|
403
|
-
const payload = record.payload;
|
|
404
|
-
if (!isRecord(payload)) return null;
|
|
405
|
-
const atMs = museTimestampToMs(record.recorded_at);
|
|
406
|
-
const timestamp = atMs !== null ? new Date(atMs).toISOString() : undefined;
|
|
407
|
-
|
|
408
|
-
switch (classifyRecord(record)) {
|
|
409
|
-
case "user-intent": {
|
|
410
|
-
const text = intentText(payload);
|
|
411
|
-
if (!text) return null;
|
|
412
|
-
return { role: "user", content: text, timestamp };
|
|
413
|
-
}
|
|
414
|
-
case "assistant": {
|
|
415
|
-
if (!isRecord(payload.event)) return null;
|
|
416
|
-
const text = assistantEventText(payload.event);
|
|
417
|
-
if (!text) return null;
|
|
418
|
-
return { role: "assistant", content: text, timestamp };
|
|
419
|
-
}
|
|
420
|
-
case "tool-calls": {
|
|
421
|
-
if (!verbose || !isRecord(payload.event) || !Array.isArray(payload.event.tool_calls)) {
|
|
422
|
-
return null;
|
|
423
|
-
}
|
|
424
|
-
const names = (payload.event.tool_calls as unknown[])
|
|
425
|
-
.filter(isRecord)
|
|
426
|
-
.map((call) => nonEmptyText(call.tool_name))
|
|
427
|
-
.filter((name): name is string => name !== null);
|
|
428
|
-
if (names.length === 0) return null;
|
|
429
|
-
return { role: "assistant", content: `tool calls: ${names.join(", ")}`, timestamp };
|
|
430
|
-
}
|
|
431
|
-
default:
|
|
432
|
-
return null;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { displayHome, record } from "../readiness/checks.js";
|
|
3
|
-
import type {
|
|
4
|
-
AuthReadinessCheck,
|
|
5
|
-
HarnessReadinessProfile,
|
|
6
|
-
ReadinessRuntime,
|
|
7
|
-
} from "../readiness/types.js";
|
|
8
|
-
|
|
9
|
-
async function authCheck(runtime: ReadinessRuntime): Promise<AuthReadinessCheck> {
|
|
10
|
-
const sourcePath = join(runtime.homeDir, ".config", "muse", "auth.json");
|
|
11
|
-
try {
|
|
12
|
-
const parsed = record(JSON.parse(await runtime.readFile(sourcePath)));
|
|
13
|
-
if (!parsed) throw new Error("invalid");
|
|
14
|
-
const authenticated = Object.keys(parsed).length > 0;
|
|
15
|
-
return {
|
|
16
|
-
state: authenticated ? "authenticated" : "unauthenticated",
|
|
17
|
-
source: displayHome(sourcePath, runtime.homeDir),
|
|
18
|
-
provider: null,
|
|
19
|
-
availableProviders: [],
|
|
20
|
-
status: authenticated ? "pass" : "fail",
|
|
21
|
-
errors: authenticated ? [] : ["Muse credential file has no entries"],
|
|
22
|
-
};
|
|
23
|
-
} catch {
|
|
24
|
-
return {
|
|
25
|
-
state: "unauthenticated",
|
|
26
|
-
source: displayHome(sourcePath, runtime.homeDir),
|
|
27
|
-
provider: null,
|
|
28
|
-
availableProviders: [],
|
|
29
|
-
status: "fail",
|
|
30
|
-
errors: ["Muse credential file is missing or invalid"],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const museReadiness: HarnessReadinessProfile = {
|
|
36
|
-
configDir: ".config/muse",
|
|
37
|
-
auth: authCheck,
|
|
38
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode Adapter
|
|
3
|
-
*
|
|
4
|
-
* Detects running OpenCode agents by:
|
|
5
|
-
* 1. Filtering OpenCode processes from a shared asynchronous process snapshot
|
|
6
|
-
* 2. Using snapshot CWD and start-time enrichment
|
|
7
|
-
* 3. Querying OpenCode's SQLite DB (~/.local/share/opencode/opencode.db) to
|
|
8
|
-
* find the session matching each process's CWD and read status from message.time.completed
|
|
9
|
-
*
|
|
10
|
-
* sessionFilePath encodes "<dbPath>::<sessionId>" so getConversation() can open the right
|
|
11
|
-
* DB row without extending the AgentAdapter interface.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import type {
|
|
15
|
-
AgentAdapter,
|
|
16
|
-
AgentInfo,
|
|
17
|
-
ProcessInfo,
|
|
18
|
-
ConversationMessage,
|
|
19
|
-
ConversationOptions,
|
|
20
|
-
SessionSummary,
|
|
21
|
-
ListSessionsOptions,
|
|
22
|
-
AgentDetectionContext,
|
|
23
|
-
} from "../../adapters/AgentAdapter.js";
|
|
24
|
-
import { OpenCodeAgentMapper } from "./OpenCodeAgentMapper.js";
|
|
25
|
-
import { OpenCodeSessionLocator } from "./OpenCodeSessionLocator.js";
|
|
26
|
-
import { OpenCodeSessionParser } from "./OpenCodeSessionParser.js";
|
|
27
|
-
import { findHarnessProcesses, matchesExecutable } from "../shared.js";
|
|
28
|
-
|
|
29
|
-
const SESSION_REF_SEP = "::";
|
|
30
|
-
|
|
31
|
-
function decodeSessionRef(ref: string): { sessionId: string } | null {
|
|
32
|
-
const idx = ref.lastIndexOf(SESSION_REF_SEP);
|
|
33
|
-
if (idx === -1) return null;
|
|
34
|
-
return { sessionId: ref.slice(idx + SESSION_REF_SEP.length) };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class OpenCodeAdapter implements AgentAdapter {
|
|
38
|
-
readonly type = "opencode" as const;
|
|
39
|
-
readonly processNames = ["opencode"] as const;
|
|
40
|
-
|
|
41
|
-
private readonly parser: OpenCodeSessionParser;
|
|
42
|
-
private readonly locator: OpenCodeSessionLocator;
|
|
43
|
-
private readonly mapper: OpenCodeAgentMapper;
|
|
44
|
-
private readonly cleanup = (): void => this.close();
|
|
45
|
-
|
|
46
|
-
constructor(dbPath?: string) {
|
|
47
|
-
this.parser = new OpenCodeSessionParser();
|
|
48
|
-
this.locator = new OpenCodeSessionLocator(dbPath, this.parser);
|
|
49
|
-
this.mapper = new OpenCodeAgentMapper(this.locator.dbFilePath);
|
|
50
|
-
process.once("exit", this.cleanup);
|
|
51
|
-
process.once("SIGINT", this.cleanup);
|
|
52
|
-
process.once("SIGTERM", this.cleanup);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
close(): void {
|
|
56
|
-
process.off("exit", this.cleanup);
|
|
57
|
-
process.off("SIGINT", this.cleanup);
|
|
58
|
-
process.off("SIGTERM", this.cleanup);
|
|
59
|
-
this.locator.close();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
canHandle(processInfo: ProcessInfo): boolean {
|
|
63
|
-
return matchesExecutable(processInfo.command, "opencode");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async detectAgents(context?: AgentDetectionContext): Promise<AgentInfo[]> {
|
|
67
|
-
const { processes } = await findHarnessProcesses(this, context);
|
|
68
|
-
if (processes.length === 0) return [];
|
|
69
|
-
|
|
70
|
-
const db = this.locator.openDb();
|
|
71
|
-
if (!db) return processes.map((process) => this.mapper.mapProcessOnlyAgent(process));
|
|
72
|
-
|
|
73
|
-
const agents: AgentInfo[] = [];
|
|
74
|
-
for (const proc of processes) {
|
|
75
|
-
if (!proc.cwd) {
|
|
76
|
-
agents.push(this.mapper.mapProcessOnlyAgent(proc));
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const session = this.locator.findSessionForDirectory(db, proc.cwd);
|
|
81
|
-
if (!session) {
|
|
82
|
-
agents.push(this.mapper.mapProcessOnlyAgent(proc));
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const stats = this.parser.getSessionStats(db, session.sessionId);
|
|
87
|
-
agents.push(this.mapper.mapSessionToAgent(session, stats, proc));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return agents;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[] {
|
|
94
|
-
const ref = decodeSessionRef(sessionFilePath);
|
|
95
|
-
if (!ref) return [];
|
|
96
|
-
|
|
97
|
-
const db = this.locator.openDb();
|
|
98
|
-
if (!db) return [];
|
|
99
|
-
|
|
100
|
-
return this.parser.getConversation(db, ref.sessionId, options);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]> {
|
|
104
|
-
return this.locator.listSessions(opts);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async findSessionsById(sessionId: string): Promise<SessionSummary[]> {
|
|
108
|
-
return this.locator.findSessionsById(sessionId);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { AgentInfo, ProcessInfo } from "../../adapters/AgentAdapter.js";
|
|
2
|
-
import { AgentStatus } from "../../adapters/AgentAdapter.js";
|
|
3
|
-
import { generateAgentName } from "../../utils/matching.js";
|
|
4
|
-
import type { OpenCodeSession } from "./OpenCodeSessionLocator.js";
|
|
5
|
-
import type { OpenCodeSessionStats } from "./OpenCodeSessionParser.js";
|
|
6
|
-
import { isIdle, processOnlyAgent } from "../shared.js";
|
|
7
|
-
|
|
8
|
-
const SESSION_REF_SEP = "::";
|
|
9
|
-
|
|
10
|
-
function encodeSessionRef(dbPath: string, sessionId: string): string {
|
|
11
|
-
return `${dbPath}${SESSION_REF_SEP}${sessionId}`;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class OpenCodeAgentMapper {
|
|
15
|
-
constructor(private readonly dbPath: string) {}
|
|
16
|
-
|
|
17
|
-
mapSessionToAgent(
|
|
18
|
-
session: OpenCodeSession,
|
|
19
|
-
stats: OpenCodeSessionStats,
|
|
20
|
-
proc: ProcessInfo,
|
|
21
|
-
): AgentInfo {
|
|
22
|
-
const lastActive =
|
|
23
|
-
stats.lastTimeUpdated > 0 ? new Date(stats.lastTimeUpdated) : new Date(session.timeCreated);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
name: generateAgentName(session.directory || proc.cwd || "", proc.pid),
|
|
27
|
-
type: "opencode",
|
|
28
|
-
status: this.determineStatus(stats, lastActive),
|
|
29
|
-
summary: stats.summary || "OpenCode session active",
|
|
30
|
-
pid: proc.pid,
|
|
31
|
-
projectPath: session.directory || proc.cwd || "",
|
|
32
|
-
sessionId: session.sessionId,
|
|
33
|
-
lastActive,
|
|
34
|
-
sessionFilePath: encodeSessionRef(this.dbPath, session.sessionId),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
mapProcessOnlyAgent(proc: ProcessInfo): AgentInfo {
|
|
39
|
-
return processOnlyAgent("opencode", proc, { summary: "OpenCode process running" });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private determineStatus(stats: OpenCodeSessionStats, lastActive: Date): AgentStatus {
|
|
43
|
-
if (stats.lastRole === "assistant" && stats.lastAssistantCompleted) {
|
|
44
|
-
return AgentStatus.WAITING;
|
|
45
|
-
}
|
|
46
|
-
if (isIdle(lastActive)) return AgentStatus.IDLE;
|
|
47
|
-
return AgentStatus.RUNNING;
|
|
48
|
-
}
|
|
49
|
-
}
|