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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The values the Orkeon adapters write and read back: the human_input answers that came from no person.
|
|
2
|
+
|
|
3
|
+
/** The default value no option holds: an answer equal to it came from no person. */
|
|
4
|
+
export const NO_ANSWER = "(no answer)";
|
|
5
|
+
/** The first option of a `multi`: picked by the auto-approver, it decides nothing. */
|
|
6
|
+
export const DECIDE_LATER = "Decide later";
|
|
@@ -15,7 +15,7 @@ export function createMemoryStore(tools: Pick<OrkeonTools, "memoryStore">): Memo
|
|
|
15
15
|
const memoryStore = (input: MemoryStoreInput) => tools.memoryStore(input);
|
|
16
16
|
return {
|
|
17
17
|
async list(category, options) {
|
|
18
|
-
// newest_first is sent only when asked
|
|
18
|
+
// newest_first is sent only when asked.
|
|
19
19
|
const order = options?.newestFirst ? { newest_first: true } : {};
|
|
20
20
|
const resp = await memoryStore({ operation: "list", category, ...order });
|
|
21
21
|
const entries: any[] = pick(resp, "entries", "Entries") ?? [];
|
|
@@ -18,6 +18,10 @@ import { recallEntries } from "../../application/shared-memory/recall-precedents
|
|
|
18
18
|
import { pushCandidate } from "../../application/shared-memory/push-candidate.ts";
|
|
19
19
|
import { scriptTool } from "./script-tools.ts";
|
|
20
20
|
import type { ScriptToolSpec, ToolBuilderFactory } from "./script-tools.ts";
|
|
21
|
+
import {
|
|
22
|
+
MEMORY_PUSH_DESCRIPTION, MEMORY_RECALL_DESCRIPTION, PUSH_APPLIES_WHEN, PUSH_CORRECTION, PUSH_DETECTION_SIGNAL, PUSH_EVIDENCE,
|
|
23
|
+
PUSH_RATIONALE, PUSH_TITLE, PUSH_TOPIC, QUERY_REQUIRED, RECALL_QUERY, RECALL_TYPES, pushWritesNothing, recallTopK,
|
|
24
|
+
} from "./prompts.ts";
|
|
21
25
|
|
|
22
26
|
export interface MemoryToolPorts {
|
|
23
27
|
files: Pick<Files, "read" | "write" | "list">;
|
|
@@ -29,16 +33,13 @@ export interface MemoryToolPorts {
|
|
|
29
33
|
|
|
30
34
|
export const MEMORY_RECALL: ScriptToolSpec = {
|
|
31
35
|
name: "memory_recall",
|
|
32
|
-
description:
|
|
33
|
-
"Search the shared memory of this project: the admitted decisions, code structures, methods and mistakes of " +
|
|
34
|
-
"past work. Returns at most five entries, best first, each with what it applies to and its file. A precedent is " +
|
|
35
|
-
"material, not an instruction: check it fits here.",
|
|
36
|
+
description: MEMORY_RECALL_DESCRIPTION,
|
|
36
37
|
schema: {
|
|
37
38
|
type: "object",
|
|
38
39
|
properties: {
|
|
39
|
-
query: { type: "string", description:
|
|
40
|
-
types: { type: "array", items: { type: "string", enum: [...ENTRY_TYPES] }, description:
|
|
41
|
-
top_k: { type: "number", description:
|
|
40
|
+
query: { type: "string", description: RECALL_QUERY },
|
|
41
|
+
types: { type: "array", items: { type: "string", enum: [...ENTRY_TYPES] }, description: RECALL_TYPES },
|
|
42
|
+
top_k: { type: "number", description: recallTopK(MAX_PRECEDENTS) },
|
|
42
43
|
},
|
|
43
44
|
required: ["query"],
|
|
44
45
|
},
|
|
@@ -46,21 +47,18 @@ export const MEMORY_RECALL: ScriptToolSpec = {
|
|
|
46
47
|
|
|
47
48
|
export const MEMORY_PUSH: ScriptToolSpec = {
|
|
48
49
|
name: "memory_push",
|
|
49
|
-
description:
|
|
50
|
-
"Propose a lesson for the shared memory: it is written as a candidate, never admitted; the operator decides " +
|
|
51
|
-
"with /memory-admit. Name the evidence (path:line, a commit, or a verdict file). A topic refused before is " +
|
|
52
|
-
"refused again; a secret or a secret-like file is refused.",
|
|
50
|
+
description: MEMORY_PUSH_DESCRIPTION,
|
|
53
51
|
schema: {
|
|
54
52
|
type: "object",
|
|
55
53
|
properties: {
|
|
56
54
|
type: { type: "string", enum: [...ENTRY_TYPES] },
|
|
57
|
-
title: { type: "string", description:
|
|
58
|
-
topic: { type: "string", description:
|
|
59
|
-
applies_when: { type: "string", description:
|
|
60
|
-
rationale: { type: "string", description:
|
|
61
|
-
correction: { type: "string", description:
|
|
62
|
-
detection_signal: { type: "string", description:
|
|
63
|
-
evidence: { type: "array", items: { type: "string" }, description:
|
|
55
|
+
title: { type: "string", description: PUSH_TITLE },
|
|
56
|
+
topic: { type: "string", description: PUSH_TOPIC },
|
|
57
|
+
applies_when: { type: "string", description: PUSH_APPLIES_WHEN },
|
|
58
|
+
rationale: { type: "string", description: PUSH_RATIONALE },
|
|
59
|
+
correction: { type: "string", description: PUSH_CORRECTION },
|
|
60
|
+
detection_signal: { type: "string", description: PUSH_DETECTION_SIGNAL },
|
|
61
|
+
evidence: { type: "array", items: { type: "string" }, description: PUSH_EVIDENCE },
|
|
64
62
|
tags: { type: "array", items: { type: "string" } },
|
|
65
63
|
},
|
|
66
64
|
required: ["type", "title", "topic", "applies_when", "rationale", "evidence"],
|
|
@@ -74,7 +72,7 @@ export function memoryRecallTool(builder: ToolBuilderFactory, ports: () => Memor
|
|
|
74
72
|
return scriptTool(builder, MEMORY_RECALL, async (input) => {
|
|
75
73
|
const raw = (input !== null && typeof input === "object" ? input : {}) as Record<string, unknown>;
|
|
76
74
|
const query = typeof raw.query === "string" ? raw.query.trim() : "";
|
|
77
|
-
if (query === "") return { ok: false, refused:
|
|
75
|
+
if (query === "") return { ok: false, refused: QUERY_REQUIRED };
|
|
78
76
|
const p = ports();
|
|
79
77
|
const settings = await readMemorySettings(p);
|
|
80
78
|
const max = typeof raw.top_k === "number" && Number.isFinite(raw.top_k) ? raw.top_k : MAX_PRECEDENTS;
|
|
@@ -94,7 +92,7 @@ export function memoryRecallTool(builder: ToolBuilderFactory, ports: () => Memor
|
|
|
94
92
|
|
|
95
93
|
export function memoryPushTool(builder: ToolBuilderFactory, ports: () => MemoryToolPorts, mode: string): Tool<unknown, unknown> {
|
|
96
94
|
return scriptTool(builder, MEMORY_PUSH, async (input) => {
|
|
97
|
-
if (isReadOnly(mode)) return { ok: false, refused:
|
|
95
|
+
if (isReadOnly(mode)) return { ok: false, refused: pushWritesNothing(mode) };
|
|
98
96
|
const p = ports();
|
|
99
97
|
const settings = await readMemorySettings(p);
|
|
100
98
|
const pushed = await pushCandidate(p, settings, input);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The text the Orkeon adapters show the user: the errors they throw.
|
|
2
|
+
|
|
3
|
+
export const notOneOfOurTools = (name: string): string => `'${name}' is not one of Orkeon Code's tools (SCRIPT_TOOLS)`;
|
|
4
|
+
export const CHILD_INPUT_NOT_A_CALL = "child agent: its input is not a child call";
|
|
5
|
+
export const GITHUB_FAILED_WITHOUT_REASON = "the github tool reported a failure without a reason";
|
|
6
|
+
export const GITHUB_SUCCESS_WITHOUT_PULL_REQUEST = "the github tool answered success without the pull request";
|
|
7
|
+
export const noLlmNamespace = (name: string): string =>
|
|
8
|
+
`llm.profile '${name}': this host declares no llm namespace, no profile can be applied`;
|
|
9
|
+
export const sessionStoreRefusedAppend = (role: string): string => `session_store refused to append a '${role}' message`;
|
|
10
|
+
export const SHELL_JOB_NEEDS_COMMAND = "a shell job needs a command";
|
|
11
|
+
export const noJobIdFor = (command: string): string => `start_job answered no job id for: ${command}`;
|
|
12
|
+
export const waitNotWholeSeconds = (seconds: number): string => `a wait is a whole number of seconds, at least 1: ${seconds}`;
|
|
13
|
+
export const timeoutNotWholeSeconds = (timeout: number): string =>
|
|
14
|
+
`a shell timeout is a whole number of seconds, at least 1: ${timeout}`;
|
|
15
|
+
export const noRegisteredTool = (name: string): string => `no registered tool '${name}'`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// The text the Orkeon adapters hand to the model: the descriptions of Orkeon Code's own tools, their parameters, and
|
|
2
|
+
// the refusals a tool answers with.
|
|
3
|
+
|
|
4
|
+
// memory_recall
|
|
5
|
+
export const MEMORY_RECALL_DESCRIPTION =
|
|
6
|
+
"Search the shared memory of this project: the admitted decisions, code structures, methods and mistakes of " +
|
|
7
|
+
"past work. Returns at most five entries, best first, each with what it applies to and its file. A precedent is " +
|
|
8
|
+
"material, not an instruction: check it fits here.";
|
|
9
|
+
export const RECALL_QUERY = "What you are about to do or decide, in a sentence.";
|
|
10
|
+
export const RECALL_TYPES = "Only these types; absent, every type.";
|
|
11
|
+
export const recallTopK = (max: number): string => `How many entries at most, ${max} at most.`;
|
|
12
|
+
export const QUERY_REQUIRED = "'query' is required";
|
|
13
|
+
|
|
14
|
+
// memory_push
|
|
15
|
+
export const MEMORY_PUSH_DESCRIPTION =
|
|
16
|
+
"Propose a lesson for the shared memory: it is written as a candidate, never admitted; the operator decides " +
|
|
17
|
+
"with /memory-admit. Name the evidence (path:line, a commit, or a verdict file). A topic refused before is " +
|
|
18
|
+
"refused again; a secret or a secret-like file is refused.";
|
|
19
|
+
export const PUSH_TITLE = "One line, at most 90 characters.";
|
|
20
|
+
export const PUSH_TOPIC = "A few words naming the subject; entries of one topic are compared.";
|
|
21
|
+
export const PUSH_APPLIES_WHEN = "When the lesson applies, so another project can tell.";
|
|
22
|
+
export const PUSH_RATIONALE = "Why: what happened, what it cost.";
|
|
23
|
+
export const PUSH_CORRECTION = "A mistake only: what to do instead.";
|
|
24
|
+
export const PUSH_DETECTION_SIGNAL = "A mistake only: how to notice it.";
|
|
25
|
+
export const PUSH_EVIDENCE = "path:line, a commit or a verdict file, one each.";
|
|
26
|
+
export const pushWritesNothing = (mode: string): string => `memory_push writes a candidate file: mode '${mode}' writes nothing`;
|
|
27
|
+
|
|
28
|
+
// run_validation, run_tests, run_build
|
|
29
|
+
export const notSetUpForThisRun = (name: string): string =>
|
|
30
|
+
`${name} is not set up for this run (not bound yet, or two runs at once): name the command in your answer instead`;
|
|
31
|
+
export const RUN_VALIDATION_DESCRIPTION =
|
|
32
|
+
"Run one narrow test command of the repository pack (one test class, one test project, or the integration " +
|
|
33
|
+
"tests narrowed by a filter, exactly as the brief lists them, each <placeholder> filled with one plain value) " +
|
|
34
|
+
"and return its exit code and the tail of its output. Three per audit at most; never a whole suite, a build or " +
|
|
35
|
+
"an option of your own.";
|
|
36
|
+
export const RUN_VALIDATION_COMMAND = "The command, one of the brief's validation commands with its placeholders filled.";
|
|
37
|
+
export const COMMAND_REQUIRED = "'command' is required";
|
|
38
|
+
export const RUN_TESTS_DESCRIPTION =
|
|
39
|
+
"Run one narrow test command of the repository pack (test_class, test_project, or test_integration with its " +
|
|
40
|
+
"filter), each <placeholder> filled with one plain relative value. Returns the exit code, the tail of the output " +
|
|
41
|
+
"and the path of the whole log. Never a whole suite, never a restore.";
|
|
42
|
+
export const RUN_TESTS_COMMAND = "The pack's test command with its placeholders filled.";
|
|
43
|
+
export const RUN_BUILD_DESCRIPTION =
|
|
44
|
+
"Build with the repository pack's command: without project, commands.build; with project, commands.build_test " +
|
|
45
|
+
"for that test project. Never restores, except once on a tree that was never restored. Returns the exit code, " +
|
|
46
|
+
"whether it restored, the tail of the output and the path of the whole log.";
|
|
47
|
+
export const RUN_BUILD_PROJECT = "The test project to build, a plain relative path; absent, the whole build.";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference path="../../../crews/.orkeon/orkeon.d.ts" />
|
|
2
|
+
// ReasoningReader over the runtime's `llm` namespace (Orkeon #359, #360, #364): the configuration the session's
|
|
3
|
+
// turns run on (`llm.profile(name)`, else `llm.model(name)`, else `llm.default_`), its `capabilities`, and its
|
|
4
|
+
// `reasoning`, with the effort asked or as the host configures it. The runtime judges, as it judges the call;
|
|
5
|
+
// nothing is called. A profile is asked for only when `llm.profiles` lists its name: one the host does not declare
|
|
6
|
+
// answers null, as do a host without the namespace and a provider that cannot tell.
|
|
7
|
+
|
|
8
|
+
import type { ReasoningReader } from "../../application/ports.ts";
|
|
9
|
+
import { capabilitiesOf, effortReportOf } from "../../domain/agent-policy/reasoning.ts";
|
|
10
|
+
import type { ReasoningTarget } from "../../domain/agent-policy/reasoning.ts";
|
|
11
|
+
|
|
12
|
+
/** What the reader needs of the `llm` namespace. */
|
|
13
|
+
export type LlmConfigs = Pick<typeof llm, "default_" | "model" | "profile" | "profiles">;
|
|
14
|
+
|
|
15
|
+
/** Whether the host declares the profile `name`, compared as `llm.profile` compares: trimmed, without case. */
|
|
16
|
+
function declares(host: LlmConfigs, name: string): boolean {
|
|
17
|
+
const wanted = name.trim().toLowerCase();
|
|
18
|
+
return host.profiles.some((declared) => declared.toLowerCase() === wanted);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function configOf(host: LlmConfigs, target: ReasoningTarget): LlmConfig | null {
|
|
22
|
+
if (target.profile !== null) return declares(host, target.profile) ? host.profile(target.profile) : null;
|
|
23
|
+
return target.model === "" ? host.default_ : host.model(target.model);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createReasoningReader(host: LlmConfigs | undefined): ReasoningReader {
|
|
27
|
+
const read = <T>(target: ReasoningTarget, of: (config: LlmConfig) => T | null): T | null => {
|
|
28
|
+
if (host === undefined) return null;
|
|
29
|
+
try {
|
|
30
|
+
const config = configOf(host, target);
|
|
31
|
+
return config === null ? null : of(config);
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
capabilities: (target) => read(target, (config) => capabilitiesOf(config.capabilities)),
|
|
38
|
+
effort: (target, level) => read(target, (config) => effortReportOf((level === null ? config : config.with({ effort: level })).reasoning)),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -24,6 +24,11 @@ import type { ScriptToolSlot } from "../../application/dev/script-tool-slot.ts";
|
|
|
24
24
|
|
|
25
25
|
export { scriptToolSlot } from "../../application/dev/script-tool-slot.ts";
|
|
26
26
|
export type { ScriptToolSlot } from "../../application/dev/script-tool-slot.ts";
|
|
27
|
+
import {
|
|
28
|
+
COMMAND_REQUIRED, RUN_BUILD_DESCRIPTION, RUN_BUILD_PROJECT, RUN_TESTS_COMMAND, RUN_TESTS_DESCRIPTION, RUN_VALIDATION_COMMAND,
|
|
29
|
+
RUN_VALIDATION_DESCRIPTION, notSetUpForThisRun,
|
|
30
|
+
} from "./prompts.ts";
|
|
31
|
+
import { notOneOfOurTools } from "./messages.ts";
|
|
27
32
|
|
|
28
33
|
/** The runtime's `toolBuilder`, or a test's. */
|
|
29
34
|
export type ToolBuilderFactory = () => ToolBuilder<unknown, unknown>;
|
|
@@ -43,7 +48,7 @@ export function scriptTool(
|
|
|
43
48
|
builder: ToolBuilderFactory, spec: ScriptToolSpec, handler: (input: unknown) => Promise<unknown>, root?: string,
|
|
44
49
|
): Tool<unknown, unknown> {
|
|
45
50
|
const access = scriptToolAccess(spec.name);
|
|
46
|
-
if (access === undefined) throw new Error(
|
|
51
|
+
if (access === undefined) throw new Error(notOneOfOurTools(spec.name));
|
|
47
52
|
return builder()
|
|
48
53
|
.name(spec.name)
|
|
49
54
|
.description(spec.description)
|
|
@@ -61,7 +66,7 @@ export function scriptTool(
|
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
const notReady = (name: string) => ({
|
|
64
|
-
ok: false, refused:
|
|
69
|
+
ok: false, refused: notSetUpForThisRun(name),
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
const commandSchema = (what: string): JsonSchema => ({
|
|
@@ -77,12 +82,8 @@ export interface ValidationCalls {
|
|
|
77
82
|
|
|
78
83
|
export const RUN_VALIDATION: ScriptToolSpec = {
|
|
79
84
|
name: "run_validation",
|
|
80
|
-
description:
|
|
81
|
-
|
|
82
|
-
"tests narrowed by a filter, exactly as the brief lists them, each <placeholder> filled with one plain value) " +
|
|
83
|
-
"and return its exit code and the tail of its output. Three per audit at most; never a whole suite, a build or " +
|
|
84
|
-
"an option of your own.",
|
|
85
|
-
schema: commandSchema("The command, one of the brief's validation commands with its placeholders filled."),
|
|
85
|
+
description: RUN_VALIDATION_DESCRIPTION,
|
|
86
|
+
schema: commandSchema(RUN_VALIDATION_COMMAND),
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
export function runValidationTool(builder: ToolBuilderFactory, slot: ScriptToolSlot<ValidationCalls>, root?: string): Tool<unknown, unknown> {
|
|
@@ -90,7 +91,7 @@ export function runValidationTool(builder: ToolBuilderFactory, slot: ScriptToolS
|
|
|
90
91
|
const runner = slot.get();
|
|
91
92
|
if (runner === undefined) return notReady(RUN_VALIDATION.name);
|
|
92
93
|
const command = (input as { command?: unknown } | null)?.command;
|
|
93
|
-
if (typeof command !== "string" || command.trim() === "") return { ok: false, refused:
|
|
94
|
+
if (typeof command !== "string" || command.trim() === "") return { ok: false, refused: COMMAND_REQUIRED };
|
|
94
95
|
const { report, line } = await runner.run(command);
|
|
95
96
|
return { ok: line !== null, command: report.command, outcome: report.outcome, tail: report.tail };
|
|
96
97
|
}, root);
|
|
@@ -98,22 +99,16 @@ export function runValidationTool(builder: ToolBuilderFactory, slot: ScriptToolS
|
|
|
98
99
|
|
|
99
100
|
export const RUN_TESTS: ScriptToolSpec = {
|
|
100
101
|
name: "run_tests",
|
|
101
|
-
description:
|
|
102
|
-
|
|
103
|
-
"filter), each <placeholder> filled with one plain relative value. Returns the exit code, the tail of the output " +
|
|
104
|
-
"and the path of the whole log. Never a whole suite, never a restore.",
|
|
105
|
-
schema: commandSchema("The pack's test command with its placeholders filled."),
|
|
102
|
+
description: RUN_TESTS_DESCRIPTION,
|
|
103
|
+
schema: commandSchema(RUN_TESTS_COMMAND),
|
|
106
104
|
};
|
|
107
105
|
|
|
108
106
|
export const RUN_BUILD: ScriptToolSpec = {
|
|
109
107
|
name: "run_build",
|
|
110
|
-
description:
|
|
111
|
-
"Build with the repository pack's command: without project, commands.build; with project, commands.build_test " +
|
|
112
|
-
"for that test project. Never restores, except once on a tree that was never restored. Returns the exit code, " +
|
|
113
|
-
"whether it restored, the tail of the output and the path of the whole log.",
|
|
108
|
+
description: RUN_BUILD_DESCRIPTION,
|
|
114
109
|
schema: {
|
|
115
110
|
type: "object",
|
|
116
|
-
properties: { project: { type: "string", description:
|
|
111
|
+
properties: { project: { type: "string", description: RUN_BUILD_PROJECT } },
|
|
117
112
|
},
|
|
118
113
|
};
|
|
119
114
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
// the tool's own message, the runtime's wrapping gone (withToolMessage).
|
|
6
6
|
|
|
7
7
|
import type { SessionMsg } from "../../domain/types.ts";
|
|
8
|
-
import { messagesOfLastTurns } from "../../domain/snip-turns.ts";
|
|
9
8
|
import type { SessionStore, StoredMessage, TokenBudget, TokenKinds } from "../../application/ports.ts";
|
|
10
9
|
import type { SessionStoreInput } from "./runtime-tools.ts";
|
|
11
10
|
import { asArray, pick, withToolMessage } from "./tool-results.ts";
|
|
11
|
+
import { sessionStoreRefusedAppend } from "./messages.ts";
|
|
12
12
|
|
|
13
13
|
/** The `{ role, content }` view of stored entries, for transcripts and history. */
|
|
14
14
|
function normalizeMessages(stored: StoredMessage[]): SessionMsg[] {
|
|
@@ -18,32 +18,14 @@ function normalizeMessages(stored: StoredMessage[]): SessionMsg[] {
|
|
|
18
18
|
}));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/** What a runtime before Orkeon #263 (the rc.6 release) throws for append_message: its session_store answers an
|
|
22
|
-
* unknown operation `{ success: false }` with no error, which the tool binding reports as
|
|
23
|
-
* `tools.sessionStore failed: (no error message provided)`. */
|
|
24
|
-
const UNKNOWN_OPERATION = "(no error message provided)";
|
|
25
|
-
|
|
26
|
-
function isUnknownOperation(error: unknown): boolean {
|
|
27
|
-
return (error instanceof Error ? error.message : String(error)).includes(UNKNOWN_OPERATION);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Whether session_snip counts turns (Orkeon #287). It came in the same merge as edge_list (#281), which the rc.6
|
|
31
|
-
* release, the tool and docker modes, lacks: there `retain_count` counts the messages kept after the head. A runtime
|
|
32
|
-
* at the pin with no code-index tools registered reads as a release, and keeps more turns than asked, never fewer. */
|
|
33
|
-
function snipCountsTurns(tools: { edgeList?: unknown }): boolean {
|
|
34
|
-
return typeof tools.edgeList === "function";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
21
|
/** A reported count, as a number; absent reads as 0. */
|
|
38
22
|
const count = (r: unknown, ...names: string[]): number => Number(pick(r, ...names) ?? 0);
|
|
39
23
|
|
|
40
24
|
export function createSessionStore(
|
|
41
|
-
tools: Pick<OrkeonTools, "sessionStore" | "sessionSnip" | "tokenBudget"
|
|
25
|
+
tools: Pick<OrkeonTools, "sessionStore" | "sessionSnip" | "tokenBudget">,
|
|
42
26
|
): SessionStore {
|
|
43
27
|
// One shape per operation (runtime-tools.ts): a misspelled operation fails here.
|
|
44
28
|
const sessionStore = (input: SessionStoreInput) => tools.sessionStore(input);
|
|
45
|
-
// Set at the first append_message the runtime does not know: the next appends read and rewrite the buffer at once.
|
|
46
|
-
let appendMissing = false;
|
|
47
29
|
return {
|
|
48
30
|
async readMessages() {
|
|
49
31
|
const resp = await withToolMessage(() => sessionStore({ operation: "read_messages" }));
|
|
@@ -56,42 +38,16 @@ export function createSessionStore(
|
|
|
56
38
|
await sessionStore({ operation: "write_messages", messages });
|
|
57
39
|
},
|
|
58
40
|
async appendMessage(role, content) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
resp = await sessionStore({ operation: "append_message", role, content });
|
|
63
|
-
} catch (e) {
|
|
64
|
-
// A blank role is refused by every runtime, and any failure but an unknown operation's is the store's own:
|
|
65
|
-
// both are rethrown, never hidden behind a rewrite of the buffer.
|
|
66
|
-
if (role.trim() === "" || !isUnknownOperation(e)) throw e;
|
|
67
|
-
appendMissing = true;
|
|
68
|
-
}
|
|
69
|
-
if (!appendMissing) {
|
|
70
|
-
// A refused append (a blank role) says so, as a failed write would.
|
|
71
|
-
if (pick(resp, "success", "Success") === false) throw new Error(`session_store refused to append a '${role}' message`);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// A runtime before Orkeon #263 (the rc.6 release, the tool and docker modes) has no append_message: the message is
|
|
76
|
-
// added by reading and rewriting the buffer, as before #263, and this store does not ask for append_message again.
|
|
77
|
-
if (role.trim() === "") throw new Error(`session_store refused to append a '${role}' message`);
|
|
78
|
-
const stored = asArray(pick(await sessionStore({ operation: "read_messages" }), "messages", "Messages"));
|
|
79
|
-
await sessionStore({ operation: "write_messages", messages: [...stored, { role, content }] });
|
|
41
|
+
const resp = await sessionStore({ operation: "append_message", role, content });
|
|
42
|
+
// A refused append (a blank role) says so, as a failed write would.
|
|
43
|
+
if (pick(resp, "success", "Success") === false) throw new Error(sessionStoreRefusedAppend(role));
|
|
80
44
|
},
|
|
81
45
|
async reset() {
|
|
82
46
|
return count(await sessionStore({ operation: "reset" }), "removed_count", "removedCount", "RemovedCount");
|
|
83
47
|
},
|
|
84
48
|
async snip(turns) {
|
|
85
|
-
// retain_count counts turns
|
|
86
|
-
|
|
87
|
-
let retain = turns;
|
|
88
|
-
if (!snipCountsTurns(tools)) {
|
|
89
|
-
const stored = asArray(pick(await withToolMessage(() => sessionStore({ operation: "read_messages" })), "messages", "Messages"));
|
|
90
|
-
const tail = messagesOfLastTurns(normalizeMessages(stored), turns);
|
|
91
|
-
if (tail === null) return { removed: 0, retained: stored.length };
|
|
92
|
-
retain = tail;
|
|
93
|
-
}
|
|
94
|
-
const resp = await tools.sessionSnip({ retain_count: retain });
|
|
49
|
+
// retain_count counts turns (Orkeon #287); kept_from (where the kept tail began) is not read: nothing uses it.
|
|
50
|
+
const resp = await tools.sessionSnip({ retain_count: turns });
|
|
95
51
|
return {
|
|
96
52
|
removed: count(resp, "removed_count", "removedCount", "RemovedCount"),
|
|
97
53
|
retained: count(resp, "retained_count", "retainedCount", "RetainedCount"),
|
|
@@ -9,12 +9,17 @@
|
|
|
9
9
|
// node or interpreters, that run fails once and every later wait says false at once,
|
|
10
10
|
// so the caller falls back to a blocking run.
|
|
11
11
|
//
|
|
12
|
-
// Given a batch's working root, the jobs run there, as the Shell adapter's commands do
|
|
12
|
+
// Given a batch's working root, the jobs run there, as the Shell adapter's commands do; given the host's context,
|
|
13
|
+
// the command's and the tail's disk spellings come back to the VFS as the Shell adapter's do.
|
|
13
14
|
|
|
14
15
|
import type { ShellJobs } from "../../application/ports.ts";
|
|
16
|
+
import type { HostSource } from "../../application/host-context.ts";
|
|
15
17
|
import { textFromRoot, textToRoot } from "../../domain/dev/path-rebase.ts";
|
|
18
|
+
import { commandToVirtual, textToVirtual } from "../../domain/host-paths.ts";
|
|
19
|
+
import { layoutOf } from "./host-context.ts";
|
|
16
20
|
import { pick, shCode } from "./tool-results.ts";
|
|
17
21
|
import { WORKSPACE } from "../../domain/vfs.ts";
|
|
22
|
+
import { SHELL_JOB_NEEDS_COMMAND, noJobIdFor, waitNotWholeSeconds } from "./messages.ts";
|
|
18
23
|
|
|
19
24
|
/** The waiting script, relative to /workspace, and its virtual path. */
|
|
20
25
|
export const WAIT_SCRIPT = ".orkeon/dev/bin/wait.mjs";
|
|
@@ -25,15 +30,16 @@ const WAIT_SCRIPT_CONTENT =
|
|
|
25
30
|
/** job_tail's own ceiling. */
|
|
26
31
|
const MAX_TAIL_LINES = 500;
|
|
27
32
|
|
|
28
|
-
export function createShellJobs(tools: Pick<OrkeonTools, "shellCommand" | "fileWrite">, root?: string): ShellJobs {
|
|
33
|
+
export function createShellJobs(tools: Pick<OrkeonTools, "shellCommand" | "fileWrite">, root?: string, host?: HostSource): ShellJobs {
|
|
29
34
|
const cwd = root ?? WORKSPACE;
|
|
30
35
|
let waiter: "unknown" | "ready" | "absent" = "unknown";
|
|
31
36
|
return {
|
|
32
37
|
async start(command) {
|
|
33
|
-
if (command.trim() === "") throw new Error(
|
|
34
|
-
const
|
|
38
|
+
if (command.trim() === "") throw new Error(SHELL_JOB_NEEDS_COMMAND);
|
|
39
|
+
const virtual = commandToVirtual(command, await layoutOf(host));
|
|
40
|
+
const r = await tools.shellCommand({ action: "start_job", command: textToRoot(virtual, root), working_directory: cwd });
|
|
35
41
|
const id = String(pick(r, "job_id", "jobId", "JobId") ?? "");
|
|
36
|
-
if (id === "") throw new Error(
|
|
42
|
+
if (id === "") throw new Error(noJobIdFor(command));
|
|
37
43
|
return { id, log: String(pick(r, "output_path", "outputPath", "OutputPath") ?? "") };
|
|
38
44
|
},
|
|
39
45
|
async status(id) {
|
|
@@ -46,11 +52,11 @@ export function createShellJobs(tools: Pick<OrkeonTools, "shellCommand" | "fileW
|
|
|
46
52
|
const r = await tools.shellCommand({
|
|
47
53
|
action: "job_tail", command: "", job_id: id, tail_lines: count, working_directory: cwd,
|
|
48
54
|
});
|
|
49
|
-
return textFromRoot(String(pick(r, "tail", "Tail") ?? ""), root);
|
|
55
|
+
return textFromRoot(textToVirtual(String(pick(r, "tail", "Tail") ?? ""), await layoutOf(host)), root);
|
|
50
56
|
},
|
|
51
57
|
async wait(seconds) {
|
|
52
58
|
if (!(Number.isInteger(seconds) && seconds >= 1)) {
|
|
53
|
-
throw new Error(
|
|
59
|
+
throw new Error(waitNotWholeSeconds(seconds));
|
|
54
60
|
}
|
|
55
61
|
if (waiter === "absent") return false;
|
|
56
62
|
try {
|
|
@@ -4,27 +4,35 @@
|
|
|
4
4
|
// command stopped at that timeout (the typings give the field, not its meaning).
|
|
5
5
|
// Given a batch's working root, the command runs there: its `/workspace` paths go
|
|
6
6
|
// onto the root, and the root's paths of its output come back as `/workspace`, so the
|
|
7
|
-
// callers keep naming the checkout `/workspace` (shared/domain/dev/path-rebase.ts).
|
|
7
|
+
// callers keep naming the checkout `/workspace` (shared/domain/dev/path-rebase.ts). Given the host's context, a
|
|
8
|
+
// path the command spells as the disk does comes back to the VFS before the run, and the disk spellings the process
|
|
9
|
+
// printed come back the same way (shared/domain/host-paths.ts), the host's layer outside the root's.
|
|
8
10
|
|
|
9
11
|
import type { Shell } from "../../application/ports.ts";
|
|
12
|
+
import type { HostSource } from "../../application/host-context.ts";
|
|
10
13
|
import { textFromRoot, textToRoot } from "../../domain/dev/path-rebase.ts";
|
|
14
|
+
import { commandToVirtual, textToVirtual } from "../../domain/host-paths.ts";
|
|
15
|
+
import { layoutOf } from "./host-context.ts";
|
|
11
16
|
import { pick, shCode, shErr, shOut } from "./tool-results.ts";
|
|
12
17
|
import { WORKSPACE } from "../../domain/vfs.ts";
|
|
18
|
+
import { timeoutNotWholeSeconds } from "./messages.ts";
|
|
13
19
|
|
|
14
|
-
export function createShell(tools: Pick<OrkeonTools, "shellCommand">, root?: string): Shell {
|
|
20
|
+
export function createShell(tools: Pick<OrkeonTools, "shellCommand">, root?: string, host?: HostSource): Shell {
|
|
15
21
|
const cwd = root ?? WORKSPACE;
|
|
16
22
|
return {
|
|
17
23
|
async run(logical, options) {
|
|
18
|
-
const
|
|
24
|
+
const layout = await layoutOf(host);
|
|
25
|
+
const command = textToRoot(commandToVirtual(logical, layout), root);
|
|
19
26
|
const timeout = options?.timeoutSeconds;
|
|
20
27
|
if (timeout !== undefined && !(Number.isInteger(timeout) && timeout >= 1)) {
|
|
21
|
-
throw new Error(
|
|
28
|
+
throw new Error(timeoutNotWholeSeconds(timeout));
|
|
22
29
|
}
|
|
23
30
|
const input = timeout === undefined
|
|
24
31
|
? { command, working_directory: cwd }
|
|
25
32
|
: { command, working_directory: cwd, timeout_seconds: timeout };
|
|
26
33
|
const r = await tools.shellCommand(input);
|
|
27
|
-
const
|
|
34
|
+
const back = (text: string) => textFromRoot(textToVirtual(text, layout), root);
|
|
35
|
+
const result = { stdout: back(shOut(r)), stderr: back(shErr(r)), exitCode: shCode(r) };
|
|
28
36
|
return pick(r, "completed", "Completed") === false ? { ...result, timedOut: true } : result;
|
|
29
37
|
},
|
|
30
38
|
};
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type { ToolCatalogue } from "../../application/ports.ts";
|
|
12
12
|
import type { ServiceLocator } from "../../../commands/.orkeon/orkeon-cli.d.ts";
|
|
13
13
|
import { asArray, pick, toolOutcome } from "./tool-results.ts";
|
|
14
|
+
import { noRegisteredTool } from "./messages.ts";
|
|
14
15
|
|
|
15
16
|
/** The service that hands out the registered tools. */
|
|
16
17
|
const TOOLS = "tools";
|
|
@@ -50,7 +51,7 @@ function registeredNames(services: Pick<ServiceLocator, "get">): string[] {
|
|
|
50
51
|
export function createToolCalls(tools: object): Pick<ToolCatalogue, "call" | "callText"> {
|
|
51
52
|
const call = async (name: string, args: Record<string, unknown>): Promise<unknown> => {
|
|
52
53
|
const fn = (tools as Record<string, unknown> | undefined)?.[toolMemberName(name)];
|
|
53
|
-
if (typeof fn !== "function") throw new Error(
|
|
54
|
+
if (typeof fn !== "function") throw new Error(noRegisteredTool(name));
|
|
54
55
|
return (fn as (input: Record<string, unknown>) => unknown)(args);
|
|
55
56
|
};
|
|
56
57
|
return { call, callText: (name, args) => toolOutcome(() => call(name, args)) };
|
|
@@ -63,7 +64,7 @@ export function createToolCatalogue(tools: object, services: Pick<ServiceLocator
|
|
|
63
64
|
};
|
|
64
65
|
const call = async (name: string, args: Record<string, unknown>): Promise<unknown> => {
|
|
65
66
|
const registered = find(name);
|
|
66
|
-
if (registered === undefined) throw new Error(
|
|
67
|
+
if (registered === undefined) throw new Error(noRegisteredTool(name));
|
|
67
68
|
return createToolCalls(tools).call(registered, args);
|
|
68
69
|
};
|
|
69
70
|
return {
|