@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
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
ROUTE_POLICY_VERSION,
|
|
4
4
|
isRouteDecisionAgentSelection,
|
|
5
5
|
isRoutingIntent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SJ5ZKQ4S.js";
|
|
7
7
|
import {
|
|
8
8
|
isExecutionRole
|
|
9
9
|
} from "./chunk-H7IXIC72.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
readSettings
|
|
12
|
+
} from "./chunk-VFA6GDY5.js";
|
|
13
13
|
import {
|
|
14
14
|
readClioVersion,
|
|
15
15
|
resolvePackageRoot
|
|
@@ -17,9 +17,6 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
require_dist
|
|
19
19
|
} from "./chunk-APJ265NV.js";
|
|
20
|
-
import {
|
|
21
|
-
safeResourceWrite
|
|
22
|
-
} from "./chunk-WEPFGWHJ.js";
|
|
23
20
|
import {
|
|
24
21
|
__toESM,
|
|
25
22
|
init_esm_shims
|
|
@@ -339,537 +336,6 @@ function verifyReceiptIntegrity(receipt, envelope) {
|
|
|
339
336
|
return { ok: true };
|
|
340
337
|
}
|
|
341
338
|
|
|
342
|
-
// src/domains/eval/harness-metrics.ts
|
|
343
|
-
init_esm_shims();
|
|
344
|
-
var ZERO_EVAL_HARNESS_METRICS = {
|
|
345
|
-
receiptCount: 0,
|
|
346
|
-
toolCalls: 0,
|
|
347
|
-
retries: 0,
|
|
348
|
-
safetyBlocks: 0,
|
|
349
|
-
correctionLatencyMs: 0,
|
|
350
|
-
validationEvidence: 0
|
|
351
|
-
};
|
|
352
|
-
function evalHarnessMetricsFromCommands(commands) {
|
|
353
|
-
return {
|
|
354
|
-
...ZERO_EVAL_HARNESS_METRICS,
|
|
355
|
-
validationEvidence: commands.filter(
|
|
356
|
-
(command) => command.phase === "verifier" && command.exitCode === 0 && !command.timedOut
|
|
357
|
-
).length
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
function sumEvalHarnessMetrics(records) {
|
|
361
|
-
return records.reduce((total, record) => addEvalHarnessMetrics(total, record.harness), {
|
|
362
|
-
...ZERO_EVAL_HARNESS_METRICS
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
function addEvalHarnessMetrics(left, right) {
|
|
366
|
-
return {
|
|
367
|
-
receiptCount: left.receiptCount + right.receiptCount,
|
|
368
|
-
toolCalls: left.toolCalls + right.toolCalls,
|
|
369
|
-
retries: left.retries + right.retries,
|
|
370
|
-
safetyBlocks: left.safetyBlocks + right.safetyBlocks,
|
|
371
|
-
correctionLatencyMs: left.correctionLatencyMs + right.correctionLatencyMs,
|
|
372
|
-
validationEvidence: left.validationEvidence + right.validationEvidence
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// src/domains/eval/store.ts
|
|
377
|
-
init_esm_shims();
|
|
378
|
-
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
379
|
-
import { readFile } from "node:fs/promises";
|
|
380
|
-
import { join } from "node:path";
|
|
381
|
-
|
|
382
|
-
// src/domains/eval/artifacts/redact.ts
|
|
383
|
-
init_esm_shims();
|
|
384
|
-
var SENSITIVE_KEY = /(?:^|[_-])(api[_-]?key|authorization|cookie|password|secret|token)(?:$|[_-])/i;
|
|
385
|
-
var CREDENTIAL_PATTERNS = [
|
|
386
|
-
[/\b(authorization\s*[:=]\s*)(?:bearer|basic)\s+[A-Za-z0-9._~+/=-]+/gi, "$1[redacted]"],
|
|
387
|
-
[/\b(bearer\s+)[A-Za-z0-9._~+/=-]{12,}/gi, "$1[redacted]"],
|
|
388
|
-
[/\b(sk-[A-Za-z0-9_-]{16,})\b/g, "[redacted]"],
|
|
389
|
-
[/\b(gh[pousr]_[A-Za-z0-9_]{16,})\b/g, "[redacted]"],
|
|
390
|
-
[/\b(AKIA[0-9A-Z]{16})\b/g, "[redacted]"],
|
|
391
|
-
[/\b((?:api[_-]?key|access[_-]?token|refresh[_-]?token|password|secret)\s*[:=]\s*)[^\s"',}]+/gi, "$1[redacted]"]
|
|
392
|
-
];
|
|
393
|
-
function redactArtifactForStorage(value, env = process.env) {
|
|
394
|
-
return redactValue(value, env);
|
|
395
|
-
}
|
|
396
|
-
function redactValue(value, env) {
|
|
397
|
-
if (typeof value === "string") return redactString(value, env);
|
|
398
|
-
if (Array.isArray(value)) return value.map((entry) => redactValue(entry, env));
|
|
399
|
-
if (value !== null && typeof value === "object") {
|
|
400
|
-
const out = {};
|
|
401
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
402
|
-
out[key] = SENSITIVE_KEY.test(key) ? "[redacted]" : redactValue(entry, env);
|
|
403
|
-
}
|
|
404
|
-
return out;
|
|
405
|
-
}
|
|
406
|
-
return value;
|
|
407
|
-
}
|
|
408
|
-
function redactString(value, env) {
|
|
409
|
-
let out = stripHomePrefix(value, env.HOME);
|
|
410
|
-
for (const [pattern, replacement] of CREDENTIAL_PATTERNS) {
|
|
411
|
-
out = out.replace(pattern, replacement);
|
|
412
|
-
}
|
|
413
|
-
return out;
|
|
414
|
-
}
|
|
415
|
-
function stripHomePrefix(value, home) {
|
|
416
|
-
if (home === void 0 || home.length === 0) return value;
|
|
417
|
-
const normalized = home.replace(/\/+$/g, "");
|
|
418
|
-
if (normalized.length === 0) return value;
|
|
419
|
-
return value.split(normalized).join("$HOME");
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// src/domains/eval/store.ts
|
|
423
|
-
var NODE_SIGNALS = /* @__PURE__ */ new Set([
|
|
424
|
-
"SIGHUP",
|
|
425
|
-
"SIGINT",
|
|
426
|
-
"SIGQUIT",
|
|
427
|
-
"SIGILL",
|
|
428
|
-
"SIGTRAP",
|
|
429
|
-
"SIGABRT",
|
|
430
|
-
"SIGIOT",
|
|
431
|
-
"SIGBUS",
|
|
432
|
-
"SIGFPE",
|
|
433
|
-
"SIGKILL",
|
|
434
|
-
"SIGUSR1",
|
|
435
|
-
"SIGSEGV",
|
|
436
|
-
"SIGUSR2",
|
|
437
|
-
"SIGPIPE",
|
|
438
|
-
"SIGALRM",
|
|
439
|
-
"SIGTERM",
|
|
440
|
-
"SIGCHLD",
|
|
441
|
-
"SIGSTKFLT",
|
|
442
|
-
"SIGCONT",
|
|
443
|
-
"SIGSTOP",
|
|
444
|
-
"SIGTSTP",
|
|
445
|
-
"SIGTTIN",
|
|
446
|
-
"SIGTTOU",
|
|
447
|
-
"SIGURG",
|
|
448
|
-
"SIGXCPU",
|
|
449
|
-
"SIGXFSZ",
|
|
450
|
-
"SIGVTALRM",
|
|
451
|
-
"SIGPROF",
|
|
452
|
-
"SIGWINCH",
|
|
453
|
-
"SIGIO",
|
|
454
|
-
"SIGPOLL",
|
|
455
|
-
"SIGPWR",
|
|
456
|
-
"SIGSYS",
|
|
457
|
-
"SIGUNUSED"
|
|
458
|
-
]);
|
|
459
|
-
function evalRoot(dataDir) {
|
|
460
|
-
return join(dataDir, "evals");
|
|
461
|
-
}
|
|
462
|
-
function evalArtifactPath(dataDir, evalId) {
|
|
463
|
-
assertSafeId(evalId, "eval");
|
|
464
|
-
return join(evalRoot(dataDir), `${evalId}.json`);
|
|
465
|
-
}
|
|
466
|
-
function createEvalId(startedAt, taskFileHash) {
|
|
467
|
-
const stamp = startedAt.toISOString().replace(/[-:.]/g, "");
|
|
468
|
-
return `eval-${stamp}-${taskFileHash.slice(0, 8)}-${randomBytes(6).toString("hex")}`;
|
|
469
|
-
}
|
|
470
|
-
async function writeEvalArtifact(dataDir, artifact) {
|
|
471
|
-
const path = evalArtifactPath(dataDir, artifact.evalId);
|
|
472
|
-
const redacted = redactArtifactForStorage({
|
|
473
|
-
...artifact,
|
|
474
|
-
paths: { ...artifact.paths, artifact: path }
|
|
475
|
-
});
|
|
476
|
-
safeResourceWrite(path, `${JSON.stringify(redacted, null, 2)}
|
|
477
|
-
`, { encoding: "utf8" });
|
|
478
|
-
return path;
|
|
479
|
-
}
|
|
480
|
-
async function loadEvalArtifact(dataDir, evalId) {
|
|
481
|
-
let raw;
|
|
482
|
-
try {
|
|
483
|
-
raw = await readFile(evalArtifactPath(dataDir, evalId), "utf8");
|
|
484
|
-
} catch (error) {
|
|
485
|
-
if (isErrorWithCode(error) && error.code === "ENOENT") throw new Error(`eval artifact not found: ${evalId}`);
|
|
486
|
-
throw error;
|
|
487
|
-
}
|
|
488
|
-
const source = evalArtifactPath(dataDir, evalId);
|
|
489
|
-
const parsed = parseJson(raw, source);
|
|
490
|
-
return parseArtifact(parsed, source);
|
|
491
|
-
}
|
|
492
|
-
function parseArtifact(value, source) {
|
|
493
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
494
|
-
if (value.version !== 1) throw new Error(`${source}.version: expected 1`);
|
|
495
|
-
const results = readArray(value, source, "results").map(
|
|
496
|
-
(entry, index) => parseRecord(entry, `${source}.results[${index}]`)
|
|
497
|
-
);
|
|
498
|
-
return {
|
|
499
|
-
version: 1,
|
|
500
|
-
evalId: readString(value, source, "evalId"),
|
|
501
|
-
taskFile: readString(value, source, "taskFile"),
|
|
502
|
-
taskFileHash: readString(value, source, "taskFileHash"),
|
|
503
|
-
clio: parseClioProvenance(readRequiredArtifactField(value, source, "clio"), `${source}.clio`),
|
|
504
|
-
environment: parseEnvironmentProvenance(
|
|
505
|
-
readRequiredArtifactField(value, source, "environment"),
|
|
506
|
-
`${source}.environment`
|
|
507
|
-
),
|
|
508
|
-
target: readOptionalNullableString(value, source, "target"),
|
|
509
|
-
model: readOptionalNullableString(value, source, "model"),
|
|
510
|
-
thinking: readOptionalNullableString(value, source, "thinking"),
|
|
511
|
-
paths: parseArtifactPaths(readRequiredArtifactField(value, source, "paths"), `${source}.paths`),
|
|
512
|
-
repeat: readNumber(value, source, "repeat"),
|
|
513
|
-
startedAt: readString(value, source, "startedAt"),
|
|
514
|
-
endedAt: readString(value, source, "endedAt"),
|
|
515
|
-
summary: parseSummary(value.summary, `${source}.summary`),
|
|
516
|
-
results
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function parseSummary(value, source) {
|
|
520
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
521
|
-
return {
|
|
522
|
-
runs: readNumber(value, source, "runs"),
|
|
523
|
-
passed: readNumber(value, source, "passed"),
|
|
524
|
-
failed: readNumber(value, source, "failed"),
|
|
525
|
-
passRate: readNumber(value, source, "passRate"),
|
|
526
|
-
tokens: readNumber(value, source, "tokens"),
|
|
527
|
-
costUsd: readNumber(value, source, "costUsd"),
|
|
528
|
-
wallTimeMs: readNumber(value, source, "wallTimeMs"),
|
|
529
|
-
harness: value.harness === void 0 ? { ...ZERO_EVAL_HARNESS_METRICS } : parseHarnessMetrics(value.harness, `${source}.harness`),
|
|
530
|
-
failureClasses: readArray(value, source, "failureClasses").map(
|
|
531
|
-
(entry, index) => parseFailureClassCount(entry, `${source}.failureClasses[${index}]`)
|
|
532
|
-
)
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
function parseRecord(value, source) {
|
|
536
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
537
|
-
const failureClass = readOptionalFailureClass(value, source, "failureClass");
|
|
538
|
-
const commands = readArray(value, source, "commands").map(
|
|
539
|
-
(entry, index) => parseCommand(entry, `${source}.commands[${index}]`)
|
|
540
|
-
);
|
|
541
|
-
const record = {
|
|
542
|
-
taskId: readString(value, source, "taskId"),
|
|
543
|
-
runId: readString(value, source, "runId"),
|
|
544
|
-
repeatIndex: readNumber(value, source, "repeatIndex"),
|
|
545
|
-
cwd: readString(value, source, "cwd"),
|
|
546
|
-
prompt: readString(value, source, "prompt"),
|
|
547
|
-
tags: readStringArray(value, source, "tags"),
|
|
548
|
-
pass: readBoolean(value, source, "pass"),
|
|
549
|
-
exitCode: readNumber(value, source, "exitCode"),
|
|
550
|
-
tokens: readNumber(value, source, "tokens"),
|
|
551
|
-
costUsd: readNumber(value, source, "costUsd"),
|
|
552
|
-
wallTimeMs: readNumber(value, source, "wallTimeMs"),
|
|
553
|
-
harness: value.harness === void 0 ? evalHarnessMetricsFromCommands(commands) : parseHarnessMetrics(value.harness, `${source}.harness`),
|
|
554
|
-
commands
|
|
555
|
-
};
|
|
556
|
-
if (failureClass !== void 0) record.failureClass = failureClass;
|
|
557
|
-
const receiptPath = readOptionalString(value, source, "receiptPath");
|
|
558
|
-
if (receiptPath !== void 0) record.receiptPath = receiptPath;
|
|
559
|
-
const evidenceId = readOptionalString(value, source, "evidenceId");
|
|
560
|
-
if (evidenceId !== void 0) record.evidenceId = evidenceId;
|
|
561
|
-
const paths = value.paths === void 0 ? void 0 : parseRunPaths(value.paths, `${source}.paths`);
|
|
562
|
-
if (paths !== void 0) record.paths = paths;
|
|
563
|
-
return record;
|
|
564
|
-
}
|
|
565
|
-
function parseClioProvenance(value, source) {
|
|
566
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
567
|
-
return {
|
|
568
|
-
version: readString(value, source, "version"),
|
|
569
|
-
commit: readNullableString(value, source, "commit"),
|
|
570
|
-
entry: readString(value, source, "entry")
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
function parseEnvironmentProvenance(value, source) {
|
|
574
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
575
|
-
return {
|
|
576
|
-
platform: readString(value, source, "platform"),
|
|
577
|
-
node: readString(value, source, "node")
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
function parseArtifactPaths(value, source) {
|
|
581
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
582
|
-
const out = {
|
|
583
|
-
taskFile: readString(value, source, "taskFile"),
|
|
584
|
-
receipts: readStringArray(value, source, "receipts"),
|
|
585
|
-
sessionLedgers: readStringArray(value, source, "sessionLedgers")
|
|
586
|
-
};
|
|
587
|
-
const artifact = readOptionalString(value, source, "artifact");
|
|
588
|
-
if (artifact !== void 0) out.artifact = artifact;
|
|
589
|
-
const evidence = readOptionalString(value, source, "evidence");
|
|
590
|
-
if (evidence !== void 0) out.evidence = evidence;
|
|
591
|
-
return out;
|
|
592
|
-
}
|
|
593
|
-
function parseRunPaths(value, source) {
|
|
594
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
595
|
-
const out = {};
|
|
596
|
-
const receipt = readOptionalString(value, source, "receipt");
|
|
597
|
-
if (receipt !== void 0) out.receipt = receipt;
|
|
598
|
-
const sessionLedger = readOptionalString(value, source, "sessionLedger");
|
|
599
|
-
if (sessionLedger !== void 0) out.sessionLedger = sessionLedger;
|
|
600
|
-
const evidence = readOptionalString(value, source, "evidence");
|
|
601
|
-
if (evidence !== void 0) out.evidence = evidence;
|
|
602
|
-
return out;
|
|
603
|
-
}
|
|
604
|
-
function readRequiredArtifactField(record, source, field) {
|
|
605
|
-
const value = record[field];
|
|
606
|
-
if (value === void 0) {
|
|
607
|
-
throw new Error(
|
|
608
|
-
`eval artifact has an invalid schema: missing required field '${field}' in ${source}. Re-run the evaluation suite to generate a complete artifact.`
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
return value;
|
|
612
|
-
}
|
|
613
|
-
function parseHarnessMetrics(value, source) {
|
|
614
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
615
|
-
return {
|
|
616
|
-
receiptCount: readNumber(value, source, "receiptCount"),
|
|
617
|
-
toolCalls: readNumber(value, source, "toolCalls"),
|
|
618
|
-
retries: readNumber(value, source, "retries"),
|
|
619
|
-
safetyBlocks: readNumber(value, source, "safetyBlocks"),
|
|
620
|
-
correctionLatencyMs: readNumber(value, source, "correctionLatencyMs"),
|
|
621
|
-
validationEvidence: readNumber(value, source, "validationEvidence")
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
function parseCommand(value, source) {
|
|
625
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
626
|
-
const phase = readString(value, source, "phase");
|
|
627
|
-
if (phase !== "setup" && phase !== "verifier") throw new Error(`${source}.phase: expected setup or verifier`);
|
|
628
|
-
return {
|
|
629
|
-
phase,
|
|
630
|
-
index: readNumber(value, source, "index"),
|
|
631
|
-
command: readString(value, source, "command"),
|
|
632
|
-
exitCode: readNumber(value, source, "exitCode"),
|
|
633
|
-
signal: readSignal(value.signal, `${source}.signal`),
|
|
634
|
-
timedOut: readBoolean(value, source, "timedOut"),
|
|
635
|
-
wallTimeMs: readNumber(value, source, "wallTimeMs"),
|
|
636
|
-
stdout: readStringAllowEmpty(value, source, "stdout"),
|
|
637
|
-
stderr: readStringAllowEmpty(value, source, "stderr")
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
function readSignal(value, source) {
|
|
641
|
-
if (value === null) return null;
|
|
642
|
-
if (typeof value === "string" && NODE_SIGNALS.has(value)) return value;
|
|
643
|
-
throw new Error(`${source}: expected signal or null`);
|
|
644
|
-
}
|
|
645
|
-
function parseFailureClassCount(value, source) {
|
|
646
|
-
if (!isRecord(value)) throw new Error(`${source}: expected object`);
|
|
647
|
-
return {
|
|
648
|
-
failureClass: readFailureClass(value, source, "failureClass"),
|
|
649
|
-
count: readNumber(value, source, "count")
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
function readFailureClass(record, source, field) {
|
|
653
|
-
const value = record[field];
|
|
654
|
-
if (value === "setup_failed" || value === "verifier_failed" || value === "timeout" || value === "cwd_missing" || value === "command_error") {
|
|
655
|
-
return value;
|
|
656
|
-
}
|
|
657
|
-
throw new Error(`${source}.${field}: expected failure class`);
|
|
658
|
-
}
|
|
659
|
-
function readOptionalFailureClass(record, source, field) {
|
|
660
|
-
if (record[field] === void 0) return void 0;
|
|
661
|
-
return readFailureClass(record, source, field);
|
|
662
|
-
}
|
|
663
|
-
function readString(record, source, field) {
|
|
664
|
-
const value = record[field];
|
|
665
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string`);
|
|
666
|
-
return value;
|
|
667
|
-
}
|
|
668
|
-
function readStringAllowEmpty(record, source, field) {
|
|
669
|
-
const value = record[field];
|
|
670
|
-
if (typeof value !== "string") throw new Error(`${source}.${field}: expected string`);
|
|
671
|
-
return value;
|
|
672
|
-
}
|
|
673
|
-
function readOptionalString(record, source, field) {
|
|
674
|
-
const value = record[field];
|
|
675
|
-
if (value === void 0) return void 0;
|
|
676
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string`);
|
|
677
|
-
return value;
|
|
678
|
-
}
|
|
679
|
-
function readNullableString(record, source, field) {
|
|
680
|
-
const value = record[field];
|
|
681
|
-
if (value === null) return null;
|
|
682
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string or null`);
|
|
683
|
-
return value;
|
|
684
|
-
}
|
|
685
|
-
function readOptionalNullableString(record, source, field) {
|
|
686
|
-
const value = record[field];
|
|
687
|
-
if (value === void 0 || value === null) return null;
|
|
688
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string or null`);
|
|
689
|
-
return value;
|
|
690
|
-
}
|
|
691
|
-
function readStringArray(record, source, field) {
|
|
692
|
-
const value = readArray(record, source, field);
|
|
693
|
-
const out = [];
|
|
694
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
695
|
-
const entry = value[index];
|
|
696
|
-
if (typeof entry !== "string") throw new Error(`${source}.${field}[${index}]: expected string`);
|
|
697
|
-
out.push(entry);
|
|
698
|
-
}
|
|
699
|
-
return out;
|
|
700
|
-
}
|
|
701
|
-
function readNumber(record, source, field) {
|
|
702
|
-
const value = record[field];
|
|
703
|
-
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${source}.${field}: expected number`);
|
|
704
|
-
return value;
|
|
705
|
-
}
|
|
706
|
-
function readBoolean(record, source, field) {
|
|
707
|
-
const value = record[field];
|
|
708
|
-
if (typeof value !== "boolean") throw new Error(`${source}.${field}: expected boolean`);
|
|
709
|
-
return value;
|
|
710
|
-
}
|
|
711
|
-
function readArray(record, source, field) {
|
|
712
|
-
const value = record[field];
|
|
713
|
-
if (!Array.isArray(value)) throw new Error(`${source}.${field}: expected array`);
|
|
714
|
-
return value;
|
|
715
|
-
}
|
|
716
|
-
function parseJson(raw, source) {
|
|
717
|
-
try {
|
|
718
|
-
return JSON.parse(raw);
|
|
719
|
-
} catch (error) {
|
|
720
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
721
|
-
throw new Error(`${source}: invalid JSON: ${message}`);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
function isRecord(value) {
|
|
725
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
726
|
-
}
|
|
727
|
-
function isErrorWithCode(error) {
|
|
728
|
-
return error instanceof Error && "code" in error && typeof error.code === "string";
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
// src/domains/eval/artifacts/store.ts
|
|
732
|
-
init_esm_shims();
|
|
733
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
734
|
-
import { join as join2 } from "node:path";
|
|
735
|
-
function evalArtifactPathV4(dataDir, evalId) {
|
|
736
|
-
assertSafeId(evalId, "eval");
|
|
737
|
-
return join2(evalRoot(dataDir), `${evalId}.json`);
|
|
738
|
-
}
|
|
739
|
-
async function writeEvalArtifactV4(dataDir, artifact, out) {
|
|
740
|
-
const path = out === void 0 ? evalArtifactPathV4(dataDir, artifact.evalId) : out.endsWith(".json") ? out : join2(out, `${artifact.evalId}.json`);
|
|
741
|
-
safeResourceWrite(path, `${JSON.stringify(redactArtifactForStorage(artifact), null, 2)}
|
|
742
|
-
`, { encoding: "utf8" });
|
|
743
|
-
return path;
|
|
744
|
-
}
|
|
745
|
-
async function loadEvalArtifactV4(dataDir, evalId) {
|
|
746
|
-
let raw;
|
|
747
|
-
try {
|
|
748
|
-
raw = await readFile2(evalArtifactPathV4(dataDir, evalId), "utf8");
|
|
749
|
-
} catch (error) {
|
|
750
|
-
if (error.code === "ENOENT") throw new Error(`eval artifact not found: ${evalId}`);
|
|
751
|
-
throw error;
|
|
752
|
-
}
|
|
753
|
-
return parseEvalArtifactV4(JSON.parse(raw), evalId);
|
|
754
|
-
}
|
|
755
|
-
function parseEvalArtifactV4(value, source) {
|
|
756
|
-
if (!isRecord2(value)) throw new Error(`${source}: expected object`);
|
|
757
|
-
if (value.version !== 4) throw new Error(`${source}.version: expected current version 4`);
|
|
758
|
-
const summary = asRecord(value.summary, `${source}.summary`);
|
|
759
|
-
const matrix = asRecord(value.matrix, `${source}.matrix`);
|
|
760
|
-
const suite = asRecord(value.suite, `${source}.suite`);
|
|
761
|
-
return {
|
|
762
|
-
version: 4,
|
|
763
|
-
evalId: readString2(value, source, "evalId"),
|
|
764
|
-
suite: { id: readString2(suite, `${source}.suite`, "id"), hash: readString2(suite, `${source}.suite`, "hash") },
|
|
765
|
-
clio: {
|
|
766
|
-
version: readString2(asRecord(value.clio, `${source}.clio`), `${source}.clio`, "version"),
|
|
767
|
-
commit: readNullableString2(asRecord(value.clio, `${source}.clio`), `${source}.clio`, "commit"),
|
|
768
|
-
entry: readString2(asRecord(value.clio, `${source}.clio`), `${source}.clio`, "entry")
|
|
769
|
-
},
|
|
770
|
-
environment: {
|
|
771
|
-
platform: readString2(asRecord(value.environment, `${source}.environment`), `${source}.environment`, "platform"),
|
|
772
|
-
node: readString2(asRecord(value.environment, `${source}.environment`), `${source}.environment`, "node")
|
|
773
|
-
},
|
|
774
|
-
matrix: {
|
|
775
|
-
target: readString2(matrix, `${source}.matrix`, "target"),
|
|
776
|
-
model: readNullableString2(matrix, `${source}.matrix`, "model"),
|
|
777
|
-
thinking: readNullableString2(matrix, `${source}.matrix`, "thinking")
|
|
778
|
-
},
|
|
779
|
-
summary: {
|
|
780
|
-
runs: readNumber2(summary, `${source}.summary`, "runs"),
|
|
781
|
-
passed: readNumber2(summary, `${source}.summary`, "passed"),
|
|
782
|
-
failed: readNumber2(summary, `${source}.summary`, "failed"),
|
|
783
|
-
passRate: readNumber2(summary, `${source}.summary`, "passRate"),
|
|
784
|
-
tokens: parseTokenAccounting(summary.tokens, `${source}.summary.tokens`),
|
|
785
|
-
wallTimeMs: readNumber2(summary, `${source}.summary`, "wallTimeMs")
|
|
786
|
-
},
|
|
787
|
-
results: readArray2(value, source, "results").map((entry, index) => parseResult(entry, `${source}.results[${index}]`))
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
function parseTokenAccounting(value, source) {
|
|
791
|
-
const record = asRecord(value, source);
|
|
792
|
-
const measured = readBoolean2(record, source, "measured");
|
|
793
|
-
const runs = readNumber2(record, source, "runs");
|
|
794
|
-
const measuredRuns = readNumber2(record, source, "measuredRuns");
|
|
795
|
-
const countFields = ["input", "output", "total", "cacheRead", "cacheWrite"];
|
|
796
|
-
if (!measured) {
|
|
797
|
-
if (measuredRuns !== 0) throw new Error(`${source}.measuredRuns: expected 0 when unmeasured`);
|
|
798
|
-
const present = countFields.filter((field) => field in record);
|
|
799
|
-
if (present.length > 0) throw new Error(`${source}: unmeasured accounting carries no counts (${present.join(", ")})`);
|
|
800
|
-
return { measured: false, runs, measuredRuns: 0 };
|
|
801
|
-
}
|
|
802
|
-
if (measuredRuns <= 0) throw new Error(`${source}.measuredRuns: expected a positive count when measured`);
|
|
803
|
-
return {
|
|
804
|
-
measured: true,
|
|
805
|
-
runs,
|
|
806
|
-
measuredRuns,
|
|
807
|
-
input: readNumber2(record, source, "input"),
|
|
808
|
-
output: readNumber2(record, source, "output"),
|
|
809
|
-
total: readNumber2(record, source, "total"),
|
|
810
|
-
cacheRead: readNumber2(record, source, "cacheRead"),
|
|
811
|
-
cacheWrite: readNumber2(record, source, "cacheWrite")
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
function parseResult(value, source) {
|
|
815
|
-
const record = asRecord(value, source);
|
|
816
|
-
const target = asRecord(record.target, `${source}.target`);
|
|
817
|
-
return {
|
|
818
|
-
assignmentId: readNullableString2(record, source, "assignmentId"),
|
|
819
|
-
terminalReceiptDigest: readNullableDigest(record, source, "terminalReceiptDigest"),
|
|
820
|
-
taskId: readString2(record, source, "taskId"),
|
|
821
|
-
repeatIndex: readNumber2(record, source, "repeatIndex"),
|
|
822
|
-
target: {
|
|
823
|
-
id: readString2(target, `${source}.target`, "id"),
|
|
824
|
-
model: readNullableString2(target, `${source}.target`, "model"),
|
|
825
|
-
thinking: readNullableString2(target, `${source}.target`, "thinking")
|
|
826
|
-
},
|
|
827
|
-
pass: readBoolean2(record, source, "pass"),
|
|
828
|
-
failureClass: readNullableString2(record, source, "failureClass"),
|
|
829
|
-
metrics: asRecord(record.metrics, `${source}.metrics`),
|
|
830
|
-
artifacts: asRecord(record.artifacts, `${source}.artifacts`)
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
function asRecord(value, source) {
|
|
834
|
-
if (isRecord2(value)) return value;
|
|
835
|
-
throw new Error(`${source}: expected object`);
|
|
836
|
-
}
|
|
837
|
-
function isRecord2(value) {
|
|
838
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
839
|
-
}
|
|
840
|
-
function readString2(record, source, field) {
|
|
841
|
-
const value = record[field];
|
|
842
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string`);
|
|
843
|
-
return value;
|
|
844
|
-
}
|
|
845
|
-
function readNullableString2(record, source, field) {
|
|
846
|
-
const value = record[field];
|
|
847
|
-
if (value === null) return null;
|
|
848
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${source}.${field}: expected string or null`);
|
|
849
|
-
return value;
|
|
850
|
-
}
|
|
851
|
-
function readNullableDigest(record, source, field) {
|
|
852
|
-
const value = readNullableString2(record, source, field);
|
|
853
|
-
if (value !== null && !/^[0-9a-f]{64}$/u.test(value))
|
|
854
|
-
throw new Error(`${source}.${field}: expected sha256 digest or null`);
|
|
855
|
-
return value;
|
|
856
|
-
}
|
|
857
|
-
function readNumber2(record, source, field) {
|
|
858
|
-
const value = record[field];
|
|
859
|
-
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${source}.${field}: expected number`);
|
|
860
|
-
return value;
|
|
861
|
-
}
|
|
862
|
-
function readBoolean2(record, source, field) {
|
|
863
|
-
const value = record[field];
|
|
864
|
-
if (typeof value !== "boolean") throw new Error(`${source}.${field}: expected boolean`);
|
|
865
|
-
return value;
|
|
866
|
-
}
|
|
867
|
-
function readArray2(record, source, field) {
|
|
868
|
-
const value = record[field];
|
|
869
|
-
if (!Array.isArray(value)) throw new Error(`${source}.${field}: expected array`);
|
|
870
|
-
return value;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
339
|
// src/domains/evidence/trust-status.ts
|
|
874
340
|
init_esm_shims();
|
|
875
341
|
var TRUST_STATUS_VERSION = 1;
|
|
@@ -953,7 +419,7 @@ var ARTIFACT_KINDS = /* @__PURE__ */ new Set([
|
|
|
953
419
|
"evidence_bundle",
|
|
954
420
|
"session_entry"
|
|
955
421
|
]);
|
|
956
|
-
function
|
|
422
|
+
function isRecord(value) {
|
|
957
423
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
958
424
|
}
|
|
959
425
|
function hasExactKeys(value, keys) {
|
|
@@ -976,7 +442,7 @@ function compareArtifactReferences(left, right) {
|
|
|
976
442
|
return leftKey < rightKey ? -1 : leftKey > rightKey ? 1 : 0;
|
|
977
443
|
}
|
|
978
444
|
function normalizeArtifactReference(value, path) {
|
|
979
|
-
if (!
|
|
445
|
+
if (!isRecord(value)) throw new Error(`${path} must be an object`);
|
|
980
446
|
if (!hasExactKeys(value, value.digest === void 0 ? ["kind", "id"] : ["kind", "id", "digest"])) {
|
|
981
447
|
throw new Error(`${path} has unknown or missing fields`);
|
|
982
448
|
}
|
|
@@ -986,7 +452,7 @@ function normalizeArtifactReference(value, path) {
|
|
|
986
452
|
if (!isTrustStatusIdentifier(value.id)) throw new Error(`${path}.id is invalid`);
|
|
987
453
|
const reference = { kind: value.kind, id: value.id };
|
|
988
454
|
if (value.digest !== void 0) {
|
|
989
|
-
if (!
|
|
455
|
+
if (!isRecord(value.digest) || !hasExactKeys(value.digest, ["algorithm", "value"]) || value.digest.algorithm !== "sha256" || typeof value.digest.value !== "string" || !/^[a-f0-9]{64}$/u.test(value.digest.value)) {
|
|
990
456
|
throw new Error(`${path}.digest is invalid`);
|
|
991
457
|
}
|
|
992
458
|
reference.digest = { algorithm: "sha256", value: value.digest.value };
|
|
@@ -997,13 +463,13 @@ function normalizeAttributedStatus(axis, value) {
|
|
|
997
463
|
if (!hasExactKeys(value, ["state", "source", "authority", "artifacts"])) {
|
|
998
464
|
throw new Error(`${axis} has unknown or missing fields`);
|
|
999
465
|
}
|
|
1000
|
-
if (!
|
|
466
|
+
if (!isRecord(value.source) || !hasExactKeys(value.source, ["kind", "id"])) {
|
|
1001
467
|
throw new Error(`${axis}.source is invalid`);
|
|
1002
468
|
}
|
|
1003
469
|
if (typeof value.source.kind !== "string" || !SOURCE_KINDS.has(value.source.kind) || !AXIS_SOURCES[axis].has(value.source.kind) || !isTrustStatusIdentifier(value.source.id)) {
|
|
1004
470
|
throw new Error(`${axis}.source is invalid`);
|
|
1005
471
|
}
|
|
1006
|
-
if (!
|
|
472
|
+
if (!isRecord(value.authority) || !hasExactKeys(value.authority, ["kind", "id"])) {
|
|
1007
473
|
throw new Error(`${axis}.authority is invalid`);
|
|
1008
474
|
}
|
|
1009
475
|
if (typeof value.authority.kind !== "string" || !AUTHORITY_KINDS.has(value.authority.kind) || !SOURCE_AUTHORITIES[value.source.kind].has(
|
|
@@ -1037,7 +503,7 @@ function normalizeAttributedStatus(axis, value) {
|
|
|
1037
503
|
};
|
|
1038
504
|
}
|
|
1039
505
|
function normalizeAxis(axis, value) {
|
|
1040
|
-
if (!
|
|
506
|
+
if (!isRecord(value) || typeof value.state !== "string" || !AXIS_STATES[axis].has(value.state)) {
|
|
1041
507
|
throw new Error(`${axis}.state is invalid`);
|
|
1042
508
|
}
|
|
1043
509
|
if (value.state === "absent") {
|
|
@@ -1049,7 +515,7 @@ function normalizeAxis(axis, value) {
|
|
|
1049
515
|
return normalizeAttributedStatus(axis, value);
|
|
1050
516
|
}
|
|
1051
517
|
function normalizeTrustStatus(value) {
|
|
1052
|
-
if (!
|
|
518
|
+
if (!isRecord(value) || !hasExactKeys(value, ["version", ...TRUST_STATUS_AXES])) {
|
|
1053
519
|
throw new Error("trust status has unknown or missing fields");
|
|
1054
520
|
}
|
|
1055
521
|
if (value.version !== TRUST_STATUS_VERSION) throw new Error("trust status version is invalid");
|
|
@@ -1107,7 +573,7 @@ function compatibilitySource(receipt, field) {
|
|
|
1107
573
|
var DISPATCH_AUTHORITY = { kind: "clio", id: "dispatch" };
|
|
1108
574
|
var COMPATIBILITY_AUTHORITY = { kind: "unknown", id: "historical-persisted-format" };
|
|
1109
575
|
function retiredReceiptIntegrity(integrity) {
|
|
1110
|
-
if (!
|
|
576
|
+
if (!isRecord(integrity)) return null;
|
|
1111
577
|
const version = integrity.version;
|
|
1112
578
|
if (typeof version !== "number" || !Number.isInteger(version) || version < 1) return null;
|
|
1113
579
|
if (version >= RUN_RECEIPT_INTEGRITY_VERSION) return null;
|
|
@@ -1416,20 +882,6 @@ function adaptGroundedEvidenceValidationStatus(input) {
|
|
|
1416
882
|
uniqueBoundedReferences([{ kind: "evidence_bundle", id: input.evidenceId }, ...observed])
|
|
1417
883
|
);
|
|
1418
884
|
}
|
|
1419
|
-
function adaptFinishContractCompletionStatus(assessment, options = {}) {
|
|
1420
|
-
const artifacts = uniqueBoundedReferences(
|
|
1421
|
-
options.artifacts ?? assessment.evidence.map((evidence, index) => ({
|
|
1422
|
-
kind: evidence.turnId === void 0 ? "finish_contract_evidence" : "session_entry",
|
|
1423
|
-
id: evidence.turnId ?? `${evidence.kind}:${index + 1}`
|
|
1424
|
-
}))
|
|
1425
|
-
);
|
|
1426
|
-
const source = { kind: "finish_contract", id: options.sourceId ?? assessment.reason };
|
|
1427
|
-
const authority = { kind: "clio", id: "finish-contract" };
|
|
1428
|
-
if (assessment.reason === "no_mutation") return attributed("not_applicable", source, authority, artifacts);
|
|
1429
|
-
if (assessment.reason === "validation_evidence") return attributed("evidenced", source, authority, artifacts);
|
|
1430
|
-
if (assessment.reason === "explicit_limitation") return attributed("limited", source, authority, artifacts);
|
|
1431
|
-
return attributed("incomplete", source, authority, artifacts);
|
|
1432
|
-
}
|
|
1433
885
|
function uniqueBoundedReferences(references) {
|
|
1434
886
|
const sorted = [...references].sort(compareArtifactReferences);
|
|
1435
887
|
const unique = sorted.filter(
|
|
@@ -1438,6 +890,151 @@ function uniqueBoundedReferences(references) {
|
|
|
1438
890
|
return unique.slice(0, TRUST_STATUS_MAX_ARTIFACT_REFERENCES);
|
|
1439
891
|
}
|
|
1440
892
|
|
|
893
|
+
// src/domains/evidence/trust-projection.ts
|
|
894
|
+
init_esm_shims();
|
|
895
|
+
var TRUST_SUMMARY_VERSION = 1;
|
|
896
|
+
var TRUST_SUMMARY_MAX_REFS = 8;
|
|
897
|
+
var TRUST_STATE_WORDS = {
|
|
898
|
+
artifactIntegrity: {
|
|
899
|
+
verified: "sealed",
|
|
900
|
+
failed: "seal broken",
|
|
901
|
+
absent: "no receipt",
|
|
902
|
+
unknown: "seal unchecked",
|
|
903
|
+
not_applicable: "seal not applicable"
|
|
904
|
+
},
|
|
905
|
+
validationGrounding: {
|
|
906
|
+
validated: "grounded",
|
|
907
|
+
failed: "validation failed",
|
|
908
|
+
ungrounded: "inferred: validation claimed, none observed",
|
|
909
|
+
absent: "no validation observed",
|
|
910
|
+
unknown: "validation unknown",
|
|
911
|
+
not_applicable: "validation not applicable"
|
|
912
|
+
},
|
|
913
|
+
independentReview: {
|
|
914
|
+
passed: "independently reviewed: pass",
|
|
915
|
+
failed: "independently reviewed: fail",
|
|
916
|
+
inconclusive: "independent review inconclusive",
|
|
917
|
+
not_independent: "review not independent",
|
|
918
|
+
absent: "not independently reviewed",
|
|
919
|
+
unknown: "independent review unknown",
|
|
920
|
+
not_applicable: "independent review not applicable"
|
|
921
|
+
},
|
|
922
|
+
contextProvenance: {
|
|
923
|
+
recorded: "context recorded",
|
|
924
|
+
invalid: "context record invalid",
|
|
925
|
+
absent: "context not recorded",
|
|
926
|
+
unknown: "context unknown",
|
|
927
|
+
not_applicable: "context not applicable"
|
|
928
|
+
},
|
|
929
|
+
autonomyEnforcement: {
|
|
930
|
+
enforced: "mediated",
|
|
931
|
+
approximated: "approximated",
|
|
932
|
+
bypassed: "bypassed",
|
|
933
|
+
absent: "autonomy not recorded",
|
|
934
|
+
unknown: "autonomy unknown",
|
|
935
|
+
not_applicable: "autonomy not applicable"
|
|
936
|
+
},
|
|
937
|
+
completionEvidence: {
|
|
938
|
+
evidenced: "completion evidenced",
|
|
939
|
+
incomplete: "completion unevidenced",
|
|
940
|
+
limited: "completion limited",
|
|
941
|
+
absent: "completion not recorded",
|
|
942
|
+
unknown: "completion unknown",
|
|
943
|
+
not_applicable: "completion not applicable"
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
function trustStateWord(axis, state) {
|
|
947
|
+
const words = TRUST_STATE_WORDS[axis];
|
|
948
|
+
return words[state] ?? words.unknown ?? "unknown";
|
|
949
|
+
}
|
|
950
|
+
function authorityOf(status, axis) {
|
|
951
|
+
const entry = status[axis];
|
|
952
|
+
return entry.state === "absent" ? null : `${entry.authority.kind}:${entry.authority.id}`;
|
|
953
|
+
}
|
|
954
|
+
function integrityClause(status) {
|
|
955
|
+
const retired = retiredIntegrityVersionOf(status.artifactIntegrity);
|
|
956
|
+
if (retired !== null) return `seal v${retired} retired (this build verifies v${RUN_RECEIPT_INTEGRITY_VERSION})`;
|
|
957
|
+
return trustStateWord("artifactIntegrity", status.artifactIntegrity.state);
|
|
958
|
+
}
|
|
959
|
+
function validationClause(status) {
|
|
960
|
+
const entry = status.validationGrounding;
|
|
961
|
+
const word = trustStateWord("validationGrounding", entry.state);
|
|
962
|
+
if (entry.state === "absent") return word;
|
|
963
|
+
if (entry.state === "validated" || entry.state === "failed") return `${word} by ${entry.authority.id}`;
|
|
964
|
+
if (entry.state === "unknown" && entry.authority.kind !== "unknown") return `${word} (${entry.authority.id})`;
|
|
965
|
+
return word;
|
|
966
|
+
}
|
|
967
|
+
function autonomyClause(status) {
|
|
968
|
+
const entry = status.autonomyEnforcement;
|
|
969
|
+
const word = trustStateWord("autonomyEnforcement", entry.state);
|
|
970
|
+
if (entry.state !== "approximated" && entry.state !== "bypassed") return word;
|
|
971
|
+
return `${word} (${entry.authority.id})`;
|
|
972
|
+
}
|
|
973
|
+
function formatTrustSummary(status) {
|
|
974
|
+
return [
|
|
975
|
+
integrityClause(status),
|
|
976
|
+
validationClause(status),
|
|
977
|
+
trustStateWord("independentReview", status.independentReview.state),
|
|
978
|
+
autonomyClause(status),
|
|
979
|
+
trustStateWord("contextProvenance", status.contextProvenance.state),
|
|
980
|
+
trustStateWord("completionEvidence", status.completionEvidence.state)
|
|
981
|
+
].join("; ");
|
|
982
|
+
}
|
|
983
|
+
function formatTrustSummaryLine(status) {
|
|
984
|
+
return `trust v${TRUST_SUMMARY_VERSION}: ${trustVerdict(status)}; ${formatTrustSummary(status)}`;
|
|
985
|
+
}
|
|
986
|
+
function formatTrustAxes(status) {
|
|
987
|
+
return [`trust_status=v${status.version}`, ...TRUST_STATUS_AXES.map((axis) => `${axis}:${status[axis].state}`)].join(
|
|
988
|
+
" "
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
function isUnanswered(status, axis) {
|
|
992
|
+
const state = status[axis].state;
|
|
993
|
+
return state === "absent" || state === "unknown";
|
|
994
|
+
}
|
|
995
|
+
function trustVerdict(status) {
|
|
996
|
+
const integrity = status.artifactIntegrity.state;
|
|
997
|
+
const validation = status.validationGrounding.state;
|
|
998
|
+
const review = status.independentReview.state;
|
|
999
|
+
const autonomy = status.autonomyEnforcement.state;
|
|
1000
|
+
if (integrity === "failed" || autonomy === "bypassed" || validation === "failed" || validation === "ungrounded" || review === "failed" || review === "not_independent" || status.contextProvenance.state === "invalid") {
|
|
1001
|
+
return "compromised";
|
|
1002
|
+
}
|
|
1003
|
+
if (integrity !== "verified") return "unknown";
|
|
1004
|
+
if (review === "passed") return "reviewed";
|
|
1005
|
+
if (validation === "validated") return "grounded";
|
|
1006
|
+
return "unverified";
|
|
1007
|
+
}
|
|
1008
|
+
function claimantOf(status) {
|
|
1009
|
+
const state = status.validationGrounding.state;
|
|
1010
|
+
if (state === "absent" || state === "ungrounded") return "worker";
|
|
1011
|
+
return authorityOf(status, "validationGrounding") ?? "worker";
|
|
1012
|
+
}
|
|
1013
|
+
function referenceKey(reference) {
|
|
1014
|
+
return `${reference.kind}:${reference.id}`;
|
|
1015
|
+
}
|
|
1016
|
+
function trustSummaryReferences(status) {
|
|
1017
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1018
|
+
for (const axis of TRUST_STATUS_AXES) {
|
|
1019
|
+
const entry = status[axis];
|
|
1020
|
+
if (entry.state === "absent") continue;
|
|
1021
|
+
for (const reference of entry.artifacts) keys.add(referenceKey(reference));
|
|
1022
|
+
}
|
|
1023
|
+
return [...keys].sort().slice(0, TRUST_SUMMARY_MAX_REFS);
|
|
1024
|
+
}
|
|
1025
|
+
function summarizeTrustStatus(status) {
|
|
1026
|
+
const axes = Object.fromEntries(TRUST_STATUS_AXES.map((axis) => [axis, status[axis].state]));
|
|
1027
|
+
return {
|
|
1028
|
+
version: TRUST_SUMMARY_VERSION,
|
|
1029
|
+
verdict: trustVerdict(status),
|
|
1030
|
+
text: formatTrustSummary(status),
|
|
1031
|
+
axes,
|
|
1032
|
+
claimant: claimantOf(status),
|
|
1033
|
+
unknown: TRUST_STATUS_AXES.filter((axis) => isUnanswered(status, axis)),
|
|
1034
|
+
refs: trustSummaryReferences(status)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1441
1038
|
// src/domains/eval/provenance.ts
|
|
1442
1039
|
init_esm_shims();
|
|
1443
1040
|
import { spawnSync } from "node:child_process";
|
|
@@ -1454,6 +1051,33 @@ function evalEnvironmentProvenance() {
|
|
|
1454
1051
|
node: process.version
|
|
1455
1052
|
};
|
|
1456
1053
|
}
|
|
1054
|
+
async function evalServingConfiguration(targets, observations) {
|
|
1055
|
+
const targetId = targets.length === 1 ? targets[0]?.id ?? "unknown" : "multiple";
|
|
1056
|
+
const configured = configuredTarget(targetId);
|
|
1057
|
+
const target = targets.length === 1 ? targets[0] : void 0;
|
|
1058
|
+
const runtimeId = consensus(observations.map((entry) => entry.runtimeId)) ?? configured?.runtime ?? null;
|
|
1059
|
+
const modelId = consensus(observations.map((entry) => entry.modelId)) ?? target?.model ?? configured?.defaultModel ?? null;
|
|
1060
|
+
const props = configured?.url === void 0 ? null : await readServingProps(configured.url, modelId);
|
|
1061
|
+
return {
|
|
1062
|
+
targetId,
|
|
1063
|
+
runtimeId,
|
|
1064
|
+
modelId,
|
|
1065
|
+
serverBuild: props?.serverBuild ?? null,
|
|
1066
|
+
total_slots: props?.totalSlots ?? null,
|
|
1067
|
+
thinkingLevel: consensus(observations.map((entry) => entry.thinkingLevel)) ?? target?.thinking ?? null,
|
|
1068
|
+
compiledPromptHash: consensus(observations.map((entry) => entry.compiledPromptHash))
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
function evalServingObservationFrom(target, receipt, compiledPromptHashes) {
|
|
1072
|
+
const compiledPromptHash = receipt?.staticCompositionHash ?? receipt?.compiledPromptHash ?? consensus(compiledPromptHashes);
|
|
1073
|
+
return {
|
|
1074
|
+
targetId: receipt?.targetId ?? target.id,
|
|
1075
|
+
runtimeId: receipt?.runtimeId ?? null,
|
|
1076
|
+
modelId: receipt?.wireModelId ?? target.model ?? null,
|
|
1077
|
+
thinkingLevel: receipt?.runtimeResolution?.effectiveThinkingLevel ?? target.thinking ?? null,
|
|
1078
|
+
compiledPromptHash
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1457
1081
|
function currentClioCommit() {
|
|
1458
1082
|
const result = spawnSync("git", ["rev-parse", "HEAD"], {
|
|
1459
1083
|
cwd: resolvePackageRoot(),
|
|
@@ -1465,12 +1089,63 @@ function currentClioCommit() {
|
|
|
1465
1089
|
const value = result.stdout.trim();
|
|
1466
1090
|
return value.length > 0 ? value : null;
|
|
1467
1091
|
}
|
|
1092
|
+
function configuredTarget(targetId) {
|
|
1093
|
+
try {
|
|
1094
|
+
const target = readSettings().targets.find((entry) => entry.id === targetId);
|
|
1095
|
+
if (target === void 0) return null;
|
|
1096
|
+
return {
|
|
1097
|
+
runtime: target.runtime,
|
|
1098
|
+
...target.url === void 0 ? {} : { url: target.url },
|
|
1099
|
+
...target.defaultModel === void 0 ? {} : { defaultModel: target.defaultModel }
|
|
1100
|
+
};
|
|
1101
|
+
} catch {
|
|
1102
|
+
return null;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
async function readServingProps(targetUrl, modelId) {
|
|
1106
|
+
const root = targetUrl.replace(/\/+$/u, "").replace(/\/v1$/u, "");
|
|
1107
|
+
try {
|
|
1108
|
+
const response = await fetch(`${root}/props`, { signal: AbortSignal.timeout(5e3) });
|
|
1109
|
+
if (!response.ok) return null;
|
|
1110
|
+
const value = await response.json();
|
|
1111
|
+
if (!isRecord2(value)) return null;
|
|
1112
|
+
const totalSlots = positiveInteger(value.total_slots) ?? await readServingSlots(root, modelId);
|
|
1113
|
+
return {
|
|
1114
|
+
serverBuild: typeof value.build_info === "string" && value.build_info.length > 0 ? value.build_info : null,
|
|
1115
|
+
totalSlots
|
|
1116
|
+
};
|
|
1117
|
+
} catch {
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
async function readServingSlots(root, modelId) {
|
|
1122
|
+
if (modelId === null) return null;
|
|
1123
|
+
try {
|
|
1124
|
+
const query = new URLSearchParams({ model: modelId });
|
|
1125
|
+
const response = await fetch(`${root}/slots?${query}`, { signal: AbortSignal.timeout(5e3) });
|
|
1126
|
+
if (!response.ok) return null;
|
|
1127
|
+
const value = await response.json();
|
|
1128
|
+
return Array.isArray(value) && value.length > 0 ? value.length : null;
|
|
1129
|
+
} catch {
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function consensus(values) {
|
|
1134
|
+
const known = [...new Set(values.filter((value) => typeof value === "string" && value.length > 0))];
|
|
1135
|
+
return known.length === 1 ? known[0] ?? null : null;
|
|
1136
|
+
}
|
|
1137
|
+
function positiveInteger(value) {
|
|
1138
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : null;
|
|
1139
|
+
}
|
|
1140
|
+
function isRecord2(value) {
|
|
1141
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1142
|
+
}
|
|
1468
1143
|
|
|
1469
1144
|
// src/domains/eval/task-file.ts
|
|
1470
1145
|
init_esm_shims();
|
|
1471
1146
|
var import_yaml = __toESM(require_dist(), 1);
|
|
1472
|
-
import { createHash as
|
|
1473
|
-
import { readFile
|
|
1147
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
1148
|
+
import { readFile } from "node:fs/promises";
|
|
1474
1149
|
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
1475
1150
|
|
|
1476
1151
|
// src/domains/eval/types.ts
|
|
@@ -1481,7 +1156,7 @@ var EVAL_TASK_FILE_VERSION = 1;
|
|
|
1481
1156
|
var TASK_KEYS = /* @__PURE__ */ new Set(["id", "prompt", "cwd", "setup", "verifier", "timeoutMs", "tags"]);
|
|
1482
1157
|
async function loadEvalTaskFile(path) {
|
|
1483
1158
|
const resolved = resolve(path);
|
|
1484
|
-
const raw = await
|
|
1159
|
+
const raw = await readFile(resolved, "utf8");
|
|
1485
1160
|
const result = parseEvalTaskFileYaml(raw);
|
|
1486
1161
|
if (!result.valid) {
|
|
1487
1162
|
throw new EvalTaskFileError(result.issues);
|
|
@@ -1508,7 +1183,7 @@ function parseEvalTaskFileYaml(raw) {
|
|
|
1508
1183
|
}
|
|
1509
1184
|
function validateEvalTaskFile(value) {
|
|
1510
1185
|
const issues = [];
|
|
1511
|
-
if (!
|
|
1186
|
+
if (!isRecord3(value)) {
|
|
1512
1187
|
return { valid: false, issues: [{ path: "$", message: "expected object" }] };
|
|
1513
1188
|
}
|
|
1514
1189
|
if (value.version !== EVAL_TASK_FILE_VERSION) {
|
|
@@ -1544,7 +1219,7 @@ var EvalTaskFileError = class extends Error {
|
|
|
1544
1219
|
}
|
|
1545
1220
|
};
|
|
1546
1221
|
function parseTask(value, path, issues) {
|
|
1547
|
-
if (!
|
|
1222
|
+
if (!isRecord3(value)) {
|
|
1548
1223
|
issues.push({ path, message: "expected object" });
|
|
1549
1224
|
return null;
|
|
1550
1225
|
}
|
|
@@ -1560,13 +1235,13 @@ function parseTask(value, path, issues) {
|
|
|
1560
1235
|
if (cwd !== null && isAbsolute(cwd)) {
|
|
1561
1236
|
issues.push({ path: `${path}.cwd`, message: "expected repo-local relative path" });
|
|
1562
1237
|
}
|
|
1563
|
-
const setup =
|
|
1564
|
-
const verifier =
|
|
1238
|
+
const setup = readStringArray(value, path, "setup", issues, true);
|
|
1239
|
+
const verifier = readStringArray(value, path, "verifier", issues, false);
|
|
1565
1240
|
if (verifier !== null && verifier.length === 0) {
|
|
1566
1241
|
issues.push({ path: `${path}.verifier`, message: "expected at least one command" });
|
|
1567
1242
|
}
|
|
1568
1243
|
const timeoutMs = readPositiveInteger(value, path, "timeoutMs", issues);
|
|
1569
|
-
const tags =
|
|
1244
|
+
const tags = readStringArray(value, path, "tags", issues, true);
|
|
1570
1245
|
if (id === null || prompt === null || cwd === null || setup === null || verifier === null || timeoutMs === null) {
|
|
1571
1246
|
return null;
|
|
1572
1247
|
}
|
|
@@ -1592,7 +1267,7 @@ function readNonEmptyString(record, path, field, issues) {
|
|
|
1592
1267
|
}
|
|
1593
1268
|
return value;
|
|
1594
1269
|
}
|
|
1595
|
-
function
|
|
1270
|
+
function readStringArray(record, path, field, issues, allowMissing) {
|
|
1596
1271
|
const value = record[field];
|
|
1597
1272
|
if (value === void 0 && allowMissing) return [];
|
|
1598
1273
|
if (!Array.isArray(value)) {
|
|
@@ -1618,173 +1293,90 @@ function readPositiveInteger(record, path, field, issues) {
|
|
|
1618
1293
|
}
|
|
1619
1294
|
return value;
|
|
1620
1295
|
}
|
|
1621
|
-
function
|
|
1296
|
+
function isRecord3(value) {
|
|
1622
1297
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1623
1298
|
}
|
|
1624
1299
|
function sha256Hex(content) {
|
|
1625
|
-
return
|
|
1300
|
+
return createHash2("sha256").update(content, "utf8").digest("hex");
|
|
1626
1301
|
}
|
|
1627
1302
|
|
|
1628
|
-
// src/domains/
|
|
1303
|
+
// src/domains/eval/run-compare.ts
|
|
1629
1304
|
init_esm_shims();
|
|
1630
|
-
var
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
absent: "no receipt",
|
|
1637
|
-
unknown: "seal unchecked",
|
|
1638
|
-
not_applicable: "seal not applicable"
|
|
1639
|
-
},
|
|
1640
|
-
validationGrounding: {
|
|
1641
|
-
validated: "grounded",
|
|
1642
|
-
failed: "validation failed",
|
|
1643
|
-
ungrounded: "inferred: validation claimed, none observed",
|
|
1644
|
-
absent: "no validation observed",
|
|
1645
|
-
unknown: "validation unknown",
|
|
1646
|
-
not_applicable: "validation not applicable"
|
|
1647
|
-
},
|
|
1648
|
-
independentReview: {
|
|
1649
|
-
passed: "independently reviewed: pass",
|
|
1650
|
-
failed: "independently reviewed: fail",
|
|
1651
|
-
inconclusive: "independent review inconclusive",
|
|
1652
|
-
not_independent: "review not independent",
|
|
1653
|
-
absent: "not independently reviewed",
|
|
1654
|
-
unknown: "independent review unknown",
|
|
1655
|
-
not_applicable: "independent review not applicable"
|
|
1656
|
-
},
|
|
1657
|
-
contextProvenance: {
|
|
1658
|
-
recorded: "context recorded",
|
|
1659
|
-
invalid: "context record invalid",
|
|
1660
|
-
absent: "context not recorded",
|
|
1661
|
-
unknown: "context unknown",
|
|
1662
|
-
not_applicable: "context not applicable"
|
|
1663
|
-
},
|
|
1664
|
-
autonomyEnforcement: {
|
|
1665
|
-
enforced: "mediated",
|
|
1666
|
-
approximated: "approximated",
|
|
1667
|
-
bypassed: "bypassed",
|
|
1668
|
-
absent: "autonomy not recorded",
|
|
1669
|
-
unknown: "autonomy unknown",
|
|
1670
|
-
not_applicable: "autonomy not applicable"
|
|
1671
|
-
},
|
|
1672
|
-
completionEvidence: {
|
|
1673
|
-
evidenced: "completion evidenced",
|
|
1674
|
-
incomplete: "completion unevidenced",
|
|
1675
|
-
limited: "completion limited",
|
|
1676
|
-
absent: "completion not recorded",
|
|
1677
|
-
unknown: "completion unknown",
|
|
1678
|
-
not_applicable: "completion not applicable"
|
|
1305
|
+
var EvalTrackedMetricSourceMismatchError = class extends Error {
|
|
1306
|
+
constructor(metric, baseline, candidate) {
|
|
1307
|
+
super(
|
|
1308
|
+
`tracked metric ${metric} cannot compare estimated and measured values (baseline=${baseline.join(",") || "none"}, candidate=${candidate.join(",") || "none"})`
|
|
1309
|
+
);
|
|
1310
|
+
this.name = "EvalTrackedMetricSourceMismatchError";
|
|
1679
1311
|
}
|
|
1680
1312
|
};
|
|
1681
|
-
function
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
}
|
|
1685
|
-
function authorityOf(status, axis) {
|
|
1686
|
-
const entry = status[axis];
|
|
1687
|
-
return entry.state === "absent" ? null : `${entry.authority.kind}:${entry.authority.id}`;
|
|
1688
|
-
}
|
|
1689
|
-
function integrityClause(status) {
|
|
1690
|
-
const retired = retiredIntegrityVersionOf(status.artifactIntegrity);
|
|
1691
|
-
if (retired !== null) return `seal v${retired} retired (this build verifies v${RUN_RECEIPT_INTEGRITY_VERSION})`;
|
|
1692
|
-
return trustStateWord("artifactIntegrity", status.artifactIntegrity.state);
|
|
1693
|
-
}
|
|
1694
|
-
function validationClause(status) {
|
|
1695
|
-
const entry = status.validationGrounding;
|
|
1696
|
-
const word = trustStateWord("validationGrounding", entry.state);
|
|
1697
|
-
if (entry.state === "absent") return word;
|
|
1698
|
-
if (entry.state === "validated" || entry.state === "failed") return `${word} by ${entry.authority.id}`;
|
|
1699
|
-
if (entry.state === "unknown" && entry.authority.kind !== "unknown") return `${word} (${entry.authority.id})`;
|
|
1700
|
-
return word;
|
|
1701
|
-
}
|
|
1702
|
-
function autonomyClause(status) {
|
|
1703
|
-
const entry = status.autonomyEnforcement;
|
|
1704
|
-
const word = trustStateWord("autonomyEnforcement", entry.state);
|
|
1705
|
-
if (entry.state !== "approximated" && entry.state !== "bypassed") return word;
|
|
1706
|
-
return `${word} (${entry.authority.id})`;
|
|
1313
|
+
function assertComparableTrackedMetricSources(metric, baseline, candidate) {
|
|
1314
|
+
if (baseline.includes("estimated") === candidate.includes("estimated")) return;
|
|
1315
|
+
throw new EvalTrackedMetricSourceMismatchError(metric, baseline, candidate);
|
|
1707
1316
|
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
trustStateWord("contextProvenance", status.contextProvenance.state),
|
|
1715
|
-
trustStateWord("completionEvidence", status.completionEvidence.state)
|
|
1716
|
-
].join("; ");
|
|
1717
|
-
}
|
|
1718
|
-
function formatTrustSummaryLine(status) {
|
|
1719
|
-
return `trust v${TRUST_SUMMARY_VERSION}: ${formatTrustSummary(status)}`;
|
|
1317
|
+
|
|
1318
|
+
// src/domains/prompts/hash.ts
|
|
1319
|
+
init_esm_shims();
|
|
1320
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
1321
|
+
function sha2562(input) {
|
|
1322
|
+
return createHash3("sha256").update(input, "utf8").digest("hex");
|
|
1720
1323
|
}
|
|
1721
|
-
function
|
|
1722
|
-
return
|
|
1723
|
-
" "
|
|
1724
|
-
);
|
|
1324
|
+
function canonicalJson2(value) {
|
|
1325
|
+
return serialize(value);
|
|
1725
1326
|
}
|
|
1726
|
-
function
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
const review = status.independentReview.state;
|
|
1734
|
-
const autonomy = status.autonomyEnforcement.state;
|
|
1735
|
-
if (integrity === "failed" || autonomy === "bypassed" || validation === "failed" || validation === "ungrounded" || review === "failed" || review === "not_independent" || status.contextProvenance.state === "invalid") {
|
|
1736
|
-
return "compromised";
|
|
1327
|
+
function serialize(value) {
|
|
1328
|
+
if (value === null) return "null";
|
|
1329
|
+
if (typeof value === "number") {
|
|
1330
|
+
if (!Number.isFinite(value)) {
|
|
1331
|
+
throw new Error(`canonicalJson: non-finite number ${String(value)} is not representable`);
|
|
1332
|
+
}
|
|
1333
|
+
return JSON.stringify(value);
|
|
1737
1334
|
}
|
|
1738
|
-
if (
|
|
1739
|
-
|
|
1740
|
-
if (validation === "validated") return "grounded";
|
|
1741
|
-
return "unverified";
|
|
1742
|
-
}
|
|
1743
|
-
function claimantOf(status) {
|
|
1744
|
-
const state = status.validationGrounding.state;
|
|
1745
|
-
if (state === "absent" || state === "ungrounded") return "worker";
|
|
1746
|
-
return authorityOf(status, "validationGrounding") ?? "worker";
|
|
1747
|
-
}
|
|
1748
|
-
function referenceKey(reference) {
|
|
1749
|
-
return `${reference.kind}:${reference.id}`;
|
|
1750
|
-
}
|
|
1751
|
-
function trustSummaryReferences(status) {
|
|
1752
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1753
|
-
for (const axis of TRUST_STATUS_AXES) {
|
|
1754
|
-
const entry = status[axis];
|
|
1755
|
-
if (entry.state === "absent") continue;
|
|
1756
|
-
for (const reference of entry.artifacts) keys.add(referenceKey(reference));
|
|
1335
|
+
if (typeof value === "string" || typeof value === "boolean") {
|
|
1336
|
+
return JSON.stringify(value);
|
|
1757
1337
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1338
|
+
if (typeof value === "bigint") {
|
|
1339
|
+
throw new Error("canonicalJson: bigint is not representable");
|
|
1340
|
+
}
|
|
1341
|
+
if (typeof value === "symbol" || typeof value === "function") {
|
|
1342
|
+
throw new Error(`canonicalJson: ${typeof value} is not representable`);
|
|
1343
|
+
}
|
|
1344
|
+
if (value === void 0) {
|
|
1345
|
+
throw new Error("canonicalJson: undefined is not representable at root");
|
|
1346
|
+
}
|
|
1347
|
+
if (Array.isArray(value)) {
|
|
1348
|
+
const parts = [];
|
|
1349
|
+
for (let i = 0; i < value.length; i++) {
|
|
1350
|
+
if (!(i in value) || value[i] === void 0) {
|
|
1351
|
+
parts.push("null");
|
|
1352
|
+
continue;
|
|
1353
|
+
}
|
|
1354
|
+
parts.push(serialize(value[i]));
|
|
1355
|
+
}
|
|
1356
|
+
return `[${parts.join(",")}]`;
|
|
1357
|
+
}
|
|
1358
|
+
if (typeof value === "object") {
|
|
1359
|
+
const obj = value;
|
|
1360
|
+
const keys = Object.keys(obj).sort();
|
|
1361
|
+
const parts = [];
|
|
1362
|
+
for (const key of keys) {
|
|
1363
|
+
const child = obj[key];
|
|
1364
|
+
if (child === void 0) continue;
|
|
1365
|
+
parts.push(`${JSON.stringify(key)}:${serialize(child)}`);
|
|
1366
|
+
}
|
|
1367
|
+
return `{${parts.join(",")}}`;
|
|
1368
|
+
}
|
|
1369
|
+
throw new Error(`canonicalJson: unsupported value of type ${typeof value}`);
|
|
1771
1370
|
}
|
|
1772
1371
|
|
|
1773
1372
|
export {
|
|
1373
|
+
sha2562 as sha256,
|
|
1374
|
+
canonicalJson2 as canonicalJson,
|
|
1774
1375
|
RUN_RECEIPT_INTEGRITY_VERSION,
|
|
1775
1376
|
RUN_RECEIPT_INTEGRITY_ALGORITHM,
|
|
1776
1377
|
withReceiptIntegrity,
|
|
1777
1378
|
isReceiptIntegrity,
|
|
1778
1379
|
verifyReceiptIntegrity,
|
|
1779
|
-
redactArtifactForStorage,
|
|
1780
|
-
ZERO_EVAL_HARNESS_METRICS,
|
|
1781
|
-
sumEvalHarnessMetrics,
|
|
1782
|
-
createEvalId,
|
|
1783
|
-
writeEvalArtifact,
|
|
1784
|
-
loadEvalArtifact,
|
|
1785
|
-
writeEvalArtifactV4,
|
|
1786
|
-
loadEvalArtifactV4,
|
|
1787
|
-
parseEvalArtifactV4,
|
|
1788
1380
|
TRUST_STATUS_AXES,
|
|
1789
1381
|
isTrustStatusIdentifier,
|
|
1790
1382
|
normalizeTrustStatus,
|
|
@@ -1796,14 +1388,18 @@ export {
|
|
|
1796
1388
|
inspectRunReceiptTrustStatus,
|
|
1797
1389
|
adaptGateDecisionReviewStatus,
|
|
1798
1390
|
adaptGroundedEvidenceValidationStatus,
|
|
1799
|
-
|
|
1800
|
-
evalClioProvenance,
|
|
1801
|
-
evalEnvironmentProvenance,
|
|
1802
|
-
loadEvalTaskFile,
|
|
1803
|
-
EvalTaskFileError,
|
|
1391
|
+
trustStateWord,
|
|
1804
1392
|
formatTrustSummary,
|
|
1805
1393
|
formatTrustSummaryLine,
|
|
1806
1394
|
formatTrustAxes,
|
|
1807
|
-
|
|
1395
|
+
trustVerdict,
|
|
1396
|
+
summarizeTrustStatus,
|
|
1397
|
+
evalClioProvenance,
|
|
1398
|
+
evalEnvironmentProvenance,
|
|
1399
|
+
evalServingConfiguration,
|
|
1400
|
+
evalServingObservationFrom,
|
|
1401
|
+
assertComparableTrackedMetricSources,
|
|
1402
|
+
loadEvalTaskFile,
|
|
1403
|
+
EvalTaskFileError
|
|
1808
1404
|
};
|
|
1809
|
-
//# sourceMappingURL=chunk-
|
|
1405
|
+
//# sourceMappingURL=chunk-B7OBL7PK.js.map
|