@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,230 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import Database from "better-sqlite3";
|
|
4
|
-
import type { ListSessionsOptions, SessionSummary } from "../../adapters/AgentAdapter.js";
|
|
5
|
-
import { DevinSessionParser } from "./DevinSessionParser.js";
|
|
6
|
-
import { homeDir } from "../shared.js";
|
|
7
|
-
|
|
8
|
-
const SESSION_REF_SEP = "::";
|
|
9
|
-
const LOCK_FILE_SUFFIX = ".lock";
|
|
10
|
-
|
|
11
|
-
export function encodeDevinSessionRef(dbPath: string, sessionId: string): string {
|
|
12
|
-
return `${dbPath}${SESSION_REF_SEP}${sessionId}`;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** Inverse of {@link encodeDevinSessionRef}; null when the ref has no separator. */
|
|
16
|
-
export function decodeDevinSessionRef(ref: string): string | null {
|
|
17
|
-
const idx = ref.lastIndexOf(SESSION_REF_SEP);
|
|
18
|
-
return idx === -1 ? null : ref.slice(idx + SESSION_REF_SEP.length);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface DevinSession {
|
|
22
|
-
sessionId: string;
|
|
23
|
-
directory: string;
|
|
24
|
-
title: string | null;
|
|
25
|
-
/** Epoch milliseconds. */
|
|
26
|
-
timeCreated: number;
|
|
27
|
-
/** Epoch milliseconds. */
|
|
28
|
-
lastActivityAt: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** A live `session_locks/<slug>.lock` entry: the session and its holder PID. */
|
|
32
|
-
export interface DevinSessionLock {
|
|
33
|
-
sessionId: string;
|
|
34
|
-
pid: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface DevinSessionRow {
|
|
38
|
-
id: string;
|
|
39
|
-
working_directory: string;
|
|
40
|
-
title: string | null;
|
|
41
|
-
created_at: number;
|
|
42
|
-
last_activity_at: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function toDevinSession(row: DevinSessionRow): DevinSession {
|
|
46
|
-
return {
|
|
47
|
-
sessionId: row.id,
|
|
48
|
-
directory: row.working_directory,
|
|
49
|
-
title: row.title,
|
|
50
|
-
timeCreated: row.created_at * 1000,
|
|
51
|
-
lastActivityAt: row.last_activity_at * 1000,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class DevinSessionLocator {
|
|
56
|
-
private readonly dbPath: string;
|
|
57
|
-
private readonly locksDir: string;
|
|
58
|
-
private db: Database.Database | null = null;
|
|
59
|
-
|
|
60
|
-
constructor(
|
|
61
|
-
dbPath = DevinSessionLocator.resolveDbPath(),
|
|
62
|
-
locksDir = DevinSessionLocator.defaultLocksDir(dbPath),
|
|
63
|
-
private readonly parser: DevinSessionParser = new DevinSessionParser(),
|
|
64
|
-
) {
|
|
65
|
-
this.dbPath = dbPath;
|
|
66
|
-
this.locksDir = locksDir;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static resolveDbPath(): string {
|
|
70
|
-
const xdg = process.env.XDG_DATA_HOME;
|
|
71
|
-
const base = xdg || path.join(homeDir(), ".local", "share");
|
|
72
|
-
return path.join(base, "devin", "cli", "sessions.db");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static defaultLocksDir(dbPath: string): string {
|
|
76
|
-
return path.join(path.dirname(dbPath), "session_locks");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
openDb(): Database.Database | null {
|
|
80
|
-
if (this.db) return this.db;
|
|
81
|
-
if (!fs.existsSync(this.dbPath)) return null;
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
this.db = new Database(this.dbPath, { readonly: true });
|
|
85
|
-
return this.db;
|
|
86
|
-
} catch {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
close(): void {
|
|
92
|
-
if (this.db) {
|
|
93
|
-
try {
|
|
94
|
-
this.db.close();
|
|
95
|
-
} catch {
|
|
96
|
-
/* ignore */
|
|
97
|
-
}
|
|
98
|
-
this.db = null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Read `session_locks/*.lock` entries. Each file name is a session slug and
|
|
104
|
-
* its body is the PID of the `devin acp` backend holding the session.
|
|
105
|
-
* Malformed files are skipped; callers validate liveness against the
|
|
106
|
-
* process snapshot.
|
|
107
|
-
*/
|
|
108
|
-
listActiveLocks(): DevinSessionLock[] {
|
|
109
|
-
let entries: string[];
|
|
110
|
-
try {
|
|
111
|
-
entries = fs.readdirSync(this.locksDir);
|
|
112
|
-
} catch {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const locks: DevinSessionLock[] = [];
|
|
117
|
-
for (const entry of entries) {
|
|
118
|
-
if (!entry.endsWith(LOCK_FILE_SUFFIX)) continue;
|
|
119
|
-
const sessionId = entry.slice(0, -LOCK_FILE_SUFFIX.length);
|
|
120
|
-
if (!sessionId) continue;
|
|
121
|
-
|
|
122
|
-
try {
|
|
123
|
-
const raw = fs.readFileSync(path.join(this.locksDir, entry), "utf-8").trim();
|
|
124
|
-
const pid = parseInt(raw, 10);
|
|
125
|
-
if (Number.isFinite(pid) && pid > 0) locks.push({ sessionId, pid });
|
|
126
|
-
} catch {
|
|
127
|
-
/* skip unreadable lock */
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return locks;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
findSessionById(db: Database.Database, sessionId: string): DevinSession | null {
|
|
134
|
-
try {
|
|
135
|
-
const row = db
|
|
136
|
-
.prepare<[string], DevinSessionRow>(`
|
|
137
|
-
SELECT id, working_directory, title, created_at, last_activity_at
|
|
138
|
-
FROM sessions
|
|
139
|
-
WHERE id = ? AND hidden = 0
|
|
140
|
-
`)
|
|
141
|
-
.get(sessionId);
|
|
142
|
-
return row ? toDevinSession(row) : null;
|
|
143
|
-
} catch {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
findSessionForDirectory(db: Database.Database, directory: string): DevinSession | null {
|
|
149
|
-
try {
|
|
150
|
-
const row = db
|
|
151
|
-
.prepare<[string], DevinSessionRow>(`
|
|
152
|
-
SELECT id, working_directory, title, created_at, last_activity_at
|
|
153
|
-
FROM sessions
|
|
154
|
-
WHERE working_directory = ? AND hidden = 0
|
|
155
|
-
ORDER BY last_activity_at DESC
|
|
156
|
-
LIMIT 1
|
|
157
|
-
`)
|
|
158
|
-
.get(directory);
|
|
159
|
-
return row ? toDevinSession(row) : null;
|
|
160
|
-
} catch {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
listSessions(opts?: ListSessionsOptions): SessionSummary[] {
|
|
166
|
-
const db = this.openDb();
|
|
167
|
-
if (!db) return [];
|
|
168
|
-
|
|
169
|
-
try {
|
|
170
|
-
const rows = db
|
|
171
|
-
.prepare<[], DevinSessionRow>(`
|
|
172
|
-
SELECT id, working_directory, title, created_at, last_activity_at
|
|
173
|
-
FROM sessions
|
|
174
|
-
WHERE hidden = 0
|
|
175
|
-
ORDER BY last_activity_at DESC
|
|
176
|
-
`)
|
|
177
|
-
.all();
|
|
178
|
-
|
|
179
|
-
const summaries: SessionSummary[] = [];
|
|
180
|
-
for (const row of rows) {
|
|
181
|
-
if (opts?.cwd !== undefined && row.working_directory !== opts.cwd) continue;
|
|
182
|
-
summaries.push(this.toSessionSummary(db, row));
|
|
183
|
-
}
|
|
184
|
-
return summaries;
|
|
185
|
-
} catch {
|
|
186
|
-
this.close();
|
|
187
|
-
return [];
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
findSessionsById(sessionId: string): SessionSummary[] {
|
|
192
|
-
const db = this.openDb();
|
|
193
|
-
if (!db) return [];
|
|
194
|
-
|
|
195
|
-
try {
|
|
196
|
-
const row = db
|
|
197
|
-
.prepare<[string], DevinSessionRow>(`
|
|
198
|
-
SELECT id, working_directory, title, created_at, last_activity_at
|
|
199
|
-
FROM sessions
|
|
200
|
-
WHERE id = ? AND hidden = 0
|
|
201
|
-
`)
|
|
202
|
-
.get(sessionId);
|
|
203
|
-
return row ? [this.toSessionSummary(db, row)] : [];
|
|
204
|
-
} catch {
|
|
205
|
-
this.close();
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
private toSessionSummary(db: Database.Database, row: DevinSessionRow): SessionSummary {
|
|
211
|
-
const session = toDevinSession(row);
|
|
212
|
-
return {
|
|
213
|
-
type: "devin",
|
|
214
|
-
sessionId: session.sessionId,
|
|
215
|
-
cwd: session.directory,
|
|
216
|
-
firstUserMessage: this.parser.getFirstUserMessage(db, session.sessionId),
|
|
217
|
-
lastActive: new Date(session.lastActivityAt),
|
|
218
|
-
startedAt: new Date(session.timeCreated),
|
|
219
|
-
sessionFilePath: encodeDevinSessionRef(this.dbPath, session.sessionId),
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
get dbFilePath(): string {
|
|
224
|
-
return this.dbPath;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
get sessionLocksDir(): string {
|
|
228
|
-
return this.locksDir;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import type { ConversationMessage, ConversationOptions } from "../../adapters/AgentAdapter.js";
|
|
2
|
-
import { sliceTail } from "../../utils/jsonlTail.js";
|
|
3
|
-
import { SUMMARY_MAX_LENGTH, truncate } from "../shared.js";
|
|
4
|
-
import type Database from "better-sqlite3";
|
|
5
|
-
|
|
6
|
-
export interface DevinSessionStats {
|
|
7
|
-
lastRole: string | null;
|
|
8
|
-
/** Epoch milliseconds of the newest message node. */
|
|
9
|
-
lastTimeUpdated: number;
|
|
10
|
-
summary: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface DevinChatMessage {
|
|
14
|
-
message_id?: string;
|
|
15
|
-
role?: string;
|
|
16
|
-
content?: unknown;
|
|
17
|
-
tool_calls?: { name?: string; function?: { name?: string } }[];
|
|
18
|
-
thinking?: { thinking?: string } | string;
|
|
19
|
-
name?: string;
|
|
20
|
-
metadata?: { is_user_input?: boolean };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface MessageNodeRow {
|
|
24
|
-
node_id: number;
|
|
25
|
-
chat_message: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const EMPTY_STATS: DevinSessionStats = {
|
|
29
|
-
lastRole: null,
|
|
30
|
-
lastTimeUpdated: 0,
|
|
31
|
-
summary: "",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** Rows fetched per requested tail message; revisions/tools eat into the window. */
|
|
35
|
-
const TAIL_OVERFETCH = 8;
|
|
36
|
-
const TOOL_CONTENT_MAX = 500;
|
|
37
|
-
|
|
38
|
-
export class DevinSessionParser {
|
|
39
|
-
getConversation(
|
|
40
|
-
db: Database.Database,
|
|
41
|
-
sessionId: string,
|
|
42
|
-
options?: ConversationOptions,
|
|
43
|
-
): ConversationMessage[] {
|
|
44
|
-
const verbose = options?.verbose ?? false;
|
|
45
|
-
const tail =
|
|
46
|
-
options?.tail && Number.isInteger(options.tail) && options.tail > 0
|
|
47
|
-
? options.tail
|
|
48
|
-
: undefined;
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
// LIMIT -1 = unbounded in SQLite; one query serves the full and tail paths.
|
|
52
|
-
const limit = tail ? tail * TAIL_OVERFETCH : -1;
|
|
53
|
-
const rows = db
|
|
54
|
-
.prepare<[string, number], MessageNodeRow>(`
|
|
55
|
-
SELECT node_id, chat_message
|
|
56
|
-
FROM message_nodes
|
|
57
|
-
WHERE session_id = ?
|
|
58
|
-
ORDER BY node_id DESC
|
|
59
|
-
LIMIT ?
|
|
60
|
-
`)
|
|
61
|
-
.all(sessionId, limit)
|
|
62
|
-
.reverse();
|
|
63
|
-
|
|
64
|
-
const messages: ConversationMessage[] = [];
|
|
65
|
-
const latestNodeByMessageId = new Map<string, number>();
|
|
66
|
-
const parsed: { nodeId: number; message: DevinChatMessage }[] = [];
|
|
67
|
-
|
|
68
|
-
for (const row of rows) {
|
|
69
|
-
const message = this.parseChatMessage(row.chat_message);
|
|
70
|
-
if (!message) continue;
|
|
71
|
-
parsed.push({ nodeId: row.node_id, message });
|
|
72
|
-
if (message.message_id) {
|
|
73
|
-
latestNodeByMessageId.set(
|
|
74
|
-
message.message_id,
|
|
75
|
-
Math.max(latestNodeByMessageId.get(message.message_id) ?? 0, row.node_id),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
for (const { nodeId, message } of parsed) {
|
|
81
|
-
if (message.message_id && latestNodeByMessageId.get(message.message_id) !== nodeId) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const role = message.role;
|
|
86
|
-
if (role === "system") continue;
|
|
87
|
-
|
|
88
|
-
const content = typeof message.content === "string" ? message.content : "";
|
|
89
|
-
|
|
90
|
-
if (role === "user") {
|
|
91
|
-
if (message.metadata?.is_user_input === false || !content.trim()) continue;
|
|
92
|
-
messages.push({ role: "user", content });
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (role === "assistant") {
|
|
97
|
-
const thinking =
|
|
98
|
-
typeof message.thinking === "string" ? message.thinking : message.thinking?.thinking;
|
|
99
|
-
if (verbose && thinking) {
|
|
100
|
-
messages.push({ role: "assistant", content: `[thinking] ${thinking}` });
|
|
101
|
-
}
|
|
102
|
-
if (content.trim()) messages.push({ role: "assistant", content });
|
|
103
|
-
if (verbose) {
|
|
104
|
-
for (const call of message.tool_calls ?? []) {
|
|
105
|
-
const name = call.function?.name ?? call.name ?? "tool";
|
|
106
|
-
messages.push({ role: "assistant", content: `[tool: ${name}]` });
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (role === "tool" && verbose) {
|
|
113
|
-
const label = message.name ? `[tool: ${message.name}]` : "[tool]";
|
|
114
|
-
messages.push({
|
|
115
|
-
role: "assistant",
|
|
116
|
-
content: `${label} ${truncate(content.trim(), TOOL_CONTENT_MAX)}`.trim(),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return sliceTail(messages, tail);
|
|
122
|
-
} catch {
|
|
123
|
-
return [];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getSessionStats(db: Database.Database, sessionId: string): DevinSessionStats {
|
|
128
|
-
try {
|
|
129
|
-
const frontier = db
|
|
130
|
-
.prepare<[string], { chat_message: string }>(`
|
|
131
|
-
SELECT chat_message
|
|
132
|
-
FROM message_nodes
|
|
133
|
-
WHERE session_id = ?
|
|
134
|
-
ORDER BY node_id DESC
|
|
135
|
-
LIMIT 1
|
|
136
|
-
`)
|
|
137
|
-
.get(sessionId);
|
|
138
|
-
|
|
139
|
-
const heartbeat = db
|
|
140
|
-
.prepare<[string], { maxCreated: number | null }>(`
|
|
141
|
-
SELECT MAX(created_at) AS maxCreated
|
|
142
|
-
FROM message_nodes
|
|
143
|
-
WHERE session_id = ?
|
|
144
|
-
`)
|
|
145
|
-
.get(sessionId);
|
|
146
|
-
|
|
147
|
-
return {
|
|
148
|
-
lastRole: this.parseChatMessage(frontier?.chat_message ?? "")?.role ?? null,
|
|
149
|
-
lastTimeUpdated: (heartbeat?.maxCreated ?? 0) * 1000,
|
|
150
|
-
summary: this.getLastUserPrompt(db, sessionId),
|
|
151
|
-
};
|
|
152
|
-
} catch {
|
|
153
|
-
return EMPTY_STATS;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Most recent typed prompt for the "working on" summary, matching the
|
|
159
|
-
* last-user-message convention of the other adapters.
|
|
160
|
-
*/
|
|
161
|
-
getLastUserPrompt(db: Database.Database, sessionId: string): string {
|
|
162
|
-
return this.userPrompt(db, sessionId, "DESC");
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* First typed prompt for session-list identity (`firstUserMessage`).
|
|
167
|
-
*/
|
|
168
|
-
getFirstUserMessage(db: Database.Database, sessionId: string): string {
|
|
169
|
-
return this.userPrompt(db, sessionId, "ASC");
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Typed prompt in the given direction. `prompt_history` is authoritative;
|
|
174
|
-
* shell `!` commands and `/` slash commands are skipped. Falls back to a
|
|
175
|
-
* bounded `is_user_input` node scan in the same direction.
|
|
176
|
-
*/
|
|
177
|
-
private userPrompt(db: Database.Database, sessionId: string, direction: "ASC" | "DESC"): string {
|
|
178
|
-
try {
|
|
179
|
-
const prompt = db
|
|
180
|
-
.prepare<[string], { content: string }>(`
|
|
181
|
-
SELECT content
|
|
182
|
-
FROM prompt_history
|
|
183
|
-
WHERE session_id = ? AND is_shell = 0 AND content NOT LIKE '/%'
|
|
184
|
-
ORDER BY timestamp ${direction}
|
|
185
|
-
LIMIT 1
|
|
186
|
-
`)
|
|
187
|
-
.get(sessionId);
|
|
188
|
-
if (prompt?.content?.trim()) return truncate(prompt.content.trim(), SUMMARY_MAX_LENGTH);
|
|
189
|
-
} catch {
|
|
190
|
-
/* fall through to message_nodes */
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
try {
|
|
194
|
-
const rows = db
|
|
195
|
-
.prepare<[string], { chat_message: string }>(`
|
|
196
|
-
SELECT chat_message
|
|
197
|
-
FROM message_nodes
|
|
198
|
-
WHERE session_id = ? AND json_extract(chat_message, '$.role') = 'user'
|
|
199
|
-
ORDER BY node_id ${direction}
|
|
200
|
-
LIMIT 8
|
|
201
|
-
`)
|
|
202
|
-
.all(sessionId);
|
|
203
|
-
for (const row of rows) {
|
|
204
|
-
const message = this.parseChatMessage(row.chat_message);
|
|
205
|
-
if (
|
|
206
|
-
message?.role === "user" &&
|
|
207
|
-
message.metadata?.is_user_input !== false &&
|
|
208
|
-
typeof message.content === "string" &&
|
|
209
|
-
message.content.trim()
|
|
210
|
-
) {
|
|
211
|
-
return truncate(message.content.trim(), SUMMARY_MAX_LENGTH);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
} catch {
|
|
215
|
-
/* ignore */
|
|
216
|
-
}
|
|
217
|
-
return "";
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
private parseChatMessage(raw: string): DevinChatMessage | null {
|
|
221
|
-
try {
|
|
222
|
-
return JSON.parse(raw) as DevinChatMessage;
|
|
223
|
-
} catch {
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
type UnknownRecord = Record<string, unknown>;
|
|
6
|
-
|
|
7
|
-
export type DevinCredential = {
|
|
8
|
-
key: string;
|
|
9
|
-
orgId: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type DevinCredentialOptions = {
|
|
13
|
-
env?: NodeJS.ProcessEnv;
|
|
14
|
-
readFile?: (path: string, encoding: BufferEncoding) => Promise<string>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const DEVIN_KEY_MISSING = "Devin API key not found; set DEVIN_API_KEY or log in with the Devin CLI";
|
|
18
|
-
const DEVIN_ORG_MISSING =
|
|
19
|
-
"Devin organization id not found; set DEVIN_ORG_ID or log in with the Devin CLI";
|
|
20
|
-
|
|
21
|
-
function record(value: unknown): UnknownRecord | null {
|
|
22
|
-
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
23
|
-
? (value as UnknownRecord)
|
|
24
|
-
: null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function nonEmptyText(value: unknown): string | null {
|
|
28
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function readText(path: string, options: DevinCredentialOptions): Promise<string | null> {
|
|
32
|
-
try {
|
|
33
|
-
return await (options.readFile ?? readFile)(path, "utf8");
|
|
34
|
-
} catch (error) {
|
|
35
|
-
if (record(error)?.code === "ENOENT") return null;
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function parseFlatToml(contents: string): UnknownRecord | null {
|
|
41
|
-
const entries: UnknownRecord = {};
|
|
42
|
-
for (const line of contents.split("\n")) {
|
|
43
|
-
const trimmed = line.trim();
|
|
44
|
-
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith("[")) continue;
|
|
45
|
-
const match = /^([A-Za-z0-9_]+)\s*=\s*"(.*)"\s*$/.exec(trimmed);
|
|
46
|
-
if (!match) return null;
|
|
47
|
-
entries[match[1]] = match[2];
|
|
48
|
-
}
|
|
49
|
-
return entries;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function resolveKey(home: string, options: DevinCredentialOptions): Promise<string> {
|
|
53
|
-
const envKey = nonEmptyText(options.env?.DEVIN_API_KEY ?? process.env.DEVIN_API_KEY);
|
|
54
|
-
if (envKey) return envKey;
|
|
55
|
-
|
|
56
|
-
const contents = await readText(
|
|
57
|
-
join(home, ".local", "share", "devin", "credentials.toml"),
|
|
58
|
-
options,
|
|
59
|
-
);
|
|
60
|
-
if (contents === null) throw new Error(DEVIN_KEY_MISSING);
|
|
61
|
-
const parsed = parseFlatToml(contents);
|
|
62
|
-
if (parsed === null) throw new Error("Devin credentials file is malformed");
|
|
63
|
-
const key = nonEmptyText(parsed.windsurf_api_key);
|
|
64
|
-
if (!key) throw new Error(DEVIN_KEY_MISSING);
|
|
65
|
-
return key;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function resolveOrgId(home: string, options: DevinCredentialOptions): Promise<string> {
|
|
69
|
-
const envOrg = nonEmptyText(options.env?.DEVIN_ORG_ID ?? process.env.DEVIN_ORG_ID);
|
|
70
|
-
if (envOrg) return envOrg;
|
|
71
|
-
|
|
72
|
-
const contents = await readText(join(home, ".config", "devin", "config.json"), options);
|
|
73
|
-
if (contents === null) throw new Error(DEVIN_ORG_MISSING);
|
|
74
|
-
const parsed = record(JSON.parse(contents));
|
|
75
|
-
if (!parsed) throw new Error("Devin config file is malformed");
|
|
76
|
-
const orgId = nonEmptyText(record(parsed.devin)?.org_id);
|
|
77
|
-
if (!orgId) throw new Error(DEVIN_ORG_MISSING);
|
|
78
|
-
return orgId;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function resolveDevinCredential(
|
|
82
|
-
options: DevinCredentialOptions = {},
|
|
83
|
-
): Promise<DevinCredential> {
|
|
84
|
-
const env = options.env ?? process.env;
|
|
85
|
-
const home = env.HOME || homedir();
|
|
86
|
-
const [key, orgId] = await Promise.all([resolveKey(home, options), resolveOrgId(home, options)]);
|
|
87
|
-
return { key, orgId };
|
|
88
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AuthReadinessCheck,
|
|
3
|
-
HarnessReadinessProfile,
|
|
4
|
-
ReadinessRuntime,
|
|
5
|
-
} from "../readiness/types.js";
|
|
6
|
-
|
|
7
|
-
const LOGGED_IN_PATTERN = /^Logged in/m;
|
|
8
|
-
|
|
9
|
-
async function authCheck(runtime: ReadinessRuntime): Promise<AuthReadinessCheck> {
|
|
10
|
-
try {
|
|
11
|
-
const result = await runtime.runCommand("devin", ["auth", "status"]);
|
|
12
|
-
const authenticated = LOGGED_IN_PATTERN.test(result.stdout);
|
|
13
|
-
return {
|
|
14
|
-
state: authenticated ? "authenticated" : "unauthenticated",
|
|
15
|
-
source: "devin auth status",
|
|
16
|
-
provider: null,
|
|
17
|
-
availableProviders: authenticated ? ["devin"] : [],
|
|
18
|
-
status: authenticated ? "pass" : "fail",
|
|
19
|
-
errors: authenticated ? [] : ["Devin is not logged in"],
|
|
20
|
-
};
|
|
21
|
-
} catch {
|
|
22
|
-
return {
|
|
23
|
-
state: "unknown",
|
|
24
|
-
source: "devin auth status",
|
|
25
|
-
provider: null,
|
|
26
|
-
availableProviders: [],
|
|
27
|
-
status: "warn",
|
|
28
|
-
errors: ["Devin authentication probe failed"],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const devinReadiness: HarnessReadinessProfile = {
|
|
34
|
-
configDir: ".config/devin",
|
|
35
|
-
auth: authCheck,
|
|
36
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AgentInfo, ProcessInfo } from "../../adapters/AgentAdapter.js";
|
|
2
|
-
import { generateAgentName } from "../../utils/matching.js";
|
|
3
|
-
import { GeminiSessionParser, type GeminiSession } from "./GeminiSessionParser.js";
|
|
4
|
-
import { processOnlyAgent } from "../shared.js";
|
|
5
|
-
|
|
6
|
-
export class GeminiAgentMapper {
|
|
7
|
-
constructor(private readonly parser: GeminiSessionParser = new GeminiSessionParser()) {}
|
|
8
|
-
|
|
9
|
-
mapSessionToAgent(session: GeminiSession, processInfo: ProcessInfo, filePath: string): AgentInfo {
|
|
10
|
-
const projectPath = session.projectPath || processInfo.cwd || "";
|
|
11
|
-
return {
|
|
12
|
-
name: generateAgentName(projectPath, processInfo.pid),
|
|
13
|
-
type: "gemini_cli",
|
|
14
|
-
status: this.parser.determineStatus(session),
|
|
15
|
-
summary: session.summary || "Gemini CLI session active",
|
|
16
|
-
pid: processInfo.pid,
|
|
17
|
-
projectPath,
|
|
18
|
-
sessionId: session.sessionId,
|
|
19
|
-
lastActive: session.lastActive,
|
|
20
|
-
sessionFilePath: filePath,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
mapProcessOnlyAgent(processInfo: ProcessInfo): AgentInfo {
|
|
25
|
-
return processOnlyAgent("gemini_cli", processInfo, { summary: "Gemini CLI process running" });
|
|
26
|
-
}
|
|
27
|
-
}
|