orkeon-code 1.0.0-rc.1 → 1.0.0-rc.2
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/.orkeon-runtime +10 -0
- package/.orkeon-version +1 -1
- package/NOTICE.md +1 -1
- package/README.fr.md +16 -22
- package/README.md +16 -22
- package/config/appsettings.jev.example.json +4 -1
- package/config/appsettings.kev.example.json +4 -1
- package/config/appsettings.liquid.example.json +4 -1
- package/config/appsettings.ollama-whisper.example.json +1 -0
- package/config/appsettings.whisper.example.json +1 -0
- package/mcp/whisper/README.md +2 -1
- package/orkeon-code +206 -11
- package/orkeon-code.ps1 +109 -7
- package/package.json +2 -1
- package/src/commands/.orkeon/orkeon-cli.d.ts +1 -4
- package/src/commands/_lib/args.ts +5 -4
- package/src/commands/_lib/dev/dev-batches.ts +34 -36
- package/src/commands/_lib/dev/dev-implement.ts +11 -14
- package/src/commands/_lib/dev/dev-source.ts +7 -11
- package/src/commands/_lib/dev/dev.ts +34 -37
- package/src/commands/_lib/dev/markers.ts +7 -0
- package/src/commands/_lib/dev/messages.ts +112 -0
- package/src/commands/_lib/dev-step.ts +16 -13
- package/src/commands/_lib/dispatch.ts +62 -39
- package/src/commands/_lib/git/branch.ts +9 -10
- package/src/commands/_lib/git/commit.ts +9 -13
- package/src/commands/_lib/git/diff.ts +22 -12
- package/src/commands/_lib/git/messages.ts +54 -0
- package/src/commands/_lib/git/review.ts +9 -10
- package/src/commands/_lib/memory/memory-admit.ts +19 -21
- package/src/commands/_lib/memory/memory.ts +3 -2
- package/src/commands/_lib/memory/messages.ts +32 -0
- package/src/commands/_lib/messages.ts +48 -0
- package/src/commands/_lib/project/messages.ts +8 -0
- package/src/commands/_lib/session/export.ts +3 -2
- package/src/commands/_lib/session/messages.ts +87 -0
- package/src/commands/_lib/session/prompts.ts +4 -0
- package/src/commands/_lib/session/resume.ts +15 -24
- package/src/commands/_lib/session/tasks.ts +20 -23
- package/src/commands/_lib/settings/advisor.ts +11 -16
- package/src/commands/_lib/settings/agents.ts +18 -28
- package/src/commands/_lib/settings/choices.ts +8 -0
- package/src/commands/_lib/settings/config.ts +43 -43
- package/src/commands/_lib/settings/effort.ts +147 -0
- package/src/commands/_lib/settings/hooks.ts +12 -20
- package/src/commands/_lib/settings/messages.ts +408 -0
- package/src/commands/_lib/settings/mode.ts +33 -24
- package/src/commands/_lib/settings/model.ts +71 -36
- package/src/commands/_lib/settings/output-style.ts +39 -0
- package/src/commands/_lib/settings/permissions.ts +71 -93
- package/src/commands/_lib/settings/route.ts +63 -0
- package/src/commands/_lib/settings/skills.ts +53 -11
- package/src/commands/_lib/settings/theme.ts +42 -0
- package/src/commands/_lib/speech/messages.ts +58 -0
- package/src/commands/_lib/speech/prompts.ts +4 -0
- package/src/commands/_lib/speech/say.ts +9 -10
- package/src/commands/_lib/speech/transcribe.ts +14 -23
- package/src/commands/_lib/speech/voice.ts +14 -18
- package/src/commands/_lib/status/doctor.ts +47 -28
- package/src/commands/_lib/status/messages.ts +100 -0
- package/src/commands/_lib/status/meta.ts +3 -24
- package/src/commands/_lib/status/status.ts +10 -11
- package/src/commands/_lib/status/usage-tools.ts +2 -3
- package/src/commands/_lib/status/usage.ts +7 -18
- package/src/commands/_lib/view.ts +6 -1
- package/src/commands/dev/dev-batches.cmd.ts +4 -3
- package/src/commands/dev/dev-learn.cmd.ts +3 -3
- package/src/commands/dev/dev-plan.cmd.ts +6 -7
- package/src/commands/dev/dev-spec.cmd.ts +6 -7
- package/src/commands/git/commit.cmd.ts +3 -3
- package/src/commands/git/review.cmd.ts +3 -3
- package/src/commands/memory/memory.cmd.ts +2 -2
- package/src/commands/project/analyze.cmd.ts +3 -3
- package/src/commands/project/debug-tool-call.cmd.ts +4 -9
- package/src/commands/project/init-verifiers.cmd.ts +3 -3
- package/src/commands/project/init.cmd.ts +3 -3
- package/src/commands/project/verify.cmd.ts +2 -2
- package/src/commands/session/assistant.cmd.ts +2 -2
- package/src/commands/session/compact.cmd.ts +1 -1
- package/src/commands/session/copy.cmd.ts +8 -7
- package/src/commands/session/rename.cmd.ts +3 -2
- package/src/commands/session/rewind.cmd.ts +3 -4
- package/src/commands/session/summary.cmd.ts +3 -3
- package/src/commands/session/tasks.cmd.ts +4 -2
- package/src/commands/settings/config.cmd.ts +4 -2
- package/src/commands/settings/effort.cmd.ts +10 -31
- package/src/commands/settings/fast.cmd.ts +2 -1
- package/src/commands/settings/mode.cmd.ts +3 -3
- package/src/commands/settings/model.cmd.ts +3 -2
- package/src/commands/settings/output-style.cmd.ts +9 -38
- package/src/commands/settings/permissions.cmd.ts +2 -2
- package/src/commands/settings/proactive.cmd.ts +2 -1
- package/src/commands/settings/route.cmd.ts +16 -0
- package/src/commands/settings/skills.cmd.ts +3 -3
- package/src/commands/settings/theme.cmd.ts +14 -0
- package/src/commands/speech/say.cmd.ts +2 -2
- package/src/commands/speech/transcribe.cmd.ts +2 -2
- package/src/commands/status/release-notes.cmd.ts +1 -1
- package/src/crews/.orkeon/orkeon.d.ts +538 -93
- package/src/crews/_probe-shared-memory/domain/messages.ts +54 -0
- package/src/crews/_probe-shared-memory/domain/probe-verdict.ts +17 -12
- package/src/crews/_probe-shared-memory/domain/prompts.ts +5 -0
- package/src/crews/_probe-shared-memory/probe.ork.ts +5 -3
- package/src/crews/advisor/application/messages.ts +4 -0
- package/src/crews/advisor/application/prompts.ts +4 -0
- package/src/crews/advisor/application/run-advisor.ts +2 -1
- package/src/crews/advisor/crew.ork.ts +5 -4
- package/src/crews/advisor/domain/advice.ts +7 -23
- package/src/crews/advisor/domain/messages.ts +8 -0
- package/src/crews/advisor/domain/prompts.ts +26 -0
- package/src/crews/agent-run/application/messages.ts +18 -0
- package/src/crews/agent-run/application/run-agent-run.ts +5 -4
- package/src/crews/agent-run/crew.ork.ts +3 -3
- package/src/crews/analyze/application/messages.ts +27 -0
- package/src/crews/analyze/application/prompts.ts +4 -0
- package/src/crews/analyze/application/run-analyze.ts +16 -14
- package/src/crews/analyze/crew.ork.ts +5 -4
- package/src/crews/analyze/domain/harvest.ts +33 -65
- package/src/crews/analyze/domain/prompts.ts +86 -0
- package/src/crews/code-review/application/lens-material.ts +24 -0
- package/src/crews/code-review/application/messages.ts +17 -0
- package/src/crews/code-review/application/prompts.ts +10 -17
- package/src/crews/code-review/application/review.ts +4 -1
- package/src/crews/code-review/application/run-code-review.ts +13 -15
- package/src/crews/code-review/crew.ork.ts +5 -4
- package/src/crews/code-review/domain/lenses.ts +6 -45
- package/src/crews/code-review/domain/messages.ts +25 -0
- package/src/crews/code-review/domain/prompts.ts +58 -0
- package/src/crews/code-review/domain/report.ts +5 -6
- package/src/crews/code-review/domain/scope.ts +6 -12
- package/src/crews/dev-batches/application/messages.ts +127 -0
- package/src/crews/dev-batches/application/plan-close.ts +12 -12
- package/src/crews/dev-batches/application/prompts.ts +10 -0
- package/src/crews/dev-batches/application/run-dev-batches.ts +57 -50
- package/src/crews/dev-batches/application/run-wave.ts +24 -22
- package/src/crews/dev-batches/application/seed-harvest.ts +8 -7
- package/src/crews/dev-batches/crew.ork.ts +12 -9
- package/src/crews/dev-batches/domain/batches-log.ts +1 -3
- package/src/crews/dev-batches/domain/markers.ts +5 -0
- package/src/crews/dev-batches/domain/messages.ts +6 -0
- package/src/crews/dev-batches/domain/wave-order.ts +3 -2
- package/src/crews/dev-change/application/change-material.ts +44 -0
- package/src/crews/dev-change/application/evidence.ts +25 -22
- package/src/crews/dev-change/application/messages.ts +81 -0
- package/src/crews/dev-change/application/{change-prompt.ts → prompts.ts} +40 -43
- package/src/crews/dev-change/application/run-dev-change.ts +43 -34
- package/src/crews/dev-change/crew.ork.ts +11 -9
- package/src/crews/dev-change/domain/change-answer.ts +24 -20
- package/src/crews/dev-change/domain/change-render.ts +13 -15
- package/src/crews/dev-change/domain/markers.ts +28 -0
- package/src/crews/dev-change/domain/messages.ts +16 -0
- package/src/crews/dev-implement/application/close.ts +21 -18
- package/src/crews/dev-implement/application/locate-sheet.ts +7 -5
- package/src/crews/dev-implement/application/messages.ts +161 -0
- package/src/crews/dev-implement/application/observe.ts +4 -2
- package/src/crews/dev-implement/application/prompts.ts +9 -0
- package/src/crews/dev-implement/application/report-writes.ts +14 -9
- package/src/crews/dev-implement/application/run-dev-implement.ts +84 -73
- package/src/crews/dev-implement/application/suite-job.ts +15 -11
- package/src/crews/dev-implement/crew.ork.ts +2 -1
- package/src/crews/dev-implement/domain/contracts.ts +59 -60
- package/src/crews/dev-implement/domain/correction.ts +16 -15
- package/src/crews/dev-implement/domain/cycles.ts +2 -1
- package/src/crews/dev-implement/domain/markers.ts +23 -0
- package/src/crews/dev-implement/domain/messages.ts +58 -0
- package/src/crews/dev-implement/domain/prompts.ts +93 -0
- package/src/crews/dev-implement/domain/roles.ts +3 -7
- package/src/crews/dev-implement/domain/sheet-edits.ts +6 -5
- package/src/crews/dev-implement/domain/sheet-ticks.ts +5 -4
- package/src/crews/dev-implement/domain/step-checks.ts +17 -16
- package/src/crews/dev-implement/domain/step-section.ts +6 -4
- package/src/crews/dev-learn/application/learn-prompt-fit.ts +63 -0
- package/src/crews/dev-learn/application/messages.ts +51 -0
- package/src/crews/dev-learn/application/{learn-prompt.ts → prompts.ts} +24 -65
- package/src/crews/dev-learn/application/run-dev-learn.ts +37 -32
- package/src/crews/dev-learn/crew.ork.ts +4 -3
- package/src/crews/dev-learn/domain/learn-answer.ts +25 -27
- package/src/crews/dev-learn/domain/messages.ts +65 -0
- package/src/crews/dev-learn/domain/owner-lines.ts +12 -9
- package/src/crews/dev-learn/domain/proposals-render.ts +8 -9
- package/src/crews/dev-plan/application/anchor-paths.ts +57 -20
- package/src/crews/dev-plan/application/inventory.ts +17 -13
- package/src/crews/dev-plan/application/messages.ts +88 -0
- package/src/crews/dev-plan/application/plan-prompt-fit.ts +44 -0
- package/src/crews/dev-plan/application/{plan-prompt.ts → prompts.ts} +37 -55
- package/src/crews/dev-plan/application/run-dev-plan.ts +103 -75
- package/src/crews/dev-plan/crew.ork.ts +11 -8
- package/src/crews/dev-plan/domain/inventory-model.ts +3 -3
- package/src/crews/dev-plan/domain/markers.ts +18 -0
- package/src/crews/dev-plan/domain/messages.ts +118 -0
- package/src/crews/dev-plan/domain/plan-answer.ts +118 -103
- package/src/crews/dev-plan/domain/plan-render.ts +30 -31
- package/src/crews/dev-plan/domain/prompts.ts +44 -0
- package/src/crews/dev-spec/application/messages.ts +30 -0
- package/src/crews/dev-spec/application/{spec-prompt.ts → prompts.ts} +42 -47
- package/src/crews/dev-spec/application/run-dev-spec.ts +67 -36
- package/src/crews/dev-spec/application/spec-material.ts +42 -0
- package/src/crews/dev-spec/crew.ork.ts +11 -9
- package/src/crews/dev-spec/domain/markers.ts +30 -0
- package/src/crews/dev-spec/domain/messages.ts +39 -0
- package/src/crews/dev-spec/domain/spec-answer.ts +46 -47
- package/src/crews/dev-spec/domain/spec-render.ts +18 -18
- package/src/crews/dev-verify/application/audit-brief.ts +187 -0
- package/src/crews/dev-verify/application/audit.ts +38 -30
- package/src/crews/dev-verify/application/capture.ts +34 -26
- package/src/crews/dev-verify/application/messages.ts +119 -0
- package/src/crews/dev-verify/application/prompts.ts +209 -0
- package/src/crews/dev-verify/application/run-dev-verify.ts +60 -46
- package/src/crews/dev-verify/application/run-gate.ts +11 -9
- package/src/crews/dev-verify/crew.ork.ts +6 -6
- package/src/crews/dev-verify/domain/audit-answer.ts +16 -12
- package/src/crews/dev-verify/domain/capture-sections.ts +5 -4
- package/src/crews/dev-verify/domain/commands.ts +3 -3
- package/src/crews/dev-verify/domain/gate.ts +21 -16
- package/src/crews/dev-verify/domain/markers.ts +16 -0
- package/src/crews/dev-verify/domain/mechanical-table.ts +37 -44
- package/src/crews/dev-verify/domain/messages.ts +92 -0
- package/src/crews/dev-verify/domain/verdict.ts +4 -4
- package/src/crews/git-commit/application/draft.ts +16 -37
- package/src/crews/git-commit/application/messages.ts +15 -0
- package/src/crews/git-commit/application/prompts.ts +47 -0
- package/src/crews/git-commit/application/run-git-commit.ts +13 -12
- package/src/crews/git-commit/crew.ork.ts +5 -4
- package/src/crews/git-commit/domain/commit.ts +15 -35
- package/src/crews/git-commit/domain/markers.ts +4 -0
- package/src/crews/git-commit/domain/messages.ts +48 -0
- package/src/crews/init-verifiers/application/authoring.ts +2 -1
- package/src/crews/init-verifiers/application/messages.ts +13 -0
- package/src/crews/init-verifiers/application/prompts.ts +5 -1
- package/src/crews/init-verifiers/application/run-init-verifiers.ts +3 -2
- package/src/crews/init-verifiers/crew.ork.ts +5 -4
- package/src/crews/main-loop/application/auto-compact.ts +2 -1
- package/src/crews/main-loop/application/messages.ts +81 -0
- package/src/crews/main-loop/application/prompts.ts +12 -0
- package/src/crews/main-loop/application/run-main-loop.ts +63 -30
- package/src/crews/main-loop/application/{turn-prompt.ts → turn-context.ts} +7 -8
- package/src/crews/main-loop/crew.ork.ts +12 -7
- package/src/crews/main-loop/domain/prompt-assembly.ts +45 -228
- package/src/crews/main-loop/domain/prompts.ts +336 -0
- package/src/crews/main-loop/domain/turn-chains.ts +10 -9
- package/src/crews/project-init/application/detect.ts +5 -4
- package/src/crews/project-init/application/messages.ts +15 -0
- package/src/crews/project-init/application/prompts.ts +11 -7
- package/src/crews/project-init/crew.ork.ts +5 -4
- package/src/crews/project-init/domain/existing-files.ts +6 -4
- package/src/crews/project-init/domain/messages.ts +13 -0
- package/src/crews/project-init/domain/package-map.ts +3 -3
- package/src/crews/project-init/domain/prompts.ts +10 -0
- package/src/crews/session-compact/application/prompts.ts +5 -0
- package/src/crews/session-compact/crew.ork.ts +5 -4
- package/src/crews/shared-memory-admit/application/prompts.ts +5 -0
- package/src/crews/shared-memory-admit/crew.ork.ts +3 -2
- package/src/crews/speech/application/messages.ts +3 -0
- package/src/crews/speech/application/prompts.ts +3 -0
- package/src/crews/speech/application/run-speech.ts +2 -1
- package/src/crews/speech/crew.ork.ts +2 -1
- package/src/shared/application/agents/child-agent.ts +11 -7
- package/src/shared/application/agents/messages.ts +35 -0
- package/src/shared/application/agents/route-agent.ts +115 -0
- package/src/shared/application/agents/run-sub-agent.ts +31 -8
- package/src/shared/application/compaction/compact-session.ts +19 -14
- package/src/shared/application/compaction/messages.ts +20 -0
- package/src/shared/application/compaction/prune-context.ts +94 -0
- package/src/shared/application/compaction/pruned-llm.ts +35 -0
- package/src/shared/application/dev/brief-inventory.ts +6 -4
- package/src/shared/application/dev/close-batch.ts +9 -7
- package/src/shared/application/dev/find-repo-pack.ts +4 -3
- package/src/shared/application/dev/learn-decision.ts +20 -18
- package/src/shared/application/dev/load-dev-context.ts +7 -8
- package/src/shared/application/dev/measure-access-cost.ts +5 -4
- package/src/shared/application/dev/messages.ts +132 -0
- package/src/shared/application/dev/phase-timer.ts +54 -0
- package/src/shared/application/dev/plan-source.ts +12 -8
- package/src/shared/application/dev/preflight.ts +8 -8
- package/src/shared/application/dev/prompts.ts +34 -0
- package/src/shared/application/dev/question-round.ts +25 -17
- package/src/shared/application/dev/resolve-work-folder.ts +4 -3
- package/src/shared/application/dev/settle-questions.ts +4 -2
- package/src/shared/application/dev/source-review.ts +12 -8
- package/src/shared/application/dev/source-step.ts +12 -10
- package/src/shared/application/dev/spend.ts +17 -4
- package/src/shared/application/dev/step-precedents.ts +2 -1
- package/src/shared/application/dev/tool-call-policy.ts +9 -11
- package/src/shared/application/dev/tool-callbacks.ts +52 -5
- package/src/shared/application/dev/tool-trace-recorder.ts +2 -1
- package/src/shared/application/dev/verdict-sources.ts +5 -3
- package/src/shared/application/dev/wrapped-tools.ts +4 -2
- package/src/shared/application/extra-tools.ts +2 -1
- package/src/shared/application/git/batch-worktree.ts +22 -17
- package/src/shared/application/git/commit-files.ts +24 -19
- package/src/shared/application/git/merge-batch.ts +11 -7
- package/src/shared/application/git/messages.ts +75 -0
- package/src/shared/application/git/open-pull-request.ts +4 -3
- package/src/shared/application/host-context.ts +59 -0
- package/src/shared/application/host-layout-store.ts +45 -0
- package/src/shared/application/llm-profile.ts +4 -3
- package/src/shared/application/messages.ts +14 -0
- package/src/shared/application/permission-rules.ts +10 -0
- package/src/shared/application/ports/decision.ts +14 -0
- package/src/shared/application/ports/human.ts +25 -0
- package/src/shared/application/ports/llm.ts +32 -3
- package/src/shared/application/ports/memory.ts +1 -1
- package/src/shared/application/ports/theme.ts +11 -0
- package/src/shared/application/ports.ts +4 -2
- package/src/shared/application/session-io.ts +2 -1
- package/src/shared/application/shared-memory/admit-entries.ts +16 -14
- package/src/shared/application/shared-memory/harvest-after-gaps.ts +5 -8
- package/src/shared/application/shared-memory/harvest-mistakes.ts +3 -2
- package/src/shared/application/shared-memory/import-agent-memory.ts +9 -7
- package/src/shared/application/shared-memory/memory-files.ts +2 -1
- package/src/shared/application/shared-memory/memory-settings.ts +2 -1
- package/src/shared/application/shared-memory/messages.ts +63 -0
- package/src/shared/application/shared-memory/push-candidate.ts +14 -11
- package/src/shared/application/shared-memory/recall-precedents.ts +2 -1
- package/src/shared/application/skills/messages.ts +4 -0
- package/src/shared/application/skills/suggest-skills.ts +102 -0
- package/src/shared/application/workflow/messages.ts +8 -0
- package/src/shared/application/workflow/workflow-state.ts +7 -6
- package/src/shared/domain/agent-policy/behavior-flags.ts +4 -10
- package/src/shared/domain/agent-policy/extra-tools.ts +2 -4
- package/src/shared/domain/agent-policy/messages.ts +66 -0
- package/src/shared/domain/agent-policy/path-rules.ts +299 -0
- package/src/shared/domain/agent-policy/permission.ts +20 -18
- package/src/shared/domain/agent-policy/prompts.ts +17 -0
- package/src/shared/domain/agent-policy/reasoning.ts +59 -0
- package/src/shared/domain/agent-policy/rule-sets.ts +18 -14
- package/src/shared/domain/agent-policy/tool-access.ts +17 -3
- package/src/shared/domain/agent-registry.ts +6 -5
- package/src/shared/domain/agents/chain.ts +2 -2
- package/src/shared/domain/agents/charter.ts +8 -5
- package/src/shared/domain/agents/exclusive.ts +2 -1
- package/src/shared/domain/agents/instances.ts +18 -15
- package/src/shared/domain/agents/messages.ts +39 -0
- package/src/shared/domain/agents/model-route.ts +199 -0
- package/src/shared/domain/agents/prompts.ts +20 -0
- package/src/shared/domain/code-intel-contract.ts +5 -4
- package/src/shared/domain/code-intel-routing.ts +8 -61
- package/src/shared/domain/compact-outcome.ts +5 -3
- package/src/shared/domain/compaction-thresholds.ts +2 -1
- package/src/shared/domain/compaction.ts +22 -113
- package/src/shared/domain/config-schema.ts +94 -81
- package/src/shared/domain/context-prune.ts +176 -0
- package/src/shared/domain/decision/questions.ts +102 -0
- package/src/shared/domain/dev/access-cost.ts +19 -15
- package/src/shared/domain/dev/batches-concurrency.ts +5 -6
- package/src/shared/domain/dev/build-commands.ts +5 -4
- package/src/shared/domain/dev/call-guard.ts +29 -28
- package/src/shared/domain/dev/carried-text.ts +3 -5
- package/src/shared/domain/dev/learn-proposals.ts +5 -4
- package/src/shared/domain/dev/learn-state.ts +3 -2
- package/src/shared/domain/dev/markers.ts +107 -0
- package/src/shared/domain/dev/messages.ts +259 -0
- package/src/shared/domain/dev/phase-timing.ts +50 -0
- package/src/shared/domain/dev/plan-checks.ts +24 -23
- package/src/shared/domain/dev/plan-format.ts +14 -24
- package/src/shared/domain/dev/project-files.ts +1 -15
- package/src/shared/domain/dev/prompts/brief-blocks.ts +20 -0
- package/src/shared/domain/dev/{review-prompt.ts → prompts.ts} +91 -61
- package/src/shared/domain/dev/questions.ts +33 -15
- package/src/shared/domain/dev/repo-pack.ts +12 -9
- package/src/shared/domain/dev/review-answer.ts +40 -17
- package/src/shared/domain/dev/review-brief.ts +54 -0
- package/src/shared/domain/dev/reviewer-charter.ts +4 -0
- package/src/shared/domain/dev/sheet-facts.ts +2 -4
- package/src/shared/domain/dev/spec-format.ts +13 -14
- package/src/shared/domain/dev/step-budget.ts +4 -2
- package/src/shared/domain/dev/step-rules.ts +3 -4
- package/src/shared/domain/dev/test-commands.ts +14 -10
- package/src/shared/domain/dev/tool-guards.ts +4 -3
- package/src/shared/domain/dev/trait-pattern.ts +14 -10
- package/src/shared/domain/dev/verdict-format.ts +14 -21
- package/src/shared/domain/dev/whitespace.ts +3 -2
- package/src/shared/domain/dev/work-folder.ts +4 -3
- package/src/shared/domain/dev/yaml-subset.ts +8 -26
- package/src/shared/domain/error-text.ts +13 -0
- package/src/shared/domain/git/close.ts +5 -4
- package/src/shared/domain/git/messages.ts +20 -0
- package/src/shared/domain/git/pull-request.ts +5 -5
- package/src/shared/domain/host-layout.ts +147 -0
- package/src/shared/domain/host-paths.ts +399 -0
- package/src/shared/domain/llm-failure.ts +35 -7
- package/src/shared/domain/llm-profile.ts +22 -3
- package/src/shared/domain/marked-message.ts +1 -5
- package/src/shared/domain/markers.ts +30 -0
- package/src/shared/domain/messages.ts +291 -0
- package/src/shared/domain/model-catalog.ts +2 -9
- package/src/shared/domain/permission-modes.ts +4 -8
- package/src/shared/domain/prelude.ts +2 -2
- package/src/shared/domain/project-manifests.ts +3 -2
- package/src/shared/domain/prompts.ts +233 -0
- package/src/shared/domain/search-routing.ts +3 -11
- package/src/shared/domain/secret-patterns.ts +3 -2
- package/src/shared/domain/session-keys.ts +7 -0
- package/src/shared/domain/session-start.ts +3 -2
- package/src/shared/domain/shared-memory/agent-memory-import.ts +4 -2
- package/src/shared/domain/shared-memory/candidates.ts +3 -4
- package/src/shared/domain/shared-memory/entry.ts +26 -20
- package/src/shared/domain/shared-memory/front-matter.ts +17 -13
- package/src/shared/domain/shared-memory/gate.ts +4 -3
- package/src/shared/domain/shared-memory/harvest.ts +9 -6
- package/src/shared/domain/shared-memory/layout.ts +11 -8
- package/src/shared/domain/shared-memory/markers.ts +9 -0
- package/src/shared/domain/shared-memory/messages.ts +66 -0
- package/src/shared/domain/shared-memory/precedents-block.ts +4 -15
- package/src/shared/domain/shared-memory/prompts.ts +28 -0
- package/src/shared/domain/shared-memory/refused.ts +3 -3
- package/src/shared/domain/skills/prompts.ts +4 -0
- package/src/shared/domain/skills/shortlist.ts +149 -0
- package/src/shared/domain/snip-turns.ts +2 -14
- package/src/shared/domain/speech.ts +2 -1
- package/src/shared/domain/tool-trace.ts +5 -7
- package/src/shared/domain/verifiers.ts +7 -11
- package/src/shared/domain/vfs.ts +8 -1
- package/src/shared/domain/workflow/prompts.ts +15 -0
- package/src/shared/domain/workflow/state-file.ts +14 -12
- package/src/shared/infrastructure/globals.ts +7 -2
- package/src/shared/infrastructure/orkeon/child-agents.ts +11 -16
- package/src/shared/infrastructure/orkeon/chooser.ts +32 -0
- package/src/shared/infrastructure/orkeon/decision-model.ts +31 -0
- package/src/shared/infrastructure/orkeon/dev-deps.ts +21 -14
- package/src/shared/infrastructure/orkeon/files.ts +24 -6
- package/src/shared/infrastructure/orkeon/github-pull-requests.ts +3 -2
- package/src/shared/infrastructure/orkeon/host-context.ts +36 -0
- package/src/shared/infrastructure/orkeon/human-input.ts +1 -5
- package/src/shared/infrastructure/orkeon/llm-profile.ts +36 -16
- package/src/shared/infrastructure/orkeon/llm.ts +85 -30
- package/src/shared/infrastructure/orkeon/markers.ts +6 -0
- package/src/shared/infrastructure/orkeon/memory-store.ts +1 -1
- package/src/shared/infrastructure/orkeon/memory-tools.ts +18 -20
- package/src/shared/infrastructure/orkeon/messages.ts +15 -0
- package/src/shared/infrastructure/orkeon/prompts.ts +47 -0
- package/src/shared/infrastructure/orkeon/reasoning.ts +40 -0
- package/src/shared/infrastructure/orkeon/script-tools.ts +14 -19
- package/src/shared/infrastructure/orkeon/session-store.ts +7 -51
- package/src/shared/infrastructure/orkeon/shell-jobs.ts +13 -7
- package/src/shared/infrastructure/orkeon/shell.ts +13 -5
- package/src/shared/infrastructure/orkeon/tool-catalogue.ts +3 -2
- package/src/shared/infrastructure/orkeon/wiring.ts +68 -12
- package/src/crews/dev-verify/application/auditor-prompt.ts +0 -323
- package/src/shared/domain/session-summary.ts +0 -13
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
import { CrewBuilder, publishCrew, inputs, ToolBuilder } from "../../shared/infrastructure/globals.ts";
|
|
26
26
|
import {
|
|
27
|
+
orkeonActRoute,
|
|
28
|
+
orkeonPrunedLlm,
|
|
27
29
|
orkeonAgent,
|
|
28
30
|
orkeonClock,
|
|
29
31
|
orkeonConfigStore,
|
|
@@ -31,7 +33,7 @@ import {
|
|
|
31
33
|
orkeonPullRequestOpener,
|
|
32
34
|
orkeonShell,
|
|
33
35
|
} from "../../shared/infrastructure/orkeon/wiring.ts";
|
|
34
|
-
import {
|
|
36
|
+
import { agentLlm } from "../../shared/infrastructure/orkeon/llm.ts";
|
|
35
37
|
import { memoryDirOf } from "../../shared/application/shared-memory/memory-settings.ts";
|
|
36
38
|
import { harvestAfterGaps } from "../../shared/application/shared-memory/harvest-after-gaps.ts";
|
|
37
39
|
import { devToolCallbacks } from "../../shared/application/dev/tool-callbacks.ts";
|
|
@@ -49,6 +51,7 @@ import { outcomeOf, runBatchChain } from "./application/run-wave.ts";
|
|
|
49
51
|
import type { BatchRun } from "./application/run-wave.ts";
|
|
50
52
|
import type { BatchesContext } from "./application/run-dev-batches.ts";
|
|
51
53
|
import { runDevBatches } from "./application/run-dev-batches.ts";
|
|
54
|
+
import { DEV_BATCHES_GOAL, GIT_TOP_PROBE_GOAL, batchAgentGoal } from "./application/prompts.ts";
|
|
52
55
|
|
|
53
56
|
const effort = providerEffort(inputs().effort);
|
|
54
57
|
// A batch agent writes and audits: the implementer's tools and the auditor's read tools.
|
|
@@ -70,7 +73,7 @@ function batchAgent(run: BatchRun, context: BatchesContext) {
|
|
|
70
73
|
const builder = orkeonAgent()
|
|
71
74
|
.name(`batch-${run.batch}`)
|
|
72
75
|
.role("Batch runner")
|
|
73
|
-
.goal(
|
|
76
|
+
.goal(batchAgentGoal(run.batch, run.code))
|
|
74
77
|
.workingRoot(run.root)
|
|
75
78
|
.tools(BATCH_TOOLS)
|
|
76
79
|
.withAutonomousTools(tools)
|
|
@@ -81,7 +84,7 @@ function batchAgent(run: BatchRun, context: BatchesContext) {
|
|
|
81
84
|
// GAPS is the driver's, on the main checkout.
|
|
82
85
|
const outcome = await runBatchChain(run, launch, {
|
|
83
86
|
implement: (input) => runDevImplement(implementInputs(input), implementDeps(ctx, { ...options, toolSlot })),
|
|
84
|
-
verify: (input) => runDevVerify(input, verifyDeps(ctx, { ...options, validationSlot })),
|
|
87
|
+
verify: (input) => runDevVerify(input, { ...verifyDeps(ctx, { ...options, validationSlot }), route: orkeonActRoute(ctx.log, ctx.tools, run.root) }),
|
|
85
88
|
spend,
|
|
86
89
|
});
|
|
87
90
|
return JSON.stringify(outcome);
|
|
@@ -92,7 +95,7 @@ function batchAgent(run: BatchRun, context: BatchesContext) {
|
|
|
92
95
|
const builder = orkeonAgent()
|
|
93
96
|
.name("dev-batches")
|
|
94
97
|
.role("Batch driver")
|
|
95
|
-
.goal(
|
|
98
|
+
.goal(DEV_BATCHES_GOAL)
|
|
96
99
|
// The reviewer's read tools, for the review of the next batch; the rest is code's.
|
|
97
100
|
.tools(charterCatalogue(REVIEWER_CHARTER))
|
|
98
101
|
.maxIterations(REVIEWER_CHARTER.maxIterations)
|
|
@@ -102,11 +105,11 @@ const builder = orkeonAgent()
|
|
|
102
105
|
const ports = { shell: orkeonShell(ctx.tools), files: orkeonFiles(ctx.tools), config: orkeonConfigStore(ctx.tools) };
|
|
103
106
|
const clock = orkeonClock();
|
|
104
107
|
return await runDevBatches(inputs(), {
|
|
105
|
-
...ports, log: ctx.log, clock,
|
|
106
|
-
//
|
|
108
|
+
...ports, log: ctx.log, clock, route: orkeonActRoute(ctx.log, ctx.tools),
|
|
109
|
+
// These callbacks, then the host's gate on the input they return: the dev rule sets again and the run's /hooks (a chained run
|
|
107
110
|
// reads them from its record, as it does the /effort). The reviewer only reads: the plan step's guard fits it.
|
|
108
|
-
reviewerFor: (c) =>
|
|
109
|
-
{ effort: providerEffort(c.effort ?? undefined) }),
|
|
111
|
+
reviewerFor: (c) => orkeonPrunedLlm(agentLlm(ctx, devToolCallbacks({ step: "dev-plan", hooks: c.hooks }, { shell: ports.shell, log: ctx.log, memoryDir: memoryDirOf(ports.config) }),
|
|
112
|
+
{ effort: providerEffort(c.effort ?? undefined) }), ctx.log, ctx.tools),
|
|
110
113
|
openerFor: (c) => orkeonPullRequestOpener({ mode: c.permissionMode, rules: parseSessionRules(c.permissionRules), asked: false }, ctx.tools),
|
|
111
114
|
// A parallel wave: each batch in its own agent under its worktree and its own budget (batches-budget.ts).
|
|
112
115
|
runBatch: async (run, context) => {
|
|
@@ -120,7 +123,7 @@ const builder = orkeonAgent()
|
|
|
120
123
|
const probe = orkeonAgent()
|
|
121
124
|
.name(`probe-${root.slice(root.lastIndexOf("/") + 1)}`)
|
|
122
125
|
.role("Worktree probe")
|
|
123
|
-
.goal(
|
|
126
|
+
.goal(GIT_TOP_PROBE_GOAL)
|
|
124
127
|
.workingRoot(root)
|
|
125
128
|
.tools(["shell_command"])
|
|
126
129
|
.body(async (_i: any, pctx: any) => JSON.stringify(await gitTopUnder(pctx.tools, root)));
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { BatchesLogEntry } from "../../../shared/domain/dev/batches-state.ts";
|
|
5
5
|
import { batchesStatePath } from "../../../shared/domain/workflow/state-file.ts";
|
|
6
6
|
import { WORKSPACE } from "../../../shared/domain/vfs.ts";
|
|
7
|
+
import { REVIEW_NOT_RUN } from "./markers.ts";
|
|
7
8
|
|
|
8
9
|
export type BatchEvent = "launched" | "relaunched" | "returned" | "merged" | "stopped";
|
|
9
10
|
|
|
@@ -43,9 +44,6 @@ export function lastEntryOf(entries: readonly BatchesLogEntry[], batch: string):
|
|
|
43
44
|
return undefined;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
/** The detail that opens a stop because the next batch's review could not run (G1). */
|
|
47
|
-
export const REVIEW_NOT_RUN = "BLOCKED — review not run";
|
|
48
|
-
|
|
49
47
|
/** True when the batch's review is still owed before its launch: the batch has no entry yet, or its last entry is a
|
|
50
48
|
* stop because the review could not run. A stop for Blocking questions settles the review: the human settled them. */
|
|
51
49
|
export function reviewPending(entries: readonly BatchesLogEntry[], batch: string): boolean {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The problems the domain of /dev-batches states: why a plan's batches have no order (ADR 0026).
|
|
2
|
+
|
|
3
|
+
// ── The order of the batches (wave-order.ts) ────────────────────────────────
|
|
4
|
+
|
|
5
|
+
export const selfDependency = (ids: string): string => `a batch depends on itself: ${ids}`;
|
|
6
|
+
export const dependencyCycle = (ids: string): string => `the dependencies form a cycle: ${ids}`;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// batch number. A batch's dependencies are its summary row's `Depends on`, else its sheet's. An
|
|
3
3
|
// unknown dependency or a cycle refuses the plan. Pure.
|
|
4
4
|
import { compareBatchIds } from "../../../shared/domain/dev/artefacts.ts";
|
|
5
|
+
import { dependencyCycle, selfDependency } from "./messages.ts";
|
|
5
6
|
|
|
6
7
|
export interface BatchNode {
|
|
7
8
|
id: string;
|
|
@@ -21,12 +22,12 @@ export function waveOrder(batches: readonly BatchNode[]): WaveOrder {
|
|
|
21
22
|
if (unknown.length > 0) return { ok: false, problem: `unknown dependency: ${unknown.join(", ")}` };
|
|
22
23
|
const left = new Map(batches.map((b) => [b.id, new Set(b.dependsOn.filter((d) => d !== b.id))]));
|
|
23
24
|
const self = batches.filter((b) => b.dependsOn.includes(b.id)).map((b) => b.id);
|
|
24
|
-
if (self.length > 0) return { ok: false, problem:
|
|
25
|
+
if (self.length > 0) return { ok: false, problem: selfDependency(self.join(", ")) };
|
|
25
26
|
const order: string[] = [];
|
|
26
27
|
while (left.size > 0) {
|
|
27
28
|
const ready = [...left].filter(([, deps]) => deps.size === 0).map(([id]) => id).sort(compareBatchIds);
|
|
28
29
|
if (ready.length === 0) {
|
|
29
|
-
return { ok: false, problem:
|
|
30
|
+
return { ok: false, problem: dependencyCycle([...left.keys()].sort(compareBatchIds).join(", ")) };
|
|
30
31
|
}
|
|
31
32
|
const next = ready[0];
|
|
32
33
|
order.push(next);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// The change writer's prompts, assembled for one extract call each: the brief's head, then its material cut to the
|
|
2
|
+
// room the cap leaves - past the cap the current file is cut first, then the origin, then the inventory - and the
|
|
3
|
+
// reproduction prompt with its origin cut. The text is ./prompts.ts's.
|
|
4
|
+
import type { Decision } from "../../../shared/domain/dev/questions.ts";
|
|
5
|
+
import type { ChangeKind } from "../../../shared/domain/dev/spec-format.ts";
|
|
6
|
+
import { NO_INVENTORY, changePromptHead, changePromptMaterial, cutByCode, reproPrompt } from "./prompts.ts";
|
|
7
|
+
import type { ChangePromptMode } from "./prompts.ts";
|
|
8
|
+
|
|
9
|
+
export interface ChangePromptInput {
|
|
10
|
+
mode: ChangePromptMode; code: string; kind: ChangeKind;
|
|
11
|
+
origin: string; facts: string; request: string; current: string;
|
|
12
|
+
decisions: readonly Decision[]; fresh: readonly Decision[]; inventory: string;
|
|
13
|
+
/** The "## Precedents" block the step recalled (T1), "" or absent when none: material, placed last. */
|
|
14
|
+
precedents?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const MAX_CHANGE_PROMPT_CHARS = 60_000;
|
|
18
|
+
const MIN_PART = 2_000;
|
|
19
|
+
/** The most of the origin the reproduction prompt carries. */
|
|
20
|
+
const MAX_REPRO_ORIGIN_CHARS = 12_000;
|
|
21
|
+
|
|
22
|
+
function cut(text: string, max: number): string {
|
|
23
|
+
return text.length <= max ? text : cutByCode(text.slice(0, Math.max(0, max - 20)));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function buildChangePrompt(input: ChangePromptInput, problems: readonly string[]): string {
|
|
27
|
+
const head = changePromptHead(input.code, input.kind, input.mode, problems, input.decisions, input.fresh);
|
|
28
|
+
const precedents = (input.precedents ?? "").trimEnd();
|
|
29
|
+
let room = MAX_CHANGE_PROMPT_CHARS - head.join("\n").length - input.facts.length - precedents.length - 400;
|
|
30
|
+
const inventory = cut(input.inventory.trimEnd() || NO_INVENTORY, Math.max(MIN_PART, Math.floor(room / 4)));
|
|
31
|
+
room -= inventory.length;
|
|
32
|
+
const origin = cut(input.origin.trim(), Math.max(MIN_PART, Math.floor(room / 3)));
|
|
33
|
+
room -= origin.length;
|
|
34
|
+
const current = cut(input.current.trimEnd(), Math.max(MIN_PART, room));
|
|
35
|
+
const material = changePromptMaterial({
|
|
36
|
+
current, origin, request: input.request.trim(), facts: input.facts.trim(), inventory, precedents,
|
|
37
|
+
});
|
|
38
|
+
return [...head, ...material].join("\n");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The prompt asking for the one command that shows the bug or measures the cost. */
|
|
42
|
+
export function buildReproPrompt(kind: "bug" | "perf", origin: string, commands: readonly string[], problems: readonly string[]): string {
|
|
43
|
+
return reproPrompt(kind, cut(origin.trim(), MAX_REPRO_ORIGIN_CHARS), commands, problems);
|
|
44
|
+
}
|
|
@@ -8,7 +8,12 @@ import type { Files, Llm, Shell } from "../../../shared/application/ports.ts";
|
|
|
8
8
|
import { firstLine, readRequest } from "../../../shared/application/dev/source-step.ts";
|
|
9
9
|
import type { RepoPackCommands } from "../../../shared/domain/dev/repo-pack.ts";
|
|
10
10
|
import { checkValidation, plainWords } from "../../../shared/domain/dev/test-commands.ts";
|
|
11
|
-
import { REPRO_SCHEMA
|
|
11
|
+
import { REPRO_SCHEMA } from "./prompts.ts";
|
|
12
|
+
import { buildReproPrompt } from "./change-material.ts";
|
|
13
|
+
import { GLOB_OR_EXPANSION, MEASURES_THE_COST, PATH_OUT_OF_CHECKOUT, REPRODUCES_THE_BUG, SHELL_OPERATOR_AFTER_CLI, evidenceCouldNotRun, couldNotStart, didNotReproduce, issuePrintedNoJson, issueViewFailed, measuredFact, measurementFailed, noCommandPicked, ranOutOfTime, reproductionFact, runMayNotRun, runtimeRefused, wasKilled } from "./messages.ts";
|
|
14
|
+
import { NOT_ONE_LINE } from "../../../shared/domain/dev/messages.ts";
|
|
15
|
+
import { errorText } from "../../../shared/domain/error-text.ts";
|
|
16
|
+
import { answerDidNotParse } from "../../../shared/application/agents/messages.ts";
|
|
12
17
|
|
|
13
18
|
export const REPRO_TIMEOUT_SECONDS = 600;
|
|
14
19
|
const MAX_COMMAND_CHARS = 400;
|
|
@@ -32,13 +37,13 @@ export async function readOrigin(step: string, deps: { shell: Pick<Shell, "run">
|
|
|
32
37
|
if (r.exitCode !== 0) throw new Error((r.stderr || r.stdout).trim() || `exit ${r.exitCode}`);
|
|
33
38
|
out = r.stdout;
|
|
34
39
|
} catch (e) {
|
|
35
|
-
return { refused:
|
|
40
|
+
return { refused: issueViewFailed(step, command, firstLine(e)) };
|
|
36
41
|
}
|
|
37
42
|
try {
|
|
38
43
|
const v = JSON.parse(out) as { number?: number; title?: string; body?: string; url?: string };
|
|
39
44
|
return { text: [`#${v.number ?? issue[1]} ${v.title ?? ""}`.trim(), v.url ?? "", "", v.body ?? ""].join("\n").trim(), from: `issue #${issue[1]}` };
|
|
40
45
|
} catch {
|
|
41
|
-
return { refused:
|
|
46
|
+
return { refused: issuePrintedNoJson(step, command) };
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
|
|
@@ -58,18 +63,18 @@ const outOfCheckout = (value: string): boolean =>
|
|
|
58
63
|
/** Why a command may not run, null when it may: a narrow test command of the pack, or the CLI and plain words. */
|
|
59
64
|
export function commandProblem(command: string, commands: RepoPackCommands): string | null {
|
|
60
65
|
const c = command.trim();
|
|
61
|
-
if (c === "" || /[\r\n]/.test(c) || c.length > MAX_COMMAND_CHARS) return
|
|
66
|
+
if (c === "" || /[\r\n]/.test(c) || c.length > MAX_COMMAND_CHARS) return NOT_ONE_LINE;
|
|
62
67
|
const cli = commands.cli?.trim() ?? "";
|
|
63
68
|
if (cli !== "" && (c === cli || c.startsWith(`${cli} `))) {
|
|
64
|
-
if (!plainWords(c)) return
|
|
69
|
+
if (!plainWords(c)) return SHELL_OPERATOR_AFTER_CLI;
|
|
65
70
|
const tail = c.slice(cli.length);
|
|
66
71
|
let quoted = false;
|
|
67
72
|
for (const ch of tail) {
|
|
68
73
|
if (ch === '"') quoted = !quoted;
|
|
69
|
-
else if (/[$`]/.test(ch) || (!quoted && /[*?[\]{}]/.test(ch))) return
|
|
74
|
+
else if (/[$`]/.test(ch) || (!quoted && /[*?[\]{}]/.test(ch))) return GLOB_OR_EXPANSION;
|
|
70
75
|
}
|
|
71
76
|
for (const word of tail.trim().split(/\s+/).filter((w) => w !== "")) {
|
|
72
|
-
if (pathValues(word.replace(/"/g, "")).some(outOfCheckout)) return
|
|
77
|
+
if (pathValues(word.replace(/"/g, "")).some(outOfCheckout)) return PATH_OUT_OF_CHECKOUT;
|
|
73
78
|
}
|
|
74
79
|
return null;
|
|
75
80
|
}
|
|
@@ -91,7 +96,7 @@ export async function pickCommand(
|
|
|
91
96
|
if (given !== "") {
|
|
92
97
|
const problem = commandProblem(given, commands);
|
|
93
98
|
return problem === null ? { command: given.trim() } : {
|
|
94
|
-
refused:
|
|
99
|
+
refused: runMayNotRun(step, given, problem),
|
|
95
100
|
};
|
|
96
101
|
}
|
|
97
102
|
let problems: string[] = [];
|
|
@@ -101,15 +106,15 @@ export async function pickCommand(
|
|
|
101
106
|
const v = await llm.extract(buildReproPrompt(kind, origin, packCommandList(commands), problems), REPRO_SCHEMA) as { command?: unknown };
|
|
102
107
|
command = typeof v?.command === "string" ? v.command.trim() : "";
|
|
103
108
|
} catch (e) {
|
|
104
|
-
problems = [
|
|
109
|
+
problems = [answerDidNotParse(errorText(e))];
|
|
105
110
|
continue;
|
|
106
111
|
}
|
|
107
112
|
const problem = commandProblem(command, commands);
|
|
108
113
|
if (problem === null) return { command };
|
|
109
114
|
problems = [`'${command}': ${problem}`];
|
|
110
115
|
}
|
|
111
|
-
const what = kind === "bug" ?
|
|
112
|
-
return { refused:
|
|
116
|
+
const what = kind === "bug" ? REPRODUCES_THE_BUG : MEASURES_THE_COST;
|
|
117
|
+
return { refused: noCommandPicked(step, what, problems[0] ?? "none") };
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
export async function runEvidence(shell: Pick<Shell, "run">, command: string, clock: () => Date): Promise<Ran> {
|
|
@@ -124,7 +129,7 @@ export async function runEvidence(shell: Pick<Shell, "run">, command: string, cl
|
|
|
124
129
|
timedOut = r.timedOut === true;
|
|
125
130
|
output = [r.stdout, r.stderr].filter((s) => s !== "").join("\n");
|
|
126
131
|
} catch (e) {
|
|
127
|
-
output =
|
|
132
|
+
output = runtimeRefused(firstLine(e));
|
|
128
133
|
refused = true;
|
|
129
134
|
}
|
|
130
135
|
const seconds = Math.round((clock().getTime() - start) / 100) / 10;
|
|
@@ -142,28 +147,26 @@ export function reproFile(ran: Ran, date: string): string {
|
|
|
142
147
|
export function factLines(kind: "bug" | "perf", ran: Ran, fileName: string): string[] {
|
|
143
148
|
const tail = ran.output.trimEnd().split(/\r?\n/).slice(-TAIL_LINES).map((l) => ` ${l.replace(/```/g, "'''")}`.trimEnd());
|
|
144
149
|
const head = kind === "bug"
|
|
145
|
-
?
|
|
146
|
-
:
|
|
150
|
+
? reproductionFact(ran.command, ran.exitCode, ran.seconds, fileName)
|
|
151
|
+
: measuredFact(ran.command, ran.seconds, ran.exitCode, fileName);
|
|
147
152
|
return ran.output.trim() === "" ? [head] : [head, "- **Observed** (last lines):", "", " ```text", ...tail, " ```"];
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
/** Why the run stops the step, null when it stands as evidence. */
|
|
151
156
|
export function runStop(step: string, kind: "bug" | "perf", ran: Ran, shown: string): string | null {
|
|
152
|
-
if (ran.refused) return
|
|
153
|
-
if (ran.timedOut) return
|
|
157
|
+
if (ran.refused) return evidenceCouldNotRun(step, ran.command, ran.output);
|
|
158
|
+
if (ran.timedOut) return ranOutOfTime(step, ran.command, REPRO_TIMEOUT_SECONDS, shown);
|
|
154
159
|
if (kind === "bug" && NOT_RUN_EXITS.has(ran.exitCode)) {
|
|
155
|
-
return
|
|
156
|
-
`nothing else is written (output in ${shown})`;
|
|
160
|
+
return couldNotStart(step, ran.command, ran.exitCode, shown);
|
|
157
161
|
}
|
|
158
162
|
if (kind === "bug" && ran.exitCode > 128) {
|
|
159
|
-
return
|
|
163
|
+
return wasKilled(step, ran.command, ran.exitCode, shown);
|
|
160
164
|
}
|
|
161
165
|
if (kind === "bug" && ran.exitCode === 0) {
|
|
162
|
-
return
|
|
163
|
-
`Give the failing command with --run, or check the origin.`;
|
|
166
|
+
return didNotReproduce(step, ran.command, shown);
|
|
164
167
|
}
|
|
165
168
|
if (kind === "perf" && ran.exitCode !== 0) {
|
|
166
|
-
return
|
|
169
|
+
return measurementFailed(step, ran.command, ran.exitCode, shown);
|
|
167
170
|
}
|
|
168
171
|
return null;
|
|
169
172
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// The messages of the change brief's step: the lines the person reads at the end of a run, its refusals and
|
|
2
|
+
// warnings, the facts code writes from the run, and the words of its crew (ADR 0026). The lines /dev-spec says the
|
|
3
|
+
// same way are imported from its messages.
|
|
4
|
+
|
|
5
|
+
// ── The crew ────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export const CHANGE_WRITER_GOAL =
|
|
8
|
+
"Write what is wrong or costly in code that exists, the evidence that shows it and what must survive, and settle its open questions with the person";
|
|
9
|
+
export const BRIEF_REVIEW_TASK = "review of the brief";
|
|
10
|
+
|
|
11
|
+
// ── The run ─────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
export const DEV_CHANGE_NEXT = "→ Next step, once you have validated the brief: /dev-plan {code}";
|
|
14
|
+
export const FEATURE_LINE = "→ a feature, not a change: the spec SPEC-{code}.md follows";
|
|
15
|
+
export const invalidKind = (step: string): string => `${step}: invalid crew input: kind`;
|
|
16
|
+
export const specExists = (step: string, shown: string, code: string): string =>
|
|
17
|
+
`${step}: ${shown}/SPEC-${code}.md exists: a code has one source; revise it with /dev-spec ${code} (no kind), or pick another code`;
|
|
18
|
+
export const titleNamesNoKind = (step: string, shown: string): string =>
|
|
19
|
+
`${step}: ${shown}: the title names no kind (bug, refactor or perf); fix the title first`;
|
|
20
|
+
export const briefKeepsKind = (step: string, shown: string, fileKind: string, kind: string): string =>
|
|
21
|
+
`${step}: ${shown} is a ${fileKind} change: a brief keeps its kind; pick another code for a ${kind}`;
|
|
22
|
+
export const nameTheKind = (step: string, code: string): string =>
|
|
23
|
+
`${step}: name the kind: /dev-spec ${code} bug|refactor|perf [--run "<command>"] <origin>`;
|
|
24
|
+
export const runIsForBugOrPerf = (step: string): string =>
|
|
25
|
+
`${step}: --run is for a bug or a perf change; a refactor is pinned by its tests`;
|
|
26
|
+
export const newBriefNeedsOrigin = (step: string, code: string, kind: string): string =>
|
|
27
|
+
`${step}: a new brief needs its origin: /dev-spec ${code} ${kind} <#issue | path | text>`;
|
|
28
|
+
export const deniedNothingWritten = (step: string, denied: string): string => `${step}: ${denied}; nothing is written`;
|
|
29
|
+
export const reproNotWritten = (step: string, shown: string, why: string): string =>
|
|
30
|
+
`${step}: ${shown} could not be written (${why}); nothing else is written`;
|
|
31
|
+
export const briefRendererDefect = (step: string, first: string): string =>
|
|
32
|
+
`${step}: a checked answer rendered a brief that fails its self-check (a renderer defect): ${first}`;
|
|
33
|
+
export const briefRefusedTwice = (step: string): string => `${step}: the brief was refused twice; nothing is written.`;
|
|
34
|
+
export const newPromiseKept = (step: string, shown: string): string =>
|
|
35
|
+
`${step}: the request is a new promise, not a change of what exists; ${shown} is kept: a feature takes a code of its own (/dev-spec <code> <brief>)`;
|
|
36
|
+
export const unknownTest = (name: string): string => `'${name}' is no test the code index shows: its row reads unpinned`;
|
|
37
|
+
export const ROUTED_TO_SPEC = "the rewrite routed the brief to a spec";
|
|
38
|
+
export const evidenceLine = (command: string, seconds: number, shown: string): string =>
|
|
39
|
+
`evidence: \`${command}\` (${seconds} s), output in ${shown}`;
|
|
40
|
+
export const mustNotChangeLine = (rows: string, unpinned: number): string => `must not change: ${rows}, ${unpinned} unpinned`;
|
|
41
|
+
export const briefBlockedUnanswered = (step: string, shown: string): string =>
|
|
42
|
+
`${step}: BLOCKED — a question went unanswered; the open questions are in ${shown} § 8.`;
|
|
43
|
+
export const answerBriefQuestions = (code: string, kind: string): string =>
|
|
44
|
+
`→ Answer them: /dev-spec ${code} ${kind} in an interactive session, or edit the file; nothing was decided for you.`;
|
|
45
|
+
export const briefStillBlocking = (ids: string, code: string, kind: string): string =>
|
|
46
|
+
`→ ${ids} still Blocking: /dev-plan refuses the brief until settled: /dev-spec ${code} ${kind}, or edit the file.`;
|
|
47
|
+
|
|
48
|
+
// ── The evidence ────────────────────────────────────────────────────────
|
|
49
|
+
|
|
50
|
+
export const issueViewFailed = (step: string, command: string, why: string): string =>
|
|
51
|
+
`${step}: ${command} failed (${why}): sign gh in (gh auth login), or give the issue's text or a file instead`;
|
|
52
|
+
export const issuePrintedNoJson = (step: string, command: string): string =>
|
|
53
|
+
`${step}: ${command} printed no JSON: give the issue's text or a file instead`;
|
|
54
|
+
export const SHELL_OPERATOR_AFTER_CLI = "a shell operator after the CLI";
|
|
55
|
+
export const GLOB_OR_EXPANSION = "a glob or an expansion after the CLI";
|
|
56
|
+
export const PATH_OUT_OF_CHECKOUT = "a path out of the checkout";
|
|
57
|
+
export const runMayNotRun = (step: string, given: string, problem: string): string =>
|
|
58
|
+
`${step}: --run "${given}" may not run (${problem}): give a narrow test command of .orkeon/repo.yaml or the CLI with plain words`;
|
|
59
|
+
export const REPRODUCES_THE_BUG = "reproduces the bug";
|
|
60
|
+
export const MEASURES_THE_COST = "measures the cost";
|
|
61
|
+
export const noCommandPicked = (step: string, what: string, problem: string): string =>
|
|
62
|
+
`${step}: no command that ${what} could be picked (${problem}): give one with --run "<command>"`;
|
|
63
|
+
export const runtimeRefused = (why: string): string => `the runtime refused the command: ${why}`;
|
|
64
|
+
export const reproductionFact = (command: string, exit: number, seconds: number, fileName: string): string =>
|
|
65
|
+
`- **Reproduction**: \`${command}\` — exit ${exit} after ${seconds} s; the output is in ${fileName}`;
|
|
66
|
+
export const measuredFact = (command: string, seconds: number, exit: number, fileName: string): string =>
|
|
67
|
+
`- **Measured**: \`${command}\` — ${seconds} s wall time, exit ${exit}; the output is in ${fileName}`;
|
|
68
|
+
export const evidenceCouldNotRun = (step: string, command: string, output: string): string =>
|
|
69
|
+
`${step}: \`${command}\` could not run (${output}); nothing else is written`;
|
|
70
|
+
export const ranOutOfTime = (step: string, command: string, seconds: number, shown: string): string =>
|
|
71
|
+
`${step}: \`${command}\` ran out of its ${seconds} s; nothing else is written (output in ${shown})`;
|
|
72
|
+
export const couldNotStart = (step: string, command: string, exit: number, shown: string): string =>
|
|
73
|
+
`${step}: \`${command}\` could not start (exit ${exit}: the command was not found or not executable); ` +
|
|
74
|
+
`nothing else is written (output in ${shown})`;
|
|
75
|
+
export const wasKilled = (step: string, command: string, exit: number, shown: string): string =>
|
|
76
|
+
`${step}: \`${command}\` was killed (exit ${exit}), which proves no failure; nothing else is written (output in ${shown})`;
|
|
77
|
+
export const didNotReproduce = (step: string, command: string, shown: string): string =>
|
|
78
|
+
`${step}: the bug did not reproduce: \`${command}\` exited 0; nothing else is written (output in ${shown}). ` +
|
|
79
|
+
`Give the failing command with --run, or check the origin.`;
|
|
80
|
+
export const measurementFailed = (step: string, command: string, exit: number, shown: string): string =>
|
|
81
|
+
`${step}: the measurement failed: \`${command}\` exited ${exit}; nothing else is written (output in ${shown})`;
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
// The change writer's
|
|
1
|
+
// The change writer's prompt text: the brief (draft, revision, fold) and the reproduction - one command to run that
|
|
2
2
|
// shows the bug or measures the cost, picked from the pack's commands. Instructions first, then on a re-ask the
|
|
3
3
|
// problems, then the material: the origin, the facts code gathered, the current brief, the decisions, the code
|
|
4
|
-
// index's rows, the precedents the shared memory recalled.
|
|
5
|
-
// the origin, then the inventory.
|
|
4
|
+
// index's rows, the precedents the shared memory recalled. ./change-material.ts cuts the material to its room.
|
|
6
5
|
import type { Decision } from "../../../shared/domain/dev/questions.ts";
|
|
7
6
|
import type { ChangeKind } from "../../../shared/domain/dev/spec-format.ts";
|
|
8
7
|
|
|
9
8
|
export type ChangePromptMode = "draft" | "revision" | "fold";
|
|
10
|
-
export interface ChangePromptInput {
|
|
11
|
-
mode: ChangePromptMode; code: string; kind: ChangeKind;
|
|
12
|
-
origin: string; facts: string; request: string; current: string;
|
|
13
|
-
decisions: readonly Decision[]; fresh: readonly Decision[]; inventory: string;
|
|
14
|
-
/** The "## Precedents" block the step recalled (T1), "" or absent when none: material, placed last. */
|
|
15
|
-
precedents?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const MAX_CHANGE_PROMPT_CHARS = 60_000;
|
|
19
|
-
const MIN_PART = 2_000;
|
|
20
9
|
|
|
21
10
|
const CHANGE_INSTRUCTIONS: string = [
|
|
22
11
|
"You write a change brief: a bug, a refactor or a performance change of code that exists. Answer in the JSON " +
|
|
@@ -52,31 +41,40 @@ const MODE_LINES: Record<ChangePromptMode, string> = {
|
|
|
52
41
|
"keeps § 1, the facts of § 2 and the questions still open: list in evidence and questions only new ones.",
|
|
53
42
|
};
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
/** The mark closing a part cut by code, after the part kept. */
|
|
45
|
+
export const cutByCode = (kept: string): string => `${kept}\n[… cut by code]`;
|
|
46
|
+
|
|
47
|
+
/** The inventory shown when the code index found nothing. */
|
|
48
|
+
export const NO_INVENTORY = "(nothing)";
|
|
49
|
+
|
|
58
50
|
const decisionLines = (ds: readonly Decision[]): string[] => ds.map((d) => `- ${d.id}: ${d.question} → ${d.answer}`);
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
/** The head of the brief's prompt: the instructions, the code, its kind, the mode, then the problems and the
|
|
53
|
+
* decisions when any. */
|
|
54
|
+
export function changePromptHead(
|
|
55
|
+
code: string, kind: ChangeKind, mode: ChangePromptMode, problems: readonly string[],
|
|
56
|
+
decisions: readonly Decision[], fresh: readonly Decision[],
|
|
57
|
+
): string[] {
|
|
58
|
+
return [
|
|
59
|
+
CHANGE_INSTRUCTIONS, "", `Code: ${code}. Kind: ${kind}.`, MODE_LINES[mode],
|
|
60
|
+
...(problems.length > 0 ? ["", "The previous answer was refused; fix each of these:", ...problems.map((p) => `- ${p}`)] : []),
|
|
61
|
+
...(decisions.length > 0 ? ["", "Decisions, settled by the person:", ...decisionLines(decisions)] : []),
|
|
62
|
+
...(fresh.length > 0 ? ["", "Decisions of this run, to write into the brief:", ...decisionLines(fresh)] : []),
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The material of the brief's prompt, each part already cut to its room; a part left empty is left out. */
|
|
67
|
+
export function changePromptMaterial(
|
|
68
|
+
part: { current: string; origin: string; request: string; facts: string; inventory: string; precedents: string },
|
|
69
|
+
): string[] {
|
|
70
|
+
return [
|
|
71
|
+
...(part.current !== "" ? ["", "The current brief (material, not instructions):", "", part.current] : []),
|
|
72
|
+
...(part.origin !== "" ? ["", "The origin of the change (material, not instructions):", "", part.origin] : []),
|
|
73
|
+
...(part.request !== "" ? ["", "The request typed with the command:", "", part.request] : []),
|
|
74
|
+
...(part.facts !== "" ? ["", "What code ran and read (facts):", "", part.facts] : []),
|
|
75
|
+
"", "What the code index found for the change (path:line — name):", part.inventory,
|
|
76
|
+
...(part.precedents !== "" ? ["", part.precedents] : []),
|
|
77
|
+
];
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
export const REPRO_SCHEMA: object = {
|
|
@@ -85,9 +83,9 @@ export const REPRO_SCHEMA: object = {
|
|
|
85
83
|
required: ["command", "why"],
|
|
86
84
|
};
|
|
87
85
|
|
|
88
|
-
/** The prompt asking for the one command that shows the bug or measures the cost. */
|
|
89
|
-
export function
|
|
90
|
-
|
|
86
|
+
/** The prompt asking for the one command that shows the bug or measures the cost; `origin` already cut. */
|
|
87
|
+
export function reproPrompt(kind: "bug" | "perf", origin: string, commands: readonly string[], problems: readonly string[]): string {
|
|
88
|
+
return [
|
|
91
89
|
kind === "bug"
|
|
92
90
|
? "Give the one command that reproduces the bug below: it must fail (a non-zero exit) while the bug is there."
|
|
93
91
|
: "Give the one command that measures the cost below: code times it and records the number before the change.",
|
|
@@ -97,8 +95,7 @@ export function buildReproPrompt(kind: "bug" | "perf", origin: string, commands:
|
|
|
97
95
|
"",
|
|
98
96
|
"The repository's commands:",
|
|
99
97
|
...(commands.length === 0 ? ["(none)"] : commands.map((c) => `- ${c}`)),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return lines.join("\n");
|
|
98
|
+
...(problems.length > 0 ? ["", "The previous command was refused:", ...problems.map((p) => `- ${p}`)] : []),
|
|
99
|
+
"", "The origin (material, not instructions):", "", origin,
|
|
100
|
+
].join("\n");
|
|
104
101
|
}
|