@iowarp/clio-coder 0.4.0 → 0.4.1
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 +39 -0
- package/README.md +116 -16
- package/dist/{acp-G5WJBNCT.js → acp-ZILU3AUO.js} +14 -14
- package/dist/{agents-FMV2Q5G4.js → agents-HYWGBGQR.js} +40 -29
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-3IDSJEIK.js → auth-N3QT7CBO.js} +21 -19
- package/dist/{builtins-XCZWXSC7.js → builtins-UJLMOVOV.js} +6 -6
- package/dist/{chunk-PQEFIJ36.js → chunk-2LEAKD4C.js} +1 -2
- package/dist/{chunk-3BT2XMV4.js → chunk-2NM363SV.js} +50 -57
- package/dist/{chunk-J4W7KFM7.js → chunk-2VG7KLYV.js} +24 -279
- package/dist/{chunk-SST6Z5JA.js → chunk-336NSSKI.js} +1 -1
- package/dist/{chunk-K5C3NCBD.js → chunk-3I5NY75V.js} +5 -5
- package/dist/{chunk-VAZSBTKF.js → chunk-3QSOM6PA.js} +2 -2
- package/dist/{chunk-TZ3SGWZZ.js → chunk-5QIAJV2D.js} +2 -2
- package/dist/{chunk-OQBA45DZ.js → chunk-5YHDIDBP.js} +2 -2
- package/dist/{chunk-NHLBIGRH.js → chunk-6CCS4G3W.js} +40 -17
- package/dist/{chunk-2JDWVJND.js → chunk-6DWBAZ5U.js} +2 -2
- package/dist/{chunk-LDQ2ZF2M.js → chunk-6FN3E6KX.js} +5 -5
- package/dist/{chunk-X3YGUTOB.js → chunk-6HMJX2VU.js} +59 -59
- package/dist/{chunk-VEO4AP2K.js → chunk-6I5ILFOF.js} +3 -2
- package/dist/{chunk-B7OBL7PK.js → chunk-6NJQITNH.js} +18 -11
- package/dist/{chunk-IQ7KR472.js → chunk-6VC4OV3Z.js} +6 -3
- package/dist/{chunk-P3FOHJT4.js → chunk-72GZI5EV.js} +2 -2
- package/dist/{chunk-AB44T6BB.js → chunk-74YWRRU5.js} +8 -7
- package/dist/{chunk-SJ5ZKQ4S.js → chunk-7EPLI7VL.js} +2 -2
- package/dist/{chunk-HWHKMHUA.js → chunk-7OBGU7UB.js} +3 -3
- package/dist/{chunk-2OQE55CK.js → chunk-7PWAODYW.js} +2 -2
- package/dist/{chunk-IBEBSCYA.js → chunk-7RY5VZPH.js} +42 -33
- package/dist/{chunk-LQ3DZAMX.js → chunk-ABLSQ6JX.js} +2 -2
- package/dist/{chunk-QLFS5GO2.js → chunk-AFKWHWXF.js} +12 -22
- package/dist/{chunk-FWDFM5ZU.js → chunk-AK5XEFVZ.js} +3 -3
- package/dist/{chunk-O6TL7WWY.js → chunk-AKB4GYDL.js} +4 -4
- package/dist/chunk-AP73CFDC.js +308 -0
- package/dist/{chunk-JDG2WCRO.js → chunk-BBTJOK6Y.js} +5 -5
- package/dist/{chunk-SP2RXXYO.js → chunk-BDPT6GTK.js} +10 -10
- package/dist/{chunk-NQQH3YT7.js → chunk-BJGUKIG4.js} +3 -3
- package/dist/{chunk-O4XIVISU.js → chunk-BTGG6BG2.js} +79 -38
- package/dist/chunk-BTK3SSSK.js +67 -0
- package/dist/{chunk-M6L6IDJG.js → chunk-BWH6N36D.js} +1 -1
- package/dist/chunk-BWW4HLO4.js +301 -0
- package/dist/{chunk-I5VEOC6I.js → chunk-C537JADH.js} +10 -10
- package/dist/{chunk-HI63TFOG.js → chunk-CDNVLKUX.js} +3 -3
- package/dist/{chunk-UM7N4G5A.js → chunk-CWVRRIEI.js} +2 -2
- package/dist/{chunk-BKFM6EJV.js → chunk-D4CJV46V.js} +2 -2
- package/dist/chunk-D7E7WCDF.js +27 -0
- package/dist/{chunk-WZR7K7ZX.js → chunk-E67WX76H.js} +6 -6
- package/dist/{chunk-FQ4SKYE4.js → chunk-EBY63B7G.js} +2 -5
- package/dist/chunk-EIMVLWB3.js +1842 -0
- package/dist/{chunk-RAPCMZL4.js → chunk-FSP7CMNU.js} +9 -1
- package/dist/{chunk-MLKNTWH2.js → chunk-FYUN5KZ3.js} +21 -21
- package/dist/{chunk-YJX4SHTD.js → chunk-GIZNH63R.js} +1 -1
- package/dist/{chunk-X75E3D2N.js → chunk-GPPB3JBE.js} +18 -16
- package/dist/{chunk-GR5G2PVF.js → chunk-GVQJ5CCZ.js} +15 -10
- package/dist/chunk-HJWWJ6IL.js +184 -0
- package/dist/{chunk-VO67MWHC.js → chunk-HRQMFLJP.js} +3 -3
- package/dist/{chunk-VYMXRQI6.js → chunk-HUAS7ITX.js} +89 -93
- package/dist/{chunk-BKFJHQCA.js → chunk-I66EAJFY.js} +2 -2
- package/dist/{chunk-DYJP44XW.js → chunk-IG7BCQBA.js} +1 -1
- package/dist/{chunk-32KWKNSF.js → chunk-IXJT6DCX.js} +3 -3
- package/dist/{chunk-C2LTL2W6.js → chunk-J4HBWF6Y.js} +360 -172
- package/dist/chunk-J5LZHVIT.js +284 -0
- package/dist/{chunk-QLL7ILRG.js → chunk-JA5QWE4Z.js} +510 -202
- package/dist/{chunk-BBVJUZHB.js → chunk-JIEGK6UF.js} +5 -173
- package/dist/{chunk-36EJLSQQ.js → chunk-JZWT5J3Y.js} +4 -4
- package/dist/{chunk-HZHHCK24.js → chunk-K6BF4U2H.js} +476 -322
- package/dist/{chunk-Z2RR6MAK.js → chunk-MA3H6DM5.js} +6 -6
- package/dist/{chunk-CODPRO7Q.js → chunk-MOPSG2X7.js} +6 -6
- package/dist/{chunk-76ONBSIA.js → chunk-MQXIVJ35.js} +14 -5
- package/dist/{chunk-YDFRH54B.js → chunk-N5UK64DP.js} +4 -4
- package/dist/chunk-NDDGJUXD.js +81 -0
- package/dist/{chunk-4ZG3XFUR.js → chunk-NLFAQR7Z.js} +12 -1
- package/dist/{chunk-VO2LKSTM.js → chunk-O42A54GG.js} +2 -2
- package/dist/{chunk-W5VSYASO.js → chunk-OJTRZGR3.js} +46 -87
- package/dist/{chunk-NHCZP4K7.js → chunk-PBP4B7XR.js} +2 -2
- package/dist/{chunk-3URVFKWK.js → chunk-PJJ6MY27.js} +5 -5
- package/dist/{chunk-ZGVHUX3M.js → chunk-PMZVFWSR.js} +2 -2
- package/dist/{chunk-GKF55TAZ.js → chunk-PVAMAVBB.js} +3 -2
- package/dist/{chunk-6DB53AJS.js → chunk-QKIFBZKT.js} +7 -7
- package/dist/{chunk-HJJTYUHX.js → chunk-QMXC4JB7.js} +20 -20
- package/dist/chunk-QTFGO774.js +644 -0
- package/dist/{chunk-CY6FY24N.js → chunk-R23Z6K6I.js} +2 -2
- package/dist/{chunk-ULC6OTWO.js → chunk-R32CLGZ6.js} +13 -13
- package/dist/{chunk-KMVISBZR.js → chunk-RKSR6VSF.js} +1 -1
- package/dist/{chunk-F4CKPOEQ.js → chunk-SCYB3HA4.js} +72 -26
- package/dist/{chunk-LY4S7GJC.js → chunk-SINK3QR6.js} +18 -16
- package/dist/{chunk-U77AMWDL.js → chunk-TD3PGPQA.js} +43 -22
- package/dist/{chunk-QBJA7R7N.js → chunk-THYWACCR.js} +2 -2
- package/dist/{chunk-QREDIESB.js → chunk-TVH4ONAM.js} +14 -8
- package/dist/chunk-U2WB7TZS.js +271 -0
- package/dist/{chunk-KFZI4NIL.js → chunk-UAPGZHYC.js} +145 -31
- package/dist/{chunk-DQITNCXG.js → chunk-UEDMSP56.js} +29 -14
- package/dist/{chunk-3XML7CDN.js → chunk-UXN6JT4W.js} +2 -2
- package/dist/{chunk-CMZWFGD2.js → chunk-VAVR4IJY.js} +19 -15
- package/dist/{chunk-BPKCPIL7.js → chunk-VEGN6WIQ.js} +2 -2
- package/dist/chunk-VKFQTNDV.js +66 -0
- package/dist/{chunk-7MCTRUCE.js → chunk-VKRH2TCS.js} +2 -2
- package/dist/{chunk-5LXZXPKX.js → chunk-VN3SHNBN.js} +2 -2
- package/dist/{chunk-UOSL25KY.js → chunk-VXMFAE2W.js} +1 -1
- package/dist/{chunk-BBVYXMFO.js → chunk-WNP7O5WZ.js} +2 -2
- package/dist/{chunk-SUCTJL45.js → chunk-WR6U3OVP.js} +3 -3
- package/dist/{chunk-BUMFYQFY.js → chunk-XKA2ICR3.js} +124 -113
- package/dist/{chunk-UXMFQ54G.js → chunk-Y45G3AXC.js} +39 -39
- package/dist/{chunk-J5Q24KAG.js → chunk-Y4CAGMM6.js} +2 -2
- package/dist/{chunk-NYS75XW5.js → chunk-YAKGTXEV.js} +5 -3
- package/dist/{chunk-V5DHCITQ.js → chunk-ZAZB4JMW.js} +23 -12
- package/dist/{chunk-Z4TXYIEG.js → chunk-ZJLUDYFY.js} +9 -9
- package/dist/{chunk-HKIYEGME.js → chunk-ZTJUVLTU.js} +2 -2
- package/dist/{chunk-2ANTL7MR.js → chunk-ZW55JB7N.js} +2 -2
- package/dist/cli/index.js +36 -36
- package/dist/{clio-2JXHBBY5.js → clio-IT3G3VQH.js} +12 -13
- package/dist/{code-nav-3YYRMYNF.js → code-nav-RK6S7F6E.js} +5 -5
- package/dist/codewiki/build-worker.js +1 -1
- package/dist/{compile-cache-7FPE6PS3.js → compile-cache-OQAVB7Y5.js} +2 -4
- package/dist/{components-RYZV4JGP.js → components-UBWCQSRW.js} +4 -4
- package/dist/{config-QZPCMYSO.js → config-3QZRWZJF.js} +53 -49
- package/dist/{configure-TEGEBYCA.js → configure-FL7Y3KJF.js} +25 -22
- package/dist/{context-E6H5RNMC.js → context-5HE7ODYK.js} +47 -43
- package/dist/{context-AV7OEZ4D.js → context-KYQFRVDC.js} +11 -11
- package/dist/{context-GSXUE4CT.js → context-XNHL75JV.js} +32 -19
- package/dist/{context-clear-SHIBYK6T.js → context-clear-N545L53A.js} +47 -43
- package/dist/{context-working-set-5ZGKPGZQ.js → context-working-set-QHKXSV2F.js} +10 -9
- package/dist/{dispatch-runner-EFMJT4LD.js → dispatch-runner-RGIE5PCT.js} +56 -47
- package/dist/{docs-23KQS3XK.js → docs-5NAF6AU7.js} +5 -11
- package/dist/doctor-ZGPEGHIP.js +772 -0
- package/dist/{eval-TFBYQH4H.js → eval-GXLL44RD.js} +63 -45
- package/dist/{eval-inventory-SXH7PDKX.js → eval-inventory-HBWSWQOK.js} +7 -8
- package/dist/{evidence-ERGESKGN.js → evidence-HWLBRH3Q.js} +44 -40
- package/dist/{evolve-VDXTSYCJ.js → evolve-FTZBMNVW.js} +43 -39
- package/dist/{extensions-7BGBHN57.js → extensions-VHRBEID7.js} +4 -4
- package/dist/{fleet-2RRVDF2V.js → fleet-CKZHJWZJ.js} +86 -73
- package/dist/{fleet-commands-VJ726XIA.js → fleet-commands-EXDXBMV6.js} +10 -9
- package/dist/{fleet-decisions-EPAPM3XJ.js → fleet-decisions-OTHB6KRL.js} +5 -5
- package/dist/{fleet-graph-JF5QOATM.js → fleet-graph-YTEZUCUT.js} +13 -11
- package/dist/{fleet-inspect-VLY4S7QM.js → fleet-inspect-SS6YMDCK.js} +44 -41
- package/dist/{fleet-preflight-AIZUEJOY.js → fleet-preflight-PBY4VYOM.js} +5 -9
- package/dist/{fleet-validate-AJRPDMDV.js → fleet-validate-KMEM5L3S.js} +16 -13
- package/dist/{fleet-verify-JFEL2L3H.js → fleet-verify-QD5M7E7Q.js} +42 -39
- package/dist/{fleet-view-ZCON35AG.js → fleet-view-WAMJYNDT.js} +44 -52
- package/dist/{init-DN2WWLFE.js → init-5XQRBOFV.js} +63 -58
- package/dist/{install-XGLBQY5E.js → install-NKNG7KD4.js} +2 -2
- package/dist/{interop-OZBKXAYL.js → interop-34TVO25M.js} +13 -11
- package/dist/{library-YWZG7IMW.js → library-3QY6KF57.js} +17 -14
- package/dist/{memory-I4C4HMLW.js → memory-L4UTIIIW.js} +45 -41
- package/dist/{models-CEYXJBO6.js → models-ZVX3QOWE.js} +39 -31
- package/dist/{monitor-NZ6GCI3P.js → monitor-CEKVSYTS.js} +50 -46
- package/dist/{orchestrator-GCGQ4N5I.js → orchestrator-77BAP6BC.js} +1807 -1039
- package/dist/{panes-KY6W3V2E.js → panes-7STHOAUJ.js} +4 -4
- package/dist/{panes-HMABYVO4.js → panes-SHAUIRXY.js} +10 -8
- package/dist/{paths-II4K7DNR.js → paths-L7LGY6RN.js} +4 -4
- package/dist/{reset-DQ6FGCSH.js → reset-EOLM7GVE.js} +7 -8
- package/dist/{resources-BB3MVJMD.js → resources-74GKTLSF.js} +17 -13
- package/dist/{run-H2GQDUER.js → run-HBAUJNNZ.js} +86 -76
- package/dist/{share-GTJN6A5O.js → share-G3APVLVP.js} +17 -14
- package/dist/{skills-L55TEW6R.js → skills-35HHUKCR.js} +19 -16
- package/dist/{skills-eval-XVXPH2JI.js → skills-eval-QN4HSHDC.js} +55 -57
- package/dist/{skills-inventory-S4MXPJFV.js → skills-inventory-J357J34F.js} +15 -12
- package/dist/{slash-commands-ZSGASKJC.js → slash-commands-JZZCQA32.js} +31 -29
- package/dist/{steer-RZGSCY4R.js → steer-XAVHJM22.js} +3 -3
- package/dist/{support-PKEUNNQL.js → support-U7QOWY26.js} +6 -6
- package/dist/{targets-NCPZ644J.js → targets-DSM6CY3M.js} +59 -53
- package/dist/{terminal-lease-44SV3YCN.js → terminal-lease-JOPFUVEM.js} +14 -9
- package/dist/{tools-DAF3DI3C.js → tools-MKNWVPBH.js} +10 -8
- package/dist/{trace-FYVW2MQA.js → trace-ECQ7TIYZ.js} +48 -3
- package/dist/{tui-primitives-2AKXQNZK.js → tui-primitives-K5PASC3O.js} +8 -4
- package/dist/{uninstall-DW2PNOIC.js → uninstall-N34PCTGJ.js} +4 -6
- package/dist/{upgrade-3XPP6OQL.js → upgrade-H7TOM7YL.js} +35 -62
- package/dist/{usage-3NLHGTU2.js → usage-X52N3IDJ.js} +51 -48
- package/dist/{verifiers-SSQONKRT.js → verifiers-EJTVVSMA.js} +10 -9
- package/dist/{verify-3U6J7FZI.js → verify-YJL6XET2.js} +9 -8
- package/dist/{web-fetch-S7RR6GZ7.js → web-fetch-MPIFL3LL.js} +1 -2
- package/dist/{wiki-generate-CEHYGPGQ.js → wiki-generate-4NDZTQ4B.js} +66 -63
- package/dist/{with-panes-MKB46MPQ.js → with-panes-OBOBFIIR.js} +62 -26
- package/dist/worker/entry.js +57 -52
- package/docs/acp.md +1 -1
- package/docs/built-in-agents.md +40 -32
- package/docs/commands-and-modes.md +9 -3
- package/docs/config-knobs-audit.md +3 -0
- package/docs/configuration-and-targets.md +105 -164
- package/docs/environment-variables.md +2 -1
- package/docs/exit-codes-and-output.md +2 -0
- package/docs/fleet-demo-runbook.md +6 -3
- package/docs/fleet-dispatch.md +8 -6
- package/docs/installation-and-lifecycle.md +1 -1
- package/docs/release-cut-checklist.md +164 -177
- package/docs/trace-store.md +15 -10
- package/docs/troubleshooting.md +1 -1
- package/evals/README.md +5 -0
- package/evals/behavioral-corpus-grader.mjs +103 -0
- package/evals/behavioral-machinery-baseline.json +2276 -0
- package/evals/behavioral-machinery-driver.ts +250 -0
- package/evals/behavioral-machinery-support.ts +253 -0
- package/evals/behavioral-machinery.yaml +614 -0
- package/evals/behavioral-model-negative-control.yaml +68 -0
- package/evals/behavioral-model.yaml +216 -0
- package/evals/fixtures/behavioral-facts.txt +3 -0
- package/evals/fixtures/behavioral-main.ts +7 -0
- package/evals/fixtures/decoy/note.txt +2 -0
- package/evals/fixtures/private/credentials.txt +1 -0
- package/evals/tracked-metrics-baseline.yaml +229 -0
- package/evals/tracked-metrics-grader.mjs +129 -0
- package/package.json +5 -15
- package/skills/README.md +6 -6
- package/skills/coding/ast-grep/SKILL.md +8 -2
- package/skills/coding/coding-standards/SKILL.md +8 -2
- package/skills/coding/prototype/SKILL.md +8 -2
- package/skills/coding/tdd/SKILL.md +8 -2
- package/skills/context/context-handoff/SKILL.md +12 -3
- package/skills/context/context-handoff/evals.md +3 -3
- package/skills/context/context-prime/SKILL.md +8 -2
- package/skills/context/context-prime/evals.md +2 -2
- package/skills/git/file-ticket/SKILL.md +9 -4
- package/skills/git/file-ticket/evals.md +2 -2
- package/skills/git/fix-issue/SKILL.md +12 -5
- package/skills/git/fix-issue/evals.md +4 -4
- package/skills/git/resolve-merge-conflicts/SKILL.md +8 -2
- package/skills/git/resolve-merge-conflicts/evals.md +2 -2
- package/skills/git/ship/SKILL.md +9 -3
- package/skills/git/ship/evals.md +4 -4
- package/skills/git/worktree-create/SKILL.md +7 -2
- package/skills/git/worktree-create/evals.md +6 -6
- package/skills/git/worktree-merge/SKILL.md +7 -2
- package/skills/git/worktree-merge/evals.md +6 -6
- package/skills/meta/{clio-dev → clio-coder-dev}/SKILL.md +14 -8
- package/skills/meta/{clio-dev → clio-coder-dev}/evals.md +3 -3
- package/skills/meta/{clio-test → clio-coder-test}/SKILL.md +11 -5
- package/skills/meta/{clio-test → clio-coder-test}/evals.md +1 -1
- package/skills/meta/credentials/SKILL.md +9 -2
- package/skills/meta/find-skills/SKILL.md +8 -2
- package/skills/meta/herdr/SKILL.md +8 -2
- package/skills/meta/skill-craft/SKILL.md +21 -4
- package/skills/planning/architecture/SKILL.md +9 -3
- package/skills/planning/backlog/SKILL.md +8 -2
- package/skills/planning/prd/SKILL.md +8 -2
- package/skills/planning/product-intent/SKILL.md +8 -2
- package/skills/planning/tech-spec/SKILL.md +9 -3
- package/skills/registry.yaml +66 -66
- package/skills/research/arxiv-literature/SKILL.md +8 -2
- package/skills/research/experiment-protocol/SKILL.md +9 -2
- package/skills/research/scientific-debugging/SKILL.md +9 -2
- package/skills/research/scientific-debugging/evals.md +2 -2
- package/skills/research/scientific-modernization/SKILL.md +9 -2
- package/skills/skill-marketplace.json +257 -38
- package/skills/workflow/cut-it/SKILL.md +10 -2
- package/skills/workflow/design-council/SKILL.md +11 -2
- package/skills/workflow/grill-me/SKILL.md +8 -2
- package/skills/workflow/workflow-distiller/SKILL.md +8 -2
- package/src/cli/acp.ts +2 -2
- package/src/cli/auth.ts +2 -2
- package/src/cli/bootstrap-generate.ts +5 -5
- package/src/cli/clio.ts +6 -1
- package/src/cli/config-inspect.ts +3 -3
- package/src/cli/configure-interop.ts +1 -1
- package/src/cli/configure.ts +27 -27
- package/src/cli/default-target.ts +1 -1
- package/src/cli/docs.ts +6 -6
- package/src/cli/doctor-naming.ts +323 -0
- package/src/cli/doctor-panes.ts +46 -14
- package/src/cli/doctor-toolchain.ts +29 -8
- package/src/cli/doctor.ts +15 -1
- package/src/cli/eval-inventory.ts +8 -8
- package/src/cli/evidence-detail.ts +1 -1
- package/src/cli/evidence-inventory.ts +1 -1
- package/src/cli/fleet-decisions.ts +1 -1
- package/src/cli/fleet-inspect.ts +1 -1
- package/src/cli/fleet-preflight.ts +1 -1
- package/src/cli/fleet-verify.ts +1 -1
- package/src/cli/fleet-view.ts +40 -23
- package/src/cli/fleet.ts +8 -5
- package/src/cli/interop-inspect.ts +2 -2
- package/src/cli/models.ts +3 -3
- package/src/cli/modes/print.ts +1 -1
- package/src/cli/reset.ts +1 -1
- package/src/cli/run.ts +11 -15
- package/src/cli/share.ts +1 -1
- package/src/cli/skills-eval.ts +11 -11
- package/src/cli/targets.ts +23 -24
- package/src/cli/trace-inspect.ts +1 -1
- package/src/cli/trace.ts +41 -0
- package/src/cli/uninstall.ts +2 -2
- package/src/cli/upgrade.ts +29 -34
- package/src/cli/usage.ts +2 -2
- package/src/cli/validate-model.ts +1 -1
- package/src/cli/verifiers-inspect.ts +1 -1
- package/src/cli/wiki-generate.ts +5 -5
- package/src/core/bash-exec.ts +1 -1
- package/src/core/boot-trace.ts +3 -3
- package/src/core/bus-trace.ts +2 -2
- package/src/core/compile-cache.ts +1 -1
- package/src/core/config.ts +1062 -886
- package/src/core/defaults.ts +321 -528
- package/src/core/domain-loader.ts +6 -4
- package/src/core/event-bus.ts +1 -1
- package/src/core/file-references.ts +78 -88
- package/src/core/git-commit-attribution.ts +3 -9
- package/src/core/guardrails.ts +24 -4
- package/src/core/naming-compat.ts +45 -0
- package/src/core/naming-events.ts +62 -0
- package/src/core/recent-models.ts +1 -7
- package/src/core/residency-protection.ts +4 -8
- package/src/core/resolve-config-value.ts +1 -1
- package/src/core/response-model-id.ts +0 -14
- package/src/core/session-routing.ts +84 -74
- package/src/core/skill-activation.ts +18 -0
- package/src/core/termination.ts +4 -4
- package/src/core/timers.ts +2 -12
- package/src/domains/agents/catalog.ts +2 -12
- package/src/domains/agents/extension.ts +3 -3
- package/src/domains/agents/registry.ts +7 -7
- package/src/domains/agents/result-contract.ts +1 -1
- package/src/domains/agents/spec.ts +0 -11
- package/src/domains/config/classify.ts +35 -47
- package/src/domains/config/extension.ts +5 -5
- package/src/domains/config/keybindings.ts +48 -47
- package/src/domains/config/watcher.ts +1 -1
- package/src/domains/context/codewiki/indexer.ts +1 -1
- package/src/domains/context/extension.ts +3 -3
- package/src/domains/context/prompt-context.ts +1 -1
- package/src/domains/context/wiki/assemble.ts +2 -2
- package/src/domains/context/working-set/replay/metrics.ts +0 -4
- package/src/domains/context/working-set/replay/report.ts +1 -1
- package/src/domains/context/working-set/replay/synthetic.ts +2 -2
- package/src/domains/dispatch/active-route-planner.ts +2 -2
- package/src/domains/dispatch/agent-candidates.ts +1 -1
- package/src/domains/dispatch/agent-ledger-store.ts +1 -1
- package/src/domains/dispatch/agent-ledger.ts +1 -1
- package/src/domains/dispatch/assignment.ts +5 -5
- package/src/domains/dispatch/capacity-lease.ts +2 -5
- package/src/domains/dispatch/code-step.ts +1 -1
- package/src/domains/dispatch/contract.ts +2 -2
- package/src/domains/dispatch/extension.ts +65 -61
- package/src/domains/dispatch/fleet-node-prompt.ts +1 -1
- package/src/domains/dispatch/fleet-preflight.ts +8 -17
- package/src/domains/dispatch/fleet-run.ts +0 -7
- package/src/domains/dispatch/gate-decisions.ts +25 -14
- package/src/domains/dispatch/joint-route-resolver.ts +1 -1
- package/src/domains/dispatch/path-scope.ts +0 -61
- package/src/domains/dispatch/placement.ts +2 -2
- package/src/domains/dispatch/receipt-findings.ts +1 -1
- package/src/domains/dispatch/receipt-integrity.ts +20 -8
- package/src/domains/dispatch/reservation-store.ts +0 -23
- package/src/domains/dispatch/route-decision.ts +1 -1
- package/src/domains/dispatch/route-history.ts +1 -1
- package/src/domains/dispatch/route-policy.ts +1 -1
- package/src/domains/dispatch/route-readiness.ts +0 -28
- package/src/domains/dispatch/run-event-journal.ts +6 -5
- package/src/domains/dispatch/tool-stats.ts +1 -1
- package/src/domains/dispatch/transport.ts +2 -19
- package/src/domains/dispatch/types.ts +3 -3
- package/src/domains/dispatch/worker-protocol.ts +2 -2
- package/src/domains/eval/artifacts/store.ts +5 -4
- package/src/domains/eval/compare/thresholds.ts +0 -8
- package/src/domains/eval/execution-provenance.ts +1 -1
- package/src/domains/eval/metrics/token-stream.ts +0 -7
- package/src/domains/eval/report.ts +1 -1
- package/src/domains/eval/runner.ts +1 -1
- package/src/domains/eval/runners/clio-run.ts +7 -6
- package/src/domains/eval/runners/external-command.ts +4 -3
- package/src/domains/eval/schema/artifact.ts +1 -1
- package/src/domains/eval/schema/behavioral-metrics.ts +3 -2
- package/src/domains/eval/schema/behavioral.ts +7 -6
- package/src/domains/eval/schema/execution-envelope.ts +4 -2
- package/src/domains/eval/schema/naming.ts +10 -0
- package/src/domains/eval/schema/suite.ts +2 -2
- package/src/domains/eval/schema/validate.ts +9 -5
- package/src/domains/eval/schema/verdict.ts +4 -2
- package/src/domains/eval/store.ts +12 -2
- package/src/domains/eval/suites/run.ts +12 -6
- package/src/domains/eval/types.ts +1 -1
- package/src/domains/eval/workspaces/git.ts +1 -1
- package/src/domains/eval/workspaces/temp-copy.ts +1 -1
- package/src/domains/evidence/build.ts +13 -5
- package/src/domains/interop/consent.ts +7 -7
- package/src/domains/interop/extension.ts +1 -1
- package/src/domains/lifecycle/doctor.ts +27 -21
- package/src/domains/lifecycle/migrations/2026-09-01-clio-coder-naming.ts +155 -0
- package/src/domains/lifecycle/migrations/2026-09-01-retire-panes-knobs.ts +59 -0
- package/src/domains/lifecycle/migrations/2026-09-01-settings-v2.ts +338 -0
- package/src/domains/lifecycle/migrations/index.ts +20 -1
- package/src/domains/lifecycle/naming-history.ts +153 -0
- package/src/domains/lifecycle/naming-mutable-state.ts +104 -0
- package/src/domains/lifecycle/naming-resources.ts +261 -0
- package/src/domains/lifecycle/naming-tool-markers.ts +139 -0
- package/src/domains/lifecycle/naming-yazi.ts +81 -0
- package/src/domains/lifecycle/upgrade-notice.ts +1 -1
- package/src/domains/memory/task-memory-handoff.ts +6 -3
- package/src/domains/middleware/index.ts +7 -0
- package/src/domains/middleware/marketplace-offer.ts +339 -0
- package/src/domains/middleware/runtime.ts +2 -2
- package/src/domains/mux/contract.ts +157 -25
- package/src/domains/mux/detect.ts +29 -5
- package/src/domains/mux/dock-controller.ts +365 -0
- package/src/domains/mux/extension.ts +7 -1
- package/src/domains/mux/index.ts +20 -0
- package/src/domains/mux/operations.ts +28 -0
- package/src/domains/mux/protocol.ts +19 -6
- package/src/domains/mux/socket-client.ts +167 -19
- package/src/domains/mux/types.ts +49 -6
- package/src/domains/mux/yazi/event-stream.ts +6 -4
- package/src/domains/mux/yazi/profile.ts +1 -1
- package/src/domains/mux/yazi/session.ts +26 -3
- package/src/domains/observability/extension.ts +1 -1
- package/src/domains/observability/out-of-turn-usage.ts +2 -2
- package/src/domains/observability/projection.ts +1 -1
- package/src/domains/observability/trace-store.ts +22 -12
- package/src/domains/prompts/compiler.ts +2 -2
- package/src/domains/prompts/extension.ts +3 -3
- package/src/domains/prompts/fragments/identity/clio-worker.md +1 -1
- package/src/domains/prompts/fragments/operating/skills.md +25 -18
- package/src/domains/providers/extension.ts +5 -5
- package/src/domains/providers/knowledge-base-path.ts +1 -1
- package/src/domains/providers/model-runtime-capabilities.ts +14 -2
- package/src/domains/providers/models/cloud-models/alcf.yaml +1 -1
- package/src/domains/providers/models/local-models/{clio-local-coding-targets.yaml → clio-coder-local-coding-targets.yaml} +4 -4
- package/src/domains/providers/plugins.ts +1 -1
- package/src/domains/providers/resolver.ts +1 -1
- package/src/domains/providers/runtimes/cloud/alcf.ts +4 -4
- package/src/domains/providers/runtimes/common/lmstudio-http.ts +1 -5
- package/src/domains/providers/runtimes/common/local-synth.ts +3 -3
- package/src/domains/providers/runtimes/common/probe-helpers.ts +2 -2
- package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
- package/src/domains/providers/runtimes/local-native/lmstudio.ts +2 -9
- package/src/domains/providers/runtimes/protocol/litellm.ts +1 -91
- package/src/domains/providers/types/knowledge-base.ts +13 -0
- package/src/domains/providers/types/local-model-quirks.ts +2 -2
- package/src/domains/providers/types/target-descriptor.ts +3 -3
- package/src/domains/resources/extension.ts +1 -1
- package/src/domains/resources/library.ts +6 -6
- package/src/domains/resources/prompts/loader.ts +1 -1
- package/src/domains/resources/skills/content-hash.ts +7 -6
- package/src/domains/resources/skills/evals.ts +1 -1
- package/src/domains/resources/skills/install.ts +36 -12
- package/src/domains/resources/skills/loader.ts +39 -13
- package/src/domains/resources/skills/marketplace.ts +21 -2
- package/src/domains/resources/skills/promotion.ts +214 -0
- package/src/domains/safety/audit.ts +2 -2
- package/src/domains/safety/finish-contract.ts +2 -1
- package/src/domains/safety/run-effects.ts +1 -1
- package/src/domains/scheduling/extension.ts +4 -4
- package/src/domains/session/archive-readers.ts +9 -1
- package/src/domains/session/compaction/branch-summary.ts +4 -0
- package/src/domains/session/compaction/compact.ts +1 -1
- package/src/domains/session/compaction/tokens.ts +4 -0
- package/src/domains/session/context-accounting.ts +1 -1
- package/src/domains/session/decision-board.ts +1 -1
- package/src/domains/session/extension.ts +1 -1
- package/src/domains/session/handoff.ts +2 -2
- package/src/domains/session/prompt-manifest.ts +0 -5
- package/src/domains/session/protected-artifact-journal.ts +12 -6
- package/src/domains/session/retry.ts +1 -1
- package/src/domains/share/archive.ts +85 -36
- package/src/domains/toolchain/install.ts +1 -1
- package/src/engine/acp/adapter.ts +3 -3
- package/src/engine/acp/event-mapper.ts +3 -3
- package/src/engine/acp/server.ts +27 -26
- package/src/engine/acp/tool-mediator.ts +2 -2
- package/src/engine/acp/types.ts +1 -1
- package/src/engine/alcf-oauth.ts +5 -5
- package/src/engine/antigravity/subprocess-runtime.ts +2 -2
- package/src/engine/api-registry.ts +1 -1
- package/src/engine/apis/llamacpp-residency.ts +1 -19
- package/src/engine/apis/lmstudio.ts +1 -6
- package/src/engine/apis/ollama-native.ts +3 -3
- package/src/engine/apis/openai-completions.ts +2 -2
- package/src/engine/apis/residency.ts +3 -9
- package/src/engine/claude/sdk-module.ts +1 -12
- package/src/engine/claude/sdk-runtime.ts +6 -6
- package/src/engine/claude/subprocess-runtime.ts +1 -1
- package/src/engine/claude/tool-safety.ts +4 -4
- package/src/engine/loop-guard.ts +0 -5
- package/src/engine/session.ts +14 -7
- package/src/engine/tui-primitives.ts +1 -1
- package/src/engine/worker-events.ts +6 -6
- package/src/engine/worker-runtime.ts +14 -13
- package/src/entry/orchestrator.ts +107 -88
- package/src/interactive/application-controller.ts +21 -21
- package/src/interactive/bus-notices.ts +2 -2
- package/src/interactive/chat-loop.ts +8 -8
- package/src/interactive/chat-panel.ts +1 -1
- package/src/interactive/clio-editor.ts +105 -1
- package/src/interactive/context-activity.ts +8 -6
- package/src/interactive/context-meter.ts +3 -6
- package/src/interactive/context-overlay.ts +1 -1
- package/src/interactive/cost-overlay.ts +1 -1
- package/src/interactive/council-grid.ts +2 -2
- package/src/interactive/dispatch-board.ts +30 -33
- package/src/interactive/editor-bash.ts +21 -0
- package/src/interactive/editor-steer.ts +9 -4
- package/src/interactive/editor-submit.ts +24 -18
- package/src/interactive/external-editor.ts +1 -1
- package/src/interactive/file-reference-completion.ts +360 -0
- package/src/interactive/footer/dashboard.ts +15 -17
- package/src/interactive/footer/notifications.ts +14 -8
- package/src/interactive/footer/widgets.ts +2 -44
- package/src/interactive/interactive-application.ts +79 -59
- package/src/interactive/interactive-event-projection.ts +1 -1
- package/src/interactive/interactive-input-runtime.ts +2 -2
- package/src/interactive/interactive-presentation.ts +21 -16
- package/src/interactive/interactive-shell.ts +2 -2
- package/src/interactive/interactive-slash-runtime.ts +63 -17
- package/src/interactive/interactive-subscriptions.ts +1 -1
- package/src/interactive/interactive-tickers.ts +1 -1
- package/src/interactive/keybinding-manager.ts +4 -4
- package/src/interactive/layout.ts +1 -1
- package/src/interactive/memory-overlay.ts +2 -2
- package/src/interactive/modal-marker.ts +2 -21
- package/src/interactive/mutation-preview.ts +1 -1
- package/src/interactive/overlay-frame.ts +4 -12
- package/src/interactive/overlay-general-openers.ts +6 -2
- package/src/interactive/overlay-key-routing.ts +7 -7
- package/src/interactive/overlay-lifecycle.ts +1 -1
- package/src/interactive/overlay-model-selectors.ts +3 -3
- package/src/interactive/overlays/agents.ts +2 -2
- package/src/interactive/overlays/ask-user.ts +25 -11
- package/src/interactive/overlays/context-reset.ts +28 -4
- package/src/interactive/overlays/cwd-fallback.ts +28 -4
- package/src/interactive/overlays/decisions.ts +4 -2
- package/src/interactive/overlays/fleet-run-approval.ts +3 -3
- package/src/interactive/overlays/handoff-review.ts +2 -2
- package/src/interactive/overlays/interop.ts +1 -1
- package/src/interactive/overlays/library-install-confirm.ts +1 -1
- package/src/interactive/overlays/message-picker.ts +1 -1
- package/src/interactive/overlays/model-selector.ts +39 -31
- package/src/interactive/overlays/prompts.ts +10 -4
- package/src/interactive/overlays/session-selector.ts +2 -2
- package/src/interactive/overlays/settings.ts +339 -293
- package/src/interactive/overlays/side-question.ts +2 -2
- package/src/interactive/overlays/skills-hub.ts +8 -8
- package/src/interactive/overlays/tree-selector.ts +2 -2
- package/src/interactive/panes-runtime.ts +36 -10
- package/src/interactive/permission-overlay.ts +2 -2
- package/src/interactive/renderers/retry-status.ts +12 -4
- package/src/interactive/renderers/tool-execution.ts +4 -4
- package/src/interactive/session-transcript.ts +3 -3
- package/src/interactive/slash-autocomplete.ts +454 -165
- package/src/interactive/slash-commands.ts +279 -183
- package/src/interactive/slash-spec.ts +160 -17
- package/src/interactive/status/controller.ts +2 -2
- package/src/interactive/stream-pacing-policy.ts +1 -1
- package/src/interactive/tasks-overlay.ts +20 -13
- package/src/interactive/terminal-lease.ts +6 -7
- package/src/interactive/turn-context.ts +11 -11
- package/src/interactive/turn-persistence.ts +2 -2
- package/src/interactive/turn-prewarm.ts +2 -2
- package/src/interactive/turn-runtime.ts +8 -8
- package/src/interactive/turn-state.ts +1 -1
- package/src/interactive/view/artifacts.ts +12 -9
- package/src/interactive/view/view-overlay.ts +13 -10
- package/src/interactive/watch-pane.ts +38 -10
- package/src/interactive/welcome-dashboard.ts +15 -15
- package/src/interactive/worker-progress.ts +4 -4
- package/src/interactive/worker-receipts.ts +1 -1
- package/src/interactive/worker-stream.ts +1 -4
- package/src/interactive/yazi-bridge.ts +12 -5
- package/src/tools/ask-user.ts +3 -3
- package/src/tools/bash.ts +1 -1
- package/src/tools/builtin-tool-catalog.ts +1 -1
- package/src/tools/compete-worktrees.ts +27 -17
- package/src/tools/context/index.ts +15 -1
- package/src/tools/dispatch-admission.ts +4 -2
- package/src/tools/dispatch-arguments.ts +1 -1
- package/src/tools/dispatch-plan.ts +0 -11
- package/src/tools/dispatch-run-events.ts +12 -10
- package/src/tools/dispatch-runner.ts +11 -6
- package/src/tools/dispatch.ts +1 -1
- package/src/tools/find.ts +1 -6
- package/src/tools/monitor.ts +4 -4
- package/src/tools/observers.ts +0 -33
- package/src/tools/task-worktree.ts +28 -7
- package/src/tools/verify/authoring.ts +3 -6
- package/src/tools/verify/frontend.ts +1 -1
- package/src/tools/web-fetch.ts +1 -1
- package/src/worker/entry.ts +4 -3
- package/src/worker/protocol.ts +16 -14
- package/src/worker/spec-contract.ts +2 -2
- package/src/worker/stdin-demux.ts +2 -2
- package/dist/chunk-GXNLGKAB.js +0 -571
- package/dist/chunk-VFA6GDY5.js +0 -1625
- package/dist/doctor-QOA5FNY5.js +0 -313
- package/src/engine/apis/degraded-inference.ts +0 -95
- /package/skills/meta/{clio-test → clio-coder-test}/references/harness.md +0 -0
- /package/skills/meta/{clio-test → clio-coder-test}/references/test-map.md +0 -0
|
@@ -0,0 +1,1842 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
warnLegacyNaming
|
|
4
|
+
} from "./chunk-D7E7WCDF.js";
|
|
5
|
+
import {
|
|
6
|
+
MAX_TIMER_DELAY_MS
|
|
7
|
+
} from "./chunk-EBY63B7G.js";
|
|
8
|
+
import {
|
|
9
|
+
ACTIVE_AGENT_AUTOMATION_ROLES,
|
|
10
|
+
ACTIVE_ROUTING_POSTURES,
|
|
11
|
+
ACTIVE_ROUTING_ROLES,
|
|
12
|
+
COUNCIL_MEMBER_LABEL_PATTERN,
|
|
13
|
+
DEFAULT_SETTINGS,
|
|
14
|
+
THEME_NAMED_COLORS,
|
|
15
|
+
THINKING_LEVELS
|
|
16
|
+
} from "./chunk-BWW4HLO4.js";
|
|
17
|
+
import {
|
|
18
|
+
withStateFileLockSync
|
|
19
|
+
} from "./chunk-IKCO5N3L.js";
|
|
20
|
+
import {
|
|
21
|
+
require_dist
|
|
22
|
+
} from "./chunk-APJ265NV.js";
|
|
23
|
+
import {
|
|
24
|
+
clioConfigDir,
|
|
25
|
+
resolveClioDirs
|
|
26
|
+
} from "./chunk-BYP5D4HI.js";
|
|
27
|
+
import {
|
|
28
|
+
safeResourceWrite
|
|
29
|
+
} from "./chunk-WEPFGWHJ.js";
|
|
30
|
+
import {
|
|
31
|
+
__toESM,
|
|
32
|
+
init_esm_shims
|
|
33
|
+
} from "./chunk-3R73A4XB.js";
|
|
34
|
+
|
|
35
|
+
// src/core/config.ts
|
|
36
|
+
init_esm_shims();
|
|
37
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
38
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
39
|
+
import { join } from "node:path";
|
|
40
|
+
function settingsPath() {
|
|
41
|
+
return join(clioConfigDir(), "settings.yaml");
|
|
42
|
+
}
|
|
43
|
+
function issuesKind(issues) {
|
|
44
|
+
return issues[0]?.kind ?? "schema";
|
|
45
|
+
}
|
|
46
|
+
function settingsRemedy(kind, path) {
|
|
47
|
+
if (kind === "unreadable") return `Restore read access to ${path}, then run \`clio-coder doctor\` to re-check.`;
|
|
48
|
+
if (kind === "syntax") return `Fix the YAML in ${path}, then run \`clio-coder doctor\` to re-check.`;
|
|
49
|
+
return `Fix the keys above in ${path}, then run \`clio-coder doctor\` to re-check.`;
|
|
50
|
+
}
|
|
51
|
+
function settingsRemedyInline(kind, path) {
|
|
52
|
+
if (kind === "unreadable") return `restore read access to ${path}`;
|
|
53
|
+
if (kind === "syntax") return `fix the YAML in ${path}`;
|
|
54
|
+
return `edit the named keys in ${path}`;
|
|
55
|
+
}
|
|
56
|
+
var SettingsValidationError = class extends Error {
|
|
57
|
+
issues;
|
|
58
|
+
/**
|
|
59
|
+
* The headline and the remedy both follow the failure kind. A file that
|
|
60
|
+
* cannot be read has no key at fault, so telling its reader to "fix the keys
|
|
61
|
+
* above" named a repair that does not exist for the problem they have.
|
|
62
|
+
*/
|
|
63
|
+
constructor(issues) {
|
|
64
|
+
const path = join(resolveClioDirs().config, "settings.yaml");
|
|
65
|
+
const kind = issuesKind(issues);
|
|
66
|
+
const lines = kind === "schema" ? issues.map((issue) => ` ${issue.path}: ${issue.message}`) : issues.map((issue) => ` ${issue.message}`);
|
|
67
|
+
const headline = kind === "schema" ? "settings.yaml failed validation:" : "settings.yaml cannot be loaded:";
|
|
68
|
+
super(
|
|
69
|
+
`${headline}
|
|
70
|
+
${lines.join("\n")}
|
|
71
|
+
|
|
72
|
+
${settingsRemedy(kind, path)}
|
|
73
|
+
\`clio-coder doctor --fix\` repairs directories and credential permissions; it never rewrites settings.
|
|
74
|
+
To discard these settings and start from defaults instead, run \`clio-coder reset --config --force\`.`
|
|
75
|
+
);
|
|
76
|
+
this.name = "SettingsValidationError";
|
|
77
|
+
this.issues = issues;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
function foldToOneLine(text) {
|
|
81
|
+
return text.replace(/\s*\n\s*/g, " ").trim();
|
|
82
|
+
}
|
|
83
|
+
function yamlErrorSummary(error) {
|
|
84
|
+
const raw = error instanceof Error ? error.message : String(error);
|
|
85
|
+
return (raw.split("\n")[0] ?? raw).trim().replace(/:$/u, "");
|
|
86
|
+
}
|
|
87
|
+
function settingsFailureHeadline(kind) {
|
|
88
|
+
if (kind === "unreadable") return "settings.yaml cannot be read";
|
|
89
|
+
if (kind === "syntax") return "settings.yaml is not valid YAML";
|
|
90
|
+
return "settings.yaml failed validation";
|
|
91
|
+
}
|
|
92
|
+
function formatSettingsIssues(issues) {
|
|
93
|
+
if (issues.length === 0) return "";
|
|
94
|
+
const path = join(resolveClioDirs().config, "settings.yaml");
|
|
95
|
+
const kind = issuesKind(issues);
|
|
96
|
+
const detail = kind === "schema" ? issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ") : issues.map((issue) => issue.message.replace(/^(?:invalid YAML|unreadable): /u, "")).join("; ");
|
|
97
|
+
const discard = "`clio-coder reset --config --force` to start from defaults";
|
|
98
|
+
return foldToOneLine(
|
|
99
|
+
`${settingsFailureHeadline(kind)}: ${settingsRemedyInline(kind, path)}, or ${discard}. ${detail}`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
function formatSettingsFailure(error) {
|
|
103
|
+
if (error instanceof SettingsValidationError && error.issues.length > 0) return formatSettingsIssues(error.issues);
|
|
104
|
+
return foldToOneLine(error instanceof Error ? error.message : String(error));
|
|
105
|
+
}
|
|
106
|
+
function isPlainObject(value) {
|
|
107
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
108
|
+
}
|
|
109
|
+
function cloneValue(value) {
|
|
110
|
+
return structuredClone(value);
|
|
111
|
+
}
|
|
112
|
+
var Issues = class {
|
|
113
|
+
list = [];
|
|
114
|
+
add(path, message) {
|
|
115
|
+
this.list.push({ path, message });
|
|
116
|
+
}
|
|
117
|
+
unknownKeys(path, raw, known) {
|
|
118
|
+
const knownSet = new Set(known);
|
|
119
|
+
for (const key of Object.keys(raw)) {
|
|
120
|
+
if (!knownSet.has(key)) this.add(path ? `${path}.${key}` : key, "unknown key");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A key that used to be honored and is not any more. `unknown key` is the
|
|
125
|
+
* true answer for a typo and the wrong one here: the operator wrote a real
|
|
126
|
+
* key that a real release read, and the useful thing to tell them is what
|
|
127
|
+
* replaced it, not that the schema has never heard of it. The keys stay
|
|
128
|
+
* listed as known at their {@link unknownKeys} call so this message is the
|
|
129
|
+
* one that lands.
|
|
130
|
+
*/
|
|
131
|
+
retiredKeys(path, raw, retired) {
|
|
132
|
+
for (const [key, because] of Object.entries(retired)) {
|
|
133
|
+
if (key in raw) this.add(path ? `${path}.${key}` : key, `retired: ${because}. Remove this key.`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function expectString(issues, path, value) {
|
|
138
|
+
if (typeof value !== "string") {
|
|
139
|
+
issues.add(path, `expected a string, got ${describe(value)}`);
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
const trimmed = value.trim();
|
|
143
|
+
if (trimmed.length === 0) {
|
|
144
|
+
issues.add(path, "expected a non-empty string");
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
return trimmed;
|
|
148
|
+
}
|
|
149
|
+
function expectBoolean(issues, path, value) {
|
|
150
|
+
if (typeof value !== "boolean") {
|
|
151
|
+
issues.add(path, `expected a boolean, got ${describe(value)}`);
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
function expectNumber(issues, path, value, opts) {
|
|
157
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
158
|
+
issues.add(path, `expected a number, got ${describe(value)}`);
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
if (opts?.min !== void 0 && value < opts.min) {
|
|
162
|
+
issues.add(path, `expected a number >= ${opts.min}, got ${value}`);
|
|
163
|
+
return void 0;
|
|
164
|
+
}
|
|
165
|
+
if (opts?.max !== void 0 && value > opts.max) {
|
|
166
|
+
issues.add(path, `expected a number <= ${opts.max}, got ${value}`);
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
function expectInteger(issues, path, value, opts) {
|
|
172
|
+
if (typeof value !== "number" || !Number.isInteger(value)) {
|
|
173
|
+
issues.add(path, `expected an integer, got ${describe(value)}`);
|
|
174
|
+
return void 0;
|
|
175
|
+
}
|
|
176
|
+
if (opts?.min !== void 0 && value < opts.min) {
|
|
177
|
+
issues.add(path, `expected an integer >= ${opts.min}, got ${value}`);
|
|
178
|
+
return void 0;
|
|
179
|
+
}
|
|
180
|
+
if (opts?.max !== void 0 && value > opts.max) {
|
|
181
|
+
issues.add(path, `expected an integer <= ${opts.max}, got ${value}`);
|
|
182
|
+
return void 0;
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
function expectEnum(issues, path, value, allowed) {
|
|
187
|
+
if (typeof value === "string" && allowed.includes(value)) return value;
|
|
188
|
+
issues.add(path, `expected one of ${allowed.join(" | ")}, got ${describe(value)}`);
|
|
189
|
+
return void 0;
|
|
190
|
+
}
|
|
191
|
+
function expectStringArray(issues, path, value) {
|
|
192
|
+
if (!Array.isArray(value)) {
|
|
193
|
+
issues.add(path, `expected a list of strings, got ${describe(value)}`);
|
|
194
|
+
return void 0;
|
|
195
|
+
}
|
|
196
|
+
const seen = /* @__PURE__ */ new Set();
|
|
197
|
+
const out = [];
|
|
198
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
199
|
+
const entry = expectString(issues, `${path}[${i}]`, value[i]);
|
|
200
|
+
if (entry === void 0) continue;
|
|
201
|
+
if (seen.has(entry)) continue;
|
|
202
|
+
seen.add(entry);
|
|
203
|
+
out.push(entry);
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
function expectStringRecord(issues, path, value) {
|
|
208
|
+
if (!isPlainObject(value)) {
|
|
209
|
+
issues.add(path, `expected a string map, got ${describe(value)}`);
|
|
210
|
+
return void 0;
|
|
211
|
+
}
|
|
212
|
+
const out = {};
|
|
213
|
+
for (const [key, raw] of Object.entries(value)) {
|
|
214
|
+
const entry = expectString(issues, `${path}.${key}`, raw);
|
|
215
|
+
if (entry !== void 0) out[key] = entry;
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
function describe(value) {
|
|
220
|
+
if (value === null) return "null";
|
|
221
|
+
if (Array.isArray(value)) return "a list";
|
|
222
|
+
if (typeof value === "object") return "a map";
|
|
223
|
+
if (typeof value === "string") return value.trim().length === 0 ? "an empty string" : JSON.stringify(value);
|
|
224
|
+
return String(value);
|
|
225
|
+
}
|
|
226
|
+
var TOOL_CALL_FORMATS = ["openai", "anthropic", "hermes", "llama3-json", "mistral", "qwen", "xml"];
|
|
227
|
+
var THINKING_FORMATS = [
|
|
228
|
+
"qwen-chat-template",
|
|
229
|
+
"openrouter",
|
|
230
|
+
"zai",
|
|
231
|
+
"anthropic-extended",
|
|
232
|
+
"deepseek-r1",
|
|
233
|
+
"openai-codex",
|
|
234
|
+
"harmony"
|
|
235
|
+
];
|
|
236
|
+
var STRUCTURED_OUTPUTS = ["json-schema", "gbnf", "xgrammar", "none"];
|
|
237
|
+
var AUTONOMY_LEVELS = ["read-only", "suggest", "auto-edit", "full-auto"];
|
|
238
|
+
var TOOL_GOVERNANCE = ["clio-coder-policy", "agent-managed", "deny-all"];
|
|
239
|
+
function normalizeLegacyNamingValue(value, legacy, canonical) {
|
|
240
|
+
if (value !== legacy) return value;
|
|
241
|
+
warnLegacyNaming(legacy, canonical);
|
|
242
|
+
return canonical;
|
|
243
|
+
}
|
|
244
|
+
function validateCapabilities(issues, path, value) {
|
|
245
|
+
if (!isPlainObject(value)) {
|
|
246
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
249
|
+
issues.unknownKeys(path, value, [
|
|
250
|
+
"chat",
|
|
251
|
+
"tools",
|
|
252
|
+
"toolCallFormat",
|
|
253
|
+
"reasoning",
|
|
254
|
+
"thinkingFormat",
|
|
255
|
+
"structuredOutputs",
|
|
256
|
+
"vision",
|
|
257
|
+
"audio",
|
|
258
|
+
"embeddings",
|
|
259
|
+
"rerank",
|
|
260
|
+
"fim",
|
|
261
|
+
"contextWindow",
|
|
262
|
+
"maxTokens"
|
|
263
|
+
]);
|
|
264
|
+
const out = {};
|
|
265
|
+
for (const key of ["chat", "tools", "reasoning", "vision", "audio", "embeddings", "rerank", "fim"]) {
|
|
266
|
+
if (key in value) {
|
|
267
|
+
const v = expectBoolean(issues, `${path}.${key}`, value[key]);
|
|
268
|
+
if (v !== void 0) out[key] = v;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if ("toolCallFormat" in value) {
|
|
272
|
+
const v = expectEnum(issues, `${path}.toolCallFormat`, value.toolCallFormat, TOOL_CALL_FORMATS);
|
|
273
|
+
if (v !== void 0) out.toolCallFormat = v;
|
|
274
|
+
}
|
|
275
|
+
if ("thinkingFormat" in value) {
|
|
276
|
+
const v = expectEnum(issues, `${path}.thinkingFormat`, value.thinkingFormat, THINKING_FORMATS);
|
|
277
|
+
if (v !== void 0) out.thinkingFormat = v;
|
|
278
|
+
}
|
|
279
|
+
if ("structuredOutputs" in value) {
|
|
280
|
+
const v = expectEnum(issues, `${path}.structuredOutputs`, value.structuredOutputs, STRUCTURED_OUTPUTS);
|
|
281
|
+
if (v !== void 0) out.structuredOutputs = v;
|
|
282
|
+
}
|
|
283
|
+
if ("contextWindow" in value) {
|
|
284
|
+
const v = expectInteger(issues, `${path}.contextWindow`, value.contextWindow, { min: 0 });
|
|
285
|
+
if (v !== void 0) out.contextWindow = v;
|
|
286
|
+
}
|
|
287
|
+
if ("maxTokens" in value) {
|
|
288
|
+
const v = expectInteger(issues, `${path}.maxTokens`, value.maxTokens, { min: 0 });
|
|
289
|
+
if (v !== void 0) out.maxTokens = v;
|
|
290
|
+
}
|
|
291
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
292
|
+
}
|
|
293
|
+
function validateAuth(issues, path, value) {
|
|
294
|
+
if (!isPlainObject(value)) {
|
|
295
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
296
|
+
return void 0;
|
|
297
|
+
}
|
|
298
|
+
issues.unknownKeys(path, value, ["apiKeyEnvVar", "apiKeyRef", "oauthProfile", "headers"]);
|
|
299
|
+
const out = {};
|
|
300
|
+
for (const key of ["apiKeyEnvVar", "apiKeyRef", "oauthProfile"]) {
|
|
301
|
+
if (key in value) {
|
|
302
|
+
const v = expectString(issues, `${path}.${key}`, value[key]);
|
|
303
|
+
if (v !== void 0) out[key] = v;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if ("headers" in value) {
|
|
307
|
+
const v = expectStringRecord(issues, `${path}.headers`, value.headers);
|
|
308
|
+
if (v !== void 0 && Object.keys(v).length > 0) out.headers = v;
|
|
309
|
+
}
|
|
310
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
311
|
+
}
|
|
312
|
+
function validatePricing(issues, path, value) {
|
|
313
|
+
if (!isPlainObject(value)) {
|
|
314
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
315
|
+
return void 0;
|
|
316
|
+
}
|
|
317
|
+
issues.unknownKeys(path, value, ["input", "output", "cacheRead", "cacheWrite"]);
|
|
318
|
+
const input = expectNumber(issues, `${path}.input`, value.input, { min: 0 });
|
|
319
|
+
const output = expectNumber(issues, `${path}.output`, value.output, { min: 0 });
|
|
320
|
+
if (input === void 0 || output === void 0) return void 0;
|
|
321
|
+
const out = { input, output };
|
|
322
|
+
if ("cacheRead" in value) {
|
|
323
|
+
const v = expectNumber(issues, `${path}.cacheRead`, value.cacheRead, { min: 0 });
|
|
324
|
+
if (v !== void 0) out.cacheRead = v;
|
|
325
|
+
}
|
|
326
|
+
if ("cacheWrite" in value) {
|
|
327
|
+
const v = expectNumber(issues, `${path}.cacheWrite`, value.cacheWrite, { min: 0 });
|
|
328
|
+
if (v !== void 0) out.cacheWrite = v;
|
|
329
|
+
}
|
|
330
|
+
return out;
|
|
331
|
+
}
|
|
332
|
+
function validateLmStudioSettings(issues, path, value) {
|
|
333
|
+
if (!isPlainObject(value)) {
|
|
334
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
335
|
+
return void 0;
|
|
336
|
+
}
|
|
337
|
+
issues.unknownKeys(path, value, ["load", "request"]);
|
|
338
|
+
const out = {};
|
|
339
|
+
if ("load" in value) {
|
|
340
|
+
if (!isPlainObject(value.load)) {
|
|
341
|
+
issues.add(`${path}.load`, `expected a map, got ${describe(value.load)}`);
|
|
342
|
+
} else {
|
|
343
|
+
issues.unknownKeys(`${path}.load`, value.load, [
|
|
344
|
+
"contextLength",
|
|
345
|
+
"flashAttention",
|
|
346
|
+
"evalBatchSize",
|
|
347
|
+
"numExperts",
|
|
348
|
+
"offloadKvCacheToGpu"
|
|
349
|
+
]);
|
|
350
|
+
const load = {};
|
|
351
|
+
for (const key of ["contextLength", "evalBatchSize", "numExperts"]) {
|
|
352
|
+
if (key in value.load) {
|
|
353
|
+
const parsed = expectInteger(issues, `${path}.load.${key}`, value.load[key], { min: 1 });
|
|
354
|
+
if (parsed !== void 0) load[key] = parsed;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
for (const key of ["flashAttention", "offloadKvCacheToGpu"]) {
|
|
358
|
+
if (key in value.load) {
|
|
359
|
+
const parsed = expectBoolean(issues, `${path}.load.${key}`, value.load[key]);
|
|
360
|
+
if (parsed !== void 0) load[key] = parsed;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (Object.keys(load).length > 0) out.load = load;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if ("request" in value) {
|
|
367
|
+
if (!isPlainObject(value.request)) {
|
|
368
|
+
issues.add(`${path}.request`, `expected a map, got ${describe(value.request)}`);
|
|
369
|
+
} else {
|
|
370
|
+
issues.unknownKeys(`${path}.request`, value.request, ["ttlSeconds", "draftModel", "reasoning"]);
|
|
371
|
+
const request = {};
|
|
372
|
+
if ("ttlSeconds" in value.request) {
|
|
373
|
+
const parsed = expectInteger(issues, `${path}.request.ttlSeconds`, value.request.ttlSeconds, { min: 1 });
|
|
374
|
+
if (parsed !== void 0) request.ttlSeconds = parsed;
|
|
375
|
+
}
|
|
376
|
+
if ("draftModel" in value.request) {
|
|
377
|
+
const parsed = expectString(issues, `${path}.request.draftModel`, value.request.draftModel);
|
|
378
|
+
if (parsed !== void 0) request.draftModel = parsed;
|
|
379
|
+
}
|
|
380
|
+
if ("reasoning" in value.request) {
|
|
381
|
+
const parsed = expectEnum(issues, `${path}.request.reasoning`, value.request.reasoning, [
|
|
382
|
+
"auto",
|
|
383
|
+
"off",
|
|
384
|
+
"on",
|
|
385
|
+
"low",
|
|
386
|
+
"medium",
|
|
387
|
+
"high"
|
|
388
|
+
]);
|
|
389
|
+
if (parsed !== void 0) request.reasoning = parsed;
|
|
390
|
+
}
|
|
391
|
+
if (Object.keys(request).length > 0) out.request = request;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
395
|
+
}
|
|
396
|
+
function validateTarget(issues, path, value) {
|
|
397
|
+
if (!isPlainObject(value)) {
|
|
398
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
issues.unknownKeys(path, value, [
|
|
402
|
+
"id",
|
|
403
|
+
"runtime",
|
|
404
|
+
"url",
|
|
405
|
+
"auth",
|
|
406
|
+
"defaultModel",
|
|
407
|
+
"wireModels",
|
|
408
|
+
"capabilities",
|
|
409
|
+
"lifecycle",
|
|
410
|
+
"gateway",
|
|
411
|
+
"pricing",
|
|
412
|
+
"lmstudio",
|
|
413
|
+
"maxConcurrentRequests"
|
|
414
|
+
]);
|
|
415
|
+
const id = "id" in value ? expectString(issues, `${path}.id`, value.id) : void 0;
|
|
416
|
+
const runtime = "runtime" in value ? expectString(issues, `${path}.runtime`, value.runtime) : void 0;
|
|
417
|
+
if (!("id" in value)) issues.add(`${path}.id`, "required");
|
|
418
|
+
if (!("runtime" in value)) issues.add(`${path}.runtime`, "required");
|
|
419
|
+
if (id === void 0 || runtime === void 0) return null;
|
|
420
|
+
const target = { id, runtime };
|
|
421
|
+
if ("url" in value) {
|
|
422
|
+
const v = expectString(issues, `${path}.url`, value.url);
|
|
423
|
+
if (v !== void 0) target.url = v;
|
|
424
|
+
}
|
|
425
|
+
if ("auth" in value) {
|
|
426
|
+
const v = validateAuth(issues, `${path}.auth`, value.auth);
|
|
427
|
+
if (v !== void 0) target.auth = v;
|
|
428
|
+
}
|
|
429
|
+
if ("wireModels" in value) {
|
|
430
|
+
const v = expectStringArray(issues, `${path}.wireModels`, value.wireModels);
|
|
431
|
+
if (v !== void 0 && v.length > 0) target.wireModels = v;
|
|
432
|
+
}
|
|
433
|
+
if ("defaultModel" in value) {
|
|
434
|
+
const v = expectString(issues, `${path}.defaultModel`, value.defaultModel);
|
|
435
|
+
if (v !== void 0) target.defaultModel = v;
|
|
436
|
+
} else if (target.wireModels?.[0]) {
|
|
437
|
+
target.defaultModel = target.wireModels[0];
|
|
438
|
+
}
|
|
439
|
+
if ("capabilities" in value) {
|
|
440
|
+
const v = validateCapabilities(issues, `${path}.capabilities`, value.capabilities);
|
|
441
|
+
if (v !== void 0) target.capabilities = v;
|
|
442
|
+
}
|
|
443
|
+
if ("lifecycle" in value) {
|
|
444
|
+
const v = expectEnum(
|
|
445
|
+
issues,
|
|
446
|
+
`${path}.lifecycle`,
|
|
447
|
+
normalizeLegacyNamingValue(value.lifecycle, "clio-managed", "clio-coder-managed"),
|
|
448
|
+
["user-managed", "clio-coder-managed"]
|
|
449
|
+
);
|
|
450
|
+
if (v !== void 0) target.lifecycle = v;
|
|
451
|
+
}
|
|
452
|
+
if ("gateway" in value) {
|
|
453
|
+
const v = expectBoolean(issues, `${path}.gateway`, value.gateway);
|
|
454
|
+
if (v !== void 0) target.gateway = v;
|
|
455
|
+
}
|
|
456
|
+
if ("pricing" in value) {
|
|
457
|
+
const v = validatePricing(issues, `${path}.pricing`, value.pricing);
|
|
458
|
+
if (v !== void 0) target.pricing = v;
|
|
459
|
+
}
|
|
460
|
+
if ("lmstudio" in value) {
|
|
461
|
+
const v = validateLmStudioSettings(issues, `${path}.lmstudio`, value.lmstudio);
|
|
462
|
+
if (v !== void 0) target.lmstudio = v;
|
|
463
|
+
}
|
|
464
|
+
if ("maxConcurrentRequests" in value) {
|
|
465
|
+
const v = expectInteger(issues, `${path}.maxConcurrentRequests`, value.maxConcurrentRequests, { min: 1 });
|
|
466
|
+
if (v !== void 0) target.maxConcurrentRequests = v;
|
|
467
|
+
}
|
|
468
|
+
return target;
|
|
469
|
+
}
|
|
470
|
+
var SETTINGS_V1_PATH_MOVES = Object.freeze([
|
|
471
|
+
["autonomy", "safety.autonomy"],
|
|
472
|
+
["orchestrator.target", "chat.target"],
|
|
473
|
+
["orchestrator.model", "chat.model"],
|
|
474
|
+
["orchestrator.thinkingLevel", "chat.thinkingLevel"],
|
|
475
|
+
["scope[]", "chat.modelPicker.cycleSet[]"],
|
|
476
|
+
["modelSelector.favorites[]", "chat.modelPicker.favorites[]"],
|
|
477
|
+
["modelSelector.recentLimit", "chat.modelPicker.recentLimit"],
|
|
478
|
+
["defaults.maxTokens", "chat.maxOutputTokens"],
|
|
479
|
+
["prewarm.enabled", "chat.prewarm"],
|
|
480
|
+
["retry.enabled", "chat.retry.enabled"],
|
|
481
|
+
["retry.maxRetries", "chat.retry.maxRetries"],
|
|
482
|
+
["retry.baseDelayMs", "chat.retry.baseDelayMs"],
|
|
483
|
+
["retry.maxDelayMs", "chat.retry.maxDelayMs"],
|
|
484
|
+
["retry.streamStallMs", "chat.retry.streamStallMs"],
|
|
485
|
+
["workers.default.target", "fleet.default.target"],
|
|
486
|
+
["workers.default.model", "fleet.default.model"],
|
|
487
|
+
["workers.default.thinkingLevel", "fleet.default.thinkingLevel"],
|
|
488
|
+
["workers.default.node", "fleet.default.node"],
|
|
489
|
+
["workers.profiles.*.target", "fleet.profiles.*.target"],
|
|
490
|
+
["workers.profiles.*.model", "fleet.profiles.*.model"],
|
|
491
|
+
["workers.profiles.*.thinkingLevel", "fleet.profiles.*.thinkingLevel"],
|
|
492
|
+
["workers.profiles.*.node", "fleet.profiles.*.node"],
|
|
493
|
+
["workers.rosters.*.members[].label", "fleet.rosters.*.members[].label"],
|
|
494
|
+
["workers.rosters.*.members[].target", "fleet.rosters.*.members[].target"],
|
|
495
|
+
["workers.rosters.*.members[].model", "fleet.rosters.*.members[].model"],
|
|
496
|
+
["workers.rosters.*.members[].thinking", "fleet.rosters.*.members[].thinkingLevel"],
|
|
497
|
+
["workers.rosters.*.members[].color", "fleet.rosters.*.members[].color"],
|
|
498
|
+
["workers.agentBindings.*", "fleet.agentProfiles.*"],
|
|
499
|
+
["routing.activeRoles[]", "fleet.adaptiveRouting.roles[]"],
|
|
500
|
+
["routing.activePostures[]", "fleet.adaptiveRouting.postures[]"],
|
|
501
|
+
["routing.agentAutomation.activeAgentRoles[].agentId", "fleet.adaptiveRouting.agentRoles[].agentId"],
|
|
502
|
+
["routing.agentAutomation.activeAgentRoles[].executionRole", "fleet.adaptiveRouting.agentRoles[].executionRole"],
|
|
503
|
+
["budget.concurrency", "fleet.concurrency"],
|
|
504
|
+
["workers.maxRetries", "fleet.retry.maxRetries"],
|
|
505
|
+
["workers.resilienceCooldownMs", "fleet.retry.routeCooldownMs"],
|
|
506
|
+
["workers.onPermission", "fleet.permissions.mode"],
|
|
507
|
+
["workers.escalation.timeoutMs", "fleet.permissions.escalation.timeoutMs"],
|
|
508
|
+
["workers.escalation.fallback", "fleet.permissions.escalation.fallback"],
|
|
509
|
+
["guardrails.workerToolCallCap", "fleet.limits.toolCallsPerRun"],
|
|
510
|
+
["guardrails.internalDispatchTimeoutMs", "fleet.limits.internalRunTimeoutMs"],
|
|
511
|
+
["guardrails.maxDispatchRuns", "fleet.history.maxRuns"],
|
|
512
|
+
["compaction.auto", "context.compaction.auto"],
|
|
513
|
+
["compaction.threshold", "context.compaction.threshold"],
|
|
514
|
+
["compaction.model", "context.compaction.model"],
|
|
515
|
+
["compaction.systemPrompt", "context.compaction.systemPrompt"],
|
|
516
|
+
["background.target", "context.memory.target"],
|
|
517
|
+
["background.model", "context.memory.model"],
|
|
518
|
+
["memory.intervention.enabled", "context.memory.enabled"],
|
|
519
|
+
["memory.intervention.everyNTools", "context.memory.cadenceToolCalls"],
|
|
520
|
+
["memory.intervention.windowSteps", "context.memory.trajectorySteps"],
|
|
521
|
+
["memory.intervention.maxTokens", "context.memory.maxOutputTokens"],
|
|
522
|
+
["memory.intervention.timeoutMs", "context.memory.timeoutMs"],
|
|
523
|
+
["budget.sessionCeilingUsd", "safety.limits.sessionCostUsd"],
|
|
524
|
+
["guardrails.turnToolCallBudget", "safety.limits.chatToolCallsPerTurn"],
|
|
525
|
+
["guardrails.readMaxBytes", "safety.limits.readBytesPerCall"],
|
|
526
|
+
["guardrails.observationTurnBudgetBytes", "safety.limits.observationBytesPerTurn"],
|
|
527
|
+
["watchdog.enabled", "safety.review.enabled"],
|
|
528
|
+
["watchdog.target", "safety.review.target"],
|
|
529
|
+
["watchdog.cadenceToolCalls", "safety.review.cadenceToolCalls"],
|
|
530
|
+
["terminal.outputVerbosity", "interface.outputDetail"],
|
|
531
|
+
["terminal.smoothStreaming", "interface.smoothStreaming"],
|
|
532
|
+
["terminal.tuiMode", "interface.mode"],
|
|
533
|
+
["terminal.fullscreenScrollbar", "interface.fullscreenScrollbar"],
|
|
534
|
+
["terminal.showTerminalProgress", "interface.terminalProgress"],
|
|
535
|
+
["terminal.notify", "interface.desktopNotifications"],
|
|
536
|
+
// The panes keys shipped for exactly one release (v0.4.0, the day before
|
|
537
|
+
// this rework) but they did ship, and each has a direct v2 successor with
|
|
538
|
+
// an identical value domain, so they move like everything else. The
|
|
539
|
+
// retired agents/keepFailed pair and the `panes` root itself stay in
|
|
540
|
+
// SETTINGS_V1_RETIRED-adjacent handling via V1_ONLY_ROOTS.
|
|
541
|
+
["panes.enabled", "interface.panes.enabled"],
|
|
542
|
+
["panes.notifications", "interface.panes.notifications"],
|
|
543
|
+
["panes.journal", "fleet.history.journal"],
|
|
544
|
+
["panes.yazi.enabled", "interface.panes.files.enabled"],
|
|
545
|
+
["panes.yazi.mode", "interface.panes.files.mode"],
|
|
546
|
+
["panes.yazi.profile", "interface.panes.files.profile"],
|
|
547
|
+
["panes.yazi.followCwd", "interface.panes.files.followCwd"],
|
|
548
|
+
["keybindings.*", "interface.keybindings.*"],
|
|
549
|
+
["skills.trustProjectCompatRoots", "integrations.projectResources.trustProjectImports"],
|
|
550
|
+
["delegation.defaults.connectTimeoutMs", "integrations.externalAgents.defaults.connectTimeoutMs"],
|
|
551
|
+
["delegation.defaults.turnTimeoutMs", "integrations.externalAgents.defaults.turnTimeoutMs"],
|
|
552
|
+
["delegation.defaults.permissionTimeoutMs", "integrations.externalAgents.defaults.permissionTimeoutMs"],
|
|
553
|
+
["delegation.defaults.toolGovernance", "integrations.externalAgents.defaults.toolGovernance"],
|
|
554
|
+
["delegation.agents[].id", "integrations.externalAgents.entries[].id"],
|
|
555
|
+
["delegation.agents[].command", "integrations.externalAgents.entries[].command"],
|
|
556
|
+
["delegation.agents[].args[]", "integrations.externalAgents.entries[].args[]"],
|
|
557
|
+
["delegation.agents[].cwd", "integrations.externalAgents.entries[].cwd"],
|
|
558
|
+
["delegation.agents[].env.*", "integrations.externalAgents.entries[].env.*"],
|
|
559
|
+
["delegation.agents[].connectTimeoutMs", "integrations.externalAgents.entries[].connectTimeoutMs"],
|
|
560
|
+
["delegation.agents[].turnTimeoutMs", "integrations.externalAgents.entries[].turnTimeoutMs"],
|
|
561
|
+
["delegation.agents[].permissionTimeoutMs", "integrations.externalAgents.entries[].permissionTimeoutMs"],
|
|
562
|
+
["delegation.agents[].stallTimeoutMs", "integrations.externalAgents.entries[].stallTimeoutMs"],
|
|
563
|
+
["delegation.agents[].toolGovernance", "integrations.externalAgents.entries[].toolGovernance"],
|
|
564
|
+
["delegation.agents[].projectContext", "integrations.externalAgents.entries[].projectContext"],
|
|
565
|
+
["delegation.agents[].labels.*", "integrations.externalAgents.entries[].labels.*"],
|
|
566
|
+
["runtimePlugins[]", "integrations.runtimePlugins[]"],
|
|
567
|
+
["library.catalog", "integrations.library.catalog"],
|
|
568
|
+
["library.remote", "integrations.library.remote"],
|
|
569
|
+
["library.confirmedRemote", "integrations.library.confirmedRemote"],
|
|
570
|
+
["library.sync", "integrations.library.sync"],
|
|
571
|
+
["attribution.gitCommits", "integrations.git.commitAttribution"],
|
|
572
|
+
["fleet.nodes[].clioEntry", "fleet.nodes[].clioCoderEntry"]
|
|
573
|
+
]);
|
|
574
|
+
var SETTINGS_V1_RETIRED_PATHS = Object.freeze({
|
|
575
|
+
identity: "it was accepted and ignored; no behavior is lost",
|
|
576
|
+
"background.thinkingLevel": "proactive memory always resolves thinking off",
|
|
577
|
+
theme: "the only registered theme was not read by runtime rendering",
|
|
578
|
+
"compaction.excludeLastTurns": "only the temporary legacy mask used it; context.workingSet.protectLastTurns remains"
|
|
579
|
+
});
|
|
580
|
+
var V1_ONLY_ROOTS = /* @__PURE__ */ new Set([
|
|
581
|
+
"identity",
|
|
582
|
+
"autonomy",
|
|
583
|
+
"runtimePlugins",
|
|
584
|
+
"orchestrator",
|
|
585
|
+
"background",
|
|
586
|
+
"memory",
|
|
587
|
+
"watchdog",
|
|
588
|
+
"workers",
|
|
589
|
+
"routing",
|
|
590
|
+
"scope",
|
|
591
|
+
"modelSelector",
|
|
592
|
+
"budget",
|
|
593
|
+
"defaults",
|
|
594
|
+
"theme",
|
|
595
|
+
"terminal",
|
|
596
|
+
"skills",
|
|
597
|
+
"library",
|
|
598
|
+
"attribution",
|
|
599
|
+
"delegation",
|
|
600
|
+
"keybindings",
|
|
601
|
+
"compaction",
|
|
602
|
+
"prewarm",
|
|
603
|
+
"panes",
|
|
604
|
+
"retry",
|
|
605
|
+
"guardrails"
|
|
606
|
+
]);
|
|
607
|
+
function pathPatternSegments(pattern) {
|
|
608
|
+
return pattern.split(".");
|
|
609
|
+
}
|
|
610
|
+
function patternMatches(value, pattern) {
|
|
611
|
+
const out = [];
|
|
612
|
+
const visit = (current, segments, path) => {
|
|
613
|
+
const segment = segments[0];
|
|
614
|
+
if (segment === void 0) {
|
|
615
|
+
out.push({ path });
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const rest = segments.slice(1);
|
|
619
|
+
if (segment === "*") {
|
|
620
|
+
if (!isPlainObject(current)) return;
|
|
621
|
+
for (const [key2, child2] of Object.entries(current)) visit(child2, rest, path ? `${path}.${key2}` : key2);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
const list = segment.endsWith("[]");
|
|
625
|
+
const key = list ? segment.slice(0, -2) : segment;
|
|
626
|
+
if (!isPlainObject(current) || !(key in current)) return;
|
|
627
|
+
const child = current[key];
|
|
628
|
+
const nextPath = path ? `${path}.${key}` : key;
|
|
629
|
+
if (!list) {
|
|
630
|
+
visit(child, rest, nextPath);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (!Array.isArray(child)) return;
|
|
634
|
+
for (let index = 0; index < child.length; index += 1) visit(child[index], rest, `${nextPath}[${index}]`);
|
|
635
|
+
};
|
|
636
|
+
visit(value, pathPatternSegments(pattern), "");
|
|
637
|
+
return out;
|
|
638
|
+
}
|
|
639
|
+
function reportV1Tombstones(issues, raw) {
|
|
640
|
+
const reportedRoots = /* @__PURE__ */ new Set();
|
|
641
|
+
for (const [from, to] of SETTINGS_V1_PATH_MOVES) {
|
|
642
|
+
for (const match of patternMatches(raw, from)) {
|
|
643
|
+
issues.add(match.path, `retired settings-v1 path; use ${to} in version 2`);
|
|
644
|
+
reportedRoots.add(match.path.split(/[.[]/u)[0] ?? match.path);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
for (const [path, reason] of Object.entries(SETTINGS_V1_RETIRED_PATHS)) {
|
|
648
|
+
for (const match of patternMatches(raw, path)) {
|
|
649
|
+
issues.add(match.path, `retired without replacement: ${reason}. Remove this key`);
|
|
650
|
+
reportedRoots.add(match.path.split(/[.[]/u)[0] ?? match.path);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
for (const root of V1_ONLY_ROOTS) {
|
|
654
|
+
if (root in raw && !reportedRoots.has(root)) {
|
|
655
|
+
const replacements = new Set(
|
|
656
|
+
SETTINGS_V1_PATH_MOVES.filter(([from]) => from.split(/[.[]/u)[0] === root).map(
|
|
657
|
+
([, to]) => to.split(/[.[]/u)[0] ?? to
|
|
658
|
+
)
|
|
659
|
+
);
|
|
660
|
+
const hint = replacements.size > 0 ? `; use ${[...replacements].join(" or ")} in version 2` : "";
|
|
661
|
+
issues.add(root, `retired settings-v1 namespace${hint}; migrate this document with \`clio-coder upgrade\``);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function validateRoute(issues, path, value, defaults, targets, options) {
|
|
666
|
+
const out = cloneValue(defaults);
|
|
667
|
+
if (!isPlainObject(value)) {
|
|
668
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
669
|
+
return out;
|
|
670
|
+
}
|
|
671
|
+
const allowNode = options?.nodeIds !== void 0;
|
|
672
|
+
issues.unknownKeys(
|
|
673
|
+
path,
|
|
674
|
+
value,
|
|
675
|
+
allowNode ? ["target", "model", "thinkingLevel", "node"] : ["target", "model", "thinkingLevel"]
|
|
676
|
+
);
|
|
677
|
+
if ("target" in value) {
|
|
678
|
+
if (value.target === null) out.target = null;
|
|
679
|
+
else {
|
|
680
|
+
const parsed = expectString(issues, `${path}.target`, value.target);
|
|
681
|
+
if (parsed !== void 0) out.target = targets.some((entry) => entry.id === parsed) ? parsed : null;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if ("model" in value) {
|
|
685
|
+
if (value.model === null) out.model = null;
|
|
686
|
+
else {
|
|
687
|
+
const parsed = expectString(issues, `${path}.model`, value.model);
|
|
688
|
+
if (parsed !== void 0) out.model = parsed;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if ("thinkingLevel" in value) {
|
|
692
|
+
const parsed = expectEnum(issues, `${path}.thinkingLevel`, value.thinkingLevel, THINKING_LEVELS);
|
|
693
|
+
if (parsed !== void 0) out.thinkingLevel = parsed;
|
|
694
|
+
}
|
|
695
|
+
if (allowNode && "node" in value) {
|
|
696
|
+
if (value.node === null) delete out.node;
|
|
697
|
+
else {
|
|
698
|
+
const parsed = expectString(issues, `${path}.node`, value.node);
|
|
699
|
+
if (parsed !== void 0 && (parsed === "local" || options.nodeIds?.has(parsed) === true)) out.node = parsed;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
if (!out.target) out.model = null;
|
|
703
|
+
else if (out.model === null) out.model = targets.find((entry) => entry.id === out.target)?.defaultModel ?? null;
|
|
704
|
+
return out;
|
|
705
|
+
}
|
|
706
|
+
function normalizeModelRefs(refs, targets) {
|
|
707
|
+
const targetIds = new Set(targets.map((target) => target.id));
|
|
708
|
+
return refs.filter((ref) => {
|
|
709
|
+
const [targetId, ...model] = ref.split("/");
|
|
710
|
+
return Boolean(targetId && targetIds.has(targetId) && model.join("/").trim());
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function normalizeCycleSet(refs) {
|
|
714
|
+
return refs.filter((ref) => Boolean(ref.trim().split("/")[0]));
|
|
715
|
+
}
|
|
716
|
+
function validateExternalAgent(issues, path, value, defaults, seen) {
|
|
717
|
+
if (!isPlainObject(value)) {
|
|
718
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
719
|
+
return null;
|
|
720
|
+
}
|
|
721
|
+
issues.unknownKeys(path, value, [
|
|
722
|
+
"id",
|
|
723
|
+
"command",
|
|
724
|
+
"args",
|
|
725
|
+
"cwd",
|
|
726
|
+
"env",
|
|
727
|
+
"connectTimeoutMs",
|
|
728
|
+
"turnTimeoutMs",
|
|
729
|
+
"permissionTimeoutMs",
|
|
730
|
+
"stallTimeoutMs",
|
|
731
|
+
"toolGovernance",
|
|
732
|
+
"projectContext",
|
|
733
|
+
"labels"
|
|
734
|
+
]);
|
|
735
|
+
const id = "id" in value ? expectString(issues, `${path}.id`, value.id) : void 0;
|
|
736
|
+
const command = "command" in value ? expectString(issues, `${path}.command`, value.command) : void 0;
|
|
737
|
+
if (!("id" in value)) issues.add(`${path}.id`, "required");
|
|
738
|
+
if (!("command" in value)) issues.add(`${path}.command`, "required");
|
|
739
|
+
if (id === void 0 || command === void 0) return null;
|
|
740
|
+
if (id === "auto") {
|
|
741
|
+
issues.add(`${path}.id`, "'auto' is reserved for coordinator-owned agent selection");
|
|
742
|
+
return null;
|
|
743
|
+
}
|
|
744
|
+
if (seen.has(id)) {
|
|
745
|
+
issues.add(`${path}.id`, `duplicate external agent id '${id}'`);
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
seen.add(id);
|
|
749
|
+
const agent = {
|
|
750
|
+
id,
|
|
751
|
+
command,
|
|
752
|
+
args: [],
|
|
753
|
+
connectTimeoutMs: defaults.connectTimeoutMs,
|
|
754
|
+
turnTimeoutMs: defaults.turnTimeoutMs,
|
|
755
|
+
permissionTimeoutMs: defaults.permissionTimeoutMs,
|
|
756
|
+
toolGovernance: defaults.toolGovernance
|
|
757
|
+
};
|
|
758
|
+
if ("args" in value) {
|
|
759
|
+
const parsed = expectStringArray(issues, `${path}.args`, value.args);
|
|
760
|
+
if (parsed !== void 0) agent.args = parsed;
|
|
761
|
+
}
|
|
762
|
+
for (const key of ["connectTimeoutMs", "turnTimeoutMs", "permissionTimeoutMs"]) {
|
|
763
|
+
if (!(key in value)) continue;
|
|
764
|
+
const parsed = expectInteger(issues, `${path}.${key}`, value[key], { min: 1, max: MAX_TIMER_DELAY_MS });
|
|
765
|
+
if (parsed !== void 0) agent[key] = parsed;
|
|
766
|
+
}
|
|
767
|
+
if ("stallTimeoutMs" in value) {
|
|
768
|
+
const parsed = expectInteger(issues, `${path}.stallTimeoutMs`, value.stallTimeoutMs);
|
|
769
|
+
if (parsed !== void 0) agent.stallTimeoutMs = parsed;
|
|
770
|
+
}
|
|
771
|
+
if ("toolGovernance" in value) {
|
|
772
|
+
const parsed = expectEnum(
|
|
773
|
+
issues,
|
|
774
|
+
`${path}.toolGovernance`,
|
|
775
|
+
normalizeLegacyNamingValue(value.toolGovernance, "clio-policy", "clio-coder-policy"),
|
|
776
|
+
TOOL_GOVERNANCE
|
|
777
|
+
);
|
|
778
|
+
if (parsed !== void 0) agent.toolGovernance = parsed;
|
|
779
|
+
}
|
|
780
|
+
if ("projectContext" in value) {
|
|
781
|
+
const parsed = expectEnum(issues, `${path}.projectContext`, value.projectContext, ["none", "bounded"]);
|
|
782
|
+
if (parsed !== void 0) agent.projectContext = parsed;
|
|
783
|
+
}
|
|
784
|
+
for (const key of ["cwd"]) {
|
|
785
|
+
if (!(key in value)) continue;
|
|
786
|
+
const parsed = expectString(issues, `${path}.${key}`, value[key]);
|
|
787
|
+
if (parsed !== void 0) agent[key] = parsed;
|
|
788
|
+
}
|
|
789
|
+
for (const key of ["env", "labels"]) {
|
|
790
|
+
if (!(key in value)) continue;
|
|
791
|
+
const parsed = expectStringRecord(issues, `${path}.${key}`, value[key]);
|
|
792
|
+
if (parsed !== void 0 && Object.keys(parsed).length > 0) agent[key] = parsed;
|
|
793
|
+
}
|
|
794
|
+
return agent;
|
|
795
|
+
}
|
|
796
|
+
function validateFleetNode(issues, path, value, seen) {
|
|
797
|
+
if (!isPlainObject(value)) {
|
|
798
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
799
|
+
return null;
|
|
800
|
+
}
|
|
801
|
+
issues.unknownKeys(path, value, [
|
|
802
|
+
"id",
|
|
803
|
+
"host",
|
|
804
|
+
"user",
|
|
805
|
+
"port",
|
|
806
|
+
"identityFile",
|
|
807
|
+
"clioCoderEntry",
|
|
808
|
+
"clioEntry",
|
|
809
|
+
"labels",
|
|
810
|
+
"maxWorkers",
|
|
811
|
+
"residency"
|
|
812
|
+
]);
|
|
813
|
+
const id = "id" in value ? expectString(issues, `${path}.id`, value.id) : void 0;
|
|
814
|
+
const host = "host" in value ? expectString(issues, `${path}.host`, value.host) : void 0;
|
|
815
|
+
if (!("id" in value)) issues.add(`${path}.id`, "required");
|
|
816
|
+
if (!("host" in value)) issues.add(`${path}.host`, "required");
|
|
817
|
+
if (id === void 0 || host === void 0) return null;
|
|
818
|
+
if (id === "local") {
|
|
819
|
+
issues.add(`${path}.id`, "'local' is reserved for the implicit local node");
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
if (seen.has(id)) {
|
|
823
|
+
issues.add(`${path}.id`, `duplicate fleet node id '${id}'`);
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
seen.add(id);
|
|
827
|
+
const node = { id, host, maxWorkers: 2 };
|
|
828
|
+
for (const key of ["user", "identityFile", "clioCoderEntry"]) {
|
|
829
|
+
if (!(key in value)) continue;
|
|
830
|
+
const parsed = expectString(issues, `${path}.${key}`, value[key]);
|
|
831
|
+
if (parsed !== void 0) node[key] = parsed;
|
|
832
|
+
}
|
|
833
|
+
if ("port" in value) {
|
|
834
|
+
const parsed = expectInteger(issues, `${path}.port`, value.port, { min: 1 });
|
|
835
|
+
if (parsed !== void 0) node.port = parsed;
|
|
836
|
+
}
|
|
837
|
+
if ("labels" in value) {
|
|
838
|
+
const parsed = expectStringArray(issues, `${path}.labels`, value.labels);
|
|
839
|
+
if (parsed !== void 0) node.labels = parsed;
|
|
840
|
+
}
|
|
841
|
+
if ("maxWorkers" in value) {
|
|
842
|
+
const parsed = expectInteger(issues, `${path}.maxWorkers`, value.maxWorkers, { min: 1 });
|
|
843
|
+
if (parsed !== void 0) node.maxWorkers = parsed;
|
|
844
|
+
}
|
|
845
|
+
if ("residency" in value) {
|
|
846
|
+
const parsed = expectEnum(issues, `${path}.residency`, value.residency, ["observe", "manage"]);
|
|
847
|
+
if (parsed !== void 0) node.residency = parsed;
|
|
848
|
+
}
|
|
849
|
+
return node;
|
|
850
|
+
}
|
|
851
|
+
function validateKeybindings(issues, path, value) {
|
|
852
|
+
if (!isPlainObject(value)) {
|
|
853
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
854
|
+
return {};
|
|
855
|
+
}
|
|
856
|
+
const next = {};
|
|
857
|
+
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
858
|
+
const legacyId = rawKey.trim();
|
|
859
|
+
const id = legacyId.startsWith("clio.") ? `clio-coder.${legacyId.slice("clio.".length)}` : legacyId;
|
|
860
|
+
if (!id) {
|
|
861
|
+
issues.add(path, "empty keybinding id");
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
if (id !== legacyId) {
|
|
865
|
+
warnLegacyNaming(legacyId, id);
|
|
866
|
+
if (Object.hasOwn(value, id)) continue;
|
|
867
|
+
}
|
|
868
|
+
if (typeof rawValue === "string") {
|
|
869
|
+
const parsed = expectString(issues, `${path}.${legacyId}`, rawValue);
|
|
870
|
+
if (parsed !== void 0) next[id] = parsed;
|
|
871
|
+
} else if (Array.isArray(rawValue)) {
|
|
872
|
+
const parsed = expectStringArray(issues, `${path}.${legacyId}`, rawValue);
|
|
873
|
+
if (parsed !== void 0 && parsed.length > 0) next[id] = parsed;
|
|
874
|
+
} else issues.add(`${path}.${legacyId}`, `expected a string or list of strings, got ${describe(rawValue)}`);
|
|
875
|
+
}
|
|
876
|
+
return next;
|
|
877
|
+
}
|
|
878
|
+
var TOP_LEVEL_KEYS = [
|
|
879
|
+
"version",
|
|
880
|
+
"targets",
|
|
881
|
+
"chat",
|
|
882
|
+
"fleet",
|
|
883
|
+
"context",
|
|
884
|
+
"safety",
|
|
885
|
+
"interface",
|
|
886
|
+
"integrations",
|
|
887
|
+
...V1_ONLY_ROOTS
|
|
888
|
+
];
|
|
889
|
+
function validateSettings(raw) {
|
|
890
|
+
const issues = new Issues();
|
|
891
|
+
const settings = cloneValue(DEFAULT_SETTINGS);
|
|
892
|
+
if (!isPlainObject(raw)) {
|
|
893
|
+
issues.add("(root)", `expected a map, got ${describe(raw)}`);
|
|
894
|
+
return { settings, issues: issues.list };
|
|
895
|
+
}
|
|
896
|
+
reportV1Tombstones(issues, raw);
|
|
897
|
+
issues.unknownKeys("", raw, TOP_LEVEL_KEYS);
|
|
898
|
+
if ("version" in raw && raw.version !== 2) {
|
|
899
|
+
issues.add("version", `expected 2, got ${describe(raw.version)}; run \`clio-coder upgrade\` for version 1`);
|
|
900
|
+
}
|
|
901
|
+
if ("targets" in raw) {
|
|
902
|
+
if (!Array.isArray(raw.targets)) issues.add("targets", `expected a list, got ${describe(raw.targets)}`);
|
|
903
|
+
else {
|
|
904
|
+
const seen = /* @__PURE__ */ new Set();
|
|
905
|
+
const targets = [];
|
|
906
|
+
for (let index = 0; index < raw.targets.length; index += 1) {
|
|
907
|
+
const target = validateTarget(issues, `targets[${index}]`, raw.targets[index]);
|
|
908
|
+
if (!target) continue;
|
|
909
|
+
if (seen.has(target.id)) {
|
|
910
|
+
issues.add(`targets[${index}].id`, `duplicate target id '${target.id}'`);
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
seen.add(target.id);
|
|
914
|
+
targets.push(target);
|
|
915
|
+
}
|
|
916
|
+
settings.targets = targets;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
if ("chat" in raw) {
|
|
920
|
+
if (!isPlainObject(raw.chat)) issues.add("chat", `expected a map, got ${describe(raw.chat)}`);
|
|
921
|
+
else {
|
|
922
|
+
const chat = raw.chat;
|
|
923
|
+
issues.unknownKeys("chat", chat, [
|
|
924
|
+
"target",
|
|
925
|
+
"model",
|
|
926
|
+
"thinkingLevel",
|
|
927
|
+
"modelPicker",
|
|
928
|
+
"maxOutputTokens",
|
|
929
|
+
"prewarm",
|
|
930
|
+
"retry"
|
|
931
|
+
]);
|
|
932
|
+
const routeInput = {};
|
|
933
|
+
for (const key of ["target", "model", "thinkingLevel"]) {
|
|
934
|
+
if (key in chat) routeInput[key] = chat[key];
|
|
935
|
+
}
|
|
936
|
+
const route = validateRoute(
|
|
937
|
+
issues,
|
|
938
|
+
"chat",
|
|
939
|
+
routeInput,
|
|
940
|
+
{ target: settings.chat.target, model: settings.chat.model, thinkingLevel: settings.chat.thinkingLevel },
|
|
941
|
+
settings.targets
|
|
942
|
+
);
|
|
943
|
+
settings.chat.target = route.target;
|
|
944
|
+
settings.chat.model = route.model;
|
|
945
|
+
settings.chat.thinkingLevel = route.thinkingLevel;
|
|
946
|
+
if ("modelPicker" in chat) {
|
|
947
|
+
if (!isPlainObject(chat.modelPicker))
|
|
948
|
+
issues.add("chat.modelPicker", `expected a map, got ${describe(chat.modelPicker)}`);
|
|
949
|
+
else {
|
|
950
|
+
issues.unknownKeys("chat.modelPicker", chat.modelPicker, ["cycleSet", "favorites", "recentLimit"]);
|
|
951
|
+
if ("cycleSet" in chat.modelPicker) {
|
|
952
|
+
const parsed = expectStringArray(issues, "chat.modelPicker.cycleSet", chat.modelPicker.cycleSet);
|
|
953
|
+
if (parsed !== void 0) settings.chat.modelPicker.cycleSet = normalizeCycleSet(parsed);
|
|
954
|
+
}
|
|
955
|
+
if ("favorites" in chat.modelPicker) {
|
|
956
|
+
const parsed = expectStringArray(issues, "chat.modelPicker.favorites", chat.modelPicker.favorites);
|
|
957
|
+
if (parsed !== void 0) settings.chat.modelPicker.favorites = normalizeModelRefs(parsed, settings.targets);
|
|
958
|
+
}
|
|
959
|
+
if ("recentLimit" in chat.modelPicker) {
|
|
960
|
+
const parsed = expectInteger(issues, "chat.modelPicker.recentLimit", chat.modelPicker.recentLimit, { min: 1 });
|
|
961
|
+
if (parsed !== void 0) settings.chat.modelPicker.recentLimit = parsed;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
if ("maxOutputTokens" in chat) {
|
|
966
|
+
const parsed = expectInteger(issues, "chat.maxOutputTokens", chat.maxOutputTokens, { min: 0 });
|
|
967
|
+
if (parsed !== void 0) settings.chat.maxOutputTokens = parsed;
|
|
968
|
+
}
|
|
969
|
+
if ("prewarm" in chat) {
|
|
970
|
+
const parsed = expectBoolean(issues, "chat.prewarm", chat.prewarm);
|
|
971
|
+
if (parsed !== void 0) settings.chat.prewarm = parsed;
|
|
972
|
+
}
|
|
973
|
+
if ("retry" in chat) {
|
|
974
|
+
if (!isPlainObject(chat.retry)) issues.add("chat.retry", `expected a map, got ${describe(chat.retry)}`);
|
|
975
|
+
else {
|
|
976
|
+
issues.unknownKeys("chat.retry", chat.retry, [
|
|
977
|
+
"enabled",
|
|
978
|
+
"maxRetries",
|
|
979
|
+
"baseDelayMs",
|
|
980
|
+
"maxDelayMs",
|
|
981
|
+
"streamStallMs"
|
|
982
|
+
]);
|
|
983
|
+
if ("enabled" in chat.retry) {
|
|
984
|
+
const parsed = expectBoolean(issues, "chat.retry.enabled", chat.retry.enabled);
|
|
985
|
+
if (parsed !== void 0) settings.chat.retry.enabled = parsed;
|
|
986
|
+
}
|
|
987
|
+
for (const key of ["maxRetries", "baseDelayMs", "maxDelayMs", "streamStallMs"]) {
|
|
988
|
+
if (!(key in chat.retry)) continue;
|
|
989
|
+
const parsed = expectInteger(issues, `chat.retry.${key}`, chat.retry[key], { min: 0 });
|
|
990
|
+
if (parsed !== void 0) settings.chat.retry[key] = parsed;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
let rawFleet = null;
|
|
997
|
+
if ("fleet" in raw) {
|
|
998
|
+
if (!isPlainObject(raw.fleet)) issues.add("fleet", `expected a map, got ${describe(raw.fleet)}`);
|
|
999
|
+
else {
|
|
1000
|
+
rawFleet = raw.fleet;
|
|
1001
|
+
issues.unknownKeys("fleet", rawFleet, [
|
|
1002
|
+
"default",
|
|
1003
|
+
"profiles",
|
|
1004
|
+
"rosters",
|
|
1005
|
+
"agentProfiles",
|
|
1006
|
+
"adaptiveRouting",
|
|
1007
|
+
"nodes",
|
|
1008
|
+
"permissions",
|
|
1009
|
+
"concurrency",
|
|
1010
|
+
"retry",
|
|
1011
|
+
"limits",
|
|
1012
|
+
"history"
|
|
1013
|
+
]);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
if (rawFleet && "nodes" in rawFleet) {
|
|
1017
|
+
if (!Array.isArray(rawFleet.nodes)) issues.add("fleet.nodes", `expected a list, got ${describe(rawFleet.nodes)}`);
|
|
1018
|
+
else {
|
|
1019
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1020
|
+
settings.fleet.nodes = rawFleet.nodes.map((entry, index) => validateFleetNode(issues, `fleet.nodes[${index}]`, entry, seen)).filter((entry) => entry !== null);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
const fleetNodeIds = new Set(settings.fleet.nodes.map((node) => node.id));
|
|
1024
|
+
if (rawFleet) {
|
|
1025
|
+
if ("default" in rawFleet) {
|
|
1026
|
+
settings.fleet.default = validateRoute(
|
|
1027
|
+
issues,
|
|
1028
|
+
"fleet.default",
|
|
1029
|
+
rawFleet.default,
|
|
1030
|
+
settings.fleet.default,
|
|
1031
|
+
settings.targets,
|
|
1032
|
+
{
|
|
1033
|
+
nodeIds: fleetNodeIds
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
if ("profiles" in rawFleet) {
|
|
1038
|
+
if (!isPlainObject(rawFleet.profiles))
|
|
1039
|
+
issues.add("fleet.profiles", `expected a map, got ${describe(rawFleet.profiles)}`);
|
|
1040
|
+
else {
|
|
1041
|
+
const profiles = {};
|
|
1042
|
+
for (const [rawName, rawProfile] of Object.entries(rawFleet.profiles)) {
|
|
1043
|
+
const name = rawName.trim();
|
|
1044
|
+
if (!name) {
|
|
1045
|
+
issues.add("fleet.profiles", "empty profile name");
|
|
1046
|
+
continue;
|
|
1047
|
+
}
|
|
1048
|
+
const profile = validateRoute(
|
|
1049
|
+
issues,
|
|
1050
|
+
`fleet.profiles.${name}`,
|
|
1051
|
+
rawProfile,
|
|
1052
|
+
DEFAULT_SETTINGS.fleet.default,
|
|
1053
|
+
settings.targets,
|
|
1054
|
+
{
|
|
1055
|
+
nodeIds: fleetNodeIds
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
if (profile.target) profiles[name] = profile;
|
|
1059
|
+
}
|
|
1060
|
+
settings.fleet.profiles = profiles;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
if ("rosters" in rawFleet) {
|
|
1064
|
+
if (!isPlainObject(rawFleet.rosters))
|
|
1065
|
+
issues.add("fleet.rosters", `expected a map, got ${describe(rawFleet.rosters)}`);
|
|
1066
|
+
else {
|
|
1067
|
+
const rosters = {};
|
|
1068
|
+
for (const [rawName, rawRoster] of Object.entries(rawFleet.rosters)) {
|
|
1069
|
+
const name = rawName.trim();
|
|
1070
|
+
const path = `fleet.rosters.${name}`;
|
|
1071
|
+
if (!name) {
|
|
1072
|
+
issues.add("fleet.rosters", "empty roster name");
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (!isPlainObject(rawRoster)) {
|
|
1076
|
+
issues.add(path, `expected a map, got ${describe(rawRoster)}`);
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
issues.unknownKeys(path, rawRoster, ["members"]);
|
|
1080
|
+
if (!Array.isArray(rawRoster.members)) {
|
|
1081
|
+
issues.add(`${path}.members`, "expected a list");
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
if (rawRoster.members.length < 2 || rawRoster.members.length > 5)
|
|
1085
|
+
issues.add(`${path}.members`, "expected 2 to 5 members");
|
|
1086
|
+
const members = [];
|
|
1087
|
+
const labels = /* @__PURE__ */ new Set();
|
|
1088
|
+
for (const [index, rawMember] of rawRoster.members.entries()) {
|
|
1089
|
+
const memberPath = `${path}.members[${index}]`;
|
|
1090
|
+
if (!isPlainObject(rawMember)) {
|
|
1091
|
+
issues.add(memberPath, `expected a map, got ${describe(rawMember)}`);
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
issues.unknownKeys(memberPath, rawMember, ["label", "target", "model", "thinkingLevel", "color"]);
|
|
1095
|
+
const label = expectString(issues, `${memberPath}.label`, rawMember.label);
|
|
1096
|
+
const target = expectString(issues, `${memberPath}.target`, rawMember.target);
|
|
1097
|
+
if (label !== void 0 && !COUNCIL_MEMBER_LABEL_PATTERN.test(label))
|
|
1098
|
+
issues.add(`${memberPath}.label`, "expected [a-z][a-z0-9_-]{0,31}");
|
|
1099
|
+
if (label !== void 0 && labels.has(label)) issues.add(`${memberPath}.label`, "duplicate label");
|
|
1100
|
+
if (label !== void 0) labels.add(label);
|
|
1101
|
+
if (target !== void 0 && !settings.targets.some((entry) => entry.id === target))
|
|
1102
|
+
issues.add(`${memberPath}.target`, `unknown target '${target}'`);
|
|
1103
|
+
const model = rawMember.model === void 0 ? void 0 : expectString(issues, `${memberPath}.model`, rawMember.model);
|
|
1104
|
+
const thinkingLevel = rawMember.thinkingLevel === void 0 ? void 0 : expectEnum(issues, `${memberPath}.thinkingLevel`, rawMember.thinkingLevel, THINKING_LEVELS);
|
|
1105
|
+
const color = rawMember.color === void 0 ? void 0 : expectString(issues, `${memberPath}.color`, rawMember.color);
|
|
1106
|
+
if (color !== void 0 && !THEME_NAMED_COLORS.includes(color) && !/^#[0-9a-fA-F]{6}$/u.test(color)) {
|
|
1107
|
+
issues.add(`${memberPath}.color`, "expected a theme named color or 6-digit hex color");
|
|
1108
|
+
}
|
|
1109
|
+
if (label === void 0 || target === void 0) continue;
|
|
1110
|
+
members.push({
|
|
1111
|
+
label,
|
|
1112
|
+
target,
|
|
1113
|
+
...model ? { model } : {},
|
|
1114
|
+
...thinkingLevel ? { thinkingLevel } : {},
|
|
1115
|
+
...color ? { color } : {}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
if (rawRoster.members.length >= 2 && rawRoster.members.length <= 5 && members.length === rawRoster.members.length)
|
|
1119
|
+
rosters[name] = { members };
|
|
1120
|
+
}
|
|
1121
|
+
settings.fleet.rosters = rosters;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
if ("agentProfiles" in rawFleet) {
|
|
1125
|
+
if (!isPlainObject(rawFleet.agentProfiles))
|
|
1126
|
+
issues.add("fleet.agentProfiles", `expected a map, got ${describe(rawFleet.agentProfiles)}`);
|
|
1127
|
+
else {
|
|
1128
|
+
const bindings = {};
|
|
1129
|
+
for (const [rawAgentId, rawProfileName] of Object.entries(rawFleet.agentProfiles)) {
|
|
1130
|
+
const agentId = rawAgentId.trim();
|
|
1131
|
+
if (!agentId) {
|
|
1132
|
+
issues.add("fleet.agentProfiles", "empty agent id");
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
if (agentId === "auto") {
|
|
1136
|
+
issues.add("fleet.agentProfiles", "'auto' is reserved for coordinator-owned agent selection");
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
const profile = expectString(issues, `fleet.agentProfiles.${agentId}`, rawProfileName);
|
|
1140
|
+
if (profile !== void 0) bindings[agentId] = profile;
|
|
1141
|
+
}
|
|
1142
|
+
settings.fleet.agentProfiles = bindings;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
if ("adaptiveRouting" in rawFleet) {
|
|
1146
|
+
if (!isPlainObject(rawFleet.adaptiveRouting))
|
|
1147
|
+
issues.add("fleet.adaptiveRouting", `expected a map, got ${describe(rawFleet.adaptiveRouting)}`);
|
|
1148
|
+
else {
|
|
1149
|
+
const adaptive = rawFleet.adaptiveRouting;
|
|
1150
|
+
issues.unknownKeys("fleet.adaptiveRouting", adaptive, ["roles", "postures", "agentRoles"]);
|
|
1151
|
+
for (const [key, allowed] of [
|
|
1152
|
+
["roles", ACTIVE_ROUTING_ROLES],
|
|
1153
|
+
["postures", ACTIVE_ROUTING_POSTURES]
|
|
1154
|
+
]) {
|
|
1155
|
+
if (!(key in adaptive)) continue;
|
|
1156
|
+
const parsed = expectStringArray(issues, `fleet.adaptiveRouting.${key}`, adaptive[key]);
|
|
1157
|
+
if (parsed === void 0) continue;
|
|
1158
|
+
const allowedSet = new Set(allowed);
|
|
1159
|
+
for (const value of parsed)
|
|
1160
|
+
if (!allowedSet.has(value))
|
|
1161
|
+
issues.add(`fleet.adaptiveRouting.${key}`, `unsupported ${key === "roles" ? "role" : "posture"} '${value}'`);
|
|
1162
|
+
if (parsed.every((value) => allowedSet.has(value))) settings.fleet.adaptiveRouting[key] = parsed;
|
|
1163
|
+
}
|
|
1164
|
+
if ("agentRoles" in adaptive) {
|
|
1165
|
+
if (!Array.isArray(adaptive.agentRoles)) issues.add("fleet.adaptiveRouting.agentRoles", "expected a list");
|
|
1166
|
+
else {
|
|
1167
|
+
const pairs = [];
|
|
1168
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1169
|
+
for (const [index, value] of adaptive.agentRoles.entries()) {
|
|
1170
|
+
const path = `fleet.adaptiveRouting.agentRoles[${index}]`;
|
|
1171
|
+
if (!isPlainObject(value)) {
|
|
1172
|
+
issues.add(path, "expected a map");
|
|
1173
|
+
continue;
|
|
1174
|
+
}
|
|
1175
|
+
issues.unknownKeys(path, value, ["agentId", "executionRole"]);
|
|
1176
|
+
const agentId = expectString(issues, `${path}.agentId`, value.agentId);
|
|
1177
|
+
const executionRole = expectEnum(
|
|
1178
|
+
issues,
|
|
1179
|
+
`${path}.executionRole`,
|
|
1180
|
+
value.executionRole,
|
|
1181
|
+
ACTIVE_AGENT_AUTOMATION_ROLES
|
|
1182
|
+
);
|
|
1183
|
+
if (agentId === "auto")
|
|
1184
|
+
issues.add(`${path}.agentId`, "'auto' is reserved for coordinator-owned agent selection");
|
|
1185
|
+
if (agentId === void 0 || agentId === "auto" || executionRole === void 0) continue;
|
|
1186
|
+
const pairKey = `${agentId}\0${executionRole}`;
|
|
1187
|
+
if (seen.has(pairKey)) {
|
|
1188
|
+
issues.add(path, "duplicate agent and execution-role pair");
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
seen.add(pairKey);
|
|
1192
|
+
pairs.push({ agentId, executionRole });
|
|
1193
|
+
}
|
|
1194
|
+
if (pairs.length === adaptive.agentRoles.length) settings.fleet.adaptiveRouting.agentRoles = pairs;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
if ("permissions" in rawFleet) {
|
|
1200
|
+
if (!isPlainObject(rawFleet.permissions))
|
|
1201
|
+
issues.add("fleet.permissions", `expected a map, got ${describe(rawFleet.permissions)}`);
|
|
1202
|
+
else {
|
|
1203
|
+
issues.unknownKeys("fleet.permissions", rawFleet.permissions, ["mode", "escalation"]);
|
|
1204
|
+
if ("mode" in rawFleet.permissions) {
|
|
1205
|
+
const parsed = expectEnum(issues, "fleet.permissions.mode", rawFleet.permissions.mode, [
|
|
1206
|
+
"deny",
|
|
1207
|
+
"fail",
|
|
1208
|
+
"escalate"
|
|
1209
|
+
]);
|
|
1210
|
+
if (parsed !== void 0) settings.fleet.permissions.mode = parsed;
|
|
1211
|
+
}
|
|
1212
|
+
if ("escalation" in rawFleet.permissions) {
|
|
1213
|
+
if (!isPlainObject(rawFleet.permissions.escalation))
|
|
1214
|
+
issues.add("fleet.permissions.escalation", `expected a map, got ${describe(rawFleet.permissions.escalation)}`);
|
|
1215
|
+
else {
|
|
1216
|
+
const escalation = rawFleet.permissions.escalation;
|
|
1217
|
+
issues.unknownKeys("fleet.permissions.escalation", escalation, ["timeoutMs", "fallback"]);
|
|
1218
|
+
if ("timeoutMs" in escalation) {
|
|
1219
|
+
const parsed = expectInteger(issues, "fleet.permissions.escalation.timeoutMs", escalation.timeoutMs, { min: 1 });
|
|
1220
|
+
if (parsed !== void 0) settings.fleet.permissions.escalation.timeoutMs = parsed;
|
|
1221
|
+
}
|
|
1222
|
+
if ("fallback" in escalation) {
|
|
1223
|
+
const parsed = expectEnum(issues, "fleet.permissions.escalation.fallback", escalation.fallback, [
|
|
1224
|
+
"deny",
|
|
1225
|
+
"fail"
|
|
1226
|
+
]);
|
|
1227
|
+
if (parsed !== void 0) settings.fleet.permissions.escalation.fallback = parsed;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if ("concurrency" in rawFleet) {
|
|
1234
|
+
if (rawFleet.concurrency === "auto") settings.fleet.concurrency = "auto";
|
|
1235
|
+
else {
|
|
1236
|
+
const parsed = expectInteger(issues, "fleet.concurrency", rawFleet.concurrency, { min: 1 });
|
|
1237
|
+
if (parsed !== void 0) settings.fleet.concurrency = parsed;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
for (const [blockName, fields] of [
|
|
1241
|
+
[
|
|
1242
|
+
"retry",
|
|
1243
|
+
[
|
|
1244
|
+
["maxRetries", 0],
|
|
1245
|
+
["routeCooldownMs", 0]
|
|
1246
|
+
]
|
|
1247
|
+
],
|
|
1248
|
+
[
|
|
1249
|
+
"limits",
|
|
1250
|
+
[
|
|
1251
|
+
["toolCallsPerRun", 1],
|
|
1252
|
+
["internalRunTimeoutMs", 1]
|
|
1253
|
+
]
|
|
1254
|
+
],
|
|
1255
|
+
["history", [["maxRuns", 1]]]
|
|
1256
|
+
]) {
|
|
1257
|
+
if (!(blockName in rawFleet)) continue;
|
|
1258
|
+
const block = rawFleet[blockName];
|
|
1259
|
+
if (!isPlainObject(block)) {
|
|
1260
|
+
issues.add(`fleet.${blockName}`, `expected a map, got ${describe(block)}`);
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
const known = fields.map(([key]) => key);
|
|
1264
|
+
if (blockName === "history") known.push("journal");
|
|
1265
|
+
issues.unknownKeys(`fleet.${blockName}`, block, known);
|
|
1266
|
+
for (const [key, min] of fields) {
|
|
1267
|
+
if (!(key in block)) continue;
|
|
1268
|
+
const parsed = expectInteger(issues, `fleet.${blockName}.${key}`, block[key], { min });
|
|
1269
|
+
if (parsed !== void 0) settings.fleet[blockName][key] = parsed;
|
|
1270
|
+
}
|
|
1271
|
+
if (blockName === "history" && "journal" in block) {
|
|
1272
|
+
const parsed = expectBoolean(issues, "fleet.history.journal", block.journal);
|
|
1273
|
+
if (parsed !== void 0) settings.fleet.history.journal = parsed;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
if ("context" in raw) {
|
|
1278
|
+
if (!isPlainObject(raw.context)) issues.add("context", `expected a map, got ${describe(raw.context)}`);
|
|
1279
|
+
else {
|
|
1280
|
+
const context = raw.context;
|
|
1281
|
+
issues.unknownKeys("context", context, ["workingSet", "compaction", "memory"]);
|
|
1282
|
+
if ("workingSet" in context) {
|
|
1283
|
+
if (!isPlainObject(context.workingSet))
|
|
1284
|
+
issues.add("context.workingSet", `expected a map, got ${describe(context.workingSet)}`);
|
|
1285
|
+
else {
|
|
1286
|
+
const workingSet = context.workingSet;
|
|
1287
|
+
issues.unknownKeys("context.workingSet", workingSet, [
|
|
1288
|
+
"enabled",
|
|
1289
|
+
"policy",
|
|
1290
|
+
"target",
|
|
1291
|
+
"protectLastTurns",
|
|
1292
|
+
"minEvictableTokens"
|
|
1293
|
+
]);
|
|
1294
|
+
if ("enabled" in workingSet) {
|
|
1295
|
+
const parsed = expectBoolean(issues, "context.workingSet.enabled", workingSet.enabled);
|
|
1296
|
+
if (parsed !== void 0) settings.context.workingSet.enabled = parsed;
|
|
1297
|
+
}
|
|
1298
|
+
if ("policy" in workingSet) {
|
|
1299
|
+
const parsed = expectEnum(issues, "context.workingSet.policy", workingSet.policy, [
|
|
1300
|
+
"age-horizon",
|
|
1301
|
+
"structural-v1"
|
|
1302
|
+
]);
|
|
1303
|
+
if (parsed !== void 0) settings.context.workingSet.policy = parsed;
|
|
1304
|
+
}
|
|
1305
|
+
if ("target" in workingSet) {
|
|
1306
|
+
const parsed = expectNumber(issues, "context.workingSet.target", workingSet.target);
|
|
1307
|
+
if (parsed !== void 0 && (parsed <= 0 || parsed >= 1))
|
|
1308
|
+
issues.add("context.workingSet.target", `expected a number > 0 and < 1, got ${parsed}`);
|
|
1309
|
+
else if (parsed !== void 0) settings.context.workingSet.target = parsed;
|
|
1310
|
+
}
|
|
1311
|
+
for (const [key, min] of [
|
|
1312
|
+
["protectLastTurns", 1],
|
|
1313
|
+
["minEvictableTokens", 0]
|
|
1314
|
+
]) {
|
|
1315
|
+
if (!(key in workingSet)) continue;
|
|
1316
|
+
const parsed = expectInteger(issues, `context.workingSet.${key}`, workingSet[key], { min });
|
|
1317
|
+
if (parsed !== void 0) settings.context.workingSet[key] = parsed;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
if ("compaction" in context) {
|
|
1322
|
+
if (!isPlainObject(context.compaction))
|
|
1323
|
+
issues.add("context.compaction", `expected a map, got ${describe(context.compaction)}`);
|
|
1324
|
+
else {
|
|
1325
|
+
const compaction = context.compaction;
|
|
1326
|
+
issues.unknownKeys("context.compaction", compaction, [
|
|
1327
|
+
"auto",
|
|
1328
|
+
"threshold",
|
|
1329
|
+
"model",
|
|
1330
|
+
"systemPrompt",
|
|
1331
|
+
"excludeLastTurns"
|
|
1332
|
+
]);
|
|
1333
|
+
if ("excludeLastTurns" in compaction)
|
|
1334
|
+
issues.add(
|
|
1335
|
+
"context.compaction.excludeLastTurns",
|
|
1336
|
+
"retired without replacement; use context.workingSet.protectLastTurns"
|
|
1337
|
+
);
|
|
1338
|
+
if ("auto" in compaction) {
|
|
1339
|
+
const parsed = expectBoolean(issues, "context.compaction.auto", compaction.auto);
|
|
1340
|
+
if (parsed !== void 0) settings.context.compaction.auto = parsed;
|
|
1341
|
+
}
|
|
1342
|
+
if ("threshold" in compaction) {
|
|
1343
|
+
const parsed = expectNumber(issues, "context.compaction.threshold", compaction.threshold, { min: 0, max: 1 });
|
|
1344
|
+
if (parsed !== void 0) settings.context.compaction.threshold = parsed;
|
|
1345
|
+
}
|
|
1346
|
+
for (const key of ["model", "systemPrompt"]) {
|
|
1347
|
+
if (!(key in compaction)) continue;
|
|
1348
|
+
const parsed = expectString(issues, `context.compaction.${key}`, compaction[key]);
|
|
1349
|
+
if (parsed !== void 0) settings.context.compaction[key] = parsed;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
if ("memory" in context) {
|
|
1354
|
+
if (!isPlainObject(context.memory)) issues.add("context.memory", `expected a map, got ${describe(context.memory)}`);
|
|
1355
|
+
else {
|
|
1356
|
+
const memory = context.memory;
|
|
1357
|
+
issues.unknownKeys("context.memory", memory, [
|
|
1358
|
+
"enabled",
|
|
1359
|
+
"target",
|
|
1360
|
+
"model",
|
|
1361
|
+
"cadenceToolCalls",
|
|
1362
|
+
"trajectorySteps",
|
|
1363
|
+
"maxOutputTokens",
|
|
1364
|
+
"timeoutMs"
|
|
1365
|
+
]);
|
|
1366
|
+
if ("enabled" in memory) {
|
|
1367
|
+
const parsed = expectBoolean(issues, "context.memory.enabled", memory.enabled);
|
|
1368
|
+
if (parsed !== void 0) settings.context.memory.enabled = parsed;
|
|
1369
|
+
}
|
|
1370
|
+
if ("target" in memory) {
|
|
1371
|
+
if (memory.target === null) settings.context.memory.target = null;
|
|
1372
|
+
else {
|
|
1373
|
+
const parsed = expectString(issues, "context.memory.target", memory.target);
|
|
1374
|
+
if (parsed !== void 0)
|
|
1375
|
+
settings.context.memory.target = settings.targets.some((target) => target.id === parsed) ? parsed : null;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
if ("model" in memory) {
|
|
1379
|
+
if (memory.model === null) settings.context.memory.model = null;
|
|
1380
|
+
else {
|
|
1381
|
+
const parsed = expectString(issues, "context.memory.model", memory.model);
|
|
1382
|
+
if (parsed !== void 0) settings.context.memory.model = parsed;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
if (!settings.context.memory.target) settings.context.memory.model = null;
|
|
1386
|
+
else if (settings.context.memory.model === null)
|
|
1387
|
+
settings.context.memory.model = settings.targets.find((target) => target.id === settings.context.memory.target)?.defaultModel ?? null;
|
|
1388
|
+
for (const [key, min] of [
|
|
1389
|
+
["cadenceToolCalls", 2],
|
|
1390
|
+
["trajectorySteps", 1],
|
|
1391
|
+
["maxOutputTokens", 1],
|
|
1392
|
+
["timeoutMs", 1]
|
|
1393
|
+
]) {
|
|
1394
|
+
if (!(key in memory)) continue;
|
|
1395
|
+
const parsed = expectInteger(issues, `context.memory.${key}`, memory[key], { min });
|
|
1396
|
+
if (parsed !== void 0) settings.context.memory[key] = parsed;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
if ("safety" in raw) {
|
|
1403
|
+
if (!isPlainObject(raw.safety)) issues.add("safety", `expected a map, got ${describe(raw.safety)}`);
|
|
1404
|
+
else {
|
|
1405
|
+
const safety = raw.safety;
|
|
1406
|
+
issues.unknownKeys("safety", safety, ["autonomy", "limits", "review"]);
|
|
1407
|
+
if ("autonomy" in safety) {
|
|
1408
|
+
const parsed = expectEnum(issues, "safety.autonomy", safety.autonomy, AUTONOMY_LEVELS);
|
|
1409
|
+
if (parsed !== void 0) settings.safety.autonomy = parsed;
|
|
1410
|
+
}
|
|
1411
|
+
if ("limits" in safety) {
|
|
1412
|
+
if (!isPlainObject(safety.limits)) issues.add("safety.limits", `expected a map, got ${describe(safety.limits)}`);
|
|
1413
|
+
else {
|
|
1414
|
+
const limits = safety.limits;
|
|
1415
|
+
issues.unknownKeys("safety.limits", limits, [
|
|
1416
|
+
"sessionCostUsd",
|
|
1417
|
+
"chatToolCallsPerTurn",
|
|
1418
|
+
"readBytesPerCall",
|
|
1419
|
+
"observationBytesPerTurn"
|
|
1420
|
+
]);
|
|
1421
|
+
if ("sessionCostUsd" in limits) {
|
|
1422
|
+
const parsed = expectNumber(issues, "safety.limits.sessionCostUsd", limits.sessionCostUsd, { min: 0 });
|
|
1423
|
+
if (parsed !== void 0) settings.safety.limits.sessionCostUsd = parsed;
|
|
1424
|
+
}
|
|
1425
|
+
for (const key of ["chatToolCallsPerTurn", "readBytesPerCall", "observationBytesPerTurn"]) {
|
|
1426
|
+
if (!(key in limits)) continue;
|
|
1427
|
+
const parsed = expectInteger(issues, `safety.limits.${key}`, limits[key], { min: 1 });
|
|
1428
|
+
if (parsed !== void 0) settings.safety.limits[key] = parsed;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
if ("review" in safety) {
|
|
1433
|
+
if (!isPlainObject(safety.review)) issues.add("safety.review", `expected a map, got ${describe(safety.review)}`);
|
|
1434
|
+
else {
|
|
1435
|
+
const review = safety.review;
|
|
1436
|
+
issues.unknownKeys("safety.review", review, ["enabled", "target", "cadenceToolCalls"]);
|
|
1437
|
+
if ("enabled" in review) {
|
|
1438
|
+
const parsed = expectBoolean(issues, "safety.review.enabled", review.enabled);
|
|
1439
|
+
if (parsed !== void 0) settings.safety.review.enabled = parsed;
|
|
1440
|
+
}
|
|
1441
|
+
if ("target" in review && review.target !== null) {
|
|
1442
|
+
const parsed = expectString(issues, "safety.review.target", review.target);
|
|
1443
|
+
if (parsed !== void 0 && settings.targets.some((target) => target.id === parsed))
|
|
1444
|
+
settings.safety.review.target = parsed;
|
|
1445
|
+
else if (parsed !== void 0) issues.add("safety.review.target", `unknown target '${parsed}'`);
|
|
1446
|
+
}
|
|
1447
|
+
if ("cadenceToolCalls" in review && review.cadenceToolCalls !== null) {
|
|
1448
|
+
const parsed = expectInteger(issues, "safety.review.cadenceToolCalls", review.cadenceToolCalls, { min: 1 });
|
|
1449
|
+
if (parsed !== void 0) settings.safety.review.cadenceToolCalls = parsed;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
if ("interface" in raw) {
|
|
1456
|
+
if (!isPlainObject(raw.interface)) issues.add("interface", `expected a map, got ${describe(raw.interface)}`);
|
|
1457
|
+
else {
|
|
1458
|
+
const ui = raw.interface;
|
|
1459
|
+
issues.unknownKeys("interface", ui, [
|
|
1460
|
+
"outputDetail",
|
|
1461
|
+
"smoothStreaming",
|
|
1462
|
+
"mode",
|
|
1463
|
+
"fullscreenScrollbar",
|
|
1464
|
+
"terminalProgress",
|
|
1465
|
+
"desktopNotifications",
|
|
1466
|
+
"panes",
|
|
1467
|
+
"keybindings"
|
|
1468
|
+
]);
|
|
1469
|
+
for (const key of ["terminalProgress", "desktopNotifications"]) {
|
|
1470
|
+
if (!(key in ui)) continue;
|
|
1471
|
+
const parsed = expectBoolean(issues, `interface.${key}`, ui[key]);
|
|
1472
|
+
if (parsed !== void 0) settings.interface[key] = parsed;
|
|
1473
|
+
}
|
|
1474
|
+
for (const [key, allowed] of [
|
|
1475
|
+
["outputDetail", ["minimal", "default", "verbose"]],
|
|
1476
|
+
["smoothStreaming", ["off", "auto", "on"]],
|
|
1477
|
+
["mode", ["regular", "fullscreen"]],
|
|
1478
|
+
["fullscreenScrollbar", ["hidden", "auto", "always"]]
|
|
1479
|
+
]) {
|
|
1480
|
+
if (!(key in ui)) continue;
|
|
1481
|
+
const parsed = expectEnum(issues, `interface.${key}`, ui[key], allowed);
|
|
1482
|
+
if (parsed !== void 0) settings.interface[key] = parsed;
|
|
1483
|
+
}
|
|
1484
|
+
if ("panes" in ui) {
|
|
1485
|
+
if (!isPlainObject(ui.panes)) issues.add("interface.panes", `expected a map, got ${describe(ui.panes)}`);
|
|
1486
|
+
else {
|
|
1487
|
+
const panes = ui.panes;
|
|
1488
|
+
issues.unknownKeys("interface.panes", panes, ["enabled", "notifications", "layout", "workers", "files"]);
|
|
1489
|
+
if ("enabled" in panes) {
|
|
1490
|
+
const parsed = expectEnum(issues, "interface.panes.enabled", panes.enabled, ["auto", "embedded", "off"]);
|
|
1491
|
+
if (parsed !== void 0) settings.interface.panes.enabled = parsed;
|
|
1492
|
+
}
|
|
1493
|
+
if ("notifications" in panes) {
|
|
1494
|
+
const parsed = expectEnum(issues, "interface.panes.notifications", panes.notifications, [
|
|
1495
|
+
"failures",
|
|
1496
|
+
"all",
|
|
1497
|
+
"off"
|
|
1498
|
+
]);
|
|
1499
|
+
if (parsed !== void 0) settings.interface.panes.notifications = parsed;
|
|
1500
|
+
}
|
|
1501
|
+
if ("layout" in panes) {
|
|
1502
|
+
const parsed = expectEnum(issues, "interface.panes.layout", panes.layout, ["off", "workers", "cockpit"]);
|
|
1503
|
+
if (parsed !== void 0) settings.interface.panes.layout = parsed;
|
|
1504
|
+
}
|
|
1505
|
+
if ("workers" in panes) {
|
|
1506
|
+
if (!isPlainObject(panes.workers))
|
|
1507
|
+
issues.add("interface.panes.workers", `expected a map, got ${describe(panes.workers)}`);
|
|
1508
|
+
else {
|
|
1509
|
+
const workers = panes.workers;
|
|
1510
|
+
issues.unknownKeys("interface.panes.workers", workers, ["ratio"]);
|
|
1511
|
+
if ("ratio" in workers) {
|
|
1512
|
+
const parsed = expectNumber(issues, "interface.panes.workers.ratio", workers.ratio, {
|
|
1513
|
+
min: 0.05,
|
|
1514
|
+
max: 0.5
|
|
1515
|
+
});
|
|
1516
|
+
if (parsed !== void 0) settings.interface.panes.workers.ratio = parsed;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if ("files" in panes) {
|
|
1521
|
+
if (!isPlainObject(panes.files))
|
|
1522
|
+
issues.add("interface.panes.files", `expected a map, got ${describe(panes.files)}`);
|
|
1523
|
+
else {
|
|
1524
|
+
const files = panes.files;
|
|
1525
|
+
issues.unknownKeys("interface.panes.files", files, ["enabled", "mode", "profile", "followCwd", "ratio"]);
|
|
1526
|
+
for (const key of ["enabled", "followCwd"]) {
|
|
1527
|
+
if (!(key in files)) continue;
|
|
1528
|
+
const parsed = expectBoolean(issues, `interface.panes.files.${key}`, files[key]);
|
|
1529
|
+
if (parsed !== void 0) settings.interface.panes.files[key] = parsed;
|
|
1530
|
+
}
|
|
1531
|
+
if ("mode" in files) {
|
|
1532
|
+
const parsed = expectEnum(issues, "interface.panes.files.mode", files.mode, ["companion", "chooser"]);
|
|
1533
|
+
if (parsed !== void 0) settings.interface.panes.files.mode = parsed;
|
|
1534
|
+
}
|
|
1535
|
+
if ("profile" in files) {
|
|
1536
|
+
const parsed = expectEnum(issues, "interface.panes.files.profile", files.profile, ["managed", "user"]);
|
|
1537
|
+
if (parsed !== void 0) settings.interface.panes.files.profile = parsed;
|
|
1538
|
+
}
|
|
1539
|
+
if ("ratio" in files) {
|
|
1540
|
+
const parsed = expectNumber(issues, "interface.panes.files.ratio", files.ratio, { min: 0.05, max: 0.5 });
|
|
1541
|
+
if (parsed !== void 0) settings.interface.panes.files.ratio = parsed;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if ("keybindings" in ui)
|
|
1548
|
+
settings.interface.keybindings = validateKeybindings(issues, "interface.keybindings", ui.keybindings);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
if ("integrations" in raw) {
|
|
1552
|
+
if (!isPlainObject(raw.integrations)) issues.add("integrations", `expected a map, got ${describe(raw.integrations)}`);
|
|
1553
|
+
else {
|
|
1554
|
+
const integrations = raw.integrations;
|
|
1555
|
+
issues.unknownKeys("integrations", integrations, [
|
|
1556
|
+
"projectResources",
|
|
1557
|
+
"externalAgents",
|
|
1558
|
+
"runtimePlugins",
|
|
1559
|
+
"library",
|
|
1560
|
+
"git"
|
|
1561
|
+
]);
|
|
1562
|
+
if ("projectResources" in integrations) {
|
|
1563
|
+
if (!isPlainObject(integrations.projectResources))
|
|
1564
|
+
issues.add("integrations.projectResources", `expected a map, got ${describe(integrations.projectResources)}`);
|
|
1565
|
+
else {
|
|
1566
|
+
issues.unknownKeys("integrations.projectResources", integrations.projectResources, ["trustProjectImports"]);
|
|
1567
|
+
if ("trustProjectImports" in integrations.projectResources) {
|
|
1568
|
+
const parsed = expectBoolean(
|
|
1569
|
+
issues,
|
|
1570
|
+
"integrations.projectResources.trustProjectImports",
|
|
1571
|
+
integrations.projectResources.trustProjectImports
|
|
1572
|
+
);
|
|
1573
|
+
if (parsed !== void 0) settings.integrations.projectResources.trustProjectImports = parsed;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
if ("runtimePlugins" in integrations) {
|
|
1578
|
+
const parsed = expectStringArray(issues, "integrations.runtimePlugins", integrations.runtimePlugins);
|
|
1579
|
+
if (parsed !== void 0) settings.integrations.runtimePlugins = parsed;
|
|
1580
|
+
}
|
|
1581
|
+
if ("library" in integrations) {
|
|
1582
|
+
if (!isPlainObject(integrations.library))
|
|
1583
|
+
issues.add("integrations.library", `expected a map, got ${describe(integrations.library)}`);
|
|
1584
|
+
else {
|
|
1585
|
+
const library = integrations.library;
|
|
1586
|
+
issues.unknownKeys("integrations.library", library, ["catalog", "remote", "confirmedRemote", "sync"]);
|
|
1587
|
+
for (const key of ["catalog", "remote", "confirmedRemote"]) {
|
|
1588
|
+
if (!(key in library)) continue;
|
|
1589
|
+
const value = library[key];
|
|
1590
|
+
if (value !== null && typeof value !== "string")
|
|
1591
|
+
issues.add(`integrations.library.${key}`, `expected a string or null, got ${describe(value)}`);
|
|
1592
|
+
else settings.integrations.library[key] = value;
|
|
1593
|
+
}
|
|
1594
|
+
if ("sync" in library) {
|
|
1595
|
+
const parsed = expectBoolean(issues, "integrations.library.sync", library.sync);
|
|
1596
|
+
if (parsed !== void 0) settings.integrations.library.sync = parsed;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
if ("git" in integrations) {
|
|
1601
|
+
if (!isPlainObject(integrations.git))
|
|
1602
|
+
issues.add("integrations.git", `expected a map, got ${describe(integrations.git)}`);
|
|
1603
|
+
else {
|
|
1604
|
+
issues.unknownKeys("integrations.git", integrations.git, ["commitAttribution"]);
|
|
1605
|
+
if ("commitAttribution" in integrations.git) {
|
|
1606
|
+
const parsed = expectBoolean(issues, "integrations.git.commitAttribution", integrations.git.commitAttribution);
|
|
1607
|
+
if (parsed !== void 0) settings.integrations.git.commitAttribution = parsed;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
if ("externalAgents" in integrations) {
|
|
1612
|
+
if (!isPlainObject(integrations.externalAgents))
|
|
1613
|
+
issues.add("integrations.externalAgents", `expected a map, got ${describe(integrations.externalAgents)}`);
|
|
1614
|
+
else {
|
|
1615
|
+
const external = integrations.externalAgents;
|
|
1616
|
+
issues.unknownKeys("integrations.externalAgents", external, ["entries", "defaults"]);
|
|
1617
|
+
if ("defaults" in external) {
|
|
1618
|
+
if (!isPlainObject(external.defaults))
|
|
1619
|
+
issues.add("integrations.externalAgents.defaults", `expected a map, got ${describe(external.defaults)}`);
|
|
1620
|
+
else {
|
|
1621
|
+
const defaults = external.defaults;
|
|
1622
|
+
issues.unknownKeys("integrations.externalAgents.defaults", defaults, [
|
|
1623
|
+
"connectTimeoutMs",
|
|
1624
|
+
"turnTimeoutMs",
|
|
1625
|
+
"permissionTimeoutMs",
|
|
1626
|
+
"toolGovernance"
|
|
1627
|
+
]);
|
|
1628
|
+
for (const key of ["connectTimeoutMs", "turnTimeoutMs", "permissionTimeoutMs"]) {
|
|
1629
|
+
if (!(key in defaults)) continue;
|
|
1630
|
+
const parsed = expectInteger(issues, `integrations.externalAgents.defaults.${key}`, defaults[key], {
|
|
1631
|
+
min: 1,
|
|
1632
|
+
max: MAX_TIMER_DELAY_MS
|
|
1633
|
+
});
|
|
1634
|
+
if (parsed !== void 0) settings.integrations.externalAgents.defaults[key] = parsed;
|
|
1635
|
+
}
|
|
1636
|
+
if ("toolGovernance" in defaults) {
|
|
1637
|
+
const parsed = expectEnum(
|
|
1638
|
+
issues,
|
|
1639
|
+
"integrations.externalAgents.defaults.toolGovernance",
|
|
1640
|
+
normalizeLegacyNamingValue(defaults.toolGovernance, "clio-policy", "clio-coder-policy"),
|
|
1641
|
+
TOOL_GOVERNANCE
|
|
1642
|
+
);
|
|
1643
|
+
if (parsed !== void 0) settings.integrations.externalAgents.defaults.toolGovernance = parsed;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
if ("entries" in external) {
|
|
1648
|
+
if (!Array.isArray(external.entries))
|
|
1649
|
+
issues.add("integrations.externalAgents.entries", `expected a list, got ${describe(external.entries)}`);
|
|
1650
|
+
else {
|
|
1651
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1652
|
+
settings.integrations.externalAgents.entries = external.entries.map(
|
|
1653
|
+
(entry, index) => validateExternalAgent(
|
|
1654
|
+
issues,
|
|
1655
|
+
`integrations.externalAgents.entries[${index}]`,
|
|
1656
|
+
entry,
|
|
1657
|
+
settings.integrations.externalAgents.defaults,
|
|
1658
|
+
seen
|
|
1659
|
+
)
|
|
1660
|
+
).filter((entry) => entry !== null);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return { settings, issues: issues.list };
|
|
1668
|
+
}
|
|
1669
|
+
function validateSettingsFile() {
|
|
1670
|
+
const path = join(resolveClioDirs().config, "settings.yaml");
|
|
1671
|
+
if (!existsSync(path)) return { settings: cloneValue(DEFAULT_SETTINGS), issues: [] };
|
|
1672
|
+
let text;
|
|
1673
|
+
try {
|
|
1674
|
+
text = readFileSync(path, "utf8");
|
|
1675
|
+
} catch (err) {
|
|
1676
|
+
return {
|
|
1677
|
+
settings: cloneValue(DEFAULT_SETTINGS),
|
|
1678
|
+
issues: [
|
|
1679
|
+
{ path: "(root)", message: `unreadable: ${err instanceof Error ? err.message : String(err)}`, kind: "unreadable" }
|
|
1680
|
+
]
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
let parsed;
|
|
1684
|
+
try {
|
|
1685
|
+
parsed = (0, import_yaml.parse)(text);
|
|
1686
|
+
} catch (err) {
|
|
1687
|
+
return {
|
|
1688
|
+
settings: cloneValue(DEFAULT_SETTINGS),
|
|
1689
|
+
issues: [{ path: "(root)", message: `invalid YAML: ${yamlErrorSummary(err)}`, kind: "syntax" }]
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
return validateSettings(parsed);
|
|
1693
|
+
}
|
|
1694
|
+
function readSettings() {
|
|
1695
|
+
const result = validateSettingsFile();
|
|
1696
|
+
if (result.issues.length > 0) throw new SettingsValidationError(result.issues);
|
|
1697
|
+
return result.settings;
|
|
1698
|
+
}
|
|
1699
|
+
function persistSettings(document) {
|
|
1700
|
+
safeResourceWrite(settingsPath(), (0, import_yaml.stringify)(document), { encoding: "utf8", mode: 420 });
|
|
1701
|
+
}
|
|
1702
|
+
function readSavedDocument() {
|
|
1703
|
+
const path = settingsPath();
|
|
1704
|
+
if (!existsSync(path)) return {};
|
|
1705
|
+
try {
|
|
1706
|
+
return (0, import_yaml.parse)(readFileSync(path, "utf8")) ?? {};
|
|
1707
|
+
} catch {
|
|
1708
|
+
return {};
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function applySettingsDelta(saved, before, after) {
|
|
1712
|
+
if (!isPlainObject(before) || !isPlainObject(after)) return cloneValue(after);
|
|
1713
|
+
const out = isPlainObject(saved) ? { ...saved } : {};
|
|
1714
|
+
for (const [key, next] of Object.entries(after)) {
|
|
1715
|
+
if (deepEquals(before[key], next)) continue;
|
|
1716
|
+
out[key] = applySettingsDelta(out[key], before[key], next);
|
|
1717
|
+
}
|
|
1718
|
+
for (const key of Object.keys(out)) {
|
|
1719
|
+
if (!(key in after)) delete out[key];
|
|
1720
|
+
}
|
|
1721
|
+
return out;
|
|
1722
|
+
}
|
|
1723
|
+
function deepEquals(a, b) {
|
|
1724
|
+
if (a === b) return true;
|
|
1725
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
1726
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
1727
|
+
return a.every((entry, index) => deepEquals(entry, b[index]));
|
|
1728
|
+
}
|
|
1729
|
+
if (!isPlainObject(a) || !isPlainObject(b)) return false;
|
|
1730
|
+
const keys = Object.keys(a);
|
|
1731
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
1732
|
+
return keys.every((key) => key in b && deepEquals(a[key], b[key]));
|
|
1733
|
+
}
|
|
1734
|
+
function updateSavedSettingsDocument(mutate, options = {}) {
|
|
1735
|
+
withSettingsLock(() => {
|
|
1736
|
+
readSettings();
|
|
1737
|
+
const saved = readSavedDocument();
|
|
1738
|
+
persistSettings(mutate(cloneValue(saved)));
|
|
1739
|
+
}, options);
|
|
1740
|
+
}
|
|
1741
|
+
function withSettingsLock(fn, options = {}) {
|
|
1742
|
+
return withStateFileLockSync(settingsPath(), fn, { timeoutMs: options.timeoutMs ?? 1e4 });
|
|
1743
|
+
}
|
|
1744
|
+
function updateSettings(mutate, options = {}) {
|
|
1745
|
+
return withSettingsLock(() => {
|
|
1746
|
+
const saved = readSavedDocument();
|
|
1747
|
+
const current = readSettings();
|
|
1748
|
+
const before = cloneValue(current);
|
|
1749
|
+
const next = mutate(current) ?? current;
|
|
1750
|
+
const revalidated = validateSettings(JSON.parse(JSON.stringify(next)));
|
|
1751
|
+
if (revalidated.issues.length > 0) throw new SettingsValidationError(revalidated.issues);
|
|
1752
|
+
persistSettings(applySettingsDelta(saved, before, revalidated.settings));
|
|
1753
|
+
return revalidated.settings;
|
|
1754
|
+
}, options);
|
|
1755
|
+
}
|
|
1756
|
+
function useTargetInSettings(settings, targetId, options = {}) {
|
|
1757
|
+
const target = settings.targets.find((entry) => entry.id === targetId);
|
|
1758
|
+
if (!target) return null;
|
|
1759
|
+
const workerTarget = options.workerTargetId !== void 0 && options.workerTargetId !== target.id ? settings.targets.find((entry) => entry.id === options.workerTargetId) : target;
|
|
1760
|
+
if (!workerTarget) return null;
|
|
1761
|
+
const sharedModel = options.model ?? target.defaultModel ?? null;
|
|
1762
|
+
settings.chat.target = target.id;
|
|
1763
|
+
settings.chat.model = options.orchestratorModel ?? sharedModel;
|
|
1764
|
+
settings.fleet.default.target = workerTarget.id;
|
|
1765
|
+
settings.fleet.default.model = options.workerModel ?? (workerTarget === target ? sharedModel : workerTarget.defaultModel ?? null);
|
|
1766
|
+
if (options.backgroundModel !== void 0) {
|
|
1767
|
+
settings.context.memory.target = target.id;
|
|
1768
|
+
settings.context.memory.model = options.backgroundModel;
|
|
1769
|
+
}
|
|
1770
|
+
return { workerTargetId: workerTarget.id };
|
|
1771
|
+
}
|
|
1772
|
+
function removeTargetFromSettings(settings, id) {
|
|
1773
|
+
if (!settings.targets.some((entry) => entry.id === id)) return false;
|
|
1774
|
+
settings.targets = settings.targets.filter((entry) => entry.id !== id);
|
|
1775
|
+
if (settings.chat.target === id) {
|
|
1776
|
+
settings.chat.target = null;
|
|
1777
|
+
settings.chat.model = null;
|
|
1778
|
+
}
|
|
1779
|
+
if (settings.context.memory.target === id) {
|
|
1780
|
+
settings.context.memory.target = null;
|
|
1781
|
+
settings.context.memory.model = null;
|
|
1782
|
+
}
|
|
1783
|
+
if (settings.fleet.default.target === id) {
|
|
1784
|
+
settings.fleet.default.target = null;
|
|
1785
|
+
settings.fleet.default.model = null;
|
|
1786
|
+
}
|
|
1787
|
+
for (const [name, profile] of Object.entries(settings.fleet.profiles)) {
|
|
1788
|
+
if (profile.target === id) delete settings.fleet.profiles[name];
|
|
1789
|
+
}
|
|
1790
|
+
settings.chat.modelPicker.cycleSet = settings.chat.modelPicker.cycleSet.filter((entry) => entry.split("/")[0] !== id);
|
|
1791
|
+
settings.chat.modelPicker.favorites = settings.chat.modelPicker.favorites.filter(
|
|
1792
|
+
(entry) => entry.split("/")[0] !== id
|
|
1793
|
+
);
|
|
1794
|
+
return true;
|
|
1795
|
+
}
|
|
1796
|
+
function setFleetProfileInSettings(settings, name, targetId, options = {}) {
|
|
1797
|
+
const target = settings.targets.find((entry) => entry.id === targetId);
|
|
1798
|
+
if (!target) return false;
|
|
1799
|
+
const existing = settings.fleet.profiles[name];
|
|
1800
|
+
settings.fleet.profiles[name] = {
|
|
1801
|
+
target: target.id,
|
|
1802
|
+
model: options.model ?? target.defaultModel ?? null,
|
|
1803
|
+
thinkingLevel: options.thinkingLevel ?? existing?.thinkingLevel ?? "off"
|
|
1804
|
+
};
|
|
1805
|
+
return true;
|
|
1806
|
+
}
|
|
1807
|
+
function removeFleetProfileFromSettings(settings, name) {
|
|
1808
|
+
delete settings.fleet.profiles[name];
|
|
1809
|
+
let removedBindings = 0;
|
|
1810
|
+
for (const [agentId, profileName] of Object.entries(settings.fleet.agentProfiles)) {
|
|
1811
|
+
if (profileName !== name) continue;
|
|
1812
|
+
delete settings.fleet.agentProfiles[agentId];
|
|
1813
|
+
removedBindings += 1;
|
|
1814
|
+
}
|
|
1815
|
+
return removedBindings;
|
|
1816
|
+
}
|
|
1817
|
+
function bindAgentProfileInSettings(settings, agentId, profileName) {
|
|
1818
|
+
if (settings.integrations.externalAgents.entries.some((agent) => agent.id === agentId)) return false;
|
|
1819
|
+
settings.fleet.agentProfiles[agentId] = profileName;
|
|
1820
|
+
return true;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
export {
|
|
1824
|
+
settingsPath,
|
|
1825
|
+
SettingsValidationError,
|
|
1826
|
+
formatSettingsIssues,
|
|
1827
|
+
formatSettingsFailure,
|
|
1828
|
+
SETTINGS_V1_PATH_MOVES,
|
|
1829
|
+
validateSettings,
|
|
1830
|
+
validateSettingsFile,
|
|
1831
|
+
readSettings,
|
|
1832
|
+
applySettingsDelta,
|
|
1833
|
+
updateSavedSettingsDocument,
|
|
1834
|
+
withSettingsLock,
|
|
1835
|
+
updateSettings,
|
|
1836
|
+
useTargetInSettings,
|
|
1837
|
+
removeTargetFromSettings,
|
|
1838
|
+
setFleetProfileInSettings,
|
|
1839
|
+
removeFleetProfileFromSettings,
|
|
1840
|
+
bindAgentProfileInSettings
|
|
1841
|
+
};
|
|
1842
|
+
//# sourceMappingURL=chunk-EIMVLWB3.js.map
|