@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,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for utils/session.ts
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { MockedFunction } from "vitest";
|
|
6
|
-
|
|
7
|
-
import * as fs from "fs";
|
|
8
|
-
import { batchGetSessionFileBirthtimes, isSafePathSegment } from "../../utils/session.js";
|
|
9
|
-
|
|
10
|
-
vi.mock("fs", () => ({
|
|
11
|
-
readdirSync: vi.fn(),
|
|
12
|
-
statSync: vi.fn(),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const mockedReaddirSync = fs.readdirSync as MockedFunction<typeof fs.readdirSync>;
|
|
16
|
-
const mockedStatSync = fs.statSync as MockedFunction<typeof fs.statSync>;
|
|
17
|
-
|
|
18
|
-
describe("isSafePathSegment", () => {
|
|
19
|
-
it.each(["", ".", "..", "nested/session", "bad\0id"])("rejects unsafe segment %j", (value) => {
|
|
20
|
-
expect(isSafePathSegment(value)).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it.each(["session-id", ".hidden-session"])("accepts safe segment %j", (value) => {
|
|
24
|
-
expect(isSafePathSegment(value)).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe("batchGetSessionFileBirthtimes", () => {
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
mockedReaddirSync.mockReset();
|
|
31
|
-
mockedStatSync.mockReset();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("should parse session files correctly", () => {
|
|
35
|
-
mockedReaddirSync.mockReturnValue(["abc123.jsonl", "def456.jsonl"] as unknown as ReturnType<
|
|
36
|
-
typeof fs.readdirSync
|
|
37
|
-
>);
|
|
38
|
-
mockedStatSync
|
|
39
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats)
|
|
40
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800500000 } as fs.Stats);
|
|
41
|
-
|
|
42
|
-
const results = batchGetSessionFileBirthtimes(["/home/.claude/projects/my-app"]);
|
|
43
|
-
|
|
44
|
-
expect(results).toHaveLength(2);
|
|
45
|
-
expect(results[0]).toEqual({
|
|
46
|
-
sessionId: "abc123",
|
|
47
|
-
filePath: "/home/.claude/projects/my-app/abc123.jsonl",
|
|
48
|
-
projectDir: "/home/.claude/projects/my-app",
|
|
49
|
-
birthtimeMs: 1710800324000,
|
|
50
|
-
resolvedCwd: "",
|
|
51
|
-
});
|
|
52
|
-
expect(results[1].sessionId).toBe("def456");
|
|
53
|
-
expect(results[1].birthtimeMs).toBe(1710800500000);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("should return empty array for empty dirs list", () => {
|
|
57
|
-
expect(batchGetSessionFileBirthtimes([])).toEqual([]);
|
|
58
|
-
expect(mockedReaddirSync).not.toHaveBeenCalled();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should return empty array on readdir failure", () => {
|
|
62
|
-
mockedReaddirSync.mockImplementation(() => {
|
|
63
|
-
throw new Error("ENOENT");
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
expect(batchGetSessionFileBirthtimes(["/some/dir"])).toEqual([]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("should skip files with invalid birthtime (0 or negative)", () => {
|
|
70
|
-
mockedReaddirSync.mockReturnValue([
|
|
71
|
-
"bad.jsonl",
|
|
72
|
-
"negative.jsonl",
|
|
73
|
-
"good.jsonl",
|
|
74
|
-
] as unknown as ReturnType<typeof fs.readdirSync>);
|
|
75
|
-
mockedStatSync
|
|
76
|
-
.mockReturnValueOnce({ birthtimeMs: 0 } as fs.Stats)
|
|
77
|
-
.mockReturnValueOnce({ birthtimeMs: -1 } as fs.Stats)
|
|
78
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats);
|
|
79
|
-
|
|
80
|
-
const results = batchGetSessionFileBirthtimes(["/dir"]);
|
|
81
|
-
expect(results).toHaveLength(1);
|
|
82
|
-
expect(results[0].sessionId).toBe("good");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("should skip non-jsonl files", () => {
|
|
86
|
-
mockedReaddirSync.mockReturnValue([
|
|
87
|
-
"sessions-index.json",
|
|
88
|
-
"abc123.jsonl",
|
|
89
|
-
] as unknown as ReturnType<typeof fs.readdirSync>);
|
|
90
|
-
mockedStatSync.mockReturnValueOnce({ birthtimeMs: 1710800500000 } as fs.Stats);
|
|
91
|
-
|
|
92
|
-
const results = batchGetSessionFileBirthtimes(["/dir"]);
|
|
93
|
-
expect(results).toHaveLength(1);
|
|
94
|
-
expect(results[0].sessionId).toBe("abc123");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("should handle empty directory", () => {
|
|
98
|
-
mockedReaddirSync.mockReturnValue([] as unknown as ReturnType<typeof fs.readdirSync>);
|
|
99
|
-
expect(batchGetSessionFileBirthtimes(["/dir"])).toEqual([]);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("should handle UUID session IDs", () => {
|
|
103
|
-
mockedReaddirSync.mockReturnValue([
|
|
104
|
-
"068e7b1f-cff5-4c94-bf69-b9acd32d765c.jsonl",
|
|
105
|
-
] as unknown as ReturnType<typeof fs.readdirSync>);
|
|
106
|
-
mockedStatSync.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats);
|
|
107
|
-
|
|
108
|
-
const results = batchGetSessionFileBirthtimes(["/dir"]);
|
|
109
|
-
expect(results).toHaveLength(1);
|
|
110
|
-
expect(results[0].sessionId).toBe("068e7b1f-cff5-4c94-bf69-b9acd32d765c");
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("should leave resolvedCwd empty", () => {
|
|
114
|
-
mockedReaddirSync.mockReturnValue(["abc.jsonl"] as unknown as ReturnType<
|
|
115
|
-
typeof fs.readdirSync
|
|
116
|
-
>);
|
|
117
|
-
mockedStatSync.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats);
|
|
118
|
-
|
|
119
|
-
const results = batchGetSessionFileBirthtimes(["/dir"]);
|
|
120
|
-
expect(results[0].resolvedCwd).toBe("");
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("should enumerate multiple directories", () => {
|
|
124
|
-
mockedReaddirSync
|
|
125
|
-
.mockReturnValueOnce(["sess1.jsonl", "sess3.jsonl"] as unknown as ReturnType<
|
|
126
|
-
typeof fs.readdirSync
|
|
127
|
-
>)
|
|
128
|
-
.mockReturnValueOnce(["sess2.jsonl"] as unknown as ReturnType<typeof fs.readdirSync>);
|
|
129
|
-
mockedStatSync
|
|
130
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats)
|
|
131
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800500000 } as fs.Stats)
|
|
132
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800400000 } as fs.Stats);
|
|
133
|
-
|
|
134
|
-
const results = batchGetSessionFileBirthtimes(["/projects/app-a", "/projects/app-b"]);
|
|
135
|
-
|
|
136
|
-
expect(mockedReaddirSync).toHaveBeenCalledTimes(2);
|
|
137
|
-
|
|
138
|
-
expect(results).toHaveLength(3);
|
|
139
|
-
expect(results[0].projectDir).toBe("/projects/app-a");
|
|
140
|
-
expect(results[1].projectDir).toBe("/projects/app-a");
|
|
141
|
-
expect(results[2].projectDir).toBe("/projects/app-b");
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it("should skip files where statSync fails", () => {
|
|
145
|
-
mockedReaddirSync.mockReturnValue(["good.jsonl", "gone.jsonl"] as unknown as ReturnType<
|
|
146
|
-
typeof fs.readdirSync
|
|
147
|
-
>);
|
|
148
|
-
mockedStatSync
|
|
149
|
-
.mockReturnValueOnce({ birthtimeMs: 1710800324000 } as fs.Stats)
|
|
150
|
-
.mockImplementationOnce(() => {
|
|
151
|
-
throw new Error("ENOENT");
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const results = batchGetSessionFileBirthtimes(["/dir"]);
|
|
155
|
-
expect(results).toHaveLength(1);
|
|
156
|
-
expect(results[0].sessionId).toBe("good");
|
|
157
|
-
});
|
|
158
|
-
});
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Adapter Interface
|
|
3
|
-
*
|
|
4
|
-
* Defines the contract for detecting and managing different types of AI agents.
|
|
5
|
-
* Each adapter is responsible for detecting agents of a specific type (e.g., claude).
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** Every built-in harness type, in the order the CLI lists them. */
|
|
9
|
-
export const AGENT_TYPES = [
|
|
10
|
-
"claude",
|
|
11
|
-
"codex",
|
|
12
|
-
"gemini_cli",
|
|
13
|
-
"grok_cli",
|
|
14
|
-
"kiro",
|
|
15
|
-
"antigravity_cli",
|
|
16
|
-
"opencode",
|
|
17
|
-
"copilot",
|
|
18
|
-
"pi",
|
|
19
|
-
"devin",
|
|
20
|
-
"muse",
|
|
21
|
-
] as const;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Type of AI agent
|
|
25
|
-
*/
|
|
26
|
-
export type AgentType = (typeof AGENT_TYPES)[number] | "other";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Current status of an agent
|
|
30
|
-
*/
|
|
31
|
-
export enum AgentStatus {
|
|
32
|
-
RUNNING = "running",
|
|
33
|
-
WAITING = "waiting",
|
|
34
|
-
IDLE = "idle",
|
|
35
|
-
UNKNOWN = "unknown",
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Information about a detected agent
|
|
40
|
-
*/
|
|
41
|
-
export interface AgentInfo {
|
|
42
|
-
/** Project-based name (e.g., "ai-devkit" or "ai-devkit (merry)") */
|
|
43
|
-
name: string;
|
|
44
|
-
|
|
45
|
-
/** Type of agent */
|
|
46
|
-
type: AgentType;
|
|
47
|
-
|
|
48
|
-
/** Current status */
|
|
49
|
-
status: AgentStatus;
|
|
50
|
-
|
|
51
|
-
/** Last user prompt from history */
|
|
52
|
-
summary: string;
|
|
53
|
-
|
|
54
|
-
/** Process ID */
|
|
55
|
-
pid: number;
|
|
56
|
-
|
|
57
|
-
/** Working directory/project path */
|
|
58
|
-
projectPath: string;
|
|
59
|
-
|
|
60
|
-
/** Session UUID */
|
|
61
|
-
sessionId: string;
|
|
62
|
-
|
|
63
|
-
/** Timestamp of last activity */
|
|
64
|
-
lastActive: Date;
|
|
65
|
-
|
|
66
|
-
/** Whether the live process is pinned in the agent console */
|
|
67
|
-
pinned?: boolean;
|
|
68
|
-
|
|
69
|
-
/** Path to the session JSONL file on disk */
|
|
70
|
-
sessionFilePath?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Information about a running process
|
|
75
|
-
*/
|
|
76
|
-
export interface ProcessInfo {
|
|
77
|
-
/** Process ID */
|
|
78
|
-
pid: number;
|
|
79
|
-
|
|
80
|
-
/** Parent process ID, populated by process discovery when available */
|
|
81
|
-
ppid?: number;
|
|
82
|
-
|
|
83
|
-
/** Process command */
|
|
84
|
-
command: string;
|
|
85
|
-
|
|
86
|
-
/** Working directory */
|
|
87
|
-
cwd: string;
|
|
88
|
-
|
|
89
|
-
/** Terminal TTY (e.g., "ttys030") */
|
|
90
|
-
tty: string;
|
|
91
|
-
|
|
92
|
-
/** Process start time, populated by process enrichment */
|
|
93
|
-
startTime?: Date;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* A single message in a conversation
|
|
98
|
-
*/
|
|
99
|
-
export interface ConversationMessage {
|
|
100
|
-
role: "user" | "assistant" | "system";
|
|
101
|
-
content: string;
|
|
102
|
-
timestamp?: string;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Options for {@link AgentAdapter.getConversation}.
|
|
107
|
-
*/
|
|
108
|
-
export interface ConversationOptions {
|
|
109
|
-
/** Include tool call/result details */
|
|
110
|
-
verbose?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Return only the last `tail` messages (after verbose filtering). When
|
|
113
|
-
* omitted or not a positive integer, the full conversation is returned.
|
|
114
|
-
*
|
|
115
|
-
* JSONL-backed adapters read backward from the end of the file and, on
|
|
116
|
-
* later calls, parse only appended bytes, so cost is proportional to the
|
|
117
|
-
* tail rather than the transcript size. Adapters backed by a single JSON
|
|
118
|
-
* document (Gemini) or a database (OpenCode) still read the whole source
|
|
119
|
-
* and slice; callers should keep an mtime cache for those.
|
|
120
|
-
*/
|
|
121
|
-
tail?: number;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* A historical session discovered on disk (running or not).
|
|
126
|
-
*
|
|
127
|
-
* Used by `listSessions` to surface enough context for a user to identify
|
|
128
|
-
* a session and resume it via the originating tool's resume command.
|
|
129
|
-
*/
|
|
130
|
-
export interface SessionSummary {
|
|
131
|
-
/** Tool that produced this session */
|
|
132
|
-
type: AgentType;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* ID accepted by the tool's resume command. Adapters MUST pass this
|
|
136
|
-
* through verbatim — no normalization, no encoding/decoding — so it
|
|
137
|
-
* round-trips into `claude --resume <id>` (and equivalents).
|
|
138
|
-
*/
|
|
139
|
-
sessionId: string;
|
|
140
|
-
|
|
141
|
-
/** Working directory the session was started in (best-known value) */
|
|
142
|
-
cwd: string;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Trimmed first user message; empty string if none. Adapters apply
|
|
146
|
-
* the same noise-filter their existing parsers use (skip tool_result
|
|
147
|
-
* blocks, request-interruption notices, system-injected skill
|
|
148
|
-
* content). The CLI table renderer substitutes a placeholder for
|
|
149
|
-
* empty values; JSON output keeps the empty string raw.
|
|
150
|
-
*/
|
|
151
|
-
firstUserMessage: string;
|
|
152
|
-
|
|
153
|
-
/** Last activity timestamp (from session content; falls back to file mtime) */
|
|
154
|
-
lastActive: Date;
|
|
155
|
-
|
|
156
|
-
/** Session start time (from session content; falls back to file birthtime/mtime) */
|
|
157
|
-
startedAt: Date;
|
|
158
|
-
|
|
159
|
-
/** Absolute path to the session file on disk (debug/diagnostics) */
|
|
160
|
-
sessionFilePath: string;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Filters passed by the CLI to {@link AgentAdapter.listSessions}.
|
|
165
|
-
*
|
|
166
|
-
* The CLI is the source of truth for filter defaults and semantics
|
|
167
|
-
* (e.g. cwd defaults to process.cwd(); --all clears it). Adapters apply
|
|
168
|
-
* the values they receive — they don't invent defaults.
|
|
169
|
-
*/
|
|
170
|
-
export interface ListSessionsOptions {
|
|
171
|
-
/**
|
|
172
|
-
* Filter to sessions whose recorded cwd matches this path using strict
|
|
173
|
-
* equality (no prefix/ancestor matching in v1). Undefined = no cwd
|
|
174
|
-
* filter.
|
|
175
|
-
*/
|
|
176
|
-
cwd?: string;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Filter to a single tool. Enforced by `AgentManager.listSessions`,
|
|
180
|
-
* which skips adapters whose `type` doesn't match. Adapters MAY
|
|
181
|
-
* ignore this field — by the time their `listSessions` runs, the
|
|
182
|
-
* type filter is already satisfied. Undefined = include every
|
|
183
|
-
* registered adapter.
|
|
184
|
-
*/
|
|
185
|
-
type?: AgentType;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface AgentDetectionContext {
|
|
189
|
-
/** One enriched process snapshot shared across this manager refresh. */
|
|
190
|
-
readonly processes: readonly ProcessInfo[];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Agent Adapter Interface
|
|
195
|
-
*
|
|
196
|
-
* Implementations must provide detection logic for a specific agent type.
|
|
197
|
-
*/
|
|
198
|
-
export interface AgentAdapter {
|
|
199
|
-
/** Type of agent this adapter handles */
|
|
200
|
-
readonly type: AgentType;
|
|
201
|
-
|
|
202
|
-
/** Executable basenames required for shared process discovery. */
|
|
203
|
-
readonly processNames?: readonly string[];
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Basename prefixes for shared process discovery: an argv[0] basename
|
|
207
|
-
* matches when it equals the prefix or starts with `<prefix>-`.
|
|
208
|
-
* For versioned launchers such as `muse-bin-1.4.4-R5419.1`.
|
|
209
|
-
* Recall-oriented like `processNames`; `canHandle` stays the precision gate.
|
|
210
|
-
*/
|
|
211
|
-
readonly processNamePrefixes?: readonly string[];
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Detect running agents of this type
|
|
215
|
-
* @returns List of detected agents
|
|
216
|
-
*/
|
|
217
|
-
detectAgents(context?: AgentDetectionContext): Promise<AgentInfo[]>;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Check if this adapter can handle the given process
|
|
221
|
-
* @param processInfo Process information
|
|
222
|
-
* @returns True if this adapter can handle the process
|
|
223
|
-
*/
|
|
224
|
-
canHandle(processInfo: ProcessInfo): boolean;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Read the conversation from a session file
|
|
228
|
-
* @param sessionFilePath Path to the session JSONL file
|
|
229
|
-
* @param options.verbose Include tool call/result details
|
|
230
|
-
* @param options.tail Return only the last N messages (see {@link ConversationOptions.tail})
|
|
231
|
-
* @returns Array of conversation messages
|
|
232
|
-
*/
|
|
233
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[];
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Enumerate historical sessions for this tool from disk.
|
|
237
|
-
*
|
|
238
|
-
* Applies `opts.cwd` as a strict-equality filter when set. Returns
|
|
239
|
-
* {@link SessionSummary} entries unsorted; sorting and global filters
|
|
240
|
-
* are handled by `AgentManager` and the CLI.
|
|
241
|
-
*
|
|
242
|
-
* @param opts Filter options computed by the CLI
|
|
243
|
-
* @returns Array of sessions discovered on disk
|
|
244
|
-
*/
|
|
245
|
-
listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]>;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Resolve exact historical session matches without enumerating every summary.
|
|
249
|
-
*
|
|
250
|
-
* Built-in adapters implement this using their harness-native storage shape.
|
|
251
|
-
* The method remains optional so external adapters can fall back to
|
|
252
|
-
* {@link listSessions} until they adopt direct lookup.
|
|
253
|
-
*/
|
|
254
|
-
findSessionsById?(sessionId: string): Promise<SessionSummary[]>;
|
|
255
|
-
}
|
package/src/capacity/index.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { constants } from "node:fs";
|
|
2
|
-
import { access as fsAccess } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { codexUnavailableReport, probeCodexCapacity } from "./sources/codex.js";
|
|
5
|
-
import { probeClaudeCapacity, type ClaudeCapacityOptions } from "./sources/claude.js";
|
|
6
|
-
import { probeDevinCapacity, type DevinCapacityOptions } from "./sources/devin.js";
|
|
7
|
-
import {
|
|
8
|
-
probeOpenAiCapacity,
|
|
9
|
-
probePiAnthropicCapacity,
|
|
10
|
-
probeZaiCapacity,
|
|
11
|
-
type PiAnthropicCapacityOptions,
|
|
12
|
-
type PiOpenAiCapacityOptions,
|
|
13
|
-
type PiZaiCapacityOptions,
|
|
14
|
-
} from "./sources/pi.js";
|
|
15
|
-
import type { CapacityReport } from "./types.js";
|
|
16
|
-
|
|
17
|
-
export type { CapacityReport, CapacityWindow } from "./types.js";
|
|
18
|
-
export type { ClaudeCapacityOptions } from "./sources/claude.js";
|
|
19
|
-
export type { DevinCapacityOptions } from "./sources/devin.js";
|
|
20
|
-
export type { PiAnthropicCapacityOptions as AnthropicCapacityOptions } from "./sources/pi.js";
|
|
21
|
-
export type {
|
|
22
|
-
PiOpenAiCapacityOptions as OpenAiCapacityOptions,
|
|
23
|
-
PiZaiCapacityOptions as ZaiCapacityOptions,
|
|
24
|
-
} from "./sources/pi.js";
|
|
25
|
-
|
|
26
|
-
export type CapacityProbeOptions = {
|
|
27
|
-
now?: () => Date;
|
|
28
|
-
path?: string;
|
|
29
|
-
access?: (target: string) => Promise<void>;
|
|
30
|
-
probe?: typeof probeCodexCapacity;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
async function canAccess(target: string, mode: number): Promise<boolean> {
|
|
34
|
-
try {
|
|
35
|
-
await fsAccess(target, mode);
|
|
36
|
-
return true;
|
|
37
|
-
} catch {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function isCodexInstalled(
|
|
43
|
-
pathValue: string,
|
|
44
|
-
checkAccess?: (target: string) => Promise<void>,
|
|
45
|
-
): Promise<boolean> {
|
|
46
|
-
const directories = pathValue.split(path.delimiter).filter(Boolean);
|
|
47
|
-
for (const directory of directories) {
|
|
48
|
-
const executable = path.join(directory, "codex");
|
|
49
|
-
if (checkAccess) {
|
|
50
|
-
try {
|
|
51
|
-
await checkAccess(executable);
|
|
52
|
-
return true;
|
|
53
|
-
} catch {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (await canAccess(executable, constants.X_OK)) return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function getCodexCapacityReport(
|
|
63
|
-
options: CapacityProbeOptions = {},
|
|
64
|
-
): Promise<CapacityReport> {
|
|
65
|
-
const generatedAt = (options.now?.() ?? new Date()).toISOString();
|
|
66
|
-
const installed = await isCodexInstalled(options.path ?? process.env.PATH ?? "", options.access);
|
|
67
|
-
try {
|
|
68
|
-
return await (options.probe ?? probeCodexCapacity)({
|
|
69
|
-
installed,
|
|
70
|
-
checkedAt: generatedAt,
|
|
71
|
-
});
|
|
72
|
-
} catch {
|
|
73
|
-
return codexUnavailableReport(generatedAt);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function getZaiCapacityReport(
|
|
78
|
-
options: PiZaiCapacityOptions = {},
|
|
79
|
-
): Promise<CapacityReport> {
|
|
80
|
-
const { now, ...probeOptions } = options;
|
|
81
|
-
return probeZaiCapacity({
|
|
82
|
-
...probeOptions,
|
|
83
|
-
checkedAt: (now?.() ?? new Date()).toISOString(),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export async function getOpenAiCapacityReport(
|
|
88
|
-
options: PiOpenAiCapacityOptions = {},
|
|
89
|
-
): Promise<CapacityReport> {
|
|
90
|
-
const { now, ...probeOptions } = options;
|
|
91
|
-
return probeOpenAiCapacity({
|
|
92
|
-
...probeOptions,
|
|
93
|
-
checkedAt: (now?.() ?? new Date()).toISOString(),
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export async function getClaudeCapacityReport(
|
|
98
|
-
options: ClaudeCapacityOptions = {},
|
|
99
|
-
): Promise<CapacityReport> {
|
|
100
|
-
const { now, ...probeOptions } = options;
|
|
101
|
-
return probeClaudeCapacity({
|
|
102
|
-
...probeOptions,
|
|
103
|
-
checkedAt: (now?.() ?? new Date()).toISOString(),
|
|
104
|
-
now,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export async function getDevinCapacityReport(
|
|
109
|
-
options: DevinCapacityOptions = {},
|
|
110
|
-
): Promise<CapacityReport> {
|
|
111
|
-
const { now, ...probeOptions } = options;
|
|
112
|
-
return probeDevinCapacity({
|
|
113
|
-
...probeOptions,
|
|
114
|
-
checkedAt: (now?.() ?? new Date()).toISOString(),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export async function getAnthropicCapacityReport(
|
|
119
|
-
options: PiAnthropicCapacityOptions = {},
|
|
120
|
-
): Promise<CapacityReport> {
|
|
121
|
-
const { now, ...probeOptions } = options;
|
|
122
|
-
return probePiAnthropicCapacity({
|
|
123
|
-
...probeOptions,
|
|
124
|
-
checkedAt: (now?.() ?? new Date()).toISOString(),
|
|
125
|
-
now,
|
|
126
|
-
});
|
|
127
|
-
}
|