@iowarp/clio-coder 0.3.3 → 0.3.6
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/CHANGELOG.md +74 -0
- package/CONTRIBUTING.md +7 -7
- package/README.md +3 -3
- package/dist/{acp-P2AQILE2.js → acp-2BEHC4DL.js} +9 -8
- package/dist/{agents-72W3BI7I.js → agents-LNNFTM53.js} +29 -24
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-5TWEIYDN.js → auth-KXXFI2VS.js} +14 -10
- package/dist/{chunk-GGXXDWE4.js → chunk-22NAGB7X.js} +2 -2
- package/dist/{chunk-YCWGATWI.js → chunk-24I7BN55.js} +2 -2
- package/dist/{chunk-EKMEHE4H.js → chunk-33YXPOE3.js} +2 -3
- package/dist/chunk-3BPUFZDL.js +37 -0
- package/dist/chunk-43AOLP7E.js +375 -0
- package/dist/{chunk-ZDOOVTXZ.js → chunk-4OC57DA6.js} +27 -4
- package/dist/{chunk-6SGHMWE3.js → chunk-5JGRAMKL.js} +5 -5
- package/dist/{chunk-V6RTAOC2.js → chunk-6US73PDB.js} +572 -51
- package/dist/{chunk-5UFT4SUX.js → chunk-6XXKFVSN.js} +3 -3
- package/dist/{chunk-A3CYT5EX.js → chunk-AD2SYQYC.js} +55 -2
- package/dist/chunk-AOCYTWAV.js +449 -0
- package/dist/chunk-CFGTUFWB.js +67 -0
- package/dist/chunk-CJUB2JJ2.js +1478 -0
- package/dist/{chunk-FNTMWMX5.js → chunk-CKXWIANG.js} +14 -12
- package/dist/{chunk-PIWWS5BL.js → chunk-CYQKWTG3.js} +63 -78
- package/dist/{chunk-LZSJBIVT.js → chunk-DJVECN66.js} +271 -762
- package/dist/{chunk-CBCAPZAA.js → chunk-E25LMLRW.js} +2 -2
- package/dist/{chunk-ZWMF7253.js → chunk-E2ER4LJF.js} +304 -9
- package/dist/{chunk-STBPMHSX.js → chunk-EKY57CSP.js} +51 -84
- package/dist/{chunk-DUYJ5IO6.js → chunk-EYPA3EGJ.js} +12 -4
- package/dist/{chunk-M6SHUN7Q.js → chunk-FO5ZOVUY.js} +2 -2
- package/dist/chunk-FYYLNIL5.js +313 -0
- package/dist/{chunk-OQ33BKR3.js → chunk-G7MUEIGA.js} +3 -60
- package/dist/chunk-GEYXPTRF.js +613 -0
- package/dist/chunk-GOXNB3AO.js +261 -0
- package/dist/{chunk-G4BMMOKF.js → chunk-HVDIIIQW.js} +2 -2
- package/dist/chunk-HWUFFB6L.js +83 -0
- package/dist/{chunk-4XUGQOHA.js → chunk-K7T3E2SR.js} +15 -8
- package/dist/chunk-K7VKOLQQ.js +15 -0
- package/dist/{chunk-UFIIWP2H.js → chunk-KHSFENX2.js} +8 -8
- package/dist/{chunk-BMEMKKIT.js → chunk-KOHPCX4K.js} +2 -2
- package/dist/chunk-LCGCVYZ4.js +57 -0
- package/dist/chunk-LL4KHSZI.js +22 -0
- package/dist/{chunk-PAJK6MAQ.js → chunk-LYF7OHWH.js} +42 -15
- package/dist/{chunk-POHLU5DW.js → chunk-M6L6IDJG.js} +3 -3
- package/dist/{chunk-5UUP6MWO.js → chunk-MV3K5QF2.js} +5 -436
- package/dist/{chunk-X4RCMKVQ.js → chunk-NDINPTJ4.js} +2 -2
- package/dist/{chunk-TZK7PACC.js → chunk-NILBFAPG.js} +14 -8
- package/dist/chunk-ODFEOB4F.js +1082 -0
- package/dist/{chunk-AGYYIBLL.js → chunk-OH3TOQTB.js} +6 -2
- package/dist/chunk-OZNBF4L3.js +23 -0
- package/dist/{chunk-DSELYM6W.js → chunk-PBTHKCPN.js} +30 -10
- package/dist/{verify-375KUB3Y.js → chunk-PCZJO5TI.js} +127 -42
- package/dist/{chunk-ED4KHGC3.js → chunk-PPAMZ32Z.js} +9 -2
- package/dist/{chunk-SRDMMSEP.js → chunk-QM3F2GKX.js} +1063 -1645
- package/dist/{chunk-X6IAEBZR.js → chunk-QNQHSOLF.js} +7 -7
- package/dist/{chunk-OC7FIQPC.js → chunk-R46L2BIR.js} +10 -7
- package/dist/{chunk-2TLUCQVG.js → chunk-RD5U66HV.js} +3 -3
- package/dist/{chunk-6N5PTWMY.js → chunk-RY3LY4J5.js} +50 -13
- package/dist/{chunk-OKGUZO2U.js → chunk-SPULKLCF.js} +4 -3
- package/dist/{chunk-OOJYHWRB.js → chunk-TSHXZTOQ.js} +6 -5
- package/dist/chunk-TZSKNMZG.js +434 -0
- package/dist/{chunk-7MNJORFF.js → chunk-UL3WSD3F.js} +6 -1
- package/dist/{chunk-VJWL6YS5.js → chunk-UUVG37B4.js} +2 -2
- package/dist/{chunk-COU2UHX6.js → chunk-VEZEGCGW.js} +170 -2
- package/dist/chunk-W6GROXXM.js +69 -0
- package/dist/{chunk-OAO4GE4M.js → chunk-WHGPSPT5.js} +2 -2
- package/dist/chunk-WHJYKASB.js +677 -0
- package/dist/{chunk-ORBHGJC5.js → chunk-WR67VIZY.js} +3 -3
- package/dist/{chunk-YHZX5GEU.js → chunk-XAKHZX5N.js} +2 -2
- package/dist/{chunk-TZTZS7QK.js → chunk-XE2VEJHX.js} +5 -3
- package/dist/{chunk-LM5TQCJZ.js → chunk-XF5N4U5A.js} +8 -7
- package/dist/{chunk-LWLEKMDQ.js → chunk-XXQNGV4M.js} +1073 -552
- package/dist/{chunk-KZWTDYJF.js → chunk-XYDYPRZI.js} +7 -7
- package/dist/chunk-ZGVHUX3M.js +66 -0
- package/dist/{chunk-LW6DSM3M.js → chunk-ZRGEBJ4T.js} +1192 -1119
- package/dist/{chunk-2DJ2KNFG.js → chunk-ZXF4XRKW.js} +202 -40
- package/dist/chunk-ZZMN5OM4.js +122 -0
- package/dist/cli/index.js +34 -30
- package/dist/{clio-JOU4FXVA.js → clio-M2KGYUFZ.js} +7 -6
- package/dist/{code-nav-7AX6FYE6.js → code-nav-GQNL7XA6.js} +8 -6
- package/dist/codewiki/build-worker.js +4 -4
- package/dist/{components-KELWS457.js → components-5TTYYX6G.js} +3 -3
- package/dist/{config-XCDVKR23.js → config-XUUYQIWO.js} +47 -35
- package/dist/{configure-4GAP54ZW.js → configure-IHJ7YOMV.js} +18 -15
- package/dist/{context-77FM5DV5.js → context-74JLXAWD.js} +18 -10
- package/dist/{context-4UOGGLQ5.js → context-75MIWW3U.js} +41 -29
- package/dist/{context-5VKGUVJJ.js → context-ZQ7SIFJV.js} +85 -9
- package/dist/{context-clear-XXJRLCJJ.js → context-clear-GYKWNUML.js} +41 -29
- package/dist/{context-index-BZ4UYMTC.js → context-index-SSR5ECNE.js} +3 -3
- package/dist/context-working-set-UX5KEP4J.js +1553 -0
- package/dist/{dispatch-runner-QPRDDBDX.js → dispatch-runner-GIJBHNFL.js} +47 -32
- package/dist/{docs-2C2LTVT2.js → docs-6FZSCG5B.js} +3 -3
- package/dist/{doctor-HR46URBJ.js → doctor-SVJ5BZCW.js} +12 -12
- package/dist/{eval-XSSNATB4.js → eval-CG6LLBLD.js} +54 -238
- package/dist/{evidence-6HG2PY2B.js → evidence-ZYFIEN42.js} +57 -28
- package/dist/{evolve-K7YU3NCY.js → evolve-QGEXEMDW.js} +36 -25
- package/dist/{extensions-QVDOHDGJ.js → extensions-ADGNCJJD.js} +3 -3
- package/dist/{fleet-VY3HHKN6.js → fleet-S5R4ZOQY.js} +73 -44
- package/dist/{fleet-preflight-DDN536IT.js → fleet-preflight-BHSNPBMH.js} +3 -3
- package/dist/{init-JYGXI3FK.js → init-5DRU55YR.js} +49 -37
- package/dist/memory-7YKKR6UC.js +467 -0
- package/dist/{models-I5QWSEOM.js → models-ZPOLRU2C.js} +24 -21
- package/dist/{monitor-GE4ID3IA.js → monitor-US5F5YGZ.js} +73 -46
- package/dist/{orchestrator-EM5MC3HM.js → orchestrator-E2AL4T5N.js} +1624 -1007
- package/dist/{paths-UXLN5YYZ.js → paths-E7KYAQWE.js} +3 -3
- package/dist/{reset-L2FQEE3E.js → reset-KZ652EK6.js} +6 -5
- package/dist/{run-ZU3QMZPZ.js → run-SRNBKDWD.js} +76 -54
- package/dist/{share-S5BZQC5I.js → share-CGZE33UP.js} +7 -6
- package/dist/{skills-X5VXCRNQ.js → skills-S2X4DLY5.js} +4 -4
- package/dist/{skills-eval-WKIHWTHR.js → skills-eval-W2GGIC4R.js} +40 -29
- package/dist/{targets-SNCPI2NR.js → targets-54SWINWB.js} +28 -23
- package/dist/{terminal-lease-BNAHVHBS.js → terminal-lease-SAIF2OGY.js} +6 -4
- package/dist/{uninstall-FZCQCDKC.js → uninstall-BVLWXKBT.js} +3 -3
- package/dist/{upgrade-JQHHPQ4K.js → upgrade-JKAR27XC.js} +20 -19
- package/dist/{usage-OR4O5SMZ.js → usage-MSAWCLX4.js} +79 -36
- package/dist/verifiers-NCBTHHN2.js +1220 -0
- package/dist/verify-X5HDROLA.js +25 -0
- package/dist/{wiki-generate-UEXP2ARI.js → wiki-generate-GUSOQ6ZP.js} +50 -37
- package/dist/worker/entry.js +90 -70
- package/dist/{workspace-G4ZWUIPR.js → workspace-ZJ6BFM3Q.js} +4 -4
- package/docs/README.md +8 -7
- package/docs/acp.md +1 -1
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +2 -2
- package/docs/artifact-placement.md +1 -2
- package/docs/artifact-versions.md +1 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +1 -1
- package/docs/commands-and-modes.md +60 -26
- package/docs/config-knobs-audit.md +1 -2
- package/docs/configuration-and-targets.md +26 -1
- package/docs/context-engine.md +67 -13
- package/docs/context-working-set.md +194 -0
- package/docs/development-pipeline.md +1 -1
- package/docs/documentation-coverage.md +6 -6
- package/docs/documentation-guide.md +7 -6
- package/docs/environment-variables.md +2 -1
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +4 -32
- package/docs/evidence-and-memory.md +139 -7
- package/docs/evolution.md +1 -1
- package/docs/exit-codes-and-output.md +1 -1
- package/docs/extensions-and-sharing.md +2 -2
- package/docs/fleet-dispatch.md +49 -8
- package/docs/glossary.md +21 -1
- package/docs/installation-and-lifecycle.md +2 -2
- package/docs/middleware-and-components.md +19 -2
- package/docs/model-catalog.md +7 -9
- package/docs/observability.md +4 -4
- package/docs/proactive-memory.md +26 -16
- package/docs/prompt-envelope-and-tools.md +7 -5
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +43 -40
- package/docs/safety-model.md +49 -8
- package/docs/scientific-validation.md +21 -3
- package/docs/session-lifecycle.md +3 -3
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +79 -12
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/tui-design.md +38 -4
- package/docs/worker-dispatch-mechanics.md +11 -1
- package/package.json +13 -13
- package/skills/meta/clio-test/SKILL.md +20 -17
- package/skills/meta/clio-test/evals.md +3 -3
- package/skills/meta/clio-test/references/harness.md +35 -6
- package/skills/meta/clio-test/references/test-map.md +20 -10
- package/skills/registry.yaml +2 -2
- package/skills/skill-marketplace.json +1 -1
- package/src/cli/agents.ts +2 -3
- package/src/cli/argv.ts +14 -1
- package/src/cli/context-working-set.ts +513 -0
- package/src/cli/context.ts +8 -0
- package/src/cli/evidence.ts +20 -2
- package/src/cli/fleet.ts +15 -0
- package/src/cli/index.ts +5 -1
- package/src/cli/memory.ts +272 -10
- package/src/cli/modes/json-stream.ts +2 -2
- package/src/cli/modes/print.ts +12 -1
- package/src/cli/run.ts +22 -2
- package/src/cli/targets.ts +12 -3
- package/src/cli/usage.ts +55 -7
- package/src/cli/verifiers.ts +325 -0
- package/src/core/bash-exec.ts +39 -14
- package/src/core/bus-events.ts +22 -4
- package/src/core/config.ts +54 -0
- package/src/core/defaults.ts +50 -3
- package/src/core/response-model-id.ts +134 -0
- package/src/core/toml.ts +62 -0
- package/src/core/verification-scripts.ts +6 -0
- package/src/core/workspace-files.ts +0 -1
- package/src/domains/agents/builtins/architect.md +1 -1
- package/src/domains/agents/builtins/verifier.md +3 -0
- package/src/domains/agents/catalog.ts +5 -4
- package/src/domains/agents/recipe.ts +54 -14
- package/src/domains/agents/result-contract.ts +7 -4
- package/src/domains/config/classify.ts +1 -0
- package/src/domains/context/bootstrap.ts +36 -27
- package/src/domains/context/project-metadata.ts +19 -63
- package/src/domains/context/prompt-context.ts +8 -0
- package/src/domains/context/working-set/contract.ts +161 -0
- package/src/domains/context/working-set/defaults.ts +28 -0
- package/src/domains/context/working-set/engine.ts +203 -0
- package/src/domains/context/working-set/fold.ts +62 -0
- package/src/domains/context/working-set/horizon.ts +38 -0
- package/src/domains/context/working-set/marker.ts +103 -0
- package/src/domains/context/working-set/path-index.ts +436 -0
- package/src/domains/context/working-set/payload.ts +152 -0
- package/src/domains/context/working-set/policies/age-horizon.ts +55 -0
- package/src/domains/context/working-set/policies/index.ts +20 -0
- package/src/domains/context/working-set/policies/structural.ts +160 -0
- package/src/domains/context/working-set/project.ts +132 -0
- package/src/domains/context/working-set/protect.ts +109 -0
- package/src/domains/context/working-set/recall.ts +177 -0
- package/src/domains/context/working-set/replay/controls.ts +112 -0
- package/src/domains/context/working-set/replay/load-clio.ts +199 -0
- package/src/domains/context/working-set/replay/metrics.ts +185 -0
- package/src/domains/context/working-set/replay/reference-graph.ts +79 -0
- package/src/domains/context/working-set/replay/report.ts +139 -0
- package/src/domains/context/working-set/replay/runner.ts +325 -0
- package/src/domains/context/working-set/replay/synthetic.ts +422 -0
- package/src/domains/context/working-set/replay/trace.ts +21 -0
- package/src/domains/context/working-set/visible.ts +54 -0
- package/src/domains/dispatch/budget-envelope.ts +396 -0
- package/src/domains/dispatch/contract.ts +2 -0
- package/src/domains/dispatch/extension.ts +81 -27
- package/src/domains/dispatch/orphan-recovery.ts +1 -0
- package/src/domains/dispatch/receipt-integrity.ts +4 -0
- package/src/domains/dispatch/state.ts +1 -0
- package/src/domains/dispatch/types.ts +10 -3
- package/src/domains/dispatch/validation.ts +14 -0
- package/src/domains/dispatch/worker-spawn.ts +14 -3
- package/src/domains/eval/metrics/evidence.ts +0 -116
- package/src/domains/eval/metrics/invariants.ts +1 -1
- package/src/domains/eval/runners/clio-run.ts +1 -10
- package/src/domains/eval/runners/external-command.ts +2 -29
- package/src/domains/eval/schema/suite.ts +0 -7
- package/src/domains/eval/suites/run.ts +1 -7
- package/src/domains/evidence/build.ts +112 -45
- package/src/domains/evidence/eval.ts +24 -7
- package/src/domains/evidence/index.ts +53 -0
- package/src/domains/evidence/ordering.ts +12 -0
- package/src/domains/evidence/run-trust.ts +221 -0
- package/src/domains/evidence/store.ts +46 -6
- package/src/domains/evidence/trust-status.ts +854 -0
- package/src/domains/evidence/types.ts +26 -0
- package/src/domains/memory/index.ts +22 -0
- package/src/domains/memory/operations.ts +58 -1
- package/src/domains/memory/promotion.ts +281 -0
- package/src/domains/memory/prompt-section.ts +25 -5
- package/src/domains/memory/proposal.ts +51 -7
- package/src/domains/memory/task-bank.ts +3 -2
- package/src/domains/memory/task-memory-handoff.ts +181 -24
- package/src/domains/memory/task-memory-policy.ts +3 -1
- package/src/domains/memory/types.ts +37 -0
- package/src/domains/memory/validate.ts +178 -0
- package/src/domains/middleware/memory-intervention.ts +38 -25
- package/src/domains/middleware/runtime.ts +6 -0
- package/src/domains/middleware/skills-reminder.ts +19 -4
- package/src/domains/middleware/stalled-turn.ts +208 -5
- package/src/domains/middleware/types.ts +10 -0
- package/src/domains/observability/contract.ts +6 -1
- package/src/domains/observability/cost.ts +20 -4
- package/src/domains/observability/extension.ts +2 -2
- package/src/domains/providers/index.ts +3 -0
- package/src/domains/providers/model-discovery.ts +9 -0
- package/src/domains/providers/runtime-resolution.ts +38 -1
- package/src/domains/providers/runtimes/common/probe-helpers.ts +97 -16
- package/src/domains/providers/types/context-window-slots.ts +18 -0
- package/src/domains/providers/types/runtime-descriptor.ts +3 -1
- package/src/domains/safety/autonomy.ts +1 -1
- package/src/domains/safety/call-target.ts +211 -14
- package/src/domains/safety/decision-presentation.ts +268 -0
- package/src/domains/safety/default-path-policy.ts +8 -0
- package/src/domains/safety/finish-contract.ts +4 -3
- package/src/domains/safety/policy-engine.ts +48 -6
- package/src/domains/safety/redaction.ts +73 -0
- package/src/domains/session/compaction/compact.ts +23 -1
- package/src/domains/session/compaction/cut-point.ts +2 -0
- package/src/domains/session/compaction/tokens.ts +16 -1
- package/src/domains/session/context-ledger.ts +12 -1
- package/src/domains/session/decision-board.ts +4 -0
- package/src/domains/session/entries.ts +110 -1
- package/src/domains/session/history.ts +68 -19
- package/src/domains/session/manager.ts +9 -2
- package/src/domains/session/migrations/index.ts +22 -3
- package/src/domains/session/usage.ts +24 -7
- package/src/engine/acp/event-mapper.ts +7 -0
- package/src/engine/acp/server.ts +32 -2
- package/src/engine/agent.ts +18 -1
- package/src/engine/apis/lmstudio.ts +25 -4
- package/src/engine/apis/openai-completions.ts +147 -22
- package/src/engine/claude/sdk-runtime.ts +8 -2
- package/src/engine/claude/tool-safety.ts +13 -0
- package/src/engine/loop-guard.ts +27 -3
- package/src/engine/session.ts +9 -3
- package/src/engine/worker-events.ts +4 -3
- package/src/engine/worker-runtime.ts +59 -54
- package/src/entry/orchestrator.ts +34 -5
- package/src/interactive/chat-loop-messages.ts +40 -6
- package/src/interactive/chat-loop.ts +13 -0
- package/src/interactive/chat-panel.ts +17 -1
- package/src/interactive/chat-renderer.ts +49 -24
- package/src/interactive/clio-editor.ts +44 -7
- package/src/interactive/context-meter.ts +10 -0
- package/src/interactive/context-overlay.ts +120 -7
- package/src/interactive/context-recall-command.ts +110 -0
- package/src/interactive/cost-overlay.ts +39 -8
- package/src/interactive/dispatch-board.ts +212 -35
- package/src/interactive/footer/widgets.ts +13 -0
- package/src/interactive/interactive-application.ts +6 -1
- package/src/interactive/interactive-input-runtime.ts +11 -1
- package/src/interactive/interactive-presentation.ts +11 -1
- package/src/interactive/interactive-slash-runtime.ts +37 -1
- package/src/interactive/memory-overlay.ts +89 -4
- package/src/interactive/model-session-replay.ts +21 -0
- package/src/interactive/overlay-ask-user-lifecycle.ts +1 -1
- package/src/interactive/overlay-frame.ts +5 -2
- package/src/interactive/overlay-general-openers.ts +46 -1
- package/src/interactive/overlay-key-routing.ts +41 -1
- package/src/interactive/overlay-lifecycle.ts +11 -4
- package/src/interactive/overlay-permission-lifecycle.ts +23 -8
- package/src/interactive/overlay-session-lifecycle.ts +8 -4
- package/src/interactive/overlay-transitions.ts +11 -0
- package/src/interactive/overlays/ask-user.ts +74 -30
- package/src/interactive/overlays/decisions.ts +3 -1
- package/src/interactive/permission-hint.ts +35 -0
- package/src/interactive/permission-overlay.ts +95 -45
- package/src/interactive/renderers/tool-execution.ts +37 -51
- package/src/interactive/session-last-turn.ts +8 -1
- package/src/interactive/session-transcript.ts +2 -2
- package/src/interactive/session-usage-reseed.ts +36 -10
- package/src/interactive/slash-commands.ts +31 -4
- package/src/interactive/status/summary.ts +5 -0
- package/src/interactive/status/types.ts +5 -0
- package/src/interactive/terminal-lease.ts +1 -0
- package/src/interactive/turn-context.ts +333 -110
- package/src/interactive/turn-middleware.ts +7 -6
- package/src/interactive/turn-runtime.ts +37 -8
- package/src/interactive/turn-state.ts +3 -0
- package/src/interactive/worker-progress.ts +440 -0
- package/src/interactive/worker-stream.ts +51 -110
- package/src/tools/agent-tools.ts +39 -7
- package/src/tools/ask-user.ts +21 -1
- package/src/tools/bash.ts +144 -82
- package/src/tools/builtin-tool-catalog.ts +11 -5
- package/src/tools/context/index.ts +107 -5
- package/src/tools/context/surface.ts +3 -2
- package/src/tools/core-bootstrap.ts +21 -0
- package/src/tools/dispatch-arguments.ts +8 -0
- package/src/tools/dispatch-event-text.ts +19 -0
- package/src/tools/dispatch-runner.ts +9 -7
- package/src/tools/dispatch.ts +24 -1
- package/src/tools/monitor.ts +43 -20
- package/src/tools/registry.ts +72 -10
- package/src/tools/result-disposition.ts +706 -0
- package/src/tools/result-shaping.ts +321 -20
- package/src/tools/safe-exec.ts +2 -0
- package/src/tools/verify/authoring.ts +1120 -0
- package/src/tools/verify/catalog.ts +346 -0
- package/src/tools/verify/index.ts +13 -3
- package/src/tools/verify/scripts.ts +135 -37
- package/src/tools/verify/surface.ts +9 -5
- package/src/tools/worker-evidence.ts +54 -12
- package/src/worker/spec-contract.ts +43 -3
- package/dist/chunk-J7CWMCQD.js +0 -255
- package/dist/chunk-T6YILFSB.js +0 -80
- package/dist/chunk-VAKQQHWR.js +0 -434
- package/dist/chunk-VPAYEGVX.js +0 -184
- package/dist/chunk-XBXAASKX.js +0 -18
- package/dist/memory-WFZMGYHX.js +0 -236
- package/src/domains/eval/metrics/chaos-stream.ts +0 -93
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
assertAgentIdNamespace
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R46L2BIR.js";
|
|
5
5
|
import {
|
|
6
6
|
parseFrontmatter
|
|
7
7
|
} from "./chunk-QKMUKYO7.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
createSafetyPolicyEngine,
|
|
23
23
|
parseResultContract
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-EKY57CSP.js";
|
|
25
25
|
import {
|
|
26
26
|
assertAgentSpecPolicy,
|
|
27
27
|
classify,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isAgentProjectContextTier,
|
|
34
34
|
isShadowAgent,
|
|
35
35
|
normalizeAgentSpec
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AOCYTWAV.js";
|
|
37
37
|
import {
|
|
38
38
|
clioConfigDir,
|
|
39
39
|
clioStateDir,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
BusChannels,
|
|
44
44
|
isRunAbortedPayload
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-G7MUEIGA.js";
|
|
46
46
|
import {
|
|
47
47
|
resolvePackageRoot
|
|
48
48
|
} from "./chunk-IWHMRKLL.js";
|
|
@@ -65,20 +65,16 @@ import path2 from "node:path";
|
|
|
65
65
|
// src/domains/agents/recipe.ts
|
|
66
66
|
init_esm_shims();
|
|
67
67
|
import path from "node:path";
|
|
68
|
-
var AGENT_BUDGET_KEYS = ["toolCalls", "readReserve", "synthesis"];
|
|
69
|
-
function
|
|
70
|
-
if (value === void 0) return void 0;
|
|
71
|
-
const prefix = `agent budget: ${sourcePath}: budget`;
|
|
68
|
+
var AGENT_BUDGET_KEYS = ["toolCalls", "readReserve", "synthesis", "maximum"];
|
|
69
|
+
function parseAgentBudgetPhase(value, prefix, relationTarget) {
|
|
72
70
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
73
71
|
throw new Error(`${prefix} must be a non-null YAML object`);
|
|
74
72
|
}
|
|
75
73
|
const record = value;
|
|
76
74
|
for (const key of Object.keys(record)) {
|
|
77
|
-
if (
|
|
78
|
-
throw new Error(`${prefix}.${key} is unknown`);
|
|
79
|
-
}
|
|
75
|
+
if (key !== "toolCalls" && key !== "readReserve") throw new Error(`${prefix}.${key} is unknown`);
|
|
80
76
|
}
|
|
81
|
-
for (const key of
|
|
77
|
+
for (const key of ["toolCalls", "readReserve"]) {
|
|
82
78
|
if (!Object.hasOwn(record, key)) throw new Error(`${prefix}.${key} is required`);
|
|
83
79
|
}
|
|
84
80
|
const toolCalls = record.toolCalls;
|
|
@@ -91,10 +87,41 @@ function parseAgentBudget(value, sourcePath) {
|
|
|
91
87
|
throw new Error(`${prefix}.readReserve must be a finite safe integer`);
|
|
92
88
|
}
|
|
93
89
|
if (readReserve < 0) throw new Error(`${prefix}.readReserve must be greater than or equal to 0`);
|
|
94
|
-
if (readReserve >= toolCalls) throw new Error(`${prefix}.readReserve must be less than
|
|
90
|
+
if (readReserve >= toolCalls) throw new Error(`${prefix}.readReserve must be less than ${relationTarget}`);
|
|
91
|
+
return { toolCalls, readReserve };
|
|
92
|
+
}
|
|
93
|
+
function parseAgentBudget(value, sourcePath) {
|
|
94
|
+
if (value === void 0) return void 0;
|
|
95
|
+
const prefix = `agent budget: ${sourcePath}: budget`;
|
|
96
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
97
|
+
throw new Error(`${prefix} must be a non-null YAML object`);
|
|
98
|
+
}
|
|
99
|
+
const record = value;
|
|
100
|
+
for (const key of Object.keys(record)) {
|
|
101
|
+
if (!AGENT_BUDGET_KEYS.includes(key)) {
|
|
102
|
+
throw new Error(`${prefix}.${key} is unknown`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const key of ["toolCalls", "readReserve", "synthesis"]) {
|
|
106
|
+
if (!Object.hasOwn(record, key)) throw new Error(`${prefix}.${key} is required`);
|
|
107
|
+
}
|
|
108
|
+
const phase = parseAgentBudgetPhase(
|
|
109
|
+
{ toolCalls: record.toolCalls, readReserve: record.readReserve },
|
|
110
|
+
prefix,
|
|
111
|
+
"budget.toolCalls"
|
|
112
|
+
);
|
|
95
113
|
const synthesis = record.synthesis;
|
|
96
114
|
if (typeof synthesis !== "boolean") throw new Error(`${prefix}.synthesis must be a boolean`);
|
|
97
|
-
|
|
115
|
+
const maximum = record.maximum === void 0 ? void 0 : parseAgentBudgetPhase(record.maximum, `${prefix}.maximum`, "budget.maximum.toolCalls");
|
|
116
|
+
if (maximum !== void 0) {
|
|
117
|
+
if (maximum.toolCalls < phase.toolCalls) {
|
|
118
|
+
throw new Error(`${prefix}.maximum.toolCalls must be greater than or equal to budget.toolCalls`);
|
|
119
|
+
}
|
|
120
|
+
if (maximum.readReserve < phase.readReserve) {
|
|
121
|
+
throw new Error(`${prefix}.maximum.readReserve must be greater than or equal to budget.readReserve`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { ...phase, synthesis, ...maximum === void 0 ? {} : { maximum } };
|
|
98
125
|
}
|
|
99
126
|
function recipeIdFromPath(absPath, rootDir) {
|
|
100
127
|
const resolvedRoot = path.resolve(rootDir);
|
|
@@ -1036,4 +1063,4 @@ export {
|
|
|
1036
1063
|
AgentsDomainModule,
|
|
1037
1064
|
SafetyDomainModule
|
|
1038
1065
|
};
|
|
1039
|
-
//# sourceMappingURL=chunk-
|
|
1066
|
+
//# sourceMappingURL=chunk-LYF7OHWH.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createSlicer,
|
|
4
4
|
isIndexablePath,
|
|
5
5
|
languageForPath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UUVG37B4.js";
|
|
7
7
|
import {
|
|
8
8
|
CODEWIKI_VERSION
|
|
9
9
|
} from "./chunk-LBMZMYH2.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
WORKSPACE_EXCLUDED_DIRS,
|
|
12
12
|
enumerateWorkspaceFilesAsync,
|
|
13
13
|
filterWorkspaceFileCandidates
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-33YXPOE3.js";
|
|
15
15
|
import {
|
|
16
16
|
classifyCHeaderLanguage,
|
|
17
17
|
isAmbiguousHeaderPath
|
|
@@ -1183,4 +1183,4 @@ export {
|
|
|
1183
1183
|
updateCodewikiPaths,
|
|
1184
1184
|
syncCodewiki
|
|
1185
1185
|
};
|
|
1186
|
-
//# sourceMappingURL=chunk-
|
|
1186
|
+
//# sourceMappingURL=chunk-M6L6IDJG.js.map
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
isVerificationScriptName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UL3WSD3F.js";
|
|
5
5
|
import {
|
|
6
6
|
canonicalizeExistingPath
|
|
7
7
|
} from "./chunk-ECH6PKUQ.js";
|
|
8
8
|
import {
|
|
9
|
-
ToolNames
|
|
10
|
-
isBuiltinToolName
|
|
9
|
+
ToolNames
|
|
11
10
|
} from "./chunk-CGKSTWHD.js";
|
|
12
11
|
import {
|
|
13
12
|
init_esm_shims
|
|
14
13
|
} from "./chunk-3R73A4XB.js";
|
|
15
14
|
|
|
16
|
-
// src/domains/agents/spec.ts
|
|
17
|
-
init_esm_shims();
|
|
18
|
-
import { createHash } from "node:crypto";
|
|
19
|
-
|
|
20
|
-
// src/domains/safety/action-classifier.ts
|
|
21
|
-
init_esm_shims();
|
|
22
|
-
import path2 from "node:path";
|
|
23
|
-
|
|
24
15
|
// src/core/artifact-paths.ts
|
|
25
16
|
init_esm_shims();
|
|
26
17
|
var CLIO_PROJECT_DIR = ".clio-coder";
|
|
@@ -756,415 +747,6 @@ function compareStrings(left, right) {
|
|
|
756
747
|
return 0;
|
|
757
748
|
}
|
|
758
749
|
|
|
759
|
-
// src/domains/safety/action-classifier.ts
|
|
760
|
-
var GIT_DESTRUCTIVE_PATTERNS = [
|
|
761
|
-
{ name: "git-push-force-long", re: /\bgit\s+push\s+--force\b/i },
|
|
762
|
-
{ name: "git-push-force-short", re: /\bgit\s+push\s+-f\b/i },
|
|
763
|
-
{ name: "git-reset-hard", re: /\bgit\s+reset\s+--hard\b/i },
|
|
764
|
-
{ name: "git-clean-fd", re: /\bgit\s+clean\s+-fd?\b/i },
|
|
765
|
-
{ name: "git-checkout-dot", re: /\bgit\s+checkout\s+--\s+\./i },
|
|
766
|
-
{ name: "git-branch-D", re: /\bgit\s+branch\s+-D\b/i },
|
|
767
|
-
{ name: "git-restore-source", re: /\bgit\s+restore\s+--source\b/i }
|
|
768
|
-
];
|
|
769
|
-
var SYSTEM_MODIFY_PATTERNS = [
|
|
770
|
-
{ name: "sudo-or-doas", re: /\b(sudo|doas)\b/i },
|
|
771
|
-
// allow rm -rf /tmp/... and /var/tmp/... but flag everything else rooted at /
|
|
772
|
-
{ name: "rm-rf-root", re: /\brm\s+-rf?\s+\/(?!(tmp|var\/tmp)(?:\/|\s|$))/i },
|
|
773
|
-
{ name: "apt-install", re: /\bapt(-get)?\s+(install|remove|purge)/i },
|
|
774
|
-
{ name: "brew-install", re: /\bbrew\s+(install|uninstall|reinstall)/i },
|
|
775
|
-
{ name: "npm-install-global", re: /\bnpm\s+install\s+-g\b/i },
|
|
776
|
-
{ name: "pip-install", re: /\bpip\s+install\b/i },
|
|
777
|
-
{ name: "systemctl", re: /\bsystemctl\s+/i },
|
|
778
|
-
{ name: "chmod-root", re: /\bchmod\s+[0-7]{3,4}\s+\//i },
|
|
779
|
-
{ name: "chown", re: /\bchown\s+/i }
|
|
780
|
-
];
|
|
781
|
-
var SYSTEM_WRITE_ROOT_PREFIXES = ["/etc", "/usr", "/var", "/bin", "/sbin", "/run"];
|
|
782
|
-
var SYSTEM_WRITE_EXEMPT_PREFIXES = ["/var/tmp", "/var/folders"];
|
|
783
|
-
function isUnderPrefix(abs, prefix) {
|
|
784
|
-
return abs === prefix || abs.startsWith(`${prefix}/`);
|
|
785
|
-
}
|
|
786
|
-
function baseClassify(tool) {
|
|
787
|
-
switch (tool) {
|
|
788
|
-
case ToolNames.Read:
|
|
789
|
-
case ToolNames.Grep:
|
|
790
|
-
case ToolNames.Find:
|
|
791
|
-
case ToolNames.Ls:
|
|
792
|
-
case ToolNames.WebFetch:
|
|
793
|
-
case ToolNames.Git:
|
|
794
|
-
case ToolNames.CodeNav:
|
|
795
|
-
case ToolNames.Context:
|
|
796
|
-
case ToolNames.Monitor:
|
|
797
|
-
case ToolNames.AskUser:
|
|
798
|
-
case ToolNames.CredentialPresent:
|
|
799
|
-
// tasks pick mutates only Clio-owned session-ledger and project-local
|
|
800
|
-
// .clio-coder runtime state, never source-workspace files. By intentional
|
|
801
|
-
// policy it stays read class and ungated; the tool itself still requires
|
|
802
|
-
// a durable operator task id before it can mutate either store.
|
|
803
|
-
case ToolNames.Tasks:
|
|
804
|
-
// ledger posts a typed contribution to a coordination board and reads a
|
|
805
|
-
// local mirror. Neither touches the workspace, so it is never gated
|
|
806
|
-
// behind a confirmation.
|
|
807
|
-
case ToolNames.Ledger:
|
|
808
|
-
return "read";
|
|
809
|
-
case ToolNames.Write:
|
|
810
|
-
case ToolNames.Edit:
|
|
811
|
-
case ToolNames.Artifact:
|
|
812
|
-
return "write";
|
|
813
|
-
case ToolNames.Bash:
|
|
814
|
-
case ToolNames.Verify:
|
|
815
|
-
return "execute";
|
|
816
|
-
case ToolNames.Dispatch:
|
|
817
|
-
case ToolNames.Steer:
|
|
818
|
-
return "dispatch";
|
|
819
|
-
default:
|
|
820
|
-
return null;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
function scanStringOf(args) {
|
|
824
|
-
if (!args) return "";
|
|
825
|
-
const parts = [];
|
|
826
|
-
for (const value of Object.values(args)) {
|
|
827
|
-
if (value == null) continue;
|
|
828
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
829
|
-
parts.push(String(value));
|
|
830
|
-
} else {
|
|
831
|
-
try {
|
|
832
|
-
parts.push(JSON.stringify(value));
|
|
833
|
-
} catch {
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
return parts.join(" ");
|
|
838
|
-
}
|
|
839
|
-
function matchFirst(patterns, haystack) {
|
|
840
|
-
for (const p of patterns) {
|
|
841
|
-
if (p.re.test(haystack)) return p;
|
|
842
|
-
}
|
|
843
|
-
return null;
|
|
844
|
-
}
|
|
845
|
-
function resolveCandidate(p, baseCwd) {
|
|
846
|
-
if (p.startsWith("~")) return p;
|
|
847
|
-
const base = canonicalizeExistingPath(path2.resolve(baseCwd ?? process.cwd()));
|
|
848
|
-
const resolved = path2.isAbsolute(p) ? path2.resolve(p) : path2.resolve(base, p);
|
|
849
|
-
return canonicalizeExistingPath(resolved);
|
|
850
|
-
}
|
|
851
|
-
function isInsideCwd(abs) {
|
|
852
|
-
const cwd = canonicalizeExistingPath(path2.resolve(process.cwd()));
|
|
853
|
-
const candidate = canonicalizeExistingPath(abs);
|
|
854
|
-
const rel = path2.relative(cwd, candidate);
|
|
855
|
-
return rel === "" || !rel.startsWith("..") && !path2.isAbsolute(rel);
|
|
856
|
-
}
|
|
857
|
-
function writePathClass(pathArg, baseCwd) {
|
|
858
|
-
if (pathArg.startsWith("~")) {
|
|
859
|
-
return { cls: "system_modify", reason: `write-path-home-escape: ${pathArg}` };
|
|
860
|
-
}
|
|
861
|
-
const abs = resolveCandidate(pathArg, baseCwd);
|
|
862
|
-
const exempt = SYSTEM_WRITE_EXEMPT_PREFIXES.some((prefix) => isUnderPrefix(abs, prefix));
|
|
863
|
-
if (!exempt) {
|
|
864
|
-
for (const prefix of SYSTEM_WRITE_ROOT_PREFIXES) {
|
|
865
|
-
if (isUnderPrefix(abs, prefix)) {
|
|
866
|
-
return { cls: "system_modify", reason: `write-path-system-root: ${prefix}` };
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
if (!isInsideCwd(abs)) {
|
|
871
|
-
return { cls: "system_modify", reason: `write-path-outside-cwd: ${abs}` };
|
|
872
|
-
}
|
|
873
|
-
return { cls: "write" };
|
|
874
|
-
}
|
|
875
|
-
function extractWritePath(tool, args) {
|
|
876
|
-
const candidate = args?.path ?? args?.file_path ?? args?.filePath;
|
|
877
|
-
if (typeof candidate === "string" && candidate.length > 0) return candidate;
|
|
878
|
-
return tool === ToolNames.Artifact ? artifactDefaultPath(args?.kind) : null;
|
|
879
|
-
}
|
|
880
|
-
function classify(call) {
|
|
881
|
-
const base = baseClassify(call.tool);
|
|
882
|
-
if (base === null) {
|
|
883
|
-
return { actionClass: "unknown", reasons: [`unknown tool: ${call.tool}`] };
|
|
884
|
-
}
|
|
885
|
-
const reasons = [];
|
|
886
|
-
if (call.tool === ToolNames.Bash) {
|
|
887
|
-
const scan = scanStringOf(call.args);
|
|
888
|
-
const gitHit = matchFirst(GIT_DESTRUCTIVE_PATTERNS, scan);
|
|
889
|
-
if (gitHit) {
|
|
890
|
-
return { actionClass: "git_destructive", reasons: [`pattern:${gitHit.name}`] };
|
|
891
|
-
}
|
|
892
|
-
const sysHit = matchFirst(SYSTEM_MODIFY_PATTERNS, scan);
|
|
893
|
-
if (sysHit) {
|
|
894
|
-
return { actionClass: "system_modify", reasons: [`pattern:${sysHit.name}`] };
|
|
895
|
-
}
|
|
896
|
-
const command = typeof call.args?.command === "string" ? call.args.command : null;
|
|
897
|
-
const argCwd = typeof call.args?.cwd === "string" && call.args.cwd.length > 0 ? call.args.cwd : void 0;
|
|
898
|
-
if (command !== null) {
|
|
899
|
-
const targetReasons = [];
|
|
900
|
-
for (const target of extractCommandWriteTargets(command)) {
|
|
901
|
-
const decision = writePathClass(target, argCwd);
|
|
902
|
-
if (decision.cls === "system_modify") {
|
|
903
|
-
targetReasons.push(decision.reason ?? `bash-write-target: ${target}`);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
for (const target of extractCommandCdTargets(command)) {
|
|
907
|
-
if (target.startsWith("~")) {
|
|
908
|
-
targetReasons.push(`bash-cd-home-escape: ${target}`);
|
|
909
|
-
continue;
|
|
910
|
-
}
|
|
911
|
-
const abs = resolveCandidate(target, argCwd);
|
|
912
|
-
if (!isInsideCwd(abs)) {
|
|
913
|
-
targetReasons.push(`bash-cd-outside-workspace: ${abs}`);
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
if (targetReasons.length > 0) {
|
|
917
|
-
return { actionClass: "system_modify", reasons: targetReasons };
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
return { actionClass: "execute", reasons };
|
|
921
|
-
}
|
|
922
|
-
if (base === "write") {
|
|
923
|
-
const pathArg = extractWritePath(call.tool, call.args);
|
|
924
|
-
if (pathArg) {
|
|
925
|
-
const decision = writePathClass(pathArg);
|
|
926
|
-
if (decision.cls === "system_modify") {
|
|
927
|
-
return { actionClass: "system_modify", reasons: decision.reason ? [decision.reason] : [] };
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
return { actionClass: "write", reasons };
|
|
931
|
-
}
|
|
932
|
-
return { actionClass: base, reasons };
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// src/domains/agents/spec.ts
|
|
936
|
-
var AGENT_AUTOMATION_AUTHORITIES = ["read-only", "verification", "artifact-write", "workspace-edit"];
|
|
937
|
-
var AGENT_PRODUCTS = ["orientation"];
|
|
938
|
-
var AGENT_CATEGORIES = [
|
|
939
|
-
"explore",
|
|
940
|
-
"plan",
|
|
941
|
-
"research",
|
|
942
|
-
"implement",
|
|
943
|
-
"quality",
|
|
944
|
-
"science",
|
|
945
|
-
"evolution",
|
|
946
|
-
"operations",
|
|
947
|
-
"internal"
|
|
948
|
-
];
|
|
949
|
-
var AGENT_CAPABILITY_CLASSES = [
|
|
950
|
-
"read-only",
|
|
951
|
-
"artifact-write",
|
|
952
|
-
"workspace-edit",
|
|
953
|
-
"verification",
|
|
954
|
-
"orchestration",
|
|
955
|
-
"internal"
|
|
956
|
-
];
|
|
957
|
-
var AGENT_LATENCY_CLASSES = ["fast", "balanced", "deep"];
|
|
958
|
-
var AGENT_AUDIENCES = ["base", "shadow", "custom", "internal"];
|
|
959
|
-
var AGENT_PROJECT_CONTEXT_TIERS = ["none", "bounded"];
|
|
960
|
-
function includes(values, value) {
|
|
961
|
-
return typeof value === "string" && values.includes(value);
|
|
962
|
-
}
|
|
963
|
-
function isAgentCategory(value) {
|
|
964
|
-
return includes(AGENT_CATEGORIES, value);
|
|
965
|
-
}
|
|
966
|
-
function isAgentCapabilityClass(value) {
|
|
967
|
-
return includes(AGENT_CAPABILITY_CLASSES, value);
|
|
968
|
-
}
|
|
969
|
-
function isAgentLatencyClass(value) {
|
|
970
|
-
return includes(AGENT_LATENCY_CLASSES, value);
|
|
971
|
-
}
|
|
972
|
-
function isAgentAudience(value) {
|
|
973
|
-
return includes(AGENT_AUDIENCES, value);
|
|
974
|
-
}
|
|
975
|
-
function isAgentProjectContextTier(value) {
|
|
976
|
-
return includes(AGENT_PROJECT_CONTEXT_TIERS, value);
|
|
977
|
-
}
|
|
978
|
-
function isAgentProduct(value) {
|
|
979
|
-
return includes(AGENT_PRODUCTS, value);
|
|
980
|
-
}
|
|
981
|
-
function actionClassesForTools(tools) {
|
|
982
|
-
const actions = /* @__PURE__ */ new Set();
|
|
983
|
-
for (const tool of tools) actions.add(classify({ tool }).actionClass);
|
|
984
|
-
return actions;
|
|
985
|
-
}
|
|
986
|
-
function normalizeTools(recipe) {
|
|
987
|
-
const seen = /* @__PURE__ */ new Set();
|
|
988
|
-
const tools = [];
|
|
989
|
-
for (const tool of recipe.tools) {
|
|
990
|
-
if (typeof tool !== "string" || tool.trim().length === 0) {
|
|
991
|
-
throw new Error(`agent recipe '${recipe.id}' declares an invalid tool name`);
|
|
992
|
-
}
|
|
993
|
-
if (seen.has(tool)) continue;
|
|
994
|
-
seen.add(tool);
|
|
995
|
-
tools.push(isBuiltinToolName(tool) ? tool : tool);
|
|
996
|
-
}
|
|
997
|
-
return tools;
|
|
998
|
-
}
|
|
999
|
-
function asToolName(tool) {
|
|
1000
|
-
return isBuiltinToolName(tool) ? tool : tool;
|
|
1001
|
-
}
|
|
1002
|
-
function normalizeToolRequirements(recipe, tools) {
|
|
1003
|
-
if (!recipe.toolRequirements) {
|
|
1004
|
-
throw new Error(`agent recipe '${recipe.id}' must declare tools.required and tools.optional`);
|
|
1005
|
-
}
|
|
1006
|
-
const declared = new Set(tools);
|
|
1007
|
-
const required = recipe.toolRequirements.required.map((requirement, index) => {
|
|
1008
|
-
if (typeof requirement === "string") return asToolName(requirement);
|
|
1009
|
-
if (!Array.isArray(requirement.anyOf) || requirement.anyOf.length === 0) {
|
|
1010
|
-
throw new Error(`agent recipe '${recipe.id}' tools.required[${index}].anyOf must be non-empty`);
|
|
1011
|
-
}
|
|
1012
|
-
return { anyOf: requirement.anyOf.map(asToolName) };
|
|
1013
|
-
});
|
|
1014
|
-
const optional = recipe.toolRequirements.optional.map(asToolName);
|
|
1015
|
-
const mentioned = required.flatMap(
|
|
1016
|
-
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
1017
|
-
);
|
|
1018
|
-
for (const tool of [...mentioned, ...optional]) {
|
|
1019
|
-
if (!declared.has(tool)) throw new Error(`agent recipe '${recipe.id}' requirement '${tool}' is not declared`);
|
|
1020
|
-
}
|
|
1021
|
-
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== mentioned.length + optional.length) {
|
|
1022
|
-
throw new Error(`agent recipe '${recipe.id}' contains duplicate tool requirements`);
|
|
1023
|
-
}
|
|
1024
|
-
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== tools.length) {
|
|
1025
|
-
throw new Error(`agent recipe '${recipe.id}' has declared tools without required/optional semantics`);
|
|
1026
|
-
}
|
|
1027
|
-
return { required, optional };
|
|
1028
|
-
}
|
|
1029
|
-
function resolveAgentToolCompatibility(spec, effectiveTools, options) {
|
|
1030
|
-
const available = new Set(effectiveTools);
|
|
1031
|
-
const missingRequired = [];
|
|
1032
|
-
for (const requirement of spec.toolRequirements.required) {
|
|
1033
|
-
if (typeof requirement === "string") {
|
|
1034
|
-
if (!available.has(requirement)) missingRequired.push(requirement);
|
|
1035
|
-
continue;
|
|
1036
|
-
}
|
|
1037
|
-
if (!requirement.anyOf.some((tool) => available.has(tool))) {
|
|
1038
|
-
missingRequired.push(`anyOf(${requirement.anyOf.join("|")})`);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
if (available.has(ToolNames.Dispatch) && !options.mediatesDispatch) {
|
|
1042
|
-
missingRequired.push("dispatch(runtime mediation unavailable)");
|
|
1043
|
-
}
|
|
1044
|
-
return {
|
|
1045
|
-
compatible: missingRequired.length === 0,
|
|
1046
|
-
missingRequired,
|
|
1047
|
-
lostOptional: spec.toolRequirements.optional.filter((tool) => !available.has(tool))
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
function normalizeAgentSpec(recipe) {
|
|
1051
|
-
const tools = normalizeTools(recipe);
|
|
1052
|
-
const toolRequirements = normalizeToolRequirements(recipe, tools);
|
|
1053
|
-
return {
|
|
1054
|
-
version: recipe.version,
|
|
1055
|
-
id: recipe.id,
|
|
1056
|
-
name: recipe.name,
|
|
1057
|
-
description: recipe.description,
|
|
1058
|
-
source: recipe.source,
|
|
1059
|
-
filepath: recipe.filepath,
|
|
1060
|
-
tools,
|
|
1061
|
-
toolRequirements,
|
|
1062
|
-
category: recipe.category,
|
|
1063
|
-
capabilityClass: recipe.capabilityClass,
|
|
1064
|
-
latencyClass: recipe.latencyClass,
|
|
1065
|
-
projectContextTier: recipe.projectContextTier,
|
|
1066
|
-
audience: recipe.audience,
|
|
1067
|
-
tags: recipe.tags,
|
|
1068
|
-
skills: recipe.skills,
|
|
1069
|
-
resultContract: recipe.resultContract,
|
|
1070
|
-
...recipe.product !== void 0 ? { product: recipe.product } : {},
|
|
1071
|
-
budget: recipe.budget,
|
|
1072
|
-
body: recipe.body
|
|
1073
|
-
};
|
|
1074
|
-
}
|
|
1075
|
-
function agentSpecFingerprint(spec) {
|
|
1076
|
-
const requirement = (entry) => typeof entry === "string" ? entry : `anyOf(${[...entry.anyOf].sort().join("|")})`;
|
|
1077
|
-
const payload = JSON.stringify({
|
|
1078
|
-
id: spec.id,
|
|
1079
|
-
tools: [...spec.tools].sort(),
|
|
1080
|
-
required: spec.toolRequirements.required.map(requirement).sort(),
|
|
1081
|
-
optional: [...spec.toolRequirements.optional].sort(),
|
|
1082
|
-
capabilityClass: spec.capabilityClass,
|
|
1083
|
-
latencyClass: spec.latencyClass,
|
|
1084
|
-
projectContextTier: spec.projectContextTier,
|
|
1085
|
-
audience: spec.audience,
|
|
1086
|
-
skills: [...spec.skills].sort(),
|
|
1087
|
-
resultContract: spec.resultContract,
|
|
1088
|
-
budget: spec.budget,
|
|
1089
|
-
body: createHash("sha256").update(spec.body, "utf8").digest("hex")
|
|
1090
|
-
});
|
|
1091
|
-
return createHash("sha256").update(payload, "utf8").digest("hex");
|
|
1092
|
-
}
|
|
1093
|
-
function isUserVisibleAgent(spec) {
|
|
1094
|
-
return spec.audience === "base" || spec.audience === "custom";
|
|
1095
|
-
}
|
|
1096
|
-
function isShadowAgent(spec) {
|
|
1097
|
-
return spec.audience === "shadow" || spec.audience === "internal";
|
|
1098
|
-
}
|
|
1099
|
-
function agentSpecPolicyErrors(spec) {
|
|
1100
|
-
const errors = [];
|
|
1101
|
-
const actions = actionClassesForTools(spec.tools);
|
|
1102
|
-
const requiredGroups = spec.toolRequirements.required.map(
|
|
1103
|
-
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
1104
|
-
);
|
|
1105
|
-
const requiresTool = (tool) => requiredGroups.some((group) => group.length > 0 && group.every((candidate) => candidate === tool));
|
|
1106
|
-
const requiresMutation = requiredGroups.some(
|
|
1107
|
-
(group) => group.length > 0 && group.every((tool) => tool === ToolNames.Write || tool === ToolNames.Edit)
|
|
1108
|
-
);
|
|
1109
|
-
if (spec.capabilityClass === "workspace-edit" && (!requiresTool(ToolNames.Read) || !requiresMutation)) {
|
|
1110
|
-
errors.push(`workspace-edit agent '${spec.id}' must require read and write|edit`);
|
|
1111
|
-
}
|
|
1112
|
-
if (spec.capabilityClass === "verification" && !requiresTool(ToolNames.Verify)) {
|
|
1113
|
-
errors.push(`verification agent '${spec.id}' must require verify`);
|
|
1114
|
-
}
|
|
1115
|
-
if (spec.capabilityClass === "artifact-write" && !requiresTool(ToolNames.Artifact)) {
|
|
1116
|
-
errors.push(`artifact-write agent '${spec.id}' must require artifact`);
|
|
1117
|
-
}
|
|
1118
|
-
if (spec.skills.length > 0 && !requiresTool(ToolNames.Context)) {
|
|
1119
|
-
errors.push(`agent '${spec.id}' must require context for bound skills`);
|
|
1120
|
-
}
|
|
1121
|
-
if (spec.capabilityClass === "orchestration" && spec.tools.includes(ToolNames.Dispatch) && !requiresTool(ToolNames.Dispatch)) {
|
|
1122
|
-
errors.push(`orchestration agent '${spec.id}' must require dispatch when it is declared`);
|
|
1123
|
-
}
|
|
1124
|
-
const toolList = spec.tools.join(", ");
|
|
1125
|
-
if (spec.capabilityClass === "read-only") {
|
|
1126
|
-
for (const action of actions) {
|
|
1127
|
-
if (action !== "read") errors.push(`read-only agent '${spec.id}' requests ${action} tools (${toolList})`);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
if (spec.capabilityClass === "artifact-write") {
|
|
1131
|
-
for (const tool of spec.tools) {
|
|
1132
|
-
const action = classify({ tool }).actionClass;
|
|
1133
|
-
if (action === "execute" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
1134
|
-
errors.push(`artifact-write agent '${spec.id}' requests ${action} tool '${tool}'`);
|
|
1135
|
-
}
|
|
1136
|
-
if (action === "write" && tool !== ToolNames.Artifact) {
|
|
1137
|
-
errors.push(`artifact-write agent '${spec.id}' can only write terminal artifacts; got '${tool}'`);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
if (spec.capabilityClass === "verification") {
|
|
1142
|
-
for (const tool of spec.tools) {
|
|
1143
|
-
const action = classify({ tool }).actionClass;
|
|
1144
|
-
if (action === "write" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
1145
|
-
errors.push(`verification agent '${spec.id}' must not request ${action} tool '${tool}'`);
|
|
1146
|
-
}
|
|
1147
|
-
if (tool === ToolNames.Bash)
|
|
1148
|
-
errors.push(`verification agent '${spec.id}' must use typed validation tools, not bash`);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
if (spec.capabilityClass !== "orchestration" && spec.tools.includes(ToolNames.Dispatch)) {
|
|
1152
|
-
errors.push(`agent '${spec.id}' exposes dispatch without orchestration capability`);
|
|
1153
|
-
}
|
|
1154
|
-
if (spec.tools.includes(ToolNames.AskUser)) {
|
|
1155
|
-
errors.push(`agent '${spec.id}' exposes ask_user, which is only available to the orchestrator`);
|
|
1156
|
-
}
|
|
1157
|
-
if (spec.skills.length > 0 && !spec.tools.includes(ToolNames.Context)) {
|
|
1158
|
-
errors.push(`agent '${spec.id}' declares skills but does not expose context`);
|
|
1159
|
-
}
|
|
1160
|
-
return errors;
|
|
1161
|
-
}
|
|
1162
|
-
function assertAgentSpecPolicy(spec) {
|
|
1163
|
-
const errors = agentSpecPolicyErrors(spec);
|
|
1164
|
-
if (errors.length > 0) throw new Error(`agent policy violation:
|
|
1165
|
-
${errors.map((error) => `- ${error}`).join("\n")}`);
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
750
|
export {
|
|
1169
751
|
CLIO_PROJECT_DIR,
|
|
1170
752
|
CLIO_ARTIFACT_DIR,
|
|
@@ -1175,21 +757,8 @@ export {
|
|
|
1175
757
|
detectValidationCommand,
|
|
1176
758
|
extractCommandWriteTargets,
|
|
1177
759
|
inlineShellScript,
|
|
760
|
+
extractCommandCdTargets,
|
|
1178
761
|
extractCommandDeleteTargets,
|
|
1179
|
-
tokenizeShellLike
|
|
1180
|
-
classify,
|
|
1181
|
-
AGENT_AUTOMATION_AUTHORITIES,
|
|
1182
|
-
isAgentCategory,
|
|
1183
|
-
isAgentCapabilityClass,
|
|
1184
|
-
isAgentLatencyClass,
|
|
1185
|
-
isAgentAudience,
|
|
1186
|
-
isAgentProjectContextTier,
|
|
1187
|
-
isAgentProduct,
|
|
1188
|
-
resolveAgentToolCompatibility,
|
|
1189
|
-
normalizeAgentSpec,
|
|
1190
|
-
agentSpecFingerprint,
|
|
1191
|
-
isUserVisibleAgent,
|
|
1192
|
-
isShadowAgent,
|
|
1193
|
-
assertAgentSpecPolicy
|
|
762
|
+
tokenizeShellLike
|
|
1194
763
|
};
|
|
1195
|
-
//# sourceMappingURL=chunk-
|
|
764
|
+
//# sourceMappingURL=chunk-MV3K5QF2.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as __clioCreateRequire } from "node:module"; const requir
|
|
|
2
2
|
import {
|
|
3
3
|
computeFingerprint,
|
|
4
4
|
computeFingerprintAsync
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UUVG37B4.js";
|
|
6
6
|
import {
|
|
7
7
|
require_dist
|
|
8
8
|
} from "./chunk-APJ265NV.js";
|
|
@@ -638,4 +638,4 @@ export {
|
|
|
638
638
|
wikiStaleness,
|
|
639
639
|
wikiStalenessAsync
|
|
640
640
|
};
|
|
641
|
-
//# sourceMappingURL=chunk-
|
|
641
|
+
//# sourceMappingURL=chunk-NDINPTJ4.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
VERIFICATION_SCRIPT_FAMILY_HINT
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UL3WSD3F.js";
|
|
5
5
|
import {
|
|
6
6
|
truncateUtf8
|
|
7
7
|
} from "./chunk-6XLNIQDB.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
SAFE_EXEC_DEFAULT_TIMEOUT_MS,
|
|
17
17
|
combineSafeOutput,
|
|
18
18
|
runCommandVector
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VEZEGCGW.js";
|
|
20
20
|
import {
|
|
21
21
|
StringEnum
|
|
22
22
|
} from "./chunk-FCSXB6T2.js";
|
|
@@ -41,20 +41,24 @@ function prepareVerifyArguments(args) {
|
|
|
41
41
|
}
|
|
42
42
|
var verifyToolSurface = {
|
|
43
43
|
name: ToolNames.Verify,
|
|
44
|
-
description: 'Run a declared verification check: no arguments lists
|
|
44
|
+
description: 'Run a declared verification check: no arguments lists package scripts and .clio-coder/verifiers.yaml entries, check=<id> runs one, and check="frontend" with path validates an HTML/CSS/JS artifact.',
|
|
45
45
|
parameters: typebox_exports.Object({
|
|
46
46
|
check: typebox_exports.Optional(
|
|
47
47
|
typebox_exports.String({
|
|
48
|
-
description: `Declared script
|
|
48
|
+
description: `Declared project check ID, package script (${VERIFICATION_SCRIPT_FAMILY_HINT}), or "frontend". Omit to list available checks.`
|
|
49
49
|
})
|
|
50
50
|
),
|
|
51
51
|
path: typebox_exports.Optional(typebox_exports.String({ description: "check=frontend: artifact file under the workspace root." })),
|
|
52
|
-
args: typebox_exports.Optional(
|
|
52
|
+
args: typebox_exports.Optional(
|
|
53
|
+
typebox_exports.Array(typebox_exports.String(), { description: "Package scripts only: extra arguments passed after --." })
|
|
54
|
+
),
|
|
53
55
|
browser: typebox_exports.Optional(
|
|
54
56
|
StringEnum(BROWSER_MODES, { description: "check=frontend: headless browser mode (default auto)." })
|
|
55
57
|
),
|
|
56
|
-
cwd: typebox_exports.Optional(typebox_exports.String({ description: "
|
|
57
|
-
timeout_ms: typebox_exports.Optional(
|
|
58
|
+
cwd: typebox_exports.Optional(typebox_exports.String({ description: "Package-script working directory; ignored by project checks." })),
|
|
59
|
+
timeout_ms: typebox_exports.Optional(
|
|
60
|
+
typebox_exports.Number({ description: "Package/frontend timeout in ms; project checks use their declared timeoutMs." })
|
|
61
|
+
),
|
|
58
62
|
max_output_bytes: typebox_exports.Optional(typebox_exports.Number({ description: "Output cap in bytes (default 600000)." }))
|
|
59
63
|
}),
|
|
60
64
|
baseActionClass: "execute",
|
|
@@ -77,9 +81,11 @@ function maxOutputArg(args) {
|
|
|
77
81
|
function resultDetails(result) {
|
|
78
82
|
return {
|
|
79
83
|
command: [result.file, ...result.args].join(" "),
|
|
84
|
+
argv: [result.file, ...result.args],
|
|
80
85
|
cwd: result.cwd,
|
|
81
86
|
exitCode: result.exitCode,
|
|
82
87
|
durationMs: result.durationMs,
|
|
88
|
+
aborted: result.aborted,
|
|
83
89
|
timedOut: result.timedOut,
|
|
84
90
|
outputCapped: result.outputCapped
|
|
85
91
|
};
|
|
@@ -171,4 +177,4 @@ export {
|
|
|
171
177
|
prepareVerifyArguments,
|
|
172
178
|
verifyToolSurface
|
|
173
179
|
};
|
|
174
|
-
//# sourceMappingURL=chunk-
|
|
180
|
+
//# sourceMappingURL=chunk-NILBFAPG.js.map
|