@ai-devkit/agent-manager 0.42.3 → 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/dist/AgentManager.d.ts +14 -5
- package/dist/AgentManager.d.ts.map +1 -1
- package/dist/AgentManager.js +32 -13
- package/dist/AgentManager.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/.swcrc +0 -27
- package/dist/__tests__/AgentManager.test.js +0 -1596
- 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 -530
- package/src/__tests__/AgentManager.test.ts +0 -1483
- 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 -70
- 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,380 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import type { ConversationMessage, ConversationOptions } from "../../adapters/AgentAdapter.js";
|
|
3
|
-
import { AgentStatus } from "../../adapters/AgentAdapter.js";
|
|
4
|
-
import {
|
|
5
|
-
IncrementalJsonlSummary,
|
|
6
|
-
reduceJsonlContent,
|
|
7
|
-
type JsonlSummaryBounds,
|
|
8
|
-
type JsonlSummaryReducer,
|
|
9
|
-
} from "../../utils/IncrementalJsonlSummary.js";
|
|
10
|
-
import { JsonlTailReader, normalizeTail } from "../../utils/jsonlTail.js";
|
|
11
|
-
import { safeReadFile, safeStat } from "../../utils/session.js";
|
|
12
|
-
import { isIdle, parseTimestamp, SUMMARY_MAX_LENGTH, truncate } from "../shared.js";
|
|
13
|
-
|
|
14
|
-
interface CopilotEventEntry {
|
|
15
|
-
type?: string;
|
|
16
|
-
data?: {
|
|
17
|
-
sessionId?: string;
|
|
18
|
-
startTime?: string;
|
|
19
|
-
context?: {
|
|
20
|
-
cwd?: string;
|
|
21
|
-
gitRoot?: string;
|
|
22
|
-
branch?: string;
|
|
23
|
-
};
|
|
24
|
-
content?: string;
|
|
25
|
-
transformedContent?: string;
|
|
26
|
-
message?: string;
|
|
27
|
-
text?: string;
|
|
28
|
-
result?: {
|
|
29
|
-
content?: string;
|
|
30
|
-
detailedContent?: string;
|
|
31
|
-
};
|
|
32
|
-
output?: string;
|
|
33
|
-
};
|
|
34
|
-
timestamp?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface CopilotWorkspace {
|
|
38
|
-
id?: string;
|
|
39
|
-
cwd?: string;
|
|
40
|
-
name?: string;
|
|
41
|
-
createdAt?: Date;
|
|
42
|
-
updatedAt?: Date;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface CopilotSession {
|
|
46
|
-
sessionId: string;
|
|
47
|
-
projectPath: string;
|
|
48
|
-
summary: string;
|
|
49
|
-
sessionStart: Date;
|
|
50
|
-
lastActive: Date;
|
|
51
|
-
lastEventType?: string;
|
|
52
|
-
firstUserMessage: string;
|
|
53
|
-
eventsFilePath: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* O(1) running summary of events.jsonl. Timestamps are epoch ms so cached
|
|
58
|
-
* state stays immutable; unset fields fall back to workspace.yaml metadata.
|
|
59
|
-
*/
|
|
60
|
-
interface CopilotEventState {
|
|
61
|
-
/** Number of lines that parsed as JSON. */
|
|
62
|
-
entryCount: number;
|
|
63
|
-
/** A bounded cold start skipped the middle: later lines are not the session's first. */
|
|
64
|
-
pastHead?: boolean;
|
|
65
|
-
sessionId?: string;
|
|
66
|
-
projectPath?: string;
|
|
67
|
-
sessionStartMs?: number;
|
|
68
|
-
lastActiveMs?: number;
|
|
69
|
-
firstUserMessage: string;
|
|
70
|
-
lastText: string;
|
|
71
|
-
lastEventType?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const VERBOSE_SYSTEM_EVENTS = new Set([
|
|
75
|
-
"system.message",
|
|
76
|
-
"session.info",
|
|
77
|
-
"session.warning",
|
|
78
|
-
"tool.execution_start",
|
|
79
|
-
"tool.execution_complete",
|
|
80
|
-
"function",
|
|
81
|
-
"abort",
|
|
82
|
-
]);
|
|
83
|
-
const WAITING_EVENTS = new Set([
|
|
84
|
-
"assistant.message",
|
|
85
|
-
"assistant.turn_end",
|
|
86
|
-
"session.shutdown",
|
|
87
|
-
"abort",
|
|
88
|
-
]);
|
|
89
|
-
|
|
90
|
-
export interface CopilotSessionParserOptions {
|
|
91
|
-
/** Cold-start scan bounds for `readSessionDirIncremental` (see IncrementalJsonlSummary). */
|
|
92
|
-
summaryBounds?: JsonlSummaryBounds | false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export class CopilotSessionParser {
|
|
96
|
-
/** Incremental reader backing `getConversation({ tail })`. */
|
|
97
|
-
private readonly tailReader = new JsonlTailReader();
|
|
98
|
-
|
|
99
|
-
private readonly eventCache: IncrementalJsonlSummary<CopilotEventState>;
|
|
100
|
-
|
|
101
|
-
constructor(options: CopilotSessionParserOptions = {}) {
|
|
102
|
-
this.eventCache = new IncrementalJsonlSummary(this.eventReducer, {
|
|
103
|
-
bounds: options.summaryBounds,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Fold one events.jsonl entry into the O(1) event summary. Mirrors the
|
|
109
|
-
* original whole-file pass: the latest valid timestamp and event type win,
|
|
110
|
-
* `session.start` overrides id/cwd/start, and user/assistant text is tracked.
|
|
111
|
-
*
|
|
112
|
-
* `skip` (bounded cold start) keeps the head's first user message and clears
|
|
113
|
-
* the latest timestamp, event type and text, so those come from the tail
|
|
114
|
-
* only. Tail entries never fill the first user message: beyond the head it
|
|
115
|
-
* stays "" and the summary falls back to the tail's latest text. The
|
|
116
|
-
* `session.start` fields (id, cwd, start) are kept from the head and, as in
|
|
117
|
-
* a full scan, a later `session.start` in the tail still overrides them; one
|
|
118
|
-
* only in the skipped middle is not seen.
|
|
119
|
-
*/
|
|
120
|
-
private readonly eventReducer: JsonlSummaryReducer<CopilotEventState> = {
|
|
121
|
-
initial: () => ({ entryCount: 0, firstUserMessage: "", lastText: "" }),
|
|
122
|
-
reduce: (state, value) => {
|
|
123
|
-
if (value === undefined) return state;
|
|
124
|
-
const next: CopilotEventState = { ...state, entryCount: state.entryCount + 1 };
|
|
125
|
-
if (!value || typeof value !== "object") return next;
|
|
126
|
-
|
|
127
|
-
const entry = value as CopilotEventEntry;
|
|
128
|
-
const timestampMs = parseTimestamp(entry.timestamp)?.getTime();
|
|
129
|
-
if (timestampMs !== undefined) {
|
|
130
|
-
next.lastActiveMs = timestampMs;
|
|
131
|
-
}
|
|
132
|
-
if (entry.type) {
|
|
133
|
-
next.lastEventType = entry.type;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (entry.type === "session.start") {
|
|
137
|
-
next.sessionId = entry.data?.sessionId || next.sessionId;
|
|
138
|
-
next.projectPath = entry.data?.context?.cwd || next.projectPath;
|
|
139
|
-
next.sessionStartMs =
|
|
140
|
-
parseTimestamp(entry.data?.startTime)?.getTime() ?? timestampMs ?? next.sessionStartMs;
|
|
141
|
-
return next;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const text = this.extractEventText(entry, false);
|
|
145
|
-
if (!text) return next;
|
|
146
|
-
|
|
147
|
-
if (!next.firstUserMessage && !state.pastHead && entry.type === "user.message") {
|
|
148
|
-
next.firstUserMessage = text;
|
|
149
|
-
}
|
|
150
|
-
if (entry.type === "user.message" || entry.type === "assistant.message") {
|
|
151
|
-
next.lastText = text;
|
|
152
|
-
}
|
|
153
|
-
return next;
|
|
154
|
-
},
|
|
155
|
-
skip: (state) => ({
|
|
156
|
-
entryCount: state.entryCount,
|
|
157
|
-
pastHead: true,
|
|
158
|
-
sessionId: state.sessionId,
|
|
159
|
-
projectPath: state.projectPath,
|
|
160
|
-
sessionStartMs: state.sessionStartMs,
|
|
161
|
-
firstUserMessage: state.firstUserMessage,
|
|
162
|
-
lastText: "",
|
|
163
|
-
}),
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
readSessionDir(sessionDir: string, fallbackSessionId: string): CopilotSession | null {
|
|
167
|
-
const eventsFilePath = path.join(sessionDir, "events.jsonl");
|
|
168
|
-
const content = safeReadFile(eventsFilePath);
|
|
169
|
-
const events =
|
|
170
|
-
content === undefined
|
|
171
|
-
? this.eventReducer.initial()
|
|
172
|
-
: reduceJsonlContent(this.eventReducer, content);
|
|
173
|
-
return this.toSession(sessionDir, fallbackSessionId, events);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Same result as `readSessionDir`, but events.jsonl is summarized through a
|
|
178
|
-
* per-instance incremental cache so repeated refreshes only parse appended
|
|
179
|
-
* bytes. Call `pruneSessionCache()` once per refresh.
|
|
180
|
-
*
|
|
181
|
-
* The first read of a large events.jsonl is a bounded head + tail scan (see
|
|
182
|
-
* `eventReducer.skip`); fields whose entries lie only in the skipped middle
|
|
183
|
-
* fall back to their defaults instead of forcing a full parse.
|
|
184
|
-
*/
|
|
185
|
-
readSessionDirIncremental(sessionDir: string, fallbackSessionId: string): CopilotSession | null {
|
|
186
|
-
const result = this.eventCache.read(path.join(sessionDir, "events.jsonl"));
|
|
187
|
-
return this.toSession(
|
|
188
|
-
sessionDir,
|
|
189
|
-
fallbackSessionId,
|
|
190
|
-
result?.state ?? this.eventReducer.initial(),
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/** Evict cached event summaries for files not read since the previous prune. */
|
|
195
|
-
pruneSessionCache(): void {
|
|
196
|
-
this.eventCache.prune();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
private toSession(
|
|
200
|
-
sessionDir: string,
|
|
201
|
-
fallbackSessionId: string,
|
|
202
|
-
events: CopilotEventState,
|
|
203
|
-
): CopilotSession | null {
|
|
204
|
-
const eventsFilePath = path.join(sessionDir, "events.jsonl");
|
|
205
|
-
const workspace = this.readWorkspaceMetadata(path.join(sessionDir, "workspace.yaml"));
|
|
206
|
-
if (events.entryCount === 0 && !this.hasWorkspaceMetadata(workspace)) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const fileStat = safeStat(eventsFilePath);
|
|
211
|
-
const defaultStart = workspace.createdAt || fileStat?.birthtime || new Date();
|
|
212
|
-
const sessionStart =
|
|
213
|
-
events.sessionStartMs !== undefined ? new Date(events.sessionStartMs) : defaultStart;
|
|
214
|
-
const lastActive =
|
|
215
|
-
events.lastActiveMs !== undefined
|
|
216
|
-
? new Date(events.lastActiveMs)
|
|
217
|
-
: workspace.updatedAt || fileStat?.mtime || defaultStart;
|
|
218
|
-
|
|
219
|
-
const summary =
|
|
220
|
-
events.firstUserMessage || events.lastText || workspace.name || "Copilot session active";
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
sessionId: events.sessionId || workspace.id || fallbackSessionId,
|
|
224
|
-
projectPath: events.projectPath || workspace.cwd || "",
|
|
225
|
-
summary: truncate(summary, SUMMARY_MAX_LENGTH),
|
|
226
|
-
sessionStart,
|
|
227
|
-
lastActive,
|
|
228
|
-
lastEventType: events.lastEventType,
|
|
229
|
-
firstUserMessage: events.firstUserMessage,
|
|
230
|
-
eventsFilePath,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[] {
|
|
235
|
-
const verbose = options?.verbose ?? false;
|
|
236
|
-
const tail = normalizeTail(options?.tail);
|
|
237
|
-
if (tail !== undefined) {
|
|
238
|
-
return this.tailReader.read(
|
|
239
|
-
sessionFilePath,
|
|
240
|
-
tail,
|
|
241
|
-
{
|
|
242
|
-
parseLine: (line) => {
|
|
243
|
-
const entry = this.parseEventLine(line);
|
|
244
|
-
return entry ? this.eventToMessage(entry, verbose) : null;
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
String(verbose),
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const content = safeReadFile(sessionFilePath);
|
|
252
|
-
if (content === undefined) return [];
|
|
253
|
-
|
|
254
|
-
const messages: ConversationMessage[] = [];
|
|
255
|
-
|
|
256
|
-
for (const entry of this.parseEventLines(content)) {
|
|
257
|
-
const message = this.eventToMessage(entry, verbose);
|
|
258
|
-
if (message) messages.push(message);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return messages;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
private eventToMessage(entry: CopilotEventEntry, verbose: boolean): ConversationMessage | null {
|
|
265
|
-
const role = this.roleForEvent(entry.type, verbose);
|
|
266
|
-
if (!role) return null;
|
|
267
|
-
|
|
268
|
-
const text = this.extractEventText(entry, verbose);
|
|
269
|
-
if (!text) return null;
|
|
270
|
-
|
|
271
|
-
return {
|
|
272
|
-
role,
|
|
273
|
-
content: text,
|
|
274
|
-
timestamp: entry.timestamp,
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
determineStatus(session: CopilotSession): AgentStatus {
|
|
279
|
-
if (session.lastEventType !== undefined && WAITING_EVENTS.has(session.lastEventType)) {
|
|
280
|
-
return AgentStatus.WAITING;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (isIdle(session.lastActive)) {
|
|
284
|
-
return AgentStatus.IDLE;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return AgentStatus.RUNNING;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
private hasWorkspaceMetadata(workspace: CopilotWorkspace): boolean {
|
|
291
|
-
return Boolean(
|
|
292
|
-
workspace.id || workspace.cwd || workspace.name || workspace.createdAt || workspace.updatedAt,
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
private readWorkspaceMetadata(filePath: string): CopilotWorkspace {
|
|
297
|
-
const content = safeReadFile(filePath);
|
|
298
|
-
if (content === undefined) return {};
|
|
299
|
-
|
|
300
|
-
const values = new Map<string, string>();
|
|
301
|
-
for (const rawLine of content.split("\n")) {
|
|
302
|
-
const line = rawLine.trim();
|
|
303
|
-
if (!line || line.startsWith("#")) continue;
|
|
304
|
-
|
|
305
|
-
const idx = line.indexOf(":");
|
|
306
|
-
if (idx === -1) continue;
|
|
307
|
-
|
|
308
|
-
const key = line.slice(0, idx).trim();
|
|
309
|
-
const value = this.stripYamlScalar(line.slice(idx + 1).trim());
|
|
310
|
-
values.set(key, value);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return {
|
|
314
|
-
id: values.get("id"),
|
|
315
|
-
cwd: values.get("cwd"),
|
|
316
|
-
name: values.get("name"),
|
|
317
|
-
createdAt: parseTimestamp(values.get("created_at")) || undefined,
|
|
318
|
-
updatedAt: parseTimestamp(values.get("updated_at")) || undefined,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
private stripYamlScalar(value: string): string {
|
|
323
|
-
if (
|
|
324
|
-
(value.startsWith('"') && value.endsWith('"')) ||
|
|
325
|
-
(value.startsWith("'") && value.endsWith("'"))
|
|
326
|
-
) {
|
|
327
|
-
return value.slice(1, -1);
|
|
328
|
-
}
|
|
329
|
-
return value;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
private parseEventLines(content: string): CopilotEventEntry[] {
|
|
333
|
-
const entries: CopilotEventEntry[] = [];
|
|
334
|
-
for (const line of content.trim().split("\n")) {
|
|
335
|
-
const entry = this.parseEventLine(line);
|
|
336
|
-
if (entry) entries.push(entry);
|
|
337
|
-
}
|
|
338
|
-
return entries;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
private parseEventLine(line: string): CopilotEventEntry | null {
|
|
342
|
-
const trimmed = line.trim();
|
|
343
|
-
if (!trimmed) return null;
|
|
344
|
-
|
|
345
|
-
try {
|
|
346
|
-
return JSON.parse(trimmed) as CopilotEventEntry;
|
|
347
|
-
} catch {
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
private roleForEvent(
|
|
353
|
-
type: string | undefined,
|
|
354
|
-
verbose: boolean,
|
|
355
|
-
): ConversationMessage["role"] | null {
|
|
356
|
-
if (type === "user.message") return "user";
|
|
357
|
-
if (type === "assistant.message") return "assistant";
|
|
358
|
-
if (verbose && type !== undefined && VERBOSE_SYSTEM_EVENTS.has(type)) {
|
|
359
|
-
return "system";
|
|
360
|
-
}
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private extractEventText(entry: CopilotEventEntry, verbose: boolean): string {
|
|
365
|
-
const data = entry.data;
|
|
366
|
-
if (!data) return "";
|
|
367
|
-
|
|
368
|
-
const raw =
|
|
369
|
-
data.content ||
|
|
370
|
-
data.message ||
|
|
371
|
-
data.text ||
|
|
372
|
-
data.result?.content ||
|
|
373
|
-
data.result?.detailedContent ||
|
|
374
|
-
(verbose ? data.output : "") ||
|
|
375
|
-
"";
|
|
376
|
-
|
|
377
|
-
if (typeof raw !== "string") return "";
|
|
378
|
-
return raw.trim();
|
|
379
|
-
}
|
|
380
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AuthReadinessCheck,
|
|
3
|
-
HarnessReadinessProfile,
|
|
4
|
-
ReadinessRuntime,
|
|
5
|
-
} from "../readiness/types.js";
|
|
6
|
-
|
|
7
|
-
async function authCheck(runtime: ReadinessRuntime): Promise<AuthReadinessCheck> {
|
|
8
|
-
try {
|
|
9
|
-
await runtime.runCommand("gh", ["auth", "status", "--hostname", "github.com"]);
|
|
10
|
-
return {
|
|
11
|
-
state: "authenticated",
|
|
12
|
-
source: "gh auth status --hostname github.com",
|
|
13
|
-
provider: "github",
|
|
14
|
-
availableProviders: ["GitHub"],
|
|
15
|
-
status: "pass",
|
|
16
|
-
errors: [],
|
|
17
|
-
};
|
|
18
|
-
} catch {
|
|
19
|
-
return {
|
|
20
|
-
state: "unknown",
|
|
21
|
-
source: "gh auth status --hostname github.com",
|
|
22
|
-
provider: null,
|
|
23
|
-
availableProviders: ["GitHub"],
|
|
24
|
-
status: "warn",
|
|
25
|
-
errors: ["Copilot authentication could not be verified through GitHub CLI"],
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const copilotReadiness: HarnessReadinessProfile = {
|
|
31
|
-
configDir: ".copilot",
|
|
32
|
-
auth: authCheck,
|
|
33
|
-
};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Devin Adapter
|
|
3
|
-
*
|
|
4
|
-
* Detects running Devin CLI agents by:
|
|
5
|
-
* 1. Filtering `devin` processes from a shared process snapshot, rejecting
|
|
6
|
-
* utility subcommands (list, doctor, ssh, ...) and `devin acp` children
|
|
7
|
-
* spawned by a Devin TUI
|
|
8
|
-
* 2. Matching processes to sessions via `session_locks/<slug>.lock` files,
|
|
9
|
-
* which contain the PID of the session's `devin acp` backend (lock-first;
|
|
10
|
-
* a TUI is matched through its backend child's ppid)
|
|
11
|
-
* 3. Falling back to `sessions.working_directory` matching in
|
|
12
|
-
* ~/.local/share/devin/cli/sessions.db (WAL SQLite, opened read-only)
|
|
13
|
-
*
|
|
14
|
-
* sessionFilePath encodes "<dbPath>::<sessionSlug>" so getConversation() can
|
|
15
|
-
* address a session row without extending the AgentAdapter interface.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import type {
|
|
19
|
-
AgentAdapter,
|
|
20
|
-
AgentInfo,
|
|
21
|
-
ProcessInfo,
|
|
22
|
-
ConversationMessage,
|
|
23
|
-
ConversationOptions,
|
|
24
|
-
SessionSummary,
|
|
25
|
-
ListSessionsOptions,
|
|
26
|
-
AgentDetectionContext,
|
|
27
|
-
} from "../../adapters/AgentAdapter.js";
|
|
28
|
-
import { DevinAgentMapper } from "./DevinAgentMapper.js";
|
|
29
|
-
import { DevinSessionLocator, decodeDevinSessionRef } from "./DevinSessionLocator.js";
|
|
30
|
-
import { DevinSessionParser } from "./DevinSessionParser.js";
|
|
31
|
-
import { findHarnessProcesses, matchesExecutable } from "../shared.js";
|
|
32
|
-
import { executablePath } from "../../utils/process.js";
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* `devin` invocations that are utilities, not agent sessions. `acp` is
|
|
36
|
-
* deliberately absent: a standalone `devin acp` serves an external client
|
|
37
|
-
* and is itself an agent.
|
|
38
|
-
*/
|
|
39
|
-
const UTILITY_SUBCOMMANDS = new Set([
|
|
40
|
-
"auth",
|
|
41
|
-
"cloud",
|
|
42
|
-
"desktop",
|
|
43
|
-
"doctor",
|
|
44
|
-
"forward",
|
|
45
|
-
"help",
|
|
46
|
-
"list",
|
|
47
|
-
"ls",
|
|
48
|
-
"mcp",
|
|
49
|
-
"migrate",
|
|
50
|
-
"models",
|
|
51
|
-
"plugins",
|
|
52
|
-
"rm",
|
|
53
|
-
"rules",
|
|
54
|
-
"sandbox",
|
|
55
|
-
"setup",
|
|
56
|
-
"skills",
|
|
57
|
-
"ssh",
|
|
58
|
-
"uninstall",
|
|
59
|
-
"update",
|
|
60
|
-
"version",
|
|
61
|
-
]);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Flags that always consume the next argv token as their value.
|
|
65
|
-
* (`devin --help`, main-command options.)
|
|
66
|
-
*/
|
|
67
|
-
const REQUIRED_VALUE_FLAGS = new Set(["--prompt-file", "--config", "--permission-mode", "--model"]);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Flags whose value is optional: the next token is consumed only when it
|
|
71
|
-
* isn't itself a flag (commander `[<VALUE>]` semantics).
|
|
72
|
-
*/
|
|
73
|
-
const OPTIONAL_VALUE_FLAGS = new Set([
|
|
74
|
-
"-p",
|
|
75
|
-
"--print",
|
|
76
|
-
"-r",
|
|
77
|
-
"--resume",
|
|
78
|
-
"--export",
|
|
79
|
-
"--respect-workspace-trust",
|
|
80
|
-
]);
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* First positional argv token after argv[0] — the subcommand candidate.
|
|
84
|
-
* Flag values are skipped (so `devin -p "update deps"` isn't mistaken for
|
|
85
|
-
* the `update` subcommand); `--` ends the search.
|
|
86
|
-
*/
|
|
87
|
-
function firstPositionalToken(command: string): string | null {
|
|
88
|
-
const argv0 = executablePath(command);
|
|
89
|
-
const tokens = command.trim().slice(argv0.length).trim().split(/\s+/);
|
|
90
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
91
|
-
const token = tokens[i];
|
|
92
|
-
if (!token) continue;
|
|
93
|
-
if (token === "--") return null;
|
|
94
|
-
if (!token.startsWith("-")) return token;
|
|
95
|
-
const flag = token.split("=", 1)[0];
|
|
96
|
-
if (flag === token) {
|
|
97
|
-
if (REQUIRED_VALUE_FLAGS.has(flag)) {
|
|
98
|
-
i++;
|
|
99
|
-
} else if (OPTIONAL_VALUE_FLAGS.has(flag) && !tokens[i + 1]?.startsWith("-")) {
|
|
100
|
-
i++;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class DevinAdapter implements AgentAdapter {
|
|
108
|
-
readonly type = "devin" as const;
|
|
109
|
-
readonly processNames = ["devin"] as const;
|
|
110
|
-
|
|
111
|
-
private readonly parser: DevinSessionParser;
|
|
112
|
-
private readonly locator: DevinSessionLocator;
|
|
113
|
-
private readonly mapper: DevinAgentMapper;
|
|
114
|
-
private readonly cleanup = (): void => this.close();
|
|
115
|
-
|
|
116
|
-
constructor(dbPath?: string, locksDir?: string) {
|
|
117
|
-
this.parser = new DevinSessionParser();
|
|
118
|
-
// Locator defaults resolve dbPath itself and derive locksDir from it.
|
|
119
|
-
this.locator = new DevinSessionLocator(dbPath, locksDir, this.parser);
|
|
120
|
-
this.mapper = new DevinAgentMapper(this.locator.dbFilePath);
|
|
121
|
-
process.once("exit", this.cleanup);
|
|
122
|
-
process.once("SIGINT", this.cleanup);
|
|
123
|
-
process.once("SIGTERM", this.cleanup);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
close(): void {
|
|
127
|
-
process.off("exit", this.cleanup);
|
|
128
|
-
process.off("SIGINT", this.cleanup);
|
|
129
|
-
process.off("SIGTERM", this.cleanup);
|
|
130
|
-
this.locator.close();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
canHandle(processInfo: ProcessInfo): boolean {
|
|
134
|
-
if (!matchesExecutable(processInfo.command, "devin")) return false;
|
|
135
|
-
const subcommand = firstPositionalToken(processInfo.command);
|
|
136
|
-
return subcommand === null || !UTILITY_SUBCOMMANDS.has(subcommand.toLowerCase());
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async detectAgents(context?: AgentDetectionContext): Promise<AgentInfo[]> {
|
|
140
|
-
const { processes } = await findHarnessProcesses(this, context);
|
|
141
|
-
if (processes.length === 0) return [];
|
|
142
|
-
|
|
143
|
-
const db = this.locator.openDb();
|
|
144
|
-
const processByPid = new Map(processes.map((proc) => [proc.pid, proc]));
|
|
145
|
-
|
|
146
|
-
// Locks map a session to its holder PID (the `devin acp` backend); a TUI
|
|
147
|
-
// is matched through its backend child's ppid. Only trust locks whose
|
|
148
|
-
// holder is a live devin process in this snapshot (stale files and PID
|
|
149
|
-
// reuse are filtered out).
|
|
150
|
-
const sessionByPid = new Map<number, string>();
|
|
151
|
-
for (const lock of this.locator.listActiveLocks()) {
|
|
152
|
-
const holder = processByPid.get(lock.pid);
|
|
153
|
-
if (!holder || !this.canHandle(holder)) continue;
|
|
154
|
-
sessionByPid.set(lock.pid, lock.sessionId);
|
|
155
|
-
if (holder.ppid !== undefined) sessionByPid.set(holder.ppid, lock.sessionId);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const agents: AgentInfo[] = [];
|
|
159
|
-
|
|
160
|
-
for (const proc of processes) {
|
|
161
|
-
if (this.isAcpBackendChild(proc, processByPid)) continue;
|
|
162
|
-
|
|
163
|
-
const slug = sessionByPid.get(proc.pid);
|
|
164
|
-
const session = !db
|
|
165
|
-
? null
|
|
166
|
-
: slug
|
|
167
|
-
? this.locator.findSessionById(db, slug)
|
|
168
|
-
: proc.cwd
|
|
169
|
-
? this.locator.findSessionForDirectory(db, proc.cwd)
|
|
170
|
-
: null;
|
|
171
|
-
|
|
172
|
-
if (!session || !db) {
|
|
173
|
-
agents.push(this.mapper.mapProcessOnlyAgent(proc));
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const stats = this.parser.getSessionStats(db, session.sessionId);
|
|
178
|
-
agents.push(this.mapper.mapSessionToAgent(session, stats, proc));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return agents;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[] {
|
|
185
|
-
const sessionId = decodeDevinSessionRef(sessionFilePath);
|
|
186
|
-
if (!sessionId) return [];
|
|
187
|
-
|
|
188
|
-
const db = this.locator.openDb();
|
|
189
|
-
if (!db) return [];
|
|
190
|
-
|
|
191
|
-
return this.parser.getConversation(db, sessionId, options);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]> {
|
|
195
|
-
return this.locator.listSessions(opts);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
async findSessionsById(sessionId: string): Promise<SessionSummary[]> {
|
|
199
|
-
return this.locator.findSessionsById(sessionId);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* A `devin acp` process spawned by another devin process is that session's
|
|
204
|
-
* backend, not a separate agent. Standalone `acp` processes (external ACP
|
|
205
|
-
* clients) keep their own agent entry.
|
|
206
|
-
*/
|
|
207
|
-
private isAcpBackendChild(proc: ProcessInfo, processByPid: Map<number, ProcessInfo>): boolean {
|
|
208
|
-
if (firstPositionalToken(proc.command)?.toLowerCase() !== "acp") return false;
|
|
209
|
-
if (proc.ppid === undefined) return false;
|
|
210
|
-
return processByPid.has(proc.ppid);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
@@ -1,39 +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 { DevinSession } from "./DevinSessionLocator.js";
|
|
5
|
-
import { encodeDevinSessionRef } from "./DevinSessionLocator.js";
|
|
6
|
-
import type { DevinSessionStats } from "./DevinSessionParser.js";
|
|
7
|
-
import { isIdle, processOnlyAgent } from "../shared.js";
|
|
8
|
-
|
|
9
|
-
export class DevinAgentMapper {
|
|
10
|
-
constructor(private readonly dbPath: string) {}
|
|
11
|
-
|
|
12
|
-
mapSessionToAgent(session: DevinSession, stats: DevinSessionStats, proc: ProcessInfo): AgentInfo {
|
|
13
|
-
const lastActive =
|
|
14
|
-
stats.lastTimeUpdated > 0
|
|
15
|
-
? new Date(stats.lastTimeUpdated)
|
|
16
|
-
: new Date(session.lastActivityAt || session.timeCreated);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
name: generateAgentName(session.directory || proc.cwd || "", proc.pid),
|
|
20
|
-
type: "devin",
|
|
21
|
-
status: this.determineStatus(stats, lastActive),
|
|
22
|
-
summary: stats.summary || session.title || "Devin session active",
|
|
23
|
-
pid: proc.pid,
|
|
24
|
-
projectPath: session.directory || proc.cwd || "",
|
|
25
|
-
sessionId: session.sessionId,
|
|
26
|
-
lastActive,
|
|
27
|
-
sessionFilePath: encodeDevinSessionRef(this.dbPath, session.sessionId),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
mapProcessOnlyAgent(proc: ProcessInfo): AgentInfo {
|
|
32
|
-
return processOnlyAgent("devin", proc, { summary: "Devin process running" });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private determineStatus(stats: DevinSessionStats, lastActive: Date): AgentStatus {
|
|
36
|
-
if (stats.lastRole === "assistant") return AgentStatus.WAITING;
|
|
37
|
-
return isIdle(lastActive) ? AgentStatus.IDLE : AgentStatus.RUNNING;
|
|
38
|
-
}
|
|
39
|
-
}
|