@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,6 +1,14 @@
|
|
|
1
1
|
import { mentionsWorkerToolCallCap } from "../core/guardrails.js";
|
|
2
|
+
import {
|
|
3
|
+
formatBudgetPolicy,
|
|
4
|
+
formatBudgetReasons,
|
|
5
|
+
formatBudgetRequest,
|
|
6
|
+
formatEffectiveBudget,
|
|
7
|
+
} from "../domains/dispatch/budget-envelope.js";
|
|
2
8
|
import type { ReceiptIntegrityResult } from "../domains/dispatch/receipt-integrity.js";
|
|
3
9
|
import type { RunReceipt, RunReceiptVerification } from "../domains/dispatch/types.js";
|
|
10
|
+
import { adaptRunReceiptTrustStatus, type CanonicalTrustStatus } from "../domains/evidence/trust-status.js";
|
|
11
|
+
import { receiptResponseModelIdObservationLabel } from "./dispatch-event-text.js";
|
|
4
12
|
|
|
5
13
|
/** Matches a source citation the parent can independently spot-check. */
|
|
6
14
|
const SOURCE_CITATION_PATTERN = /([\w./~-]+):(\d+)/g;
|
|
@@ -39,10 +47,10 @@ export const SPOT_CHECK_GUIDANCE =
|
|
|
39
47
|
* keeps its own role, so this is deliberately narrow; the activity and
|
|
40
48
|
* first-pass labels below carry the honest signal for every other class.
|
|
41
49
|
*/
|
|
42
|
-
function isMutationClassRun(receipt: RunReceipt,
|
|
50
|
+
function isMutationClassRun(receipt: RunReceipt, status: CanonicalTrustStatus): boolean {
|
|
43
51
|
// A read-only agent seals `not_applicable`; recon that changes nothing is
|
|
44
52
|
// the expected outcome there, not a missing effect.
|
|
45
|
-
if (
|
|
53
|
+
if (status.validationGrounding.state === "not_applicable") return false;
|
|
46
54
|
if (receipt.executionRole === "builder" || receipt.executionRole === "recovery") return true;
|
|
47
55
|
return receipt.quality?.resultContract?.sourceId?.startsWith("agent-result-contract:mutation-report") === true;
|
|
48
56
|
}
|
|
@@ -87,7 +95,7 @@ function receiptAdmissionLabels(receipt: RunReceipt): string[] {
|
|
|
87
95
|
* fixed the file. These labels are the receipt's own counters, so the parent
|
|
88
96
|
* sees the shape of the run before it reads the worker's account of it.
|
|
89
97
|
*/
|
|
90
|
-
function receiptActivityLabels(receipt: RunReceipt,
|
|
98
|
+
function receiptActivityLabels(receipt: RunReceipt, status: CanonicalTrustStatus): string[] {
|
|
91
99
|
const labels: string[] = [];
|
|
92
100
|
const activity = receipt.toolActivity;
|
|
93
101
|
if (activity !== undefined) {
|
|
@@ -98,7 +106,7 @@ function receiptActivityLabels(receipt: RunReceipt, verification: RunReceiptVeri
|
|
|
98
106
|
);
|
|
99
107
|
// The case this whole label set exists for: the task was to change
|
|
100
108
|
// something and nothing changed, under an exit code that says success.
|
|
101
|
-
if (!activity.mutatingSucceeded && isMutationClassRun(receipt,
|
|
109
|
+
if (!activity.mutatingSucceeded && isMutationClassRun(receipt, status)) labels.push("mutation_effect=none");
|
|
102
110
|
}
|
|
103
111
|
const findings = receipt.findingsSummary;
|
|
104
112
|
if (findings !== undefined) {
|
|
@@ -119,7 +127,11 @@ export function receiptEvidenceLabels(
|
|
|
119
127
|
verification: RunReceiptVerification,
|
|
120
128
|
integrity: ReceiptIntegrityResult,
|
|
121
129
|
): string[] {
|
|
122
|
-
|
|
130
|
+
const status = adaptRunReceiptTrustStatus({ ...receipt, verification }, { integrity });
|
|
131
|
+
const canonical = canonicalTrustLabel(status);
|
|
132
|
+
if (!integrity.ok) {
|
|
133
|
+
return [canonical, `receipt_integrity=FAILED reason=${JSON.stringify(integrity.reason)}`];
|
|
134
|
+
}
|
|
123
135
|
const briefing =
|
|
124
136
|
receipt.briefing === undefined
|
|
125
137
|
? "briefing=none"
|
|
@@ -131,24 +143,49 @@ export function receiptEvidenceLabels(
|
|
|
131
143
|
sections.length > 0 ? ` sections:${[...sections].sort().join(",")}` : ""
|
|
132
144
|
}${receipt.projectContext.contentHash !== undefined ? ` sha256:${receipt.projectContext.contentHash}` : ""}`;
|
|
133
145
|
}
|
|
146
|
+
const responseModelIdObservation = receiptResponseModelIdObservationLabel(receipt);
|
|
147
|
+
const budget =
|
|
148
|
+
receipt.budget === undefined
|
|
149
|
+
? []
|
|
150
|
+
: [
|
|
151
|
+
`budget_recipe_policy=${JSON.stringify(formatBudgetPolicy(receipt.budget))}`,
|
|
152
|
+
`budget_requested=${JSON.stringify(formatBudgetRequest(receipt.budget))}`,
|
|
153
|
+
`budget_effective=${JSON.stringify(formatEffectiveBudget(receipt.budget))}`,
|
|
154
|
+
`budget_reason=${JSON.stringify(formatBudgetReasons(receipt.budget))}`,
|
|
155
|
+
];
|
|
134
156
|
return [
|
|
157
|
+
canonical,
|
|
135
158
|
`receipt_integrity=verified/v${receipt.integrity.version}/${receipt.integrity.algorithm}`,
|
|
136
159
|
`evidence_verification=${verification.state}/${verification.basis}`,
|
|
160
|
+
...(responseModelIdObservation ? [responseModelIdObservation] : []),
|
|
161
|
+
...budget,
|
|
137
162
|
...receiptAdmissionLabels(receipt),
|
|
138
|
-
...receiptActivityLabels(receipt,
|
|
163
|
+
...receiptActivityLabels(receipt, status),
|
|
139
164
|
briefing,
|
|
140
165
|
projectContext,
|
|
141
166
|
];
|
|
142
167
|
}
|
|
143
168
|
|
|
169
|
+
function canonicalTrustLabel(status: CanonicalTrustStatus): string {
|
|
170
|
+
return [
|
|
171
|
+
`trust_status=v${status.version}`,
|
|
172
|
+
`artifactIntegrity:${status.artifactIntegrity.state}`,
|
|
173
|
+
`validationGrounding:${status.validationGrounding.state}`,
|
|
174
|
+
`independentReview:${status.independentReview.state}`,
|
|
175
|
+
`contextProvenance:${status.contextProvenance.state}`,
|
|
176
|
+
`autonomyEnforcement:${status.autonomyEnforcement.state}`,
|
|
177
|
+
`completionEvidence:${status.completionEvidence.state}`,
|
|
178
|
+
].join(" ");
|
|
179
|
+
}
|
|
180
|
+
|
|
144
181
|
/**
|
|
145
182
|
* Header for delegated worker text, keyed only on integrity-checked receipt
|
|
146
183
|
* verification. The string is shared by dispatch and monitor so detached
|
|
147
184
|
* collection cannot silently assign a different evidence meaning.
|
|
148
185
|
*/
|
|
149
|
-
export function workerTextLabel(
|
|
150
|
-
switch (
|
|
151
|
-
case "
|
|
186
|
+
export function workerTextLabel(status: CanonicalTrustStatus): string {
|
|
187
|
+
switch (status.validationGrounding.state) {
|
|
188
|
+
case "validated":
|
|
152
189
|
return "worker output (tool-verified):";
|
|
153
190
|
case "not_applicable":
|
|
154
191
|
return "reconnaissance output (advisory leads, not validation evidence):";
|
|
@@ -166,7 +203,7 @@ export function workerTextLabel(verification: RunReceiptVerification): string {
|
|
|
166
203
|
*/
|
|
167
204
|
export function workerTextNonEvidenceNotices(
|
|
168
205
|
receipt: RunReceipt,
|
|
169
|
-
|
|
206
|
+
status: CanonicalTrustStatus,
|
|
170
207
|
answerText: string,
|
|
171
208
|
): string[] {
|
|
172
209
|
const notices: string[] = [];
|
|
@@ -184,7 +221,7 @@ export function workerTextNonEvidenceNotices(
|
|
|
184
221
|
}
|
|
185
222
|
if (receipt.toolActivity !== undefined && receipt.toolActivity.succeeded === 0) {
|
|
186
223
|
notices.push("non-evidence: no tool call succeeded in this run; the text above was written without observed work.");
|
|
187
|
-
} else if (receipt.toolActivity?.mutatingSucceeded === false && isMutationClassRun(receipt,
|
|
224
|
+
} else if (receipt.toolActivity?.mutatingSucceeded === false && isMutationClassRun(receipt, status)) {
|
|
188
225
|
// A live verifier run returned {"verdict":"pass"} for a check it never
|
|
189
226
|
// ran, on a script that does not exist, at exit 0. The parent recovered
|
|
190
227
|
// only because it independently diffed the tree; say so on the line.
|
|
@@ -206,7 +243,12 @@ export function workerTextNonEvidenceNotices(
|
|
|
206
243
|
`non-evidence: '${receipt.capabilityMismatch.agentId}' is a ${receipt.capabilityMismatch.capabilityClass} recipe and cannot write to the workspace, but this task classified as ${receipt.capabilityMismatch.taskType}. Nothing it reports as changed can have been changed by it.`,
|
|
207
244
|
);
|
|
208
245
|
}
|
|
209
|
-
if (
|
|
246
|
+
if (
|
|
247
|
+
!failedRun &&
|
|
248
|
+
status.validationGrounding.state === "not_applicable" &&
|
|
249
|
+
answerText.length > 0 &&
|
|
250
|
+
!hasSourceCitation(answerText)
|
|
251
|
+
) {
|
|
210
252
|
notices.push(
|
|
211
253
|
"non-evidence: this reconnaissance answer cites no file:line locations; treat its leads as unconfirmed.",
|
|
212
254
|
);
|
|
@@ -48,6 +48,11 @@ export interface WorkerProtectedArtifactState {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** Concrete dispatch-time budget after recipe policy and operator clamping. */
|
|
51
|
+
export interface WorkerBudgetPhase {
|
|
52
|
+
toolCalls: number;
|
|
53
|
+
readReserve: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
export interface WorkerBudget {
|
|
52
57
|
/** Agent phase boundary before synthesis or bounded termination. */
|
|
53
58
|
toolCalls: number;
|
|
@@ -57,6 +62,8 @@ export interface WorkerBudget {
|
|
|
57
62
|
synthesis: boolean;
|
|
58
63
|
/** Independent operator-owned attempt ceiling; recipes cannot widen it. */
|
|
59
64
|
hardCap: number;
|
|
65
|
+
/** Optional ceiling that a bounded result-contract revision may activate. */
|
|
66
|
+
revision?: WorkerBudgetPhase;
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
interface WorkerSpecFields {
|
|
@@ -416,10 +423,16 @@ function validateAllowedTools(value: unknown): void {
|
|
|
416
423
|
|
|
417
424
|
function validateWorkerBudget(value: unknown): void {
|
|
418
425
|
const budget = readRecord(value, "WorkerSpec.budget");
|
|
419
|
-
const expected = ["hardCap", "readReserve", "synthesis", "toolCalls"];
|
|
426
|
+
const expected = ["hardCap", "readReserve", "revision", "synthesis", "toolCalls"];
|
|
420
427
|
const actual = Object.keys(budget).sort();
|
|
421
|
-
if (
|
|
422
|
-
|
|
428
|
+
if (
|
|
429
|
+
actual.some((key) => !expected.includes(key)) ||
|
|
430
|
+
actual.some((key) => key === "revision" && budget.revision === undefined)
|
|
431
|
+
) {
|
|
432
|
+
throw new Error(`WorkerSpec.budget may contain only: ${expected.join(", ")}`);
|
|
433
|
+
}
|
|
434
|
+
for (const required of ["hardCap", "readReserve", "synthesis", "toolCalls"] as const) {
|
|
435
|
+
if (!Object.hasOwn(budget, required)) throw new Error(`WorkerSpec.budget.${required} is required`);
|
|
423
436
|
}
|
|
424
437
|
for (const key of ["toolCalls", "readReserve", "hardCap"] as const) {
|
|
425
438
|
const value = budget[key];
|
|
@@ -436,6 +449,33 @@ function validateWorkerBudget(value: unknown): void {
|
|
|
436
449
|
throw new Error("WorkerSpec.budget.readReserve must be an integer in [0, toolCalls)");
|
|
437
450
|
}
|
|
438
451
|
if (typeof budget.synthesis !== "boolean") throw new Error("WorkerSpec.budget.synthesis must be a boolean");
|
|
452
|
+
if (budget.revision !== undefined) {
|
|
453
|
+
const revision = readRecord(budget.revision, "WorkerSpec.budget.revision");
|
|
454
|
+
const revisionKeys = Object.keys(revision).sort();
|
|
455
|
+
if (revisionKeys.length !== 2 || revisionKeys[0] !== "readReserve" || revisionKeys[1] !== "toolCalls") {
|
|
456
|
+
throw new Error("WorkerSpec.budget.revision must contain exactly: readReserve, toolCalls");
|
|
457
|
+
}
|
|
458
|
+
for (const key of ["toolCalls", "readReserve"] as const) {
|
|
459
|
+
if (typeof revision[key] !== "number" || !Number.isSafeInteger(revision[key])) {
|
|
460
|
+
throw new Error(`WorkerSpec.budget.revision.${key} must be a safe integer`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if ((revision.toolCalls as number) < (budget.toolCalls as number)) {
|
|
464
|
+
throw new Error("WorkerSpec.budget.revision.toolCalls must not be smaller than WorkerSpec.budget.toolCalls");
|
|
465
|
+
}
|
|
466
|
+
if (
|
|
467
|
+
(revision.toolCalls as number) === (budget.toolCalls as number) &&
|
|
468
|
+
(revision.readReserve as number) <= (budget.readReserve as number)
|
|
469
|
+
) {
|
|
470
|
+
throw new Error("WorkerSpec.budget.revision must increase toolCalls or readReserve");
|
|
471
|
+
}
|
|
472
|
+
if ((revision.toolCalls as number) > (budget.hardCap as number)) {
|
|
473
|
+
throw new Error("WorkerSpec.budget.revision.toolCalls must not exceed WorkerSpec.budget.hardCap");
|
|
474
|
+
}
|
|
475
|
+
if ((revision.readReserve as number) < 0 || (revision.readReserve as number) >= (revision.toolCalls as number)) {
|
|
476
|
+
throw new Error("WorkerSpec.budget.revision.readReserve must be an integer in [0, toolCalls)");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
439
479
|
}
|
|
440
480
|
|
|
441
481
|
function validateRuntimeCapabilityDecision(value: unknown, source: string): void {
|
package/dist/chunk-J7CWMCQD.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
gitCommitAttributionEnabled,
|
|
4
|
-
reportCommitAttributionDiagnostic,
|
|
5
|
-
withManagedGitCommitAttributionEnvironment
|
|
6
|
-
} from "./chunk-COU2UHX6.js";
|
|
7
|
-
import {
|
|
8
|
-
clampTimerDelayMs
|
|
9
|
-
} from "./chunk-FQ4SKYE4.js";
|
|
10
|
-
import {
|
|
11
|
-
AI_AGENT_NAME
|
|
12
|
-
} from "./chunk-6EJMN2Y3.js";
|
|
13
|
-
import {
|
|
14
|
-
init_esm_shims
|
|
15
|
-
} from "./chunk-3R73A4XB.js";
|
|
16
|
-
|
|
17
|
-
// src/core/headless-permission.ts
|
|
18
|
-
init_esm_shims();
|
|
19
|
-
var HEADLESS_PERMISSION_DENIED_REASON = "clio-coder run cannot confirm permission requests; rerun interactively to approve this action.";
|
|
20
|
-
var HEADLESS_PERMISSION_DENIED_MARKER = "clio-coder run cannot confirm permission requests";
|
|
21
|
-
|
|
22
|
-
// src/core/bash-exec.ts
|
|
23
|
-
init_esm_shims();
|
|
24
|
-
import { spawn } from "node:child_process";
|
|
25
|
-
var BASH_HARD_CAP_BYTES = 16 * 1024 * 1024;
|
|
26
|
-
var CLIO_CONTROL_ENV_KEYS = ["CLIO_CODER_INTERACTIVE", "CLIO_CODER_RESUME_SESSION_ID"];
|
|
27
|
-
var BASH_UPDATE_THROTTLE_MS = 100;
|
|
28
|
-
function buildToolEnv() {
|
|
29
|
-
const env = { ...process.env };
|
|
30
|
-
env.AI_AGENT = AI_AGENT_NAME;
|
|
31
|
-
for (const key of CLIO_CONTROL_ENV_KEYS) {
|
|
32
|
-
Reflect.deleteProperty(env, key);
|
|
33
|
-
}
|
|
34
|
-
return env;
|
|
35
|
-
}
|
|
36
|
-
var LOGIN_ENV_CAPTURE_TIMEOUT_MS = 1e4;
|
|
37
|
-
var loginEnvCapture = null;
|
|
38
|
-
function parseNullDelimitedEnv(raw) {
|
|
39
|
-
const env = {};
|
|
40
|
-
for (const entry of raw.split("\0")) {
|
|
41
|
-
if (entry.length === 0) continue;
|
|
42
|
-
const eq = entry.indexOf("=");
|
|
43
|
-
if (eq <= 0) continue;
|
|
44
|
-
env[entry.slice(0, eq)] = entry.slice(eq + 1);
|
|
45
|
-
}
|
|
46
|
-
return typeof env.PATH === "string" && env.PATH.length > 0 ? env : null;
|
|
47
|
-
}
|
|
48
|
-
function captureLoginEnv() {
|
|
49
|
-
return new Promise((resolve) => {
|
|
50
|
-
let stdout = "";
|
|
51
|
-
let settled = false;
|
|
52
|
-
const finish = (value) => {
|
|
53
|
-
if (settled) return;
|
|
54
|
-
settled = true;
|
|
55
|
-
clearTimeout(timer);
|
|
56
|
-
resolve(value);
|
|
57
|
-
};
|
|
58
|
-
const child = spawn("/bin/bash", ["-lc", "env -0"], {
|
|
59
|
-
env: buildToolEnv(),
|
|
60
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
61
|
-
});
|
|
62
|
-
const timer = setTimeout(() => {
|
|
63
|
-
child.kill("SIGKILL");
|
|
64
|
-
finish(null);
|
|
65
|
-
}, LOGIN_ENV_CAPTURE_TIMEOUT_MS);
|
|
66
|
-
child.stdout?.on("data", (chunk) => {
|
|
67
|
-
stdout += chunk.toString("utf8");
|
|
68
|
-
});
|
|
69
|
-
child.on("error", () => finish(null));
|
|
70
|
-
child.on("close", (code) => finish(code === 0 ? parseNullDelimitedEnv(stdout) : null));
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
async function bashSpawnPlan() {
|
|
74
|
-
loginEnvCapture ??= captureLoginEnv();
|
|
75
|
-
const captured = await loginEnvCapture;
|
|
76
|
-
if (captured === null) return { mode: "-lc", env: buildToolEnv() };
|
|
77
|
-
const env = { ...process.env, ...captured };
|
|
78
|
-
env.AI_AGENT = AI_AGENT_NAME;
|
|
79
|
-
for (const key of CLIO_CONTROL_ENV_KEYS) {
|
|
80
|
-
Reflect.deleteProperty(env, key);
|
|
81
|
-
}
|
|
82
|
-
return { mode: "-c", env };
|
|
83
|
-
}
|
|
84
|
-
function combineBashOutput(result) {
|
|
85
|
-
const { stdout, stderr } = result;
|
|
86
|
-
return stderr.length > 0 ? `${stdout}${stdout.endsWith("\n") || stdout.length === 0 ? "" : "\n"}${stderr}` : stdout;
|
|
87
|
-
}
|
|
88
|
-
async function runBashCommand(command, options = {}) {
|
|
89
|
-
const plan = await bashSpawnPlan();
|
|
90
|
-
const attribution = withManagedGitCommitAttributionEnvironment(plan.env, {
|
|
91
|
-
cwd: options.cwd ?? process.cwd(),
|
|
92
|
-
enabled: gitCommitAttributionEnabled(process.env)
|
|
93
|
-
});
|
|
94
|
-
reportCommitAttributionDiagnostic(attribution.diagnostic);
|
|
95
|
-
return new Promise((resolve) => {
|
|
96
|
-
const timeout = clampTimerDelayMs(options.timeoutMs ?? 3e5);
|
|
97
|
-
let aborted = false;
|
|
98
|
-
let timedOut = false;
|
|
99
|
-
let settled = false;
|
|
100
|
-
let timeoutId = null;
|
|
101
|
-
let killGraceTimer = null;
|
|
102
|
-
let killSent = false;
|
|
103
|
-
let stdout = "";
|
|
104
|
-
let stderr = "";
|
|
105
|
-
let outputBytes = 0;
|
|
106
|
-
let outputCapped = false;
|
|
107
|
-
let updateTimer = null;
|
|
108
|
-
let updateDirty = false;
|
|
109
|
-
let lastUpdateAt = 0;
|
|
110
|
-
const child = spawn("/bin/bash", [plan.mode, command], {
|
|
111
|
-
...options.cwd === void 0 ? {} : { cwd: options.cwd },
|
|
112
|
-
env: attribution.env,
|
|
113
|
-
detached: process.platform !== "win32",
|
|
114
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
115
|
-
});
|
|
116
|
-
const emitUpdate = () => {
|
|
117
|
-
if (options.onUpdate === void 0 || !updateDirty) return;
|
|
118
|
-
updateDirty = false;
|
|
119
|
-
lastUpdateAt = Date.now();
|
|
120
|
-
try {
|
|
121
|
-
options.onUpdate({ stdout, stderr, outputBytes: Math.min(outputBytes, BASH_HARD_CAP_BYTES) });
|
|
122
|
-
} catch {
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const clearUpdateTimer = () => {
|
|
126
|
-
if (updateTimer === null) return;
|
|
127
|
-
clearTimeout(updateTimer);
|
|
128
|
-
updateTimer = null;
|
|
129
|
-
};
|
|
130
|
-
const scheduleUpdate = () => {
|
|
131
|
-
if (options.onUpdate === void 0) return;
|
|
132
|
-
updateDirty = true;
|
|
133
|
-
const delay = BASH_UPDATE_THROTTLE_MS - (Date.now() - lastUpdateAt);
|
|
134
|
-
if (delay <= 0) {
|
|
135
|
-
clearUpdateTimer();
|
|
136
|
-
emitUpdate();
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
updateTimer ??= setTimeout(() => {
|
|
140
|
-
updateTimer = null;
|
|
141
|
-
emitUpdate();
|
|
142
|
-
}, delay);
|
|
143
|
-
};
|
|
144
|
-
const finishUpdates = () => {
|
|
145
|
-
clearUpdateTimer();
|
|
146
|
-
emitUpdate();
|
|
147
|
-
};
|
|
148
|
-
if (options.onUpdate !== void 0) {
|
|
149
|
-
updateDirty = true;
|
|
150
|
-
emitUpdate();
|
|
151
|
-
}
|
|
152
|
-
const clearKillGraceTimer = () => {
|
|
153
|
-
if (!killGraceTimer) return;
|
|
154
|
-
clearTimeout(killGraceTimer);
|
|
155
|
-
killGraceTimer = null;
|
|
156
|
-
};
|
|
157
|
-
const sendSignal = (signalName) => {
|
|
158
|
-
const pid = child.pid;
|
|
159
|
-
if (pid && process.platform !== "win32") {
|
|
160
|
-
try {
|
|
161
|
-
process.kill(-pid, signalName);
|
|
162
|
-
return;
|
|
163
|
-
} catch {
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
child.kill(signalName);
|
|
167
|
-
};
|
|
168
|
-
const killChild = () => {
|
|
169
|
-
if (killSent) return;
|
|
170
|
-
killSent = true;
|
|
171
|
-
sendSignal("SIGTERM");
|
|
172
|
-
killGraceTimer = setTimeout(() => {
|
|
173
|
-
sendSignal("SIGKILL");
|
|
174
|
-
}, 5e3);
|
|
175
|
-
};
|
|
176
|
-
function onAbort() {
|
|
177
|
-
aborted = true;
|
|
178
|
-
killChild();
|
|
179
|
-
}
|
|
180
|
-
if (timeout > 0) {
|
|
181
|
-
timeoutId = setTimeout(() => {
|
|
182
|
-
timedOut = true;
|
|
183
|
-
killChild();
|
|
184
|
-
}, timeout);
|
|
185
|
-
}
|
|
186
|
-
if (options.signal?.aborted) {
|
|
187
|
-
onAbort();
|
|
188
|
-
} else {
|
|
189
|
-
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
190
|
-
}
|
|
191
|
-
const appendChunk = (target, chunk) => {
|
|
192
|
-
if (outputCapped) return;
|
|
193
|
-
outputBytes += chunk.byteLength;
|
|
194
|
-
if (outputBytes > BASH_HARD_CAP_BYTES) {
|
|
195
|
-
const remaining = BASH_HARD_CAP_BYTES - (outputBytes - chunk.byteLength);
|
|
196
|
-
if (remaining > 0) {
|
|
197
|
-
const slice = chunk.subarray(0, remaining).toString("utf8");
|
|
198
|
-
if (target === "stdout") stdout += slice;
|
|
199
|
-
else stderr += slice;
|
|
200
|
-
}
|
|
201
|
-
outputCapped = true;
|
|
202
|
-
scheduleUpdate();
|
|
203
|
-
killChild();
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (target === "stdout") stdout += chunk.toString("utf8");
|
|
207
|
-
else stderr += chunk.toString("utf8");
|
|
208
|
-
scheduleUpdate();
|
|
209
|
-
};
|
|
210
|
-
child.stdout?.on("data", (chunk) => appendChunk("stdout", chunk));
|
|
211
|
-
child.stderr?.on("data", (chunk) => appendChunk("stderr", chunk));
|
|
212
|
-
child.on("error", (error) => {
|
|
213
|
-
if (settled) return;
|
|
214
|
-
settled = true;
|
|
215
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
216
|
-
clearKillGraceTimer();
|
|
217
|
-
finishUpdates();
|
|
218
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
219
|
-
resolve({
|
|
220
|
-
error,
|
|
221
|
-
stdout,
|
|
222
|
-
stderr,
|
|
223
|
-
exitCode: null,
|
|
224
|
-
signal: null,
|
|
225
|
-
aborted,
|
|
226
|
-
timedOut,
|
|
227
|
-
outputCapped
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
child.on("close", (code, signalName) => {
|
|
231
|
-
if (settled) return;
|
|
232
|
-
settled = true;
|
|
233
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
234
|
-
clearKillGraceTimer();
|
|
235
|
-
finishUpdates();
|
|
236
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
237
|
-
const error = code === 0 && signalName === null ? null : {
|
|
238
|
-
name: "Error",
|
|
239
|
-
message: signalName ? `command terminated by ${signalName}` : `command exited with code ${code ?? "?"}`,
|
|
240
|
-
code: code ?? void 0,
|
|
241
|
-
signal: signalName ?? void 0
|
|
242
|
-
};
|
|
243
|
-
resolve({ error, stdout, stderr, exitCode: code, signal: signalName, aborted, timedOut, outputCapped });
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export {
|
|
249
|
-
HEADLESS_PERMISSION_DENIED_REASON,
|
|
250
|
-
HEADLESS_PERMISSION_DENIED_MARKER,
|
|
251
|
-
BASH_HARD_CAP_BYTES,
|
|
252
|
-
combineBashOutput,
|
|
253
|
-
runBashCommand
|
|
254
|
-
};
|
|
255
|
-
//# sourceMappingURL=chunk-J7CWMCQD.js.map
|
package/dist/chunk-T6YILFSB.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
init_esm_shims
|
|
4
|
-
} from "./chunk-3R73A4XB.js";
|
|
5
|
-
|
|
6
|
-
// src/core/skill-activation.ts
|
|
7
|
-
init_esm_shims();
|
|
8
|
-
var SKILL_SUGGESTION_ANCHOR = "Suggested skill: /skill <name>";
|
|
9
|
-
var SKILL_SUGGESTION_PREFIX = SKILL_SUGGESTION_ANCHOR.slice(0, SKILL_SUGGESTION_ANCHOR.indexOf("<name>"));
|
|
10
|
-
var SKILL_SURFACE_EXEMPT_TOOLS = /* @__PURE__ */ new Set(["context", "ask_user"]);
|
|
11
|
-
function evaluateSkillToolSurface(policy, tool) {
|
|
12
|
-
if (!policy || policy.loadedSkillPolicies.size === 0) return null;
|
|
13
|
-
if (SKILL_SURFACE_EXEMPT_TOOLS.has(tool)) return null;
|
|
14
|
-
const entries = [...policy.loadedSkillPolicies.entries()];
|
|
15
|
-
const skills = entries.map(([name]) => name);
|
|
16
|
-
const disallowedBy = entries.filter(([, declared]) => declared.disallowedTools?.includes(tool) === true).map(([name]) => name);
|
|
17
|
-
if (disallowedBy.length > 0) return { skills, mergedAllowedTools: null, disallowedBy };
|
|
18
|
-
const allowLists = entries.map(([, declared]) => declared.allowedTools);
|
|
19
|
-
if (allowLists.some((list) => list === void 0 || list.length === 0)) return null;
|
|
20
|
-
const merged = [...new Set(allowLists.flatMap((list) => [...list ?? []]))];
|
|
21
|
-
if (merged.includes(tool)) return null;
|
|
22
|
-
return { skills, mergedAllowedTools: merged, disallowedBy: [] };
|
|
23
|
-
}
|
|
24
|
-
function agentSkillToolPolicy(skillNames) {
|
|
25
|
-
const allowedSkillNames = [...new Set(skillNames.map((name) => name.trim()).filter((name) => name.length > 0))];
|
|
26
|
-
if (allowedSkillNames.length === 0) return void 0;
|
|
27
|
-
return {
|
|
28
|
-
allowedSkillNames,
|
|
29
|
-
requests: allowedSkillNames.map((name) => ({ name, args: "", source: "recipe", installed: true })),
|
|
30
|
-
loadedSkillNames: /* @__PURE__ */ new Set(),
|
|
31
|
-
loadedSkillPolicies: /* @__PURE__ */ new Map()
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function trimmedString(value) {
|
|
35
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
36
|
-
}
|
|
37
|
-
function skillActivationFromSource(source, triggeredBy, turnId) {
|
|
38
|
-
const sourceOrigin = trimmedString(source.sourceOrigin) ?? trimmedString(source.sourceInfo?.source);
|
|
39
|
-
return {
|
|
40
|
-
name: source.name,
|
|
41
|
-
filePath: source.filePath,
|
|
42
|
-
hash: source.hash,
|
|
43
|
-
source: source.source,
|
|
44
|
-
...sourceOrigin ? { sourceOrigin } : {},
|
|
45
|
-
triggeredBy,
|
|
46
|
-
...turnId ? { turnId } : {}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function skillActivationFromToolDetails(details, turnId) {
|
|
50
|
-
if (!details || typeof details !== "object" || Array.isArray(details)) return null;
|
|
51
|
-
const record = details;
|
|
52
|
-
const name = trimmedString(record.name);
|
|
53
|
-
const filePath = trimmedString(record.filePath) ?? trimmedString(record.path);
|
|
54
|
-
const hash = trimmedString(record.hash);
|
|
55
|
-
const source = trimmedString(record.source);
|
|
56
|
-
const sourceOrigin = trimmedString(record.sourceOrigin) ?? trimmedString(record.origin);
|
|
57
|
-
if (!name || !filePath || !hash || !source) return null;
|
|
58
|
-
const activation = skillActivationFromSource(
|
|
59
|
-
{ name, filePath, hash, source, ...sourceOrigin ? { sourceOrigin } : {} },
|
|
60
|
-
"tool",
|
|
61
|
-
turnId
|
|
62
|
-
);
|
|
63
|
-
if (record.drift === "match" || record.drift === "mismatch") activation.drift = record.drift;
|
|
64
|
-
return activation;
|
|
65
|
-
}
|
|
66
|
-
function isSkillActivation(value) {
|
|
67
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
68
|
-
const record = value;
|
|
69
|
-
return typeof record.name === "string" && typeof record.filePath === "string" && typeof record.hash === "string" && typeof record.source === "string" && (record.sourceOrigin === void 0 || typeof record.sourceOrigin === "string") && (record.triggeredBy === "slash-command" || record.triggeredBy === "tool") && (record.turnId === void 0 || typeof record.turnId === "string") && (record.runId === void 0 || typeof record.runId === "string");
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
SKILL_SUGGESTION_ANCHOR,
|
|
74
|
-
SKILL_SUGGESTION_PREFIX,
|
|
75
|
-
evaluateSkillToolSurface,
|
|
76
|
-
agentSkillToolPolicy,
|
|
77
|
-
skillActivationFromToolDetails,
|
|
78
|
-
isSkillActivation
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=chunk-T6YILFSB.js.map
|