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,245 +1,136 @@
|
|
|
1
|
-
import { describe, it, expect,
|
|
2
|
-
import {
|
|
3
|
-
import { tmpdir } from 'node:os'
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import { mkdirSync, symlinkSync, renameSync } from 'node:fs'
|
|
4
3
|
import { join } from 'node:path'
|
|
5
|
-
import { EventEmitter } from 'node:events'
|
|
6
4
|
import type { Task } from '../../convoy/spec-types.js'
|
|
5
|
+
import { installStubCli, type StubCli } from './stub-cli.test-helper.js'
|
|
6
|
+
import { execute, isAvailable, cursorCommand, parseCursorOutput } from './cursor.js'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const posix = process.platform !== 'win32'
|
|
9
9
|
|
|
10
|
-
function makeTask(): Task {
|
|
10
|
+
function makeTask(overrides: Partial<Task> = {}): Task {
|
|
11
11
|
return {
|
|
12
|
-
id: 'test-task',
|
|
13
|
-
|
|
14
|
-
prompt: 'Do something',
|
|
15
|
-
files: [],
|
|
16
|
-
timeout: '5m',
|
|
17
|
-
depends_on: [],
|
|
18
|
-
description: 'test task',
|
|
19
|
-
max_retries: 0,
|
|
20
|
-
} as unknown as Task
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function makeMockProc(exitCode = 0, stdoutData = '{"result":"ok"}') {
|
|
24
|
-
const proc = new EventEmitter() as EventEmitter & {
|
|
25
|
-
stdout: EventEmitter
|
|
26
|
-
stderr: EventEmitter
|
|
27
|
-
killed: boolean
|
|
28
|
-
kill: ReturnType<typeof vi.fn>
|
|
12
|
+
id: 'test-task', agent: 'developer', prompt: 'Do something', files: [], timeout: '5m',
|
|
13
|
+
depends_on: [], description: 'test task', max_retries: 0, ...overrides,
|
|
29
14
|
}
|
|
30
|
-
proc.stdout = new EventEmitter()
|
|
31
|
-
proc.stderr = new EventEmitter()
|
|
32
|
-
proc.killed = false
|
|
33
|
-
proc.kill = vi.fn()
|
|
34
|
-
process.nextTick(() => {
|
|
35
|
-
if (stdoutData) proc.stdout.emit('data', Buffer.from(stdoutData))
|
|
36
|
-
proc.emit('close', exitCode)
|
|
37
|
-
})
|
|
38
|
-
return proc
|
|
39
15
|
}
|
|
40
16
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
describe('cursor adapter — MCP support', () => {
|
|
44
|
-
let tmpDir: string
|
|
45
|
-
let mockSpawn: ReturnType<typeof vi.fn>
|
|
46
|
-
|
|
47
|
-
beforeEach(() => {
|
|
48
|
-
vi.resetModules()
|
|
49
|
-
tmpDir = realpathSync(mkdtempSync(join(tmpdir(), 'cursor-test-')))
|
|
50
|
-
|
|
51
|
-
mockSpawn = vi.fn().mockImplementation((cmd: string) => {
|
|
52
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
53
|
-
return makeMockProc(0, '{"result":"ok"}')
|
|
54
|
-
})
|
|
55
|
-
vi.doMock('node:child_process', () => ({ spawn: mockSpawn }))
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
afterEach(() => {
|
|
59
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
60
|
-
vi.restoreAllMocks()
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('writes mcp.json to cwd with correct format when mcpServers provided', async () => {
|
|
64
|
-
let capturedContent: string | null = null
|
|
65
|
-
mockSpawn.mockImplementation((cmd: string) => {
|
|
66
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
67
|
-
const mcpPath = join(tmpDir, 'mcp.json')
|
|
68
|
-
if (existsSync(mcpPath)) {
|
|
69
|
-
capturedContent = readFileSync(mcpPath, 'utf8')
|
|
70
|
-
}
|
|
71
|
-
return makeMockProc(0, '{}')
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const { execute } = await import('./cursor.js')
|
|
75
|
-
const mcpServers = [{ name: 'my-mcp', type: 'local', command: 'node', args: ['server.js'] }]
|
|
76
|
-
await execute(makeTask(), { mcpServers, cwd: tmpDir })
|
|
77
|
-
|
|
78
|
-
expect(capturedContent).not.toBeNull()
|
|
79
|
-
expect(JSON.parse(capturedContent!)).toEqual({
|
|
80
|
-
mcpServers: { 'my-mcp': { command: 'node', args: ['server.js'] } },
|
|
81
|
-
})
|
|
82
|
-
})
|
|
17
|
+
/** The terminal object from Cursor's output-format docs, verbatim. */
|
|
18
|
+
const DOCS_RESULT = '{"type":"result","subtype":"success","duration_ms":5234,"duration_api_ms":5234,"is_error":false,"result":"I\'ll read the README.md fileBased on the README, I\'ll create a summaryDone! I\'ve created the summary in summary.txt","session_id":"c6b62c6f-7ead-4fd6-9922-e952131177ff","request_id":"10e11780-df2f-45dc-a1ff-4540af32e9c0"}'
|
|
83
19
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})
|
|
91
|
-
const { execute } = await import('./cursor.js')
|
|
92
|
-
const mcpServers = [{ name: 'my-mcp', type: 'local', command: 'node', args: ['server.js'] }]
|
|
93
|
-
await execute(makeTask(), { mcpServers, cwd: tmpDir })
|
|
94
|
-
|
|
95
|
-
const idx = capturedArgs.indexOf('--mcp-config')
|
|
96
|
-
expect(idx).toBeGreaterThanOrEqual(0)
|
|
97
|
-
expect(capturedArgs[idx + 1]).toBe(join(tmpDir, 'mcp.json'))
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('passes --approve-mcps when mcp_approve_all is true', async () => {
|
|
101
|
-
const capturedArgs: string[] = []
|
|
102
|
-
mockSpawn.mockImplementation((cmd: string, args: string[]) => {
|
|
103
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
104
|
-
capturedArgs.push(...args)
|
|
105
|
-
return makeMockProc(0, '{}')
|
|
106
|
-
})
|
|
107
|
-
const { execute } = await import('./cursor.js')
|
|
108
|
-
await execute(makeTask(), { mcp_approve_all: true, cwd: tmpDir })
|
|
109
|
-
expect(capturedArgs).toContain('--approve-mcps')
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it('cleans up mcp.json after successful execution', async () => {
|
|
113
|
-
const { execute } = await import('./cursor.js')
|
|
114
|
-
const mcpServers = [{ name: 'my-mcp', type: 'local', command: 'node', args: ['server.js'] }]
|
|
115
|
-
await execute(makeTask(), { mcpServers, cwd: tmpDir })
|
|
116
|
-
expect(existsSync(join(tmpDir, 'mcp.json'))).toBe(false)
|
|
117
|
-
})
|
|
20
|
+
/** The same, as recent releases print it: with `usage` summed over turns, input excluding the cache. */
|
|
21
|
+
const RESULT_WITH_USAGE = JSON.stringify({
|
|
22
|
+
type: 'result', subtype: 'success', is_error: false, duration_ms: 5234, duration_api_ms: 5234,
|
|
23
|
+
result: 'Done.', session_id: 'c6b62c6f-7ead-4fd6-9922-e952131177ff', request_id: '10e11780-df2f-45dc-a1ff-4540af32e9c0',
|
|
24
|
+
usage: { inputTokens: 812, outputTokens: 240, cacheReadTokens: 15360, cacheWriteTokens: 1024 },
|
|
25
|
+
})
|
|
118
26
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
27
|
+
describe('parseCursorOutput', () => {
|
|
28
|
+
it('reads the result text, and no usage when there is none', () => {
|
|
29
|
+
const parsed = parseCursorOutput(DOCS_RESULT)
|
|
30
|
+
expect(parsed.text).toContain('created the summary in summary.txt')
|
|
31
|
+
expect(parsed.usage).toBeUndefined()
|
|
32
|
+
expect(parsed.isError).toBeUndefined()
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('reads usage when the result carries it', () => {
|
|
36
|
+
expect(parseCursorOutput(RESULT_WITH_USAGE).usage).toEqual({
|
|
37
|
+
prompt_tokens: 812 + 15360 + 1024,
|
|
38
|
+
completion_tokens: 240,
|
|
39
|
+
total_tokens: 812 + 15360 + 1024 + 240,
|
|
40
|
+
cache_read_tokens: 15360,
|
|
41
|
+
cache_write_tokens: 1024,
|
|
123
42
|
})
|
|
124
|
-
const { execute } = await import('./cursor.js')
|
|
125
|
-
const mcpServers = [{ name: 'err-mcp', type: 'local', command: 'node', args: [] }]
|
|
126
|
-
await execute(makeTask(), { mcpServers, cwd: tmpDir })
|
|
127
|
-
expect(existsSync(join(tmpDir, 'mcp.json'))).toBe(false)
|
|
128
43
|
})
|
|
129
44
|
|
|
130
|
-
it('
|
|
131
|
-
const {
|
|
132
|
-
|
|
133
|
-
expect(existsSync(join(tmpDir, 'mcp.json'))).toBe(false)
|
|
45
|
+
it('finds the result line in a stream-json transcript', () => {
|
|
46
|
+
const stream = '{"type":"system","subtype":"init","model":"Claude 4 Sonnet"}\n' + DOCS_RESULT
|
|
47
|
+
expect(parseCursorOutput(stream).text).toContain('summary.txt')
|
|
134
48
|
})
|
|
49
|
+
})
|
|
135
50
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
140
|
-
capturedArgs.push(...args)
|
|
141
|
-
return makeMockProc(0, '{}')
|
|
142
|
-
})
|
|
143
|
-
const { execute } = await import('./cursor.js')
|
|
144
|
-
await execute(makeTask(), { cwd: tmpDir })
|
|
145
|
-
expect(capturedArgs).not.toContain('--approve-mcps')
|
|
146
|
-
})
|
|
51
|
+
describe.skipIf(!posix)('finding Cursor\'s agent CLI', () => {
|
|
52
|
+
let stub: StubCli
|
|
53
|
+
afterEach(() => stub.restore())
|
|
147
54
|
|
|
148
|
-
it('
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
152
|
-
capturedArgs.push(...args)
|
|
153
|
-
return makeMockProc(0, '{}')
|
|
154
|
-
})
|
|
155
|
-
const { execute } = await import('./cursor.js')
|
|
156
|
-
await execute(makeTask(), { mcp_approve_all: true, cwd: tmpDir })
|
|
157
|
-
expect(capturedArgs).toContain('--approve-mcps')
|
|
158
|
-
expect(existsSync(join(tmpDir, 'mcp.json'))).toBe(false)
|
|
55
|
+
it('prefers `cursor-agent`', () => {
|
|
56
|
+
stub = installStubCli('cursor-agent', 'agent')
|
|
57
|
+
expect(cursorCommand()).toBe('cursor-agent')
|
|
159
58
|
})
|
|
160
59
|
|
|
161
|
-
it('
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
})
|
|
166
|
-
const { execute } = await import('./cursor.js')
|
|
167
|
-
const result = await execute(makeTask(), { cwd: tmpDir })
|
|
168
|
-
expect(result.output).toBe('# My PRD\n\nThe actual content')
|
|
60
|
+
it('does not take an unrelated `agent` for Cursor', async () => {
|
|
61
|
+
stub = installStubCli('agent')
|
|
62
|
+
expect(cursorCommand()).toBeNull()
|
|
63
|
+
expect(await isAvailable()).toBe(false)
|
|
169
64
|
})
|
|
170
65
|
|
|
171
|
-
it('
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
})
|
|
181
|
-
const { execute } = await import('./cursor.js')
|
|
182
|
-
const result = await execute(makeTask(), { cwd: tmpDir })
|
|
183
|
-
expect(result.output).toBe('# My PRD\n\nThe actual markdown content')
|
|
184
|
-
expect(result.usage?.prompt_tokens).toBe(500)
|
|
185
|
-
expect(result.usage?.completion_tokens).toBe(1000)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
it('scans JSONL and finds result line among non-result lines', async () => {
|
|
189
|
-
const jsonl = [
|
|
190
|
-
'{"type":"progress","content":"thinking..."}',
|
|
191
|
-
'{"type":"tool_use","tool":"edit","args":{}}',
|
|
192
|
-
'{"type":"result","result":"# Final Content","usage":{"input_tokens":100,"output_tokens":200}}',
|
|
193
|
-
'{"type":"done"}',
|
|
194
|
-
].join('\n')
|
|
195
|
-
mockSpawn.mockImplementation((cmd: string) => {
|
|
196
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
197
|
-
return makeMockProc(0, jsonl)
|
|
198
|
-
})
|
|
199
|
-
const { execute } = await import('./cursor.js')
|
|
200
|
-
const result = await execute(makeTask(), { cwd: tmpDir })
|
|
201
|
-
expect(result.output).toBe('# Final Content')
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
it('extracts content from Copilot-style assistant.message JSONL', async () => {
|
|
205
|
-
const jsonl = [
|
|
206
|
-
'{"type":"session.tools_updated","data":{"model":"claude-sonnet-4.6"}}',
|
|
207
|
-
'{"type":"user.message","data":{"content":"Generate a PRD"}}',
|
|
208
|
-
'{"type":"assistant.message","data":{"content":"# My PRD\\n\\nThe generated content","outputTokens":50}}',
|
|
209
|
-
'{"type":"assistant.turn_end","data":{"turnId":"0"}}',
|
|
210
|
-
'{"type":"result","sessionId":"abc","exitCode":0,"usage":{"premiumRequests":1}}',
|
|
211
|
-
].join('\n')
|
|
212
|
-
mockSpawn.mockImplementation((cmd: string) => {
|
|
213
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
214
|
-
return makeMockProc(0, jsonl)
|
|
215
|
-
})
|
|
216
|
-
const { execute } = await import('./cursor.js')
|
|
217
|
-
const result = await execute(makeTask(), { cwd: tmpDir })
|
|
218
|
-
expect(result.output).toBe('# My PRD\n\nThe generated content')
|
|
66
|
+
it('accepts a lone `agent` that resolves into Cursor\'s install', async () => {
|
|
67
|
+
stub = installStubCli('agent')
|
|
68
|
+
// The installer's layout: ~/.local/bin/agent -> ~/.local/share/cursor-agent/versions/<v>/cursor-agent
|
|
69
|
+
const versions = join(stub.log, 'share', 'cursor-agent', 'versions', '2026.10.01')
|
|
70
|
+
mkdirSync(versions, { recursive: true })
|
|
71
|
+
renameSync(join(stub.bin, 'agent'), join(versions, 'cursor-agent'))
|
|
72
|
+
symlinkSync(join(versions, 'cursor-agent'), join(stub.bin, 'agent'))
|
|
73
|
+
expect(cursorCommand()).toBe('agent')
|
|
74
|
+
expect(await isAvailable()).toBe(true)
|
|
219
75
|
})
|
|
76
|
+
})
|
|
220
77
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
'{"type":"assistant.message","data":{"content":"Let me check..."}}',
|
|
224
|
-
'{"type":"assistant.message","data":{"content":"# Final PRD\\n\\nComplete document"}}',
|
|
225
|
-
'{"type":"result","sessionId":"abc","exitCode":0}',
|
|
226
|
-
].join('\n')
|
|
227
|
-
mockSpawn.mockImplementation((cmd: string) => {
|
|
228
|
-
if (cmd === 'which') return makeMockProc(0, '')
|
|
229
|
-
return makeMockProc(0, jsonl)
|
|
230
|
-
})
|
|
231
|
-
const { execute } = await import('./cursor.js')
|
|
232
|
-
const result = await execute(makeTask(), { cwd: tmpDir })
|
|
233
|
-
expect(result.output).toBe('# Final PRD\n\nComplete document')
|
|
234
|
-
})
|
|
78
|
+
describe.skipIf(!posix)('cursor adapter — against a stub `cursor-agent`', () => {
|
|
79
|
+
let stub: StubCli
|
|
235
80
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
stub = installStubCli('cursor-agent')
|
|
83
|
+
stub.respond(RESULT_WITH_USAGE)
|
|
84
|
+
})
|
|
85
|
+
afterEach(() => stub.restore())
|
|
86
|
+
|
|
87
|
+
it('sends the prompt on stdin and runs in the task directory', async () => {
|
|
88
|
+
const task = makeTask()
|
|
89
|
+
const result = await execute(task, { cwd: stub.work })
|
|
90
|
+
expect(result.success).toBe(true)
|
|
91
|
+
expect(result.output).toBe('Done.')
|
|
92
|
+
expect(result.usage?.cache_read_tokens).toBe(15360)
|
|
93
|
+
expect(result.costUsd).toBeUndefined()
|
|
94
|
+
expect(stub.stdin()).toBe(task.prompt)
|
|
95
|
+
expect(stub.cwd()).toBe(stub.work)
|
|
96
|
+
expect(stub.argv().slice(0, 3)).toEqual(['-p', '--output-format', 'json'])
|
|
97
|
+
expect(stub.argv()).not.toContain(task.prompt)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('applies edits with --force by default, and stays read-only in plan', async () => {
|
|
101
|
+
await execute(makeTask(), { cwd: stub.work })
|
|
102
|
+
expect(stub.argv()).toContain('--force')
|
|
103
|
+
|
|
104
|
+
await execute(makeTask(), { cwd: stub.work, permissionMode: 'plan' })
|
|
105
|
+
const argv = stub.argv()
|
|
106
|
+
expect(argv).not.toContain('--force')
|
|
107
|
+
expect(argv[argv.indexOf('--mode') + 1]).toBe('ask')
|
|
108
|
+
// A headless run in an untrusted workspace — a new worktree — exits at once without it.
|
|
109
|
+
expect(argv).toContain('--trust')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('passes --model only when one is set, and never an MCP flag', async () => {
|
|
113
|
+
await execute(makeTask(), { cwd: stub.work, mcpServers: [{ name: 'x', type: 'stdio', command: 'x' }], mcp_approve_all: true })
|
|
114
|
+
expect(stub.argv()).not.toContain('--model')
|
|
115
|
+
expect(stub.argv()).not.toContain('--mcp-config')
|
|
116
|
+
expect(stub.argv()).not.toContain('--approve-mcps')
|
|
117
|
+
await execute(makeTask(), { cwd: stub.work, model: 'sonnet-4.5' })
|
|
118
|
+
const argv = stub.argv()
|
|
119
|
+
expect(argv[argv.indexOf('--model') + 1]).toBe('sonnet-4.5')
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('reports stderr when Cursor fails, as it prints no JSON then', async () => {
|
|
123
|
+
process.env.STUB_EXIT = '1'
|
|
124
|
+
stub.respond('', 'Workspace Trust Required')
|
|
125
|
+
const result = await execute(makeTask(), { cwd: stub.work })
|
|
126
|
+
expect(result.success).toBe(false)
|
|
127
|
+
expect(result.output).toContain('Workspace Trust Required')
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('times out with success false', async () => {
|
|
131
|
+
process.env.STUB_SLEEP = '30'
|
|
132
|
+
const result = await execute(makeTask({ timeout: '300ms' }), { cwd: stub.work })
|
|
133
|
+
expect(result.success).toBe(false)
|
|
134
|
+
expect(result._timedOut).toBe(true)
|
|
244
135
|
})
|
|
245
136
|
})
|
|
@@ -1,179 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { writeFileSync, unlinkSync } from 'node:fs'
|
|
3
|
-
import { join } from 'node:path'
|
|
1
|
+
import { realpathSync } from 'node:fs'
|
|
4
2
|
import type { Task, ExecuteOptions, ExecuteResult, TokenUsage } from '../../convoy/spec-types.js'
|
|
3
|
+
import { resolveCommand } from '../platform.js'
|
|
4
|
+
import { cursorPermissionArgs } from './permission-modes.js'
|
|
5
|
+
import { runAgent, stopTask, promptOf, interruptedMessage, OUTPUT_LIMIT } from './agent-process.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Cursor Agent CLI, run headless: `cursor-agent -p --output-format json`.
|
|
9
|
+
*
|
|
10
|
+
* With `-p` and no prompt argument the agent reads its prompt from stdin.
|
|
11
|
+
* The JSON result has no cost and does not name the model; recent releases add
|
|
12
|
+
* a `usage` object, which is read when it is there.
|
|
13
|
+
*/
|
|
5
14
|
|
|
6
|
-
/** Adapter name */
|
|
7
15
|
export const name = 'cursor'
|
|
8
16
|
|
|
9
17
|
export function supportsSessionContinuity(): boolean { return false }
|
|
10
|
-
/**
|
|
11
|
-
* Check if the Cursor CLI (`agent`) is available on the system PATH.
|
|
12
|
-
*/
|
|
13
|
-
export async function isAvailable(): Promise<boolean> {
|
|
14
|
-
return new Promise((resolve) => {
|
|
15
|
-
const proc = spawn('which', ['agent'], { stdio: 'pipe' })
|
|
16
|
-
proc.on('close', (code) => resolve(code === 0))
|
|
17
|
-
proc.on('error', () => resolve(false))
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
20
|
+
* The Cursor Agent command on PATH.
|
|
21
|
+
*
|
|
22
|
+
* Cursor's installer puts both `agent` and `cursor-agent` on PATH, and its
|
|
23
|
+
* docs now lead with `agent`. `agent` is a name any tool could have, so it was
|
|
24
|
+
* mistaken for Cursor: `cursor-agent` is preferred, and a lone `agent` counts
|
|
25
|
+
* only when it resolves into Cursor's own install
|
|
26
|
+
* (`~/.local/share/cursor-agent/…`, `%LOCALAPPDATA%\cursor-agent\agent.cmd`).
|
|
23
27
|
*/
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const args = [
|
|
32
|
-
'-p',
|
|
33
|
-
prompt,
|
|
34
|
-
'--force',
|
|
35
|
-
'--output-format',
|
|
36
|
-
'json',
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
const cwd = options?.cwd ?? process.cwd()
|
|
40
|
-
const mcpJsonPath = join(cwd, 'mcp.json')
|
|
41
|
-
let wroteJson = false
|
|
42
|
-
|
|
43
|
-
if (options.mcpServers?.length) {
|
|
44
|
-
const mcpJson: Record<string, Record<string, unknown>> = {}
|
|
45
|
-
for (const server of options.mcpServers) {
|
|
46
|
-
const entry: Record<string, unknown> = {}
|
|
47
|
-
if (server.command) entry.command = server.command
|
|
48
|
-
if (server.args) entry.args = server.args
|
|
49
|
-
if (server.url) entry.url = server.url
|
|
50
|
-
if (server.config) Object.assign(entry, server.config)
|
|
51
|
-
mcpJson[server.name] = entry
|
|
52
|
-
}
|
|
53
|
-
writeFileSync(mcpJsonPath, JSON.stringify({ mcpServers: mcpJson }, null, 2), 'utf8')
|
|
54
|
-
args.push('--mcp-config', mcpJsonPath)
|
|
55
|
-
wroteJson = true
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (options.mcp_approve_all) {
|
|
59
|
-
args.push('--approve-mcps')
|
|
60
|
-
}
|
|
61
|
-
|
|
28
|
+
export function cursorCommand(env: NodeJS.ProcessEnv = process.env): string | null {
|
|
29
|
+
if (resolveCommand('cursor-agent', env)) return 'cursor-agent'
|
|
30
|
+
const agent = resolveCommand('agent', env)
|
|
31
|
+
if (!agent) return null
|
|
32
|
+
let real = agent
|
|
62
33
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
cwd,
|
|
68
|
-
})
|
|
34
|
+
real = realpathSync(agent)
|
|
35
|
+
} catch { /* keep the PATH entry */ }
|
|
36
|
+
return /cursor/i.test(real) ? 'agent' : null
|
|
37
|
+
}
|
|
69
38
|
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
export async function isAvailable(): Promise<boolean> {
|
|
40
|
+
return cursorCommand() !== null
|
|
41
|
+
}
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
43
|
+
export interface ParsedCursor {
|
|
44
|
+
text?: string
|
|
45
|
+
isError?: boolean
|
|
46
|
+
usage?: TokenUsage
|
|
47
|
+
}
|
|
79
48
|
|
|
80
|
-
|
|
81
|
-
stderr += chunk.toString()
|
|
82
|
-
if (options.verbose) {
|
|
83
|
-
process.stderr.write(chunk)
|
|
84
|
-
}
|
|
85
|
-
})
|
|
49
|
+
const num = (v: unknown): number | undefined => (typeof v === 'number' && Number.isFinite(v) ? v : undefined)
|
|
86
50
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Read `cursor-agent -p --output-format json` output: one `result` object.
|
|
53
|
+
* Its `usage.inputTokens` excludes the cache reads and writes, which are added
|
|
54
|
+
* to `prompt_tokens` and also kept apart.
|
|
55
|
+
*/
|
|
56
|
+
export function parseCursorOutput(stdout: string): ParsedCursor {
|
|
57
|
+
let obj: Record<string, unknown> | null = null
|
|
58
|
+
try {
|
|
59
|
+
obj = JSON.parse(stdout) as Record<string, unknown>
|
|
60
|
+
} catch {
|
|
61
|
+
// stream-json, or noise before the result: take the last result line.
|
|
62
|
+
for (const line of stdout.split('\n').reverse()) {
|
|
63
|
+
if (!line.trim().startsWith('{')) continue
|
|
90
64
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
const u = parsed?.usage as Record<string, number> | undefined
|
|
97
|
-
if (u) {
|
|
98
|
-
const promptTokens = (u.input_tokens ?? u.prompt_tokens) as number | undefined
|
|
99
|
-
const completionTokens = (u.output_tokens ?? u.completion_tokens) as number | undefined
|
|
100
|
-
const total = ((promptTokens ?? 0) + (completionTokens ?? 0)) || undefined
|
|
101
|
-
usage = { prompt_tokens: promptTokens, completion_tokens: completionTokens, total_tokens: total }
|
|
102
|
-
}
|
|
103
|
-
} catch {
|
|
104
|
-
// Fallback: parse JSONL (one JSON object per line)
|
|
105
|
-
// Claude CLI uses {"result": "text"}, Copilot CLI uses
|
|
106
|
-
// {"type":"assistant.message","data":{"content":"text"}} for the AI
|
|
107
|
-
// response and a separate {"type":"result"} line for session metadata.
|
|
108
|
-
const lines = stdout.split('\n')
|
|
109
|
-
let lastAssistantContent: string | undefined
|
|
110
|
-
for (const rawLine of lines) {
|
|
111
|
-
const line = rawLine.trim()
|
|
112
|
-
if (!line) continue
|
|
113
|
-
try {
|
|
114
|
-
const parsed = JSON.parse(line) as Record<string, unknown>
|
|
115
|
-
// Claude-style: result text in the result line
|
|
116
|
-
if (typeof parsed.result === 'string' && parsed.result) {
|
|
117
|
-
textOutput = parsed.result
|
|
118
|
-
const u = parsed?.usage as Record<string, number> | undefined
|
|
119
|
-
if (u) {
|
|
120
|
-
const promptTokens = (u.input_tokens ?? u.prompt_tokens) as number | undefined
|
|
121
|
-
const completionTokens = (u.output_tokens ?? u.completion_tokens) as number | undefined
|
|
122
|
-
const total = ((promptTokens ?? 0) + (completionTokens ?? 0)) || undefined
|
|
123
|
-
usage = { prompt_tokens: promptTokens, completion_tokens: completionTokens, total_tokens: total }
|
|
124
|
-
}
|
|
125
|
-
lastAssistantContent = undefined // prefer explicit result field
|
|
126
|
-
break
|
|
127
|
-
}
|
|
128
|
-
// Copilot-style: AI response in assistant.message events
|
|
129
|
-
if (parsed.type === 'assistant.message') {
|
|
130
|
-
const data = parsed.data as Record<string, unknown> | undefined
|
|
131
|
-
if (data && typeof data.content === 'string') {
|
|
132
|
-
lastAssistantContent = data.content
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
} catch { /* skip non-JSON lines */ }
|
|
136
|
-
}
|
|
137
|
-
if (lastAssistantContent !== undefined) {
|
|
138
|
-
textOutput = lastAssistantContent
|
|
65
|
+
const candidate = JSON.parse(line) as Record<string, unknown>
|
|
66
|
+
if (candidate.type === 'result') {
|
|
67
|
+
obj = candidate
|
|
68
|
+
break
|
|
139
69
|
}
|
|
70
|
+
} catch { /* not JSON */ }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!obj || typeof obj !== 'object') return {}
|
|
74
|
+
const parsed: ParsedCursor = {}
|
|
75
|
+
if (typeof obj.result === 'string') parsed.text = obj.result
|
|
76
|
+
if (obj.is_error === true) parsed.isError = true
|
|
77
|
+
const u = obj.usage as Record<string, unknown> | undefined
|
|
78
|
+
if (u && typeof u === 'object') {
|
|
79
|
+
const input = num(u.inputTokens)
|
|
80
|
+
const output = num(u.outputTokens)
|
|
81
|
+
if (input !== undefined || output !== undefined) {
|
|
82
|
+
const cacheRead = num(u.cacheReadTokens)
|
|
83
|
+
const cacheWrite = num(u.cacheWriteTokens)
|
|
84
|
+
const prompt = (input ?? 0) + (cacheRead ?? 0) + (cacheWrite ?? 0)
|
|
85
|
+
parsed.usage = {
|
|
86
|
+
prompt_tokens: prompt,
|
|
87
|
+
completion_tokens: output ?? 0,
|
|
88
|
+
total_tokens: prompt + (output ?? 0),
|
|
89
|
+
...(cacheRead !== undefined ? { cache_read_tokens: cacheRead } : {}),
|
|
90
|
+
...(cacheWrite !== undefined ? { cache_write_tokens: cacheWrite } : {}),
|
|
140
91
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
usage,
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
proc.on('error', (err) => {
|
|
150
|
-
resolve({
|
|
151
|
-
success: false,
|
|
152
|
-
output: `Failed to spawn cursor agent CLI: ${err.message}`,
|
|
153
|
-
exitCode: -1,
|
|
154
|
-
})
|
|
155
|
-
})
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return parsed
|
|
95
|
+
}
|
|
156
96
|
|
|
157
|
-
|
|
158
|
-
|
|
97
|
+
export async function execute(task: Task, options: ExecuteOptions = {}): Promise<ExecuteResult> {
|
|
98
|
+
const command = cursorCommand() ?? 'cursor-agent'
|
|
99
|
+
const args = ['-p', '--output-format', 'json', ...cursorPermissionArgs(options.permissionMode)]
|
|
100
|
+
if (options.model) args.push('--model', options.model)
|
|
101
|
+
|
|
102
|
+
const exit = await runAgent(task, {
|
|
103
|
+
command,
|
|
104
|
+
args,
|
|
105
|
+
input: promptOf(task),
|
|
106
|
+
cwd: options.cwd ?? process.cwd(),
|
|
107
|
+
verbose: options.verbose,
|
|
159
108
|
})
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
109
|
+
|
|
110
|
+
const parsed = parseCursorOutput(exit.stdout)
|
|
111
|
+
const interrupted = interruptedMessage(command, task, exit)
|
|
112
|
+
const success = !interrupted && exit.code === 0 && !parsed.isError
|
|
113
|
+
// On failure Cursor prints no JSON, only a message on stderr.
|
|
114
|
+
const output = success
|
|
115
|
+
? parsed.text ?? exit.stdout
|
|
116
|
+
: [interrupted, parsed.text, exit.stderr.trim() || exit.stdout.trim()].filter(Boolean).join('\n')
|
|
117
|
+
return {
|
|
118
|
+
success,
|
|
119
|
+
output: output.slice(0, OUTPUT_LIMIT),
|
|
120
|
+
exitCode: exit.code,
|
|
121
|
+
...(exit.timedOut ? { _timedOut: true } : {}),
|
|
122
|
+
...(parsed.usage ? { usage: parsed.usage } : {}),
|
|
164
123
|
}
|
|
165
124
|
}
|
|
166
125
|
|
|
167
|
-
/**
|
|
168
|
-
* Kill the process associated with a task (used by timeout enforcement).
|
|
169
|
-
*/
|
|
170
126
|
export function kill(task: Task): void {
|
|
171
|
-
|
|
172
|
-
task._process.kill('SIGTERM')
|
|
173
|
-
setTimeout(() => {
|
|
174
|
-
if (task._process && !task._process.killed) {
|
|
175
|
-
task._process.kill('SIGKILL')
|
|
176
|
-
}
|
|
177
|
-
}, 5000)
|
|
178
|
-
}
|
|
127
|
+
stopTask(task)
|
|
179
128
|
}
|