opencastle 1.3.1 → 1.4.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/README.md +16 -10
- package/bin/cli.mjs +8 -9
- package/dist/cli/agent-roster.test.js +0 -48
- package/dist/cli/agent-roster.test.js.map +1 -1
- package/dist/cli/boundary.test.js +9 -7
- package/dist/cli/boundary.test.js.map +1 -1
- package/dist/cli/convoy/artifacts.d.ts +9 -2
- package/dist/cli/convoy/artifacts.d.ts.map +1 -1
- package/dist/cli/convoy/artifacts.js +13 -10
- package/dist/cli/convoy/artifacts.js.map +1 -1
- package/dist/cli/convoy/artifacts.test.js +4 -2
- package/dist/cli/convoy/artifacts.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts +53 -23
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.git.test.d.ts +2 -0
- package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
- package/dist/cli/convoy/engine.git.test.js +435 -0
- package/dist/cli/convoy/engine.git.test.js.map +1 -0
- package/dist/cli/convoy/engine.js +1746 -2305
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +698 -678
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-schemas.d.ts +2 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +59 -57
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.d.ts +4 -1
- package/dist/cli/convoy/events.d.ts.map +1 -1
- package/dist/cli/convoy/events.js +69 -84
- package/dist/cli/convoy/events.js.map +1 -1
- package/dist/cli/convoy/events.test.js +50 -9
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +9 -4
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +29 -14
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/convoy/isolation.d.ts +32 -6
- package/dist/cli/convoy/isolation.d.ts.map +1 -1
- package/dist/cli/convoy/isolation.js +72 -34
- package/dist/cli/convoy/isolation.js.map +1 -1
- package/dist/cli/convoy/isolation.test.js +66 -42
- package/dist/cli/convoy/isolation.test.js.map +1 -1
- package/dist/cli/convoy/lock.d.ts.map +1 -1
- package/dist/cli/convoy/lock.js +25 -10
- package/dist/cli/convoy/lock.js.map +1 -1
- package/dist/cli/convoy/lock.test.js +12 -0
- package/dist/cli/convoy/lock.test.js.map +1 -1
- package/dist/cli/convoy/merge.d.ts +21 -4
- package/dist/cli/convoy/merge.d.ts.map +1 -1
- package/dist/cli/convoy/merge.js +69 -53
- package/dist/cli/convoy/merge.js.map +1 -1
- package/dist/cli/convoy/merge.test.js +23 -1
- package/dist/cli/convoy/merge.test.js.map +1 -1
- package/dist/cli/convoy/progress.d.ts +35 -0
- package/dist/cli/convoy/progress.d.ts.map +1 -0
- package/dist/cli/convoy/progress.js +103 -0
- package/dist/cli/convoy/progress.js.map +1 -0
- package/dist/cli/convoy/progress.test.d.ts +2 -0
- package/dist/cli/convoy/progress.test.d.ts.map +1 -0
- package/dist/cli/convoy/progress.test.js +53 -0
- package/dist/cli/convoy/progress.test.js.map +1 -0
- package/dist/cli/convoy/read-model.d.ts +468 -0
- package/dist/cli/convoy/read-model.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.js +1132 -0
- package/dist/cli/convoy/read-model.js.map +1 -0
- package/dist/cli/convoy/read-model.test.d.ts +2 -0
- package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.test.js +609 -0
- package/dist/cli/convoy/read-model.test.js.map +1 -0
- package/dist/cli/convoy/redact.d.ts +34 -0
- package/dist/cli/convoy/redact.d.ts.map +1 -0
- package/dist/cli/convoy/redact.js +66 -0
- package/dist/cli/convoy/redact.js.map +1 -0
- package/dist/cli/convoy/redact.test.d.ts +2 -0
- package/dist/cli/convoy/redact.test.d.ts.map +1 -0
- package/dist/cli/convoy/redact.test.js +43 -0
- package/dist/cli/convoy/redact.test.js.map +1 -0
- package/dist/cli/convoy/reviewer.d.ts +65 -0
- package/dist/cli/convoy/reviewer.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.js +141 -0
- package/dist/cli/convoy/reviewer.js.map +1 -0
- package/dist/cli/convoy/reviewer.test.d.ts +2 -0
- package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.test.js +96 -0
- package/dist/cli/convoy/reviewer.test.js.map +1 -0
- package/dist/cli/convoy/schedule.d.ts +30 -0
- package/dist/cli/convoy/schedule.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.js +111 -0
- package/dist/cli/convoy/schedule.js.map +1 -0
- package/dist/cli/convoy/schedule.test.d.ts +2 -0
- package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.test.js +45 -0
- package/dist/cli/convoy/schedule.test.js.map +1 -0
- package/dist/cli/convoy/spec-builder.d.ts +120 -30
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +438 -114
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +419 -435
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +46 -92
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +6 -1
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +111 -15
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +59 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +76 -113
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +6 -13
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy/worktree.d.ts +88 -3
- package/dist/cli/convoy/worktree.d.ts.map +1 -1
- package/dist/cli/convoy/worktree.js +282 -56
- package/dist/cli/convoy/worktree.js.map +1 -1
- package/dist/cli/convoy/worktree.test.js +132 -1
- package/dist/cli/convoy/worktree.test.js.map +1 -1
- package/dist/cli/convoy-args.test.js +9 -27
- package/dist/cli/convoy-args.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts +31 -6
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +150 -201
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.d.ts +2 -0
- package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
- package/dist/cli/convoy-cmd.test.js +144 -0
- package/dist/cli/convoy-cmd.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +24 -11
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +241 -303
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.d.ts +2 -0
- package/dist/cli/dashboard.test.d.ts.map +1 -0
- package/dist/cli/dashboard.test.js +340 -0
- package/dist/cli/dashboard.test.js.map +1 -0
- package/dist/cli/dispatcher.test.js +35 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +3 -3
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/log.d.ts +39 -0
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +267 -93
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.d.ts +2 -0
- package/dist/cli/log.test.d.ts.map +1 -0
- package/dist/cli/log.test.js +208 -0
- package/dist/cli/log.test.js.map +1 -0
- package/dist/cli/nearest.d.ts +18 -0
- package/dist/cli/nearest.d.ts.map +1 -0
- package/dist/cli/nearest.js +38 -0
- package/dist/cli/nearest.js.map +1 -0
- package/dist/cli/nearest.test.d.ts +2 -0
- package/dist/cli/nearest.test.d.ts.map +1 -0
- package/dist/cli/nearest.test.js +24 -0
- package/dist/cli/nearest.test.js.map +1 -0
- package/dist/cli/pipeline.d.ts +61 -0
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.d.ts +2 -0
- package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
- package/dist/cli/pipeline.flow.test.js +524 -0
- package/dist/cli/pipeline.flow.test.js.map +1 -0
- package/dist/cli/pipeline.js +471 -690
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +82 -31
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +167 -507
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.d.ts +2 -0
- package/dist/cli/plan.test.d.ts.map +1 -0
- package/dist/cli/plan.test.js +158 -0
- package/dist/cli/plan.test.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.d.ts +82 -0
- package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.js +224 -0
- package/dist/cli/run/adapters/agent-process.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.js +159 -0
- package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +53 -2
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +147 -171
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +197 -254
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts +25 -2
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +113 -81
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +116 -95
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts +35 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +104 -287
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +122 -282
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/cursor.d.ts +25 -7
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/run/adapters/cursor.js +103 -156
- package/dist/cli/run/adapters/cursor.js.map +1 -1
- package/dist/cli/run/adapters/cursor.test.js +106 -218
- package/dist/cli/run/adapters/cursor.test.js.map +1 -1
- package/dist/cli/run/adapters/index.d.ts +34 -5
- package/dist/cli/run/adapters/index.d.ts.map +1 -1
- package/dist/cli/run/adapters/index.js +147 -21
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.d.ts +2 -0
- package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.test.js +129 -0
- package/dist/cli/run/adapters/index.test.js.map +1 -0
- package/dist/cli/run/adapters/opencode.d.ts +25 -9
- package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/run/adapters/opencode.js +136 -152
- package/dist/cli/run/adapters/opencode.js.map +1 -1
- package/dist/cli/run/adapters/opencode.test.js +99 -218
- package/dist/cli/run/adapters/opencode.test.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
- package/dist/cli/run/adapters/permission-modes.js +113 -37
- package/dist/cli/run/adapters/permission-modes.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.test.js +55 -40
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
- package/dist/cli/run/platform.d.ts +52 -0
- package/dist/cli/run/platform.d.ts.map +1 -0
- package/dist/cli/run/platform.js +207 -0
- package/dist/cli/run/platform.js.map +1 -0
- package/dist/cli/run/platform.test.d.ts +2 -0
- package/dist/cli/run/platform.test.d.ts.map +1 -0
- package/dist/cli/run/platform.test.js +119 -0
- package/dist/cli/run/platform.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts +6 -8
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +44 -68
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +59 -279
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run.d.ts +34 -56
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +379 -1132
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.d.ts +2 -0
- package/dist/cli/run.test.d.ts.map +1 -0
- package/dist/cli/run.test.js +318 -0
- package/dist/cli/run.test.js.map +1 -0
- package/dist/cli/team-config.d.ts.map +1 -1
- package/dist/cli/team-config.js +2 -21
- package/dist/cli/team-config.js.map +1 -1
- package/dist/cli/tiers.test.js +4 -13
- package/dist/cli/tiers.test.js.map +1 -1
- package/package.json +3 -10
- package/src/cli/agent-roster.test.ts +0 -55
- package/src/cli/boundary.test.ts +9 -7
- package/src/cli/convoy/TELEMETRY.md +131 -125
- package/src/cli/convoy/artifacts.test.ts +4 -2
- package/src/cli/convoy/artifacts.ts +13 -12
- package/src/cli/convoy/engine.git.test.ts +462 -0
- package/src/cli/convoy/engine.test.ts +817 -850
- package/src/cli/convoy/engine.ts +1864 -2596
- package/src/cli/convoy/event-schemas.ts +63 -59
- package/src/cli/convoy/events.test.ts +58 -9
- package/src/cli/convoy/events.ts +69 -91
- package/src/cli/convoy/gates.ts +31 -12
- package/src/cli/convoy/isolation.test.ts +76 -43
- package/src/cli/convoy/isolation.ts +100 -38
- package/src/cli/convoy/lock.test.ts +16 -0
- package/src/cli/convoy/lock.ts +25 -8
- package/src/cli/convoy/merge.test.ts +25 -1
- package/src/cli/convoy/merge.ts +74 -61
- package/src/cli/convoy/progress.test.ts +59 -0
- package/src/cli/convoy/progress.ts +121 -0
- package/src/cli/convoy/read-model.test.ts +685 -0
- package/src/cli/convoy/read-model.ts +1469 -0
- package/src/cli/convoy/redact.test.ts +49 -0
- package/src/cli/convoy/redact.ts +73 -0
- package/src/cli/convoy/reviewer.test.ts +112 -0
- package/src/cli/convoy/reviewer.ts +196 -0
- package/src/cli/convoy/schedule.test.ts +56 -0
- package/src/cli/convoy/schedule.ts +109 -0
- package/src/cli/convoy/spec-builder.test.ts +460 -464
- package/src/cli/convoy/spec-builder.ts +460 -129
- package/src/cli/convoy/spec-types.ts +46 -108
- package/src/cli/convoy/store.test.ts +64 -13
- package/src/cli/convoy/store.ts +143 -33
- package/src/cli/convoy/types.ts +59 -71
- package/src/cli/convoy/worktree.test.ts +140 -1
- package/src/cli/convoy/worktree.ts +311 -61
- package/src/cli/convoy-args.test.ts +10 -30
- package/src/cli/convoy-cmd.test.ts +163 -0
- package/src/cli/convoy-cmd.ts +173 -216
- package/src/cli/dashboard/dashboard.css +2086 -0
- package/src/cli/dashboard/dashboard.js +1687 -0
- package/src/cli/dashboard/index.html +307 -0
- package/src/cli/dashboard.test.ts +382 -0
- package/src/cli/dashboard.ts +243 -339
- package/src/cli/dispatcher.test.ts +36 -2
- package/src/cli/docs-accuracy.test.ts +3 -3
- package/src/cli/log.test.ts +228 -0
- package/src/cli/log.ts +302 -83
- package/src/cli/nearest.test.ts +27 -0
- package/src/cli/nearest.ts +38 -0
- package/src/cli/pipeline.flow.test.ts +607 -0
- package/src/cli/pipeline.ts +544 -759
- package/src/cli/plan.test.ts +193 -0
- package/src/cli/plan.ts +209 -545
- package/src/cli/run/adapters/agent-process.test.ts +175 -0
- package/src/cli/run/adapters/agent-process.ts +252 -0
- package/src/cli/run/adapters/claude.test.ts +205 -260
- package/src/cli/run/adapters/claude.ts +151 -162
- package/src/cli/run/adapters/codex.test.ts +120 -100
- package/src/cli/run/adapters/codex.ts +115 -91
- package/src/cli/run/adapters/copilot.test.ts +135 -306
- package/src/cli/run/adapters/copilot.ts +105 -274
- package/src/cli/run/adapters/cursor.test.ts +111 -220
- package/src/cli/run/adapters/cursor.ts +105 -156
- package/src/cli/run/adapters/index.test.ts +148 -0
- package/src/cli/run/adapters/index.ts +168 -20
- package/src/cli/run/adapters/opencode.test.ts +106 -227
- package/src/cli/run/adapters/opencode.ts +139 -151
- package/src/cli/run/adapters/permission-modes.test.ts +63 -41
- package/src/cli/run/adapters/permission-modes.ts +118 -37
- package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
- package/src/cli/run/platform.test.ts +128 -0
- package/src/cli/run/platform.ts +213 -0
- package/src/cli/run/schema.test.ts +62 -344
- package/src/cli/run/schema.ts +48 -78
- package/src/cli/run.test.ts +351 -0
- package/src/cli/run.ts +366 -1151
- package/src/cli/team-config.ts +2 -21
- package/src/cli/tiers.test.ts +4 -17
- package/src/orchestrator/agents/team-lead.agent.md +1 -1
- package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
- package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
- package/src/orchestrator/prompts/bug-fix.prompt.md +2 -2
- package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
- package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
- package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
- package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
- package/src/orchestrator/prompts/implement-feature.prompt.md +2 -2
- package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
- package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
- package/dist/cli/convoy/dag-analysis.d.ts +0 -39
- package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.js +0 -279
- package/dist/cli/convoy/dag-analysis.js.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
- package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.js +0 -289
- package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
- package/dist/cli/convoy/formula.d.ts +0 -19
- package/dist/cli/convoy/formula.d.ts.map +0 -1
- package/dist/cli/convoy/formula.js +0 -142
- package/dist/cli/convoy/formula.js.map +0 -1
- package/dist/cli/convoy/formula.test.d.ts +0 -2
- package/dist/cli/convoy/formula.test.d.ts.map +0 -1
- package/dist/cli/convoy/formula.test.js +0 -342
- package/dist/cli/convoy/formula.test.js.map +0 -1
- package/dist/cli/convoy/health.d.ts +0 -34
- package/dist/cli/convoy/health.d.ts.map +0 -1
- package/dist/cli/convoy/health.js +0 -123
- package/dist/cli/convoy/health.js.map +0 -1
- package/dist/cli/convoy/health.test.d.ts +0 -2
- package/dist/cli/convoy/health.test.d.ts.map +0 -1
- package/dist/cli/convoy/health.test.js +0 -448
- package/dist/cli/convoy/health.test.js.map +0 -1
- package/dist/cli/convoy/last-run.d.ts +0 -53
- package/dist/cli/convoy/last-run.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.js +0 -54
- package/dist/cli/convoy/last-run.js.map +0 -1
- package/dist/cli/convoy/last-run.test.d.ts +0 -2
- package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.test.js +0 -110
- package/dist/cli/convoy/last-run.test.js.map +0 -1
- package/dist/cli/convoy/pipeline.d.ts +0 -41
- package/dist/cli/convoy/pipeline.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.js +0 -414
- package/dist/cli/convoy/pipeline.js.map +0 -1
- package/dist/cli/convoy/pipeline.test.d.ts +0 -2
- package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.test.js +0 -837
- package/dist/cli/convoy/pipeline.test.js.map +0 -1
- package/dist/cli/convoy/review-stages.d.ts +0 -9
- package/dist/cli/convoy/review-stages.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.js +0 -134
- package/dist/cli/convoy/review-stages.js.map +0 -1
- package/dist/cli/convoy/review-stages.test.d.ts +0 -2
- package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.test.js +0 -197
- package/dist/cli/convoy/review-stages.test.js.map +0 -1
- package/dist/cli/run/executor.d.ts +0 -15
- package/dist/cli/run/executor.d.ts.map +0 -1
- package/dist/cli/run/executor.js +0 -249
- package/dist/cli/run/executor.js.map +0 -1
- package/dist/cli/run/executor.test.d.ts +0 -2
- package/dist/cli/run/executor.test.d.ts.map +0 -1
- package/dist/cli/run/executor.test.js +0 -297
- package/dist/cli/run/executor.test.js.map +0 -1
- package/dist/cli/run/reporter.d.ts +0 -10
- package/dist/cli/run/reporter.d.ts.map +0 -1
- package/dist/cli/run/reporter.js +0 -142
- package/dist/cli/run/reporter.js.map +0 -1
- package/dist/cli/run-dry-run.test.d.ts +0 -2
- package/dist/cli/run-dry-run.test.d.ts.map +0 -1
- package/dist/cli/run-dry-run.test.js +0 -83
- package/dist/cli/run-dry-run.test.js.map +0 -1
- package/dist/cli/run-executor-flags.test.d.ts +0 -2
- package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
- package/dist/cli/run-executor-flags.test.js +0 -31
- package/dist/cli/run-executor-flags.test.js.map +0 -1
- package/dist/cli/run-finish.test.d.ts +0 -2
- package/dist/cli/run-finish.test.d.ts.map +0 -1
- package/dist/cli/run-finish.test.js +0 -77
- package/dist/cli/run-finish.test.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -15
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js +0 -277
- package/dist/cli/watch.js.map +0 -1
- package/dist/dashboard/scripts/etl.d.ts +0 -10
- package/dist/dashboard/scripts/etl.d.ts.map +0 -1
- package/dist/dashboard/scripts/etl.js +0 -141
- package/dist/dashboard/scripts/etl.js.map +0 -1
- package/src/cli/convoy/dag-analysis.test.ts +0 -349
- package/src/cli/convoy/dag-analysis.ts +0 -367
- package/src/cli/convoy/formula.test.ts +0 -404
- package/src/cli/convoy/formula.ts +0 -174
- package/src/cli/convoy/health.test.ts +0 -519
- package/src/cli/convoy/health.ts +0 -189
- package/src/cli/convoy/last-run.test.ts +0 -130
- package/src/cli/convoy/last-run.ts +0 -87
- package/src/cli/convoy/pipeline.test.ts +0 -999
- package/src/cli/convoy/pipeline.ts +0 -492
- package/src/cli/convoy/review-stages.test.ts +0 -235
- package/src/cli/convoy/review-stages.ts +0 -166
- package/src/cli/run/executor.test.ts +0 -338
- package/src/cli/run/executor.ts +0 -292
- package/src/cli/run/reporter.ts +0 -160
- package/src/cli/run-dry-run.test.ts +0 -97
- package/src/cli/run-executor-flags.test.ts +0 -38
- package/src/cli/run-finish.test.ts +0 -91
- package/src/cli/watch.ts +0 -295
- package/src/dashboard/astro.config.mjs +0 -6
- package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
- package/src/dashboard/dist/data/.gitkeep +0 -0
- package/src/dashboard/dist/data/convoy-list.json +0 -1
- package/src/dashboard/dist/data/overall-stats.json +0 -29
- package/src/dashboard/dist/index.html +0 -1963
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
- package/src/dashboard/package-lock.json +0 -6
- package/src/dashboard/public/data/.gitkeep +0 -0
- package/src/dashboard/public/data/convoy-list.json +0 -1
- package/src/dashboard/public/data/overall-stats.json +0 -29
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/etl.test.ts +0 -166
- package/src/dashboard/scripts/etl.ts +0 -170
- package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
- package/src/dashboard/scripts/generate-demo-db.ts +0 -529
- package/src/dashboard/scripts/integration-test.ts +0 -504
- package/src/dashboard/scripts/verify-demo-data.sh +0 -51
- package/src/dashboard/seed-data/delegations.ndjson +0 -35
- package/src/dashboard/seed-data/events.ndjson +0 -104
- package/src/dashboard/seed-data/panels.ndjson +0 -13
- package/src/dashboard/seed-data/reviews.ndjson +0 -6
- package/src/dashboard/seed-data/sessions.ndjson +0 -50
- package/src/dashboard/src/env.d.ts +0 -1
- package/src/dashboard/src/layouts/Layout.astro +0 -25
- package/src/dashboard/src/pages/index.astro +0 -2313
- package/src/dashboard/src/styles/dashboard.css +0 -2943
- package/src/dashboard/tsconfig.json +0 -6
- /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
|
@@ -1,173 +1,161 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process'
|
|
2
|
-
import { writeFileSync, unlinkSync } from 'node:fs'
|
|
3
|
-
import { join } from 'node:path'
|
|
4
1
|
import type { Task, ExecuteOptions, ExecuteResult, TokenUsage } from '../../convoy/spec-types.js'
|
|
2
|
+
import { commandExists } from '../platform.js'
|
|
3
|
+
import { opencodePermission } from './permission-modes.js'
|
|
4
|
+
import { runAgent, stopTask, promptOf, interruptedMessage, OUTPUT_LIMIT } from './agent-process.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* OpenCode, run headless: `opencode run --format json`.
|
|
8
|
+
*
|
|
9
|
+
* With no message argument `opencode run` reads the message from stdin. That
|
|
10
|
+
* is also the only safe way to pass it: a message given as arguments is
|
|
11
|
+
* re-joined with quotes added around any that contain a space, so the agent
|
|
12
|
+
* received `"Fix the bug"`, quotes and all. Each `step_finish` event carries
|
|
13
|
+
* that step's tokens and cost, which are summed. OpenCode prices the step
|
|
14
|
+
* itself from its model table — that figure is what is recorded. The stream
|
|
15
|
+
* does not name the model.
|
|
16
|
+
*/
|
|
5
17
|
|
|
6
|
-
/** Adapter name */
|
|
7
18
|
export const name = 'opencode'
|
|
8
19
|
|
|
9
20
|
export function supportsSessionContinuity(): boolean { return false }
|
|
10
|
-
|
|
11
|
-
* Check if the `opencode` CLI is available on the system PATH.
|
|
12
|
-
*/
|
|
21
|
+
|
|
13
22
|
export async function isAvailable(): Promise<boolean> {
|
|
14
|
-
return
|
|
15
|
-
const proc = spawn('which', ['opencode'], { stdio: 'pipe' })
|
|
16
|
-
proc.on('close', (code) => resolve(code === 0))
|
|
17
|
-
proc.on('error', () => resolve(false))
|
|
18
|
-
})
|
|
23
|
+
return commandExists('opencode')
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
prompt += `\n\nOnly modify files under: ${task.files.join(', ')}`
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const args = ['run', prompt, '--format', 'json']
|
|
26
|
+
export interface ParsedOpenCode {
|
|
27
|
+
/** The text of the last step that produced any: the agent's final answer. */
|
|
28
|
+
text?: string
|
|
29
|
+
usage?: TokenUsage
|
|
30
|
+
costUsd?: number
|
|
31
|
+
errors: string[]
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
const mcpJsonPath = join(cwd, 'mcp.json')
|
|
35
|
-
let wroteJson = false
|
|
34
|
+
const num = (v: unknown): number | undefined => (typeof v === 'number' && Number.isFinite(v) ? v : undefined)
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Read `opencode run --format json` output.
|
|
38
|
+
*
|
|
39
|
+
* Step tokens are per step, so they add up. OpenCode's `input` excludes the
|
|
40
|
+
* cache reads and writes, and its `output` excludes reasoning; both are added
|
|
41
|
+
* back so `prompt_tokens` and `completion_tokens` count everything.
|
|
42
|
+
*/
|
|
43
|
+
export function parseOpenCodeOutput(stdout: string): ParsedOpenCode {
|
|
44
|
+
const parsed: ParsedOpenCode = { errors: [] }
|
|
45
|
+
let stepText: string[] = []
|
|
46
|
+
let lastText: string[] = []
|
|
47
|
+
let prompt = 0
|
|
48
|
+
let completion = 0
|
|
49
|
+
let cacheRead = 0
|
|
50
|
+
let cacheWrite = 0
|
|
51
|
+
let cost = 0
|
|
52
|
+
let sawTokens = false
|
|
53
|
+
let sawCost = false
|
|
54
|
+
|
|
55
|
+
for (const raw of stdout.split('\n')) {
|
|
56
|
+
const line = raw.trim()
|
|
57
|
+
if (!line.startsWith('{')) continue
|
|
58
|
+
let ev: Record<string, unknown>
|
|
59
|
+
try {
|
|
60
|
+
ev = JSON.parse(line) as Record<string, unknown>
|
|
61
|
+
} catch {
|
|
62
|
+
continue
|
|
46
63
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
stdout += chunk.toString()
|
|
69
|
-
if (options.verbose) {
|
|
70
|
-
process.stdout.write(chunk)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
proc.stderr.on('data', (chunk: Buffer) => {
|
|
75
|
-
stderr += chunk.toString()
|
|
76
|
-
if (options.verbose) {
|
|
77
|
-
process.stderr.write(chunk)
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
proc.on('close', (code) => {
|
|
82
|
-
let textOutput = [stdout, stderr].filter(Boolean).join('\n')
|
|
83
|
-
let usage: TokenUsage | undefined
|
|
84
|
-
try {
|
|
85
|
-
// Try single JSON object first (claude CLI)
|
|
86
|
-
const parsed = JSON.parse(stdout) as Record<string, unknown>
|
|
87
|
-
if (typeof parsed.result === 'string') {
|
|
88
|
-
textOutput = parsed.result
|
|
89
|
-
}
|
|
90
|
-
const u = parsed?.usage as Record<string, number> | undefined
|
|
91
|
-
if (u) {
|
|
92
|
-
const promptTokens = (u.input_tokens ?? u.prompt_tokens) as number | undefined
|
|
93
|
-
const completionTokens = (u.output_tokens ?? u.completion_tokens) as number | undefined
|
|
94
|
-
const total = ((promptTokens ?? 0) + (completionTokens ?? 0)) || undefined
|
|
95
|
-
usage = { prompt_tokens: promptTokens, completion_tokens: completionTokens, total_tokens: total }
|
|
64
|
+
const part = ev.part as Record<string, unknown> | undefined
|
|
65
|
+
switch (ev.type) {
|
|
66
|
+
case 'step_start':
|
|
67
|
+
stepText = []
|
|
68
|
+
break
|
|
69
|
+
case 'text':
|
|
70
|
+
if (typeof part?.text === 'string' && part.text) stepText.push(part.text)
|
|
71
|
+
break
|
|
72
|
+
case 'step_finish': {
|
|
73
|
+
if (stepText.length) lastText = stepText
|
|
74
|
+
stepText = []
|
|
75
|
+
const tokens = part?.tokens as Record<string, unknown> | undefined
|
|
76
|
+
if (tokens) {
|
|
77
|
+
const cache = (tokens.cache ?? {}) as Record<string, unknown>
|
|
78
|
+
const read = num(cache.read) ?? 0
|
|
79
|
+
const write = num(cache.write) ?? 0
|
|
80
|
+
prompt += (num(tokens.input) ?? 0) + read + write
|
|
81
|
+
completion += (num(tokens.output) ?? 0) + (num(tokens.reasoning) ?? 0)
|
|
82
|
+
cacheRead += read
|
|
83
|
+
cacheWrite += write
|
|
84
|
+
sawTokens = true
|
|
96
85
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// response and a separate {"type":"result"} line for session metadata.
|
|
102
|
-
const lines = stdout.split('\n')
|
|
103
|
-
let lastAssistantContent: string | undefined
|
|
104
|
-
for (const rawLine of lines) {
|
|
105
|
-
const line = rawLine.trim()
|
|
106
|
-
if (!line) continue
|
|
107
|
-
try {
|
|
108
|
-
const parsed = JSON.parse(line) as Record<string, unknown>
|
|
109
|
-
// Claude-style: result text in the result line
|
|
110
|
-
if (typeof parsed.result === 'string' && parsed.result) {
|
|
111
|
-
textOutput = parsed.result
|
|
112
|
-
const u = parsed?.usage as Record<string, number> | undefined
|
|
113
|
-
if (u) {
|
|
114
|
-
const promptTokens = (u.input_tokens ?? u.prompt_tokens) as number | undefined
|
|
115
|
-
const completionTokens = (u.output_tokens ?? u.completion_tokens) as number | undefined
|
|
116
|
-
const total = ((promptTokens ?? 0) + (completionTokens ?? 0)) || undefined
|
|
117
|
-
usage = { prompt_tokens: promptTokens, completion_tokens: completionTokens, total_tokens: total }
|
|
118
|
-
}
|
|
119
|
-
lastAssistantContent = undefined // prefer explicit result field
|
|
120
|
-
break
|
|
121
|
-
}
|
|
122
|
-
// Copilot-style: AI response in assistant.message events
|
|
123
|
-
if (parsed.type === 'assistant.message') {
|
|
124
|
-
const data = parsed.data as Record<string, unknown> | undefined
|
|
125
|
-
if (data && typeof data.content === 'string') {
|
|
126
|
-
lastAssistantContent = data.content
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
} catch { /* skip non-JSON lines */ }
|
|
130
|
-
}
|
|
131
|
-
if (lastAssistantContent !== undefined) {
|
|
132
|
-
textOutput = lastAssistantContent
|
|
86
|
+
const c = num(part?.cost)
|
|
87
|
+
if (c !== undefined) {
|
|
88
|
+
cost += c
|
|
89
|
+
sawCost = true
|
|
133
90
|
}
|
|
91
|
+
break
|
|
92
|
+
}
|
|
93
|
+
case 'error': {
|
|
94
|
+
const err = ev.error as Record<string, unknown> | undefined
|
|
95
|
+
const data = err?.data as Record<string, unknown> | undefined
|
|
96
|
+
const message = data?.message ?? err?.message ?? err?.name
|
|
97
|
+
if (typeof message === 'string') parsed.errors.push(message)
|
|
98
|
+
break
|
|
134
99
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (stepText.length) lastText = stepText
|
|
103
|
+
if (lastText.length) parsed.text = lastText.join('\n')
|
|
104
|
+
if (sawTokens) {
|
|
105
|
+
parsed.usage = {
|
|
106
|
+
prompt_tokens: prompt,
|
|
107
|
+
completion_tokens: completion,
|
|
108
|
+
total_tokens: prompt + completion,
|
|
109
|
+
cache_read_tokens: cacheRead,
|
|
110
|
+
cache_write_tokens: cacheWrite,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// OpenCode reports 0 when it has no price for the model; that is "unknown", not free.
|
|
114
|
+
if (sawCost && cost > 0) parsed.costUsd = cost
|
|
115
|
+
return parsed
|
|
116
|
+
}
|
|
142
117
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
118
|
+
/** OpenCode's permission JSON, merged over any the user already set in the environment. */
|
|
119
|
+
function permissionEnv(permission: Record<string, string>): Record<string, string> {
|
|
120
|
+
let existing: Record<string, unknown> = {}
|
|
121
|
+
try {
|
|
122
|
+
const parsed = JSON.parse(process.env.OPENCODE_PERMISSION ?? '{}') as unknown
|
|
123
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) existing = parsed as Record<string, unknown>
|
|
124
|
+
} catch { /* not JSON: OpenCode ignores it too */ }
|
|
125
|
+
return { OPENCODE_PERMISSION: JSON.stringify({ ...existing, ...permission }) }
|
|
126
|
+
}
|
|
150
127
|
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
export async function execute(task: Task, options: ExecuteOptions = {}): Promise<ExecuteResult> {
|
|
129
|
+
const permission = opencodePermission(options.permissionMode)
|
|
130
|
+
const args = ['run', '--format', 'json', ...permission.args]
|
|
131
|
+
if (options.model) args.push('--model', options.model) // provider/model
|
|
132
|
+
|
|
133
|
+
const exit = await runAgent(task, {
|
|
134
|
+
command: 'opencode',
|
|
135
|
+
args,
|
|
136
|
+
input: promptOf(task),
|
|
137
|
+
cwd: options.cwd ?? process.cwd(),
|
|
138
|
+
...(permission.permission ? { env: permissionEnv(permission.permission) } : {}),
|
|
139
|
+
verbose: options.verbose,
|
|
153
140
|
})
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
141
|
+
|
|
142
|
+
const parsed = parseOpenCodeOutput(exit.stdout)
|
|
143
|
+
const interrupted = interruptedMessage('opencode', task, exit)
|
|
144
|
+
// An `error` event is a session error or a rejected prompt: the run failed, whatever the exit code says.
|
|
145
|
+
const success = !interrupted && exit.code === 0 && parsed.errors.length === 0
|
|
146
|
+
const output = success
|
|
147
|
+
? parsed.text ?? exit.stdout
|
|
148
|
+
: [interrupted, parsed.text, ...parsed.errors, exit.stderr.trim()].filter(Boolean).join('\n')
|
|
149
|
+
return {
|
|
150
|
+
success,
|
|
151
|
+
output: output.slice(0, OUTPUT_LIMIT),
|
|
152
|
+
exitCode: exit.code,
|
|
153
|
+
...(exit.timedOut ? { _timedOut: true } : {}),
|
|
154
|
+
...(parsed.usage ? { usage: parsed.usage } : {}),
|
|
155
|
+
...(parsed.costUsd !== undefined ? { costUsd: parsed.costUsd } : {}),
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
|
|
161
|
-
/**
|
|
162
|
-
* Kill the process associated with a task (used by timeout enforcement).
|
|
163
|
-
*/
|
|
164
159
|
export function kill(task: Task): void {
|
|
165
|
-
|
|
166
|
-
task._process.kill('SIGTERM')
|
|
167
|
-
setTimeout(() => {
|
|
168
|
-
if (task._process && !task._process.killed) {
|
|
169
|
-
task._process.kill('SIGKILL')
|
|
170
|
-
}
|
|
171
|
-
}, 5000)
|
|
172
|
-
}
|
|
160
|
+
stopTask(task)
|
|
173
161
|
}
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
* The defect: `--permission-mode` was validated against the enum, stored on the
|
|
5
5
|
* spec, threaded through four call sites in the engine, handed to the adapter —
|
|
6
6
|
* and read by one of the five. A run told to hold its workers to `plan` wrote
|
|
7
|
-
* files anyway, on `codex`, `cursor`, `opencode` and `copilot` alike.
|
|
7
|
+
* files anyway, on `codex`, `cursor`, `opencode` and `copilot` alike. Each CLI
|
|
8
|
+
* now has a mapping; these tests pin what each mode becomes.
|
|
8
9
|
*/
|
|
9
10
|
import { describe, it, expect } from 'vitest'
|
|
10
11
|
import {
|
|
11
12
|
ADAPTER_PERMISSION_MODES,
|
|
13
|
+
meaningOf,
|
|
12
14
|
codexSandboxFor,
|
|
15
|
+
copilotPermissionArgs,
|
|
16
|
+
opencodePermission,
|
|
17
|
+
cursorPermissionArgs,
|
|
13
18
|
supportsPermissionMode,
|
|
14
19
|
permissionModeError,
|
|
15
20
|
} from './permission-modes.js'
|
|
@@ -30,24 +35,28 @@ describe('the capability table', () => {
|
|
|
30
35
|
}
|
|
31
36
|
})
|
|
32
37
|
|
|
33
|
-
it('lets
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
it('lets every runtime run read-only, so the planner can use any of them', () => {
|
|
39
|
+
for (const name of ['claude', 'codex', 'cursor', 'opencode', 'copilot']) {
|
|
40
|
+
expect(supportsPermissionMode(name, 'plan'), name).toBe(true)
|
|
41
|
+
}
|
|
36
42
|
})
|
|
43
|
+
})
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
describe('meaningOf', () => {
|
|
46
|
+
it('reduces the modes to read-only, edits and everything', () => {
|
|
47
|
+
expect(meaningOf('plan')).toBe('read-only')
|
|
48
|
+
// In a headless run `default` can only refuse what it would have asked about.
|
|
49
|
+
expect(meaningOf('default')).toBe('read-only')
|
|
50
|
+
expect(meaningOf(undefined)).toBe('edits')
|
|
51
|
+
expect(meaningOf('acceptEdits')).toBe('edits')
|
|
52
|
+
expect(meaningOf('auto')).toBe('edits')
|
|
53
|
+
expect(meaningOf('dontAsk')).toBe('edits')
|
|
54
|
+
expect(meaningOf('bypassPermissions')).toBe('everything')
|
|
44
55
|
})
|
|
45
56
|
})
|
|
46
57
|
|
|
47
58
|
describe('codexSandboxFor', () => {
|
|
48
59
|
it('leaves the default run exactly as it was', () => {
|
|
49
|
-
// acceptEdits is the default mode, and workspace-write is what the adapter
|
|
50
|
-
// has always passed. This fix must not change an unconfigured run.
|
|
51
60
|
expect(codexSandboxFor(undefined)).toBe('workspace-write')
|
|
52
61
|
expect(codexSandboxFor('acceptEdits')).toBe('workspace-write')
|
|
53
62
|
})
|
|
@@ -60,36 +69,57 @@ describe('codexSandboxFor', () => {
|
|
|
60
69
|
it('widens the sandbox only when explicitly asked', () => {
|
|
61
70
|
expect(codexSandboxFor('bypassPermissions')).toBe('danger-full-access')
|
|
62
71
|
})
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe('copilotPermissionArgs', () => {
|
|
75
|
+
it('denies writes and commands for read-only — denials beat any allow, even COPILOT_ALLOW_ALL', () => {
|
|
76
|
+
expect(copilotPermissionArgs('plan')).toEqual(['--deny-tool=write', '--deny-tool=shell'])
|
|
77
|
+
})
|
|
63
78
|
|
|
64
|
-
it('
|
|
65
|
-
expect(
|
|
66
|
-
expect(
|
|
79
|
+
it('allows file edits by default, and no longer approves everything', () => {
|
|
80
|
+
expect(copilotPermissionArgs(undefined)).toEqual(['--allow-tool=write'])
|
|
81
|
+
expect(copilotPermissionArgs('acceptEdits')).not.toContain('--allow-all')
|
|
67
82
|
})
|
|
68
83
|
|
|
69
|
-
it('
|
|
70
|
-
|
|
71
|
-
// hardcoded and the mode never read.
|
|
72
|
-
expect(codexSandboxFor('plan')).not.toBe(codexSandboxFor('bypassPermissions'))
|
|
84
|
+
it('allows everything only for bypassPermissions', () => {
|
|
85
|
+
expect(copilotPermissionArgs('bypassPermissions')).toEqual(['--allow-all'])
|
|
73
86
|
})
|
|
74
87
|
})
|
|
75
88
|
|
|
76
|
-
describe('
|
|
77
|
-
it('
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
describe('opencodePermission', () => {
|
|
90
|
+
it('denies the edit and bash tools for read-only', () => {
|
|
91
|
+
expect(opencodePermission('plan')).toEqual({ args: [], permission: { edit: 'deny', bash: 'deny' } })
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('keeps `opencode run` as it is for edits, and approves questions only for everything', () => {
|
|
95
|
+
expect(opencodePermission('acceptEdits')).toEqual({ args: [] })
|
|
96
|
+
expect(opencodePermission('bypassPermissions')).toEqual({ args: ['--auto'] })
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('cursorPermissionArgs', () => {
|
|
101
|
+
it('applies edits only with --force', () => {
|
|
102
|
+
expect(cursorPermissionArgs('acceptEdits')).toEqual(['--force'])
|
|
103
|
+
expect(cursorPermissionArgs('plan')).not.toContain('--force')
|
|
82
104
|
})
|
|
83
105
|
|
|
84
|
-
it('
|
|
85
|
-
expect(
|
|
86
|
-
expect(supportsPermissionMode('opencode', 'default')).toBe(false)
|
|
87
|
-
expect(supportsPermissionMode('copilot', 'bypassPermissions')).toBe(false)
|
|
106
|
+
it('trusts the worktree and asks only questions for read-only', () => {
|
|
107
|
+
expect(cursorPermissionArgs('plan')).toEqual(['--trust', '--mode', 'ask'])
|
|
88
108
|
})
|
|
89
109
|
|
|
90
|
-
it('
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
110
|
+
it('turns the sandbox off only for bypassPermissions', () => {
|
|
111
|
+
expect(cursorPermissionArgs('bypassPermissions')).toEqual(['--force', '--sandbox', 'disabled', '--approve-mcps'])
|
|
112
|
+
expect(cursorPermissionArgs('acceptEdits')).not.toContain('--sandbox')
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
describe('supportsPermissionMode', () => {
|
|
117
|
+
it('accepts every mode on every adapter that maps them all', () => {
|
|
118
|
+
for (const mode of PERMISSION_MODES) {
|
|
119
|
+
for (const name of ['claude', 'codex', 'cursor', 'opencode', 'copilot']) {
|
|
120
|
+
expect(supportsPermissionMode(name, mode)).toBe(true)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
93
123
|
})
|
|
94
124
|
|
|
95
125
|
it('does not second-guess an adapter it has never heard of', () => {
|
|
@@ -100,15 +130,7 @@ describe('supportsPermissionMode', () => {
|
|
|
100
130
|
describe('permissionModeError', () => {
|
|
101
131
|
it('is null when the mode can be honoured', () => {
|
|
102
132
|
expect(permissionModeError('claude', 'plan')).toBeNull()
|
|
133
|
+
expect(permissionModeError('cursor', 'plan')).toBeNull()
|
|
103
134
|
expect(permissionModeError('codex', 'bypassPermissions')).toBeNull()
|
|
104
135
|
})
|
|
105
|
-
|
|
106
|
-
it('names the adapter, the mode, and a way forward', () => {
|
|
107
|
-
const msg = permissionModeError('cursor', 'plan')!
|
|
108
|
-
expect(msg).toContain('cursor')
|
|
109
|
-
expect(msg).toContain('plan')
|
|
110
|
-
expect(msg).toContain('acceptEdits')
|
|
111
|
-
// A refusal with no alternative is just a wall.
|
|
112
|
-
expect(msg).toMatch(/claude|codex/)
|
|
113
|
-
})
|
|
114
136
|
})
|
|
@@ -2,68 +2,149 @@ import { PERMISSION_MODES } from '../../convoy/spec-types.js'
|
|
|
2
2
|
import type { PermissionMode } from '../../convoy/spec-types.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* What each permission mode means on each agent CLI.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* then read by exactly one of the five. On `codex`, `cursor`, `opencode` and
|
|
10
|
-
* `copilot` it was accepted in full and dropped, so a run asked to hold a worker
|
|
11
|
-
* to `plan` went ahead and wrote files, saying nothing.
|
|
7
|
+
* The modes are Claude Code's. Every other CLI spells authority differently,
|
|
8
|
+
* and this file is the one place that translates. Three meanings matter:
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
10
|
+
* - **read-only** (`plan`, and `default`, which in a headless run can only
|
|
11
|
+
* refuse what it would have asked about): the agent reads and answers. It
|
|
12
|
+
* edits no file, and runs no command beyond what the CLI itself treats as
|
|
13
|
+
* read-only. The planner runs its agents this way.
|
|
14
|
+
* - **edits** (`acceptEdits` — the default — and `auto`, `dontAsk`): the agent
|
|
15
|
+
* edits files in its working directory without asking. Whether it may also
|
|
16
|
+
* run commands is each CLI's own rule, noted per CLI below.
|
|
17
|
+
* - **everything** (`bypassPermissions`): no prompts and no sandbox.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* A mode an adapter cannot express is refused before the run starts, never
|
|
20
|
+
* dropped: a run told to stay read-only that writes anyway is the worst
|
|
21
|
+
* outcome there is.
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
/** Every mode, for an adapter that maps the whole enum. */
|
|
23
25
|
const ALL: readonly PermissionMode[] = PERMISSION_MODES
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
type Meaning = 'read-only' | 'edits' | 'everything'
|
|
28
|
+
|
|
29
|
+
/** The three meanings the modes reduce to on a CLI that is not Claude Code. */
|
|
30
|
+
export function meaningOf(mode: PermissionMode | undefined): Meaning {
|
|
31
|
+
switch (mode) {
|
|
32
|
+
case 'plan':
|
|
33
|
+
case 'default':
|
|
34
|
+
return 'read-only'
|
|
35
|
+
case 'bypassPermissions':
|
|
36
|
+
return 'everything'
|
|
37
|
+
// acceptEdits, auto, dontAsk, and no mode at all.
|
|
38
|
+
default:
|
|
39
|
+
return 'edits'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
35
42
|
|
|
36
43
|
export const ADAPTER_PERMISSION_MODES: Record<string, readonly PermissionMode[]> = {
|
|
37
|
-
// Passed
|
|
44
|
+
// Passed through as `claude -p --permission-mode <mode>`, except read-only
|
|
45
|
+
// (`plan`), which is default mode with Edit, Write and NotebookEdit denied —
|
|
46
|
+
// see `claudePermissionArgs`. A headless run refuses whatever it would have
|
|
47
|
+
// asked about. `acceptEdits` allows edits and simple filesystem commands
|
|
48
|
+
// (mkdir, mv, cp …) in the working directory.
|
|
38
49
|
claude: ALL,
|
|
39
|
-
//
|
|
50
|
+
// `codex exec` never asks for approval; the sandbox is the whole policy.
|
|
51
|
+
// See `codexSandboxFor`. Edits mode can run commands, inside the sandbox.
|
|
40
52
|
codex: ALL,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
copilot:
|
|
53
|
+
// `copilot` tool rules. See `copilotPermissionArgs`. Edits mode runs only
|
|
54
|
+
// read-only commands.
|
|
55
|
+
copilot: ALL,
|
|
56
|
+
// `opencode run` allows edits and commands by default and rejects what it
|
|
57
|
+
// would ask about. See `opencodePermission`.
|
|
58
|
+
opencode: ALL,
|
|
59
|
+
// `cursor-agent -p` applies edits only with `--force`, which also allows
|
|
60
|
+
// commands. See `cursorPermissionArgs`.
|
|
61
|
+
cursor: ALL,
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
/**
|
|
47
|
-
* The sandbox `codex exec -s`
|
|
65
|
+
* The sandbox `codex exec -s` runs under.
|
|
48
66
|
*
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
*
|
|
67
|
+
* `codex exec` always runs with approval policy "never" — it has no `-a` of
|
|
68
|
+
* its own, and the `-a never` this adapter used to pass before `exec` was
|
|
69
|
+
* parsed as an option of the interactive CLI and ignored — so the sandbox is
|
|
70
|
+
* all there is. `read-only` writes nothing and runs commands read-only;
|
|
71
|
+
* `workspace-write` writes inside the working directory, with no network;
|
|
72
|
+
* `danger-full-access` is unrestricted.
|
|
52
73
|
*/
|
|
53
74
|
export function codexSandboxFor(mode: PermissionMode | undefined): string {
|
|
54
|
-
switch (mode) {
|
|
55
|
-
|
|
56
|
-
case 'default':
|
|
57
|
-
case 'plan':
|
|
75
|
+
switch (meaningOf(mode)) {
|
|
76
|
+
case 'read-only':
|
|
58
77
|
return 'read-only'
|
|
59
|
-
case '
|
|
78
|
+
case 'everything':
|
|
60
79
|
return 'danger-full-access'
|
|
61
|
-
// acceptEdits, auto, dontAsk, and no mode at all.
|
|
62
80
|
default:
|
|
63
81
|
return 'workspace-write'
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Copilot CLI tool rules for a headless run.
|
|
87
|
+
*
|
|
88
|
+
* In prompt mode Copilot cannot ask, so whatever no rule allows is refused;
|
|
89
|
+
* reads inside the working directory, and read-only shell commands, need no
|
|
90
|
+
* rule. `write` is every file-editing tool and `shell` every command. Deny
|
|
91
|
+
* rules beat allow rules — even `--allow-all` and `COPILOT_ALLOW_ALL` in the
|
|
92
|
+
* environment — so read-only is stated as denials rather than left to the
|
|
93
|
+
* absence of an allow. Edits mode allows `write` and leaves commands to that
|
|
94
|
+
* default, which is close to Claude Code's `acceptEdits`.
|
|
95
|
+
*/
|
|
96
|
+
export function copilotPermissionArgs(mode: PermissionMode | undefined): string[] {
|
|
97
|
+
switch (meaningOf(mode)) {
|
|
98
|
+
case 'read-only':
|
|
99
|
+
return ['--deny-tool=write', '--deny-tool=shell']
|
|
100
|
+
case 'everything':
|
|
101
|
+
return ['--allow-all']
|
|
102
|
+
default:
|
|
103
|
+
return ['--allow-tool=write']
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* OpenCode's permission settings for a headless `opencode run`.
|
|
109
|
+
*
|
|
110
|
+
* `run` already allows edits and commands, and rejects whatever would need a
|
|
111
|
+
* question (paths outside the project, a detected loop). Read-only denies the
|
|
112
|
+
* edit and bash tools through `OPENCODE_PERMISSION` — the built-in `plan`
|
|
113
|
+
* agent alone still runs shell commands. `--auto` approves the questions too.
|
|
114
|
+
*/
|
|
115
|
+
export function opencodePermission(mode: PermissionMode | undefined): { args: string[]; permission?: Record<string, string> } {
|
|
116
|
+
switch (meaningOf(mode)) {
|
|
117
|
+
case 'read-only':
|
|
118
|
+
return { args: [], permission: { edit: 'deny', bash: 'deny' } }
|
|
119
|
+
case 'everything':
|
|
120
|
+
return { args: ['--auto'] }
|
|
121
|
+
default:
|
|
122
|
+
return { args: [] }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Cursor Agent flags for a headless `cursor-agent -p`.
|
|
128
|
+
*
|
|
129
|
+
* In print mode the agent proposes changes and applies none unless `--force`
|
|
130
|
+
* is given, and `--mode ask` keeps it to read-only questions and answers. A
|
|
131
|
+
* headless run in a workspace Cursor has not been told to trust — every new
|
|
132
|
+
* worktree — exits at once, so read-only passes `--trust`; `--force` implies
|
|
133
|
+
* it. Cursor has no grant narrower than `--force`, which also lets it run
|
|
134
|
+
* commands. Everything also turns Cursor's sandbox off and approves the
|
|
135
|
+
* project's MCP servers.
|
|
136
|
+
*/
|
|
137
|
+
export function cursorPermissionArgs(mode: PermissionMode | undefined): string[] {
|
|
138
|
+
switch (meaningOf(mode)) {
|
|
139
|
+
case 'read-only':
|
|
140
|
+
return ['--trust', '--mode', 'ask']
|
|
141
|
+
case 'everything':
|
|
142
|
+
return ['--force', '--sandbox', 'disabled', '--approve-mcps']
|
|
143
|
+
default:
|
|
144
|
+
return ['--force']
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
67
148
|
/** True when `adapter` can honour `mode`. Unknown adapters are not second-guessed. */
|
|
68
149
|
export function supportsPermissionMode(adapter: string, mode: PermissionMode): boolean {
|
|
69
150
|
const supported = ADAPTER_PERMISSION_MODES[adapter]
|