@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,56 +0,0 @@
|
|
|
1
|
-
import { execFile } from "child_process";
|
|
2
|
-
import { promisify } from "util";
|
|
3
|
-
import { PiPrintError } from "../../../durable/DurableAgent.js";
|
|
4
|
-
import { sanitizeText } from "../../../durable/utils.js";
|
|
5
|
-
|
|
6
|
-
type ExecResult = { stdout: string; stderr: string };
|
|
7
|
-
type Exec = (file: string, args: string[]) => Promise<ExecResult>;
|
|
8
|
-
const execFileAsync = promisify(execFile);
|
|
9
|
-
const REQUIRED = ["--mode", "json", "--session-id", "--session"];
|
|
10
|
-
|
|
11
|
-
export interface PiCliProbeOptions {
|
|
12
|
-
executable?: string;
|
|
13
|
-
exec?: Exec;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class PiCliProbe {
|
|
17
|
-
private readonly executable: string;
|
|
18
|
-
private readonly exec: Exec;
|
|
19
|
-
|
|
20
|
-
constructor(options: PiCliProbeOptions = {}) {
|
|
21
|
-
this.executable = options.executable ?? "pi";
|
|
22
|
-
this.exec =
|
|
23
|
-
options.exec ??
|
|
24
|
-
(async (file, args) => {
|
|
25
|
-
const result = await execFileAsync(file, args, {
|
|
26
|
-
encoding: "utf8",
|
|
27
|
-
maxBuffer: 1024 * 1024,
|
|
28
|
-
});
|
|
29
|
-
return { stdout: result.stdout, stderr: result.stderr };
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async validate(): Promise<{ executable: string; version: string }> {
|
|
34
|
-
try {
|
|
35
|
-
const version = await this.exec(this.executable, ["--version"]);
|
|
36
|
-
const help = await this.exec(this.executable, ["--help"]);
|
|
37
|
-
const missing = REQUIRED.filter((capability) => !help.stdout.includes(capability));
|
|
38
|
-
if (missing.length > 0) {
|
|
39
|
-
throw new PiPrintError(
|
|
40
|
-
`Pi CLI does not support required print-mode capabilities: ${missing.join(", ")}.`,
|
|
41
|
-
"PI_CLI_UNSUPPORTED",
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
executable: this.executable,
|
|
46
|
-
version: sanitizeText(version.stdout, 256) || "unknown",
|
|
47
|
-
};
|
|
48
|
-
} catch (error) {
|
|
49
|
-
if (error instanceof PiPrintError) throw error;
|
|
50
|
-
throw new PiPrintError(
|
|
51
|
-
`Pi CLI validation failed: ${sanitizeText((error as Error).message, 512)}`,
|
|
52
|
-
"PI_CLI_UNAVAILABLE",
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { DurableAgent, ProcessIdentity } from "../../../durable/DurableAgent.js";
|
|
2
|
-
import { PiPrintError } from "../../../durable/DurableAgent.js";
|
|
3
|
-
import { PiCliProbe } from "./PiCliProbe.js";
|
|
4
|
-
import { PiPrintRunner, type PiPrintRunResult } from "./PiPrintRunner.js";
|
|
5
|
-
import {
|
|
6
|
-
DurableAgentRepository,
|
|
7
|
-
type CreateDurableAgentInput,
|
|
8
|
-
} from "../../../durable/DurableAgentRepository.js";
|
|
9
|
-
import { runDurableAgent, type DurableRunRepository } from "../../../durable/run.js";
|
|
10
|
-
|
|
11
|
-
interface RepositoryLike extends DurableRunRepository {
|
|
12
|
-
create(input: CreateDurableAgentInput): Promise<DurableAgent>;
|
|
13
|
-
list(): Promise<DurableAgent[]>;
|
|
14
|
-
recordProviderProcess(id: string, token: string, identity: ProcessIdentity): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ProbeLike {
|
|
18
|
-
validate(): Promise<{ executable: string; version: string }>;
|
|
19
|
-
}
|
|
20
|
-
interface RunnerLike {
|
|
21
|
-
run(request: Parameters<PiPrintRunner["run"]>[0]): Promise<PiPrintRunResult>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface PiPrintAgentServiceOptions {
|
|
25
|
-
repository?: RepositoryLike;
|
|
26
|
-
probe?: ProbeLike;
|
|
27
|
-
runner?: RunnerLike;
|
|
28
|
-
executable?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface PiPrintSendResult extends PiPrintRunResult {
|
|
32
|
-
agentId: string;
|
|
33
|
-
agentName: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class PiPrintAgentService {
|
|
37
|
-
readonly repository: RepositoryLike;
|
|
38
|
-
private readonly probe: ProbeLike;
|
|
39
|
-
private readonly runner: RunnerLike;
|
|
40
|
-
private readonly executable?: string;
|
|
41
|
-
|
|
42
|
-
constructor(options: PiPrintAgentServiceOptions = {}) {
|
|
43
|
-
this.repository = options.repository ?? new DurableAgentRepository();
|
|
44
|
-
this.probe = options.probe ?? new PiCliProbe();
|
|
45
|
-
this.runner = options.runner ?? new PiPrintRunner();
|
|
46
|
-
this.executable = options.executable;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async create(input: Omit<CreateDurableAgentInput, "provider">): Promise<DurableAgent> {
|
|
50
|
-
await this.probe.validate();
|
|
51
|
-
return this.repository.create({ ...input, provider: "pi" });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async send(reference: string, prompt: string): Promise<PiPrintSendResult> {
|
|
55
|
-
const completed = await runDurableAgent({
|
|
56
|
-
reference,
|
|
57
|
-
provider: "pi",
|
|
58
|
-
repository: this.repository,
|
|
59
|
-
ambiguousError: () => new PiPrintError("Multiple print agents match.", "PI_UNSUPPORTED"),
|
|
60
|
-
providerError: () => new PiPrintError("Print agent provider is not Pi.", "PI_UNSUPPORTED"),
|
|
61
|
-
execute: (agent, token) =>
|
|
62
|
-
this.runner.run({
|
|
63
|
-
agent,
|
|
64
|
-
prompt,
|
|
65
|
-
executable: this.executable,
|
|
66
|
-
onSpawn: (identity) => this.repository.recordProviderProcess(agent.id, token, identity),
|
|
67
|
-
}),
|
|
68
|
-
isSessionMismatch: (error) =>
|
|
69
|
-
error instanceof PiPrintError && error.code === "PI_SESSION_MISMATCH",
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
...completed.result,
|
|
73
|
-
agentId: completed.agent.id,
|
|
74
|
-
agentName: completed.agent.name,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { PiPrintError } from "../../../durable/DurableAgent.js";
|
|
2
|
-
import { isUuid } from "../../../durable/utils.js";
|
|
3
|
-
|
|
4
|
-
export function buildPiPrintArgs(providerSessionId: string, firstRun: boolean): string[] {
|
|
5
|
-
return firstRun
|
|
6
|
-
? ["--mode", "json", "--session-id", providerSessionId]
|
|
7
|
-
: ["--mode", "json", "--session", providerSessionId];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function readPiSessionId(
|
|
11
|
-
event: Record<string, unknown>,
|
|
12
|
-
currentSessionId: string | null,
|
|
13
|
-
expectedSessionId: string,
|
|
14
|
-
): string {
|
|
15
|
-
if (currentSessionId !== null || typeof event.id !== "string" || !isUuid(event.id)) {
|
|
16
|
-
throw new PiPrintError("Pi emitted an invalid session identity.", "PI_PROTOCOL");
|
|
17
|
-
}
|
|
18
|
-
const sessionId = event.id;
|
|
19
|
-
if (expectedSessionId !== sessionId) {
|
|
20
|
-
throw new PiPrintError("Pi returned a different session identity.", "PI_SESSION_MISMATCH");
|
|
21
|
-
}
|
|
22
|
-
return sessionId;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function readPiAssistantText(event: Record<string, unknown>): string | null {
|
|
26
|
-
if (event.type !== "message_end") return null;
|
|
27
|
-
const message = event.message;
|
|
28
|
-
if (!message || typeof message !== "object" || Array.isArray(message)) return null;
|
|
29
|
-
const record = message as Record<string, unknown>;
|
|
30
|
-
if (record.role !== "assistant") return null;
|
|
31
|
-
if (typeof record.content === "string") return record.content.trim() ? record.content : null;
|
|
32
|
-
if (!Array.isArray(record.content)) return null;
|
|
33
|
-
const text = record.content
|
|
34
|
-
.flatMap((part) => {
|
|
35
|
-
if (!part || typeof part !== "object" || Array.isArray(part)) return [];
|
|
36
|
-
const block = part as Record<string, unknown>;
|
|
37
|
-
return block.type === "text" && typeof block.text === "string" ? [block.text] : [];
|
|
38
|
-
})
|
|
39
|
-
.join("");
|
|
40
|
-
return text.trim() ? text : null;
|
|
41
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
spawn as nodeSpawn,
|
|
3
|
-
type ChildProcessWithoutNullStreams,
|
|
4
|
-
type SpawnOptionsWithoutStdio,
|
|
5
|
-
} from "child_process";
|
|
6
|
-
import type { PiDurableAgent, ProcessIdentity } from "../../../durable/DurableAgent.js";
|
|
7
|
-
import { PiPrintError } from "../../../durable/DurableAgent.js";
|
|
8
|
-
import { LocalProcessInspector, type ProcessInspector } from "../../../durable/process.js";
|
|
9
|
-
import { waitForChildClose } from "../../../durable/utils.js";
|
|
10
|
-
import { buildPiPrintArgs } from "./PiPrintProtocol.js";
|
|
11
|
-
import { PiStreamParser } from "./PiStreamParser.js";
|
|
12
|
-
|
|
13
|
-
type Spawn = (
|
|
14
|
-
command: string,
|
|
15
|
-
args: readonly string[],
|
|
16
|
-
options: SpawnOptionsWithoutStdio & { stdio: ["pipe", "pipe", "pipe"] },
|
|
17
|
-
) => ChildProcessWithoutNullStreams;
|
|
18
|
-
|
|
19
|
-
export interface PiPrintRunRequest {
|
|
20
|
-
agent: PiDurableAgent;
|
|
21
|
-
prompt: string;
|
|
22
|
-
executable?: string;
|
|
23
|
-
onSpawn(identity: ProcessIdentity): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface PiPrintRunResult {
|
|
27
|
-
sessionId: string;
|
|
28
|
-
result: string;
|
|
29
|
-
messages: string[];
|
|
30
|
-
exitCode: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface PiPrintRunnerOptions {
|
|
34
|
-
spawn?: Spawn;
|
|
35
|
-
processInspector?: ProcessInspector;
|
|
36
|
-
maxLineBytes?: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class PiPrintRunner {
|
|
40
|
-
private readonly spawn: Spawn;
|
|
41
|
-
private readonly processInspector: ProcessInspector;
|
|
42
|
-
private readonly maxLineBytes: number;
|
|
43
|
-
|
|
44
|
-
constructor(options: PiPrintRunnerOptions = {}) {
|
|
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: PiPrintRunRequest): Promise<PiPrintRunResult> {
|
|
51
|
-
const args = buildPiPrintArgs(
|
|
52
|
-
request.agent.providerSessionId,
|
|
53
|
-
request.agent.sessionHealth === "uninitialized",
|
|
54
|
-
);
|
|
55
|
-
const child = this.spawn(request.executable ?? "pi", args, {
|
|
56
|
-
cwd: request.agent.cwd,
|
|
57
|
-
shell: false,
|
|
58
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
59
|
-
});
|
|
60
|
-
if (!child.pid) {
|
|
61
|
-
child.kill();
|
|
62
|
-
throw new PiPrintError("Pi process did not provide a PID.", "PI_PROCESS");
|
|
63
|
-
}
|
|
64
|
-
const identity = this.processInspector.getIdentity(child.pid);
|
|
65
|
-
if (!identity) {
|
|
66
|
-
child.kill();
|
|
67
|
-
throw new PiPrintError("Cannot verify Pi process identity.", "PI_PROCESS");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const parser = new PiStreamParser(request.agent.providerSessionId, this.maxLineBytes);
|
|
71
|
-
child.stdout.on("data", (chunk: Buffer | string) => {
|
|
72
|
-
if (parser.hasFailed()) return;
|
|
73
|
-
try {
|
|
74
|
-
parser.accept(chunk);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
parser.fail(error);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
child.stderr.resume();
|
|
80
|
-
|
|
81
|
-
const closed = waitForChildClose(child);
|
|
82
|
-
try {
|
|
83
|
-
await request.onSpawn(identity);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
child.kill();
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
child.stdin.end(request.prompt);
|
|
90
|
-
const close = await closed.catch(() => {
|
|
91
|
-
throw new PiPrintError("Pi process failed to start or communicate.", "PI_PROCESS");
|
|
92
|
-
});
|
|
93
|
-
return parser.result(close);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { PiPrintError } from "../../../durable/DurableAgent.js";
|
|
2
|
-
import { LineBuffer, type ChildCloseResult } from "../../../durable/utils.js";
|
|
3
|
-
import { readPiAssistantText, readPiSessionId } from "./PiPrintProtocol.js";
|
|
4
|
-
|
|
5
|
-
export class PiStreamParser {
|
|
6
|
-
private readonly lines: LineBuffer;
|
|
7
|
-
private sessionId: string | null = null;
|
|
8
|
-
private ended = false;
|
|
9
|
-
private readonly messages: string[] = [];
|
|
10
|
-
private failure: PiPrintError | null = null;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly expectedSessionId: string,
|
|
14
|
-
maxLineBytes: number,
|
|
15
|
-
) {
|
|
16
|
-
this.lines = new LineBuffer(
|
|
17
|
-
maxLineBytes,
|
|
18
|
-
() => new PiPrintError("Pi stream line exceeded the safety limit.", "PI_PROTOCOL"),
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
hasFailed(): boolean {
|
|
23
|
-
return this.failure !== null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
accept(chunk: Buffer | string): void {
|
|
27
|
-
for (const line of this.lines.accept(chunk)) {
|
|
28
|
-
if (line.length === 0) continue;
|
|
29
|
-
this.acceptLine(line);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fail(error: unknown): void {
|
|
34
|
-
this.failure =
|
|
35
|
-
error instanceof PiPrintError
|
|
36
|
-
? error
|
|
37
|
-
: new PiPrintError("Pi stream processing failed.", "PI_PROTOCOL");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
result(close: ChildCloseResult): {
|
|
41
|
-
sessionId: string;
|
|
42
|
-
result: string;
|
|
43
|
-
messages: string[];
|
|
44
|
-
exitCode: number;
|
|
45
|
-
} {
|
|
46
|
-
if (this.failure) throw this.failure;
|
|
47
|
-
this.lines.assertComplete(
|
|
48
|
-
() => new PiPrintError("Pi stream ended with incomplete JSON.", "PI_PROTOCOL"),
|
|
49
|
-
);
|
|
50
|
-
if (close.code !== 0) {
|
|
51
|
-
throw new PiPrintError(
|
|
52
|
-
`Pi print run failed${close.signal ? ` (${close.signal})` : "."}`,
|
|
53
|
-
"PI_PROCESS",
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
if (this.sessionId === null) {
|
|
57
|
-
throw new PiPrintError("Pi stream ended without a session identity.", "PI_PROTOCOL");
|
|
58
|
-
}
|
|
59
|
-
if (!this.ended)
|
|
60
|
-
throw new PiPrintError("Pi stream ended before agent completion.", "PI_PROTOCOL");
|
|
61
|
-
if (this.messages.length === 0) {
|
|
62
|
-
throw new PiPrintError("Pi stream ended without an assistant result.", "PI_RESULT_MISSING");
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
sessionId: this.sessionId,
|
|
66
|
-
result: this.messages.at(-1)!,
|
|
67
|
-
messages: this.messages,
|
|
68
|
-
exitCode: close.code,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private acceptLine(line: Buffer): void {
|
|
73
|
-
let value: unknown;
|
|
74
|
-
try {
|
|
75
|
-
value = JSON.parse(line.toString("utf8"));
|
|
76
|
-
} catch {
|
|
77
|
-
throw new PiPrintError("Pi emitted malformed stream JSON.", "PI_PROTOCOL");
|
|
78
|
-
}
|
|
79
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
80
|
-
throw new PiPrintError("Pi emitted a non-object stream message.", "PI_PROTOCOL");
|
|
81
|
-
}
|
|
82
|
-
const event = value as Record<string, unknown>;
|
|
83
|
-
if (event.type === "session") {
|
|
84
|
-
this.sessionId = readPiSessionId(event, this.sessionId, this.expectedSessionId);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (event.type === "agent_end") {
|
|
88
|
-
this.ended = true;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const text = readPiAssistantText(event);
|
|
92
|
-
if (text !== null) this.messages.push(text);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
displayHome,
|
|
4
|
-
mappingCheck,
|
|
5
|
-
nonEmpty,
|
|
6
|
-
record,
|
|
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
|
-
function providerNames(parsed: Record<string, unknown>): string[] {
|
|
17
|
-
const names = new Set<string>();
|
|
18
|
-
if (nonEmpty(parsed.provider)) names.add((parsed.provider as string).trim());
|
|
19
|
-
const providers = record(parsed.providers);
|
|
20
|
-
if (providers) {
|
|
21
|
-
for (const name of Object.keys(providers)) {
|
|
22
|
-
if (name.trim()) names.add(name);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
for (const [name, value] of Object.entries(parsed)) {
|
|
26
|
-
if (name === "provider" || name === "providers") continue;
|
|
27
|
-
if (record(value) && name.trim()) names.add(name);
|
|
28
|
-
}
|
|
29
|
-
return [...names].sort();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function authCheck(runtime: ReadinessRuntime): Promise<AuthReadinessCheck> {
|
|
33
|
-
const sourcePath = join(runtime.homeDir, ".pi", "agent", "auth.json");
|
|
34
|
-
try {
|
|
35
|
-
const parsed = record(JSON.parse(await runtime.readFile(sourcePath)));
|
|
36
|
-
if (!parsed) throw new Error("invalid");
|
|
37
|
-
const availableProviders = providerNames(parsed);
|
|
38
|
-
const provider = nonEmpty(parsed.provider) ? (parsed.provider as string).trim() : null;
|
|
39
|
-
const authenticated = availableProviders.length > 0;
|
|
40
|
-
return {
|
|
41
|
-
state: authenticated ? "authenticated" : "unauthenticated",
|
|
42
|
-
source: displayHome(sourcePath, runtime.homeDir),
|
|
43
|
-
provider,
|
|
44
|
-
availableProviders,
|
|
45
|
-
status: authenticated ? "pass" : "fail",
|
|
46
|
-
errors: authenticated ? [] : ["Pi credential file has no configured model provider"],
|
|
47
|
-
};
|
|
48
|
-
} catch {
|
|
49
|
-
return {
|
|
50
|
-
state: "unauthenticated",
|
|
51
|
-
source: displayHome(sourcePath, runtime.homeDir),
|
|
52
|
-
provider: null,
|
|
53
|
-
availableProviders: [],
|
|
54
|
-
status: "fail",
|
|
55
|
-
errors: ["Pi credential file is missing or invalid"],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function isSessionTrackerListed(output: string): boolean {
|
|
61
|
-
const normalized = output.toLowerCase();
|
|
62
|
-
return (
|
|
63
|
-
normalized.includes("@ai-devkit/pi-session-tracker") ||
|
|
64
|
-
/\bsession[\s-]+tracker\b/.test(normalized)
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function integrationCheck(runtime: ReadinessRuntime): Promise<IntegrationReadinessCheck> {
|
|
69
|
-
let installed = false;
|
|
70
|
-
try {
|
|
71
|
-
const result = await runtime.runCommand("pi", ["list"]);
|
|
72
|
-
installed = isSessionTrackerListed(result.stdout);
|
|
73
|
-
} catch {
|
|
74
|
-
// Safe fixed result below.
|
|
75
|
-
}
|
|
76
|
-
const mapping = await mappingCheck(
|
|
77
|
-
join(runtime.homeDir, ".pi", "agent", "sessions.json"),
|
|
78
|
-
runtime,
|
|
79
|
-
);
|
|
80
|
-
const mappingStatus = mapping.valid || !mapping.present ? "pass" : "fail";
|
|
81
|
-
const status = worstReadinessStatus([installed ? "pass" : "fail", mappingStatus]);
|
|
82
|
-
return {
|
|
83
|
-
label: "ai-devkit plugin",
|
|
84
|
-
installed,
|
|
85
|
-
status,
|
|
86
|
-
errors: [
|
|
87
|
-
...(!installed ? ["Pi session tracker is not registered"] : []),
|
|
88
|
-
...(mappingStatus === "fail" ? mapping.errors : []),
|
|
89
|
-
],
|
|
90
|
-
details: {
|
|
91
|
-
package: "@ai-devkit/pi-session-tracker",
|
|
92
|
-
registryPath: mapping.path,
|
|
93
|
-
registryValid: mapping.valid,
|
|
94
|
-
invalidEntries: mapping.invalidEntries,
|
|
95
|
-
staleEntries: mapping.staleEntries,
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export const piReadiness: HarnessReadinessProfile = {
|
|
101
|
-
configDir: ".pi",
|
|
102
|
-
auth: authCheck,
|
|
103
|
-
integration: integrationCheck,
|
|
104
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { claudeReadiness } from "../claude/readiness.js";
|
|
2
|
-
import { codexReadiness } from "../codex/readiness.js";
|
|
3
|
-
import { copilotReadiness } from "../copilot/readiness.js";
|
|
4
|
-
import { openCodeReadiness } from "../opencode/readiness.js";
|
|
5
|
-
import { piReadiness } from "../pi/readiness.js";
|
|
6
|
-
import { devinReadiness } from "../devin/readiness.js";
|
|
7
|
-
import { museReadiness } from "../muse/readiness.js";
|
|
8
|
-
import {
|
|
9
|
-
builtInSkillsCheck,
|
|
10
|
-
createReadinessRuntime,
|
|
11
|
-
directoryCheck,
|
|
12
|
-
executableCheck,
|
|
13
|
-
worstReadinessStatus,
|
|
14
|
-
} from "./checks.js";
|
|
15
|
-
import {
|
|
16
|
-
READINESS_AGENT_TYPES,
|
|
17
|
-
type AgentReadinessOptions,
|
|
18
|
-
type AgentReadinessReport,
|
|
19
|
-
type HarnessReadinessProfile,
|
|
20
|
-
type ReadinessAgentType,
|
|
21
|
-
type ReadinessRuntime,
|
|
22
|
-
} from "./types.js";
|
|
23
|
-
|
|
24
|
-
const READINESS_PROFILES: Record<ReadinessAgentType, HarnessReadinessProfile> = {
|
|
25
|
-
claude: claudeReadiness,
|
|
26
|
-
codex: codexReadiness,
|
|
27
|
-
gemini_cli: { configDir: ".gemini" },
|
|
28
|
-
grok_cli: { configDir: ".grok" },
|
|
29
|
-
kiro: { configDir: ".kiro" },
|
|
30
|
-
antigravity_cli: { configDir: ".gemini/antigravity-cli" },
|
|
31
|
-
opencode: openCodeReadiness,
|
|
32
|
-
copilot: copilotReadiness,
|
|
33
|
-
pi: piReadiness,
|
|
34
|
-
devin: devinReadiness,
|
|
35
|
-
muse: museReadiness,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export async function getAgentReadinessReport(
|
|
39
|
-
agent: ReadinessAgentType,
|
|
40
|
-
options: AgentReadinessOptions = {},
|
|
41
|
-
): Promise<AgentReadinessReport> {
|
|
42
|
-
return agentReadiness(agent, createReadinessRuntime(options));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function agentReadiness(
|
|
46
|
-
agent: ReadinessAgentType,
|
|
47
|
-
runtime: ReadinessRuntime,
|
|
48
|
-
): Promise<AgentReadinessReport> {
|
|
49
|
-
const profile = READINESS_PROFILES[agent];
|
|
50
|
-
const [executable, globalConfig, builtInSkills, auth, integration] = await Promise.all([
|
|
51
|
-
executableCheck(agent, runtime),
|
|
52
|
-
directoryCheck(profile.configDir, runtime),
|
|
53
|
-
builtInSkillsCheck(agent, runtime),
|
|
54
|
-
profile.auth?.(runtime),
|
|
55
|
-
profile.integration?.(runtime),
|
|
56
|
-
]);
|
|
57
|
-
return {
|
|
58
|
-
type: agent,
|
|
59
|
-
executable,
|
|
60
|
-
globalConfig,
|
|
61
|
-
builtInSkills,
|
|
62
|
-
auth,
|
|
63
|
-
integration,
|
|
64
|
-
status: worstReadinessStatus([
|
|
65
|
-
executable.status,
|
|
66
|
-
globalConfig.status,
|
|
67
|
-
...(auth ? [auth.status] : []),
|
|
68
|
-
...(integration ? [integration.status] : []),
|
|
69
|
-
]),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function getAgentReadinessReports(
|
|
74
|
-
options: AgentReadinessOptions = {},
|
|
75
|
-
): Promise<Record<ReadinessAgentType, AgentReadinessReport>> {
|
|
76
|
-
const runtime = createReadinessRuntime(options);
|
|
77
|
-
const entries = await Promise.all(
|
|
78
|
-
READINESS_AGENT_TYPES.map(
|
|
79
|
-
async (agent) => [agent, await agentReadiness(agent, runtime)] as const,
|
|
80
|
-
),
|
|
81
|
-
);
|
|
82
|
-
return Object.fromEntries(entries) as Record<ReadinessAgentType, AgentReadinessReport>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { worstReadinessStatus } from "./checks.js";
|
|
86
|
-
export type {
|
|
87
|
-
AgentReadinessOptions,
|
|
88
|
-
AgentReadinessReport,
|
|
89
|
-
ReadinessAgentType,
|
|
90
|
-
ReadinessStatus,
|
|
91
|
-
} from "./types.js";
|