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
|
@@ -11,3 +11,28 @@ export interface HumanInput {
|
|
|
11
11
|
/** Several of `options`, none recommended: the options picked, in the order given. */
|
|
12
12
|
multi(prompt: string, options: readonly string[]): Promise<{ answered: true; values: string[] } | { answered: false }>;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/** One option of a `Chooser` question. */
|
|
16
|
+
export interface ChoiceOption {
|
|
17
|
+
value: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Aligned in a column after the label. */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** The value in force, marked in the list and selected on opening. */
|
|
22
|
+
current?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ChoiceQuestion {
|
|
26
|
+
message: string;
|
|
27
|
+
options: readonly ChoiceOption[];
|
|
28
|
+
/** A second value, adjusted with the side arrows while an option is selected. */
|
|
29
|
+
control?: { label: string; values: readonly string[]; value: string };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A choice made in the console's own panel, for a command typed at the prompt. Unlike `HumanInput`, which a crew's
|
|
33
|
+
* tool call goes through, it can be left: `null` is the person leaving, and nothing is to change. */
|
|
34
|
+
export interface Chooser {
|
|
35
|
+
/** False on a replay or a plain console: the command keeps its behaviour without a panel. */
|
|
36
|
+
readonly interactive: boolean;
|
|
37
|
+
choose(question: ChoiceQuestion): Promise<{ value: string; control: string | null } | null>;
|
|
38
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
// The model port: the agentic call, the completion and the extraction, with their per-call settings.
|
|
2
2
|
// Types only, re-exported by ../ports.ts.
|
|
3
|
+
import type { EffortLevel } from "../../domain/agent-policy/behavior-flags.ts";
|
|
4
|
+
import type { EffortReport, ReasoningCapabilities, ReasoningTarget } from "../../domain/agent-policy/reasoning.ts";
|
|
5
|
+
import type { ContextPressure, PressureSettings, PruneVerdict } from "../../domain/context-prune.ts";
|
|
3
6
|
|
|
4
7
|
/** What one model call may change, for that call only. */
|
|
5
8
|
export interface ModelOverride {
|
|
6
9
|
/** The model to answer with; the host's provider keeps its credentials and
|
|
7
10
|
* endpoint. Empty or absent: the model the host booted with. */
|
|
8
11
|
model?: string;
|
|
12
|
+
/** The host profile (`Llm:Profiles:<name>`, or a decision profile) this one call runs on, `model` then choosing
|
|
13
|
+
* the model within it. Empty or absent: the agent's own profile. A name the host does not declare throws. */
|
|
14
|
+
profile?: string;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
/** The settings of one completion. */
|
|
@@ -28,11 +34,18 @@ export interface ActRequest extends ModelOverride {
|
|
|
28
34
|
maxIterations?: number;
|
|
29
35
|
/** The mode the host's permission gate applies to each tool call. */
|
|
30
36
|
permissionMode?: string;
|
|
31
|
-
/** The provider's thinking at this level (`act({effort})`); none when absent. A provider
|
|
32
|
-
* not
|
|
33
|
-
|
|
37
|
+
/** The provider's thinking at this level (`act({effort})`); none when absent. A level the provider or the model
|
|
38
|
+
* does not take is sent as another one (the highest it takes below, else the lowest it takes) or dropped by the
|
|
39
|
+
* runtime, with a warning in its log: `Llm.effortSent` says which. */
|
|
40
|
+
effort?: EffortLevel;
|
|
34
41
|
/** The agent's tools offered for this call (a role's subset); all of them when absent. */
|
|
35
42
|
tools?: readonly string[];
|
|
43
|
+
/** Asked by the runtime before a model turn once the loop's messages pass `contextPressure.thresholdTokens`
|
|
44
|
+
* (Orkeon #327): the older results of the read tools that ran, answered by call id. A call left out keeps its
|
|
45
|
+
* result; a callback that throws prunes nothing. Absent: nothing is pruned. */
|
|
46
|
+
onContextPressure?: (pressure: ContextPressure) => Promise<Record<string, PruneVerdict> | void>;
|
|
47
|
+
/** When `onContextPressure` runs and what a `head` verdict keeps; the runtime's defaults when absent. */
|
|
48
|
+
contextPressure?: PressureSettings;
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
/** The model, as the crews call it. Every call throws when the host's provider
|
|
@@ -51,4 +64,20 @@ export interface Llm {
|
|
|
51
64
|
/** Whether the host's permission gate checks the tool calls of `act`: false, the mode and the
|
|
52
65
|
* session's rules check nothing; undefined when the facade does not say (a test's). */
|
|
53
66
|
permissionGateEnabled(): boolean | undefined;
|
|
67
|
+
/** What an act with this request sends for its effort (Orkeon #360), judged on the running agent's provider and
|
|
68
|
+
* model, the request's profile and model over them; places no call. A request and a crew that ask for no effort
|
|
69
|
+
* give what the host's own configuration sends. Null when nothing asks for an effort, or the host cannot tell.
|
|
70
|
+
* Null too for a request naming a profile the host does not declare: its act is the one that fails. */
|
|
71
|
+
effortSent(request: Pick<ActRequest, "effort" | "model" | "profile">): EffortReport | null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** What the host's models take for reasoning, read by a command before any call (Orkeon #359, #360): the runtime's
|
|
75
|
+
* own judgement, the host's `Llm:ModelCapabilities` included. Both answer null when the host cannot tell (no `llm`
|
|
76
|
+
* namespace, no provider), and for a target on a profile the host does not declare (Orkeon #364). */
|
|
77
|
+
export interface ReasoningReader {
|
|
78
|
+
/** What the model of `target` takes. */
|
|
79
|
+
capabilities(target: ReasoningTarget): ReasoningCapabilities | null;
|
|
80
|
+
/** What a call on `target` asking for `level` sends; with no level, what the host's own configuration sends
|
|
81
|
+
* (`Llm:Thinking:Effort`), null when it asks for none. */
|
|
82
|
+
effort(target: ReasoningTarget, level: EffortLevel | null): EffortReport | null;
|
|
54
83
|
}
|
|
@@ -14,7 +14,7 @@ export interface MemoryEntry {
|
|
|
14
14
|
* keeps it per project (`Orkeon:Cli:Memory:Persist`, Orkeon #286). Every call throws when the store cannot answer. */
|
|
15
15
|
export interface MemoryStore {
|
|
16
16
|
/** The entries of one category, or of every category when none is named, in stored order, or the newest first
|
|
17
|
-
* when `newestFirst` is set (Orkeon #286
|
|
17
|
+
* when `newestFirst` is set (Orkeon #286). */
|
|
18
18
|
list(category?: string, options?: { newestFirst?: boolean }): Promise<MemoryEntry[]>;
|
|
19
19
|
/** Store an entry; resolves to its id as the host reports it, as text (`null` or
|
|
20
20
|
* `undefined` when it reports none): /memory add prints it as is. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The palette port: the console's palette for this session. Types only, re-exported by ../ports.ts.
|
|
2
|
+
|
|
3
|
+
export type ThemeName = "dark" | "light" | "none";
|
|
4
|
+
|
|
5
|
+
/** The part of the command context the palette goes through; the context itself is the adapter. */
|
|
6
|
+
export interface ThemeConsole {
|
|
7
|
+
/** Null on a console without palettes (a plain console). */
|
|
8
|
+
readonly theme: ThemeName | null;
|
|
9
|
+
/** False on a console without palettes, which stays as it is. */
|
|
10
|
+
setTheme(name: ThemeName): boolean;
|
|
11
|
+
}
|
|
@@ -18,10 +18,12 @@ export type { UsageTokens, UsageSpent, ModelUsage, CommandUsage, UsageReport, Us
|
|
|
18
18
|
export type { MemoryEntry, MemoryStore } from "./ports/memory.ts";
|
|
19
19
|
export type { ToolOutcome, ToolCatalogue, PermissionRules } from "./ports/tools.ts";
|
|
20
20
|
export type { CrewHost, CrewLaunchOptions, ChildRuntime, Logger, RunState, CrewMemory } from "./ports/crew.ts";
|
|
21
|
-
export type { ModelOverride, CompleteRequest, ActRequest, Llm } from "./ports/llm.ts";
|
|
22
|
-
export type { HumanInput } from "./ports/human.ts";
|
|
21
|
+
export type { ModelOverride, CompleteRequest, ActRequest, Llm, ReasoningReader } from "./ports/llm.ts";
|
|
22
|
+
export type { ChoiceOption, ChoiceQuestion, Chooser, HumanInput } from "./ports/human.ts";
|
|
23
|
+
export type { ThemeConsole, ThemeName } from "./ports/theme.ts";
|
|
23
24
|
export type { PendingApproval, PendingApprovals } from "./ports/approvals.ts";
|
|
24
25
|
export type {
|
|
25
26
|
MapLevel, CodeMap, CodeSearchHit, SymbolLocation, CodeIndex, AnchorClosure, AnchorIndex, CostIndex, AffectedTests,
|
|
26
27
|
} from "./ports/code-index.ts";
|
|
27
28
|
export type { SharedHit, SharedIngest, SharedMemory } from "./ports/shared-memory.ts";
|
|
29
|
+
export type { DecisionModel } from "./ports/decision.ts";
|
|
@@ -12,6 +12,7 @@ import type { ConfigStore } from "./config-store.ts";
|
|
|
12
12
|
import { PERMISSION_FALLBACK_CONFIG_KEY, isPermissionMode, resolveFallbackMode } from "../domain/permission-modes.ts";
|
|
13
13
|
import type { FallbackResolution } from "../domain/permission-modes.ts";
|
|
14
14
|
import { DEFAULT_MODE_STATE_KEY } from "../domain/session-keys.ts";
|
|
15
|
+
import { SESSION_DEFAULT_VIA_MODE } from "./messages.ts";
|
|
15
16
|
|
|
16
17
|
export interface SessionIo extends SessionStore {
|
|
17
18
|
/** The session-default permission mode set by /mode, or null when unset/invalid
|
|
@@ -76,7 +77,7 @@ export function createSessionIo(deps: {
|
|
|
76
77
|
resolveSessionFallbackMode,
|
|
77
78
|
async resolveEffectiveSessionMode() {
|
|
78
79
|
const sessionDefault = await readDefaultPermissionMode();
|
|
79
|
-
if (sessionDefault) return { mode: sessionDefault, via:
|
|
80
|
+
if (sessionDefault) return { mode: sessionDefault, via: SESSION_DEFAULT_VIA_MODE };
|
|
80
81
|
const fallback = await resolveSessionFallbackMode();
|
|
81
82
|
return { mode: fallback.mode, via: fallback.explanation };
|
|
82
83
|
},
|
|
@@ -16,6 +16,8 @@ import { candidatePath, entryPath } from "../../domain/shared-memory/layout.ts";
|
|
|
16
16
|
import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
17
17
|
import { readOrNull, refreshCandidatesList, refreshIndexFile, refusedTopics, storedEntries } from "./memory-files.ts";
|
|
18
18
|
import { sha1Hex } from "../../domain/sha1.ts";
|
|
19
|
+
import { CANDIDATE_CHANGED, NOTHING_TO_APPLY, NO_CANDIDATE_FILE, candidateUnreadable, fileHoldsId, indexStale, notACandidateAnyMore, notMarkedSuperseded, refusedNotWritten, statusNotCandidate, stillReadsAsCandidate, supersedesNoAdmitted, topicWasRefused } from "./messages.ts";
|
|
20
|
+
import { prefixedCannotBeRead as refusedFileUnreadable } from "../messages.ts";
|
|
19
21
|
|
|
20
22
|
export const DEFAULT_REFUSAL_MOTIF = "refused by /memory-admit";
|
|
21
23
|
|
|
@@ -66,14 +68,14 @@ async function candidate(
|
|
|
66
68
|
try {
|
|
67
69
|
text = await readOrNull(files, candidatePath(layout, id));
|
|
68
70
|
} catch (error) {
|
|
69
|
-
return
|
|
71
|
+
return candidateUnreadable(firstLine(error));
|
|
70
72
|
}
|
|
71
|
-
if (text === null) return
|
|
72
|
-
if (sha1 !== undefined && sha1Hex(text) !== sha1) return
|
|
73
|
+
if (text === null) return NO_CANDIDATE_FILE;
|
|
74
|
+
if (sha1 !== undefined && sha1Hex(text) !== sha1) return CANDIDATE_CHANGED;
|
|
73
75
|
const parsed = parseEntry(text);
|
|
74
|
-
if (!parsed.ok) return
|
|
75
|
-
if (parsed.entry.status !== "candidate") return
|
|
76
|
-
if (parsed.entry.id !== id) return
|
|
76
|
+
if (!parsed.ok) return notACandidateAnyMore(parsed.problems[0] ?? "decided already");
|
|
77
|
+
if (parsed.entry.status !== "candidate") return statusNotCandidate(parsed.entry.status);
|
|
78
|
+
if (parsed.entry.id !== id) return fileHoldsId(parsed.entry.id);
|
|
77
79
|
return parsed.entry;
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -87,10 +89,10 @@ async function admitOne(
|
|
|
87
89
|
try {
|
|
88
90
|
refused = await refusedTopics(deps.files, layout);
|
|
89
91
|
} catch (error) {
|
|
90
|
-
outcome.failed.push(
|
|
92
|
+
outcome.failed.push(refusedFileUnreadable(id, layout.refused, firstLine(error)));
|
|
91
93
|
return false;
|
|
92
94
|
}
|
|
93
|
-
if (refused.has(found.topic)) { outcome.failed.push(
|
|
95
|
+
if (refused.has(found.topic)) { outcome.failed.push(topicWasRefused(id, found.topic)); return false; }
|
|
94
96
|
const entry: MemoryEntry = { ...found, status: "admitted" };
|
|
95
97
|
const problems = [...entryProblems(entry), ...[admissionProblem(entry)].filter((p): p is string => p !== undefined)];
|
|
96
98
|
if (problems.length > 0) { outcome.failed.push(`${id}: not admitted, ${problems.join("; ")}`); return false; }
|
|
@@ -107,11 +109,11 @@ async function admitOne(
|
|
|
107
109
|
const stored = await storedEntries(deps.files, layout);
|
|
108
110
|
for (const old of entry.supersedes) {
|
|
109
111
|
const hit = stored.find((s) => s.entry.id === old && s.entry.status === "admitted");
|
|
110
|
-
if (hit === undefined) { outcome.warnings.push(
|
|
112
|
+
if (hit === undefined) { outcome.warnings.push(supersedesNoAdmitted(id, old)); continue; }
|
|
111
113
|
try {
|
|
112
114
|
await deps.files.write(hit.path, serializeEntry({ ...hit.entry, status: "superseded", supersededBy: id }));
|
|
113
115
|
} catch (error) {
|
|
114
|
-
outcome.warnings.push(
|
|
116
|
+
outcome.warnings.push(notMarkedSuperseded(old, id, firstLine(error)));
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
}
|
|
@@ -129,7 +131,7 @@ async function refuseOne(
|
|
|
129
131
|
const motif = decision.motif?.trim() || DEFAULT_REFUSAL_MOTIF;
|
|
130
132
|
await deps.files.write(layout.refused, appendRefused(previous, { topic: found.topic, project: found.project, date: today, motif }));
|
|
131
133
|
} catch (error) {
|
|
132
|
-
outcome.failed.push(
|
|
134
|
+
outcome.failed.push(refusedNotWritten(decision.id, layout.refused, firstLine(error)));
|
|
133
135
|
return;
|
|
134
136
|
}
|
|
135
137
|
outcome.refused.push(decision.id);
|
|
@@ -140,7 +142,7 @@ async function pointer(files: Pick<Files, "write">, layout: MemoryLayout, id: st
|
|
|
140
142
|
try {
|
|
141
143
|
await files.write(candidatePath(layout, id), text);
|
|
142
144
|
} catch (error) {
|
|
143
|
-
outcome.warnings.push(
|
|
145
|
+
outcome.warnings.push(stillReadsAsCandidate(candidatePath(layout, id), firstLine(error)));
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -160,7 +162,7 @@ export async function admitEntries(
|
|
|
160
162
|
const report = await deps.memory.ingest(memory.collection, [memory.layout.entriesGlob], { prune: true });
|
|
161
163
|
for (const error of report.errors) outcome.warnings.push(`index: ${error}`);
|
|
162
164
|
} catch (error) {
|
|
163
|
-
outcome.warnings.push(
|
|
165
|
+
outcome.warnings.push(indexStale(memory.collection, firstLine(error)));
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
return outcome;
|
|
@@ -173,5 +175,5 @@ export function admitReport(outcome: AdmitOutcome): string {
|
|
|
173
175
|
...outcome.refused.map((id) => `refused ${id}`),
|
|
174
176
|
...outcome.failed.map((line) => `not applied: ${line}`),
|
|
175
177
|
...outcome.warnings.map((line) => `warning: ${line}`),
|
|
176
|
-
].join("\n") ||
|
|
178
|
+
].join("\n") || NOTHING_TO_APPLY;
|
|
177
179
|
}
|
|
@@ -17,6 +17,7 @@ import { harvestMistakes } from "./harvest-mistakes.ts";
|
|
|
17
17
|
import { readMemorySettings } from "./memory-settings.ts";
|
|
18
18
|
import { readOrNull } from "./memory-files.ts";
|
|
19
19
|
import { WORKSPACE } from "../../domain/vfs.ts";
|
|
20
|
+
import { UNTREATED_GAP, UNTREATED_GAPS, harvestFailed, harvestSkipped, learnNudgeLine, mistakesHarvested } from "./messages.ts";
|
|
20
21
|
|
|
21
22
|
export interface AfterGapsDeps {
|
|
22
23
|
files: Pick<Files, "read" | "write" | "list">;
|
|
@@ -40,8 +41,7 @@ async function untreatedRows(files: Pick<Files, "read">, rows: readonly LearnRow
|
|
|
40
41
|
export function learnNudge(rows: readonly LearnRow[]): string {
|
|
41
42
|
const batches = new Set(rows.map((r) => r.batch)).size;
|
|
42
43
|
if (batches < NUDGE_BATCHES) return "";
|
|
43
|
-
return
|
|
44
|
-
"turns those that recur into rules (in a fresh session).";
|
|
44
|
+
return learnNudgeLine(plural(rows.length, UNTREATED_GAP, UNTREATED_GAPS), batches);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** The lines the verdict's end message adds: the candidates harvested, the nudge; none when there is nothing to say. */
|
|
@@ -55,18 +55,15 @@ export async function harvestAfterGaps(deps: AfterGapsDeps, work: Pick<WorkFolde
|
|
|
55
55
|
const settings = await readMemorySettings(deps);
|
|
56
56
|
for (const w of settings.warnings) deps.log.warn(`shared memory: ${w}`);
|
|
57
57
|
const harvest = await harvestMistakes(deps, settings, rows);
|
|
58
|
-
for (const s of harvest.skipped) deps.log.warn(
|
|
58
|
+
for (const s of harvest.skipped) deps.log.warn(harvestSkipped(s));
|
|
59
59
|
if (harvest.written.length > 0) {
|
|
60
|
-
lines.push(
|
|
61
|
-
`shared memory: ${plural(harvest.written.length, "mistake candidate", "mistake candidates")} harvested from the audits ` +
|
|
62
|
-
`(${harvest.written.join(", ")}) → /memory-admit decides each one.`,
|
|
63
|
-
);
|
|
60
|
+
lines.push(mistakesHarvested(plural(harvest.written.length, "mistake candidate", "mistake candidates"), harvest.written.join(", ")));
|
|
64
61
|
}
|
|
65
62
|
const nudge = learnNudge(await untreatedRows(deps.files, rows));
|
|
66
63
|
if (nudge !== "") lines.push(nudge);
|
|
67
64
|
return lines;
|
|
68
65
|
} catch (error) {
|
|
69
|
-
deps.log.warn(
|
|
66
|
+
deps.log.warn(harvestFailed(firstLine(error)));
|
|
70
67
|
return [];
|
|
71
68
|
}
|
|
72
69
|
}
|
|
@@ -8,6 +8,7 @@ import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
|
8
8
|
import { pendingCandidates, refusedTopics, storedEntries } from "./memory-files.ts";
|
|
9
9
|
import { writeCandidate } from "./push-candidate.ts";
|
|
10
10
|
import type { PushDeps } from "./push-candidate.ts";
|
|
11
|
+
import { mistakeAlreadyHeld, refusedUnreadableNothingHarvested } from "./messages.ts";
|
|
11
12
|
|
|
12
13
|
export interface HarvestOutcome {
|
|
13
14
|
written: string[];
|
|
@@ -23,7 +24,7 @@ export async function harvestMistakes(
|
|
|
23
24
|
try {
|
|
24
25
|
refused = await refusedTopics(deps.files, memory.layout);
|
|
25
26
|
} catch (error) {
|
|
26
|
-
outcome.skipped.push(
|
|
27
|
+
outcome.skipped.push(refusedUnreadableNothingHarvested(String((error as Error)?.message ?? error).split("\n")[0]));
|
|
27
28
|
return outcome;
|
|
28
29
|
}
|
|
29
30
|
const date = deps.clock().toISOString().slice(0, 10);
|
|
@@ -33,7 +34,7 @@ export async function harvestMistakes(
|
|
|
33
34
|
.filter((s) => s.entry.type === "mistake").map((s) => s.entry.topic));
|
|
34
35
|
for (const candidate of plan.candidates) {
|
|
35
36
|
if (held.has(candidate.topic)) {
|
|
36
|
-
outcome.skipped.push(
|
|
37
|
+
outcome.skipped.push(mistakeAlreadyHeld(candidate.topic));
|
|
37
38
|
continue;
|
|
38
39
|
}
|
|
39
40
|
const pushed = await writeCandidate(deps, memory, candidate);
|
|
@@ -15,6 +15,8 @@ import { writeCandidate } from "./push-candidate.ts";
|
|
|
15
15
|
import { topicOf } from "../../domain/shared-memory/refused.ts";
|
|
16
16
|
import { secretPatternsIn } from "../../domain/secret-patterns.ts";
|
|
17
17
|
import { WORKSPACE } from "../../domain/vfs.ts";
|
|
18
|
+
import { DECIDE_WITH_MEMORY_ADMIT, NO_CANDIDATE_WRITTEN, duplicatesSkipped, itemLooksLikeSecret, noAgentMemory, noteUnreadable } from "./messages.ts";
|
|
19
|
+
import { cannotBeRead } from "../messages.ts";
|
|
18
20
|
|
|
19
21
|
export const HARNESS_AGENT_MEMORY_ROOT = `${WORKSPACE}/${HARNESS_AGENT_MEMORY_DIR}`;
|
|
20
22
|
|
|
@@ -58,7 +60,7 @@ export async function importAgentMemory(
|
|
|
58
60
|
try {
|
|
59
61
|
index = await readOrNull(deps.files, `${folder}/${AGENT_MEMORY_INDEX}`);
|
|
60
62
|
} catch (error) {
|
|
61
|
-
outcome.warnings.push(`${folder}/${AGENT_MEMORY_INDEX}
|
|
63
|
+
outcome.warnings.push(cannotBeRead(`${folder}/${AGENT_MEMORY_INDEX}`, firstLine(error)));
|
|
62
64
|
continue;
|
|
63
65
|
}
|
|
64
66
|
if (index === null) continue;
|
|
@@ -73,14 +75,14 @@ export async function importAgentMemory(
|
|
|
73
75
|
note = text === null ? null : parseAgentNote(text.slice(0, MAX_NOTE_CHARS));
|
|
74
76
|
if (text !== null) uncut += `\n${text}`;
|
|
75
77
|
} catch (error) {
|
|
76
|
-
outcome.warnings.push(`${folder}/${item.note}
|
|
78
|
+
outcome.warnings.push(noteUnreadable(`${folder}/${item.note}`, firstLine(error)));
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
// The entry cuts the note and the line: a secret cut at the boundary would slip past entryProblems,
|
|
80
82
|
// so the uncut text is scanned first.
|
|
81
83
|
const secrets = secretPatternsIn(uncut);
|
|
82
84
|
if (secrets.length > 0) {
|
|
83
|
-
outcome.refused.push({ agent, line: item.line, reason:
|
|
85
|
+
outcome.refused.push({ agent, line: item.line, reason: itemLooksLikeSecret(secrets.join(", ")) });
|
|
84
86
|
continue;
|
|
85
87
|
}
|
|
86
88
|
const entry = importedEntry(item, note, { agent, project: memory.project, date });
|
|
@@ -103,15 +105,15 @@ export async function importAgentMemory(
|
|
|
103
105
|
|
|
104
106
|
/** The lines the operator reads after an import. */
|
|
105
107
|
export function importReport(outcome: ImportOutcome, root: string = HARNESS_AGENT_MEMORY_ROOT): string {
|
|
106
|
-
if (outcome.agents.length === 0) return
|
|
108
|
+
if (outcome.agents.length === 0) return noAgentMemory(root, AGENT_MEMORY_INDEX);
|
|
107
109
|
const lines = outcome.agents.map((a) => `${root}/${a.agent}/${AGENT_MEMORY_INDEX}: ${a.entries} entr${a.entries === 1 ? "y" : "ies"}`);
|
|
108
|
-
lines.push(outcome.written.length === 0 ?
|
|
110
|
+
lines.push(outcome.written.length === 0 ? NO_CANDIDATE_WRITTEN
|
|
109
111
|
: `${outcome.written.length} candidate(s) written: ${outcome.written.map((w) => w.id).join(", ")}`);
|
|
110
112
|
if (outcome.duplicates.length > 0) {
|
|
111
|
-
lines.push(
|
|
113
|
+
lines.push(duplicatesSkipped(outcome.duplicates.length, outcome.duplicates.map((d) => `${d.agent}:${d.line} ${d.topic}`).join(", ")));
|
|
112
114
|
}
|
|
113
115
|
for (const r of outcome.refused) lines.push(`✗ ${r.agent}/${AGENT_MEMORY_INDEX}:${r.line}: ${r.reason}`);
|
|
114
116
|
for (const w of outcome.warnings) lines.push(`warning: ${w}`);
|
|
115
|
-
if (outcome.written.length > 0) lines.push(
|
|
117
|
+
if (outcome.written.length > 0) lines.push(DECIDE_WITH_MEMORY_ADMIT);
|
|
116
118
|
return lines.join("\n");
|
|
117
119
|
}
|
|
@@ -10,6 +10,7 @@ import { parseRefused } from "../../domain/shared-memory/refused.ts";
|
|
|
10
10
|
import { CANDIDATES_TITLE, INDEX_TITLE, candidatesList, entriesIndex } from "../../domain/shared-memory/candidates.ts";
|
|
11
11
|
import { candidatePath } from "../../domain/shared-memory/layout.ts";
|
|
12
12
|
import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
13
|
+
import { notRefreshed } from "./messages.ts";
|
|
13
14
|
|
|
14
15
|
/** How many files of one folder are read at most. */
|
|
15
16
|
export const MAX_LISTED = 1_000;
|
|
@@ -85,7 +86,7 @@ export async function writeCandidateFile(files: Pick<Files, "write">, layout: Me
|
|
|
85
86
|
async function writeGenerated(files: Pick<Files, "read" | "write">, path: string, title: string, text: string): Promise<string | null> {
|
|
86
87
|
const previous = await readOrNull(files, path);
|
|
87
88
|
if (previous !== null && previous.trim() !== "" && !previous.startsWith(title)) {
|
|
88
|
-
return
|
|
89
|
+
return notRefreshed(path, title);
|
|
89
90
|
}
|
|
90
91
|
await files.write(path, text);
|
|
91
92
|
return null;
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
memoryCollection, memoryLayout, memoryProjectProblem,
|
|
13
13
|
} from "../../domain/shared-memory/layout.ts";
|
|
14
14
|
import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
15
|
+
import { memoryDirSetAside } from "./messages.ts";
|
|
15
16
|
|
|
16
17
|
export const GIT_REMOTE_ORIGIN = "git remote get-url origin";
|
|
17
18
|
export const LOCAL_PROJECT = "local";
|
|
@@ -59,7 +60,7 @@ export async function readMemoryDir(config: Pick<ConfigStore, "readValue">): Pro
|
|
|
59
60
|
const raw = await valueOf(config, MEMORY_DIR_CONFIG_KEY);
|
|
60
61
|
if (raw === undefined) return { dir: DEFAULT_MEMORY_DIR };
|
|
61
62
|
const check = checkMemoryDir(raw);
|
|
62
|
-
return check.ok ? { dir: check.dir } : { dir: DEFAULT_MEMORY_DIR, warning:
|
|
63
|
+
return check.ok ? { dir: check.dir } : { dir: DEFAULT_MEMORY_DIR, warning: memoryDirSetAside(MEMORY_DIR_CONFIG_KEY, raw, check.reason, DEFAULT_MEMORY_DIR) };
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/** memory.dir as the guards read it: the folder alone, the warning left to the commands that print it. */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// The text the shared-memory services report: the admission, the harvests, the import, a push's refusals (the
|
|
2
|
+
// memory_push tool hands them to the model as they are) and the settings set aside.
|
|
3
|
+
|
|
4
|
+
// admit-entries.ts
|
|
5
|
+
export const candidateUnreadable = (reason: string): string => `its candidate file cannot be read (${reason})`;
|
|
6
|
+
export const NO_CANDIDATE_FILE = "no candidate file";
|
|
7
|
+
export const CANDIDATE_CHANGED = "its file changed since it was confirmed: run /memory-admit again";
|
|
8
|
+
export const notACandidateAnyMore = (problem: string): string => `its file is not a candidate entry any more (${problem})`;
|
|
9
|
+
export const statusNotCandidate = (status: string): string => `its status is ${status}, not candidate`;
|
|
10
|
+
export const fileHoldsId = (id: string): string => `its file holds the id ${id}`;
|
|
11
|
+
export const topicWasRefused = (id: string, topic: string): string => `${id}: its topic '${topic}' was refused (refused.md)`;
|
|
12
|
+
export const supersedesNoAdmitted = (id: string, old: string): string =>
|
|
13
|
+
`${id} supersedes ${old}, which is no admitted entry: left as it is`;
|
|
14
|
+
export const notMarkedSuperseded = (old: string, id: string, reason: string): string =>
|
|
15
|
+
`${old} not marked superseded by ${id} (${reason})`;
|
|
16
|
+
export const refusedNotWritten = (id: string, path: string, reason: string): string =>
|
|
17
|
+
`${id}: ${path} not written (${reason}), the candidate stays`;
|
|
18
|
+
export const stillReadsAsCandidate = (path: string, reason: string): string =>
|
|
19
|
+
`${path} still reads as a candidate (${reason}): /memory-admit will say it is decided`;
|
|
20
|
+
export const indexStale = (collection: string, reason: string): string =>
|
|
21
|
+
`the index of ${collection} is stale (${reason}): the next admission re-ingests entries/`;
|
|
22
|
+
export const NOTHING_TO_APPLY = "nothing to apply";
|
|
23
|
+
|
|
24
|
+
// harvest-after-gaps.ts, harvest-mistakes.ts
|
|
25
|
+
export const UNTREATED_GAP = "untreated verdict gap";
|
|
26
|
+
export const UNTREATED_GAPS = "untreated verdict gaps";
|
|
27
|
+
export const learnNudgeLine = (gaps: string, batches: number): string =>
|
|
28
|
+
`→ ${gaps} across ${batches} batches: /dev-learn ` +
|
|
29
|
+
"turns those that recur into rules (in a fresh session).";
|
|
30
|
+
export const harvestSkipped = (reason: string): string => `shared memory: harvest: ${reason}`;
|
|
31
|
+
export const mistakesHarvested = (candidates: string, ids: string): string =>
|
|
32
|
+
`shared memory: ${candidates} harvested from the audits ` +
|
|
33
|
+
`(${ids}) → /memory-admit decides each one.`;
|
|
34
|
+
export const harvestFailed = (reason: string): string => `shared memory: harvest after the verdict failed (${reason})`;
|
|
35
|
+
export const refusedUnreadableNothingHarvested = (reason: string): string => `refused.md cannot be read (${reason}): nothing harvested`;
|
|
36
|
+
export const mistakeAlreadyHeld = (topic: string): string => `${topic}: a mistake candidate or entry already holds it`;
|
|
37
|
+
|
|
38
|
+
// import-agent-memory.ts
|
|
39
|
+
export const noteUnreadable = (path: string, reason: string): string => `${path} cannot be read (${reason}): the line alone is imported`;
|
|
40
|
+
export const itemLooksLikeSecret = (patterns: string): string => `the item looks like it holds a secret (${patterns})`;
|
|
41
|
+
export const noAgentMemory = (root: string, index: string): string => `No harness agent memory in ${root} (no <agent>/${index}).`;
|
|
42
|
+
export const NO_CANDIDATE_WRITTEN = "No candidate written.";
|
|
43
|
+
export const duplicatesSkipped = (count: number, list: string): string =>
|
|
44
|
+
`${count} duplicate(s) skipped (topic already held): ${list}`;
|
|
45
|
+
export const DECIDE_WITH_MEMORY_ADMIT = "Decide them with /memory-admit (each one is asked).";
|
|
46
|
+
|
|
47
|
+
// memory-files.ts, memory-settings.ts, recall-precedents.ts
|
|
48
|
+
export const notRefreshed = (path: string, title: string): string =>
|
|
49
|
+
`${path} not refreshed: it exists and is not the memory's (it does not start with '${title}')`;
|
|
50
|
+
export const memoryDirSetAside = (key: string, raw: string, reason: string, dir: string): string =>
|
|
51
|
+
`${key} '${raw}' set aside (${reason}): ${dir} applies`;
|
|
52
|
+
export const recallFailed = (reason: string): string => `shared memory: recall failed, no precedents (${reason})`;
|
|
53
|
+
|
|
54
|
+
// push-candidate.ts: the refusals of memory_push
|
|
55
|
+
export const EVIDENCE_REQUIRED = "evidence required: at least one path:line, commit or verdict file";
|
|
56
|
+
export const topicNeverProposedAgain = (topic: string): string =>
|
|
57
|
+
`topic '${topic}' was refused (refused.md): it is never proposed again`;
|
|
58
|
+
export const refusedUnreadableNothingWritten = (reason: string): string => `refused.md cannot be read (${reason}): nothing was written`;
|
|
59
|
+
export const notAValidEntry = (problems: string): string => `not a valid entry: ${problems}`;
|
|
60
|
+
export const nineHoldTheId = (id: string): string => `nine candidates or entries already hold the id ${id}`;
|
|
61
|
+
export const admittedHoldsId = (id: string): string => `an admitted entry already holds ${id}: supersede it rather than push it again`;
|
|
62
|
+
export const notWritable = (path: string, reason: string): string => `${path} is not writable (${reason}): nothing was written`;
|
|
63
|
+
export const overwroteTwice = (id: string): string => `another push overwrote ${id} twice: nothing was kept, push again`;
|
|
@@ -12,6 +12,9 @@ import { candidatePath, entryPath } from "../../domain/shared-memory/layout.ts";
|
|
|
12
12
|
import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
13
13
|
import { secretLikePaths } from "../../domain/secret-patterns.ts";
|
|
14
14
|
import { readOrNull, refreshCandidatesList, refusedTopics, writeCandidateFile } from "./memory-files.ts";
|
|
15
|
+
import { EVIDENCE_REQUIRED, admittedHoldsId, nineHoldTheId, notAValidEntry, notWritable, overwroteTwice, refusedUnreadableNothingWritten, topicNeverProposedAgain } from "./messages.ts";
|
|
16
|
+
import { evidenceNamesSecret, typeMustBeOneOf } from "../../domain/shared-memory/messages.ts";
|
|
17
|
+
import { cannotBeRead } from "../messages.ts";
|
|
15
18
|
|
|
16
19
|
export interface PushInput {
|
|
17
20
|
type: EntryType;
|
|
@@ -45,13 +48,13 @@ const list = (value: unknown): string[] =>
|
|
|
45
48
|
export function readPushInput(input: unknown): { ok: true; input: PushInput } | { ok: false; refused: string } {
|
|
46
49
|
const raw = (input !== null && typeof input === "object" ? input : {}) as Record<string, unknown>;
|
|
47
50
|
const type = text(raw.type);
|
|
48
|
-
if (!(ENTRY_TYPES as readonly string[]).includes(type)) return { ok: false, refused:
|
|
51
|
+
if (!(ENTRY_TYPES as readonly string[]).includes(type)) return { ok: false, refused: typeMustBeOneOf(ENTRY_TYPES.join(", ")) };
|
|
49
52
|
const missing = ["title", "topic", "applies_when", "rationale"].filter((key) => text(raw[key]) === "");
|
|
50
53
|
if (missing.length > 0) return { ok: false, refused: `${missing.join(", ")} required` };
|
|
51
54
|
const evidence = list(raw.evidence);
|
|
52
|
-
if (evidence.length === 0) return { ok: false, refused:
|
|
55
|
+
if (evidence.length === 0) return { ok: false, refused: EVIDENCE_REQUIRED };
|
|
53
56
|
const secret = secretLikePaths(evidence.flatMap((e) => e.split(/\s+/)).map((w) => w.replace(/:\d+$/, "")));
|
|
54
|
-
if (secret.length > 0) return { ok: false, refused:
|
|
57
|
+
if (secret.length > 0) return { ok: false, refused: evidenceNamesSecret(secret.join(", ")) };
|
|
55
58
|
const pushed: PushInput = {
|
|
56
59
|
type: type as EntryType, title: text(raw.title), topic: text(raw.topic), appliesWhen: text(raw.applies_when),
|
|
57
60
|
rationale: text(raw.rationale), evidence, tags: list(raw.tags).map((t) => t.toLowerCase()),
|
|
@@ -101,13 +104,13 @@ export async function writeCandidate(
|
|
|
101
104
|
): Promise<PushOutcome> {
|
|
102
105
|
try {
|
|
103
106
|
if ((await refusedTopics(deps.files, memory.layout)).has(entry.topic)) {
|
|
104
|
-
return { ok: false, refused:
|
|
107
|
+
return { ok: false, refused: topicNeverProposedAgain(entry.topic) };
|
|
105
108
|
}
|
|
106
109
|
} catch (error) {
|
|
107
|
-
return { ok: false, refused:
|
|
110
|
+
return { ok: false, refused: refusedUnreadableNothingWritten(firstLine(error)) };
|
|
108
111
|
}
|
|
109
112
|
const problems = entryProblems(entry);
|
|
110
|
-
if (problems.length > 0) return { ok: false, refused:
|
|
113
|
+
if (problems.length > 0) return { ok: false, refused: notAValidEntry(problems.join("; ")) };
|
|
111
114
|
// The Files port has no exclusive create: a concurrent push of the same title may write the same id between
|
|
112
115
|
// freeId and the write. The candidate is read back, and a file another push overwrote is written again under the
|
|
113
116
|
// next free id; a push whose write came last still wins its id (no lock without module state).
|
|
@@ -116,24 +119,24 @@ export async function writeCandidate(
|
|
|
116
119
|
try {
|
|
117
120
|
id = await freeId(deps.files, memory.layout, entry);
|
|
118
121
|
} catch (error) {
|
|
119
|
-
return { ok: false, refused:
|
|
122
|
+
return { ok: false, refused: cannotBeRead(memory.layout.candidates, firstLine(error)) };
|
|
120
123
|
}
|
|
121
|
-
if (id === null) return { ok: false, refused:
|
|
124
|
+
if (id === null) return { ok: false, refused: nineHoldTheId(entry.id) };
|
|
122
125
|
if (id !== entry.id && (await readOrNull(deps.files, entryPath(memory.layout, entry.type, entry.id)).catch(() => null)) !== null) {
|
|
123
|
-
return { ok: false, refused:
|
|
126
|
+
return { ok: false, refused: admittedHoldsId(entry.id) };
|
|
124
127
|
}
|
|
125
128
|
let path: string;
|
|
126
129
|
try {
|
|
127
130
|
path = await writeCandidateFile(deps.files, memory.layout, { ...entry, id });
|
|
128
131
|
} catch (error) {
|
|
129
|
-
return { ok: false, refused:
|
|
132
|
+
return { ok: false, refused: notWritable(memory.layout.candidates, firstLine(error)) };
|
|
130
133
|
}
|
|
131
134
|
const kept = await readOrNull(deps.files, path).catch(() => null);
|
|
132
135
|
if (kept !== null && sameText(kept, serializeEntry({ ...entry, id, status: "candidate" })) === false) continue;
|
|
133
136
|
const listed = await refreshCandidatesList(deps.files, memory.layout);
|
|
134
137
|
return { ok: true, id, path, warnings: listed === null ? [] : [listed] };
|
|
135
138
|
}
|
|
136
|
-
return { ok: false, refused:
|
|
139
|
+
return { ok: false, refused: overwroteTwice(entry.id) };
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
/** memory_push: the input read, the candidate built and written. */
|
|
@@ -9,6 +9,7 @@ import type { EntryType } from "../../domain/shared-memory/entry.ts";
|
|
|
9
9
|
import { MAX_PRECEDENTS, RECALL_TOP_N, buildPrecedentsBlock } from "../../domain/shared-memory/precedents-block.ts";
|
|
10
10
|
import type { Precedent } from "../../domain/shared-memory/precedents-block.ts";
|
|
11
11
|
import type { MemoryLayout } from "../../domain/shared-memory/layout.ts";
|
|
12
|
+
import { recallFailed } from "./messages.ts";
|
|
12
13
|
|
|
13
14
|
export interface RecallDeps {
|
|
14
15
|
memory: Pick<SharedMemory, "search">;
|
|
@@ -63,7 +64,7 @@ export async function recallPrecedents(
|
|
|
63
64
|
try {
|
|
64
65
|
return buildPrecedentsBlock((await recallEntries(deps, request)).precedents);
|
|
65
66
|
} catch (error) {
|
|
66
|
-
deps.log.warn(
|
|
67
|
+
deps.log.warn(recallFailed(String((error as Error)?.message ?? error).split("\n")[0]));
|
|
67
68
|
return "";
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// What the suggestion of skills says to the user.
|
|
2
|
+
export const SUGGEST_WITHOUT_DECISION_MODEL =
|
|
3
|
+
"skills.suggest is on and the host has no decision model: no skill is suggested (set Orkeon:Decision:Provider, or Orkeon:TypeSafe)";
|
|
4
|
+
export const skillsSuggested = (paths: string): string => `skills suggested for this turn: ${paths}`;
|