@ai-devkit/agent-manager 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -3
- package/.swcrc +0 -27
- package/dist/__tests__/AgentManager.test.js +0 -1727
- package/dist/__tests__/AgentManager.test.js.map +0 -1
- package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js +0 -486
- package/dist/__tests__/adapters/IncrementalSessionRefresh.test.js.map +0 -1
- package/dist/__tests__/adapters/adapterProcessImports.test.js +0 -52
- package/dist/__tests__/adapters/adapterProcessImports.test.js.map +0 -1
- package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js +0 -247
- package/dist/__tests__/adapters/adapterSnapshotCandidates.test.js.map +0 -1
- package/dist/__tests__/capacity/anthropic.test.js +0 -115
- package/dist/__tests__/capacity/anthropic.test.js.map +0 -1
- package/dist/__tests__/capacity/boundaries.test.js +0 -45
- package/dist/__tests__/capacity/boundaries.test.js.map +0 -1
- package/dist/__tests__/capacity/claude.test.js +0 -485
- package/dist/__tests__/capacity/claude.test.js.map +0 -1
- package/dist/__tests__/capacity/codex.test.js +0 -339
- package/dist/__tests__/capacity/codex.test.js.map +0 -1
- package/dist/__tests__/capacity/devin.test.js +0 -239
- package/dist/__tests__/capacity/devin.test.js.map +0 -1
- package/dist/__tests__/capacity/index.test.js +0 -53
- package/dist/__tests__/capacity/index.test.js.map +0 -1
- package/dist/__tests__/capacity/openai.test.js +0 -687
- package/dist/__tests__/capacity/openai.test.js.map +0 -1
- package/dist/__tests__/capacity/wham.test.js +0 -159
- package/dist/__tests__/capacity/wham.test.js.map +0 -1
- package/dist/__tests__/capacity/zai.test.js +0 -212
- package/dist/__tests__/capacity/zai.test.js.map +0 -1
- package/dist/__tests__/fixtures.test.js +0 -218
- package/dist/__tests__/fixtures.test.js.map +0 -1
- package/dist/__tests__/harnesses/BoundedSummarySkip.test.js +0 -568
- package/dist/__tests__/harnesses/BoundedSummarySkip.test.js.map +0 -1
- package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js +0 -1089
- package/dist/__tests__/harnesses/SessionSummaryEquivalence.test.js.map +0 -1
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js +0 -143
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.js.map +0 -1
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js +0 -462
- package/dist/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/builtinAdapters.test.js +0 -33
- package/dist/__tests__/harnesses/builtinAdapters.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js +0 -79
- package/dist/__tests__/harnesses/claude/ClaudeAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js +0 -1881
- package/dist/__tests__/harnesses/claude/ClaudeCodeAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js +0 -425
- package/dist/__tests__/harnesses/claude/ClaudeSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js +0 -314
- package/dist/__tests__/harnesses/claude/ClaudeSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js +0 -49
- package/dist/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js +0 -76
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js +0 -173
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js +0 -181
- package/dist/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexAdapter.test.js +0 -685
- package/dist/__tests__/harnesses/codex/CodexAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js +0 -463
- package/dist/__tests__/harnesses/codex/CodexSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js +0 -86
- package/dist/__tests__/harnesses/codex/CodexSessionMapping.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js +0 -254
- package/dist/__tests__/harnesses/codex/CodexSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js +0 -121
- package/dist/__tests__/harnesses/codex/durable/CodexCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js +0 -84
- package/dist/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js +0 -128
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js +0 -246
- package/dist/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js +0 -384
- package/dist/__tests__/harnesses/codex/durable/CodexPrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js +0 -659
- package/dist/__tests__/harnesses/copilot/CopilotAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js +0 -290
- package/dist/__tests__/harnesses/copilot/CopilotRefreshIO.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinAdapter.test.js +0 -597
- package/dist/__tests__/harnesses/devin/DevinAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js +0 -99
- package/dist/__tests__/harnesses/devin/DevinAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js +0 -192
- package/dist/__tests__/harnesses/devin/DevinSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js +0 -407
- package/dist/__tests__/harnesses/devin/DevinSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/devin/fixtures.js +0 -95
- package/dist/__tests__/harnesses/devin/fixtures.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js +0 -1454
- package/dist/__tests__/harnesses/gemini/GeminiCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js +0 -491
- package/dist/__tests__/harnesses/gemini/GeminiSessionJsonl.test.js.map +0 -1
- package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js +0 -399
- package/dist/__tests__/harnesses/gemini/GeminiSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js +0 -56
- package/dist/__tests__/harnesses/grok/GrokAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js +0 -421
- package/dist/__tests__/harnesses/grok/GrokCliAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js +0 -167
- package/dist/__tests__/harnesses/grok/GrokIncrementalRefresh.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js +0 -133
- package/dist/__tests__/harnesses/grok/GrokSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js +0 -301
- package/dist/__tests__/harnesses/grok/GrokSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js +0 -662
- package/dist/__tests__/harnesses/kiro/KiroAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseAdapter.test.js +0 -247
- package/dist/__tests__/harnesses/muse/MuseAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js +0 -81
- package/dist/__tests__/harnesses/muse/MuseAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js +0 -185
- package/dist/__tests__/harnesses/muse/MuseSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js +0 -328
- package/dist/__tests__/harnesses/muse/MuseSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js +0 -213
- package/dist/__tests__/harnesses/opencode/OpenCodeAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js +0 -108
- package/dist/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js +0 -94
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.js.map +0 -1
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js +0 -147
- package/dist/__tests__/harnesses/opencode/OpenCodeSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiAdapter.test.js +0 -367
- package/dist/__tests__/harnesses/pi/PiAdapter.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js +0 -382
- package/dist/__tests__/harnesses/pi/PiDiscoveryIO.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiSessionParser.test.js +0 -416
- package/dist/__tests__/harnesses/pi/PiSessionParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js +0 -108
- package/dist/__tests__/harnesses/pi/PiSessionTracker.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js +0 -70
- package/dist/__tests__/harnesses/pi/durable/PiCliProbe.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js +0 -43
- package/dist/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js +0 -192
- package/dist/__tests__/harnesses/pi/durable/PiPrintAgentService.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js +0 -119
- package/dist/__tests__/harnesses/pi/durable/PiPrintProtocol.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js +0 -382
- package/dist/__tests__/harnesses/pi/durable/PiPrintRunner.test.js.map +0 -1
- package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js +0 -34
- package/dist/__tests__/harnesses/pi/durable/PiStreamParser.test.js.map +0 -1
- package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js +0 -446
- package/dist/__tests__/harnesses/readiness/AgentReadiness.test.js.map +0 -1
- package/dist/__tests__/harnesses/runtimeProfiles.test.js +0 -101
- package/dist/__tests__/harnesses/runtimeProfiles.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgent.test.js +0 -15
- package/dist/__tests__/print/DurableAgent.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js +0 -186
- package/dist/__tests__/print/DurableAgentRepository.sqlite.test.js.map +0 -1
- package/dist/__tests__/print/DurableAgentRepository.test.js +0 -249
- package/dist/__tests__/print/DurableAgentRepository.test.js.map +0 -1
- package/dist/__tests__/readiness-fixtures.test.js +0 -54
- package/dist/__tests__/readiness-fixtures.test.js.map +0 -1
- package/dist/__tests__/runtime/AgentRuntime.test.js +0 -13
- package/dist/__tests__/runtime/AgentRuntime.test.js.map +0 -1
- package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js +0 -164
- package/dist/__tests__/runtime/HerdrAgentDiscovery.test.js.map +0 -1
- package/dist/__tests__/runtime/HerdrAgentRuntime.test.js +0 -488
- package/dist/__tests__/runtime/HerdrAgentRuntime.test.js.map +0 -1
- package/dist/__tests__/runtime/ManagedAgentRuntime.test.js +0 -637
- package/dist/__tests__/runtime/ManagedAgentRuntime.test.js.map +0 -1
- package/dist/__tests__/terminal/GhosttyBackend.test.js +0 -334
- package/dist/__tests__/terminal/GhosttyBackend.test.js.map +0 -1
- package/dist/__tests__/terminal/TerminalFocusManager.test.js +0 -253
- package/dist/__tests__/terminal/TerminalFocusManager.test.js.map +0 -1
- package/dist/__tests__/terminal/TmuxManager.test.js +0 -168
- package/dist/__tests__/terminal/TmuxManager.test.js.map +0 -1
- package/dist/__tests__/terminal/TtyWriter.test.js +0 -386
- package/dist/__tests__/terminal/TtyWriter.test.js.map +0 -1
- package/dist/__tests__/utils/AgentRegistry.test.js +0 -636
- package/dist/__tests__/utils/AgentRegistry.test.js.map +0 -1
- package/dist/__tests__/utils/IncrementalJsonlSummary.test.js +0 -650
- package/dist/__tests__/utils/IncrementalJsonlSummary.test.js.map +0 -1
- package/dist/__tests__/utils/agent-requests.test.js +0 -90
- package/dist/__tests__/utils/agent-requests.test.js.map +0 -1
- package/dist/__tests__/utils/conversationTail.bench.test.js +0 -258
- package/dist/__tests__/utils/conversationTail.bench.test.js.map +0 -1
- package/dist/__tests__/utils/conversationTailParity.test.js +0 -588
- package/dist/__tests__/utils/conversationTailParity.test.js.map +0 -1
- package/dist/__tests__/utils/jsonlTail.test.js +0 -360
- package/dist/__tests__/utils/jsonlTail.test.js.map +0 -1
- package/dist/__tests__/utils/matching.test.js +0 -324
- package/dist/__tests__/utils/matching.test.js.map +0 -1
- package/dist/__tests__/utils/matchingConstants.test.js +0 -35
- package/dist/__tests__/utils/matchingConstants.test.js.map +0 -1
- package/dist/__tests__/utils/process.test.js +0 -818
- package/dist/__tests__/utils/process.test.js.map +0 -1
- package/dist/__tests__/utils/session.test.js +0 -175
- package/dist/__tests__/utils/session.test.js.map +0 -1
- package/project.json +0 -29
- package/scripts/benchmark-cold-start.mjs +0 -350
- package/src/AgentManager.ts +0 -559
- package/src/__tests__/AgentManager.test.ts +0 -1578
- package/src/__tests__/adapters/IncrementalSessionRefresh.test.ts +0 -437
- package/src/__tests__/adapters/adapterProcessImports.test.ts +0 -58
- package/src/__tests__/adapters/adapterSnapshotCandidates.test.ts +0 -243
- package/src/__tests__/capacity/anthropic.test.ts +0 -105
- package/src/__tests__/capacity/boundaries.test.ts +0 -36
- package/src/__tests__/capacity/claude.test.ts +0 -462
- package/src/__tests__/capacity/codex.test.ts +0 -311
- package/src/__tests__/capacity/devin.test.ts +0 -210
- package/src/__tests__/capacity/fixtures/claude-credentials.json +0 -7
- package/src/__tests__/capacity/fixtures/claude-usage-malformed.json +0 -1
- package/src/__tests__/capacity/fixtures/claude-usage-partial.json +0 -15
- package/src/__tests__/capacity/fixtures/claude-usage.json +0 -63
- package/src/__tests__/capacity/fixtures/devin-config.json +0 -6
- package/src/__tests__/capacity/fixtures/devin-credentials.toml +0 -4
- package/src/__tests__/capacity/fixtures/devin-quota-nonplan.json +0 -5
- package/src/__tests__/capacity/fixtures/devin-quota.json +0 -10
- package/src/__tests__/capacity/fixtures/openai-auth.json +0 -6
- package/src/__tests__/capacity/fixtures/openai-codex-auth.json +0 -9
- package/src/__tests__/capacity/fixtures/openai-usage-completions.json +0 -67
- package/src/__tests__/capacity/fixtures/openai-usage-responses.json +0 -20
- package/src/__tests__/capacity/fixtures/wham-usage.json +0 -45
- package/src/__tests__/capacity/fixtures/zai-auth.json +0 -6
- package/src/__tests__/capacity/fixtures/zai-quota-invalid.json +0 -7
- package/src/__tests__/capacity/fixtures/zai-quota.json +0 -38
- package/src/__tests__/capacity/index.test.ts +0 -54
- package/src/__tests__/capacity/openai.test.ts +0 -571
- package/src/__tests__/capacity/wham.test.ts +0 -122
- package/src/__tests__/capacity/zai.test.ts +0 -151
- package/src/__tests__/fixtures.test.ts +0 -245
- package/src/__tests__/harnesses/BoundedSummarySkip.test.ts +0 -496
- package/src/__tests__/harnesses/SessionSummaryEquivalence.test.ts +0 -726
- package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.subprocess.test.ts +0 -133
- package/src/__tests__/harnesses/antigravity/AntigravityCliAdapter.test.ts +0 -396
- package/src/__tests__/harnesses/builtinAdapters.test.ts +0 -33
- package/src/__tests__/harnesses/claude/ClaudeAgentMapper.test.ts +0 -84
- package/src/__tests__/harnesses/claude/ClaudeCodeAdapter.test.ts +0 -1793
- package/src/__tests__/harnesses/claude/ClaudeSessionLocator.test.ts +0 -423
- package/src/__tests__/harnesses/claude/ClaudeSessionParser.test.ts +0 -300
- package/src/__tests__/harnesses/claude/durable/ClaudeCliProbe.test.ts +0 -34
- package/src/__tests__/harnesses/claude/durable/ClaudePrintAgent.integration.test.ts +0 -61
- package/src/__tests__/harnesses/claude/durable/ClaudePrintAgentService.test.ts +0 -129
- package/src/__tests__/harnesses/claude/durable/ClaudePrintRunner.test.ts +0 -152
- package/src/__tests__/harnesses/codex/CodexAdapter.test.ts +0 -652
- package/src/__tests__/harnesses/codex/CodexSessionLocator.test.ts +0 -419
- package/src/__tests__/harnesses/codex/CodexSessionMapping.test.ts +0 -63
- package/src/__tests__/harnesses/codex/CodexSessionParser.test.ts +0 -192
- package/src/__tests__/harnesses/codex/durable/CodexCliProbe.test.ts +0 -80
- package/src/__tests__/harnesses/codex/durable/CodexDurableAgentRepository.test.ts +0 -65
- package/src/__tests__/harnesses/codex/durable/CodexPrintAgent.integration.test.ts +0 -104
- package/src/__tests__/harnesses/codex/durable/CodexPrintAgentService.test.ts +0 -201
- package/src/__tests__/harnesses/codex/durable/CodexPrintRunner.test.ts +0 -299
- package/src/__tests__/harnesses/copilot/CopilotAdapter.test.ts +0 -614
- package/src/__tests__/harnesses/copilot/CopilotRefreshIO.test.ts +0 -270
- package/src/__tests__/harnesses/devin/DevinAdapter.test.ts +0 -290
- package/src/__tests__/harnesses/devin/DevinAgentMapper.test.ts +0 -101
- package/src/__tests__/harnesses/devin/DevinSessionLocator.test.ts +0 -139
- package/src/__tests__/harnesses/devin/DevinSessionParser.test.ts +0 -212
- package/src/__tests__/harnesses/devin/fixtures.ts +0 -144
- package/src/__tests__/harnesses/gemini/GeminiCliAdapter.test.ts +0 -1336
- package/src/__tests__/harnesses/gemini/GeminiSessionJsonl.test.ts +0 -402
- package/src/__tests__/harnesses/gemini/GeminiSessionLocator.test.ts +0 -396
- package/src/__tests__/harnesses/grok/GrokAgentMapper.test.ts +0 -57
- package/src/__tests__/harnesses/grok/GrokCliAdapter.test.ts +0 -376
- package/src/__tests__/harnesses/grok/GrokIncrementalRefresh.test.ts +0 -170
- package/src/__tests__/harnesses/grok/GrokSessionLocator.test.ts +0 -106
- package/src/__tests__/harnesses/grok/GrokSessionParser.test.ts +0 -230
- package/src/__tests__/harnesses/kiro/KiroAdapter.test.ts +0 -552
- package/src/__tests__/harnesses/muse/MuseAdapter.test.ts +0 -197
- package/src/__tests__/harnesses/muse/MuseAgentMapper.test.ts +0 -83
- package/src/__tests__/harnesses/muse/MuseSessionLocator.test.ts +0 -177
- package/src/__tests__/harnesses/muse/MuseSessionParser.test.ts +0 -279
- package/src/__tests__/harnesses/opencode/OpenCodeAdapter.test.ts +0 -215
- package/src/__tests__/harnesses/opencode/OpenCodeAgentMapper.test.ts +0 -101
- package/src/__tests__/harnesses/opencode/OpenCodeSessionLocator.test.ts +0 -84
- package/src/__tests__/harnesses/opencode/OpenCodeSessionParser.test.ts +0 -149
- package/src/__tests__/harnesses/pi/PiAdapter.test.ts +0 -325
- package/src/__tests__/harnesses/pi/PiDiscoveryIO.test.ts +0 -337
- package/src/__tests__/harnesses/pi/PiSessionParser.test.ts +0 -280
- package/src/__tests__/harnesses/pi/PiSessionTracker.test.ts +0 -79
- package/src/__tests__/harnesses/pi/durable/PiCliProbe.test.ts +0 -50
- package/src/__tests__/harnesses/pi/durable/PiDurableAgentRepository.test.ts +0 -33
- package/src/__tests__/harnesses/pi/durable/PiPrintAgentService.test.ts +0 -138
- package/src/__tests__/harnesses/pi/durable/PiPrintProtocol.test.ts +0 -71
- package/src/__tests__/harnesses/pi/durable/PiPrintRunner.test.ts +0 -252
- package/src/__tests__/harnesses/pi/durable/PiStreamParser.test.ts +0 -26
- package/src/__tests__/harnesses/readiness/AgentReadiness.test.ts +0 -362
- package/src/__tests__/harnesses/runtimeProfiles.test.ts +0 -123
- package/src/__tests__/print/DurableAgent.test.ts +0 -15
- package/src/__tests__/print/DurableAgentRepository.sqlite.test.ts +0 -128
- package/src/__tests__/print/DurableAgentRepository.test.ts +0 -184
- package/src/__tests__/readiness-fixtures.test.ts +0 -79
- package/src/__tests__/runtime/AgentRuntime.test.ts +0 -8
- package/src/__tests__/runtime/HerdrAgentDiscovery.test.ts +0 -131
- package/src/__tests__/runtime/HerdrAgentRuntime.test.ts +0 -377
- package/src/__tests__/runtime/ManagedAgentRuntime.test.ts +0 -590
- package/src/__tests__/terminal/GhosttyBackend.test.ts +0 -271
- package/src/__tests__/terminal/TerminalFocusManager.test.ts +0 -280
- package/src/__tests__/terminal/TmuxManager.test.ts +0 -185
- package/src/__tests__/terminal/TtyWriter.test.ts +0 -454
- package/src/__tests__/utils/AgentRegistry.test.ts +0 -532
- package/src/__tests__/utils/IncrementalJsonlSummary.test.ts +0 -414
- package/src/__tests__/utils/agent-requests.test.ts +0 -94
- package/src/__tests__/utils/conversationTail.bench.test.ts +0 -193
- package/src/__tests__/utils/conversationTailParity.test.ts +0 -365
- package/src/__tests__/utils/jsonlTail.test.ts +0 -317
- package/src/__tests__/utils/matching.test.ts +0 -234
- package/src/__tests__/utils/matchingConstants.test.ts +0 -40
- package/src/__tests__/utils/process.test.ts +0 -596
- package/src/__tests__/utils/session.test.ts +0 -158
- package/src/adapters/AgentAdapter.ts +0 -255
- package/src/capacity/index.ts +0 -127
- package/src/capacity/providers/anthropic.ts +0 -198
- package/src/capacity/providers/devin.ts +0 -121
- package/src/capacity/providers/openai-platform.ts +0 -150
- package/src/capacity/providers/openai-subscription.ts +0 -184
- package/src/capacity/providers/zai.ts +0 -155
- package/src/capacity/sources/claude.ts +0 -30
- package/src/capacity/sources/codex.ts +0 -251
- package/src/capacity/sources/devin.ts +0 -49
- package/src/capacity/sources/pi.ts +0 -131
- package/src/capacity/types.ts +0 -29
- package/src/database/connection.ts +0 -96
- package/src/database/index.ts +0 -7
- package/src/database/migrations/001_initial.sql +0 -12
- package/src/database/migrations/002_pins.sql +0 -1
- package/src/database/migrations/003_durable_agents.sql +0 -43
- package/src/database/migrations/004_codex_durable_sessions.sql +0 -1
- package/src/database/migrations/005_agent_runtime.sql +0 -2
- package/src/database/schema.ts +0 -64
- package/src/durable/DurableAgent.ts +0 -139
- package/src/durable/DurableAgentRepository.ts +0 -485
- package/src/durable/process.ts +0 -29
- package/src/durable/run.ts +0 -84
- package/src/durable/utils.ts +0 -66
- package/src/fixtures/bundle.ts +0 -130
- package/src/fixtures/capture.ts +0 -364
- package/src/harnesses/antigravity/AntigravityAgentMapper.ts +0 -34
- package/src/harnesses/antigravity/AntigravityCliAdapter.ts +0 -126
- package/src/harnesses/antigravity/AntigravitySessionLocator.ts +0 -75
- package/src/harnesses/antigravity/AntigravitySessionParser.ts +0 -252
- package/src/harnesses/claude/ClaudeAgentMapper.ts +0 -55
- package/src/harnesses/claude/ClaudeCodeAdapter.ts +0 -175
- package/src/harnesses/claude/ClaudeSessionLocator.ts +0 -358
- package/src/harnesses/claude/ClaudeSessionParser.ts +0 -524
- package/src/harnesses/claude/credentials.ts +0 -122
- package/src/harnesses/claude/durable/ClaudeCliProbe.ts +0 -57
- package/src/harnesses/claude/durable/ClaudePrintAgentService.ts +0 -79
- package/src/harnesses/claude/durable/ClaudePrintRunner.ts +0 -102
- package/src/harnesses/claude/durable/ClaudeStreamParser.ts +0 -108
- package/src/harnesses/claude/readiness.ts +0 -69
- package/src/harnesses/codex/CodexAdapter.ts +0 -337
- package/src/harnesses/codex/CodexAgentMapper.ts +0 -26
- package/src/harnesses/codex/CodexSessionLocator.ts +0 -509
- package/src/harnesses/codex/CodexSessionMapping.ts +0 -89
- package/src/harnesses/codex/CodexSessionParser.ts +0 -462
- package/src/harnesses/codex/credentials.ts +0 -81
- package/src/harnesses/codex/durable/CodexCliProbe.ts +0 -68
- package/src/harnesses/codex/durable/CodexPrintAgentService.ts +0 -79
- package/src/harnesses/codex/durable/CodexPrintRunner.ts +0 -104
- package/src/harnesses/codex/durable/CodexStreamParser.ts +0 -117
- package/src/harnesses/codex/readiness.ts +0 -72
- package/src/harnesses/copilot/CopilotAdapter.ts +0 -161
- package/src/harnesses/copilot/CopilotAgentMapper.ts +0 -27
- package/src/harnesses/copilot/CopilotSessionLocator.ts +0 -161
- package/src/harnesses/copilot/CopilotSessionParser.ts +0 -380
- package/src/harnesses/copilot/readiness.ts +0 -33
- package/src/harnesses/devin/DevinAdapter.ts +0 -212
- package/src/harnesses/devin/DevinAgentMapper.ts +0 -39
- package/src/harnesses/devin/DevinSessionLocator.ts +0 -230
- package/src/harnesses/devin/DevinSessionParser.ts +0 -227
- package/src/harnesses/devin/credentials.ts +0 -88
- package/src/harnesses/devin/readiness.ts +0 -36
- package/src/harnesses/gemini/GeminiAgentMapper.ts +0 -27
- package/src/harnesses/gemini/GeminiCliAdapter.ts +0 -272
- package/src/harnesses/gemini/GeminiSessionLocator.ts +0 -394
- package/src/harnesses/gemini/GeminiSessionParser.ts +0 -395
- package/src/harnesses/gemini/fileSignature.ts +0 -10
- package/src/harnesses/grok/GrokAgentMapper.ts +0 -32
- package/src/harnesses/grok/GrokCliAdapter.ts +0 -126
- package/src/harnesses/grok/GrokSessionLocator.ts +0 -179
- package/src/harnesses/grok/GrokSessionParser.ts +0 -251
- package/src/harnesses/index.ts +0 -32
- package/src/harnesses/kiro/KiroAdapter.ts +0 -143
- package/src/harnesses/kiro/KiroAgentMapper.ts +0 -34
- package/src/harnesses/kiro/KiroSessionLocator.ts +0 -143
- package/src/harnesses/kiro/KiroSessionParser.ts +0 -376
- package/src/harnesses/muse/MuseAdapter.ts +0 -157
- package/src/harnesses/muse/MuseAgentMapper.ts +0 -33
- package/src/harnesses/muse/MuseSessionLocator.ts +0 -286
- package/src/harnesses/muse/MuseSessionParser.ts +0 -435
- package/src/harnesses/muse/readiness.ts +0 -38
- package/src/harnesses/opencode/OpenCodeAdapter.ts +0 -110
- package/src/harnesses/opencode/OpenCodeAgentMapper.ts +0 -49
- package/src/harnesses/opencode/OpenCodeSessionLocator.ts +0 -151
- package/src/harnesses/opencode/OpenCodeSessionParser.ts +0 -146
- package/src/harnesses/opencode/readiness.ts +0 -48
- package/src/harnesses/pi/PiAdapter.ts +0 -197
- package/src/harnesses/pi/PiAgentMapper.ts +0 -27
- package/src/harnesses/pi/PiSessionLocator.ts +0 -288
- package/src/harnesses/pi/PiSessionParser.ts +0 -488
- package/src/harnesses/pi/PiSessionTracker.ts +0 -87
- package/src/harnesses/pi/credentials.ts +0 -129
- package/src/harnesses/pi/durable/PiCliProbe.ts +0 -56
- package/src/harnesses/pi/durable/PiPrintAgentService.ts +0 -77
- package/src/harnesses/pi/durable/PiPrintProtocol.ts +0 -41
- package/src/harnesses/pi/durable/PiPrintRunner.ts +0 -95
- package/src/harnesses/pi/durable/PiStreamParser.ts +0 -94
- package/src/harnesses/pi/readiness.ts +0 -104
- package/src/harnesses/readiness/AgentReadiness.ts +0 -91
- package/src/harnesses/readiness/checks.ts +0 -336
- package/src/harnesses/readiness/types.ts +0 -90
- package/src/harnesses/runtimeProfiles.ts +0 -105
- package/src/harnesses/shared.ts +0 -124
- package/src/index.ts +0 -71
- package/src/runtime/ManagedAgentRuntime.ts +0 -253
- package/src/runtime/RuntimeFactory.ts +0 -13
- package/src/runtime/errors.ts +0 -50
- package/src/runtime/herdr/HerdrAgentDiscovery.ts +0 -166
- package/src/runtime/herdr/HerdrAgentRuntime.ts +0 -216
- package/src/runtime/herdr/HerdrCliClient.ts +0 -78
- package/src/runtime/herdr/HerdrErrors.ts +0 -9
- package/src/runtime/herdr/HerdrResponseParsers.ts +0 -86
- package/src/runtime/herdr/HerdrRuntimeRef.ts +0 -41
- package/src/runtime/tmux/PidPolling.ts +0 -34
- package/src/runtime/tmux/TmuxAgentRuntime.ts +0 -113
- package/src/runtime/tmux/TmuxManager.ts +0 -102
- package/src/runtime/tmux/TmuxRuntimeRef.ts +0 -9
- package/src/runtime/types.ts +0 -56
- package/src/terminal/TerminalFocusManager.ts +0 -52
- package/src/terminal/TtyWriter.ts +0 -26
- package/src/terminal/backends/ghostty.ts +0 -180
- package/src/terminal/backends/index.ts +0 -23
- package/src/terminal/backends/iterm2.ts +0 -126
- package/src/terminal/backends/shared.ts +0 -47
- package/src/terminal/backends/terminal-app.ts +0 -122
- package/src/terminal/backends/tmux.ts +0 -62
- package/src/terminal/backends/wezterm.ts +0 -65
- package/src/terminal/types.ts +0 -23
- package/src/utils/AgentRegistry.ts +0 -351
- package/src/utils/IncrementalJsonlSummary.ts +0 -306
- package/src/utils/agent-requests.ts +0 -28
- package/src/utils/applescript.ts +0 -10
- package/src/utils/jsonlTail.ts +0 -349
- package/src/utils/matching.ts +0 -96
- package/src/utils/matchingConstants.ts +0 -15
- package/src/utils/process.ts +0 -604
- package/src/utils/session.ts +0 -144
- package/src/utils/sortAgents.ts +0 -54
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -20
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
spawn as nodeSpawn,
|
|
3
|
-
type ChildProcessWithoutNullStreams,
|
|
4
|
-
type SpawnOptionsWithoutStdio,
|
|
5
|
-
} from "child_process";
|
|
6
|
-
import type { CodexDurableAgent, ProcessIdentity } from "../../../durable/DurableAgent.js";
|
|
7
|
-
import { CodexPrintError } from "../../../durable/DurableAgent.js";
|
|
8
|
-
import { LocalProcessInspector, type ProcessInspector } from "../../../durable/process.js";
|
|
9
|
-
import { waitForChildClose } from "../../../durable/utils.js";
|
|
10
|
-
import { CodexStreamParser } from "./CodexStreamParser.js";
|
|
11
|
-
|
|
12
|
-
type Spawn = (
|
|
13
|
-
command: string,
|
|
14
|
-
args: readonly string[],
|
|
15
|
-
options: SpawnOptionsWithoutStdio & { stdio: ["pipe", "pipe", "pipe"] },
|
|
16
|
-
) => ChildProcessWithoutNullStreams;
|
|
17
|
-
|
|
18
|
-
export interface CodexPrintRunRequest {
|
|
19
|
-
agent: CodexDurableAgent;
|
|
20
|
-
prompt: string;
|
|
21
|
-
executable?: string;
|
|
22
|
-
onSpawn(identity: ProcessIdentity): Promise<void>;
|
|
23
|
-
onSession(providerSessionId: string): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface CodexPrintRunResult {
|
|
27
|
-
sessionId: string;
|
|
28
|
-
result: string;
|
|
29
|
-
messages: string[];
|
|
30
|
-
exitCode: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface CodexPrintRunnerOptions {
|
|
34
|
-
spawn?: Spawn;
|
|
35
|
-
processInspector?: ProcessInspector;
|
|
36
|
-
maxLineBytes?: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class CodexPrintRunner {
|
|
40
|
-
private readonly spawn: Spawn;
|
|
41
|
-
private readonly processInspector: ProcessInspector;
|
|
42
|
-
private readonly maxLineBytes: number;
|
|
43
|
-
|
|
44
|
-
constructor(options: CodexPrintRunnerOptions = {}) {
|
|
45
|
-
this.spawn = options.spawn ?? (nodeSpawn as Spawn);
|
|
46
|
-
this.processInspector = options.processInspector ?? new LocalProcessInspector();
|
|
47
|
-
this.maxLineBytes = options.maxLineBytes ?? 1024 * 1024;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async run(request: CodexPrintRunRequest): Promise<CodexPrintRunResult> {
|
|
51
|
-
const args = buildCodexExecArgs(request.agent);
|
|
52
|
-
const child = this.spawn(request.executable ?? "codex", args, {
|
|
53
|
-
cwd: request.agent.cwd,
|
|
54
|
-
shell: false,
|
|
55
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
56
|
-
});
|
|
57
|
-
const identity = this.verifyProcessIdentity(child);
|
|
58
|
-
|
|
59
|
-
const parser = new CodexStreamParser(
|
|
60
|
-
request.agent.providerSessionId,
|
|
61
|
-
request.onSession,
|
|
62
|
-
this.maxLineBytes,
|
|
63
|
-
);
|
|
64
|
-
let processing = Promise.resolve();
|
|
65
|
-
|
|
66
|
-
child.stdout.on("data", (chunk: Buffer | string) => {
|
|
67
|
-
if (parser.hasFailed()) return;
|
|
68
|
-
processing = processing.then(() => parser.accept(chunk)).catch((error) => parser.fail(error));
|
|
69
|
-
});
|
|
70
|
-
child.stderr.resume();
|
|
71
|
-
const closed = waitForChildClose(child);
|
|
72
|
-
try {
|
|
73
|
-
await request.onSpawn(identity);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
child.kill();
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
child.stdin.end(request.prompt);
|
|
79
|
-
const { code, signal } = await closed.catch(() => {
|
|
80
|
-
throw new CodexPrintError("Codex process failed to start or communicate.", "CODEX_PROCESS");
|
|
81
|
-
});
|
|
82
|
-
await processing;
|
|
83
|
-
return parser.result({ code, signal });
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private verifyProcessIdentity(child: ChildProcessWithoutNullStreams): ProcessIdentity {
|
|
87
|
-
if (!child.pid) {
|
|
88
|
-
child.kill();
|
|
89
|
-
throw new CodexPrintError("Codex process did not provide a PID.", "CODEX_PROCESS");
|
|
90
|
-
}
|
|
91
|
-
const identity = this.processInspector.getIdentity(child.pid);
|
|
92
|
-
if (!identity) {
|
|
93
|
-
child.kill();
|
|
94
|
-
throw new CodexPrintError("Cannot verify Codex process identity.", "CODEX_PROCESS");
|
|
95
|
-
}
|
|
96
|
-
return identity;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function buildCodexExecArgs(agent: CodexDurableAgent): string[] {
|
|
101
|
-
return agent.providerSessionId === null
|
|
102
|
-
? ["exec", "--json", "-"]
|
|
103
|
-
: ["exec", "resume", "--json", agent.providerSessionId, "-"];
|
|
104
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { CodexPrintError } from "../../../durable/DurableAgent.js";
|
|
2
|
-
import { isUuid, LineBuffer, type ChildCloseResult } from "../../../durable/utils.js";
|
|
3
|
-
import type { CodexPrintRunResult } from "./CodexPrintRunner.js";
|
|
4
|
-
|
|
5
|
-
export class CodexStreamParser {
|
|
6
|
-
private readonly lines: LineBuffer;
|
|
7
|
-
private sessionId: string | null = null;
|
|
8
|
-
private turnCompleted = false;
|
|
9
|
-
private readonly messages: string[] = [];
|
|
10
|
-
private protocolError: CodexPrintError | null = null;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly expectedSessionId: string | null,
|
|
14
|
-
private readonly onSession: (providerSessionId: string) => Promise<void>,
|
|
15
|
-
maxLineBytes: number,
|
|
16
|
-
) {
|
|
17
|
-
this.lines = new LineBuffer(
|
|
18
|
-
maxLineBytes,
|
|
19
|
-
() => new CodexPrintError("Codex stream line exceeded the safety limit.", "CODEX_PROTOCOL"),
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
hasFailed(): boolean {
|
|
24
|
-
return this.protocolError !== null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async accept(chunk: Buffer | string): Promise<void> {
|
|
28
|
-
for (const line of this.lines.accept(chunk)) {
|
|
29
|
-
await this.processLine(line);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fail(error: unknown): void {
|
|
34
|
-
this.protocolError =
|
|
35
|
-
error instanceof CodexPrintError
|
|
36
|
-
? error
|
|
37
|
-
: new CodexPrintError("Codex stream processing failed.", "CODEX_PROTOCOL");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
result(close: ChildCloseResult): CodexPrintRunResult {
|
|
41
|
-
if (this.protocolError) throw this.protocolError;
|
|
42
|
-
this.lines.assertComplete(
|
|
43
|
-
() => new CodexPrintError("Codex stream ended with incomplete JSON.", "CODEX_PROTOCOL"),
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
if (close.code !== 0) {
|
|
47
|
-
throw new CodexPrintError(
|
|
48
|
-
`Codex print run failed${close.signal ? ` (${close.signal})` : "."}`,
|
|
49
|
-
"CODEX_PROCESS",
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
if (this.sessionId === null)
|
|
53
|
-
throw new CodexPrintError("Codex stream ended without a thread identity.", "CODEX_PROTOCOL");
|
|
54
|
-
if (!this.turnCompleted)
|
|
55
|
-
throw new CodexPrintError("Codex stream ended before turn completion.", "CODEX_PROTOCOL");
|
|
56
|
-
if (this.messages.length === 0)
|
|
57
|
-
throw new CodexPrintError(
|
|
58
|
-
"Codex stream ended without an assistant result.",
|
|
59
|
-
"CODEX_RESULT_MISSING",
|
|
60
|
-
);
|
|
61
|
-
return {
|
|
62
|
-
sessionId: this.sessionId,
|
|
63
|
-
result: this.messages.at(-1)!,
|
|
64
|
-
messages: this.messages,
|
|
65
|
-
exitCode: close.code,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private async processLine(line: Buffer): Promise<void> {
|
|
70
|
-
if (this.protocolError || line.length === 0) return;
|
|
71
|
-
|
|
72
|
-
const event = this.parseEvent(line);
|
|
73
|
-
if (event.type === "thread.started") {
|
|
74
|
-
await this.recordSession(event);
|
|
75
|
-
} else if (event.type === "item.completed") {
|
|
76
|
-
this.recordAssistantMessage(event.item);
|
|
77
|
-
} else if (event.type === "turn.completed") {
|
|
78
|
-
this.turnCompleted = true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private parseEvent(line: Buffer): Record<string, unknown> {
|
|
83
|
-
let value: unknown;
|
|
84
|
-
try {
|
|
85
|
-
value = JSON.parse(line.toString("utf8"));
|
|
86
|
-
} catch {
|
|
87
|
-
throw new CodexPrintError("Codex emitted malformed stream JSON.", "CODEX_PROTOCOL");
|
|
88
|
-
}
|
|
89
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
90
|
-
throw new CodexPrintError("Codex emitted a non-object stream message.", "CODEX_PROTOCOL");
|
|
91
|
-
}
|
|
92
|
-
return value as Record<string, unknown>;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private async recordSession(event: Record<string, unknown>): Promise<void> {
|
|
96
|
-
const sessionId = String(event.thread_id ?? "");
|
|
97
|
-
if (this.sessionId !== null || !isUuid(sessionId)) {
|
|
98
|
-
throw new CodexPrintError("Codex emitted an invalid thread identity.", "CODEX_PROTOCOL");
|
|
99
|
-
}
|
|
100
|
-
if (this.expectedSessionId !== null && this.expectedSessionId !== sessionId) {
|
|
101
|
-
throw new CodexPrintError(
|
|
102
|
-
"Codex returned a different session identity.",
|
|
103
|
-
"CODEX_SESSION_MISMATCH",
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
this.sessionId = sessionId;
|
|
107
|
-
await this.onSession(sessionId);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
private recordAssistantMessage(item: unknown): void {
|
|
111
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) return;
|
|
112
|
-
const record = item as Record<string, unknown>;
|
|
113
|
-
if (record.type === "agent_message" && typeof record.text === "string" && record.text.trim()) {
|
|
114
|
-
this.messages.push(record.text);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
displayHome,
|
|
4
|
-
mappingCheck,
|
|
5
|
-
registrationCheck,
|
|
6
|
-
scriptCheck,
|
|
7
|
-
worstReadinessStatus,
|
|
8
|
-
} from "../readiness/checks.js";
|
|
9
|
-
import type {
|
|
10
|
-
AuthReadinessCheck,
|
|
11
|
-
HarnessReadinessProfile,
|
|
12
|
-
IntegrationReadinessCheck,
|
|
13
|
-
ReadinessRuntime,
|
|
14
|
-
} from "../readiness/types.js";
|
|
15
|
-
|
|
16
|
-
async function authCheck(runtime: ReadinessRuntime): Promise<AuthReadinessCheck> {
|
|
17
|
-
try {
|
|
18
|
-
const value = await runtime.codexAuth();
|
|
19
|
-
return {
|
|
20
|
-
state: value === true ? "authenticated" : value === false ? "unauthenticated" : "unknown",
|
|
21
|
-
source: displayHome(join(runtime.homeDir, ".codex", "auth.json"), runtime.homeDir),
|
|
22
|
-
provider: null,
|
|
23
|
-
availableProviders: [],
|
|
24
|
-
status: value === true ? "pass" : value === false ? "fail" : "warn",
|
|
25
|
-
errors:
|
|
26
|
-
value === true
|
|
27
|
-
? []
|
|
28
|
-
: [value === false ? "Codex is not authenticated" : "Codex authentication is unknown"],
|
|
29
|
-
};
|
|
30
|
-
} catch {
|
|
31
|
-
return {
|
|
32
|
-
state: "unknown",
|
|
33
|
-
source: "~/.codex/auth.json",
|
|
34
|
-
provider: null,
|
|
35
|
-
availableProviders: [],
|
|
36
|
-
status: "warn",
|
|
37
|
-
errors: ["Codex authentication probe failed"],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function integrationCheck(runtime: ReadinessRuntime): Promise<IntegrationReadinessCheck> {
|
|
43
|
-
const script = await scriptCheck(
|
|
44
|
-
join(runtime.homeDir, ".codex", "hooks", "codex-session-mapping.cjs"),
|
|
45
|
-
join(runtime.assetRoot ?? "", "codex", "codex-session-mapping.cjs"),
|
|
46
|
-
runtime,
|
|
47
|
-
);
|
|
48
|
-
const registration = await registrationCheck(
|
|
49
|
-
join(runtime.homeDir, ".codex", "hooks.json"),
|
|
50
|
-
"SessionStart",
|
|
51
|
-
"node ~/.codex/hooks/codex-session-mapping.cjs",
|
|
52
|
-
runtime,
|
|
53
|
-
);
|
|
54
|
-
const mappingFile = await mappingCheck(
|
|
55
|
-
join(runtime.homeDir, ".codex", "ai-devkit", "sessions.json"),
|
|
56
|
-
runtime,
|
|
57
|
-
);
|
|
58
|
-
const installed = script.status === "pass" && registration.status === "pass";
|
|
59
|
-
return {
|
|
60
|
-
label: "ai-devkit hook",
|
|
61
|
-
installed,
|
|
62
|
-
status: worstReadinessStatus([script.status, registration.status, mappingFile.status]),
|
|
63
|
-
errors: [...script.errors, ...registration.errors, ...mappingFile.errors],
|
|
64
|
-
details: { sessionMappingScript: script, registration, mappingFile },
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const codexReadiness: HarnessReadinessProfile = {
|
|
69
|
-
configDir: ".codex",
|
|
70
|
-
auth: authCheck,
|
|
71
|
-
integration: integrationCheck,
|
|
72
|
-
};
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copilot Adapter
|
|
3
|
-
*
|
|
4
|
-
* Detects running GitHub Copilot CLI agents by:
|
|
5
|
-
* 1. Filtering Copilot processes from a shared asynchronous process snapshot
|
|
6
|
-
* 2. Using snapshot CWD and start-time enrichment
|
|
7
|
-
* 3. Mapping active ~/.copilot/session-state/{sessionId}/inuse.{pid}.lock files to processes
|
|
8
|
-
* (only directories modified since the process started are listed, and a
|
|
9
|
-
* known lock is re-validated with one stat on later refreshes)
|
|
10
|
-
* 4. Reading events.jsonl as the primary session/conversation source (incrementally
|
|
11
|
-
* cached across refreshes, so unchanged files are not re-read)
|
|
12
|
-
* 5. Reading workspace.yaml as a flat fallback metadata source
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import * as path from "path";
|
|
16
|
-
import type {
|
|
17
|
-
AgentAdapter,
|
|
18
|
-
AgentInfo,
|
|
19
|
-
ConversationMessage,
|
|
20
|
-
ConversationOptions,
|
|
21
|
-
ListSessionsOptions,
|
|
22
|
-
ProcessInfo,
|
|
23
|
-
SessionSummary,
|
|
24
|
-
AgentDetectionContext,
|
|
25
|
-
} from "../../adapters/AgentAdapter.js";
|
|
26
|
-
import { findWrapperProcess, findWrapperProcessPids } from "../../utils/process.js";
|
|
27
|
-
import { AgentRegistry, type RegistryEntry } from "../../utils/AgentRegistry.js";
|
|
28
|
-
import { CopilotAgentMapper } from "./CopilotAgentMapper.js";
|
|
29
|
-
import { CopilotSessionLocator } from "./CopilotSessionLocator.js";
|
|
30
|
-
import { CopilotSessionParser, type CopilotSession } from "./CopilotSessionParser.js";
|
|
31
|
-
import { findHarnessProcesses, homeDir, matchesExecutable } from "../shared.js";
|
|
32
|
-
|
|
33
|
-
export interface CopilotAdapterOptions {
|
|
34
|
-
sessionStateDir?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class CopilotAdapter implements AgentAdapter {
|
|
38
|
-
readonly type = "copilot" as const;
|
|
39
|
-
readonly processNames = ["copilot"] as const;
|
|
40
|
-
|
|
41
|
-
private readonly registry: AgentRegistry;
|
|
42
|
-
private readonly parser: CopilotSessionParser;
|
|
43
|
-
private readonly mapper: CopilotAgentMapper;
|
|
44
|
-
private readonly locator: CopilotSessionLocator;
|
|
45
|
-
|
|
46
|
-
constructor(
|
|
47
|
-
registry: AgentRegistry = AgentRegistry.default(),
|
|
48
|
-
options: CopilotAdapterOptions = {},
|
|
49
|
-
) {
|
|
50
|
-
this.registry = registry;
|
|
51
|
-
this.parser = new CopilotSessionParser();
|
|
52
|
-
this.mapper = new CopilotAgentMapper(this.parser);
|
|
53
|
-
this.locator = new CopilotSessionLocator({
|
|
54
|
-
sessionStateDir: options.sessionStateDir ?? path.join(homeDir(), ".copilot", "session-state"),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
canHandle(processInfo: ProcessInfo): boolean {
|
|
59
|
-
return matchesExecutable(processInfo.command, "copilot");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async detectAgents(context?: AgentDetectionContext): Promise<AgentInfo[]> {
|
|
63
|
-
try {
|
|
64
|
-
return await this.detectRunningAgents(context);
|
|
65
|
-
} finally {
|
|
66
|
-
// Drop cached event summaries for sessions that were not part of this refresh
|
|
67
|
-
this.parser.pruneSessionCache();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private async detectRunningAgents(context?: AgentDetectionContext): Promise<AgentInfo[]> {
|
|
72
|
-
const { processes } = await findHarnessProcesses(this, context);
|
|
73
|
-
if (processes.length === 0) return [];
|
|
74
|
-
|
|
75
|
-
const processByPid = new Map(processes.map((proc) => [proc.pid, proc]));
|
|
76
|
-
const registryEntriesByPid = new Map(this.registry.list().map((entry) => [entry.pid, entry]));
|
|
77
|
-
const matchedPids = new Set<number>();
|
|
78
|
-
const matchedProcesses: ProcessInfo[] = [];
|
|
79
|
-
const agents: AgentInfo[] = [];
|
|
80
|
-
|
|
81
|
-
for (const lock of this.locator.discoverActiveLocks(processes)) {
|
|
82
|
-
const proc = processByPid.get(lock.pid);
|
|
83
|
-
if (!proc) continue;
|
|
84
|
-
|
|
85
|
-
const session = this.parser.readSessionDirIncremental(lock.sessionDir, lock.sessionId);
|
|
86
|
-
if (!session) continue;
|
|
87
|
-
|
|
88
|
-
const agent = this.mapper.mapSessionToAgent(session, proc);
|
|
89
|
-
this.applyWrapperRegistryName(agent, proc, processes, registryEntriesByPid);
|
|
90
|
-
agents.push(agent);
|
|
91
|
-
matchedPids.add(proc.pid);
|
|
92
|
-
matchedProcesses.push(proc);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const wrapperPids = findWrapperProcessPids(processes, matchedProcesses);
|
|
96
|
-
for (const proc of processes) {
|
|
97
|
-
if (!matchedPids.has(proc.pid) && !wrapperPids.has(proc.pid)) {
|
|
98
|
-
const agent = this.mapper.mapProcessOnlyAgent(proc);
|
|
99
|
-
this.applyWrapperRegistryName(agent, proc, processes, registryEntriesByPid);
|
|
100
|
-
agents.push(agent);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return agents;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
getConversation(sessionFilePath: string, options?: ConversationOptions): ConversationMessage[] {
|
|
108
|
-
return this.parser.getConversation(sessionFilePath, options);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]> {
|
|
112
|
-
const summaries: SessionSummary[] = [];
|
|
113
|
-
|
|
114
|
-
for (const { sessionDir, sessionId } of this.locator.listSessionDirs()) {
|
|
115
|
-
const session = this.parser.readSessionDir(sessionDir, sessionId);
|
|
116
|
-
if (!session) continue;
|
|
117
|
-
if (opts?.cwd !== undefined && session.projectPath !== opts.cwd) continue;
|
|
118
|
-
|
|
119
|
-
summaries.push(this.toSessionSummary(session));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return summaries;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async findSessionsById(sessionId: string): Promise<SessionSummary[]> {
|
|
126
|
-
const match = this.locator.findSessionDirById(sessionId);
|
|
127
|
-
if (match) {
|
|
128
|
-
const session = this.parser.readSessionDir(match.sessionDir, match.sessionId);
|
|
129
|
-
if (session?.sessionId === sessionId) {
|
|
130
|
-
return [this.toSessionSummary(session)];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return (await this.listSessions()).filter((session) => session.sessionId === sessionId);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private toSessionSummary(session: CopilotSession): SessionSummary {
|
|
138
|
-
return {
|
|
139
|
-
type: this.type,
|
|
140
|
-
sessionId: session.sessionId,
|
|
141
|
-
cwd: session.projectPath,
|
|
142
|
-
firstUserMessage: session.firstUserMessage,
|
|
143
|
-
lastActive: session.lastActive,
|
|
144
|
-
startedAt: session.sessionStart,
|
|
145
|
-
sessionFilePath: session.eventsFilePath,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private applyWrapperRegistryName(
|
|
150
|
-
agent: AgentInfo,
|
|
151
|
-
processInfo: ProcessInfo,
|
|
152
|
-
processes: ProcessInfo[],
|
|
153
|
-
registryEntriesByPid: Map<number, RegistryEntry>,
|
|
154
|
-
): void {
|
|
155
|
-
const wrapper = findWrapperProcess(processes, processInfo);
|
|
156
|
-
const wrapperEntry = wrapper ? registryEntriesByPid.get(wrapper.pid) : undefined;
|
|
157
|
-
if (wrapperEntry?.type === this.type) {
|
|
158
|
-
agent.name = wrapperEntry.name;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AgentInfo, ProcessInfo } from "../../adapters/AgentAdapter.js";
|
|
2
|
-
import { generateAgentName } from "../../utils/matching.js";
|
|
3
|
-
import { CopilotSessionParser, type CopilotSession } from "./CopilotSessionParser.js";
|
|
4
|
-
import { processOnlyAgent } from "../shared.js";
|
|
5
|
-
|
|
6
|
-
export class CopilotAgentMapper {
|
|
7
|
-
constructor(private readonly parser: CopilotSessionParser = new CopilotSessionParser()) {}
|
|
8
|
-
|
|
9
|
-
mapSessionToAgent(session: CopilotSession, processInfo: ProcessInfo): AgentInfo {
|
|
10
|
-
const projectPath = session.projectPath || processInfo.cwd || "";
|
|
11
|
-
return {
|
|
12
|
-
name: generateAgentName(projectPath, processInfo.pid),
|
|
13
|
-
type: "copilot",
|
|
14
|
-
status: this.parser.determineStatus(session),
|
|
15
|
-
summary: session.summary || "Copilot session active",
|
|
16
|
-
pid: processInfo.pid,
|
|
17
|
-
projectPath,
|
|
18
|
-
sessionId: session.sessionId,
|
|
19
|
-
lastActive: session.lastActive,
|
|
20
|
-
sessionFilePath: session.eventsFilePath,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
mapProcessOnlyAgent(processInfo: ProcessInfo): AgentInfo {
|
|
25
|
-
return processOnlyAgent("copilot", processInfo, { summary: "Copilot process running" });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import { isDirectory, isSafePathSegment, safeReaddir, safeStat } from "../../utils/session.js";
|
|
3
|
-
import { homeDir } from "../shared.js";
|
|
4
|
-
|
|
5
|
-
export interface CopilotLock {
|
|
6
|
-
sessionDir: string;
|
|
7
|
-
sessionId: string;
|
|
8
|
-
pid: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface CopilotSessionDir {
|
|
12
|
-
sessionDir: string;
|
|
13
|
-
sessionId: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** A live Copilot process whose `inuse.<pid>.lock` file should be located. */
|
|
17
|
-
export interface CopilotLockProcess {
|
|
18
|
-
pid: number;
|
|
19
|
-
startTime?: Date;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface CopilotSessionLocatorOptions {
|
|
23
|
-
sessionStateDir?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface KnownLock extends CopilotSessionDir {
|
|
27
|
-
startTimeMs: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Tolerance between a reported process start time and its lock directory's
|
|
32
|
-
* mtime: `ps lstart` has 1 s resolution, Linux start times derive from an
|
|
33
|
-
* estimated boot time, and some filesystems store coarse mtimes.
|
|
34
|
-
*/
|
|
35
|
-
const START_TIME_SLACK_MS = 5 * 60 * 1000;
|
|
36
|
-
|
|
37
|
-
const LOCK_FILE_PATTERN = /^inuse\.(\d+)\.lock$/;
|
|
38
|
-
|
|
39
|
-
export class CopilotSessionLocator {
|
|
40
|
-
private readonly sessionStateDir: string;
|
|
41
|
-
/** Lock location per PID, trusted only while that PID's start time is unchanged. */
|
|
42
|
-
private readonly knownLocks = new Map<number, KnownLock>();
|
|
43
|
-
|
|
44
|
-
constructor(options: CopilotSessionLocatorOptions = {}) {
|
|
45
|
-
this.sessionStateDir =
|
|
46
|
-
options.sessionStateDir ?? path.join(homeDir(), ".copilot", "session-state");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
listSessionDirs(): CopilotSessionDir[] {
|
|
50
|
-
if (!isDirectory(this.sessionStateDir)) return [];
|
|
51
|
-
|
|
52
|
-
const sessionDirs: CopilotSessionDir[] = [];
|
|
53
|
-
for (const sessionId of safeReaddir(this.sessionStateDir)) {
|
|
54
|
-
const sessionDir = path.join(this.sessionStateDir, sessionId);
|
|
55
|
-
if (!isDirectory(sessionDir)) continue;
|
|
56
|
-
|
|
57
|
-
sessionDirs.push({ sessionDir, sessionId });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return sessionDirs;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
findSessionDirById(sessionId: string): CopilotSessionDir | null {
|
|
64
|
-
if (!isSafePathSegment(sessionId)) return null;
|
|
65
|
-
const sessionDir = path.join(this.sessionStateDir, sessionId);
|
|
66
|
-
return isDirectory(sessionDir) ? { sessionDir, sessionId } : null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Find `inuse.<pid>.lock` files.
|
|
71
|
-
*
|
|
72
|
-
* Without `processes`, every session directory is scanned and all locks are
|
|
73
|
-
* returned. With `processes`, only locks of those PIDs are returned and the
|
|
74
|
-
* search is bounded:
|
|
75
|
-
* - a lock found earlier for the same (pid, startTime) is re-validated with
|
|
76
|
-
* a single `stat` (a reused PID has a different start time and misses);
|
|
77
|
-
* - otherwise only session directories whose mtime is at or after the
|
|
78
|
-
* earliest unresolved process start time (minus slack) are listed, since
|
|
79
|
-
* creating the lock file bumps its directory's mtime;
|
|
80
|
-
* - if an unresolved process has no start time, every directory is listed.
|
|
81
|
-
*/
|
|
82
|
-
discoverActiveLocks(processes?: readonly CopilotLockProcess[]): CopilotLock[] {
|
|
83
|
-
if (!processes) {
|
|
84
|
-
return this.scanLocks(undefined, () => true);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const startTimes = new Map(processes.map((proc) => [proc.pid, proc.startTime?.getTime()]));
|
|
88
|
-
for (const [pid, known] of this.knownLocks) {
|
|
89
|
-
if (startTimes.get(pid) !== known.startTimeMs) {
|
|
90
|
-
this.knownLocks.delete(pid);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const locks: CopilotLock[] = [];
|
|
95
|
-
const unresolved = new Set<number>();
|
|
96
|
-
for (const pid of startTimes.keys()) {
|
|
97
|
-
const known = this.knownLocks.get(pid);
|
|
98
|
-
if (known && safeStat(path.join(known.sessionDir, lockFileName(pid)))?.isFile()) {
|
|
99
|
-
locks.push({ sessionDir: known.sessionDir, sessionId: known.sessionId, pid });
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
this.knownLocks.delete(pid);
|
|
103
|
-
unresolved.add(pid);
|
|
104
|
-
}
|
|
105
|
-
if (unresolved.size === 0) return locks;
|
|
106
|
-
|
|
107
|
-
const unresolvedStarts = [...unresolved].map((pid) => startTimes.get(pid));
|
|
108
|
-
const minMtimeMs = unresolvedStarts.every((start): start is number => start !== undefined)
|
|
109
|
-
? Math.min(...unresolvedStarts) - START_TIME_SLACK_MS
|
|
110
|
-
: undefined;
|
|
111
|
-
|
|
112
|
-
const found = this.scanLocks(minMtimeMs, (pid) => unresolved.has(pid));
|
|
113
|
-
|
|
114
|
-
const lockCounts = new Map<number, number>();
|
|
115
|
-
for (const lock of found) {
|
|
116
|
-
lockCounts.set(lock.pid, (lockCounts.get(lock.pid) ?? 0) + 1);
|
|
117
|
-
}
|
|
118
|
-
for (const lock of found) {
|
|
119
|
-
const startTimeMs = startTimes.get(lock.pid);
|
|
120
|
-
// Only remember unambiguous locks of processes with a known start time
|
|
121
|
-
if (startTimeMs !== undefined && lockCounts.get(lock.pid) === 1) {
|
|
122
|
-
this.knownLocks.set(lock.pid, {
|
|
123
|
-
sessionDir: lock.sessionDir,
|
|
124
|
-
sessionId: lock.sessionId,
|
|
125
|
-
startTimeMs,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return locks.concat(found);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** List lock files in session directories with mtime >= `minMtimeMs` (all when undefined). */
|
|
134
|
-
private scanLocks(
|
|
135
|
-
minMtimeMs: number | undefined,
|
|
136
|
-
includePid: (pid: number) => boolean,
|
|
137
|
-
): CopilotLock[] {
|
|
138
|
-
const locks: CopilotLock[] = [];
|
|
139
|
-
for (const sessionId of safeReaddir(this.sessionStateDir)) {
|
|
140
|
-
const sessionDir = path.join(this.sessionStateDir, sessionId);
|
|
141
|
-
const stat = safeStat(sessionDir);
|
|
142
|
-
if (!stat?.isDirectory()) continue;
|
|
143
|
-
if (minMtimeMs !== undefined && stat.mtimeMs < minMtimeMs) continue;
|
|
144
|
-
|
|
145
|
-
for (const entry of safeReaddir(sessionDir)) {
|
|
146
|
-
const match = entry.match(LOCK_FILE_PATTERN);
|
|
147
|
-
if (!match) continue;
|
|
148
|
-
|
|
149
|
-
const pid = Number.parseInt(match[1], 10);
|
|
150
|
-
if (!Number.isFinite(pid) || !includePid(pid)) continue;
|
|
151
|
-
locks.push({ sessionDir, sessionId, pid });
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return locks;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function lockFileName(pid: number): string {
|
|
160
|
-
return `inuse.${pid}.lock`;
|
|
161
|
-
}
|