@iowarp/clio-coder 0.3.8 → 0.3.9
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 +49 -0
- package/README.md +7 -3
- package/dist/{acp-U67UHUK2.js → acp-7LOELQFP.js} +6 -6
- package/dist/{agents-YU6SGALZ.js → agents-FIBG2SHA.js} +27 -25
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-5ZPJOIVG.js → auth-OI4LIH2I.js} +11 -12
- package/dist/{builtins-C6JMZVV6.js → builtins-AD25UL3C.js} +5 -5
- package/dist/{chunk-5FR74PWO.js → chunk-2JDWVJND.js} +2 -2
- package/dist/chunk-3DPEIQKN.js +113 -0
- package/dist/{chunk-4SPRNWDE.js → chunk-3DUR4WUA.js} +15 -15
- package/dist/{chunk-VHN4MY6O.js → chunk-3MRC2YSQ.js} +2 -2
- package/dist/{chunk-5DHKRSMQ.js → chunk-3UUY7R3Z.js} +11 -7
- package/dist/{chunk-IGWKHNIQ.js → chunk-3V5AYSEQ.js} +8 -8
- package/dist/{chunk-FHJEP5SW.js → chunk-465CC7FK.js} +8 -5
- package/dist/{chunk-5WIGXA4T.js → chunk-47CMYGET.js} +111 -4
- package/dist/{chunk-A3WNZD3P.js → chunk-4H6ULJ3H.js} +67 -21
- package/dist/{chunk-TB5666IT.js → chunk-4LJX2PUC.js} +3 -3
- package/dist/{chunk-XWSF374K.js → chunk-56KB5IJP.js} +2 -2
- package/dist/{chunk-SPULKLCF.js → chunk-5DQRIYDZ.js} +2 -2
- package/dist/{chunk-2HEJ2F35.js → chunk-5HFBWUMU.js} +20 -8
- package/dist/{chunk-WNIJTQQK.js → chunk-5PVQ4SRS.js} +78 -6
- package/dist/{chunk-DYIM5TJT.js → chunk-5QKCQQ3E.js} +262 -6
- package/dist/{chunk-TYPGUK6W.js → chunk-5T7RBWN2.js} +111 -5
- package/dist/{chunk-IIZWH4XA.js → chunk-774ILSRL.js} +2 -2
- package/dist/chunk-7C6RYZGQ.js +391 -0
- package/dist/{chunk-TANS5ZJS.js → chunk-AD7Y7STJ.js} +3 -3
- package/dist/{chunk-RWSI4YD7.js → chunk-AEYBF3TB.js} +33 -12
- package/dist/{chunk-DGSYXYMX.js → chunk-AMKHQW3C.js} +2 -2
- package/dist/{chunk-VWZOAB7K.js → chunk-B5XRQOLB.js} +7 -7
- package/dist/{chunk-WXY7KU3G.js → chunk-BVDVID7E.js} +2 -2
- package/dist/{chunk-PMDBGQSJ.js → chunk-CA42X6KT.js} +2 -2
- package/dist/{chunk-HLE42MG7.js → chunk-D73KXYPF.js} +3 -3
- package/dist/{chunk-5Q2VVUKB.js → chunk-DG4M6ZUE.js} +3 -3
- package/dist/{chunk-ME6CCNFO.js → chunk-EBOC7MT3.js} +6 -6
- package/dist/{chunk-MXKJU4JB.js → chunk-ECUO3KDP.js} +48 -7
- package/dist/{chunk-26LEYJZH.js → chunk-FALJGAWU.js} +2 -2
- package/dist/{chunk-GWS3VEIW.js → chunk-FWDFM5ZU.js} +24 -3
- package/dist/{chunk-7RGZWPB6.js → chunk-GAYUJ7LE.js} +67 -13
- package/dist/{chunk-VCBR6CU7.js → chunk-HAY4ZE2P.js} +2 -2
- package/dist/{chunk-FBVTI2TJ.js → chunk-HCBCAYZU.js} +11 -130
- package/dist/{chunk-WSB3FPX7.js → chunk-HJB5IUKP.js} +32 -136
- package/dist/{chunk-J3YUBZWY.js → chunk-HKO36JWF.js} +33 -5
- package/dist/{chunk-E77JEWSD.js → chunk-HPCTNZM2.js} +6 -36
- package/dist/{chunk-FJ3H4MN5.js → chunk-IHKBWSXF.js} +2 -2
- package/dist/{chunk-NMPKI6XL.js → chunk-JEQQR47K.js} +37 -18
- package/dist/{chunk-3BINW3FP.js → chunk-KV2AOLDF.js} +24 -4
- package/dist/{chunk-YS5VLNH5.js → chunk-LXPJXFM5.js} +7 -7
- package/dist/{chunk-7RFXX52T.js → chunk-MIX5N5AC.js} +271 -41
- package/dist/{chunk-K4XHGFR5.js → chunk-MLOK6ZOS.js} +1297 -218
- package/dist/{chunk-ZNLWCMVZ.js → chunk-MV2VUEJC.js} +2 -2
- package/dist/{chunk-MVVUPGPW.js → chunk-MXHC5QYU.js} +6 -6
- package/dist/{chunk-5H3GB5BO.js → chunk-N3PBVRTZ.js} +4 -382
- package/dist/{chunk-2HFZQUHL.js → chunk-N5XKWMDW.js} +17 -7
- package/dist/{chunk-5C3AQNDW.js → chunk-NNNWO6F2.js} +124 -36
- package/dist/{chunk-GU2UIAFZ.js → chunk-NQ6UCCOD.js} +3 -3
- package/dist/{chunk-N22QMJKY.js → chunk-NZU6YDNV.js} +4 -4
- package/dist/{chunk-ZVJ5BLO2.js → chunk-O6I4CIEU.js} +151 -13
- package/dist/{chunk-XN3L4EYL.js → chunk-OEDBCISO.js} +2 -2
- package/dist/{chunk-VAWNZU7Z.js → chunk-P3JGPQFL.js} +2 -2
- package/dist/{chunk-IJ7RPIYJ.js → chunk-PNY46YEY.js} +20 -3
- package/dist/{chunk-U6MBIEMB.js → chunk-PZ4I4JE2.js} +56 -35
- package/dist/{chunk-GPIEI3LY.js → chunk-QQ7EKM72.js} +2 -2
- package/dist/{chunk-WLFILSD5.js → chunk-R7LNVMCS.js} +66 -28
- package/dist/{chunk-GOXNB3AO.js → chunk-RAPCMZL4.js} +75 -4
- package/dist/chunk-RKKLTLYB.js +45 -0
- package/dist/{chunk-TT36MB5S.js → chunk-RKRLDWD3.js} +3 -1
- package/dist/{chunk-TTHACPOM.js → chunk-S4COXYBG.js} +456 -18
- package/dist/{chunk-WWCZ5F23.js → chunk-T3Z6VAAF.js} +69 -10
- package/dist/{chunk-GN57SG4G.js → chunk-TD7UE2L5.js} +9 -7
- package/dist/{chunk-TLQJPP24.js → chunk-TEO2TLVN.js} +523 -322
- package/dist/{chunk-FCSXB6T2.js → chunk-UOSL25KY.js} +14 -2
- package/dist/{chunk-KTYTFRMB.js → chunk-VKBMFOYV.js} +17 -15
- package/dist/{chunk-PT7HYKEM.js → chunk-VO2LKSTM.js} +2 -2
- package/dist/{chunk-P43ETTHK.js → chunk-VPTUJU4P.js} +2 -2
- package/dist/{chunk-WEH5XRJQ.js → chunk-WIE7ZOSW.js} +2 -2
- package/dist/{chunk-EMYUUSFG.js → chunk-WXCJ7VME.js} +5 -5
- package/dist/{chunk-4DGYLA73.js → chunk-XDOQXGFO.js} +22 -7
- package/dist/{chunk-JOZYP4GM.js → chunk-YKOFT37S.js} +5 -5
- package/dist/chunk-YSEHGPCT.js +127 -0
- package/dist/{chunk-HFSBBKSQ.js → chunk-YW7UVM5V.js} +138 -3
- package/dist/cli/index.js +27 -27
- package/dist/{clio-QVTYJ57A.js → clio-LT5V7SSZ.js} +6 -6
- package/dist/{code-nav-FGGFIE7L.js → code-nav-LMW275PA.js} +4 -4
- package/dist/{config-LW5IJFQN.js → config-RXS5T3JT.js} +71 -43
- package/dist/{configure-7XIZCOU4.js → configure-2WYWSCSD.js} +14 -15
- package/dist/{context-Y6Y7QPR6.js → context-I3BTOTCS.js} +12 -12
- package/dist/{context-L3WL3X7K.js → context-MVOORGMF.js} +34 -33
- package/dist/{context-N52ZA626.js → context-PALKKQYL.js} +20 -20
- package/dist/{context-clear-MBQRLSDQ.js → context-clear-N2WOYZ2K.js} +34 -33
- package/dist/{context-index-HVMFQHK3.js → context-index-HNG3MOME.js} +2 -2
- package/dist/{context-working-set-GS6DSO7F.js → context-working-set-MIEVECVZ.js} +10 -11
- package/dist/{dispatch-runner-22ZCNOM3.js → dispatch-runner-VVA4SRRH.js} +34 -33
- package/dist/doctor-TWBWFK5V.js +165 -0
- package/dist/{eval-BEC2WHDA.js → eval-IJ5VEZDJ.js} +2016 -142
- package/dist/{evidence-REJUMSKM.js → evidence-L5APPXNV.js} +29 -28
- package/dist/{evolve-PY5ZBA5K.js → evolve-RGNKFJ52.js} +29 -28
- package/dist/{extensions-HVKU65YU.js → extensions-7WYWUX5A.js} +9 -3
- package/dist/{fleet-7WZEWRFA.js → fleet-6CNVBZZP.js} +87 -55
- package/dist/{fleet-commands-UVHWM76J.js → fleet-commands-L2SXSYEI.js} +6 -6
- package/dist/{fleet-graph-6ULH7PES.js → fleet-graph-2J3OOIPO.js} +14 -12
- package/dist/{fleet-preflight-J53T6CCE.js → fleet-preflight-CZRJ4JP5.js} +3 -4
- package/dist/{fleet-validate-72PC4SLA.js → fleet-validate-C5RI6DP7.js} +16 -15
- package/dist/{init-OG3TPGQG.js → init-VBN2ACVA.js} +50 -48
- package/dist/{library-CNTMPLRF.js → library-JHGUMLY2.js} +13 -11
- package/dist/{memory-6IS7F275.js → memory-K4OQIYWG.js} +31 -30
- package/dist/{models-ENRJDA5W.js → models-2NCZUWDD.js} +23 -22
- package/dist/{monitor-XLDVO7TN.js → monitor-MMVTJABD.js} +35 -34
- package/dist/{orchestrator-6KSPYRHA.js → orchestrator-ZKBPCHW6.js} +1627 -294
- package/dist/{reset-RZ4ER727.js → reset-DD5JGOY3.js} +3 -3
- package/dist/{run-Y2CNK5RU.js → run-QEGNX7FL.js} +56 -55
- package/dist/{share-A55GYP6Z.js → share-JKD3BQMW.js} +13 -11
- package/dist/{skills-ALC5J6AT.js → skills-LMQIKDOZ.js} +14 -12
- package/dist/{skills-eval-JPBEBYQU.js → skills-eval-I7X2774U.js} +34 -32
- package/dist/{steer-GGWFUJUD.js → steer-CF5TDANS.js} +3 -3
- package/dist/{support-MIETYA5E.js → support-I7LOJLIF.js} +4 -4
- package/dist/{targets-VGNXIR3S.js → targets-RUSR6B5Z.js} +58 -32
- package/dist/{terminal-lease-WOBR64YA.js → terminal-lease-QYVORFR4.js} +6 -4
- package/dist/{trace-PNCASAXC.js → trace-ODOQIVIW.js} +61 -6
- package/dist/{upgrade-FUSUAGHR.js → upgrade-XANW3FXB.js} +17 -16
- package/dist/{usage-N4MKVHKD.js → usage-4H7ZRXQT.js} +88 -44
- package/dist/{verifiers-YAWOJ3H2.js → verifiers-UZXNBZEB.js} +6 -6
- package/dist/{verify-LTDHYBGY.js → verify-BVKWTNDL.js} +5 -5
- package/dist/{wiki-generate-6M7GHTBJ.js → wiki-generate-MY7WV2QI.js} +49 -47
- package/dist/worker/entry.js +29 -33
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/artifact-versions.md +6 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +23 -2
- package/docs/commands-and-modes.md +1 -1
- package/docs/configuration-and-targets.md +30 -3
- package/docs/context-engine.md +63 -4
- package/docs/documentation-coverage.md +3 -3
- package/docs/documentation-guide.md +1 -1
- package/docs/environment-variables.md +2 -0
- package/docs/eval-runner.md +262 -11
- package/docs/evals-internal.md +72 -2
- package/docs/evidence-and-memory.md +11 -10
- package/docs/evolution.md +1 -1
- package/docs/extensions-and-sharing.md +3 -1
- package/docs/fleet-dispatch.md +4 -4
- package/docs/installation-and-lifecycle.md +1 -1
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +1 -1
- package/docs/observability.md +53 -2
- package/docs/proactive-memory.md +127 -14
- package/docs/prompt-envelope-and-tools.md +19 -1
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +19 -3
- package/docs/safety-model.md +1 -1
- package/docs/scientific-validation.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +1 -1
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +87 -0
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +2 -1
- package/src/cli/agents.ts +1 -1
- package/src/cli/config-inspect.ts +33 -6
- package/src/cli/config.ts +1 -1
- package/src/cli/doctor-state-size.ts +82 -0
- package/src/cli/doctor.ts +3 -1
- package/src/cli/eval.ts +80 -16
- package/src/cli/extensions.ts +5 -1
- package/src/cli/fleet.ts +32 -3
- package/src/cli/targets.ts +44 -13
- package/src/cli/trace.ts +63 -4
- package/src/cli/usage.ts +63 -14
- package/src/core/bus-events.ts +29 -1
- package/src/core/cache-telemetry.ts +42 -0
- package/src/core/config.ts +18 -0
- package/src/core/defaults.ts +36 -6
- package/src/core/endpoint-key.ts +27 -0
- package/src/core/residency-target-key.ts +25 -0
- package/src/core/response-schema.ts +36 -2
- package/src/domains/config/classify.ts +3 -0
- package/src/domains/context/codewiki/coordinator.ts +12 -4
- package/src/domains/dispatch/admission.ts +40 -3
- package/src/domains/dispatch/capacity-lease.ts +98 -9
- package/src/domains/dispatch/contract.ts +11 -0
- package/src/domains/dispatch/execution-plan.ts +44 -4
- package/src/domains/dispatch/extension.ts +166 -42
- package/src/domains/dispatch/fleet-run.ts +23 -3
- package/src/domains/dispatch/heartbeat.ts +32 -8
- package/src/domains/dispatch/index.ts +3 -0
- package/src/domains/dispatch/orphan-recovery.ts +5 -0
- package/src/domains/dispatch/reservation-store.ts +116 -8
- package/src/domains/dispatch/state.ts +4 -0
- package/src/domains/dispatch/worker-spawn.ts +25 -11
- package/src/domains/dispatch/write-boundary-enforcer.ts +20 -3
- package/src/domains/dispatch/write-boundary.ts +62 -1
- package/src/domains/eval/artifacts/store.ts +62 -0
- package/src/domains/eval/compare/behavioral.ts +224 -0
- package/src/domains/eval/compare/compare.ts +355 -2
- package/src/domains/eval/compare/envelope.ts +128 -0
- package/src/domains/eval/compare/gates.ts +24 -6
- package/src/domains/eval/compare/thresholds.ts +30 -3
- package/src/domains/eval/execution-provenance.ts +240 -0
- package/src/domains/eval/metrics/aggregate.ts +136 -0
- package/src/domains/eval/metrics/call-ledger-stream.ts +112 -0
- package/src/domains/eval/metrics/tracked.ts +413 -0
- package/src/domains/eval/provenance.ts +117 -0
- package/src/domains/eval/reports/comparison.ts +128 -0
- package/src/domains/eval/reports/junit.ts +17 -3
- package/src/domains/eval/reports/markdown.ts +3 -3
- package/src/domains/eval/reports/text.ts +14 -0
- package/src/domains/eval/run-compare.ts +20 -0
- package/src/domains/eval/runners/clio-run.ts +127 -0
- package/src/domains/eval/runners/external-command.ts +28 -3
- package/src/domains/eval/schema/adapter.ts +111 -0
- package/src/domains/eval/schema/artifact.ts +20 -0
- package/src/domains/eval/schema/behavioral-metrics.ts +204 -0
- package/src/domains/eval/schema/behavioral.ts +520 -0
- package/src/domains/eval/schema/execution-envelope.ts +194 -0
- package/src/domains/eval/schema/serving.ts +74 -0
- package/src/domains/eval/schema/suite.ts +38 -8
- package/src/domains/eval/schema/validate.ts +58 -3
- package/src/domains/eval/schema/verdict.ts +237 -0
- package/src/domains/eval/suites/resolve.ts +2 -0
- package/src/domains/eval/suites/run.ts +264 -33
- package/src/domains/eval/verifiers/command.ts +2 -1
- package/src/domains/eval/workspaces/temp-copy.ts +145 -13
- package/src/domains/evidence/build.ts +2 -13
- package/src/domains/evidence/eval.ts +2 -12
- package/src/domains/evidence/findings-markdown.ts +33 -0
- package/src/domains/evidence/run-trust.ts +7 -113
- package/src/domains/evidence/trust-projection.ts +2 -2
- package/src/domains/extensions/compatibility.ts +285 -0
- package/src/domains/extensions/discovery.ts +38 -3
- package/src/domains/extensions/resources.ts +1 -1
- package/src/domains/extensions/state.ts +12 -3
- package/src/domains/extensions/types.ts +2 -0
- package/src/domains/lifecycle/doctor.ts +69 -1
- package/src/domains/memory/index.ts +14 -0
- package/src/domains/memory/task-bank-promotion.ts +64 -0
- package/src/domains/memory/task-memory-policy.ts +77 -8
- package/src/domains/memory/task-memory-spend.ts +131 -0
- package/src/domains/memory/task-memory-status.ts +7 -0
- package/src/domains/memory/task-memory-telemetry.ts +2 -0
- package/src/domains/middleware/index.ts +1 -0
- package/src/domains/middleware/memory-intervention.ts +69 -5
- package/src/domains/middleware/memory-step-endpoint.ts +71 -0
- package/src/domains/observability/background-memory-usage.ts +140 -0
- package/src/domains/observability/cost.ts +1 -1
- package/src/domains/observability/index.ts +7 -0
- package/src/domains/observability/out-of-turn-usage.ts +51 -2
- package/src/domains/observability/trace-store.ts +192 -2
- package/src/domains/prompts/compiler.ts +100 -13
- package/src/domains/providers/endpoint-capacity.ts +96 -0
- package/src/domains/providers/index.ts +10 -0
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +243 -1
- package/src/domains/providers/runtime-resolution.ts +8 -1
- package/src/domains/providers/runtimes/common/probe-helpers.ts +31 -9
- package/src/domains/providers/runtimes/local-native/llamacpp-anthropic.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-embed.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp-rerank.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp.ts +4 -1
- package/src/domains/providers/runtimes/local-native/lmstudio.ts +4 -1
- package/src/domains/providers/runtimes/local-native/ollama-native.ts +6 -1
- package/src/domains/providers/types/capability-flags.ts +2 -0
- package/src/domains/providers/types/target-descriptor.ts +2 -0
- package/src/domains/resources/prompts/loader.ts +95 -33
- package/src/domains/safety/call-target.ts +52 -0
- package/src/domains/safety/run-effects.ts +35 -4
- package/src/domains/session/context-accounting.ts +52 -1
- package/src/domains/session/context-ledger.ts +37 -13
- package/src/domains/session/index.ts +6 -0
- package/src/domains/session/prompt-cache.ts +140 -0
- package/src/domains/session/prompt-manifest.ts +42 -0
- package/src/engine/acp/adapter.ts +18 -3
- package/src/engine/ai.ts +35 -0
- package/src/engine/apis/llamacpp-residency.ts +55 -3
- package/src/engine/apis/lmstudio.ts +25 -5
- package/src/engine/apis/ollama-native.ts +2 -1
- package/src/engine/apis/openai-completions.ts +80 -17
- package/src/engine/apis/residency-lock.ts +3 -1
- package/src/engine/apis/residency.ts +34 -1
- package/src/engine/provider-payload.ts +29 -1
- package/src/entry/orchestrator.ts +176 -30
- package/src/interactive/chat-loop-messages.ts +26 -7
- package/src/interactive/chat-loop.ts +318 -41
- package/src/interactive/chat-panel.ts +62 -8
- package/src/interactive/clio-editor.ts +45 -8
- package/src/interactive/context-activity.ts +5 -1
- package/src/interactive/context-meter.ts +1 -1
- package/src/interactive/context-overlay.ts +40 -10
- package/src/interactive/cost-overlay.ts +64 -6
- package/src/interactive/dispatch-board.ts +84 -12
- package/src/interactive/fleet-run-preview.ts +41 -15
- package/src/interactive/handoff-round.ts +41 -2
- package/src/interactive/interactive-application.ts +24 -1
- package/src/interactive/interactive-input-runtime.ts +8 -0
- package/src/interactive/interactive-presentation.ts +4 -0
- package/src/interactive/interactive-shell.ts +20 -17
- package/src/interactive/interactive-slash-runtime.ts +27 -4
- package/src/interactive/memory-overlay.ts +8 -0
- package/src/interactive/mutation-preview.ts +295 -0
- package/src/interactive/overlay-general-openers.ts +16 -0
- package/src/interactive/overlay-key-routing.ts +38 -0
- package/src/interactive/overlay-lifecycle.ts +38 -5
- package/src/interactive/overlay-permission-lifecycle.ts +22 -2
- package/src/interactive/overlay-session-lifecycle.ts +73 -9
- package/src/interactive/overlays/ask-user.ts +91 -19
- package/src/interactive/overlays/help-reference.ts +4 -0
- package/src/interactive/overlays/prompts.ts +11 -1
- package/src/interactive/overlays/settings.ts +35 -1
- package/src/interactive/permission-hint.ts +34 -2
- package/src/interactive/permission-overlay.ts +159 -9
- package/src/interactive/prewarm.ts +197 -0
- package/src/interactive/render-trace.ts +162 -15
- package/src/interactive/renderers/tool-execution.ts +4 -0
- package/src/interactive/side-question.ts +58 -1
- package/src/interactive/status/controller.ts +11 -0
- package/src/interactive/status/state-machine.ts +54 -2
- package/src/interactive/status/types.ts +7 -0
- package/src/interactive/terminal-lease.ts +2 -0
- package/src/interactive/turn-context.ts +299 -31
- package/src/interactive/turn-persistence.ts +14 -4
- package/src/interactive/turn-prewarm.ts +364 -0
- package/src/interactive/turn-queues.ts +7 -4
- package/src/interactive/turn-runtime.ts +8 -1
- package/src/interactive/turn-state.ts +23 -0
- package/src/interactive/view/view-overlay.ts +28 -3
- package/src/tools/ask-user.ts +43 -2
- package/src/tools/dispatch-plan.ts +17 -9
- package/src/tools/dispatch-scout.ts +1 -1
- package/src/tools/registry.ts +16 -0
- package/dist/chunk-AOCYTWAV.js +0 -449
- package/dist/chunk-HWUFFB6L.js +0 -83
- package/dist/chunk-R346GLFC.js +0 -31
- package/dist/doctor-M7YEDGAE.js +0 -91
|
@@ -236,15 +236,19 @@ function str(value: unknown): string | undefined {
|
|
|
236
236
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
/** Keep terminal control bytes and line breaks out of approval artifacts. */
|
|
240
|
-
function safeField(value: string): string {
|
|
239
|
+
/** Keep terminal control bytes and line breaks out of approval artifacts without losing their identity. */
|
|
240
|
+
function safeField(value: string, bindChangedValue = true): string {
|
|
241
241
|
let result = "";
|
|
242
242
|
for (const character of value) {
|
|
243
243
|
const code = character.codePointAt(0) ?? 0;
|
|
244
244
|
result += code < 32 || (code >= 127 && code <= 159) ? "?" : character;
|
|
245
|
-
if (result.length >= 256)
|
|
245
|
+
if (result.length >= 256) {
|
|
246
|
+
result = `${result.slice(0, 255)}…`;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
246
249
|
}
|
|
247
|
-
return result;
|
|
250
|
+
if (!bindChangedValue || result === value) return result;
|
|
251
|
+
return `${result}{sha256=${createHash("sha256").update(value, "utf8").digest("hex")}}`;
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
function renderLegacyPathScope(task: DispatchPlanTaskView): string[] {
|
|
@@ -393,7 +397,7 @@ function renderPlanText(
|
|
|
393
397
|
? ""
|
|
394
398
|
: ` posture=${routing.posture} maxCostUsd=${routing.maxCostUsd ?? "none"} deadlineMs=${routing.deadlineMs ?? "none"} minimumQuality=${routing.minimumQuality ?? "none"} locality=${routing.locality}`;
|
|
395
399
|
lines.push(
|
|
396
|
-
` ${index + 1}.${role} agent=${safeField(task.agent)}${target}${model}${node}${failover}${routingText} task=${JSON.stringify(safeField(task.task))}`,
|
|
400
|
+
` ${index + 1}.${role} agent=${safeField(task.agent)}${target}${model}${node}${failover}${routingText} task_bytes=${Buffer.byteLength(task.task, "utf8")} task_sha256=${createHash("sha256").update(task.task, "utf8").digest("hex")} task_preview=${JSON.stringify(safeField(task.task, false))}`,
|
|
397
401
|
);
|
|
398
402
|
if (task.council !== undefined) {
|
|
399
403
|
lines.push(
|
|
@@ -420,25 +424,29 @@ function renderPlanText(
|
|
|
420
424
|
}
|
|
421
425
|
if (task.agentSelection !== null) {
|
|
422
426
|
lines.push(
|
|
423
|
-
` agent-selection=auto baseline=${safeField(task.agentSelection.baselineAgentId)} authority=${task.agentSelection.approvedAuthorities.map(safeField).join(",")} basis=${task.agentSelection.authorityBasis}`,
|
|
427
|
+
` agent-selection=auto baseline=${safeField(task.agentSelection.baselineAgentId)} authority=${task.agentSelection.approvedAuthorities.map((authority) => safeField(authority)).join(",")} basis=${task.agentSelection.authorityBasis}`,
|
|
424
428
|
);
|
|
425
429
|
}
|
|
426
430
|
if (task.stepId !== null) {
|
|
427
431
|
lines.push(
|
|
428
|
-
` step=${safeField(task.stepId)} wave=${task.wave ?? "?"} role=${task.executionRole} dependencies=${task.dependencies.map(safeField).join(",") || "none"} result=${task.expectedResultContract ?? "none"} authority=${task.authorityGrant?.requested ?? "none"} basis=${task.authorityGrant?.basis ?? "none"}`,
|
|
432
|
+
` step=${safeField(task.stepId)} wave=${task.wave ?? "?"} role=${task.executionRole} dependencies=${task.dependencies.map((dependency) => safeField(dependency)).join(",") || "none"} result=${task.expectedResultContract ?? "none"} authority=${task.authorityGrant?.requested ?? "none"} basis=${task.authorityGrant?.basis ?? "none"}`,
|
|
429
433
|
);
|
|
430
434
|
const agentReasons = task.agentDecision?.agentSelection.evaluations
|
|
431
435
|
.filter((evaluation) => evaluation.rejections.length > 0)
|
|
432
436
|
.slice(0, 8)
|
|
433
437
|
.map(
|
|
434
|
-
(evaluation) =>
|
|
438
|
+
(evaluation) =>
|
|
439
|
+
`${safeField(evaluation.agentId)}:${evaluation.rejections
|
|
440
|
+
.slice(0, 4)
|
|
441
|
+
.map((rejection) => safeField(rejection))
|
|
442
|
+
.join(",")}`,
|
|
435
443
|
);
|
|
436
444
|
if (agentReasons !== undefined && agentReasons.length > 0)
|
|
437
445
|
lines.push(` agent-exclusions=${agentReasons.join(";")}`);
|
|
438
446
|
}
|
|
439
447
|
if (task.briefing !== undefined) {
|
|
440
448
|
lines.push(
|
|
441
|
-
` briefing_bytes=${Buffer.byteLength(task.briefing, "utf8")} briefing_sha256=${createHash("sha256").update(task.briefing, "utf8").digest("hex")} briefing_preview=${JSON.stringify(safeField(task.briefing))}`,
|
|
449
|
+
` briefing_bytes=${Buffer.byteLength(task.briefing, "utf8")} briefing_sha256=${createHash("sha256").update(task.briefing, "utf8").digest("hex")} briefing_preview=${JSON.stringify(safeField(task.briefing, false))}`,
|
|
442
450
|
);
|
|
443
451
|
}
|
|
444
452
|
if (task.intent !== undefined) {
|
|
@@ -256,7 +256,7 @@ export async function runScoutContinuationPlan<T, S>(input: {
|
|
|
256
256
|
};
|
|
257
257
|
},
|
|
258
258
|
cancel: (assignmentId) => input.dispatch.abort(assignmentId),
|
|
259
|
-
release: (ownerId) => input.dispatch.reservations?.
|
|
259
|
+
release: (ownerId) => input.dispatch.reservations?.release(ownerId),
|
|
260
260
|
releaseUnconsumed: (ownerId) => input.dispatch.reservations?.rollbackUnconsumed(ownerId),
|
|
261
261
|
},
|
|
262
262
|
input.signal,
|
package/src/tools/registry.ts
CHANGED
|
@@ -234,13 +234,29 @@ export interface AskUserTranscriptQuestion {
|
|
|
234
234
|
|
|
235
235
|
export interface AskUserTranscriptAnswer {
|
|
236
236
|
question: string;
|
|
237
|
+
/** The whole answer on one line: the chosen labels, then the typed text. */
|
|
237
238
|
answer: string;
|
|
239
|
+
/**
|
|
240
|
+
* The option labels the operator chose, in list order. Absent when they only
|
|
241
|
+
* typed. Present with no {@link value} is a label-only answer.
|
|
242
|
+
*/
|
|
243
|
+
options?: string[];
|
|
244
|
+
/**
|
|
245
|
+
* The operator's typed text, exactly as submitted. Absent when they only
|
|
246
|
+
* chose. Recording an option label without this is what lost the figures in
|
|
247
|
+
* issue #228.
|
|
248
|
+
*/
|
|
249
|
+
value?: string;
|
|
238
250
|
}
|
|
239
251
|
|
|
240
252
|
export interface AskUserTranscriptDecision {
|
|
241
253
|
key: string;
|
|
242
254
|
value: string;
|
|
243
255
|
label?: string;
|
|
256
|
+
/** The chosen labels behind {@link value}, when the answer had any. Harness-derived. */
|
|
257
|
+
options?: string[];
|
|
258
|
+
/** The typed text behind {@link value}, when the answer had any. Harness-derived. */
|
|
259
|
+
text?: string;
|
|
244
260
|
source_question?: string;
|
|
245
261
|
}
|
|
246
262
|
|
package/dist/chunk-AOCYTWAV.js
DELETED
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
artifactDefaultPath,
|
|
4
|
-
extractCommandCdTargets,
|
|
5
|
-
extractCommandWriteTargets
|
|
6
|
-
} from "./chunk-MV3K5QF2.js";
|
|
7
|
-
import {
|
|
8
|
-
canonicalizeExistingPath
|
|
9
|
-
} from "./chunk-ECH6PKUQ.js";
|
|
10
|
-
import {
|
|
11
|
-
ToolNames,
|
|
12
|
-
isBuiltinToolName
|
|
13
|
-
} from "./chunk-CGKSTWHD.js";
|
|
14
|
-
import {
|
|
15
|
-
init_esm_shims
|
|
16
|
-
} from "./chunk-3R73A4XB.js";
|
|
17
|
-
|
|
18
|
-
// src/domains/agents/spec.ts
|
|
19
|
-
init_esm_shims();
|
|
20
|
-
import { createHash } from "node:crypto";
|
|
21
|
-
|
|
22
|
-
// src/domains/safety/action-classifier.ts
|
|
23
|
-
init_esm_shims();
|
|
24
|
-
import path from "node:path";
|
|
25
|
-
var GIT_DESTRUCTIVE_PATTERNS = [
|
|
26
|
-
{ name: "git-push-force-long", re: /\bgit\s+push\s+--force\b/i },
|
|
27
|
-
{ name: "git-push-force-short", re: /\bgit\s+push\s+-f\b/i },
|
|
28
|
-
{ name: "git-reset-hard", re: /\bgit\s+reset\s+--hard\b/i },
|
|
29
|
-
{ name: "git-clean-fd", re: /\bgit\s+clean\s+-fd?\b/i },
|
|
30
|
-
{ name: "git-checkout-dot", re: /\bgit\s+checkout\s+--\s+\./i },
|
|
31
|
-
{ name: "git-branch-D", re: /\bgit\s+branch\s+-D\b/i },
|
|
32
|
-
{ name: "git-restore-source", re: /\bgit\s+restore\s+--source\b/i }
|
|
33
|
-
];
|
|
34
|
-
var SYSTEM_MODIFY_PATTERNS = [
|
|
35
|
-
{ name: "sudo-or-doas", re: /\b(sudo|doas)\b/i },
|
|
36
|
-
// allow rm -rf /tmp/... and /var/tmp/... but flag everything else rooted at /
|
|
37
|
-
{ name: "rm-rf-root", re: /\brm\s+-rf?\s+\/(?!(tmp|var\/tmp)(?:\/|\s|$))/i },
|
|
38
|
-
{ name: "apt-install", re: /\bapt(-get)?\s+(install|remove|purge)/i },
|
|
39
|
-
{ name: "brew-install", re: /\bbrew\s+(install|uninstall|reinstall)/i },
|
|
40
|
-
{ name: "npm-install-global", re: /\bnpm\s+install\s+-g\b/i },
|
|
41
|
-
{ name: "pip-install", re: /\bpip\s+install\b/i },
|
|
42
|
-
{ name: "systemctl", re: /\bsystemctl\s+/i },
|
|
43
|
-
{ name: "chmod-root", re: /\bchmod\s+[0-7]{3,4}\s+\//i },
|
|
44
|
-
{ name: "chown", re: /\bchown\s+/i }
|
|
45
|
-
];
|
|
46
|
-
var SYSTEM_WRITE_ROOT_PREFIXES = ["/etc", "/usr", "/var", "/bin", "/sbin", "/run"];
|
|
47
|
-
var SYSTEM_WRITE_EXEMPT_PREFIXES = ["/var/tmp", "/var/folders"];
|
|
48
|
-
function isUnderPrefix(abs, prefix) {
|
|
49
|
-
return abs === prefix || abs.startsWith(`${prefix}/`);
|
|
50
|
-
}
|
|
51
|
-
function baseClassify(tool) {
|
|
52
|
-
switch (tool) {
|
|
53
|
-
case ToolNames.Read:
|
|
54
|
-
case ToolNames.Grep:
|
|
55
|
-
case ToolNames.Find:
|
|
56
|
-
case ToolNames.Ls:
|
|
57
|
-
case ToolNames.WebFetch:
|
|
58
|
-
case ToolNames.Git:
|
|
59
|
-
case ToolNames.CodeNav:
|
|
60
|
-
case ToolNames.Context:
|
|
61
|
-
case ToolNames.Monitor:
|
|
62
|
-
case ToolNames.AskUser:
|
|
63
|
-
case ToolNames.CredentialPresent:
|
|
64
|
-
// tasks pick mutates only Clio-owned session-ledger and project-local
|
|
65
|
-
// .clio-coder runtime state, never source-workspace files. By intentional
|
|
66
|
-
// policy it stays read class and ungated; the tool itself still requires
|
|
67
|
-
// a durable operator task id before it can mutate either store.
|
|
68
|
-
case ToolNames.Tasks:
|
|
69
|
-
// ledger posts a typed contribution to a coordination board and reads a
|
|
70
|
-
// local mirror. Neither touches the workspace, so it is never gated
|
|
71
|
-
// behind a confirmation.
|
|
72
|
-
case ToolNames.Ledger:
|
|
73
|
-
return "read";
|
|
74
|
-
case ToolNames.Write:
|
|
75
|
-
case ToolNames.Edit:
|
|
76
|
-
case ToolNames.Artifact:
|
|
77
|
-
return "write";
|
|
78
|
-
case ToolNames.Bash:
|
|
79
|
-
case ToolNames.Verify:
|
|
80
|
-
return "execute";
|
|
81
|
-
case ToolNames.Dispatch:
|
|
82
|
-
case ToolNames.Steer:
|
|
83
|
-
return "dispatch";
|
|
84
|
-
default:
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function scanStringOf(args) {
|
|
89
|
-
if (!args) return "";
|
|
90
|
-
const parts = [];
|
|
91
|
-
for (const value of Object.values(args)) {
|
|
92
|
-
if (value == null) continue;
|
|
93
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
94
|
-
parts.push(String(value));
|
|
95
|
-
} else {
|
|
96
|
-
try {
|
|
97
|
-
parts.push(JSON.stringify(value));
|
|
98
|
-
} catch {
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return parts.join(" ");
|
|
103
|
-
}
|
|
104
|
-
function matchFirst(patterns, haystack) {
|
|
105
|
-
for (const p of patterns) {
|
|
106
|
-
if (p.re.test(haystack)) return p;
|
|
107
|
-
}
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
function resolveCandidate(p, baseCwd) {
|
|
111
|
-
if (p.startsWith("~")) return p;
|
|
112
|
-
const base = canonicalizeExistingPath(path.resolve(baseCwd ?? process.cwd()));
|
|
113
|
-
const resolved = path.isAbsolute(p) ? path.resolve(p) : path.resolve(base, p);
|
|
114
|
-
return canonicalizeExistingPath(resolved);
|
|
115
|
-
}
|
|
116
|
-
function isInsideCwd(abs) {
|
|
117
|
-
const cwd = canonicalizeExistingPath(path.resolve(process.cwd()));
|
|
118
|
-
const candidate = canonicalizeExistingPath(abs);
|
|
119
|
-
const rel = path.relative(cwd, candidate);
|
|
120
|
-
return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
121
|
-
}
|
|
122
|
-
function writePathClass(pathArg, baseCwd) {
|
|
123
|
-
if (pathArg.startsWith("~")) {
|
|
124
|
-
return { cls: "system_modify", reason: `write-path-home-escape: ${pathArg}` };
|
|
125
|
-
}
|
|
126
|
-
const abs = resolveCandidate(pathArg, baseCwd);
|
|
127
|
-
const exempt = SYSTEM_WRITE_EXEMPT_PREFIXES.some((prefix) => isUnderPrefix(abs, prefix));
|
|
128
|
-
if (!exempt) {
|
|
129
|
-
for (const prefix of SYSTEM_WRITE_ROOT_PREFIXES) {
|
|
130
|
-
if (isUnderPrefix(abs, prefix)) {
|
|
131
|
-
return { cls: "system_modify", reason: `write-path-system-root: ${prefix}` };
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (!isInsideCwd(abs)) {
|
|
136
|
-
return { cls: "system_modify", reason: `write-path-outside-cwd: ${abs}` };
|
|
137
|
-
}
|
|
138
|
-
return { cls: "write" };
|
|
139
|
-
}
|
|
140
|
-
function extractWritePath(tool, args) {
|
|
141
|
-
const candidate = args?.path ?? args?.file_path ?? args?.filePath;
|
|
142
|
-
if (typeof candidate === "string" && candidate.length > 0) return candidate;
|
|
143
|
-
return tool === ToolNames.Artifact ? artifactDefaultPath(args?.kind) : null;
|
|
144
|
-
}
|
|
145
|
-
function classify(call) {
|
|
146
|
-
const base = baseClassify(call.tool);
|
|
147
|
-
if (base === null) {
|
|
148
|
-
return { actionClass: "unknown", reasons: [`unknown tool: ${call.tool}`] };
|
|
149
|
-
}
|
|
150
|
-
const reasons = [];
|
|
151
|
-
if (call.tool === ToolNames.Bash) {
|
|
152
|
-
const scan = scanStringOf(call.args);
|
|
153
|
-
const gitHit = matchFirst(GIT_DESTRUCTIVE_PATTERNS, scan);
|
|
154
|
-
if (gitHit) {
|
|
155
|
-
return { actionClass: "git_destructive", reasons: [`pattern:${gitHit.name}`] };
|
|
156
|
-
}
|
|
157
|
-
const sysHit = matchFirst(SYSTEM_MODIFY_PATTERNS, scan);
|
|
158
|
-
if (sysHit) {
|
|
159
|
-
return { actionClass: "system_modify", reasons: [`pattern:${sysHit.name}`] };
|
|
160
|
-
}
|
|
161
|
-
const command = typeof call.args?.command === "string" ? call.args.command : null;
|
|
162
|
-
const argCwd = typeof call.args?.cwd === "string" && call.args.cwd.length > 0 ? call.args.cwd : void 0;
|
|
163
|
-
if (command !== null) {
|
|
164
|
-
const targetReasons = [];
|
|
165
|
-
for (const target of extractCommandWriteTargets(command)) {
|
|
166
|
-
const decision = writePathClass(target, argCwd);
|
|
167
|
-
if (decision.cls === "system_modify") {
|
|
168
|
-
targetReasons.push(decision.reason ?? `bash-write-target: ${target}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
for (const target of extractCommandCdTargets(command)) {
|
|
172
|
-
if (target.startsWith("~")) {
|
|
173
|
-
targetReasons.push(`bash-cd-home-escape: ${target}`);
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
const abs = resolveCandidate(target, argCwd);
|
|
177
|
-
if (!isInsideCwd(abs)) {
|
|
178
|
-
targetReasons.push(`bash-cd-outside-workspace: ${abs}`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (targetReasons.length > 0) {
|
|
182
|
-
return { actionClass: "system_modify", reasons: targetReasons };
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return { actionClass: "execute", reasons };
|
|
186
|
-
}
|
|
187
|
-
if (base === "write") {
|
|
188
|
-
const pathArg = extractWritePath(call.tool, call.args);
|
|
189
|
-
if (pathArg) {
|
|
190
|
-
const decision = writePathClass(pathArg);
|
|
191
|
-
if (decision.cls === "system_modify") {
|
|
192
|
-
return { actionClass: "system_modify", reasons: decision.reason ? [decision.reason] : [] };
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return { actionClass: "write", reasons };
|
|
196
|
-
}
|
|
197
|
-
return { actionClass: base, reasons };
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// src/domains/agents/spec.ts
|
|
201
|
-
var AGENT_AUTOMATION_AUTHORITIES = ["read-only", "verification", "artifact-write", "workspace-edit"];
|
|
202
|
-
var AGENT_PRODUCTS = ["orientation"];
|
|
203
|
-
var AGENT_CATEGORIES = [
|
|
204
|
-
"explore",
|
|
205
|
-
"plan",
|
|
206
|
-
"research",
|
|
207
|
-
"implement",
|
|
208
|
-
"quality",
|
|
209
|
-
"science",
|
|
210
|
-
"evolution",
|
|
211
|
-
"operations",
|
|
212
|
-
"internal"
|
|
213
|
-
];
|
|
214
|
-
var AGENT_CAPABILITY_CLASSES = [
|
|
215
|
-
"read-only",
|
|
216
|
-
"artifact-write",
|
|
217
|
-
"workspace-edit",
|
|
218
|
-
"verification",
|
|
219
|
-
"orchestration",
|
|
220
|
-
"internal"
|
|
221
|
-
];
|
|
222
|
-
var AGENT_LATENCY_CLASSES = ["fast", "balanced", "deep"];
|
|
223
|
-
var AGENT_AUDIENCES = ["base", "shadow", "custom", "internal"];
|
|
224
|
-
var AGENT_PROJECT_CONTEXT_TIERS = ["none", "bounded"];
|
|
225
|
-
function includes(values, value) {
|
|
226
|
-
return typeof value === "string" && values.includes(value);
|
|
227
|
-
}
|
|
228
|
-
function isAgentCategory(value) {
|
|
229
|
-
return includes(AGENT_CATEGORIES, value);
|
|
230
|
-
}
|
|
231
|
-
function isAgentCapabilityClass(value) {
|
|
232
|
-
return includes(AGENT_CAPABILITY_CLASSES, value);
|
|
233
|
-
}
|
|
234
|
-
function isAgentLatencyClass(value) {
|
|
235
|
-
return includes(AGENT_LATENCY_CLASSES, value);
|
|
236
|
-
}
|
|
237
|
-
function isAgentAudience(value) {
|
|
238
|
-
return includes(AGENT_AUDIENCES, value);
|
|
239
|
-
}
|
|
240
|
-
function isAgentProjectContextTier(value) {
|
|
241
|
-
return includes(AGENT_PROJECT_CONTEXT_TIERS, value);
|
|
242
|
-
}
|
|
243
|
-
function isAgentProduct(value) {
|
|
244
|
-
return includes(AGENT_PRODUCTS, value);
|
|
245
|
-
}
|
|
246
|
-
function actionClassesForTools(tools) {
|
|
247
|
-
const actions = /* @__PURE__ */ new Set();
|
|
248
|
-
for (const tool of tools) actions.add(classify({ tool }).actionClass);
|
|
249
|
-
return actions;
|
|
250
|
-
}
|
|
251
|
-
function normalizeTools(recipe) {
|
|
252
|
-
const seen = /* @__PURE__ */ new Set();
|
|
253
|
-
const tools = [];
|
|
254
|
-
for (const tool of recipe.tools) {
|
|
255
|
-
if (typeof tool !== "string" || tool.trim().length === 0) {
|
|
256
|
-
throw new Error(`agent recipe '${recipe.id}' declares an invalid tool name`);
|
|
257
|
-
}
|
|
258
|
-
if (seen.has(tool)) continue;
|
|
259
|
-
seen.add(tool);
|
|
260
|
-
tools.push(isBuiltinToolName(tool) ? tool : tool);
|
|
261
|
-
}
|
|
262
|
-
return tools;
|
|
263
|
-
}
|
|
264
|
-
function asToolName(tool) {
|
|
265
|
-
return isBuiltinToolName(tool) ? tool : tool;
|
|
266
|
-
}
|
|
267
|
-
function normalizeToolRequirements(recipe, tools) {
|
|
268
|
-
if (!recipe.toolRequirements) {
|
|
269
|
-
throw new Error(`agent recipe '${recipe.id}' must declare tools.required and tools.optional`);
|
|
270
|
-
}
|
|
271
|
-
const declared = new Set(tools);
|
|
272
|
-
const required = recipe.toolRequirements.required.map((requirement, index) => {
|
|
273
|
-
if (typeof requirement === "string") return asToolName(requirement);
|
|
274
|
-
if (!Array.isArray(requirement.anyOf) || requirement.anyOf.length === 0) {
|
|
275
|
-
throw new Error(`agent recipe '${recipe.id}' tools.required[${index}].anyOf must be non-empty`);
|
|
276
|
-
}
|
|
277
|
-
return { anyOf: requirement.anyOf.map(asToolName) };
|
|
278
|
-
});
|
|
279
|
-
const optional = recipe.toolRequirements.optional.map(asToolName);
|
|
280
|
-
const mentioned = required.flatMap(
|
|
281
|
-
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
282
|
-
);
|
|
283
|
-
for (const tool of [...mentioned, ...optional]) {
|
|
284
|
-
if (!declared.has(tool)) throw new Error(`agent recipe '${recipe.id}' requirement '${tool}' is not declared`);
|
|
285
|
-
}
|
|
286
|
-
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== mentioned.length + optional.length) {
|
|
287
|
-
throw new Error(`agent recipe '${recipe.id}' contains duplicate tool requirements`);
|
|
288
|
-
}
|
|
289
|
-
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== tools.length) {
|
|
290
|
-
throw new Error(`agent recipe '${recipe.id}' has declared tools without required/optional semantics`);
|
|
291
|
-
}
|
|
292
|
-
return { required, optional };
|
|
293
|
-
}
|
|
294
|
-
function resolveAgentToolCompatibility(spec, effectiveTools, options) {
|
|
295
|
-
const available = new Set(effectiveTools);
|
|
296
|
-
const missingRequired = [];
|
|
297
|
-
for (const requirement of spec.toolRequirements.required) {
|
|
298
|
-
if (typeof requirement === "string") {
|
|
299
|
-
if (!available.has(requirement)) missingRequired.push(requirement);
|
|
300
|
-
continue;
|
|
301
|
-
}
|
|
302
|
-
if (!requirement.anyOf.some((tool) => available.has(tool))) {
|
|
303
|
-
missingRequired.push(`anyOf(${requirement.anyOf.join("|")})`);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
if (available.has(ToolNames.Dispatch) && !options.mediatesDispatch) {
|
|
307
|
-
missingRequired.push("dispatch(runtime mediation unavailable)");
|
|
308
|
-
}
|
|
309
|
-
return {
|
|
310
|
-
compatible: missingRequired.length === 0,
|
|
311
|
-
missingRequired,
|
|
312
|
-
lostOptional: spec.toolRequirements.optional.filter((tool) => !available.has(tool))
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function normalizeAgentSpec(recipe) {
|
|
316
|
-
const tools = normalizeTools(recipe);
|
|
317
|
-
const toolRequirements = normalizeToolRequirements(recipe, tools);
|
|
318
|
-
return {
|
|
319
|
-
version: recipe.version,
|
|
320
|
-
id: recipe.id,
|
|
321
|
-
name: recipe.name,
|
|
322
|
-
description: recipe.description,
|
|
323
|
-
source: recipe.source,
|
|
324
|
-
filepath: recipe.filepath,
|
|
325
|
-
tools,
|
|
326
|
-
toolRequirements,
|
|
327
|
-
category: recipe.category,
|
|
328
|
-
capabilityClass: recipe.capabilityClass,
|
|
329
|
-
latencyClass: recipe.latencyClass,
|
|
330
|
-
projectContextTier: recipe.projectContextTier,
|
|
331
|
-
audience: recipe.audience,
|
|
332
|
-
tags: recipe.tags,
|
|
333
|
-
skills: recipe.skills,
|
|
334
|
-
resultContract: recipe.resultContract,
|
|
335
|
-
...recipe.product !== void 0 ? { product: recipe.product } : {},
|
|
336
|
-
budget: recipe.budget,
|
|
337
|
-
body: recipe.body
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function agentSpecFingerprint(spec) {
|
|
341
|
-
const requirement = (entry) => typeof entry === "string" ? entry : `anyOf(${[...entry.anyOf].sort().join("|")})`;
|
|
342
|
-
const payload = JSON.stringify({
|
|
343
|
-
id: spec.id,
|
|
344
|
-
tools: [...spec.tools].sort(),
|
|
345
|
-
required: spec.toolRequirements.required.map(requirement).sort(),
|
|
346
|
-
optional: [...spec.toolRequirements.optional].sort(),
|
|
347
|
-
capabilityClass: spec.capabilityClass,
|
|
348
|
-
latencyClass: spec.latencyClass,
|
|
349
|
-
projectContextTier: spec.projectContextTier,
|
|
350
|
-
audience: spec.audience,
|
|
351
|
-
skills: [...spec.skills].sort(),
|
|
352
|
-
resultContract: spec.resultContract,
|
|
353
|
-
budget: spec.budget,
|
|
354
|
-
body: createHash("sha256").update(spec.body, "utf8").digest("hex")
|
|
355
|
-
});
|
|
356
|
-
return createHash("sha256").update(payload, "utf8").digest("hex");
|
|
357
|
-
}
|
|
358
|
-
function isUserVisibleAgent(spec) {
|
|
359
|
-
return spec.audience === "base" || spec.audience === "custom";
|
|
360
|
-
}
|
|
361
|
-
function isShadowAgent(spec) {
|
|
362
|
-
return spec.audience === "shadow" || spec.audience === "internal";
|
|
363
|
-
}
|
|
364
|
-
function agentSpecPolicyErrors(spec) {
|
|
365
|
-
const errors = [];
|
|
366
|
-
const actions = actionClassesForTools(spec.tools);
|
|
367
|
-
const requiredGroups = spec.toolRequirements.required.map(
|
|
368
|
-
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
369
|
-
);
|
|
370
|
-
const requiresTool = (tool) => requiredGroups.some((group) => group.length > 0 && group.every((candidate) => candidate === tool));
|
|
371
|
-
const requiresMutation = requiredGroups.some(
|
|
372
|
-
(group) => group.length > 0 && group.every((tool) => tool === ToolNames.Write || tool === ToolNames.Edit)
|
|
373
|
-
);
|
|
374
|
-
if (spec.capabilityClass === "workspace-edit" && (!requiresTool(ToolNames.Read) || !requiresMutation)) {
|
|
375
|
-
errors.push(`workspace-edit agent '${spec.id}' must require read and write|edit`);
|
|
376
|
-
}
|
|
377
|
-
if (spec.capabilityClass === "verification" && !requiresTool(ToolNames.Verify)) {
|
|
378
|
-
errors.push(`verification agent '${spec.id}' must require verify`);
|
|
379
|
-
}
|
|
380
|
-
if (spec.capabilityClass === "artifact-write" && !requiresTool(ToolNames.Artifact)) {
|
|
381
|
-
errors.push(`artifact-write agent '${spec.id}' must require artifact`);
|
|
382
|
-
}
|
|
383
|
-
if (spec.skills.length > 0 && !requiresTool(ToolNames.Context)) {
|
|
384
|
-
errors.push(`agent '${spec.id}' must require context for bound skills`);
|
|
385
|
-
}
|
|
386
|
-
if (spec.capabilityClass === "orchestration" && spec.tools.includes(ToolNames.Dispatch) && !requiresTool(ToolNames.Dispatch)) {
|
|
387
|
-
errors.push(`orchestration agent '${spec.id}' must require dispatch when it is declared`);
|
|
388
|
-
}
|
|
389
|
-
const toolList = spec.tools.join(", ");
|
|
390
|
-
if (spec.capabilityClass === "read-only") {
|
|
391
|
-
for (const action of actions) {
|
|
392
|
-
if (action !== "read") errors.push(`read-only agent '${spec.id}' requests ${action} tools (${toolList})`);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
if (spec.capabilityClass === "artifact-write") {
|
|
396
|
-
for (const tool of spec.tools) {
|
|
397
|
-
const action = classify({ tool }).actionClass;
|
|
398
|
-
if (action === "execute" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
399
|
-
errors.push(`artifact-write agent '${spec.id}' requests ${action} tool '${tool}'`);
|
|
400
|
-
}
|
|
401
|
-
if (action === "write" && tool !== ToolNames.Artifact) {
|
|
402
|
-
errors.push(`artifact-write agent '${spec.id}' can only write terminal artifacts; got '${tool}'`);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (spec.capabilityClass === "verification") {
|
|
407
|
-
for (const tool of spec.tools) {
|
|
408
|
-
const action = classify({ tool }).actionClass;
|
|
409
|
-
if (action === "write" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
410
|
-
errors.push(`verification agent '${spec.id}' must not request ${action} tool '${tool}'`);
|
|
411
|
-
}
|
|
412
|
-
if (tool === ToolNames.Bash)
|
|
413
|
-
errors.push(`verification agent '${spec.id}' must use typed validation tools, not bash`);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (spec.capabilityClass !== "orchestration" && spec.tools.includes(ToolNames.Dispatch)) {
|
|
417
|
-
errors.push(`agent '${spec.id}' exposes dispatch without orchestration capability`);
|
|
418
|
-
}
|
|
419
|
-
if (spec.tools.includes(ToolNames.AskUser)) {
|
|
420
|
-
errors.push(`agent '${spec.id}' exposes ask_user, which is only available to the orchestrator`);
|
|
421
|
-
}
|
|
422
|
-
if (spec.skills.length > 0 && !spec.tools.includes(ToolNames.Context)) {
|
|
423
|
-
errors.push(`agent '${spec.id}' declares skills but does not expose context`);
|
|
424
|
-
}
|
|
425
|
-
return errors;
|
|
426
|
-
}
|
|
427
|
-
function assertAgentSpecPolicy(spec) {
|
|
428
|
-
const errors = agentSpecPolicyErrors(spec);
|
|
429
|
-
if (errors.length > 0) throw new Error(`agent policy violation:
|
|
430
|
-
${errors.map((error) => `- ${error}`).join("\n")}`);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export {
|
|
434
|
-
classify,
|
|
435
|
-
AGENT_AUTOMATION_AUTHORITIES,
|
|
436
|
-
isAgentCategory,
|
|
437
|
-
isAgentCapabilityClass,
|
|
438
|
-
isAgentLatencyClass,
|
|
439
|
-
isAgentAudience,
|
|
440
|
-
isAgentProjectContextTier,
|
|
441
|
-
isAgentProduct,
|
|
442
|
-
resolveAgentToolCompatibility,
|
|
443
|
-
normalizeAgentSpec,
|
|
444
|
-
agentSpecFingerprint,
|
|
445
|
-
isUserVisibleAgent,
|
|
446
|
-
isShadowAgent,
|
|
447
|
-
assertAgentSpecPolicy
|
|
448
|
-
};
|
|
449
|
-
//# sourceMappingURL=chunk-AOCYTWAV.js.map
|
package/dist/chunk-HWUFFB6L.js
DELETED
|
@@ -1,83 +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/domains/safety/autonomy.ts
|
|
7
|
-
init_esm_shims();
|
|
8
|
-
var AUTONOMY_LEVELS = ["read-only", "suggest", "auto-edit", "full-auto"];
|
|
9
|
-
var DEFAULT_AUTONOMY_LEVEL = "auto-edit";
|
|
10
|
-
function isAutonomyLevel(value) {
|
|
11
|
-
return typeof value === "string" && AUTONOMY_LEVELS.includes(value);
|
|
12
|
-
}
|
|
13
|
-
var AUTONOMY_EXPOSURES = ["local", "outward"];
|
|
14
|
-
var DEFAULT_AUTONOMY_EXPOSURE = "local";
|
|
15
|
-
function mapAutonomy(level, actionClass, options = {}) {
|
|
16
|
-
if (actionClass === "git_destructive") return "deny";
|
|
17
|
-
if ((level === "auto-edit" || level === "suggest") && options.exposure === "outward") return "ask";
|
|
18
|
-
if (actionClass === "read") return "allow";
|
|
19
|
-
if (level === "read-only") return "deny";
|
|
20
|
-
if (level === "suggest") return "ask";
|
|
21
|
-
switch (actionClass) {
|
|
22
|
-
case "write":
|
|
23
|
-
return "allow";
|
|
24
|
-
case "dispatch":
|
|
25
|
-
if (options.dispatchPlanScale === true && level !== "full-auto") return "ask";
|
|
26
|
-
return "allow";
|
|
27
|
-
case "execute": {
|
|
28
|
-
if (options.executeRecognized !== false) return "allow";
|
|
29
|
-
return level === "full-auto" ? "allow" : "ask";
|
|
30
|
-
}
|
|
31
|
-
case "unknown":
|
|
32
|
-
return "ask";
|
|
33
|
-
default:
|
|
34
|
-
return "ask";
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function autonomyDenyRejection(level, tool, actionClass) {
|
|
38
|
-
return {
|
|
39
|
-
short: `${tool} denied: autonomy level is ${level}`,
|
|
40
|
-
detail: `Clio is at autonomy ${level}: ${actionClass} actions are denied without prompting. Describe the change you would make instead, so the operator can apply it or raise the autonomy level.`,
|
|
41
|
-
hints: ["Propose the exact edit or command as text.", "The operator can change the level in /settings."]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function autonomyAskRejection(level, tool, actionClass, exposure = DEFAULT_AUTONOMY_EXPOSURE) {
|
|
45
|
-
if (exposure === "outward") {
|
|
46
|
-
return {
|
|
47
|
-
short: `${tool} needs approval: outward-facing gate at autonomy ${level}`,
|
|
48
|
-
detail: `The call declared exposure=outward, so answering it publishes or sends something outside the workspace. Autonomy ${level} auto-answers local gates and parks outward-facing ones for the operator.`,
|
|
49
|
-
hints: [
|
|
50
|
-
"Approving resumes only this call.",
|
|
51
|
-
"Autonomy full-auto answers outward gates too; the safety net still applies there."
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
short: `${tool} needs approval (${actionClass}) at autonomy ${level}`,
|
|
57
|
-
detail: `Autonomy ${level} routes ${actionClass} actions through operator approval. The call is parked until the operator approves it once or cancels it.`,
|
|
58
|
-
hints: [
|
|
59
|
-
"Approving resumes only this call.",
|
|
60
|
-
"Recognized commands can be added to .clio-coder/safety.yaml.",
|
|
61
|
-
// The sanctioned pivots for a gated shell command: typed verification
|
|
62
|
-
// and read-class observe tools run without approval at this level,
|
|
63
|
-
// and models otherwise stall retrying denied bash for checks or
|
|
64
|
-
// directory listings.
|
|
65
|
-
...actionClass === "execute" ? [
|
|
66
|
-
'A declared package or project-catalog check runs without approval through the verify tool: verify(check="<id>").',
|
|
67
|
-
"Read-only inspection runs without approval through the ls, read, grep, and find tools."
|
|
68
|
-
] : []
|
|
69
|
-
]
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export {
|
|
74
|
-
AUTONOMY_LEVELS,
|
|
75
|
-
DEFAULT_AUTONOMY_LEVEL,
|
|
76
|
-
isAutonomyLevel,
|
|
77
|
-
AUTONOMY_EXPOSURES,
|
|
78
|
-
DEFAULT_AUTONOMY_EXPOSURE,
|
|
79
|
-
mapAutonomy,
|
|
80
|
-
autonomyDenyRejection,
|
|
81
|
-
autonomyAskRejection
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=chunk-HWUFFB6L.js.map
|
package/dist/chunk-R346GLFC.js
DELETED
|
@@ -1,31 +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/safe-id.ts
|
|
7
|
-
init_esm_shims();
|
|
8
|
-
var InvalidIdError = class extends Error {
|
|
9
|
-
constructor(message) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = "InvalidIdError";
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
function isSafeId(id) {
|
|
15
|
-
if (id.length === 0) return false;
|
|
16
|
-
if (id.includes("/") || id.includes("\\")) return false;
|
|
17
|
-
if (id.includes("\0")) return false;
|
|
18
|
-
if (id === "." || id === "..") return false;
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
function assertSafeId(id, kind) {
|
|
22
|
-
if (!isSafeId(id)) {
|
|
23
|
-
throw new InvalidIdError(`invalid ${kind} id '${id}': must not contain path separators or path segments`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
InvalidIdError,
|
|
29
|
-
assertSafeId
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=chunk-R346GLFC.js.map
|