@iowarp/clio-coder 0.3.8 → 0.4.0
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 +102 -0
- package/NOTICE +33 -0
- package/README.md +12 -3
- package/dist/{acp-U67UHUK2.js → acp-G5WJBNCT.js} +13 -12
- package/dist/{agents-YU6SGALZ.js → agents-FMV2Q5G4.js} +41 -36
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-5ZPJOIVG.js → auth-3IDSJEIK.js} +18 -18
- package/dist/{builtins-C6JMZVV6.js → builtins-XCZWXSC7.js} +5 -5
- package/dist/{chunk-IFBNV6H6.js → chunk-2ANTL7MR.js} +3 -3
- package/dist/{chunk-5FR74PWO.js → chunk-2JDWVJND.js} +2 -2
- package/dist/{chunk-XWSF374K.js → chunk-2OQE55CK.js} +3 -3
- package/dist/{chunk-5H3GB5BO.js → chunk-32KWKNSF.js} +8 -384
- package/dist/{chunk-KTYTFRMB.js → chunk-36EJLSQQ.js} +34 -36
- package/dist/{chunk-FHJEP5SW.js → chunk-3BT2XMV4.js} +19 -13
- package/dist/chunk-3DPEIQKN.js +113 -0
- package/dist/{chunk-GU2UIAFZ.js → chunk-3URVFKWK.js} +7 -7
- package/dist/{chunk-WEH5XRJQ.js → chunk-3XML7CDN.js} +3 -3
- package/dist/chunk-42FMPA75.js +101 -0
- package/dist/{chunk-A2NJGIB3.js → chunk-5LXZXPKX.js} +2 -2
- package/dist/{chunk-VCBR6CU7.js → chunk-5PSMVOLM.js} +2 -2
- package/dist/{chunk-NMPKI6XL.js → chunk-6DB53AJS.js} +203 -25
- package/dist/{chunk-3BINW3FP.js → chunk-76ONBSIA.js} +2 -2
- package/dist/{chunk-26LEYJZH.js → chunk-7MCTRUCE.js} +2 -2
- package/dist/{chunk-TYPGUK6W.js → chunk-AB44T6BB.js} +111 -5
- package/dist/{chunk-K4XHGFR5.js → chunk-B7OBL7PK.js} +317 -721
- package/dist/{chunk-B5CSFE7B.js → chunk-BBVJUZHB.js} +2 -2
- package/dist/{chunk-EQ63NRB7.js → chunk-BBVYXMFO.js} +2 -2
- package/dist/{chunk-ZVJ5BLO2.js → chunk-BKFJHQCA.js} +154 -16
- package/dist/chunk-BKFM6EJV.js +462 -0
- package/dist/chunk-BMS5RKQY.js +27 -0
- package/dist/{chunk-ZNLWCMVZ.js → chunk-BPKCPIL7.js} +2 -2
- package/dist/{chunk-TLQJPP24.js → chunk-BUMFYQFY.js} +1394 -1349
- package/dist/{chunk-BNAZZHFG.js → chunk-BYP5D4HI.js} +1 -1
- package/dist/chunk-C2LTL2W6.js +2447 -0
- package/dist/{chunk-ME6CCNFO.js → chunk-CODPRO7Q.js} +8 -8
- package/dist/{chunk-E77JEWSD.js → chunk-CTJ4RNAA.js} +7 -37
- package/dist/{chunk-ODFEOB4F.js → chunk-CY6FY24N.js} +26 -8
- package/dist/{chunk-7RFXX52T.js → chunk-DQITNCXG.js} +642 -172
- package/dist/{chunk-TTHACPOM.js → chunk-DYJP44XW.js} +578 -117
- package/dist/{chunk-2HFZQUHL.js → chunk-F4CKPOEQ.js} +18 -8
- package/dist/{chunk-DGSYXYMX.js → chunk-FEFIFZTL.js} +3 -3
- package/dist/{chunk-GWS3VEIW.js → chunk-FWDFM5ZU.js} +24 -3
- package/dist/{chunk-MV3K5QF2.js → chunk-GCSMB2KY.js} +2 -2
- package/dist/chunk-GKF55TAZ.js +391 -0
- package/dist/{chunk-VWZOAB7K.js → chunk-GR5G2PVF.js} +9 -8
- package/dist/{chunk-4DGYLA73.js → chunk-GXNLGKAB.js} +80 -9
- package/dist/chunk-HHV2GANA.js +88 -0
- package/dist/{chunk-IIZWH4XA.js → chunk-HI63TFOG.js} +5 -4
- package/dist/{chunk-WLFILSD5.js → chunk-HJJTYUHX.js} +113 -83
- package/dist/{chunk-TT36MB5S.js → chunk-HLW2MRKE.js} +3 -1
- package/dist/{chunk-PMDBGQSJ.js → chunk-HWHKMHUA.js} +7 -7
- package/dist/chunk-HZHHCK24.js +1631 -0
- package/dist/{chunk-WSB3FPX7.js → chunk-I5VEOC6I.js} +39 -143
- package/dist/chunk-IBEBSCYA.js +564 -0
- package/dist/chunk-IQ7KR472.js +362 -0
- package/dist/{chunk-A3WNZD3P.js → chunk-J4W7KFM7.js} +949 -972
- package/dist/{chunk-TB5666IT.js → chunk-JDG2WCRO.js} +5 -5
- package/dist/{chunk-N22QMJKY.js → chunk-K5C3NCBD.js} +4 -4
- package/dist/{chunk-CGKSTWHD.js → chunk-K6BSR66V.js} +2 -1
- package/dist/{chunk-5C3AQNDW.js → chunk-KFZI4NIL.js} +216 -38
- package/dist/chunk-KMVISBZR.js +132 -0
- package/dist/{chunk-WXY7KU3G.js → chunk-LDQ2ZF2M.js} +2 -2
- package/dist/{chunk-XN3L4EYL.js → chunk-LQ3DZAMX.js} +3 -3
- package/dist/{chunk-U6MBIEMB.js → chunk-LY4S7GJC.js} +173 -144
- package/dist/{chunk-4SPRNWDE.js → chunk-MLKNTWH2.js} +19 -19
- package/dist/{chunk-MVVUPGPW.js → chunk-MXHC5QYU.js} +6 -6
- package/dist/chunk-NEKRRTYW.js +56 -0
- package/dist/{chunk-SPULKLCF.js → chunk-NHCZP4K7.js} +3 -3
- package/dist/chunk-NHLBIGRH.js +1506 -0
- package/dist/chunk-NQQH3YT7.js +302 -0
- package/dist/chunk-NYS75XW5.js +15 -0
- package/dist/{chunk-GN57SG4G.js → chunk-O4XIVISU.js} +10 -8
- package/dist/{chunk-EMYUUSFG.js → chunk-O6TL7WWY.js} +6 -6
- package/dist/chunk-OQBA45DZ.js +97 -0
- package/dist/{chunk-LU7P4LHA.js → chunk-P3FOHJT4.js} +2 -2
- package/dist/chunk-PMZCIOCJ.js +25 -0
- package/dist/{chunk-I4HZDVNP.js → chunk-PQEFIJ36.js} +2 -2
- package/dist/{chunk-J3YUBZWY.js → chunk-QBJA7R7N.js} +62 -6
- package/dist/chunk-QDC3K2U3.js +262 -0
- package/dist/{chunk-2HEJ2F35.js → chunk-QLFS5GO2.js} +22 -10
- package/dist/{chunk-7RGZWPB6.js → chunk-QLL7ILRG.js} +95 -32
- package/dist/{chunk-YS5VLNH5.js → chunk-QREDIESB.js} +6 -6
- package/dist/chunk-QSNYB6ZV.js +195 -0
- package/dist/{chunk-GOXNB3AO.js → chunk-RAPCMZL4.js} +75 -4
- package/dist/chunk-RKKLTLYB.js +45 -0
- package/dist/{chunk-P43ETTHK.js → chunk-SJ5ZKQ4S.js} +2 -2
- package/dist/{chunk-GPIEI3LY.js → chunk-SP2RXXYO.js} +6 -54
- package/dist/chunk-SUCTJL45.js +45 -0
- package/dist/{chunk-DYIM5TJT.js → chunk-SUW5DORT.js} +263 -7
- package/dist/chunk-T56WDKA5.js +183 -0
- package/dist/chunk-TVHHYFHE.js +255 -0
- package/dist/{chunk-FJ3H4MN5.js → chunk-TZ3SGWZZ.js} +3 -3
- package/dist/{chunk-MXKJU4JB.js → chunk-U77AMWDL.js} +91 -10
- package/dist/{chunk-5DHKRSMQ.js → chunk-ULC6OTWO.js} +11 -7
- package/dist/{chunk-RWSI4YD7.js → chunk-UM7N4G5A.js} +33 -12
- package/dist/{chunk-FCSXB6T2.js → chunk-UOSL25KY.js} +14 -2
- package/dist/{chunk-IGWKHNIQ.js → chunk-UXMFQ54G.js} +44 -37
- package/dist/{chunk-HFSBBKSQ.js → chunk-V5DHCITQ.js} +171 -3
- package/dist/{chunk-5WIGXA4T.js → chunk-VAZSBTKF.js} +111 -4
- package/dist/{chunk-VHN4MY6O.js → chunk-VEO4AP2K.js} +2 -2
- package/dist/{chunk-IJ7RPIYJ.js → chunk-VFA6GDY5.js} +65 -4
- package/dist/{chunk-PT7HYKEM.js → chunk-VO2LKSTM.js} +2 -2
- package/dist/chunk-VO67MWHC.js +75 -0
- package/dist/{chunk-XK56QHLX.js → chunk-VPKWYKEY.js} +19 -5
- package/dist/{chunk-TANS5ZJS.js → chunk-VYMXRQI6.js} +36 -22
- package/dist/{chunk-WWCZ5F23.js → chunk-W5VSYASO.js} +77 -16
- package/dist/{chunk-WNIJTQQK.js → chunk-WZR7K7ZX.js} +72 -116
- package/dist/{chunk-5Q2VVUKB.js → chunk-X3YGUTOB.js} +4 -4
- package/dist/chunk-X75E3D2N.js +686 -0
- package/dist/{chunk-VAWNZU7Z.js → chunk-YDFRH54B.js} +4 -4
- package/dist/chunk-YJX4SHTD.js +40 -0
- package/dist/{chunk-ZI647VB5.js → chunk-YPI3QQCF.js} +2 -2
- package/dist/chunk-Z2RR6MAK.js +127 -0
- package/dist/{chunk-FBVTI2TJ.js → chunk-Z4TXYIEG.js} +12 -131
- package/dist/cli/index.js +47 -36
- package/dist/{clio-QVTYJ57A.js → clio-2JXHBBY5.js} +7 -7
- package/dist/{code-nav-FGGFIE7L.js → code-nav-3YYRMYNF.js} +8 -8
- package/dist/{compile-cache-CVJMMODC.js → compile-cache-7FPE6PS3.js} +3 -3
- package/dist/{components-ZFA3SAER.js → components-RYZV4JGP.js} +5 -5
- package/dist/{config-LW5IJFQN.js → config-QZPCMYSO.js} +99 -63
- package/dist/{configure-7XIZCOU4.js → configure-TEGEBYCA.js} +23 -22
- package/dist/{context-Y6Y7QPR6.js → context-AV7OEZ4D.js} +12 -12
- package/dist/{context-L3WL3X7K.js → context-E6H5RNMC.js} +56 -47
- package/dist/{context-N52ZA626.js → context-GSXUE4CT.js} +29 -27
- package/dist/{context-clear-MBQRLSDQ.js → context-clear-SHIBYK6T.js} +55 -46
- package/dist/{context-index-HVMFQHK3.js → context-index-HNG3MOME.js} +2 -2
- package/dist/{context-working-set-GS6DSO7F.js → context-working-set-5ZGKPGZQ.js} +13 -13
- package/dist/{dispatch-runner-22ZCNOM3.js → dispatch-runner-EFMJT4LD.js} +93 -64
- package/dist/{docs-7LQ23DLM.js → docs-23KQS3XK.js} +5 -5
- package/dist/doctor-QOA5FNY5.js +313 -0
- package/dist/{eval-BEC2WHDA.js → eval-TFBYQH4H.js} +2032 -156
- package/dist/eval-inventory-SXH7PDKX.js +316 -0
- package/dist/{evidence-REJUMSKM.js → evidence-ERGESKGN.js} +203 -48
- package/dist/{evolve-PY5ZBA5K.js → evolve-VDXTSYCJ.js} +52 -43
- package/dist/{extensions-HVKU65YU.js → extensions-7BGBHN57.js} +13 -7
- package/dist/{fleet-7WZEWRFA.js → fleet-2RRVDF2V.js} +228 -108
- package/dist/{fleet-commands-UVHWM76J.js → fleet-commands-VJ726XIA.js} +11 -11
- package/dist/fleet-decisions-EPAPM3XJ.js +157 -0
- package/dist/{fleet-graph-6ULH7PES.js → fleet-graph-JF5QOATM.js} +18 -15
- package/dist/fleet-inspect-VLY4S7QM.js +442 -0
- package/dist/{fleet-preflight-J53T6CCE.js → fleet-preflight-AIZUEJOY.js} +5 -5
- package/dist/{fleet-validate-72PC4SLA.js → fleet-validate-AJRPDMDV.js} +22 -19
- package/dist/fleet-verify-JFEL2L3H.js +175 -0
- package/dist/fleet-view-ZCON35AG.js +102 -0
- package/dist/{init-OG3TPGQG.js → init-DN2WWLFE.js} +72 -62
- package/dist/install-XGLBQY5E.js +13 -0
- package/dist/interop-OZBKXAYL.js +114 -0
- package/dist/{library-CNTMPLRF.js → library-YWZG7IMW.js} +21 -18
- package/dist/{memory-6IS7F275.js → memory-I4C4HMLW.js} +54 -45
- package/dist/{models-ENRJDA5W.js → models-CEYXJBO6.js} +33 -30
- package/dist/{monitor-XLDVO7TN.js → monitor-NZ6GCI3P.js} +59 -52
- package/dist/{orchestrator-6KSPYRHA.js → orchestrator-GCGQ4N5I.js} +7827 -7328
- package/dist/panes-HMABYVO4.js +58 -0
- package/dist/panes-KY6W3V2E.js +103 -0
- package/dist/{paths-DBXMZMDU.js → paths-II4K7DNR.js} +5 -5
- package/dist/{reset-RZ4ER727.js → reset-DQ6FGCSH.js} +13 -11
- package/dist/resources-BB3MVJMD.js +111 -0
- package/dist/{run-Y2CNK5RU.js → run-H2GQDUER.js} +119 -87
- package/dist/{share-A55GYP6Z.js → share-GTJN6A5O.js} +20 -17
- package/dist/{skills-ALC5J6AT.js → skills-L55TEW6R.js} +33 -24
- package/dist/{skills-eval-JPBEBYQU.js → skills-eval-XVXPH2JI.js} +67 -56
- package/dist/skills-inventory-S4MXPJFV.js +126 -0
- package/dist/slash-commands-ZSGASKJC.js +77 -0
- package/dist/{steer-GGWFUJUD.js → steer-RZGSCY4R.js} +4 -4
- package/dist/{support-MIETYA5E.js → support-PKEUNNQL.js} +6 -6
- package/dist/{targets-VGNXIR3S.js → targets-NCPZ644J.js} +68 -40
- package/dist/{terminal-lease-WOBR64YA.js → terminal-lease-44SV3YCN.js} +6 -4
- package/dist/tools-DAF3DI3C.js +27 -0
- package/dist/{trace-PNCASAXC.js → trace-FYVW2MQA.js} +207 -10
- package/dist/tui-primitives-2AKXQNZK.js +13 -0
- package/dist/{uninstall-ZJF5H5ZN.js → uninstall-DW2PNOIC.js} +5 -5
- package/dist/{upgrade-FUSUAGHR.js → upgrade-3XPP6OQL.js} +27 -24
- package/dist/{usage-N4MKVHKD.js → usage-3NLHGTU2.js} +114 -62
- package/dist/{verifiers-YAWOJ3H2.js → verifiers-SSQONKRT.js} +172 -13
- package/dist/{verify-LTDHYBGY.js → verify-3U6J7FZI.js} +10 -10
- package/dist/{web-fetch-2YHJ3KTG.js → web-fetch-S7RR6GZ7.js} +3 -3
- package/dist/{wiki-generate-6M7GHTBJ.js → wiki-generate-CEHYGPGQ.js} +75 -65
- package/dist/with-panes-MKB46MPQ.js +782 -0
- package/dist/worker/entry.js +106 -75
- package/docs/README.md +3 -2
- package/docs/acp.md +24 -3
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +2 -2
- package/docs/artifact-versions.md +9 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +62 -3
- package/docs/commands-and-modes.md +31 -2
- package/docs/configuration-and-targets.md +69 -12
- package/docs/context-engine.md +63 -4
- package/docs/development-pipeline.md +19 -0
- package/docs/dispatch-typed-intent.md +385 -0
- package/docs/documentation-coverage.md +5 -5
- package/docs/documentation-guide.md +1 -1
- package/docs/environment-variables.md +3 -0
- package/docs/eval-runner.md +262 -11
- package/docs/evals-internal.md +72 -2
- package/docs/evidence-and-memory.md +12 -11
- package/docs/evolution.md +1 -1
- package/docs/exit-codes-and-output.md +1 -1
- package/docs/extensions-and-sharing.md +27 -1
- package/docs/fleet-dispatch.md +25 -4
- package/docs/installation-and-lifecycle.md +15 -2
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +10 -1
- package/docs/observability.md +55 -4
- 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 +2 -2
- package/docs/scientific-validation.md +3 -3
- package/docs/session-lifecycle.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +18 -8
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +88 -1
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +5 -2
- package/src/cli/acp.ts +6 -2
- package/src/cli/agents.ts +1 -1
- package/src/cli/argv.ts +25 -0
- package/src/cli/config-inspect.ts +33 -6
- package/src/cli/config.ts +1 -1
- package/src/cli/configure.ts +23 -21
- package/src/cli/doctor-panes.ts +124 -0
- package/src/cli/doctor-state-size.ts +82 -0
- package/src/cli/doctor-toolchain.ts +57 -0
- package/src/cli/doctor.ts +22 -1
- package/src/cli/eval-inventory.ts +436 -0
- package/src/cli/eval.ts +93 -16
- package/src/cli/evidence-detail.ts +88 -0
- package/src/cli/evidence-inventory.ts +183 -0
- package/src/cli/evidence.ts +30 -5
- package/src/cli/extensions.ts +5 -1
- package/src/cli/fleet-decisions.ts +69 -0
- package/src/cli/fleet-inspect.ts +334 -0
- package/src/cli/fleet-verify.ts +133 -0
- package/src/cli/fleet-view.ts +810 -0
- package/src/cli/fleet.ts +179 -39
- package/src/cli/index.ts +14 -2
- package/src/cli/interop-inspect.ts +128 -0
- package/src/cli/interop.ts +34 -0
- package/src/cli/panes.ts +35 -0
- package/src/cli/reset.ts +5 -2
- package/src/cli/run.ts +58 -0
- package/src/cli/skills-inventory.ts +185 -0
- package/src/cli/skills.ts +16 -13
- package/src/cli/targets.ts +44 -13
- package/src/cli/tools.ts +321 -0
- package/src/cli/trace-inspect.ts +252 -0
- package/src/cli/trace.ts +85 -5
- package/src/cli/usage.ts +63 -14
- package/src/cli/verifiers-inspect.ts +347 -0
- package/src/cli/verifiers.ts +9 -0
- package/src/core/bus-events.ts +33 -1
- package/src/core/cache-telemetry.ts +42 -0
- package/src/core/config.ts +67 -0
- package/src/core/defaults.ts +124 -8
- package/src/core/endpoint-key.ts +27 -0
- package/src/core/residency-target-key.ts +25 -0
- package/src/core/response-schema.ts +80 -6
- package/src/core/theme-token-hex.ts +43 -0
- package/src/core/tool-names.ts +2 -1
- package/src/core/xdg.ts +1 -1
- package/src/domains/agents/fleets/build-review.md +0 -3
- package/src/domains/agents/fleets/build-test.md +0 -3
- package/src/domains/agents/result-contract-filesystem.ts +32 -0
- package/src/domains/agents/result-contract.ts +164 -35
- package/src/domains/config/classify.ts +6 -0
- package/src/domains/context/codewiki/coordinator.ts +12 -4
- package/src/domains/dispatch/admission-error.ts +9 -0
- package/src/domains/dispatch/admission.ts +52 -14
- package/src/domains/dispatch/capacity-lease.ts +118 -9
- package/src/domains/dispatch/contract.ts +11 -0
- package/src/domains/dispatch/council-topology.ts +398 -0
- package/src/domains/dispatch/execution-plan.ts +44 -4
- package/src/domains/dispatch/extension.ts +378 -82
- package/src/domains/dispatch/fleet-node-prompt.ts +62 -0
- package/src/domains/dispatch/fleet-plan.ts +7 -2
- package/src/domains/dispatch/fleet-run.ts +87 -4
- package/src/domains/dispatch/gate-decisions.ts +11 -1
- package/src/domains/dispatch/gate-role-prompts.ts +9 -0
- package/src/domains/dispatch/gate-topology.ts +289 -0
- package/src/domains/dispatch/heartbeat.ts +32 -8
- package/src/domains/dispatch/index.ts +22 -0
- package/src/domains/dispatch/intent-compatibility.ts +330 -0
- package/src/domains/dispatch/intent.ts +85 -1
- package/src/domains/dispatch/orphan-recovery.ts +5 -0
- package/src/domains/dispatch/reservation-store.ts +139 -11
- package/src/domains/dispatch/run-event-journal-bridge.ts +149 -0
- package/src/domains/dispatch/run-event-journal.ts +598 -0
- package/src/domains/dispatch/state.ts +49 -1
- package/src/domains/dispatch/types.ts +13 -0
- package/src/domains/dispatch/validation.ts +33 -8
- 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 +342 -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/inventory.ts +113 -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 +105 -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/store.ts +6 -0
- 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 -1
- package/src/domains/memory/task-bank-promotion.ts +64 -0
- package/src/domains/memory/task-memory-policy.ts +82 -17
- 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 +3 -0
- package/src/domains/middleware/index.ts +1 -0
- package/src/domains/middleware/memory-intervention.ts +97 -21
- package/src/domains/middleware/memory-step-endpoint.ts +71 -0
- package/src/domains/mux/contract.ts +434 -0
- package/src/domains/mux/detect.ts +158 -0
- package/src/domains/mux/extension.ts +47 -0
- package/src/domains/mux/index.ts +96 -0
- package/src/domains/mux/manifest.ts +6 -0
- package/src/domains/mux/operations.ts +164 -0
- package/src/domains/mux/pane-registry.ts +90 -0
- package/src/domains/mux/protocol.ts +49 -0
- package/src/domains/mux/socket-client.ts +816 -0
- package/src/domains/mux/types.ts +222 -0
- package/src/domains/mux/viewer-command.ts +59 -0
- package/src/domains/mux/yazi/assets/init.lua +2 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/LICENSE +21 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/README.md +78 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/main.lua +255 -0
- package/src/domains/mux/yazi/assets/plugins/git.yazi/types.lua +12 -0
- package/src/domains/mux/yazi/assets/yazi.toml +17 -0
- package/src/domains/mux/yazi/event-stream.ts +180 -0
- package/src/domains/mux/yazi/profile.ts +299 -0
- package/src/domains/mux/yazi/session.ts +228 -0
- package/src/domains/mux/yazi/theme.ts +30 -0
- package/src/domains/observability/background-memory-usage.ts +140 -0
- package/src/domains/observability/cost.ts +22 -1
- package/src/domains/observability/index.ts +9 -0
- package/src/domains/observability/out-of-turn-usage.ts +51 -2
- package/src/domains/observability/trace-store.ts +234 -2
- package/src/domains/prompts/compiler.ts +100 -13
- package/src/domains/providers/endpoint-capacity.ts +228 -0
- package/src/domains/providers/endpoint-slots-store.ts +189 -0
- package/src/domains/providers/extension.ts +20 -3
- package/src/domains/providers/index.ts +32 -0
- package/src/domains/providers/model-runtime-capabilities.ts +32 -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/boot-manifest.ts +1 -0
- package/src/domains/providers/runtimes/builtins.ts +2 -0
- 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/runtimes/protocol/litellm.ts +375 -0
- package/src/domains/providers/support.ts +1 -0
- package/src/domains/providers/target-model-cache.ts +124 -0
- package/src/domains/providers/types/capability-flags.ts +2 -0
- package/src/domains/providers/types/target-descriptor.ts +2 -0
- package/src/domains/resources/index.ts +3 -0
- package/src/domains/resources/prompts/loader.ts +95 -33
- package/src/domains/resources/skills/loader.ts +33 -0
- package/src/domains/safety/action-classifier.ts +6 -0
- 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/domains/toolchain/archive.ts +175 -0
- package/src/domains/toolchain/contract.ts +28 -0
- package/src/domains/toolchain/extension.ts +47 -0
- package/src/domains/toolchain/index.ts +39 -0
- package/src/domains/toolchain/install.ts +327 -0
- package/src/domains/toolchain/manifest.ts +8 -0
- package/src/domains/toolchain/paths.ts +34 -0
- package/src/domains/toolchain/registry.ts +265 -0
- package/src/domains/toolchain/remove.ts +218 -0
- package/src/domains/toolchain/resolve.ts +182 -0
- package/src/domains/toolchain/types.ts +113 -0
- package/src/domains/toolchain/version.ts +88 -0
- package/src/engine/acp/adapter.ts +18 -3
- package/src/engine/acp/server.ts +413 -70
- package/src/engine/acp/types.ts +19 -1
- 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/claude/sdk-module.ts +98 -0
- package/src/engine/claude/sdk-runtime.ts +19 -11
- package/src/engine/provider-payload.ts +29 -1
- package/src/engine/tui-primitives.ts +21 -0
- package/src/engine/tui.ts +1 -0
- package/src/engine/worker-runtime.ts +2 -13
- package/src/entry/boot-options.ts +2 -0
- package/src/entry/orchestrator.ts +279 -35
- package/src/entry/panes-activation.ts +31 -0
- package/src/entry/with-panes.ts +20 -0
- 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 +41 -10
- package/src/interactive/cost-overlay.ts +66 -6
- package/src/interactive/council-grid.ts +1 -3
- package/src/interactive/council.ts +11 -0
- package/src/interactive/dispatch-board.ts +102 -20
- package/src/interactive/fleet-run-preview.ts +41 -15
- package/src/interactive/handoff-round.ts +41 -2
- package/src/interactive/interactive-application.ts +177 -7
- package/src/interactive/interactive-input-runtime.ts +15 -0
- package/src/interactive/interactive-presentation.ts +4 -0
- package/src/interactive/interactive-shell.ts +20 -17
- package/src/interactive/interactive-slash-runtime.ts +63 -10
- package/src/interactive/memory-overlay.ts +9 -0
- package/src/interactive/modal-marker.ts +170 -0
- package/src/interactive/mutation-preview.ts +295 -0
- package/src/interactive/mux-bridge.ts +214 -0
- package/src/interactive/overlay-frame.ts +58 -2
- package/src/interactive/overlay-general-openers.ts +17 -0
- package/src/interactive/overlay-key-routing.ts +52 -3
- package/src/interactive/overlay-lifecycle.ts +56 -7
- package/src/interactive/overlay-model-selectors.ts +40 -3
- package/src/interactive/overlay-permission-lifecycle.ts +112 -24
- package/src/interactive/overlay-session-lifecycle.ts +73 -9
- package/src/interactive/overlay-transitions.ts +18 -4
- package/src/interactive/overlays/agents.ts +1 -0
- package/src/interactive/overlays/ask-user.ts +227 -49
- package/src/interactive/overlays/auth-dialog.ts +1 -0
- package/src/interactive/overlays/context-reset.ts +1 -0
- package/src/interactive/overlays/cwd-fallback.ts +1 -0
- package/src/interactive/overlays/decisions.ts +11 -11
- package/src/interactive/overlays/extensions.ts +1 -0
- package/src/interactive/overlays/fleet-run-approval.ts +1 -0
- package/src/interactive/overlays/handoff-review.ts +1 -0
- package/src/interactive/overlays/help-reference.ts +6 -0
- package/src/interactive/overlays/interop.ts +1 -0
- package/src/interactive/overlays/library-install-confirm.ts +1 -0
- package/src/interactive/overlays/library-tabs.ts +28 -0
- package/src/interactive/overlays/list-overlay.ts +10 -1
- package/src/interactive/overlays/message-picker.ts +1 -0
- package/src/interactive/overlays/model-scope.ts +86 -0
- package/src/interactive/overlays/model-selector.ts +1 -0
- package/src/interactive/overlays/prompts.ts +12 -1
- package/src/interactive/overlays/session-selector.ts +1 -0
- package/src/interactive/overlays/settings-sections.ts +30 -0
- package/src/interactive/overlays/settings.ts +614 -45
- package/src/interactive/overlays/side-question.ts +1 -0
- package/src/interactive/overlays/skills-hub.ts +3 -11
- package/src/interactive/overlays/tree-selector.ts +1 -0
- package/src/interactive/pane-policy.ts +46 -0
- package/src/interactive/panes-runtime.ts +292 -0
- 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/compaction-summary.ts +29 -0
- package/src/interactive/renderers/tool-execution.ts +4 -0
- package/src/interactive/renderers/worker-entry.ts +122 -14
- package/src/interactive/side-question.ts +58 -1
- package/src/interactive/slash-commands.ts +251 -15
- 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/tasks-overlay.ts +1 -0
- package/src/interactive/terminal-lease.ts +2 -0
- package/src/interactive/theme/tokens.ts +3 -14
- package/src/interactive/turn-context.ts +346 -33
- 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/artifacts.ts +109 -1
- package/src/interactive/view/view-overlay.ts +29 -3
- package/src/interactive/watch-pane.ts +152 -0
- package/src/interactive/worker-progress.ts +7 -1
- package/src/interactive/worker-receipts.ts +19 -1
- package/src/interactive/worker-stream.ts +5 -0
- package/src/interactive/yazi-bridge.ts +444 -0
- package/src/tools/ask-user.ts +43 -2
- package/src/tools/bootstrap.ts +26 -2
- package/src/tools/builtin-tool-catalog.ts +15 -0
- package/src/tools/compete-worktrees.ts +83 -2
- package/src/tools/core-bootstrap.ts +2 -1
- package/src/tools/dispatch-admission.ts +14 -3
- package/src/tools/dispatch-arguments.ts +20 -20
- package/src/tools/dispatch-plan.ts +17 -9
- package/src/tools/dispatch-run-events.ts +134 -19
- package/src/tools/dispatch-runner.ts +29 -7
- package/src/tools/dispatch-scout.ts +1 -1
- package/src/tools/dispatch-types.ts +15 -3
- package/src/tools/dispatch.ts +1 -1
- package/src/tools/executables.ts +17 -14
- package/src/tools/observation.ts +54 -4
- package/src/tools/panes-surface.ts +38 -0
- package/src/tools/panes.ts +112 -0
- package/src/tools/policy.ts +10 -1
- package/src/tools/presentation.ts +1 -0
- package/src/tools/registry.ts +16 -0
- package/dist/chunk-AOCYTWAV.js +0 -449
- package/dist/chunk-HLE42MG7.js +0 -37
- package/dist/chunk-HWUFFB6L.js +0 -83
- package/dist/chunk-JOZYP4GM.js +0 -279
- package/dist/doctor-M7YEDGAE.js +0 -91
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
artifactDefaultPath,
|
|
4
|
+
extractCommandCdTargets,
|
|
5
|
+
extractCommandWriteTargets
|
|
6
|
+
} from "./chunk-GCSMB2KY.js";
|
|
7
|
+
import {
|
|
8
|
+
canonicalizeExistingPath
|
|
9
|
+
} from "./chunk-ECH6PKUQ.js";
|
|
10
|
+
import {
|
|
11
|
+
ToolNames,
|
|
12
|
+
isBuiltinToolName
|
|
13
|
+
} from "./chunk-K6BSR66V.js";
|
|
5
14
|
import {
|
|
6
15
|
init_esm_shims
|
|
7
16
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -34,10 +43,431 @@ function parseJsonObjectPayload(text) {
|
|
|
34
43
|
return { ok: false, reason: parsedSomething ? "not-object" : "not-json" };
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
// src/domains/agents/
|
|
46
|
+
// src/domains/agents/spec.ts
|
|
38
47
|
init_esm_shims();
|
|
39
48
|
import { createHash } from "node:crypto";
|
|
49
|
+
|
|
50
|
+
// src/domains/safety/action-classifier.ts
|
|
51
|
+
init_esm_shims();
|
|
40
52
|
import path from "node:path";
|
|
53
|
+
var GIT_DESTRUCTIVE_PATTERNS = [
|
|
54
|
+
{ name: "git-push-force-long", re: /\bgit\s+push\s+--force\b/i },
|
|
55
|
+
{ name: "git-push-force-short", re: /\bgit\s+push\s+-f\b/i },
|
|
56
|
+
{ name: "git-reset-hard", re: /\bgit\s+reset\s+--hard\b/i },
|
|
57
|
+
{ name: "git-clean-fd", re: /\bgit\s+clean\s+-fd?\b/i },
|
|
58
|
+
{ name: "git-checkout-dot", re: /\bgit\s+checkout\s+--\s+\./i },
|
|
59
|
+
{ name: "git-branch-D", re: /\bgit\s+branch\s+-D\b/i },
|
|
60
|
+
{ name: "git-restore-source", re: /\bgit\s+restore\s+--source\b/i }
|
|
61
|
+
];
|
|
62
|
+
var SYSTEM_MODIFY_PATTERNS = [
|
|
63
|
+
{ name: "sudo-or-doas", re: /\b(sudo|doas)\b/i },
|
|
64
|
+
// allow rm -rf /tmp/... and /var/tmp/... but flag everything else rooted at /
|
|
65
|
+
{ name: "rm-rf-root", re: /\brm\s+-rf?\s+\/(?!(tmp|var\/tmp)(?:\/|\s|$))/i },
|
|
66
|
+
{ name: "apt-install", re: /\bapt(-get)?\s+(install|remove|purge)/i },
|
|
67
|
+
{ name: "brew-install", re: /\bbrew\s+(install|uninstall|reinstall)/i },
|
|
68
|
+
{ name: "npm-install-global", re: /\bnpm\s+install\s+-g\b/i },
|
|
69
|
+
{ name: "pip-install", re: /\bpip\s+install\b/i },
|
|
70
|
+
{ name: "systemctl", re: /\bsystemctl\s+/i },
|
|
71
|
+
{ name: "chmod-root", re: /\bchmod\s+[0-7]{3,4}\s+\//i },
|
|
72
|
+
{ name: "chown", re: /\bchown\s+/i }
|
|
73
|
+
];
|
|
74
|
+
var SYSTEM_WRITE_ROOT_PREFIXES = ["/etc", "/usr", "/var", "/bin", "/sbin", "/run"];
|
|
75
|
+
var SYSTEM_WRITE_EXEMPT_PREFIXES = ["/var/tmp", "/var/folders"];
|
|
76
|
+
function isUnderPrefix(abs, prefix) {
|
|
77
|
+
return abs === prefix || abs.startsWith(`${prefix}/`);
|
|
78
|
+
}
|
|
79
|
+
function baseClassify(tool) {
|
|
80
|
+
switch (tool) {
|
|
81
|
+
case ToolNames.Read:
|
|
82
|
+
case ToolNames.Grep:
|
|
83
|
+
case ToolNames.Find:
|
|
84
|
+
case ToolNames.Ls:
|
|
85
|
+
case ToolNames.WebFetch:
|
|
86
|
+
case ToolNames.Git:
|
|
87
|
+
case ToolNames.CodeNav:
|
|
88
|
+
case ToolNames.Context:
|
|
89
|
+
case ToolNames.Monitor:
|
|
90
|
+
case ToolNames.AskUser:
|
|
91
|
+
case ToolNames.CredentialPresent:
|
|
92
|
+
// tasks pick mutates only Clio-owned session-ledger and project-local
|
|
93
|
+
// .clio-coder runtime state, never source-workspace files. By intentional
|
|
94
|
+
// policy it stays read class and ungated; the tool itself still requires
|
|
95
|
+
// a durable operator task id before it can mutate either store.
|
|
96
|
+
case ToolNames.Tasks:
|
|
97
|
+
// ledger posts a typed contribution to a coordination board and reads a
|
|
98
|
+
// local mirror. Neither touches the workspace, so it is never gated
|
|
99
|
+
// behind a confirmation.
|
|
100
|
+
case ToolNames.Ledger:
|
|
101
|
+
// panes focuses, opens, and closes terminal panes Clio itself created, in
|
|
102
|
+
// a pane host that lives outside the workspace. Nothing it does writes a
|
|
103
|
+
// file, runs a model-supplied command (its schema exposes presets only),
|
|
104
|
+
// or survives the session, so it is reversible, local, and never gated
|
|
105
|
+
// behind a confirmation.
|
|
106
|
+
case ToolNames.Panes:
|
|
107
|
+
return "read";
|
|
108
|
+
case ToolNames.Write:
|
|
109
|
+
case ToolNames.Edit:
|
|
110
|
+
case ToolNames.Artifact:
|
|
111
|
+
return "write";
|
|
112
|
+
case ToolNames.Bash:
|
|
113
|
+
case ToolNames.Verify:
|
|
114
|
+
return "execute";
|
|
115
|
+
case ToolNames.Dispatch:
|
|
116
|
+
case ToolNames.Steer:
|
|
117
|
+
return "dispatch";
|
|
118
|
+
default:
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function scanStringOf(args) {
|
|
123
|
+
if (!args) return "";
|
|
124
|
+
const parts = [];
|
|
125
|
+
for (const value of Object.values(args)) {
|
|
126
|
+
if (value == null) continue;
|
|
127
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
128
|
+
parts.push(String(value));
|
|
129
|
+
} else {
|
|
130
|
+
try {
|
|
131
|
+
parts.push(JSON.stringify(value));
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return parts.join(" ");
|
|
137
|
+
}
|
|
138
|
+
function matchFirst(patterns, haystack) {
|
|
139
|
+
for (const p of patterns) {
|
|
140
|
+
if (p.re.test(haystack)) return p;
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
function resolveCandidate(p, baseCwd) {
|
|
145
|
+
if (p.startsWith("~")) return p;
|
|
146
|
+
const base = canonicalizeExistingPath(path.resolve(baseCwd ?? process.cwd()));
|
|
147
|
+
const resolved = path.isAbsolute(p) ? path.resolve(p) : path.resolve(base, p);
|
|
148
|
+
return canonicalizeExistingPath(resolved);
|
|
149
|
+
}
|
|
150
|
+
function isInsideCwd(abs) {
|
|
151
|
+
const cwd = canonicalizeExistingPath(path.resolve(process.cwd()));
|
|
152
|
+
const candidate = canonicalizeExistingPath(abs);
|
|
153
|
+
const rel = path.relative(cwd, candidate);
|
|
154
|
+
return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
155
|
+
}
|
|
156
|
+
function writePathClass(pathArg, baseCwd) {
|
|
157
|
+
if (pathArg.startsWith("~")) {
|
|
158
|
+
return { cls: "system_modify", reason: `write-path-home-escape: ${pathArg}` };
|
|
159
|
+
}
|
|
160
|
+
const abs = resolveCandidate(pathArg, baseCwd);
|
|
161
|
+
const exempt = SYSTEM_WRITE_EXEMPT_PREFIXES.some((prefix) => isUnderPrefix(abs, prefix));
|
|
162
|
+
if (!exempt) {
|
|
163
|
+
for (const prefix of SYSTEM_WRITE_ROOT_PREFIXES) {
|
|
164
|
+
if (isUnderPrefix(abs, prefix)) {
|
|
165
|
+
return { cls: "system_modify", reason: `write-path-system-root: ${prefix}` };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!isInsideCwd(abs)) {
|
|
170
|
+
return { cls: "system_modify", reason: `write-path-outside-cwd: ${abs}` };
|
|
171
|
+
}
|
|
172
|
+
return { cls: "write" };
|
|
173
|
+
}
|
|
174
|
+
function extractWritePath(tool, args) {
|
|
175
|
+
const candidate = args?.path ?? args?.file_path ?? args?.filePath;
|
|
176
|
+
if (typeof candidate === "string" && candidate.length > 0) return candidate;
|
|
177
|
+
return tool === ToolNames.Artifact ? artifactDefaultPath(args?.kind) : null;
|
|
178
|
+
}
|
|
179
|
+
function classify(call) {
|
|
180
|
+
const base = baseClassify(call.tool);
|
|
181
|
+
if (base === null) {
|
|
182
|
+
return { actionClass: "unknown", reasons: [`unknown tool: ${call.tool}`] };
|
|
183
|
+
}
|
|
184
|
+
const reasons = [];
|
|
185
|
+
if (call.tool === ToolNames.Bash) {
|
|
186
|
+
const scan = scanStringOf(call.args);
|
|
187
|
+
const gitHit = matchFirst(GIT_DESTRUCTIVE_PATTERNS, scan);
|
|
188
|
+
if (gitHit) {
|
|
189
|
+
return { actionClass: "git_destructive", reasons: [`pattern:${gitHit.name}`] };
|
|
190
|
+
}
|
|
191
|
+
const sysHit = matchFirst(SYSTEM_MODIFY_PATTERNS, scan);
|
|
192
|
+
if (sysHit) {
|
|
193
|
+
return { actionClass: "system_modify", reasons: [`pattern:${sysHit.name}`] };
|
|
194
|
+
}
|
|
195
|
+
const command = typeof call.args?.command === "string" ? call.args.command : null;
|
|
196
|
+
const argCwd = typeof call.args?.cwd === "string" && call.args.cwd.length > 0 ? call.args.cwd : void 0;
|
|
197
|
+
if (command !== null) {
|
|
198
|
+
const targetReasons = [];
|
|
199
|
+
for (const target of extractCommandWriteTargets(command)) {
|
|
200
|
+
const decision = writePathClass(target, argCwd);
|
|
201
|
+
if (decision.cls === "system_modify") {
|
|
202
|
+
targetReasons.push(decision.reason ?? `bash-write-target: ${target}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
for (const target of extractCommandCdTargets(command)) {
|
|
206
|
+
if (target.startsWith("~")) {
|
|
207
|
+
targetReasons.push(`bash-cd-home-escape: ${target}`);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const abs = resolveCandidate(target, argCwd);
|
|
211
|
+
if (!isInsideCwd(abs)) {
|
|
212
|
+
targetReasons.push(`bash-cd-outside-workspace: ${abs}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (targetReasons.length > 0) {
|
|
216
|
+
return { actionClass: "system_modify", reasons: targetReasons };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { actionClass: "execute", reasons };
|
|
220
|
+
}
|
|
221
|
+
if (base === "write") {
|
|
222
|
+
const pathArg = extractWritePath(call.tool, call.args);
|
|
223
|
+
if (pathArg) {
|
|
224
|
+
const decision = writePathClass(pathArg);
|
|
225
|
+
if (decision.cls === "system_modify") {
|
|
226
|
+
return { actionClass: "system_modify", reasons: decision.reason ? [decision.reason] : [] };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return { actionClass: "write", reasons };
|
|
230
|
+
}
|
|
231
|
+
return { actionClass: base, reasons };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/domains/agents/spec.ts
|
|
235
|
+
var AGENT_AUTOMATION_AUTHORITIES = ["read-only", "verification", "artifact-write", "workspace-edit"];
|
|
236
|
+
var AGENT_PRODUCTS = ["orientation"];
|
|
237
|
+
var AGENT_CATEGORIES = [
|
|
238
|
+
"explore",
|
|
239
|
+
"plan",
|
|
240
|
+
"research",
|
|
241
|
+
"implement",
|
|
242
|
+
"quality",
|
|
243
|
+
"science",
|
|
244
|
+
"evolution",
|
|
245
|
+
"operations",
|
|
246
|
+
"internal"
|
|
247
|
+
];
|
|
248
|
+
var AGENT_CAPABILITY_CLASSES = [
|
|
249
|
+
"read-only",
|
|
250
|
+
"artifact-write",
|
|
251
|
+
"workspace-edit",
|
|
252
|
+
"verification",
|
|
253
|
+
"orchestration",
|
|
254
|
+
"internal"
|
|
255
|
+
];
|
|
256
|
+
var AGENT_LATENCY_CLASSES = ["fast", "balanced", "deep"];
|
|
257
|
+
var AGENT_AUDIENCES = ["base", "shadow", "custom", "internal"];
|
|
258
|
+
var AGENT_PROJECT_CONTEXT_TIERS = ["none", "bounded"];
|
|
259
|
+
function includes(values, value) {
|
|
260
|
+
return typeof value === "string" && values.includes(value);
|
|
261
|
+
}
|
|
262
|
+
function isAgentCategory(value) {
|
|
263
|
+
return includes(AGENT_CATEGORIES, value);
|
|
264
|
+
}
|
|
265
|
+
function isAgentCapabilityClass(value) {
|
|
266
|
+
return includes(AGENT_CAPABILITY_CLASSES, value);
|
|
267
|
+
}
|
|
268
|
+
function isAgentLatencyClass(value) {
|
|
269
|
+
return includes(AGENT_LATENCY_CLASSES, value);
|
|
270
|
+
}
|
|
271
|
+
function isAgentAudience(value) {
|
|
272
|
+
return includes(AGENT_AUDIENCES, value);
|
|
273
|
+
}
|
|
274
|
+
function isAgentProjectContextTier(value) {
|
|
275
|
+
return includes(AGENT_PROJECT_CONTEXT_TIERS, value);
|
|
276
|
+
}
|
|
277
|
+
function isAgentProduct(value) {
|
|
278
|
+
return includes(AGENT_PRODUCTS, value);
|
|
279
|
+
}
|
|
280
|
+
function actionClassesForTools(tools) {
|
|
281
|
+
const actions = /* @__PURE__ */ new Set();
|
|
282
|
+
for (const tool of tools) actions.add(classify({ tool }).actionClass);
|
|
283
|
+
return actions;
|
|
284
|
+
}
|
|
285
|
+
function normalizeTools(recipe) {
|
|
286
|
+
const seen = /* @__PURE__ */ new Set();
|
|
287
|
+
const tools = [];
|
|
288
|
+
for (const tool of recipe.tools) {
|
|
289
|
+
if (typeof tool !== "string" || tool.trim().length === 0) {
|
|
290
|
+
throw new Error(`agent recipe '${recipe.id}' declares an invalid tool name`);
|
|
291
|
+
}
|
|
292
|
+
if (seen.has(tool)) continue;
|
|
293
|
+
seen.add(tool);
|
|
294
|
+
tools.push(isBuiltinToolName(tool) ? tool : tool);
|
|
295
|
+
}
|
|
296
|
+
return tools;
|
|
297
|
+
}
|
|
298
|
+
function asToolName(tool) {
|
|
299
|
+
return isBuiltinToolName(tool) ? tool : tool;
|
|
300
|
+
}
|
|
301
|
+
function normalizeToolRequirements(recipe, tools) {
|
|
302
|
+
if (!recipe.toolRequirements) {
|
|
303
|
+
throw new Error(`agent recipe '${recipe.id}' must declare tools.required and tools.optional`);
|
|
304
|
+
}
|
|
305
|
+
const declared = new Set(tools);
|
|
306
|
+
const required = recipe.toolRequirements.required.map((requirement, index) => {
|
|
307
|
+
if (typeof requirement === "string") return asToolName(requirement);
|
|
308
|
+
if (!Array.isArray(requirement.anyOf) || requirement.anyOf.length === 0) {
|
|
309
|
+
throw new Error(`agent recipe '${recipe.id}' tools.required[${index}].anyOf must be non-empty`);
|
|
310
|
+
}
|
|
311
|
+
return { anyOf: requirement.anyOf.map(asToolName) };
|
|
312
|
+
});
|
|
313
|
+
const optional = recipe.toolRequirements.optional.map(asToolName);
|
|
314
|
+
const mentioned = required.flatMap(
|
|
315
|
+
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
316
|
+
);
|
|
317
|
+
for (const tool of [...mentioned, ...optional]) {
|
|
318
|
+
if (!declared.has(tool)) throw new Error(`agent recipe '${recipe.id}' requirement '${tool}' is not declared`);
|
|
319
|
+
}
|
|
320
|
+
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== mentioned.length + optional.length) {
|
|
321
|
+
throw new Error(`agent recipe '${recipe.id}' contains duplicate tool requirements`);
|
|
322
|
+
}
|
|
323
|
+
if ((/* @__PURE__ */ new Set([...mentioned, ...optional])).size !== tools.length) {
|
|
324
|
+
throw new Error(`agent recipe '${recipe.id}' has declared tools without required/optional semantics`);
|
|
325
|
+
}
|
|
326
|
+
return { required, optional };
|
|
327
|
+
}
|
|
328
|
+
function resolveAgentToolCompatibility(spec, effectiveTools, options) {
|
|
329
|
+
const available = new Set(effectiveTools);
|
|
330
|
+
const missingRequired = [];
|
|
331
|
+
for (const requirement of spec.toolRequirements.required) {
|
|
332
|
+
if (typeof requirement === "string") {
|
|
333
|
+
if (!available.has(requirement)) missingRequired.push(requirement);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (!requirement.anyOf.some((tool) => available.has(tool))) {
|
|
337
|
+
missingRequired.push(`anyOf(${requirement.anyOf.join("|")})`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (available.has(ToolNames.Dispatch) && !options.mediatesDispatch) {
|
|
341
|
+
missingRequired.push("dispatch(runtime mediation unavailable)");
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
compatible: missingRequired.length === 0,
|
|
345
|
+
missingRequired,
|
|
346
|
+
lostOptional: spec.toolRequirements.optional.filter((tool) => !available.has(tool))
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function normalizeAgentSpec(recipe) {
|
|
350
|
+
const tools = normalizeTools(recipe);
|
|
351
|
+
const toolRequirements = normalizeToolRequirements(recipe, tools);
|
|
352
|
+
return {
|
|
353
|
+
version: recipe.version,
|
|
354
|
+
id: recipe.id,
|
|
355
|
+
name: recipe.name,
|
|
356
|
+
description: recipe.description,
|
|
357
|
+
source: recipe.source,
|
|
358
|
+
filepath: recipe.filepath,
|
|
359
|
+
tools,
|
|
360
|
+
toolRequirements,
|
|
361
|
+
category: recipe.category,
|
|
362
|
+
capabilityClass: recipe.capabilityClass,
|
|
363
|
+
latencyClass: recipe.latencyClass,
|
|
364
|
+
projectContextTier: recipe.projectContextTier,
|
|
365
|
+
audience: recipe.audience,
|
|
366
|
+
tags: recipe.tags,
|
|
367
|
+
skills: recipe.skills,
|
|
368
|
+
resultContract: recipe.resultContract,
|
|
369
|
+
...recipe.product !== void 0 ? { product: recipe.product } : {},
|
|
370
|
+
budget: recipe.budget,
|
|
371
|
+
body: recipe.body
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function agentSpecFingerprint(spec) {
|
|
375
|
+
const requirement = (entry) => typeof entry === "string" ? entry : `anyOf(${[...entry.anyOf].sort().join("|")})`;
|
|
376
|
+
const payload = JSON.stringify({
|
|
377
|
+
id: spec.id,
|
|
378
|
+
tools: [...spec.tools].sort(),
|
|
379
|
+
required: spec.toolRequirements.required.map(requirement).sort(),
|
|
380
|
+
optional: [...spec.toolRequirements.optional].sort(),
|
|
381
|
+
capabilityClass: spec.capabilityClass,
|
|
382
|
+
latencyClass: spec.latencyClass,
|
|
383
|
+
projectContextTier: spec.projectContextTier,
|
|
384
|
+
audience: spec.audience,
|
|
385
|
+
skills: [...spec.skills].sort(),
|
|
386
|
+
resultContract: spec.resultContract,
|
|
387
|
+
budget: spec.budget,
|
|
388
|
+
body: createHash("sha256").update(spec.body, "utf8").digest("hex")
|
|
389
|
+
});
|
|
390
|
+
return createHash("sha256").update(payload, "utf8").digest("hex");
|
|
391
|
+
}
|
|
392
|
+
function isUserVisibleAgent(spec) {
|
|
393
|
+
return spec.audience === "base" || spec.audience === "custom";
|
|
394
|
+
}
|
|
395
|
+
function isShadowAgent(spec) {
|
|
396
|
+
return spec.audience === "shadow" || spec.audience === "internal";
|
|
397
|
+
}
|
|
398
|
+
function agentSpecPolicyErrors(spec) {
|
|
399
|
+
const errors = [];
|
|
400
|
+
const actions = actionClassesForTools(spec.tools);
|
|
401
|
+
const requiredGroups = spec.toolRequirements.required.map(
|
|
402
|
+
(requirement) => typeof requirement === "string" ? [requirement] : requirement.anyOf
|
|
403
|
+
);
|
|
404
|
+
const requiresTool = (tool) => requiredGroups.some((group) => group.length > 0 && group.every((candidate) => candidate === tool));
|
|
405
|
+
const requiresMutation = requiredGroups.some(
|
|
406
|
+
(group) => group.length > 0 && group.every((tool) => tool === ToolNames.Write || tool === ToolNames.Edit)
|
|
407
|
+
);
|
|
408
|
+
if (spec.capabilityClass === "workspace-edit" && (!requiresTool(ToolNames.Read) || !requiresMutation)) {
|
|
409
|
+
errors.push(`workspace-edit agent '${spec.id}' must require read and write|edit`);
|
|
410
|
+
}
|
|
411
|
+
if (spec.capabilityClass === "verification" && !requiresTool(ToolNames.Verify)) {
|
|
412
|
+
errors.push(`verification agent '${spec.id}' must require verify`);
|
|
413
|
+
}
|
|
414
|
+
if (spec.capabilityClass === "artifact-write" && !requiresTool(ToolNames.Artifact)) {
|
|
415
|
+
errors.push(`artifact-write agent '${spec.id}' must require artifact`);
|
|
416
|
+
}
|
|
417
|
+
if (spec.skills.length > 0 && !requiresTool(ToolNames.Context)) {
|
|
418
|
+
errors.push(`agent '${spec.id}' must require context for bound skills`);
|
|
419
|
+
}
|
|
420
|
+
if (spec.capabilityClass === "orchestration" && spec.tools.includes(ToolNames.Dispatch) && !requiresTool(ToolNames.Dispatch)) {
|
|
421
|
+
errors.push(`orchestration agent '${spec.id}' must require dispatch when it is declared`);
|
|
422
|
+
}
|
|
423
|
+
const toolList = spec.tools.join(", ");
|
|
424
|
+
if (spec.capabilityClass === "read-only") {
|
|
425
|
+
for (const action of actions) {
|
|
426
|
+
if (action !== "read") errors.push(`read-only agent '${spec.id}' requests ${action} tools (${toolList})`);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (spec.capabilityClass === "artifact-write") {
|
|
430
|
+
for (const tool of spec.tools) {
|
|
431
|
+
const action = classify({ tool }).actionClass;
|
|
432
|
+
if (action === "execute" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
433
|
+
errors.push(`artifact-write agent '${spec.id}' requests ${action} tool '${tool}'`);
|
|
434
|
+
}
|
|
435
|
+
if (action === "write" && tool !== ToolNames.Artifact) {
|
|
436
|
+
errors.push(`artifact-write agent '${spec.id}' can only write terminal artifacts; got '${tool}'`);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (spec.capabilityClass === "verification") {
|
|
441
|
+
for (const tool of spec.tools) {
|
|
442
|
+
const action = classify({ tool }).actionClass;
|
|
443
|
+
if (action === "write" || action === "dispatch" || action === "system_modify" || action === "git_destructive") {
|
|
444
|
+
errors.push(`verification agent '${spec.id}' must not request ${action} tool '${tool}'`);
|
|
445
|
+
}
|
|
446
|
+
if (tool === ToolNames.Bash)
|
|
447
|
+
errors.push(`verification agent '${spec.id}' must use typed validation tools, not bash`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (spec.capabilityClass !== "orchestration" && spec.tools.includes(ToolNames.Dispatch)) {
|
|
451
|
+
errors.push(`agent '${spec.id}' exposes dispatch without orchestration capability`);
|
|
452
|
+
}
|
|
453
|
+
if (spec.tools.includes(ToolNames.AskUser)) {
|
|
454
|
+
errors.push(`agent '${spec.id}' exposes ask_user, which is only available to the orchestrator`);
|
|
455
|
+
}
|
|
456
|
+
if (spec.skills.length > 0 && !spec.tools.includes(ToolNames.Context)) {
|
|
457
|
+
errors.push(`agent '${spec.id}' declares skills but does not expose context`);
|
|
458
|
+
}
|
|
459
|
+
return errors;
|
|
460
|
+
}
|
|
461
|
+
function assertAgentSpecPolicy(spec) {
|
|
462
|
+
const errors = agentSpecPolicyErrors(spec);
|
|
463
|
+
if (errors.length > 0) throw new Error(`agent policy violation:
|
|
464
|
+
${errors.map((error) => `- ${error}`).join("\n")}`);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/domains/agents/result-contract.ts
|
|
468
|
+
init_esm_shims();
|
|
469
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
470
|
+
import path2 from "node:path";
|
|
41
471
|
function parseDelegationPlanResult(output) {
|
|
42
472
|
const parsed = parseJson(output);
|
|
43
473
|
if (!parsed.ok || !hasOnlyKeys(parsed.value, ["tasks"]) || !Array.isArray(parsed.value.tasks) || parsed.value.tasks.length === 0)
|
|
@@ -155,7 +585,7 @@ function canonical(value) {
|
|
|
155
585
|
throw new Error(`result contract cannot digest ${typeof value}`);
|
|
156
586
|
}
|
|
157
587
|
function digest(value) {
|
|
158
|
-
return
|
|
588
|
+
return createHash2("sha256").update(canonical(value), "utf8").digest("hex");
|
|
159
589
|
}
|
|
160
590
|
function resultContractDigest(contract) {
|
|
161
591
|
return digest(contract);
|
|
@@ -358,13 +788,24 @@ function parseChecks(value) {
|
|
|
358
788
|
}
|
|
359
789
|
return checks;
|
|
360
790
|
}
|
|
791
|
+
function citationWithinWorkspace(cwd, citedPath) {
|
|
792
|
+
const relative = path2.relative(cwd, citedPath);
|
|
793
|
+
if (relative === "") return true;
|
|
794
|
+
return !(relative === ".." || relative.startsWith(`..${path2.sep}`) || path2.isAbsolute(relative));
|
|
795
|
+
}
|
|
796
|
+
function directoryCitationDigest(cwd, citedPath) {
|
|
797
|
+
const relative = path2.relative(cwd, citedPath);
|
|
798
|
+
return createHash2("sha256").update(`directory:${relative === "" ? "." : relative}`, "utf8").digest("hex");
|
|
799
|
+
}
|
|
361
800
|
function validateScoutCitation(input, citation) {
|
|
362
|
-
const cwd =
|
|
363
|
-
const citedPath =
|
|
364
|
-
|
|
365
|
-
if (relative === "" || relative.startsWith(`..${path.sep}`) || relative === ".." || path.isAbsolute(relative)) {
|
|
801
|
+
const cwd = path2.resolve(input.cwd);
|
|
802
|
+
const citedPath = path2.resolve(cwd, citation.path);
|
|
803
|
+
if (!citationWithinWorkspace(cwd, citedPath)) {
|
|
366
804
|
return { ok: false, reason: `Scout citation path escapes the workspace: ${citation.path}` };
|
|
367
805
|
}
|
|
806
|
+
if (input.filesystem.isDirectory?.(citedPath) === true) {
|
|
807
|
+
return { ok: true, evidence: { ...citation, contentDigest: directoryCitationDigest(cwd, citedPath) } };
|
|
808
|
+
}
|
|
368
809
|
const content = input.filesystem.readFile(citedPath);
|
|
369
810
|
if (content === null) return { ok: false, reason: `Scout citation cannot be read: ${citation.path}` };
|
|
370
811
|
const lineCount = content.split(/\r\n|\r|\n/u).length;
|
|
@@ -383,7 +824,7 @@ function validateScoutCitation(input, citation) {
|
|
|
383
824
|
}
|
|
384
825
|
return {
|
|
385
826
|
ok: true,
|
|
386
|
-
evidence: { ...citation, contentDigest:
|
|
827
|
+
evidence: { ...citation, contentDigest: createHash2("sha256").update(content, "utf8").digest("hex") }
|
|
387
828
|
};
|
|
388
829
|
}
|
|
389
830
|
function validateScoutCitations(input, citations) {
|
|
@@ -420,14 +861,57 @@ function groundDegradedScout(contract, input, scout, degradedReason) {
|
|
|
420
861
|
}
|
|
421
862
|
function validateVerifier(contract, output) {
|
|
422
863
|
const parsed = parseJson(output);
|
|
423
|
-
if (!parsed.ok) return failure(contract, "fail", parsed.reason);
|
|
864
|
+
if (!parsed.ok) return failure(contract, "fail", `Verifier result payload failed: ${parsed.reason}`);
|
|
424
865
|
const value = parsed.value;
|
|
425
|
-
|
|
426
|
-
|
|
866
|
+
const unknown = Object.keys(value).filter((key) => key !== "verdict" && key !== "checks");
|
|
867
|
+
if (unknown.length > 0) {
|
|
868
|
+
return failure(
|
|
869
|
+
contract,
|
|
870
|
+
"fail",
|
|
871
|
+
`Verifier result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are verdict and checks`
|
|
872
|
+
);
|
|
427
873
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
874
|
+
if (value.verdict !== "pass" && value.verdict !== "fail") {
|
|
875
|
+
return failure(contract, "fail", 'Verifier field "verdict" must be one of: pass | fail');
|
|
876
|
+
}
|
|
877
|
+
if (!Array.isArray(value.checks) || value.checks.length === 0) {
|
|
878
|
+
return failure(
|
|
879
|
+
contract,
|
|
880
|
+
"fail",
|
|
881
|
+
'Verifier field "checks" must be a non-empty array of {name, passed, evidence}; each checks[].passed value must be one of: true | false'
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
const checks = [];
|
|
885
|
+
for (const [index, raw] of value.checks.entries()) {
|
|
886
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
887
|
+
return failure(contract, "fail", `Verifier field "checks[${index}]" must be an object`);
|
|
888
|
+
}
|
|
889
|
+
const check = raw;
|
|
890
|
+
const checkUnknown = Object.keys(check).filter((key) => key !== "name" && key !== "passed" && key !== "evidence");
|
|
891
|
+
if (checkUnknown.length > 0) {
|
|
892
|
+
return failure(
|
|
893
|
+
contract,
|
|
894
|
+
"fail",
|
|
895
|
+
`Verifier field "checks[${index}].${checkUnknown[0]}" is not legal; legal check fields are name, passed, and evidence`
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
if (!string(check.name)) {
|
|
899
|
+
return failure(contract, "fail", `Verifier field "checks[${index}].name" must be a non-empty string`);
|
|
900
|
+
}
|
|
901
|
+
if (typeof check.passed !== "boolean") {
|
|
902
|
+
return failure(contract, "fail", `Verifier field "checks[${index}].passed" must be one of: true | false`);
|
|
903
|
+
}
|
|
904
|
+
if (!string(check.evidence)) {
|
|
905
|
+
return failure(contract, "fail", `Verifier field "checks[${index}].evidence" must be a non-empty string`);
|
|
906
|
+
}
|
|
907
|
+
checks.push({ name: check.name, passed: check.passed, evidence: check.evidence });
|
|
908
|
+
}
|
|
909
|
+
if (value.verdict === "pass" !== checks.every((check) => check.passed)) {
|
|
910
|
+
return failure(
|
|
911
|
+
contract,
|
|
912
|
+
"fail",
|
|
913
|
+
'Verifier field "verdict" must agree with every checks[].passed value; verdict legal values are pass | fail and checks[].passed legal values are true | false'
|
|
914
|
+
);
|
|
431
915
|
}
|
|
432
916
|
const verifier = { verdict: value.verdict, checks };
|
|
433
917
|
return success(contract, value.verdict, verifier, { verifier });
|
|
@@ -520,45 +1004,87 @@ function resultContractAuthorship(contract, output) {
|
|
|
520
1004
|
}
|
|
521
1005
|
function validateDebugger(contract, output) {
|
|
522
1006
|
const parsed = parseJson(output);
|
|
523
|
-
if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
|
|
1007
|
+
if (!parsed.ok) return failure(contract, "unmeasured", `Debugger result payload failed: ${parsed.reason}`);
|
|
524
1008
|
const value = parsed.value;
|
|
525
|
-
|
|
1009
|
+
const unknown = Object.keys(value).filter(
|
|
1010
|
+
(key) => key !== "diagnosis" && key !== "reproduction" && key !== "evidence"
|
|
1011
|
+
);
|
|
1012
|
+
if (unknown.length > 0) {
|
|
526
1013
|
return failure(
|
|
527
1014
|
contract,
|
|
528
1015
|
"unmeasured",
|
|
529
|
-
|
|
1016
|
+
`Debugger result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are diagnosis, reproduction, and evidence`
|
|
530
1017
|
);
|
|
531
1018
|
}
|
|
1019
|
+
if (!string(value.diagnosis)) {
|
|
1020
|
+
return failure(contract, "unmeasured", 'Debugger field "diagnosis" must be a non-empty string');
|
|
1021
|
+
}
|
|
1022
|
+
if (value.reproduction !== "reproduced" && value.reproduction !== "not-reproduced" && value.reproduction !== "unknown") {
|
|
1023
|
+
return failure(
|
|
1024
|
+
contract,
|
|
1025
|
+
"unmeasured",
|
|
1026
|
+
'Debugger field "reproduction" must be one of: reproduced | not-reproduced | unknown'
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
if (!Array.isArray(value.evidence)) {
|
|
1030
|
+
return failure(contract, "unmeasured", 'Debugger field "evidence" must be an array of strings');
|
|
1031
|
+
}
|
|
1032
|
+
const malformedEvidence = value.evidence.findIndex((entry) => !string(entry));
|
|
1033
|
+
if (malformedEvidence >= 0) {
|
|
1034
|
+
return failure(contract, "unmeasured", `Debugger field "evidence[${malformedEvidence}]" must be a non-empty string`);
|
|
1035
|
+
}
|
|
532
1036
|
return success(contract, "unmeasured", value);
|
|
533
1037
|
}
|
|
534
1038
|
function validateResearch(contract, output, networkAllowed) {
|
|
535
1039
|
const parsed = parseJson(output);
|
|
536
|
-
if (!parsed.ok) return failure(contract, "unmeasured", parsed.reason);
|
|
1040
|
+
if (!parsed.ok) return failure(contract, "unmeasured", `Research result payload failed: ${parsed.reason}`);
|
|
537
1041
|
const value = parsed.value;
|
|
538
|
-
|
|
1042
|
+
const unknown = Object.keys(value).filter((key) => key !== "source" && key !== "findings");
|
|
1043
|
+
if (unknown.length > 0) {
|
|
539
1044
|
return failure(
|
|
540
1045
|
contract,
|
|
541
1046
|
"unmeasured",
|
|
542
|
-
|
|
1047
|
+
`Research result field${unknown.length === 1 ? "" : "s"} ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not legal; legal top-level fields are source and findings`
|
|
543
1048
|
);
|
|
544
1049
|
}
|
|
1050
|
+
if (value.source !== "local" && value.source !== "external") {
|
|
1051
|
+
return failure(contract, "unmeasured", 'Research field "source" must be one of: local | external');
|
|
1052
|
+
}
|
|
1053
|
+
if (!Array.isArray(value.findings)) {
|
|
1054
|
+
return failure(contract, "unmeasured", 'Research field "findings" must be an array of {claim, evidence} objects');
|
|
1055
|
+
}
|
|
545
1056
|
if (value.source === "external" && !networkAllowed) {
|
|
546
|
-
return failure(
|
|
1057
|
+
return failure(
|
|
1058
|
+
contract,
|
|
1059
|
+
"unmeasured",
|
|
1060
|
+
'Research field "source" is external but the run has no allowed network posture; legal values are local | external, and use local for workspace-only evidence'
|
|
1061
|
+
);
|
|
547
1062
|
}
|
|
548
|
-
for (const finding of value.findings) {
|
|
1063
|
+
for (const [index, finding] of value.findings.entries()) {
|
|
549
1064
|
if (finding === null || typeof finding !== "object" || Array.isArray(finding)) {
|
|
550
|
-
return failure(contract, "unmeasured",
|
|
1065
|
+
return failure(contract, "unmeasured", `Research field "findings[${index}]" must be an object`);
|
|
551
1066
|
}
|
|
552
1067
|
const record = finding;
|
|
553
|
-
|
|
554
|
-
|
|
1068
|
+
const findingUnknown = Object.keys(record).filter((key) => key !== "claim" && key !== "evidence");
|
|
1069
|
+
if (findingUnknown.length > 0) {
|
|
1070
|
+
return failure(
|
|
1071
|
+
contract,
|
|
1072
|
+
"unmeasured",
|
|
1073
|
+
`Research field "findings[${index}].${findingUnknown[0]}" is not legal; legal finding fields are claim and evidence`
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
if (!string(record.claim)) {
|
|
1077
|
+
return failure(contract, "unmeasured", `Research field "findings[${index}].claim" must be a non-empty string`);
|
|
1078
|
+
}
|
|
1079
|
+
if (!string(record.evidence)) {
|
|
1080
|
+
return failure(contract, "unmeasured", `Research field "findings[${index}].evidence" must be a non-empty string`);
|
|
555
1081
|
}
|
|
556
1082
|
}
|
|
557
1083
|
return success(contract, "unmeasured", value);
|
|
558
1084
|
}
|
|
559
1085
|
function describeWriteSet(effects, cwd) {
|
|
560
1086
|
if (effects.mutatedPaths.size === 0) return "this run wrote nothing";
|
|
561
|
-
const written = [...effects.mutatedPaths].map((target) =>
|
|
1087
|
+
const written = [...effects.mutatedPaths].map((target) => path2.relative(cwd, target) || target).sort().slice(0, MUTATION_WRITE_SET_REASON_LIMIT);
|
|
562
1088
|
const more = effects.mutatedPaths.size - written.length;
|
|
563
1089
|
return `this run wrote ${written.join(", ")}${more > 0 ? ` (+${more} more)` : ""}`;
|
|
564
1090
|
}
|
|
@@ -589,10 +1115,10 @@ function validateMutation(contract, input) {
|
|
|
589
1115
|
const reportedFailure = !validations.every((check) => check.passed);
|
|
590
1116
|
const effects = input.observedRunEffects;
|
|
591
1117
|
if (effects === void 0) return success(contract, reportedFailure ? "fail" : "pass", value);
|
|
592
|
-
const cwd =
|
|
1118
|
+
const cwd = path2.resolve(input.cwd);
|
|
593
1119
|
let unverifiedMutation = false;
|
|
594
1120
|
for (const reported of value.mutatedPaths) {
|
|
595
|
-
const target =
|
|
1121
|
+
const target = path2.resolve(cwd, reported);
|
|
596
1122
|
if (effects.mutatedPaths.has(target)) continue;
|
|
597
1123
|
if (effects.failedMutationPaths.has(target)) {
|
|
598
1124
|
return failure(
|
|
@@ -631,14 +1157,14 @@ function validateProvenance(contract, output) {
|
|
|
631
1157
|
return success(contract, "unmeasured", value);
|
|
632
1158
|
}
|
|
633
1159
|
function validateArchitect(contract, input) {
|
|
634
|
-
const artifactPath =
|
|
1160
|
+
const artifactPath = path2.resolve(input.cwd, contract.path);
|
|
635
1161
|
const content = input.filesystem.readFile(artifactPath);
|
|
636
1162
|
if (content === null || content.trim().length === 0) {
|
|
637
1163
|
return failure(contract, "unmeasured", `required plan artifact is missing or empty: ${contract.path}`);
|
|
638
1164
|
}
|
|
639
1165
|
return success(contract, "unmeasured", {
|
|
640
1166
|
path: contract.path,
|
|
641
|
-
artifactDigest:
|
|
1167
|
+
artifactDigest: createHash2("sha256").update(content, "utf8").digest("hex")
|
|
642
1168
|
});
|
|
643
1169
|
}
|
|
644
1170
|
function parseScoutResult(output) {
|
|
@@ -742,15 +1268,15 @@ function resultContractShape(contract) {
|
|
|
742
1268
|
case "scout-report":
|
|
743
1269
|
return '{"findings":[{"claim":"what you observed","path":"src/file.ts","line":1}],"needsSplit":false,"proposedSubtasks":[]} or {"findings":[],"needsSplit":true,"proposedSubtasks":[{"id":"inspect","task":"Inspect the boundary","dependencies":[],"expectedResultContract":"scout-report","requestedAuthority":"read-only"}]} or, if you cannot produce a citation you are sure of, at least {"findings":[{"claim":"what you observed"}]}, which is accepted as an ungrounded lead rather than losing the run';
|
|
744
1270
|
case "verifier-report":
|
|
745
|
-
return '{"verdict":"pass","checks":[{"name":"npm run typecheck","passed":true,"evidence":"exit 0"}]}';
|
|
1271
|
+
return 'one of {"verdict":"pass","checks":[{"name":"npm run typecheck","passed":true,"evidence":"exit 0"}]} or {"verdict":"fail","checks":[{"name":"npm run typecheck","passed":false,"evidence":"exit 1"}]}; verdict legal values are pass | fail and checks[].passed legal values are true | false';
|
|
746
1272
|
case "council-report":
|
|
747
1273
|
return '{"members":[{"label":"alpha","runId":"run-1","round":1,"answer":"..."}],"synthesis":{"kind":"none"}}';
|
|
748
1274
|
case "council-ballot":
|
|
749
1275
|
return COUNCIL_BALLOT_SHAPE;
|
|
750
1276
|
case "debugger-report":
|
|
751
|
-
return '{"diagnosis":"...","reproduction":"reproduced","evidence":["..."]}';
|
|
1277
|
+
return 'one of {"diagnosis":"...","reproduction":"reproduced","evidence":["..."]}, {"diagnosis":"...","reproduction":"not-reproduced","evidence":["..."]}, or {"diagnosis":"...","reproduction":"unknown","evidence":["..."]}; reproduction legal values are reproduced | not-reproduced | unknown';
|
|
752
1278
|
case "research-report":
|
|
753
|
-
return '{"source":"local","findings":[{"claim":"...","evidence":"..."}]}';
|
|
1279
|
+
return 'one of {"source":"local","findings":[{"claim":"...","evidence":"..."}]} or {"source":"external","findings":[{"claim":"...","evidence":"..."}]}; source legal values are local | external';
|
|
754
1280
|
case "mutation-report":
|
|
755
1281
|
return '{"mutatedPaths":["src/file.ts"],"validations":[{"name":"npm test","passed":true,"evidence":"exit 0"}],"commitMessage":"optional: the commit message for this change","summary":"optional: one line"}';
|
|
756
1282
|
case "provenance-report":
|
|
@@ -844,7 +1370,7 @@ function parseContract(value, sourcePath, kinds) {
|
|
|
844
1370
|
if (!only("kind", "path") || !string(record.path)) {
|
|
845
1371
|
throw new Error(`agent recipe: ${sourcePath}: architect-plan requires only non-empty path`);
|
|
846
1372
|
}
|
|
847
|
-
if (
|
|
1373
|
+
if (path2.isAbsolute(record.path) || record.path.split(/[\\/]/u).includes("..")) {
|
|
848
1374
|
throw new Error(`agent recipe: ${sourcePath}: architect-plan path must be workspace-relative`);
|
|
849
1375
|
}
|
|
850
1376
|
return { kind: "architect-plan", path: record.path };
|
|
@@ -861,80 +1387,22 @@ function parseWorkerResultContract(value, sourcePath) {
|
|
|
861
1387
|
return parseContract(value, sourcePath, [...RECIPE_DECLARABLE_KINDS, ...COORDINATOR_AUTHORED_KINDS]);
|
|
862
1388
|
}
|
|
863
1389
|
|
|
864
|
-
// src/core/path-boundary.ts
|
|
865
|
-
init_esm_shims();
|
|
866
|
-
import path2 from "node:path";
|
|
867
|
-
var PATH_BOUNDARY_MAX_ENTRIES = 32;
|
|
868
|
-
var PathBoundaryError = class extends Error {
|
|
869
|
-
code;
|
|
870
|
-
constructor(code, message) {
|
|
871
|
-
super(message);
|
|
872
|
-
this.name = "PathBoundaryError";
|
|
873
|
-
this.code = code;
|
|
874
|
-
}
|
|
875
|
-
};
|
|
876
|
-
var GLOB_CHARACTERS = /[*?[\]{}]/u;
|
|
877
|
-
function normalizePathBoundaryEntry(entry) {
|
|
878
|
-
const raw = entry.trim();
|
|
879
|
-
if (raw.length === 0) throw new PathBoundaryError("empty", "write boundary: entry must be a non-empty path");
|
|
880
|
-
if (raw.includes("\\")) {
|
|
881
|
-
throw new PathBoundaryError("separator", `write boundary: entry '${entry}' must use '/' separators`);
|
|
882
|
-
}
|
|
883
|
-
if (GLOB_CHARACTERS.test(raw)) {
|
|
884
|
-
throw new PathBoundaryError("glob", `write boundary: entry '${entry}' looks like a glob, which v1 does not support`);
|
|
885
|
-
}
|
|
886
|
-
if (raw.startsWith("/") || /^[A-Za-z]:/u.test(raw)) {
|
|
887
|
-
throw new PathBoundaryError("absolute", `write boundary: entry '${entry}' must be repository-relative, not absolute`);
|
|
888
|
-
}
|
|
889
|
-
const subtree = raw.endsWith("/");
|
|
890
|
-
const segments = raw.split("/").filter((segment) => segment.length > 0);
|
|
891
|
-
if (segments.length === 0) {
|
|
892
|
-
throw new PathBoundaryError("empty", `write boundary: entry '${entry}' must name a path inside the repository`);
|
|
893
|
-
}
|
|
894
|
-
for (const segment of segments) {
|
|
895
|
-
if (segment === "..") {
|
|
896
|
-
throw new PathBoundaryError("parent", `write boundary: entry '${entry}' must not contain '..'`);
|
|
897
|
-
}
|
|
898
|
-
if (segment === ".") {
|
|
899
|
-
throw new PathBoundaryError("dot", `write boundary: entry '${entry}' must not contain '.' segments`);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
const joined = segments.join("/");
|
|
903
|
-
return subtree ? `${joined}/` : joined;
|
|
904
|
-
}
|
|
905
|
-
function normalizePathBoundary(entries) {
|
|
906
|
-
if (entries.length > PATH_BOUNDARY_MAX_ENTRIES) {
|
|
907
|
-
throw new Error(`write boundary: at most ${PATH_BOUNDARY_MAX_ENTRIES} entries may be declared`);
|
|
908
|
-
}
|
|
909
|
-
return [...new Set(entries.map(normalizePathBoundaryEntry))].sort();
|
|
910
|
-
}
|
|
911
|
-
function toPosixBoundaryPath(value) {
|
|
912
|
-
return value.split("\\").join("/");
|
|
913
|
-
}
|
|
914
|
-
function isDirectoryPathBoundary(entry) {
|
|
915
|
-
return toPosixBoundaryPath(entry).endsWith("/");
|
|
916
|
-
}
|
|
917
|
-
function asDirectoryPathBoundary(entry) {
|
|
918
|
-
const normalized = toPosixBoundaryPath(entry);
|
|
919
|
-
return normalized.endsWith("/") ? normalized : `${normalized}/`;
|
|
920
|
-
}
|
|
921
|
-
function resolvePathBoundary(cwd, entry) {
|
|
922
|
-
const directory = isDirectoryPathBoundary(entry);
|
|
923
|
-
const withoutMarker = directory ? entry.slice(0, -1) : entry;
|
|
924
|
-
const resolved = toPosixBoundaryPath(path2.resolve(cwd, withoutMarker));
|
|
925
|
-
return directory ? asDirectoryPathBoundary(resolved) : resolved;
|
|
926
|
-
}
|
|
927
|
-
function pathBoundaryEntryCovers(outer, inner) {
|
|
928
|
-
const normalizedOuter = toPosixBoundaryPath(outer);
|
|
929
|
-
const normalizedInner = toPosixBoundaryPath(inner);
|
|
930
|
-
return normalizedOuter.endsWith("/") ? normalizedInner.startsWith(normalizedOuter) : !normalizedInner.endsWith("/") && normalizedInner === normalizedOuter;
|
|
931
|
-
}
|
|
932
|
-
function pathBoundaryCovers(boundary, candidate) {
|
|
933
|
-
return boundary.some((entry) => pathBoundaryEntryCovers(entry, candidate));
|
|
934
|
-
}
|
|
935
|
-
|
|
936
1390
|
export {
|
|
937
1391
|
parseJsonObjectPayload,
|
|
1392
|
+
classify,
|
|
1393
|
+
AGENT_AUTOMATION_AUTHORITIES,
|
|
1394
|
+
isAgentCategory,
|
|
1395
|
+
isAgentCapabilityClass,
|
|
1396
|
+
isAgentLatencyClass,
|
|
1397
|
+
isAgentAudience,
|
|
1398
|
+
isAgentProjectContextTier,
|
|
1399
|
+
isAgentProduct,
|
|
1400
|
+
resolveAgentToolCompatibility,
|
|
1401
|
+
normalizeAgentSpec,
|
|
1402
|
+
agentSpecFingerprint,
|
|
1403
|
+
isUserVisibleAgent,
|
|
1404
|
+
isShadowAgent,
|
|
1405
|
+
assertAgentSpecPolicy,
|
|
938
1406
|
COUNCIL_BALLOT_VERDICT_MAX_BYTES,
|
|
939
1407
|
COUNCIL_BALLOT_SHAPE,
|
|
940
1408
|
parseCouncilReport,
|
|
@@ -946,16 +1414,9 @@ export {
|
|
|
946
1414
|
validateResultContract,
|
|
947
1415
|
validateRecipeResult,
|
|
948
1416
|
RESULT_CONTRACT_REPAIR_LIMIT,
|
|
1417
|
+
resultContractShape,
|
|
949
1418
|
resultContractRepairMessages,
|
|
950
1419
|
parseResultContract,
|
|
951
|
-
parseWorkerResultContract
|
|
952
|
-
PATH_BOUNDARY_MAX_ENTRIES,
|
|
953
|
-
PathBoundaryError,
|
|
954
|
-
normalizePathBoundaryEntry,
|
|
955
|
-
normalizePathBoundary,
|
|
956
|
-
asDirectoryPathBoundary,
|
|
957
|
-
resolvePathBoundary,
|
|
958
|
-
pathBoundaryEntryCovers,
|
|
959
|
-
pathBoundaryCovers
|
|
1420
|
+
parseWorkerResultContract
|
|
960
1421
|
};
|
|
961
|
-
//# sourceMappingURL=chunk-
|
|
1422
|
+
//# sourceMappingURL=chunk-DYJP44XW.js.map
|