@iowarp/clio-coder 0.4.0 → 0.4.2
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 +131 -0
- package/CONTRIBUTING.md +59 -36
- package/README.md +407 -375
- package/SECURITY.md +2 -1
- package/dist/{acp-G5WJBNCT.js → acp-TMDQZDIG.js} +14 -14
- package/dist/{agents-FMV2Q5G4.js → agents-5N5NG3XG.js} +45 -34
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-3IDSJEIK.js → auth-Z5CCBXKQ.js} +22 -21
- package/dist/{builtins-XCZWXSC7.js → builtins-K6TNDT24.js} +6 -6
- package/dist/{chunk-GR5G2PVF.js → chunk-2HFQNRV3.js} +15 -10
- package/dist/{chunk-PQEFIJ36.js → chunk-2LEAKD4C.js} +1 -2
- package/dist/{chunk-HJJTYUHX.js → chunk-2NHR3NAY.js} +168 -1406
- package/dist/chunk-2X4RYJTJ.js +39 -0
- package/dist/{chunk-UXMFQ54G.js → chunk-2Z2IKEXI.js} +39 -43
- package/dist/{chunk-SST6Z5JA.js → chunk-336NSSKI.js} +1 -1
- package/dist/chunk-34BHNEE3.js +1846 -0
- package/dist/{chunk-YJX4SHTD.js → chunk-35MSIRKH.js} +9 -4
- package/dist/chunk-3EBYEESD.js +314 -0
- package/dist/{chunk-CTJ4RNAA.js → chunk-3F7VUY77.js} +2 -2
- package/dist/chunk-3KIPBMUA.js +308 -0
- package/dist/chunk-3M6DQK6S.js +362 -0
- package/dist/{chunk-BPKCPIL7.js → chunk-462T4EGZ.js} +3 -3
- package/dist/{chunk-QLFS5GO2.js → chunk-4JDLP6ZS.js} +44 -37
- package/dist/{chunk-LDQ2ZF2M.js → chunk-4O6MANBS.js} +6 -6
- package/dist/{chunk-O6TL7WWY.js → chunk-54ODD65L.js} +6 -6
- package/dist/{chunk-JDG2WCRO.js → chunk-5KW52TEP.js} +5 -5
- package/dist/{chunk-NHLBIGRH.js → chunk-5PFYMY2V.js} +41 -18
- package/dist/{chunk-P3FOHJT4.js → chunk-72GZI5EV.js} +2 -2
- package/dist/chunk-77QIVUZB.js +1334 -0
- package/dist/{chunk-HWHKMHUA.js → chunk-7BHIY2MW.js} +9 -15
- package/dist/{chunk-FWDFM5ZU.js → chunk-AK5XEFVZ.js} +3 -3
- package/dist/{chunk-VAZSBTKF.js → chunk-AZ4WMN4W.js} +2 -2
- package/dist/{chunk-B7OBL7PK.js → chunk-B74PXLU7.js} +21 -11
- package/dist/{chunk-CY6FY24N.js → chunk-B7HM5Z7T.js} +15 -15
- package/dist/{chunk-ULC6OTWO.js → chunk-BO7Y52RY.js} +88 -27
- package/dist/chunk-BTK3SSSK.js +67 -0
- package/dist/{chunk-M6L6IDJG.js → chunk-BWH6N36D.js} +1 -1
- package/dist/{chunk-DQITNCXG.js → chunk-BYMNWQ7O.js} +149 -159
- package/dist/{chunk-HI63TFOG.js → chunk-CDNVLKUX.js} +3 -3
- package/dist/{chunk-Z4TXYIEG.js → chunk-CRFOIAX3.js} +10 -10
- package/dist/{chunk-UM7N4G5A.js → chunk-CWVRRIEI.js} +2 -2
- package/dist/{chunk-3BT2XMV4.js → chunk-CYZW7JHJ.js} +53 -60
- package/dist/{chunk-BKFM6EJV.js → chunk-D4CJV46V.js} +2 -2
- package/dist/chunk-D7E7WCDF.js +27 -0
- package/dist/{chunk-X3YGUTOB.js → chunk-DYHAXKHD.js} +90 -62
- package/dist/{chunk-QBJA7R7N.js → chunk-DZAW46HP.js} +3 -3
- package/dist/{chunk-MLKNTWH2.js → chunk-DZEK6CJN.js} +22 -22
- package/dist/{chunk-K5C3NCBD.js → chunk-E7GT7O5N.js} +5 -5
- package/dist/{chunk-FQ4SKYE4.js → chunk-EBY63B7G.js} +2 -5
- package/dist/chunk-F2I26BDK.js +66 -0
- package/dist/{chunk-HLW2MRKE.js → chunk-F4EKGO4N.js} +3 -1
- package/dist/{chunk-RAPCMZL4.js → chunk-FSP7CMNU.js} +9 -1
- package/dist/{chunk-32KWKNSF.js → chunk-FVDGR2ZL.js} +4 -4
- package/dist/{chunk-TZSKNMZG.js → chunk-GTUD2WMY.js} +2 -1
- package/dist/{chunk-SJ5ZKQ4S.js → chunk-HIICAHCJ.js} +2 -2
- package/dist/chunk-HJWWJ6IL.js +184 -0
- package/dist/{chunk-WZR7K7ZX.js → chunk-HKMD33FO.js} +32 -83
- package/dist/chunk-HLAFFSEK.js +360 -0
- package/dist/{chunk-VO67MWHC.js → chunk-HRQMFLJP.js} +3 -3
- package/dist/{chunk-KFZI4NIL.js → chunk-I64IFBLB.js} +152 -31
- package/dist/{chunk-BKFJHQCA.js → chunk-I66EAJFY.js} +2 -2
- package/dist/{chunk-BUMFYQFY.js → chunk-I66ZTYNP.js} +543 -267
- package/dist/{chunk-2OQE55CK.js → chunk-I7XBWTYH.js} +2 -2
- package/dist/{chunk-GKF55TAZ.js → chunk-IDNA72AH.js} +104 -3
- package/dist/{chunk-GCSMB2KY.js → chunk-IKOZFYBN.js} +1 -1
- package/dist/{chunk-J4W7KFM7.js → chunk-IKSLQ4XV.js} +5439 -3475
- package/dist/{chunk-6DB53AJS.js → chunk-IMXMHHMQ.js} +171 -30
- package/dist/{chunk-AB44T6BB.js → chunk-JBCS7CRR.js} +8 -7
- package/dist/{chunk-BBVJUZHB.js → chunk-JIEGK6UF.js} +5 -173
- package/dist/{chunk-SP2RXXYO.js → chunk-JWJGP5DQ.js} +10 -10
- package/dist/{chunk-HZHHCK24.js → chunk-KKOJXO6R.js} +527 -325
- package/dist/chunk-KPXDY6QF.js +47 -0
- package/dist/{chunk-LQ3DZAMX.js → chunk-LJID3DYZ.js} +8 -2
- package/dist/{chunk-7MCTRUCE.js → chunk-M2DAX4F6.js} +2 -2
- package/dist/{chunk-VEO4AP2K.js → chunk-M2WXEHER.js} +4 -3
- package/dist/{chunk-YPI3QQCF.js → chunk-MCEPRMZW.js} +2 -4
- package/dist/{chunk-YDFRH54B.js → chunk-MCMZMDAC.js} +4 -4
- package/dist/{chunk-J5Q24KAG.js → chunk-MNJGS2IN.js} +5 -6
- package/dist/{chunk-76ONBSIA.js → chunk-MQXIVJ35.js} +14 -5
- package/dist/chunk-NDDGJUXD.js +81 -0
- package/dist/{chunk-TVHHYFHE.js → chunk-NEDJ26B5.js} +2 -2
- package/dist/chunk-NMJXSHBJ.js +283 -0
- package/dist/{chunk-VYMXRQI6.js → chunk-O3YUNJZ2.js} +88 -100
- package/dist/{chunk-VO2LKSTM.js → chunk-O42A54GG.js} +2 -2
- package/dist/{chunk-Z2RR6MAK.js → chunk-P75RZCJW.js} +28 -6
- package/dist/{chunk-NHCZP4K7.js → chunk-PBP4B7XR.js} +2 -2
- package/dist/{chunk-DYJP44XW.js → chunk-PGF63K6I.js} +2 -2
- package/dist/chunk-PJX3WQUQ.js +42 -0
- package/dist/{chunk-ZGVHUX3M.js → chunk-PMZVFWSR.js} +2 -2
- package/dist/{chunk-2JDWVJND.js → chunk-Q4XWMHX6.js} +5 -7
- package/dist/{chunk-W5VSYASO.js → chunk-QQLGQY2A.js} +46 -87
- package/dist/{chunk-KMVISBZR.js → chunk-RKSR6VSF.js} +1 -1
- package/dist/{chunk-C2LTL2W6.js → chunk-RLYRBIYQ.js} +463 -180
- package/dist/{chunk-4ZG3XFUR.js → chunk-S66XZJOF.js} +14 -23
- package/dist/{chunk-I5VEOC6I.js → chunk-SSEYRH53.js} +13 -14
- package/dist/chunk-SZAA6XDG.js +30 -0
- package/dist/{chunk-CODPRO7Q.js → chunk-TPEQIQIE.js} +7 -7
- package/dist/{chunk-QLL7ILRG.js → chunk-UBRFI4HS.js} +1151 -614
- package/dist/{chunk-O4XIVISU.js → chunk-UH347SHR.js} +227 -47
- package/dist/{chunk-OQBA45DZ.js → chunk-UH632ZYL.js} +2 -2
- package/dist/chunk-UXCU4E3T.js +303 -0
- package/dist/{chunk-CMZWFGD2.js → chunk-VAVR4IJY.js} +19 -15
- package/dist/{chunk-IQ7KR472.js → chunk-VIA6RFQZ.js} +8 -13
- package/dist/{chunk-V5DHCITQ.js → chunk-VKPAQYEB.js} +49 -19
- package/dist/{chunk-5LXZXPKX.js → chunk-VN3SHNBN.js} +2 -2
- package/dist/{chunk-UOSL25KY.js → chunk-VXMFAE2W.js} +1 -1
- package/dist/{chunk-3XML7CDN.js → chunk-W4YEMFBX.js} +3 -3
- package/dist/{chunk-U77AMWDL.js → chunk-W6NIE6OW.js} +44 -23
- package/dist/{chunk-BBVYXMFO.js → chunk-WNP7O5WZ.js} +2 -2
- package/dist/{chunk-QREDIESB.js → chunk-X7IARSHT.js} +15 -9
- package/dist/{chunk-3URVFKWK.js → chunk-XE3PCIXH.js} +5 -5
- package/dist/{chunk-FEFIFZTL.js → chunk-XGDPUNND.js} +2 -2
- package/dist/{chunk-F4CKPOEQ.js → chunk-XOXV5GKE.js} +119 -38
- package/dist/chunk-XQRY4DTA.js +657 -0
- package/dist/{chunk-NYS75XW5.js → chunk-YAKGTXEV.js} +5 -3
- package/dist/{chunk-NQQH3YT7.js → chunk-YJISEZKC.js} +3 -3
- package/dist/{chunk-X75E3D2N.js → chunk-ZGNYYXQ6.js} +18 -16
- package/dist/{chunk-LY4S7GJC.js → chunk-ZNT2M6TG.js} +20 -18
- package/dist/{chunk-HKIYEGME.js → chunk-ZTJUVLTU.js} +2 -2
- package/dist/{chunk-IBEBSCYA.js → chunk-ZW4HH5JJ.js} +43 -34
- package/dist/{chunk-2ANTL7MR.js → chunk-ZW55JB7N.js} +2 -2
- package/dist/cli/index.js +38 -37
- package/dist/{clio-2JXHBBY5.js → clio-7VB377CC.js} +12 -13
- package/dist/{code-nav-3YYRMYNF.js → code-nav-YVLCYA7V.js} +86 -18
- 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-4HVOS65E.js} +112 -63
- package/dist/{configure-TEGEBYCA.js → configure-PIWO7B24.js} +25 -22
- package/dist/{context-E6H5RNMC.js → context-IYEHL3WQ.js} +53 -47
- package/dist/{context-GSXUE4CT.js → context-KQYIWPWT.js} +68 -42
- package/dist/{context-AV7OEZ4D.js → context-N6ZE3LGJ.js} +11 -11
- package/dist/{context-clear-SHIBYK6T.js → context-clear-G4OGZJDS.js} +53 -47
- package/dist/{context-working-set-5ZGKPGZQ.js → context-working-set-BWLF6LJP.js} +12 -11
- package/dist/{dispatch-runner-EFMJT4LD.js → dispatch-runner-2QQAITS3.js} +67 -58
- package/dist/{docs-23KQS3XK.js → docs-PD3EXDKU.js} +20 -25
- package/dist/doctor-LHBD36VU.js +773 -0
- package/dist/{eval-TFBYQH4H.js → eval-C45FYRJ6.js} +68 -49
- package/dist/{eval-inventory-SXH7PDKX.js → eval-inventory-6DEJPLBF.js} +7 -8
- package/dist/{evidence-ERGESKGN.js → evidence-6SHONYAF.js} +50 -44
- package/dist/{evolve-VDXTSYCJ.js → evolve-KRKMV72X.js} +49 -43
- package/dist/{extensions-7BGBHN57.js → extensions-KPZ2UHBB.js} +8 -6
- package/dist/{fleet-2RRVDF2V.js → fleet-IVTCKDHT.js} +93 -79
- package/dist/{fleet-commands-VJ726XIA.js → fleet-commands-EDWL3IT7.js} +10 -9
- package/dist/{fleet-decisions-EPAPM3XJ.js → fleet-decisions-YP3YEFGK.js} +6 -6
- package/dist/{fleet-graph-JF5QOATM.js → fleet-graph-ZFWKHY2M.js} +19 -15
- package/dist/{fleet-inspect-VLY4S7QM.js → fleet-inspect-FVUNCBML.js} +50 -45
- package/dist/{fleet-preflight-AIZUEJOY.js → fleet-preflight-UN5XED4R.js} +5 -9
- package/dist/{fleet-validate-AJRPDMDV.js → fleet-validate-XOWC4HSX.js} +22 -17
- package/dist/{fleet-verify-JFEL2L3H.js → fleet-verify-UN3SODEL.js} +48 -43
- package/dist/fleet-view-TWHJKCN6.js +96 -0
- package/dist/{init-DN2WWLFE.js → init-T2QORQ3Y.js} +72 -66
- package/dist/{install-XGLBQY5E.js → install-NKNG7KD4.js} +2 -2
- package/dist/{interop-OZBKXAYL.js → interop-IN5I2A66.js} +13 -11
- package/dist/{library-YWZG7IMW.js → library-LSCATDLZ.js} +23 -18
- package/dist/{memory-I4C4HMLW.js → memory-HYOKAGGJ.js} +51 -45
- package/dist/{models-CEYXJBO6.js → models-2GPMFYCM.js} +42 -33
- package/dist/{monitor-NZ6GCI3P.js → monitor-E4ASVUJH.js} +56 -50
- package/dist/{orchestrator-GCGQ4N5I.js → orchestrator-DDMPR3PY.js} +2676 -1507
- package/dist/{panes-KY6W3V2E.js → panes-E3RUXOW5.js} +5 -5
- package/dist/panes-IXKLOKA2.js +75 -0
- package/dist/{paths-II4K7DNR.js → paths-L7LGY6RN.js} +4 -4
- package/dist/{reset-DQ6FGCSH.js → reset-OAQP3W4O.js} +7 -8
- package/dist/{resources-BB3MVJMD.js → resources-OTRSN34L.js} +23 -17
- package/dist/{run-H2GQDUER.js → run-5DEYH5QK.js} +95 -84
- package/dist/{share-GTJN6A5O.js → share-IHWTLO3M.js} +26 -19
- package/dist/{skills-L55TEW6R.js → skills-IYMXMKW4.js} +25 -20
- package/dist/{skills-eval-XVXPH2JI.js → skills-eval-DROHSJAR.js} +63 -65
- package/dist/{skills-inventory-S4MXPJFV.js → skills-inventory-D7X4L4ZX.js} +21 -16
- package/dist/{slash-commands-ZSGASKJC.js → slash-commands-QBM7UZ3B.js} +38 -33
- package/dist/{steer-RZGSCY4R.js → steer-Z5DO23FJ.js} +3 -3
- package/dist/{support-PKEUNNQL.js → support-U7QOWY26.js} +6 -6
- package/dist/{targets-NCPZ644J.js → targets-P2FUC4IL.js} +64 -61
- package/dist/{terminal-lease-44SV3YCN.js → terminal-lease-YREJ3JX2.js} +15 -10
- package/dist/{tools-DAF3DI3C.js → tools-5B7RO6MV.js} +10 -8
- package/dist/{trace-FYVW2MQA.js → trace-YMGMUM6A.js} +101 -8
- 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-PXK3S2YM.js} +36 -61
- package/dist/{usage-3NLHGTU2.js → usage-ME5MPXGX.js} +58 -53
- package/dist/{verifiers-SSQONKRT.js → verifiers-BVZ7IWOO.js} +10 -9
- package/dist/{verify-3U6J7FZI.js → verify-5K7ZKQFC.js} +9 -8
- package/dist/{web-fetch-S7RR6GZ7.js → web-fetch-MPARV2K7.js} +2 -3
- package/dist/{wiki-generate-CEHYGPGQ.js → wiki-generate-F5W5QTYY.js} +74 -70
- package/dist/{with-panes-MKB46MPQ.js → with-panes-BYOJCLAM.js} +78 -246
- package/dist/worker/entry.js +83 -63
- package/docs/README.md +176 -81
- package/docs/{acp.md → architecture/acp.md} +36 -20
- package/docs/{alcf-provider.md → architecture/alcf-provider.md} +8 -5
- package/docs/{architecture.md → architecture/architecture.md} +43 -22
- package/docs/{artifact-placement.md → architecture/artifact-placement.md} +26 -23
- package/docs/architecture/artifact-versions.md +90 -0
- package/docs/{capacity-and-scheduling.md → architecture/capacity-and-scheduling.md} +26 -13
- package/docs/{context-engine.md → architecture/context-engine.md} +25 -25
- package/docs/{context-working-set.md → architecture/context-working-set.md} +13 -10
- package/docs/{dispatch-architecture-rationale.md → architecture/dispatch-architecture-rationale.md} +12 -9
- package/docs/{dispatch-typed-intent.md → architecture/dispatch-typed-intent.md} +68 -46
- package/docs/{evidence-and-memory.md → architecture/evidence-and-memory.md} +23 -16
- package/docs/{middleware-and-components.md → architecture/middleware-and-components.md} +11 -5
- package/docs/{model-catalog.md → architecture/model-catalog.md} +40 -17
- package/docs/{observability.md → architecture/observability.md} +26 -13
- package/docs/{pi-boundary.md → architecture/pi-boundary.md} +24 -11
- package/docs/{prompt-envelope-and-tools.md → architecture/prompt-envelope-and-tools.md} +55 -20
- package/docs/{provider-adapter-cookbook.md → architecture/provider-adapter-cookbook.md} +35 -24
- package/docs/{safety-model.md → architecture/safety-model.md} +20 -15
- package/docs/{session-lifecycle.md → architecture/session-lifecycle.md} +8 -5
- package/docs/architecture/time-conventions.md +125 -0
- package/docs/{trace-store.md → architecture/trace-store.md} +26 -13
- package/docs/{tui-design.md → architecture/tui-design.md} +13 -13
- package/docs/{worker-dispatch-mechanics.md → architecture/worker-dispatch-mechanics.md} +27 -30
- package/docs/{built-in-agents.md → guide/built-in-agents.md} +70 -46
- package/docs/{commands-and-modes.md → guide/commands-and-modes.md} +73 -62
- package/docs/{configuration-and-targets.md → guide/configuration-and-targets.md} +323 -444
- package/docs/guide/configuration-reference.md +1158 -0
- package/docs/{environment-variables.md → guide/environment-variables.md} +31 -27
- package/docs/{exit-codes-and-output.md → guide/exit-codes-and-output.md} +8 -3
- package/docs/{extensions-and-sharing.md → guide/extensions-and-sharing.md} +41 -14
- package/docs/{fleet-dispatch.md → guide/fleet-dispatch.md} +47 -49
- package/docs/{glossary.md → guide/glossary.md} +14 -11
- package/docs/{installation-and-lifecycle.md → guide/installation-and-lifecycle.md} +45 -14
- package/docs/guide/panes-and-files.md +290 -0
- package/docs/{proactive-memory.md → guide/proactive-memory.md} +79 -66
- package/docs/{resource-library.md → guide/resource-library.md} +13 -4
- package/docs/{skills-marketplace.md → guide/skills-marketplace.md} +7 -3
- package/docs/{tool-usage.md → guide/tool-usage.md} +87 -23
- package/docs/{troubleshooting.md → guide/troubleshooting.md} +10 -5
- package/docs/{config-knobs-audit.md → history/config-knobs-audit.md} +13 -10
- package/docs/history/release-cut-checklist.md +207 -0
- package/docs/{development-pipeline.md → process/development-pipeline.md} +24 -26
- package/docs/process/documentation-coverage.md +100 -0
- package/docs/process/documentation-guide.md +187 -0
- package/docs/{eval-runner.md → process/eval-runner.md} +41 -50
- package/docs/{evals-internal.md → process/evals-internal.md} +10 -10
- package/docs/{evolution.md → process/evolution.md} +2 -2
- package/docs/{fleet-demo-runbook.md → process/fleet-demo-runbook.md} +17 -10
- package/docs/{git-commit-provenance.md → process/git-commit-provenance.md} +11 -4
- package/docs/{performance-methodology.md → process/performance-methodology.md} +87 -69
- package/docs/{scientific-validation.md → process/scientific-validation.md} +4 -4
- 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 +13 -21
- package/skills/README.md +51 -42
- package/skills/coding/ast-grep/SKILL.md +9 -3
- package/skills/coding/coding-standards/SKILL.md +9 -3
- package/skills/coding/prototype/SKILL.md +9 -3
- package/skills/coding/tdd/SKILL.md +9 -3
- package/skills/context/context-handoff/SKILL.md +13 -4
- package/skills/context/context-handoff/evals.md +3 -3
- package/skills/context/context-prime/SKILL.md +9 -3
- package/skills/context/context-prime/evals.md +2 -2
- package/skills/git/file-ticket/SKILL.md +10 -5
- 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 +9 -3
- package/skills/git/resolve-merge-conflicts/evals.md +2 -2
- package/skills/git/ship/SKILL.md +10 -4
- package/skills/git/ship/evals.md +4 -4
- package/skills/git/worktree-create/SKILL.md +8 -3
- package/skills/git/worktree-create/evals.md +6 -6
- package/skills/git/worktree-merge/SKILL.md +8 -3
- package/skills/git/worktree-merge/evals.md +6 -6
- package/skills/meta/{clio-dev → clio-coder-dev}/SKILL.md +22 -12
- package/skills/meta/{clio-dev → clio-coder-dev}/evals.md +5 -4
- package/skills/meta/clio-coder-test/SKILL.md +146 -0
- package/skills/meta/{clio-test → clio-coder-test}/evals.md +10 -5
- package/skills/meta/clio-coder-test/references/harness.md +102 -0
- package/skills/meta/clio-coder-test/references/test-map.md +96 -0
- package/skills/meta/credentials/SKILL.md +10 -3
- package/skills/meta/find-skills/SKILL.md +9 -3
- package/skills/meta/herdr/SKILL.md +9 -3
- package/skills/meta/skill-craft/SKILL.md +39 -16
- package/skills/planning/architecture/SKILL.md +9 -3
- package/skills/planning/backlog/SKILL.md +9 -3
- package/skills/planning/prd/SKILL.md +9 -3
- package/skills/planning/product-intent/SKILL.md +9 -3
- package/skills/planning/tech-spec/SKILL.md +9 -3
- package/skills/registry.yaml +66 -66
- package/skills/research/arxiv-literature/SKILL.md +9 -3
- package/skills/research/experiment-protocol/SKILL.md +10 -3
- package/skills/research/scientific-debugging/SKILL.md +10 -3
- package/skills/research/scientific-debugging/evals.md +2 -2
- package/skills/research/scientific-modernization/SKILL.md +10 -3
- package/skills/skill-marketplace.json +285 -66
- package/skills/workflow/cut-it/SKILL.md +11 -3
- package/skills/workflow/design-council/SKILL.md +12 -3
- package/skills/workflow/grill-me/SKILL.md +9 -3
- package/skills/workflow/workflow-distiller/SKILL.md +9 -3
- package/src/cli/acp.ts +2 -2
- package/src/cli/args.ts +2 -2
- package/src/cli/auth.ts +2 -2
- package/src/cli/bootstrap-generate.ts +6 -6
- package/src/cli/clio.ts +6 -1
- package/src/cli/config-inspect.ts +68 -15
- package/src/cli/configure-interop.ts +1 -1
- package/src/cli/configure.ts +27 -31
- package/src/cli/default-target.ts +1 -1
- package/src/cli/docs.ts +28 -20
- package/src/cli/doctor-naming.ts +323 -0
- package/src/cli/doctor-panes.ts +46 -14
- package/src/cli/doctor-toolchain.ts +31 -10
- package/src/cli/doctor.ts +15 -1
- package/src/cli/eval-inventory.ts +8 -8
- package/src/cli/eval.ts +1 -2
- package/src/cli/evidence-detail.ts +1 -1
- package/src/cli/evidence-inventory.ts +1 -1
- package/src/cli/extensions.ts +2 -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 +9 -6
- package/src/cli/index.ts +2 -1
- package/src/cli/internal-dispatch.ts +3 -4
- 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/panes.ts +19 -5
- package/src/cli/reset.ts +1 -1
- package/src/cli/run.ts +13 -17
- package/src/cli/share.ts +6 -2
- package/src/cli/skills-eval.ts +14 -14
- package/src/cli/targets.ts +25 -30
- package/src/cli/trace-inspect.ts +1 -1
- package/src/cli/trace.ts +96 -4
- 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 +6 -6
- package/src/core/artifact-paths.ts +1 -1
- package/src/core/bash-exec.ts +132 -87
- package/src/core/boot-trace.ts +3 -3
- package/src/core/bus-events.ts +51 -6
- package/src/core/bus-trace.ts +2 -2
- package/src/core/compile-cache.ts +1 -1
- package/src/core/config.ts +1066 -886
- package/src/core/defaults.ts +326 -530
- package/src/core/dispatch-outcome.ts +16 -0
- 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 +33 -52
- package/src/core/naming-compat.ts +45 -0
- package/src/core/naming-events.ts +62 -0
- package/src/core/prompt-hint.ts +9 -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/builtins/architect.md +2 -3
- package/src/domains/agents/builtins/coder.md +3 -2
- package/src/domains/agents/builtins/debugger.md +2 -2
- package/src/domains/agents/builtins/documenter.md +2 -2
- package/src/domains/agents/builtins/git-master.md +1 -1
- package/src/domains/agents/builtins/oracle.md +1 -1
- package/src/domains/agents/builtins/provenance.md +1 -1
- package/src/domains/agents/builtins/researcher.md +1 -1
- package/src/domains/agents/builtins/scout.md +1 -1
- package/src/domains/agents/builtins/tester.md +2 -2
- package/src/domains/agents/builtins/verifier.md +2 -2
- package/src/domains/agents/builtins/wiki-writer.md +1 -1
- package/src/domains/agents/catalog.ts +14 -26
- package/src/domains/agents/contract.ts +2 -0
- package/src/domains/agents/extension.ts +26 -4
- 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 +56 -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 -6
- package/src/domains/context/prompt-context.ts +1 -1
- package/src/domains/context/wiki/assemble.ts +2 -2
- package/src/domains/context/working-set/path-index.ts +1 -0
- 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/capability-match.ts +10 -0
- 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 +169 -82
- 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/host-verification.ts +435 -39
- package/src/domains/dispatch/intent-requirements.ts +10 -0
- package/src/domains/dispatch/intent.ts +18 -1
- package/src/domains/dispatch/joint-route-resolver.ts +1 -1
- package/src/domains/dispatch/path-scope.ts +220 -70
- 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 +9 -19
- package/src/domains/dispatch/state.ts +2 -3
- package/src/domains/dispatch/tool-stats.ts +1 -1
- package/src/domains/dispatch/transport.ts +47 -40
- package/src/domains/dispatch/types.ts +58 -6
- package/src/domains/dispatch/worker-protocol.ts +2 -2
- package/src/domains/eval/artifacts/store.ts +10 -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 +20 -3
- 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/evidence/trust-status.ts +10 -1
- package/src/domains/extensions/contract.ts +15 -1
- package/src/domains/extensions/discovery.ts +238 -41
- package/src/domains/extensions/extension.ts +105 -6
- package/src/domains/extensions/index.ts +24 -0
- package/src/domains/extensions/integrity.ts +189 -0
- package/src/domains/extensions/manager.ts +17 -1
- package/src/domains/extensions/resource-path.ts +27 -0
- package/src/domains/extensions/resources.ts +18 -38
- package/src/domains/extensions/snapshot-store.ts +39 -0
- package/src/domains/extensions/snapshot.ts +180 -0
- package/src/domains/extensions/state.ts +385 -57
- package/src/domains/extensions/types.ts +118 -1
- 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-extension-install-digests.ts +27 -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 +22 -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 +276 -0
- package/src/domains/lifecycle/naming-tool-markers.ts +139 -0
- package/src/domains/lifecycle/naming-yazi.ts +86 -0
- package/src/domains/lifecycle/upgrade-notice.ts +1 -1
- package/src/domains/memory/task-memory-handoff.ts +6 -3
- package/src/domains/middleware/contract.ts +26 -0
- package/src/domains/middleware/extension.ts +24 -24
- package/src/domains/middleware/hook-receipts.ts +27 -4
- package/src/domains/middleware/hooks-io.ts +65 -32
- package/src/domains/middleware/hooks.ts +64 -0
- package/src/domains/middleware/index.ts +35 -4
- package/src/domains/middleware/marketplace-offer.ts +339 -0
- package/src/domains/middleware/registrations.ts +326 -0
- package/src/domains/middleware/runtime.ts +30 -2
- package/src/domains/middleware/snapshot.ts +20 -7
- package/src/domains/mux/contract.ts +195 -25
- package/src/domains/mux/detect.ts +23 -6
- package/src/domains/mux/dock-controller.ts +365 -0
- package/src/domains/mux/extension.ts +7 -1
- package/src/domains/mux/index.ts +21 -1
- package/src/domains/mux/operations.ts +72 -5
- 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/assets/yazi.toml +2 -2
- 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 +79 -7
- package/src/domains/mux/yazi/theme.ts +117 -17
- package/src/domains/observability/contract.ts +10 -11
- package/src/domains/observability/extension.ts +12 -4
- package/src/domains/observability/out-of-turn-usage.ts +2 -2
- package/src/domains/observability/projection.ts +15 -91
- package/src/domains/observability/trace-store.ts +65 -19
- package/src/domains/prompts/compiler.ts +75 -55
- package/src/domains/prompts/contract.ts +15 -3
- package/src/domains/prompts/extension.ts +100 -12
- package/src/domains/prompts/fragments/identity/clio-worker.md +2 -4
- package/src/domains/prompts/fragments/identity/clio.md +6 -12
- package/src/domains/prompts/fragments/identity/docs-routing.md +1 -2
- package/src/domains/prompts/fragments/identity/self-awareness.md +3 -11
- package/src/domains/prompts/fragments/operating/contract.md +7 -15
- package/src/domains/prompts/fragments/operating/delegation.md +32 -34
- package/src/domains/prompts/fragments/operating/skills.md +11 -18
- package/src/domains/prompts/fragments/operating/worker.md +1 -8
- package/src/domains/providers/extension.ts +5 -5
- package/src/domains/providers/index.ts +1 -1
- package/src/domains/providers/knowledge-base-path.ts +1 -1
- package/src/domains/providers/model-runtime-capabilities.ts +99 -23
- 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} +671 -106
- package/src/domains/providers/plugins.ts +1 -1
- package/src/domains/providers/resolver.ts +1 -1
- package/src/domains/providers/runtime-resolution.ts +31 -0
- 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 +9 -4
- package/src/domains/providers/runtimes/local-native/llamacpp-completion.ts +1 -1
- package/src/domains/providers/runtimes/local-native/llamacpp.ts +9 -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/cost-provenance.ts +19 -0
- package/src/domains/providers/types/knowledge-base.ts +13 -0
- package/src/domains/providers/types/local-model-quirks.ts +87 -39
- 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 +41 -18
- 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/call-target.ts +1 -1
- package/src/domains/safety/finish-contract.ts +2 -1
- package/src/domains/safety/loop-detector.ts +7 -4
- 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/session/task-board.ts +10 -9
- package/src/domains/share/archive.ts +249 -43
- 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 +89 -35
- 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 +4 -23
- package/src/engine/apis/lmstudio.ts +4 -9
- package/src/engine/apis/ollama-native.ts +9 -9
- package/src/engine/apis/openai-completions.ts +30 -27
- package/src/engine/apis/output-budget.ts +8 -18
- package/src/engine/apis/residency.ts +10 -35
- 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/gemma-channel-filter.ts +19 -0
- package/src/engine/loop-guard.ts +92 -17
- 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 +54 -24
- package/src/engine/worker-tools.ts +3 -1
- package/src/entry/extension-hook-sources.ts +28 -0
- package/src/entry/extension-reload.ts +309 -0
- package/src/entry/orchestrator.ts +163 -120
- package/src/interactive/application-controller.ts +23 -22
- package/src/interactive/bus-notices.ts +10 -3
- package/src/interactive/chat-loop-messages.ts +3 -13
- package/src/interactive/chat-loop.ts +18 -9
- package/src/interactive/chat-panel.ts +37 -14
- package/src/interactive/chat-renderer.ts +71 -7
- 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 +36 -44
- 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 +15 -44
- package/src/interactive/interactive-application.ts +116 -61
- package/src/interactive/interactive-event-projection.ts +1 -1
- package/src/interactive/interactive-input-runtime.ts +6 -2
- package/src/interactive/interactive-presentation.ts +22 -17
- package/src/interactive/interactive-shell.ts +2 -2
- package/src/interactive/interactive-slash-runtime.ts +65 -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/extensions.ts +9 -1
- package/src/interactive/overlays/fleet-run-approval.ts +3 -3
- package/src/interactive/overlays/handoff-review.ts +2 -2
- package/src/interactive/overlays/help-reference.ts +13 -0
- 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 +360 -303
- 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 +145 -43
- package/src/interactive/permission-overlay.ts +2 -2
- package/src/interactive/prompt-cache-identity.ts +88 -0
- 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 +401 -190
- package/src/interactive/slash-spec.ts +160 -17
- package/src/interactive/status/controller.ts +2 -2
- package/src/interactive/stream-pacing-policy.ts +1 -24
- package/src/interactive/tasks-overlay.ts +20 -13
- package/src/interactive/terminal-lease.ts +6 -7
- package/src/interactive/turn-context.ts +41 -26
- 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 +72 -11
- package/src/tools/agent-tools.ts +30 -1
- package/src/tools/artifact.ts +2 -2
- package/src/tools/ask-user.ts +6 -6
- package/src/tools/bash.ts +2 -2
- package/src/tools/bootstrap.ts +4 -0
- package/src/tools/builtin-tool-catalog.ts +52 -22
- package/src/tools/codewiki/code-nav-surface.ts +6 -0
- package/src/tools/codewiki/code-nav.ts +99 -13
- package/src/tools/compete-worktrees.ts +27 -17
- package/src/tools/context/docs-engine.ts +20 -7
- package/src/tools/context/index.ts +44 -13
- package/src/tools/core-bootstrap.ts +28 -6
- package/src/tools/credential-present.ts +1 -2
- package/src/tools/dispatch-admission.ts +4 -2
- package/src/tools/dispatch-arguments.ts +6 -2
- package/src/tools/dispatch-plan.ts +48 -15
- package/src/tools/dispatch-run-events.ts +13 -11
- package/src/tools/dispatch-runner.ts +11 -6
- package/src/tools/dispatch-schema.ts +338 -0
- package/src/tools/dispatch-types.ts +3 -0
- package/src/tools/dispatch.ts +9 -254
- package/src/tools/find.ts +1 -6
- package/src/tools/ledger.ts +3 -5
- package/src/tools/monitor-surface.ts +5 -13
- package/src/tools/monitor.ts +4 -4
- package/src/tools/observation.ts +4 -5
- package/src/tools/observers.ts +0 -33
- package/src/tools/panes-surface.ts +4 -11
- package/src/tools/panes.ts +4 -2
- package/src/tools/policy.ts +15 -2
- package/src/tools/read.ts +5 -6
- package/src/tools/registry.ts +30 -7
- package/src/tools/result-shaping.ts +18 -14
- package/src/tools/steer-surface.ts +1 -1
- package/src/tools/task-worktree.ts +28 -7
- package/src/tools/tasks.ts +1 -1
- package/src/tools/truncate.ts +6 -5
- package/src/tools/verify/authoring.ts +3 -6
- package/src/tools/verify/frontend.ts +1 -1
- package/src/tools/verify/surface.ts +6 -12
- package/src/tools/web-fetch-surface.ts +1 -3
- 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-36EJLSQQ.js +0 -814
- package/dist/chunk-GXNLGKAB.js +0 -571
- package/dist/chunk-K7VKOLQQ.js +0 -15
- package/dist/chunk-PMZCIOCJ.js +0 -25
- package/dist/chunk-SUCTJL45.js +0 -45
- package/dist/chunk-SUW5DORT.js +0 -819
- package/dist/chunk-TZ3SGWZZ.js +0 -48
- package/dist/chunk-UOV2BYIW.js +0 -107
- package/dist/chunk-VFA6GDY5.js +0 -1625
- package/dist/doctor-QOA5FNY5.js +0 -313
- package/dist/fleet-view-ZCON35AG.js +0 -102
- package/dist/panes-HMABYVO4.js +0 -58
- package/docs/artifact-versions.md +0 -67
- package/docs/documentation-coverage.md +0 -46
- package/docs/documentation-guide.md +0 -167
- package/docs/release-cut-checklist.md +0 -193
- package/docs/time-conventions.md +0 -101
- package/skills/meta/clio-test/SKILL.md +0 -133
- package/skills/meta/clio-test/references/harness.md +0 -126
- package/skills/meta/clio-test/references/test-map.md +0 -69
- package/src/engine/apis/degraded-inference.ts +0 -95
package/src/core/config.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* loader has finished booting.
|
|
6
6
|
*
|
|
7
7
|
* There is exactly one schema: the file on disk and the in-memory shape use
|
|
8
|
-
* the same key names (`targets`, `
|
|
8
|
+
* the same version-2 key names (`targets`, `chat.target`, ...). Validation is
|
|
9
9
|
* strict: unknown keys and type violations are errors carrying the exact key
|
|
10
|
-
* path
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* path. Version-1 paths are non-executing tombstones with migration hints;
|
|
11
|
+
* lifecycle owns the one-time file migration. Missing keys take
|
|
12
|
+
* DEFAULT_SETTINGS values.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
THINKING_LEVELS,
|
|
26
26
|
type ThinkingLevel,
|
|
27
27
|
} from "./defaults.js";
|
|
28
|
+
import { warnLegacyNaming } from "./naming-compat.js";
|
|
28
29
|
import { safeResourceWrite } from "./safe-resource-write.js";
|
|
29
30
|
import { withStateFileLockSync } from "./state-file-lock.js";
|
|
30
31
|
import { MAX_TIMER_DELAY_MS } from "./timers.js";
|
|
@@ -47,7 +48,7 @@ export function settingsPath(): string {
|
|
|
47
48
|
export type SettingsIssueKind = "unreadable" | "syntax" | "schema";
|
|
48
49
|
|
|
49
50
|
export interface SettingsIssue {
|
|
50
|
-
/** Dotted key path, e.g. `
|
|
51
|
+
/** Dotted key path, e.g. `chat.target` or `targets[2].runtime`. */
|
|
51
52
|
path: string;
|
|
52
53
|
message: string;
|
|
53
54
|
kind?: SettingsIssueKind;
|
|
@@ -206,6 +207,20 @@ class Issues {
|
|
|
206
207
|
if (!knownSet.has(key)) this.add(path ? `${path}.${key}` : key, "unknown key");
|
|
207
208
|
}
|
|
208
209
|
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A key that used to be honored and is not any more. `unknown key` is the
|
|
213
|
+
* true answer for a typo and the wrong one here: the operator wrote a real
|
|
214
|
+
* key that a real release read, and the useful thing to tell them is what
|
|
215
|
+
* replaced it, not that the schema has never heard of it. The keys stay
|
|
216
|
+
* listed as known at their {@link unknownKeys} call so this message is the
|
|
217
|
+
* one that lands.
|
|
218
|
+
*/
|
|
219
|
+
retiredKeys(path: string, raw: Record<string, unknown>, retired: Readonly<Record<string, string>>): void {
|
|
220
|
+
for (const [key, because] of Object.entries(retired)) {
|
|
221
|
+
if (key in raw) this.add(path ? `${path}.${key}` : key, `retired: ${because}. Remove this key.`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
209
224
|
}
|
|
210
225
|
|
|
211
226
|
function expectString(issues: Issues, path: string, value: unknown): string | undefined {
|
|
@@ -332,7 +347,13 @@ const THINKING_FORMATS = [
|
|
|
332
347
|
] as const;
|
|
333
348
|
const STRUCTURED_OUTPUTS = ["json-schema", "gbnf", "xgrammar", "none"] as const;
|
|
334
349
|
const AUTONOMY_LEVELS = ["read-only", "suggest", "auto-edit", "full-auto"] as const;
|
|
335
|
-
const TOOL_GOVERNANCE = ["clio-policy", "agent-managed", "deny-all"] as const;
|
|
350
|
+
const TOOL_GOVERNANCE = ["clio-coder-policy", "agent-managed", "deny-all"] as const;
|
|
351
|
+
|
|
352
|
+
function normalizeLegacyNamingValue(value: unknown, legacy: string, canonical: string): unknown {
|
|
353
|
+
if (value !== legacy) return value;
|
|
354
|
+
warnLegacyNaming(legacy, canonical);
|
|
355
|
+
return canonical;
|
|
356
|
+
}
|
|
336
357
|
|
|
337
358
|
type TargetCapabilities = NonNullable<ClioSettings["targets"][number]["capabilities"]>;
|
|
338
359
|
|
|
@@ -552,7 +573,12 @@ function validateTarget(issues: Issues, path: string, value: unknown): ClioSetti
|
|
|
552
573
|
if (v !== undefined) target.capabilities = v;
|
|
553
574
|
}
|
|
554
575
|
if ("lifecycle" in value) {
|
|
555
|
-
const v = expectEnum(
|
|
576
|
+
const v = expectEnum(
|
|
577
|
+
issues,
|
|
578
|
+
`${path}.lifecycle`,
|
|
579
|
+
normalizeLegacyNamingValue(value.lifecycle, "clio-managed", "clio-coder-managed"),
|
|
580
|
+
["user-managed", "clio-coder-managed"] as const,
|
|
581
|
+
);
|
|
556
582
|
if (v !== undefined) target.lifecycle = v;
|
|
557
583
|
}
|
|
558
584
|
if ("gateway" in value) {
|
|
@@ -581,15 +607,231 @@ function validateTarget(issues: Issues, path: string, value: unknown): ClioSetti
|
|
|
581
607
|
* every session that still mentions it. This is referential normalization,
|
|
582
608
|
* not a legacy reader; the key names themselves are never aliased.
|
|
583
609
|
*/
|
|
584
|
-
|
|
610
|
+
type FleetRoute = ClioSettings["fleet"]["default"];
|
|
611
|
+
type ExternalAgentDefaults = ClioSettings["integrations"]["externalAgents"]["defaults"];
|
|
612
|
+
type ExternalAgent = ClioSettings["integrations"]["externalAgents"]["entries"][number];
|
|
613
|
+
type FleetNodeConfig = ClioSettings["fleet"]["nodes"][number];
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Complete durable path manifest for the settings-v1 to settings-v2 rename.
|
|
617
|
+
* `*` denotes a map key and `[]` denotes a list element. Values are copied
|
|
618
|
+
* without reinterpretation unless a separate retired-path entry says they are
|
|
619
|
+
* deliberately dropped.
|
|
620
|
+
*/
|
|
621
|
+
export const SETTINGS_V1_PATH_MOVES = Object.freeze([
|
|
622
|
+
["autonomy", "safety.autonomy"],
|
|
623
|
+
["orchestrator.target", "chat.target"],
|
|
624
|
+
["orchestrator.model", "chat.model"],
|
|
625
|
+
["orchestrator.thinkingLevel", "chat.thinkingLevel"],
|
|
626
|
+
["scope[]", "chat.modelPicker.cycleSet[]"],
|
|
627
|
+
["modelSelector.favorites[]", "chat.modelPicker.favorites[]"],
|
|
628
|
+
["modelSelector.recentLimit", "chat.modelPicker.recentLimit"],
|
|
629
|
+
["defaults.maxTokens", "chat.maxOutputTokens"],
|
|
630
|
+
["prewarm.enabled", "chat.prewarm"],
|
|
631
|
+
["retry.enabled", "chat.retry.enabled"],
|
|
632
|
+
["retry.maxRetries", "chat.retry.maxRetries"],
|
|
633
|
+
["retry.baseDelayMs", "chat.retry.baseDelayMs"],
|
|
634
|
+
["retry.maxDelayMs", "chat.retry.maxDelayMs"],
|
|
635
|
+
["retry.streamStallMs", "chat.retry.streamStallMs"],
|
|
636
|
+
["workers.default.target", "fleet.default.target"],
|
|
637
|
+
["workers.default.model", "fleet.default.model"],
|
|
638
|
+
["workers.default.thinkingLevel", "fleet.default.thinkingLevel"],
|
|
639
|
+
["workers.default.node", "fleet.default.node"],
|
|
640
|
+
["workers.profiles.*.target", "fleet.profiles.*.target"],
|
|
641
|
+
["workers.profiles.*.model", "fleet.profiles.*.model"],
|
|
642
|
+
["workers.profiles.*.thinkingLevel", "fleet.profiles.*.thinkingLevel"],
|
|
643
|
+
["workers.profiles.*.node", "fleet.profiles.*.node"],
|
|
644
|
+
["workers.rosters.*.members[].label", "fleet.rosters.*.members[].label"],
|
|
645
|
+
["workers.rosters.*.members[].target", "fleet.rosters.*.members[].target"],
|
|
646
|
+
["workers.rosters.*.members[].model", "fleet.rosters.*.members[].model"],
|
|
647
|
+
["workers.rosters.*.members[].thinking", "fleet.rosters.*.members[].thinkingLevel"],
|
|
648
|
+
["workers.rosters.*.members[].color", "fleet.rosters.*.members[].color"],
|
|
649
|
+
["workers.agentBindings.*", "fleet.agentProfiles.*"],
|
|
650
|
+
["routing.activeRoles[]", "fleet.adaptiveRouting.roles[]"],
|
|
651
|
+
["routing.activePostures[]", "fleet.adaptiveRouting.postures[]"],
|
|
652
|
+
["routing.agentAutomation.activeAgentRoles[].agentId", "fleet.adaptiveRouting.agentRoles[].agentId"],
|
|
653
|
+
["routing.agentAutomation.activeAgentRoles[].executionRole", "fleet.adaptiveRouting.agentRoles[].executionRole"],
|
|
654
|
+
["budget.concurrency", "fleet.concurrency"],
|
|
655
|
+
["workers.maxRetries", "fleet.retry.maxRetries"],
|
|
656
|
+
["workers.resilienceCooldownMs", "fleet.retry.routeCooldownMs"],
|
|
657
|
+
["workers.onPermission", "fleet.permissions.mode"],
|
|
658
|
+
["workers.escalation.timeoutMs", "fleet.permissions.escalation.timeoutMs"],
|
|
659
|
+
["workers.escalation.fallback", "fleet.permissions.escalation.fallback"],
|
|
660
|
+
["guardrails.workerToolCallCap", "fleet.limits.toolCallsPerRun"],
|
|
661
|
+
["guardrails.internalDispatchTimeoutMs", "fleet.limits.internalRunTimeoutMs"],
|
|
662
|
+
["guardrails.maxDispatchRuns", "fleet.history.maxRuns"],
|
|
663
|
+
["compaction.auto", "context.compaction.auto"],
|
|
664
|
+
["compaction.threshold", "context.compaction.threshold"],
|
|
665
|
+
["compaction.model", "context.compaction.model"],
|
|
666
|
+
["compaction.systemPrompt", "context.compaction.systemPrompt"],
|
|
667
|
+
["background.target", "context.memory.target"],
|
|
668
|
+
["background.model", "context.memory.model"],
|
|
669
|
+
["memory.intervention.enabled", "context.memory.enabled"],
|
|
670
|
+
["memory.intervention.everyNTools", "context.memory.cadenceToolCalls"],
|
|
671
|
+
["memory.intervention.windowSteps", "context.memory.trajectorySteps"],
|
|
672
|
+
["memory.intervention.maxTokens", "context.memory.maxOutputTokens"],
|
|
673
|
+
["memory.intervention.timeoutMs", "context.memory.timeoutMs"],
|
|
674
|
+
["budget.sessionCeilingUsd", "safety.limits.sessionCostUsd"],
|
|
675
|
+
["guardrails.turnToolCallBudget", "safety.limits.chatToolCallsPerTurn"],
|
|
676
|
+
["guardrails.readMaxBytes", "safety.limits.readBytesPerCall"],
|
|
677
|
+
["guardrails.observationTurnBudgetBytes", "safety.limits.observationBytesPerTurn"],
|
|
678
|
+
["watchdog.enabled", "safety.review.enabled"],
|
|
679
|
+
["watchdog.target", "safety.review.target"],
|
|
680
|
+
["watchdog.cadenceToolCalls", "safety.review.cadenceToolCalls"],
|
|
681
|
+
["terminal.outputVerbosity", "interface.outputDetail"],
|
|
682
|
+
["terminal.smoothStreaming", "interface.smoothStreaming"],
|
|
683
|
+
["terminal.tuiMode", "interface.mode"],
|
|
684
|
+
["terminal.fullscreenScrollbar", "interface.fullscreenScrollbar"],
|
|
685
|
+
["terminal.showTerminalProgress", "interface.terminalProgress"],
|
|
686
|
+
["terminal.notify", "interface.desktopNotifications"],
|
|
687
|
+
// The panes keys shipped for exactly one release (v0.4.0, the day before
|
|
688
|
+
// this rework) but they did ship, and each has a direct v2 successor with
|
|
689
|
+
// an identical value domain, so they move like everything else. The
|
|
690
|
+
// retired agents/keepFailed pair and the `panes` root itself stay in
|
|
691
|
+
// SETTINGS_V1_RETIRED-adjacent handling via V1_ONLY_ROOTS.
|
|
692
|
+
["panes.enabled", "interface.panes.enabled"],
|
|
693
|
+
["panes.notifications", "interface.panes.notifications"],
|
|
694
|
+
["panes.journal", "fleet.history.journal"],
|
|
695
|
+
["panes.yazi.enabled", "interface.panes.files.enabled"],
|
|
696
|
+
["panes.yazi.mode", "interface.panes.files.mode"],
|
|
697
|
+
["panes.yazi.profile", "interface.panes.files.profile"],
|
|
698
|
+
["panes.yazi.followCwd", "interface.panes.files.followCwd"],
|
|
699
|
+
["keybindings.*", "interface.keybindings.*"],
|
|
700
|
+
["skills.trustProjectCompatRoots", "integrations.projectResources.trustProjectImports"],
|
|
701
|
+
["delegation.defaults.connectTimeoutMs", "integrations.externalAgents.defaults.connectTimeoutMs"],
|
|
702
|
+
["delegation.defaults.turnTimeoutMs", "integrations.externalAgents.defaults.turnTimeoutMs"],
|
|
703
|
+
["delegation.defaults.permissionTimeoutMs", "integrations.externalAgents.defaults.permissionTimeoutMs"],
|
|
704
|
+
["delegation.defaults.toolGovernance", "integrations.externalAgents.defaults.toolGovernance"],
|
|
705
|
+
["delegation.agents[].id", "integrations.externalAgents.entries[].id"],
|
|
706
|
+
["delegation.agents[].command", "integrations.externalAgents.entries[].command"],
|
|
707
|
+
["delegation.agents[].args[]", "integrations.externalAgents.entries[].args[]"],
|
|
708
|
+
["delegation.agents[].cwd", "integrations.externalAgents.entries[].cwd"],
|
|
709
|
+
["delegation.agents[].env.*", "integrations.externalAgents.entries[].env.*"],
|
|
710
|
+
["delegation.agents[].connectTimeoutMs", "integrations.externalAgents.entries[].connectTimeoutMs"],
|
|
711
|
+
["delegation.agents[].turnTimeoutMs", "integrations.externalAgents.entries[].turnTimeoutMs"],
|
|
712
|
+
["delegation.agents[].permissionTimeoutMs", "integrations.externalAgents.entries[].permissionTimeoutMs"],
|
|
713
|
+
["delegation.agents[].stallTimeoutMs", "integrations.externalAgents.entries[].stallTimeoutMs"],
|
|
714
|
+
["delegation.agents[].toolGovernance", "integrations.externalAgents.entries[].toolGovernance"],
|
|
715
|
+
["delegation.agents[].projectContext", "integrations.externalAgents.entries[].projectContext"],
|
|
716
|
+
["delegation.agents[].labels.*", "integrations.externalAgents.entries[].labels.*"],
|
|
717
|
+
["runtimePlugins[]", "integrations.runtimePlugins[]"],
|
|
718
|
+
["library.catalog", "integrations.library.catalog"],
|
|
719
|
+
["library.remote", "integrations.library.remote"],
|
|
720
|
+
["library.confirmedRemote", "integrations.library.confirmedRemote"],
|
|
721
|
+
["library.sync", "integrations.library.sync"],
|
|
722
|
+
["attribution.gitCommits", "integrations.git.commitAttribution"],
|
|
723
|
+
["fleet.nodes[].clioEntry", "fleet.nodes[].clioCoderEntry"],
|
|
724
|
+
] as const);
|
|
725
|
+
|
|
726
|
+
export const SETTINGS_V1_RETIRED_PATHS = Object.freeze({
|
|
727
|
+
identity: "it was accepted and ignored; no behavior is lost",
|
|
728
|
+
"background.thinkingLevel": "proactive memory always resolves thinking off",
|
|
729
|
+
theme: "the only registered theme was not read by runtime rendering",
|
|
730
|
+
"compaction.excludeLastTurns": "only the temporary legacy mask used it; context.workingSet.protectLastTurns remains",
|
|
731
|
+
} as const);
|
|
732
|
+
|
|
733
|
+
const V1_ONLY_ROOTS = new Set([
|
|
734
|
+
"identity",
|
|
735
|
+
"autonomy",
|
|
736
|
+
"runtimePlugins",
|
|
737
|
+
"orchestrator",
|
|
738
|
+
"background",
|
|
739
|
+
"memory",
|
|
740
|
+
"watchdog",
|
|
741
|
+
"workers",
|
|
742
|
+
"routing",
|
|
743
|
+
"scope",
|
|
744
|
+
"modelSelector",
|
|
745
|
+
"budget",
|
|
746
|
+
"defaults",
|
|
747
|
+
"theme",
|
|
748
|
+
"terminal",
|
|
749
|
+
"skills",
|
|
750
|
+
"library",
|
|
751
|
+
"attribution",
|
|
752
|
+
"delegation",
|
|
753
|
+
"keybindings",
|
|
754
|
+
"compaction",
|
|
755
|
+
"prewarm",
|
|
756
|
+
"panes",
|
|
757
|
+
"retry",
|
|
758
|
+
"guardrails",
|
|
759
|
+
]);
|
|
760
|
+
|
|
761
|
+
interface PatternMatch {
|
|
762
|
+
path: string;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function pathPatternSegments(pattern: string): string[] {
|
|
766
|
+
return pattern.split(".");
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
function patternMatches(value: unknown, pattern: string): PatternMatch[] {
|
|
770
|
+
const out: PatternMatch[] = [];
|
|
771
|
+
const visit = (current: unknown, segments: ReadonlyArray<string>, path: string): void => {
|
|
772
|
+
const segment = segments[0];
|
|
773
|
+
if (segment === undefined) {
|
|
774
|
+
out.push({ path });
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
const rest = segments.slice(1);
|
|
778
|
+
if (segment === "*") {
|
|
779
|
+
if (!isPlainObject(current)) return;
|
|
780
|
+
for (const [key, child] of Object.entries(current)) visit(child, rest, path ? `${path}.${key}` : key);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
const list = segment.endsWith("[]");
|
|
784
|
+
const key = list ? segment.slice(0, -2) : segment;
|
|
785
|
+
if (!isPlainObject(current) || !(key in current)) return;
|
|
786
|
+
const child = current[key];
|
|
787
|
+
const nextPath = path ? `${path}.${key}` : key;
|
|
788
|
+
if (!list) {
|
|
789
|
+
visit(child, rest, nextPath);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
if (!Array.isArray(child)) return;
|
|
793
|
+
for (let index = 0; index < child.length; index += 1) visit(child[index], rest, `${nextPath}[${index}]`);
|
|
794
|
+
};
|
|
795
|
+
visit(value, pathPatternSegments(pattern), "");
|
|
796
|
+
return out;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function reportV1Tombstones(issues: Issues, raw: Record<string, unknown>): void {
|
|
800
|
+
const reportedRoots = new Set<string>();
|
|
801
|
+
for (const [from, to] of SETTINGS_V1_PATH_MOVES) {
|
|
802
|
+
for (const match of patternMatches(raw, from)) {
|
|
803
|
+
issues.add(match.path, `retired settings-v1 path; use ${to} in version 2`);
|
|
804
|
+
reportedRoots.add(match.path.split(/[.[]/u)[0] ?? match.path);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
for (const [path, reason] of Object.entries(SETTINGS_V1_RETIRED_PATHS)) {
|
|
808
|
+
for (const match of patternMatches(raw, path)) {
|
|
809
|
+
issues.add(match.path, `retired without replacement: ${reason}. Remove this key`);
|
|
810
|
+
reportedRoots.add(match.path.split(/[.[]/u)[0] ?? match.path);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
for (const root of V1_ONLY_ROOTS) {
|
|
814
|
+
if (root in raw && !reportedRoots.has(root)) {
|
|
815
|
+
const replacements = new Set(
|
|
816
|
+
SETTINGS_V1_PATH_MOVES.filter(([from]) => from.split(/[.[]/u)[0] === root).map(
|
|
817
|
+
([, to]) => to.split(/[.[]/u)[0] ?? to,
|
|
818
|
+
),
|
|
819
|
+
);
|
|
820
|
+
const hint = replacements.size > 0 ? `; use ${[...replacements].join(" or ")} in version 2` : "";
|
|
821
|
+
issues.add(root, `retired settings-v1 namespace${hint}; migrate this document with \`clio-coder upgrade\``);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function validateRoute(
|
|
585
827
|
issues: Issues,
|
|
586
828
|
path: string,
|
|
587
829
|
value: unknown,
|
|
588
|
-
defaults:
|
|
830
|
+
defaults: FleetRoute,
|
|
589
831
|
targets: ReadonlyArray<ClioSettings["targets"][number]>,
|
|
590
832
|
options?: { nodeIds?: ReadonlySet<string> },
|
|
591
|
-
):
|
|
592
|
-
const out
|
|
833
|
+
): FleetRoute {
|
|
834
|
+
const out = cloneValue(defaults);
|
|
593
835
|
if (!isPlainObject(value)) {
|
|
594
836
|
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
595
837
|
return out;
|
|
@@ -600,80 +842,58 @@ function validateWorkerTarget(
|
|
|
600
842
|
value,
|
|
601
843
|
allowNode ? ["target", "model", "thinkingLevel", "node"] : ["target", "model", "thinkingLevel"],
|
|
602
844
|
);
|
|
603
|
-
if ("target" in value
|
|
604
|
-
|
|
605
|
-
|
|
845
|
+
if ("target" in value) {
|
|
846
|
+
if (value.target === null) out.target = null;
|
|
847
|
+
else {
|
|
848
|
+
const parsed = expectString(issues, `${path}.target`, value.target);
|
|
849
|
+
if (parsed !== undefined) out.target = targets.some((entry) => entry.id === parsed) ? parsed : null;
|
|
850
|
+
}
|
|
606
851
|
}
|
|
607
|
-
if ("
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
const v = expectString(issues, `${path}.model`, value.model);
|
|
613
|
-
if (v !== undefined) out.model = v;
|
|
614
|
-
}
|
|
615
|
-
// Node pins follow the target idiom: a pin naming a node that is not
|
|
616
|
-
// configured (and is not the implicit local node) is dropped, not fatal.
|
|
617
|
-
if (allowNode && "node" in value && value.node !== null) {
|
|
618
|
-
const v = expectString(issues, `${path}.node`, value.node);
|
|
619
|
-
if (v !== undefined) {
|
|
620
|
-
const id = v.trim();
|
|
621
|
-
if (id.length > 0 && (id === "local" || options?.nodeIds?.has(id) === true)) out.node = id;
|
|
852
|
+
if ("model" in value) {
|
|
853
|
+
if (value.model === null) out.model = null;
|
|
854
|
+
else {
|
|
855
|
+
const parsed = expectString(issues, `${path}.model`, value.model);
|
|
856
|
+
if (parsed !== undefined) out.model = parsed;
|
|
622
857
|
}
|
|
623
858
|
}
|
|
624
|
-
if (
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
859
|
+
if ("thinkingLevel" in value) {
|
|
860
|
+
const parsed = expectEnum(issues, `${path}.thinkingLevel`, value.thinkingLevel, THINKING_LEVELS);
|
|
861
|
+
if (parsed !== undefined) out.thinkingLevel = parsed;
|
|
862
|
+
}
|
|
863
|
+
if (allowNode && "node" in value) {
|
|
864
|
+
if (value.node === null) delete out.node;
|
|
865
|
+
else {
|
|
866
|
+
const parsed = expectString(issues, `${path}.node`, value.node);
|
|
867
|
+
if (parsed !== undefined && (parsed === "local" || options.nodeIds?.has(parsed) === true)) out.node = parsed;
|
|
868
|
+
}
|
|
628
869
|
}
|
|
870
|
+
if (!out.target) out.model = null;
|
|
871
|
+
else if (out.model === null) out.model = targets.find((entry) => entry.id === out.target)?.defaultModel ?? null;
|
|
629
872
|
return out;
|
|
630
873
|
}
|
|
631
874
|
|
|
632
|
-
/** `targetId/wireModelId` refs filtered to configured target ids. */
|
|
633
875
|
function normalizeModelRefs(
|
|
634
876
|
refs: ReadonlyArray<string>,
|
|
635
877
|
targets: ReadonlyArray<ClioSettings["targets"][number]>,
|
|
636
878
|
): string[] {
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const model = modelParts.join("/").trim();
|
|
643
|
-
if (!model) continue;
|
|
644
|
-
const normalized = `${targetId}/${model}`;
|
|
645
|
-
if (!out.includes(normalized)) out.push(normalized);
|
|
646
|
-
}
|
|
647
|
-
return out;
|
|
879
|
+
const targetIds = new Set(targets.map((target) => target.id));
|
|
880
|
+
return refs.filter((ref) => {
|
|
881
|
+
const [targetId, ...model] = ref.split("/");
|
|
882
|
+
return Boolean(targetId && targetIds.has(targetId) && model.join("/").trim());
|
|
883
|
+
});
|
|
648
884
|
}
|
|
649
885
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
* whose target is not configured is kept, not dropped: a renamed or
|
|
653
|
-
* temporarily removed target is the common staleness case, and silently
|
|
654
|
-
* deleting the operator's cycle set at load destroys a preference they never
|
|
655
|
-
* asked to change. Disclosure belongs to the presentation layer, which lists
|
|
656
|
-
* unresolvable refs under "Unavailable"; the consumers that must resolve a ref
|
|
657
|
-
* (advanceScopedTarget) filter it themselves.
|
|
658
|
-
*/
|
|
659
|
-
function normalizeScope(refs: ReadonlyArray<string>): string[] {
|
|
660
|
-
const out: string[] = [];
|
|
661
|
-
for (const ref of refs) {
|
|
662
|
-
const trimmed = ref.trim();
|
|
663
|
-
const [targetId] = trimmed.split("/");
|
|
664
|
-
if (!targetId) continue;
|
|
665
|
-
if (!out.includes(trimmed)) out.push(trimmed);
|
|
666
|
-
}
|
|
667
|
-
return out;
|
|
886
|
+
function normalizeCycleSet(refs: ReadonlyArray<string>): string[] {
|
|
887
|
+
return refs.filter((ref) => Boolean(ref.trim().split("/")[0]));
|
|
668
888
|
}
|
|
669
889
|
|
|
670
|
-
function
|
|
890
|
+
function validateExternalAgent(
|
|
671
891
|
issues: Issues,
|
|
672
892
|
path: string,
|
|
673
893
|
value: unknown,
|
|
674
|
-
defaults:
|
|
894
|
+
defaults: ExternalAgentDefaults,
|
|
675
895
|
seen: Set<string>,
|
|
676
|
-
):
|
|
896
|
+
): ExternalAgent | null {
|
|
677
897
|
if (!isPlainObject(value)) {
|
|
678
898
|
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
679
899
|
return null;
|
|
@@ -702,11 +922,11 @@ function validateDelegationAgent(
|
|
|
702
922
|
return null;
|
|
703
923
|
}
|
|
704
924
|
if (seen.has(id)) {
|
|
705
|
-
issues.add(`${path}.id`, `duplicate
|
|
925
|
+
issues.add(`${path}.id`, `duplicate external agent id '${id}'`);
|
|
706
926
|
return null;
|
|
707
927
|
}
|
|
708
928
|
seen.add(id);
|
|
709
|
-
const agent:
|
|
929
|
+
const agent: ExternalAgent = {
|
|
710
930
|
id,
|
|
711
931
|
command,
|
|
712
932
|
args: [],
|
|
@@ -716,89 +936,44 @@ function validateDelegationAgent(
|
|
|
716
936
|
toolGovernance: defaults.toolGovernance,
|
|
717
937
|
};
|
|
718
938
|
if ("args" in value) {
|
|
719
|
-
const
|
|
720
|
-
if (
|
|
939
|
+
const parsed = expectStringArray(issues, `${path}.args`, value.args);
|
|
940
|
+
if (parsed !== undefined) agent.args = parsed;
|
|
721
941
|
}
|
|
722
942
|
for (const key of ["connectTimeoutMs", "turnTimeoutMs", "permissionTimeoutMs"] as const) {
|
|
723
|
-
if (key in value)
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
943
|
+
if (!(key in value)) continue;
|
|
944
|
+
const parsed = expectInteger(issues, `${path}.${key}`, value[key], { min: 1, max: MAX_TIMER_DELAY_MS });
|
|
945
|
+
if (parsed !== undefined) agent[key] = parsed;
|
|
727
946
|
}
|
|
728
947
|
if ("stallTimeoutMs" in value) {
|
|
729
|
-
const
|
|
730
|
-
if (
|
|
948
|
+
const parsed = expectInteger(issues, `${path}.stallTimeoutMs`, value.stallTimeoutMs);
|
|
949
|
+
if (parsed !== undefined) agent.stallTimeoutMs = parsed;
|
|
731
950
|
}
|
|
732
951
|
if ("toolGovernance" in value) {
|
|
733
|
-
const
|
|
734
|
-
|
|
952
|
+
const parsed = expectEnum(
|
|
953
|
+
issues,
|
|
954
|
+
`${path}.toolGovernance`,
|
|
955
|
+
normalizeLegacyNamingValue(value.toolGovernance, "clio-policy", "clio-coder-policy"),
|
|
956
|
+
TOOL_GOVERNANCE,
|
|
957
|
+
);
|
|
958
|
+
if (parsed !== undefined) agent.toolGovernance = parsed;
|
|
735
959
|
}
|
|
736
960
|
if ("projectContext" in value) {
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
961
|
+
const parsed = expectEnum(issues, `${path}.projectContext`, value.projectContext, ["none", "bounded"] as const);
|
|
962
|
+
if (parsed !== undefined) agent.projectContext = parsed;
|
|
739
963
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
964
|
+
for (const key of ["cwd"] as const) {
|
|
965
|
+
if (!(key in value)) continue;
|
|
966
|
+
const parsed = expectString(issues, `${path}.${key}`, value[key]);
|
|
967
|
+
if (parsed !== undefined) agent[key] = parsed;
|
|
743
968
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
if ("labels" in value) {
|
|
749
|
-
const v = expectStringRecord(issues, `${path}.labels`, value.labels);
|
|
750
|
-
if (v !== undefined && Object.keys(v).length > 0) agent.labels = v;
|
|
969
|
+
for (const key of ["env", "labels"] as const) {
|
|
970
|
+
if (!(key in value)) continue;
|
|
971
|
+
const parsed = expectStringRecord(issues, `${path}.${key}`, value[key]);
|
|
972
|
+
if (parsed !== undefined && Object.keys(parsed).length > 0) agent[key] = parsed;
|
|
751
973
|
}
|
|
752
974
|
return agent;
|
|
753
975
|
}
|
|
754
976
|
|
|
755
|
-
function validateDelegation(issues: Issues, value: unknown): ClioSettings["delegation"] {
|
|
756
|
-
const out = cloneValue(DEFAULT_SETTINGS.delegation);
|
|
757
|
-
if (!isPlainObject(value)) {
|
|
758
|
-
issues.add("delegation", `expected a map, got ${describe(value)}`);
|
|
759
|
-
return out;
|
|
760
|
-
}
|
|
761
|
-
issues.unknownKeys("delegation", value, ["agents", "defaults"]);
|
|
762
|
-
if ("defaults" in value) {
|
|
763
|
-
if (!isPlainObject(value.defaults)) {
|
|
764
|
-
issues.add("delegation.defaults", `expected a map, got ${describe(value.defaults)}`);
|
|
765
|
-
} else {
|
|
766
|
-
issues.unknownKeys("delegation.defaults", value.defaults, [
|
|
767
|
-
"connectTimeoutMs",
|
|
768
|
-
"turnTimeoutMs",
|
|
769
|
-
"permissionTimeoutMs",
|
|
770
|
-
"toolGovernance",
|
|
771
|
-
]);
|
|
772
|
-
for (const key of ["connectTimeoutMs", "turnTimeoutMs", "permissionTimeoutMs"] as const) {
|
|
773
|
-
if (key in value.defaults) {
|
|
774
|
-
const v = expectInteger(issues, `delegation.defaults.${key}`, value.defaults[key], {
|
|
775
|
-
min: 1,
|
|
776
|
-
max: MAX_TIMER_DELAY_MS,
|
|
777
|
-
});
|
|
778
|
-
if (v !== undefined) out.defaults[key] = v;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
if ("toolGovernance" in value.defaults) {
|
|
782
|
-
const v = expectEnum(issues, "delegation.defaults.toolGovernance", value.defaults.toolGovernance, TOOL_GOVERNANCE);
|
|
783
|
-
if (v !== undefined) out.defaults.toolGovernance = v;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
if ("agents" in value) {
|
|
788
|
-
if (!Array.isArray(value.agents)) {
|
|
789
|
-
issues.add("delegation.agents", `expected a list, got ${describe(value.agents)}`);
|
|
790
|
-
} else {
|
|
791
|
-
const seen = new Set<string>();
|
|
792
|
-
out.agents = value.agents
|
|
793
|
-
.map((entry, i) => validateDelegationAgent(issues, `delegation.agents[${i}]`, entry, out.defaults, seen))
|
|
794
|
-
.filter((entry): entry is NonNullable<typeof entry> => entry !== null);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return out;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
type FleetNodeConfig = ClioSettings["fleet"]["nodes"][number];
|
|
801
|
-
|
|
802
977
|
function validateFleetNode(issues: Issues, path: string, value: unknown, seen: Set<string>): FleetNodeConfig | null {
|
|
803
978
|
if (!isPlainObject(value)) {
|
|
804
979
|
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
@@ -811,7 +986,6 @@ function validateFleetNode(issues: Issues, path: string, value: unknown, seen: S
|
|
|
811
986
|
"port",
|
|
812
987
|
"identityFile",
|
|
813
988
|
"clioCoderEntry",
|
|
814
|
-
// Pre-0.3.1 spelling, still read.
|
|
815
989
|
"clioEntry",
|
|
816
990
|
"labels",
|
|
817
991
|
"maxWorkers",
|
|
@@ -822,197 +996,79 @@ function validateFleetNode(issues: Issues, path: string, value: unknown, seen: S
|
|
|
822
996
|
if (!("id" in value)) issues.add(`${path}.id`, "required");
|
|
823
997
|
if (!("host" in value)) issues.add(`${path}.host`, "required");
|
|
824
998
|
if (id === undefined || host === undefined) return null;
|
|
825
|
-
|
|
826
|
-
if (trimmedId.length === 0) {
|
|
827
|
-
issues.add(`${path}.id`, "must not be blank");
|
|
828
|
-
return null;
|
|
829
|
-
}
|
|
830
|
-
if (trimmedId === "local") {
|
|
999
|
+
if (id === "local") {
|
|
831
1000
|
issues.add(`${path}.id`, "'local' is reserved for the implicit local node");
|
|
832
1001
|
return null;
|
|
833
1002
|
}
|
|
834
|
-
if (seen.has(
|
|
835
|
-
issues.add(`${path}.id`, `duplicate fleet node id '${
|
|
1003
|
+
if (seen.has(id)) {
|
|
1004
|
+
issues.add(`${path}.id`, `duplicate fleet node id '${id}'`);
|
|
836
1005
|
return null;
|
|
837
1006
|
}
|
|
838
|
-
seen.add(
|
|
839
|
-
const node: FleetNodeConfig = { id
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1007
|
+
seen.add(id);
|
|
1008
|
+
const node: FleetNodeConfig = { id, host, maxWorkers: 2 };
|
|
1009
|
+
for (const key of ["user", "identityFile", "clioCoderEntry"] as const) {
|
|
1010
|
+
if (!(key in value)) continue;
|
|
1011
|
+
const parsed = expectString(issues, `${path}.${key}`, value[key]);
|
|
1012
|
+
if (parsed !== undefined) node[key] = parsed;
|
|
843
1013
|
}
|
|
844
1014
|
if ("port" in value) {
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
}
|
|
848
|
-
if ("identityFile" in value) {
|
|
849
|
-
const v = expectString(issues, `${path}.identityFile`, value.identityFile);
|
|
850
|
-
if (v !== undefined) node.identityFile = v;
|
|
851
|
-
}
|
|
852
|
-
// The key was `clioEntry` before 0.3.1. Both spellings read; the new one
|
|
853
|
-
// wins when a node carries both.
|
|
854
|
-
if ("clioEntry" in value) {
|
|
855
|
-
const v = expectString(issues, `${path}.clioEntry`, value.clioEntry);
|
|
856
|
-
if (v !== undefined) node.clioCoderEntry = v;
|
|
857
|
-
}
|
|
858
|
-
if ("clioCoderEntry" in value) {
|
|
859
|
-
const v = expectString(issues, `${path}.clioCoderEntry`, value.clioCoderEntry);
|
|
860
|
-
if (v !== undefined) node.clioCoderEntry = v;
|
|
1015
|
+
const parsed = expectInteger(issues, `${path}.port`, value.port, { min: 1 });
|
|
1016
|
+
if (parsed !== undefined) node.port = parsed;
|
|
861
1017
|
}
|
|
862
1018
|
if ("labels" in value) {
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
1019
|
+
const parsed = expectStringArray(issues, `${path}.labels`, value.labels);
|
|
1020
|
+
if (parsed !== undefined) node.labels = parsed;
|
|
865
1021
|
}
|
|
866
1022
|
if ("maxWorkers" in value) {
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
1023
|
+
const parsed = expectInteger(issues, `${path}.maxWorkers`, value.maxWorkers, { min: 1 });
|
|
1024
|
+
if (parsed !== undefined) node.maxWorkers = parsed;
|
|
869
1025
|
}
|
|
870
1026
|
if ("residency" in value) {
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
1027
|
+
const parsed = expectEnum(issues, `${path}.residency`, value.residency, ["observe", "manage"] as const);
|
|
1028
|
+
if (parsed !== undefined) node.residency = parsed;
|
|
873
1029
|
}
|
|
874
1030
|
return node;
|
|
875
1031
|
}
|
|
876
1032
|
|
|
877
|
-
function
|
|
878
|
-
const out = cloneValue(DEFAULT_SETTINGS.fleet);
|
|
879
|
-
if (!isPlainObject(value)) {
|
|
880
|
-
issues.add("fleet", `expected a map, got ${describe(value)}`);
|
|
881
|
-
return out;
|
|
882
|
-
}
|
|
883
|
-
issues.unknownKeys("fleet", value, ["nodes"]);
|
|
884
|
-
if ("nodes" in value) {
|
|
885
|
-
if (!Array.isArray(value.nodes)) {
|
|
886
|
-
issues.add("fleet.nodes", `expected a list, got ${describe(value.nodes)}`);
|
|
887
|
-
} else {
|
|
888
|
-
const seen = new Set<string>();
|
|
889
|
-
out.nodes = value.nodes
|
|
890
|
-
.map((entry, i) => validateFleetNode(issues, `fleet.nodes[${i}]`, entry, seen))
|
|
891
|
-
.filter((entry): entry is NonNullable<typeof entry> => entry !== null);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
return out;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
function validateMemorySettings(issues: Issues, value: unknown): ClioSettings["memory"] {
|
|
898
|
-
const out = cloneValue(DEFAULT_SETTINGS.memory);
|
|
899
|
-
if (!isPlainObject(value)) {
|
|
900
|
-
issues.add("memory", `expected a map, got ${describe(value)}`);
|
|
901
|
-
return out;
|
|
902
|
-
}
|
|
903
|
-
issues.unknownKeys("memory", value, ["intervention"]);
|
|
904
|
-
if (!("intervention" in value)) return out;
|
|
905
|
-
if (!isPlainObject(value.intervention)) {
|
|
906
|
-
issues.add("memory.intervention", `expected a map, got ${describe(value.intervention)}`);
|
|
907
|
-
return out;
|
|
908
|
-
}
|
|
909
|
-
const raw = value.intervention;
|
|
910
|
-
issues.unknownKeys("memory.intervention", raw, ["enabled", "everyNTools", "windowSteps", "maxTokens", "timeoutMs"]);
|
|
911
|
-
if ("enabled" in raw) {
|
|
912
|
-
const enabled = expectBoolean(issues, "memory.intervention.enabled", raw.enabled);
|
|
913
|
-
if (enabled !== undefined) out.intervention.enabled = enabled;
|
|
914
|
-
}
|
|
915
|
-
for (const key of ["everyNTools", "windowSteps", "maxTokens", "timeoutMs"] as const) {
|
|
916
|
-
if (!(key in raw)) continue;
|
|
917
|
-
const parsed = expectInteger(issues, `memory.intervention.${key}`, raw[key], {
|
|
918
|
-
min: key === "everyNTools" ? 2 : 1,
|
|
919
|
-
});
|
|
920
|
-
if (parsed !== undefined) out.intervention[key] = parsed;
|
|
921
|
-
}
|
|
922
|
-
return out;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* The watchdog block. `target` and `cadenceToolCalls` stay absent rather than
|
|
927
|
-
* taking sentinel values: an absent target means the session's active target,
|
|
928
|
-
* and an absent cadence means the watchdog fires only at turn end. A written
|
|
929
|
-
* default for either would turn "not configured" into a configuration.
|
|
930
|
-
*/
|
|
931
|
-
function validateWatchdogSettings(issues: Issues, value: unknown): ClioSettings["watchdog"] {
|
|
932
|
-
const out = cloneValue(DEFAULT_SETTINGS.watchdog);
|
|
933
|
-
if (!isPlainObject(value)) {
|
|
934
|
-
issues.add("watchdog", `expected a map, got ${describe(value)}`);
|
|
935
|
-
return out;
|
|
936
|
-
}
|
|
937
|
-
issues.unknownKeys("watchdog", value, ["enabled", "target", "cadenceToolCalls"]);
|
|
938
|
-
if ("enabled" in value) {
|
|
939
|
-
const enabled = expectBoolean(issues, "watchdog.enabled", value.enabled);
|
|
940
|
-
if (enabled !== undefined) out.enabled = enabled;
|
|
941
|
-
}
|
|
942
|
-
if ("target" in value && value.target !== null) {
|
|
943
|
-
const target = expectString(issues, "watchdog.target", value.target);
|
|
944
|
-
if (target !== undefined) {
|
|
945
|
-
if (target.trim().length === 0) issues.add("watchdog.target", "expected a non-empty target id");
|
|
946
|
-
else out.target = target.trim();
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
if ("cadenceToolCalls" in value && value.cadenceToolCalls !== null) {
|
|
950
|
-
const cadence = expectInteger(issues, "watchdog.cadenceToolCalls", value.cadenceToolCalls, { min: 1 });
|
|
951
|
-
if (cadence !== undefined) out.cadenceToolCalls = cadence;
|
|
952
|
-
}
|
|
953
|
-
return out;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
function validateKeybindings(issues: Issues, value: unknown): ClioSettings["keybindings"] {
|
|
1033
|
+
function validateKeybindings(issues: Issues, path: string, value: unknown): Record<string, string | string[]> {
|
|
957
1034
|
if (!isPlainObject(value)) {
|
|
958
|
-
issues.add(
|
|
1035
|
+
issues.add(path, `expected a map, got ${describe(value)}`);
|
|
959
1036
|
return {};
|
|
960
1037
|
}
|
|
961
1038
|
const next: Record<string, string | string[]> = {};
|
|
962
1039
|
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
963
|
-
const
|
|
1040
|
+
const legacyId = rawKey.trim();
|
|
1041
|
+
const id = legacyId.startsWith("clio.") ? `clio-coder.${legacyId.slice("clio.".length)}` : legacyId;
|
|
964
1042
|
if (!id) {
|
|
965
|
-
issues.add(
|
|
966
|
-
continue;
|
|
967
|
-
}
|
|
968
|
-
if (typeof rawValue === "string") {
|
|
969
|
-
const v = expectString(issues, `keybindings.${id}`, rawValue);
|
|
970
|
-
if (v !== undefined) next[id] = v;
|
|
1043
|
+
issues.add(path, "empty keybinding id");
|
|
971
1044
|
continue;
|
|
972
1045
|
}
|
|
973
|
-
if (
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
continue;
|
|
1046
|
+
if (id !== legacyId) {
|
|
1047
|
+
warnLegacyNaming(legacyId, id);
|
|
1048
|
+
// Canonical values win even when the legacy key occurs later in YAML.
|
|
1049
|
+
if (Object.hasOwn(value, id)) continue;
|
|
977
1050
|
}
|
|
978
|
-
|
|
1051
|
+
if (typeof rawValue === "string") {
|
|
1052
|
+
const parsed = expectString(issues, `${path}.${legacyId}`, rawValue);
|
|
1053
|
+
if (parsed !== undefined) next[id] = parsed;
|
|
1054
|
+
} else if (Array.isArray(rawValue)) {
|
|
1055
|
+
const parsed = expectStringArray(issues, `${path}.${legacyId}`, rawValue);
|
|
1056
|
+
if (parsed !== undefined && parsed.length > 0) next[id] = parsed;
|
|
1057
|
+
} else issues.add(`${path}.${legacyId}`, `expected a string or list of strings, got ${describe(rawValue)}`);
|
|
979
1058
|
}
|
|
980
1059
|
return next;
|
|
981
1060
|
}
|
|
982
1061
|
|
|
983
1062
|
const TOP_LEVEL_KEYS = [
|
|
984
1063
|
"version",
|
|
985
|
-
// Accepted and ignored. Settings files generated before 0.3.1 carry an
|
|
986
|
-
// `identity:` line for a control nothing ever read; listing it here keeps
|
|
987
|
-
// those files loading without an unknown-key issue.
|
|
988
|
-
"identity",
|
|
989
|
-
"autonomy",
|
|
990
1064
|
"targets",
|
|
991
|
-
"
|
|
992
|
-
"orchestrator",
|
|
993
|
-
"background",
|
|
994
|
-
"memory",
|
|
995
|
-
"watchdog",
|
|
996
|
-
"workers",
|
|
1065
|
+
"chat",
|
|
997
1066
|
"fleet",
|
|
998
|
-
"routing",
|
|
999
|
-
"scope",
|
|
1000
|
-
"modelSelector",
|
|
1001
|
-
"budget",
|
|
1002
|
-
"defaults",
|
|
1003
|
-
"theme",
|
|
1004
|
-
"terminal",
|
|
1005
|
-
"skills",
|
|
1006
|
-
"library",
|
|
1007
|
-
"attribution",
|
|
1008
|
-
"delegation",
|
|
1009
|
-
"keybindings",
|
|
1010
|
-
"compaction",
|
|
1011
1067
|
"context",
|
|
1012
|
-
"
|
|
1013
|
-
"
|
|
1014
|
-
"
|
|
1015
|
-
|
|
1068
|
+
"safety",
|
|
1069
|
+
"interface",
|
|
1070
|
+
"integrations",
|
|
1071
|
+
...V1_ONLY_ROOTS,
|
|
1016
1072
|
] as const;
|
|
1017
1073
|
|
|
1018
1074
|
export interface SettingsValidationResult {
|
|
@@ -1030,529 +1086,416 @@ export interface SettingsValidationResult {
|
|
|
1030
1086
|
export function validateSettings(raw: unknown): SettingsValidationResult {
|
|
1031
1087
|
const issues = new Issues();
|
|
1032
1088
|
const settings = cloneValue(DEFAULT_SETTINGS);
|
|
1033
|
-
// A genuinely missing settings file falls back to defaults before ever
|
|
1034
|
-
// reaching here (validateSettingsFile returns early when the file is absent).
|
|
1035
|
-
// So a null/undefined raw here means a present-but-empty or `null` document,
|
|
1036
|
-
// which is malformed and must be a root-shape issue, not silent defaults.
|
|
1037
1089
|
if (!isPlainObject(raw)) {
|
|
1038
1090
|
issues.add("(root)", `expected a map, got ${describe(raw)}`);
|
|
1039
1091
|
return { settings, issues: issues.list };
|
|
1040
1092
|
}
|
|
1093
|
+
reportV1Tombstones(issues, raw);
|
|
1041
1094
|
issues.unknownKeys("", raw, TOP_LEVEL_KEYS);
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
issues.add("version", `expected 1, got ${describe(raw.version)}`);
|
|
1045
|
-
}
|
|
1046
|
-
if ("autonomy" in raw) {
|
|
1047
|
-
const v = expectEnum(issues, "autonomy", raw.autonomy, AUTONOMY_LEVELS);
|
|
1048
|
-
if (v !== undefined) settings.autonomy = v;
|
|
1095
|
+
if ("version" in raw && raw.version !== 2) {
|
|
1096
|
+
issues.add("version", `expected 2, got ${describe(raw.version)}; run \`clio-coder upgrade\` for version 1`);
|
|
1049
1097
|
}
|
|
1050
1098
|
|
|
1051
1099
|
if ("targets" in raw) {
|
|
1052
|
-
if (!Array.isArray(raw.targets)) {
|
|
1053
|
-
|
|
1054
|
-
} else {
|
|
1100
|
+
if (!Array.isArray(raw.targets)) issues.add("targets", `expected a list, got ${describe(raw.targets)}`);
|
|
1101
|
+
else {
|
|
1055
1102
|
const seen = new Set<string>();
|
|
1056
|
-
const
|
|
1057
|
-
for (let
|
|
1058
|
-
const target = validateTarget(issues, `targets[${
|
|
1103
|
+
const targets: ClioSettings["targets"] = [];
|
|
1104
|
+
for (let index = 0; index < raw.targets.length; index += 1) {
|
|
1105
|
+
const target = validateTarget(issues, `targets[${index}]`, raw.targets[index]);
|
|
1059
1106
|
if (!target) continue;
|
|
1060
1107
|
if (seen.has(target.id)) {
|
|
1061
|
-
issues.add(`targets[${
|
|
1108
|
+
issues.add(`targets[${index}].id`, `duplicate target id '${target.id}'`);
|
|
1062
1109
|
continue;
|
|
1063
1110
|
}
|
|
1064
1111
|
seen.add(target.id);
|
|
1065
|
-
|
|
1112
|
+
targets.push(target);
|
|
1066
1113
|
}
|
|
1067
|
-
settings.targets =
|
|
1114
|
+
settings.targets = targets;
|
|
1068
1115
|
}
|
|
1069
1116
|
}
|
|
1070
1117
|
|
|
1071
|
-
if ("
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
if (raw.library.sync !== undefined) {
|
|
1088
|
-
if (typeof raw.library.sync !== "boolean")
|
|
1089
|
-
issues.add("library.sync", `expected a boolean, got ${describe(raw.library.sync)}`);
|
|
1090
|
-
else settings.library.sync = raw.library.sync;
|
|
1118
|
+
if ("chat" in raw) {
|
|
1119
|
+
if (!isPlainObject(raw.chat)) issues.add("chat", `expected a map, got ${describe(raw.chat)}`);
|
|
1120
|
+
else {
|
|
1121
|
+
const chat = raw.chat;
|
|
1122
|
+
issues.unknownKeys("chat", chat, [
|
|
1123
|
+
"target",
|
|
1124
|
+
"model",
|
|
1125
|
+
"thinkingLevel",
|
|
1126
|
+
"modelPicker",
|
|
1127
|
+
"maxOutputTokens",
|
|
1128
|
+
"prewarm",
|
|
1129
|
+
"retry",
|
|
1130
|
+
]);
|
|
1131
|
+
const routeInput: Record<string, unknown> = {};
|
|
1132
|
+
for (const key of ["target", "model", "thinkingLevel"] as const) {
|
|
1133
|
+
if (key in chat) routeInput[key] = chat[key];
|
|
1091
1134
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
settings.
|
|
1101
|
-
settings.
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
settings.fleet = validateFleet(issues, raw.fleet);
|
|
1120
|
-
}
|
|
1121
|
-
const fleetNodeIds = new Set(settings.fleet.nodes.map((node) => node.id));
|
|
1122
|
-
|
|
1123
|
-
if ("routing" in raw) {
|
|
1124
|
-
if (!isPlainObject(raw.routing)) {
|
|
1125
|
-
issues.add("routing", `expected a map, got ${describe(raw.routing)}`);
|
|
1126
|
-
} else {
|
|
1127
|
-
issues.unknownKeys("routing", raw.routing, ["activeRoles", "activePostures", "agentAutomation"]);
|
|
1128
|
-
const activeRoles = expectStringArray(issues, "routing.activeRoles", raw.routing.activeRoles);
|
|
1129
|
-
if (activeRoles !== undefined) {
|
|
1130
|
-
const allowed = new Set<string>(ACTIVE_ROUTING_ROLES);
|
|
1131
|
-
const rawRoles = raw.routing.activeRoles as unknown[];
|
|
1132
|
-
const stringRoles = rawRoles.filter((role): role is string => typeof role === "string");
|
|
1133
|
-
const complete = activeRoles.length === rawRoles.length;
|
|
1134
|
-
for (const role of activeRoles) {
|
|
1135
|
-
if (!allowed.has(role)) issues.add("routing.activeRoles", `unsupported active role '${role}'`);
|
|
1136
|
-
}
|
|
1137
|
-
if (new Set(stringRoles).size !== stringRoles.length) {
|
|
1138
|
-
issues.add("routing.activeRoles", "expected unique roles");
|
|
1139
|
-
}
|
|
1140
|
-
if (complete && activeRoles.every((role) => allowed.has(role))) {
|
|
1141
|
-
settings.routing.activeRoles = activeRoles as typeof settings.routing.activeRoles;
|
|
1135
|
+
const route = validateRoute(
|
|
1136
|
+
issues,
|
|
1137
|
+
"chat",
|
|
1138
|
+
routeInput,
|
|
1139
|
+
{ target: settings.chat.target, model: settings.chat.model, thinkingLevel: settings.chat.thinkingLevel },
|
|
1140
|
+
settings.targets,
|
|
1141
|
+
);
|
|
1142
|
+
settings.chat.target = route.target;
|
|
1143
|
+
settings.chat.model = route.model;
|
|
1144
|
+
settings.chat.thinkingLevel = route.thinkingLevel;
|
|
1145
|
+
if ("modelPicker" in chat) {
|
|
1146
|
+
if (!isPlainObject(chat.modelPicker))
|
|
1147
|
+
issues.add("chat.modelPicker", `expected a map, got ${describe(chat.modelPicker)}`);
|
|
1148
|
+
else {
|
|
1149
|
+
issues.unknownKeys("chat.modelPicker", chat.modelPicker, ["cycleSet", "favorites", "recentLimit"]);
|
|
1150
|
+
if ("cycleSet" in chat.modelPicker) {
|
|
1151
|
+
const parsed = expectStringArray(issues, "chat.modelPicker.cycleSet", chat.modelPicker.cycleSet);
|
|
1152
|
+
if (parsed !== undefined) settings.chat.modelPicker.cycleSet = normalizeCycleSet(parsed);
|
|
1153
|
+
}
|
|
1154
|
+
if ("favorites" in chat.modelPicker) {
|
|
1155
|
+
const parsed = expectStringArray(issues, "chat.modelPicker.favorites", chat.modelPicker.favorites);
|
|
1156
|
+
if (parsed !== undefined) settings.chat.modelPicker.favorites = normalizeModelRefs(parsed, settings.targets);
|
|
1157
|
+
}
|
|
1158
|
+
if ("recentLimit" in chat.modelPicker) {
|
|
1159
|
+
const parsed = expectInteger(issues, "chat.modelPicker.recentLimit", chat.modelPicker.recentLimit, { min: 1 });
|
|
1160
|
+
if (parsed !== undefined) settings.chat.modelPicker.recentLimit = parsed;
|
|
1161
|
+
}
|
|
1142
1162
|
}
|
|
1143
1163
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
const rawPostures = raw.routing.activePostures as unknown[];
|
|
1148
|
-
const stringPostures = rawPostures.filter((posture): posture is string => typeof posture === "string");
|
|
1149
|
-
const complete = activePostures.length === rawPostures.length;
|
|
1150
|
-
for (const posture of activePostures) {
|
|
1151
|
-
if (!allowed.has(posture)) issues.add("routing.activePostures", `unsupported active posture '${posture}'`);
|
|
1152
|
-
}
|
|
1153
|
-
if (new Set(stringPostures).size !== stringPostures.length) {
|
|
1154
|
-
issues.add("routing.activePostures", "expected unique postures");
|
|
1155
|
-
}
|
|
1156
|
-
if (complete && activePostures.every((posture) => allowed.has(posture))) {
|
|
1157
|
-
settings.routing.activePostures = activePostures as typeof settings.routing.activePostures;
|
|
1158
|
-
}
|
|
1164
|
+
if ("maxOutputTokens" in chat) {
|
|
1165
|
+
const parsed = expectInteger(issues, "chat.maxOutputTokens", chat.maxOutputTokens, { min: 0 });
|
|
1166
|
+
if (parsed !== undefined) settings.chat.maxOutputTokens = parsed;
|
|
1159
1167
|
}
|
|
1160
|
-
if (
|
|
1161
|
-
issues
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
if (!
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
const agentId = expectString(issues, `${path}.agentId`, value.agentId);
|
|
1178
|
-
const executionRole = expectEnum(
|
|
1179
|
-
issues,
|
|
1180
|
-
`${path}.executionRole`,
|
|
1181
|
-
value.executionRole,
|
|
1182
|
-
ACTIVE_AGENT_AUTOMATION_ROLES,
|
|
1183
|
-
);
|
|
1184
|
-
if (agentId === "auto") {
|
|
1185
|
-
issues.add(`${path}.agentId`, "'auto' is reserved for coordinator-owned agent selection");
|
|
1186
|
-
}
|
|
1187
|
-
if (agentId === undefined || agentId === "auto" || executionRole === undefined) continue;
|
|
1188
|
-
const key = `${agentId}\u0000${executionRole}`;
|
|
1189
|
-
if (seen.has(key)) {
|
|
1190
|
-
issues.add(path, "duplicate agent and execution-role pair");
|
|
1191
|
-
continue;
|
|
1192
|
-
}
|
|
1193
|
-
seen.add(key);
|
|
1194
|
-
pairs.push({ agentId, executionRole });
|
|
1168
|
+
if ("prewarm" in chat) {
|
|
1169
|
+
const parsed = expectBoolean(issues, "chat.prewarm", chat.prewarm);
|
|
1170
|
+
if (parsed !== undefined) settings.chat.prewarm = parsed;
|
|
1171
|
+
}
|
|
1172
|
+
if ("retry" in chat) {
|
|
1173
|
+
if (!isPlainObject(chat.retry)) issues.add("chat.retry", `expected a map, got ${describe(chat.retry)}`);
|
|
1174
|
+
else {
|
|
1175
|
+
issues.unknownKeys("chat.retry", chat.retry, [
|
|
1176
|
+
"enabled",
|
|
1177
|
+
"maxRetries",
|
|
1178
|
+
"baseDelayMs",
|
|
1179
|
+
"maxDelayMs",
|
|
1180
|
+
"streamStallMs",
|
|
1181
|
+
]);
|
|
1182
|
+
if ("enabled" in chat.retry) {
|
|
1183
|
+
const parsed = expectBoolean(issues, "chat.retry.enabled", chat.retry.enabled);
|
|
1184
|
+
if (parsed !== undefined) settings.chat.retry.enabled = parsed;
|
|
1195
1185
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1186
|
+
for (const key of ["maxRetries", "baseDelayMs", "maxDelayMs", "streamStallMs"] as const) {
|
|
1187
|
+
if (!(key in chat.retry)) continue;
|
|
1188
|
+
const parsed = expectInteger(issues, `chat.retry.${key}`, chat.retry[key], { min: 0 });
|
|
1189
|
+
if (parsed !== undefined) settings.chat.retry[key] = parsed;
|
|
1198
1190
|
}
|
|
1199
1191
|
}
|
|
1200
1192
|
}
|
|
1201
1193
|
}
|
|
1202
1194
|
}
|
|
1203
1195
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1196
|
+
let rawFleet: Record<string, unknown> | null = null;
|
|
1197
|
+
if ("fleet" in raw) {
|
|
1198
|
+
if (!isPlainObject(raw.fleet)) issues.add("fleet", `expected a map, got ${describe(raw.fleet)}`);
|
|
1199
|
+
else {
|
|
1200
|
+
rawFleet = raw.fleet;
|
|
1201
|
+
issues.unknownKeys("fleet", rawFleet, [
|
|
1209
1202
|
"default",
|
|
1210
1203
|
"profiles",
|
|
1211
1204
|
"rosters",
|
|
1212
|
-
"
|
|
1213
|
-
"
|
|
1214
|
-
"
|
|
1215
|
-
"
|
|
1216
|
-
"
|
|
1205
|
+
"agentProfiles",
|
|
1206
|
+
"adaptiveRouting",
|
|
1207
|
+
"nodes",
|
|
1208
|
+
"permissions",
|
|
1209
|
+
"concurrency",
|
|
1210
|
+
"retry",
|
|
1211
|
+
"limits",
|
|
1212
|
+
"history",
|
|
1217
1213
|
]);
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
);
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
if (rawFleet && "nodes" in rawFleet) {
|
|
1217
|
+
if (!Array.isArray(rawFleet.nodes)) issues.add("fleet.nodes", `expected a list, got ${describe(rawFleet.nodes)}`);
|
|
1218
|
+
else {
|
|
1219
|
+
const seen = new Set<string>();
|
|
1220
|
+
settings.fleet.nodes = rawFleet.nodes
|
|
1221
|
+
.map((entry, index) => validateFleetNode(issues, `fleet.nodes[${index}]`, entry, seen))
|
|
1222
|
+
.filter((entry): entry is FleetNodeConfig => entry !== null);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
const fleetNodeIds = new Set(settings.fleet.nodes.map((node) => node.id));
|
|
1226
|
+
if (rawFleet) {
|
|
1227
|
+
if ("default" in rawFleet) {
|
|
1228
|
+
settings.fleet.default = validateRoute(
|
|
1229
|
+
issues,
|
|
1230
|
+
"fleet.default",
|
|
1231
|
+
rawFleet.default,
|
|
1232
|
+
settings.fleet.default,
|
|
1233
|
+
settings.targets,
|
|
1234
|
+
{
|
|
1235
|
+
nodeIds: fleetNodeIds,
|
|
1236
|
+
},
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
if ("profiles" in rawFleet) {
|
|
1240
|
+
if (!isPlainObject(rawFleet.profiles))
|
|
1241
|
+
issues.add("fleet.profiles", `expected a map, got ${describe(rawFleet.profiles)}`);
|
|
1242
|
+
else {
|
|
1243
|
+
const profiles: ClioSettings["fleet"]["profiles"] = {};
|
|
1244
|
+
for (const [rawName, rawProfile] of Object.entries(rawFleet.profiles)) {
|
|
1245
|
+
const name = rawName.trim();
|
|
1246
|
+
if (!name) {
|
|
1247
|
+
issues.add("fleet.profiles", "empty profile name");
|
|
1248
|
+
continue;
|
|
1249
1249
|
}
|
|
1250
|
-
|
|
1250
|
+
const profile = validateRoute(
|
|
1251
|
+
issues,
|
|
1252
|
+
`fleet.profiles.${name}`,
|
|
1253
|
+
rawProfile,
|
|
1254
|
+
DEFAULT_SETTINGS.fleet.default,
|
|
1255
|
+
settings.targets,
|
|
1256
|
+
{
|
|
1257
|
+
nodeIds: fleetNodeIds,
|
|
1258
|
+
},
|
|
1259
|
+
);
|
|
1260
|
+
if (profile.target) profiles[name] = profile;
|
|
1251
1261
|
}
|
|
1262
|
+
settings.fleet.profiles = profiles;
|
|
1252
1263
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
if (!isPlainObject(rawRoster)) {
|
|
1266
|
-
issues.add(path, `expected a map, got ${describe(rawRoster)}`);
|
|
1267
|
-
continue;
|
|
1268
|
-
}
|
|
1269
|
-
issues.unknownKeys(path, rawRoster, ["members"]);
|
|
1270
|
-
if (!Array.isArray(rawRoster.members)) {
|
|
1271
|
-
issues.add(`${path}.members`, "expected a list");
|
|
1272
|
-
continue;
|
|
1273
|
-
}
|
|
1274
|
-
if (rawRoster.members.length < 2 || rawRoster.members.length > 5) {
|
|
1275
|
-
issues.add(`${path}.members`, "expected 2 to 5 members");
|
|
1276
|
-
}
|
|
1277
|
-
const members: ClioSettings["workers"]["rosters"][string]["members"] = [];
|
|
1278
|
-
const labels = new Set<string>();
|
|
1279
|
-
for (const [index, rawMember] of rawRoster.members.entries()) {
|
|
1280
|
-
const memberPath = `${path}.members[${index}]`;
|
|
1281
|
-
if (!isPlainObject(rawMember)) {
|
|
1282
|
-
issues.add(memberPath, `expected a map, got ${describe(rawMember)}`);
|
|
1283
|
-
continue;
|
|
1284
|
-
}
|
|
1285
|
-
issues.unknownKeys(memberPath, rawMember, ["label", "target", "model", "thinking", "color"]);
|
|
1286
|
-
const label = expectString(issues, `${memberPath}.label`, rawMember.label);
|
|
1287
|
-
const target = expectString(issues, `${memberPath}.target`, rawMember.target);
|
|
1288
|
-
if (label !== undefined && !COUNCIL_MEMBER_LABEL_PATTERN.test(label)) {
|
|
1289
|
-
issues.add(`${memberPath}.label`, "expected [a-z][a-z0-9_-]{0,31}");
|
|
1290
|
-
}
|
|
1291
|
-
if (label !== undefined && labels.has(label)) issues.add(`${memberPath}.label`, "duplicate label");
|
|
1292
|
-
if (label !== undefined) labels.add(label);
|
|
1293
|
-
if (target !== undefined && !settings.targets.some((entry) => entry.id === target)) {
|
|
1294
|
-
issues.add(`${memberPath}.target`, `unknown target '${target}'`);
|
|
1295
|
-
}
|
|
1296
|
-
const model =
|
|
1297
|
-
rawMember.model === undefined ? undefined : expectString(issues, `${memberPath}.model`, rawMember.model);
|
|
1298
|
-
const thinking =
|
|
1299
|
-
rawMember.thinking === undefined
|
|
1300
|
-
? undefined
|
|
1301
|
-
: expectEnum(issues, `${memberPath}.thinking`, rawMember.thinking, THINKING_LEVELS);
|
|
1302
|
-
const color =
|
|
1303
|
-
rawMember.color === undefined ? undefined : expectString(issues, `${memberPath}.color`, rawMember.color);
|
|
1304
|
-
if (color !== undefined && !THEME_NAMED_COLORS.includes(color as never) && !/^#[0-9a-fA-F]{6}$/u.test(color)) {
|
|
1305
|
-
issues.add(`${memberPath}.color`, "expected a theme named color or 6-digit hex color");
|
|
1306
|
-
}
|
|
1307
|
-
if (label === undefined || target === undefined) continue;
|
|
1308
|
-
members.push({
|
|
1309
|
-
label,
|
|
1310
|
-
target,
|
|
1311
|
-
...(model ? { model } : {}),
|
|
1312
|
-
...(thinking ? { thinking } : {}),
|
|
1313
|
-
...(color ? { color } : {}),
|
|
1314
|
-
});
|
|
1315
|
-
}
|
|
1316
|
-
if (rawRoster.members.length >= 2 && rawRoster.members.length <= 5 && members.length === rawRoster.members.length)
|
|
1317
|
-
rosters[name] = { members };
|
|
1264
|
+
}
|
|
1265
|
+
if ("rosters" in rawFleet) {
|
|
1266
|
+
if (!isPlainObject(rawFleet.rosters))
|
|
1267
|
+
issues.add("fleet.rosters", `expected a map, got ${describe(rawFleet.rosters)}`);
|
|
1268
|
+
else {
|
|
1269
|
+
const rosters: ClioSettings["fleet"]["rosters"] = {};
|
|
1270
|
+
for (const [rawName, rawRoster] of Object.entries(rawFleet.rosters)) {
|
|
1271
|
+
const name = rawName.trim();
|
|
1272
|
+
const path = `fleet.rosters.${name}`;
|
|
1273
|
+
if (!name) {
|
|
1274
|
+
issues.add("fleet.rosters", "empty roster name");
|
|
1275
|
+
continue;
|
|
1318
1276
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1277
|
+
if (!isPlainObject(rawRoster)) {
|
|
1278
|
+
issues.add(path, `expected a map, got ${describe(rawRoster)}`);
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
issues.unknownKeys(path, rawRoster, ["members"]);
|
|
1282
|
+
if (!Array.isArray(rawRoster.members)) {
|
|
1283
|
+
issues.add(`${path}.members`, "expected a list");
|
|
1284
|
+
continue;
|
|
1285
|
+
}
|
|
1286
|
+
if (rawRoster.members.length < 2 || rawRoster.members.length > 5)
|
|
1287
|
+
issues.add(`${path}.members`, "expected 2 to 5 members");
|
|
1288
|
+
const members: ClioSettings["fleet"]["rosters"][string]["members"] = [];
|
|
1289
|
+
const labels = new Set<string>();
|
|
1290
|
+
for (const [index, rawMember] of rawRoster.members.entries()) {
|
|
1291
|
+
const memberPath = `${path}.members[${index}]`;
|
|
1292
|
+
if (!isPlainObject(rawMember)) {
|
|
1293
|
+
issues.add(memberPath, `expected a map, got ${describe(rawMember)}`);
|
|
1331
1294
|
continue;
|
|
1332
1295
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1296
|
+
issues.unknownKeys(memberPath, rawMember, ["label", "target", "model", "thinkingLevel", "color"]);
|
|
1297
|
+
const label = expectString(issues, `${memberPath}.label`, rawMember.label);
|
|
1298
|
+
const target = expectString(issues, `${memberPath}.target`, rawMember.target);
|
|
1299
|
+
if (label !== undefined && !COUNCIL_MEMBER_LABEL_PATTERN.test(label))
|
|
1300
|
+
issues.add(`${memberPath}.label`, "expected [a-z][a-z0-9_-]{0,31}");
|
|
1301
|
+
if (label !== undefined && labels.has(label)) issues.add(`${memberPath}.label`, "duplicate label");
|
|
1302
|
+
if (label !== undefined) labels.add(label);
|
|
1303
|
+
if (target !== undefined && !settings.targets.some((entry) => entry.id === target))
|
|
1304
|
+
issues.add(`${memberPath}.target`, `unknown target '${target}'`);
|
|
1305
|
+
const model =
|
|
1306
|
+
rawMember.model === undefined ? undefined : expectString(issues, `${memberPath}.model`, rawMember.model);
|
|
1307
|
+
const thinkingLevel =
|
|
1308
|
+
rawMember.thinkingLevel === undefined
|
|
1309
|
+
? undefined
|
|
1310
|
+
: expectEnum(issues, `${memberPath}.thinkingLevel`, rawMember.thinkingLevel, THINKING_LEVELS);
|
|
1311
|
+
const color =
|
|
1312
|
+
rawMember.color === undefined ? undefined : expectString(issues, `${memberPath}.color`, rawMember.color);
|
|
1313
|
+
if (color !== undefined && !THEME_NAMED_COLORS.includes(color as never) && !/^#[0-9a-fA-F]{6}$/u.test(color)) {
|
|
1314
|
+
issues.add(`${memberPath}.color`, "expected a theme named color or 6-digit hex color");
|
|
1336
1315
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1316
|
+
if (label === undefined || target === undefined) continue;
|
|
1317
|
+
members.push({
|
|
1318
|
+
label,
|
|
1319
|
+
target,
|
|
1320
|
+
...(model ? { model } : {}),
|
|
1321
|
+
...(thinkingLevel ? { thinkingLevel } : {}),
|
|
1322
|
+
...(color ? { color } : {}),
|
|
1323
|
+
});
|
|
1339
1324
|
}
|
|
1340
|
-
|
|
1325
|
+
if (rawRoster.members.length >= 2 && rawRoster.members.length <= 5 && members.length === rawRoster.members.length)
|
|
1326
|
+
rosters[name] = { members };
|
|
1341
1327
|
}
|
|
1328
|
+
settings.fleet.rosters = rosters;
|
|
1342
1329
|
}
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
}
|
|
1355
|
-
if ("escalation" in raw.workers) {
|
|
1356
|
-
if (!isPlainObject(raw.workers.escalation)) {
|
|
1357
|
-
issues.add("workers.escalation", `expected a map, got ${describe(raw.workers.escalation)}`);
|
|
1358
|
-
} else {
|
|
1359
|
-
const base = settings.workers.escalation ?? DEFAULT_SETTINGS.workers.escalation;
|
|
1360
|
-
const escalation = { timeoutMs: base?.timeoutMs ?? 120000, fallback: base?.fallback ?? "deny" };
|
|
1361
|
-
issues.unknownKeys("workers.escalation", raw.workers.escalation, ["timeoutMs", "fallback"]);
|
|
1362
|
-
if ("timeoutMs" in raw.workers.escalation) {
|
|
1363
|
-
const v = expectInteger(issues, "workers.escalation.timeoutMs", raw.workers.escalation.timeoutMs, {
|
|
1364
|
-
min: 1,
|
|
1365
|
-
});
|
|
1366
|
-
if (v !== undefined) escalation.timeoutMs = v;
|
|
1330
|
+
}
|
|
1331
|
+
if ("agentProfiles" in rawFleet) {
|
|
1332
|
+
if (!isPlainObject(rawFleet.agentProfiles))
|
|
1333
|
+
issues.add("fleet.agentProfiles", `expected a map, got ${describe(rawFleet.agentProfiles)}`);
|
|
1334
|
+
else {
|
|
1335
|
+
const bindings: ClioSettings["fleet"]["agentProfiles"] = {};
|
|
1336
|
+
for (const [rawAgentId, rawProfileName] of Object.entries(rawFleet.agentProfiles)) {
|
|
1337
|
+
const agentId = rawAgentId.trim();
|
|
1338
|
+
if (!agentId) {
|
|
1339
|
+
issues.add("fleet.agentProfiles", "empty agent id");
|
|
1340
|
+
continue;
|
|
1367
1341
|
}
|
|
1368
|
-
if ("
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
"fail",
|
|
1372
|
-
] as const);
|
|
1373
|
-
if (v !== undefined) escalation.fallback = v;
|
|
1342
|
+
if (agentId === "auto") {
|
|
1343
|
+
issues.add("fleet.agentProfiles", "'auto' is reserved for coordinator-owned agent selection");
|
|
1344
|
+
continue;
|
|
1374
1345
|
}
|
|
1375
|
-
|
|
1346
|
+
const profile = expectString(issues, `fleet.agentProfiles.${agentId}`, rawProfileName);
|
|
1347
|
+
if (profile !== undefined) bindings[agentId] = profile;
|
|
1376
1348
|
}
|
|
1377
|
-
|
|
1378
|
-
if ("resilienceCooldownMs" in raw.workers) {
|
|
1379
|
-
const v = expectInteger(issues, "workers.resilienceCooldownMs", raw.workers.resilienceCooldownMs, { min: 0 });
|
|
1380
|
-
if (v !== undefined) settings.workers.resilienceCooldownMs = v;
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
if ("scope" in raw) {
|
|
1386
|
-
const v = expectStringArray(issues, "scope", raw.scope);
|
|
1387
|
-
if (v !== undefined) settings.scope = normalizeScope(v);
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
if ("modelSelector" in raw) {
|
|
1391
|
-
if (!isPlainObject(raw.modelSelector)) {
|
|
1392
|
-
issues.add("modelSelector", `expected a map, got ${describe(raw.modelSelector)}`);
|
|
1393
|
-
} else {
|
|
1394
|
-
issues.unknownKeys("modelSelector", raw.modelSelector, ["favorites", "recentLimit"]);
|
|
1395
|
-
if ("favorites" in raw.modelSelector) {
|
|
1396
|
-
const v = expectStringArray(issues, "modelSelector.favorites", raw.modelSelector.favorites);
|
|
1397
|
-
if (v !== undefined) settings.modelSelector.favorites = normalizeModelRefs(v, settings.targets);
|
|
1398
|
-
}
|
|
1399
|
-
if ("recentLimit" in raw.modelSelector) {
|
|
1400
|
-
const v = expectInteger(issues, "modelSelector.recentLimit", raw.modelSelector.recentLimit, { min: 1 });
|
|
1401
|
-
if (v !== undefined) settings.modelSelector.recentLimit = v;
|
|
1349
|
+
settings.fleet.agentProfiles = bindings;
|
|
1402
1350
|
}
|
|
1403
1351
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1352
|
+
if ("adaptiveRouting" in rawFleet) {
|
|
1353
|
+
if (!isPlainObject(rawFleet.adaptiveRouting))
|
|
1354
|
+
issues.add("fleet.adaptiveRouting", `expected a map, got ${describe(rawFleet.adaptiveRouting)}`);
|
|
1355
|
+
else {
|
|
1356
|
+
const adaptive = rawFleet.adaptiveRouting;
|
|
1357
|
+
issues.unknownKeys("fleet.adaptiveRouting", adaptive, ["roles", "postures", "agentRoles"]);
|
|
1358
|
+
for (const [key, allowed] of [
|
|
1359
|
+
["roles", ACTIVE_ROUTING_ROLES],
|
|
1360
|
+
["postures", ACTIVE_ROUTING_POSTURES],
|
|
1361
|
+
] as const) {
|
|
1362
|
+
if (!(key in adaptive)) continue;
|
|
1363
|
+
const parsed = expectStringArray(issues, `fleet.adaptiveRouting.${key}`, adaptive[key]);
|
|
1364
|
+
if (parsed === undefined) continue;
|
|
1365
|
+
const allowedSet = new Set<string>(allowed);
|
|
1366
|
+
for (const value of parsed)
|
|
1367
|
+
if (!allowedSet.has(value))
|
|
1368
|
+
issues.add(`fleet.adaptiveRouting.${key}`, `unsupported ${key === "roles" ? "role" : "posture"} '${value}'`);
|
|
1369
|
+
if (parsed.every((value) => allowedSet.has(value))) settings.fleet.adaptiveRouting[key] = parsed as never;
|
|
1370
|
+
}
|
|
1371
|
+
if ("agentRoles" in adaptive) {
|
|
1372
|
+
if (!Array.isArray(adaptive.agentRoles)) issues.add("fleet.adaptiveRouting.agentRoles", "expected a list");
|
|
1373
|
+
else {
|
|
1374
|
+
const pairs: ClioSettings["fleet"]["adaptiveRouting"]["agentRoles"] = [];
|
|
1375
|
+
const seen = new Set<string>();
|
|
1376
|
+
for (const [index, value] of adaptive.agentRoles.entries()) {
|
|
1377
|
+
const path = `fleet.adaptiveRouting.agentRoles[${index}]`;
|
|
1378
|
+
if (!isPlainObject(value)) {
|
|
1379
|
+
issues.add(path, "expected a map");
|
|
1380
|
+
continue;
|
|
1381
|
+
}
|
|
1382
|
+
issues.unknownKeys(path, value, ["agentId", "executionRole"]);
|
|
1383
|
+
const agentId = expectString(issues, `${path}.agentId`, value.agentId);
|
|
1384
|
+
const executionRole = expectEnum(
|
|
1385
|
+
issues,
|
|
1386
|
+
`${path}.executionRole`,
|
|
1387
|
+
value.executionRole,
|
|
1388
|
+
ACTIVE_AGENT_AUTOMATION_ROLES,
|
|
1389
|
+
);
|
|
1390
|
+
if (agentId === "auto")
|
|
1391
|
+
issues.add(`${path}.agentId`, "'auto' is reserved for coordinator-owned agent selection");
|
|
1392
|
+
if (agentId === undefined || agentId === "auto" || executionRole === undefined) continue;
|
|
1393
|
+
const pairKey = `${agentId}\u0000${executionRole}`;
|
|
1394
|
+
if (seen.has(pairKey)) {
|
|
1395
|
+
issues.add(path, "duplicate agent and execution-role pair");
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
seen.add(pairKey);
|
|
1399
|
+
pairs.push({ agentId, executionRole });
|
|
1400
|
+
}
|
|
1401
|
+
if (pairs.length === adaptive.agentRoles.length) settings.fleet.adaptiveRouting.agentRoles = pairs;
|
|
1402
|
+
}
|
|
1421
1403
|
}
|
|
1422
1404
|
}
|
|
1423
1405
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
const v = expectBoolean(issues, "terminal.showTerminalProgress", raw.terminal.showTerminalProgress);
|
|
1457
|
-
if (v !== undefined) settings.terminal.showTerminalProgress = v;
|
|
1458
|
-
}
|
|
1459
|
-
if ("outputVerbosity" in raw.terminal) {
|
|
1460
|
-
const v = expectString(issues, "terminal.outputVerbosity", raw.terminal.outputVerbosity);
|
|
1461
|
-
if (v === "minimal" || v === "default" || v === "verbose") settings.terminal.outputVerbosity = v;
|
|
1462
|
-
else if (v !== undefined) issues.add("terminal.outputVerbosity", "expected minimal, default, or verbose");
|
|
1463
|
-
}
|
|
1464
|
-
if ("tuiMode" in raw.terminal) {
|
|
1465
|
-
const v = expectString(issues, "terminal.tuiMode", raw.terminal.tuiMode);
|
|
1466
|
-
if (v === "regular" || v === "fullscreen") settings.terminal.tuiMode = v;
|
|
1467
|
-
else if (v !== undefined) issues.add("terminal.tuiMode", "expected regular or fullscreen");
|
|
1468
|
-
}
|
|
1469
|
-
if ("fullscreenScrollbar" in raw.terminal) {
|
|
1470
|
-
const v = expectString(issues, "terminal.fullscreenScrollbar", raw.terminal.fullscreenScrollbar);
|
|
1471
|
-
if (v === "hidden" || v === "auto" || v === "always") settings.terminal.fullscreenScrollbar = v;
|
|
1472
|
-
else if (v !== undefined) issues.add("terminal.fullscreenScrollbar", "expected hidden, auto, or always");
|
|
1473
|
-
}
|
|
1474
|
-
if ("smoothStreaming" in raw.terminal) {
|
|
1475
|
-
const v = expectString(issues, "terminal.smoothStreaming", raw.terminal.smoothStreaming);
|
|
1476
|
-
if (v === "off" || v === "auto" || v === "on") settings.terminal.smoothStreaming = v;
|
|
1477
|
-
else if (v !== undefined) issues.add("terminal.smoothStreaming", "expected off, auto, or on");
|
|
1478
|
-
}
|
|
1479
|
-
if ("notify" in raw.terminal) {
|
|
1480
|
-
const v = expectBoolean(issues, "terminal.notify", raw.terminal.notify);
|
|
1481
|
-
if (v !== undefined) settings.terminal.notify = v;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
if ("skills" in raw) {
|
|
1487
|
-
if (!isPlainObject(raw.skills)) {
|
|
1488
|
-
issues.add("skills", `expected a map, got ${describe(raw.skills)}`);
|
|
1489
|
-
} else {
|
|
1490
|
-
issues.unknownKeys("skills", raw.skills, ["trustProjectCompatRoots"]);
|
|
1491
|
-
if ("trustProjectCompatRoots" in raw.skills) {
|
|
1492
|
-
const v = expectBoolean(issues, "skills.trustProjectCompatRoots", raw.skills.trustProjectCompatRoots);
|
|
1493
|
-
if (v !== undefined) settings.skills.trustProjectCompatRoots = v;
|
|
1406
|
+
if ("permissions" in rawFleet) {
|
|
1407
|
+
if (!isPlainObject(rawFleet.permissions))
|
|
1408
|
+
issues.add("fleet.permissions", `expected a map, got ${describe(rawFleet.permissions)}`);
|
|
1409
|
+
else {
|
|
1410
|
+
issues.unknownKeys("fleet.permissions", rawFleet.permissions, ["mode", "escalation"]);
|
|
1411
|
+
if ("mode" in rawFleet.permissions) {
|
|
1412
|
+
const parsed = expectEnum(issues, "fleet.permissions.mode", rawFleet.permissions.mode, [
|
|
1413
|
+
"deny",
|
|
1414
|
+
"fail",
|
|
1415
|
+
"escalate",
|
|
1416
|
+
] as const);
|
|
1417
|
+
if (parsed !== undefined) settings.fleet.permissions.mode = parsed;
|
|
1418
|
+
}
|
|
1419
|
+
if ("escalation" in rawFleet.permissions) {
|
|
1420
|
+
if (!isPlainObject(rawFleet.permissions.escalation))
|
|
1421
|
+
issues.add("fleet.permissions.escalation", `expected a map, got ${describe(rawFleet.permissions.escalation)}`);
|
|
1422
|
+
else {
|
|
1423
|
+
const escalation = rawFleet.permissions.escalation;
|
|
1424
|
+
issues.unknownKeys("fleet.permissions.escalation", escalation, ["timeoutMs", "fallback"]);
|
|
1425
|
+
if ("timeoutMs" in escalation) {
|
|
1426
|
+
const parsed = expectInteger(issues, "fleet.permissions.escalation.timeoutMs", escalation.timeoutMs, { min: 1 });
|
|
1427
|
+
if (parsed !== undefined) settings.fleet.permissions.escalation.timeoutMs = parsed;
|
|
1428
|
+
}
|
|
1429
|
+
if ("fallback" in escalation) {
|
|
1430
|
+
const parsed = expectEnum(issues, "fleet.permissions.escalation.fallback", escalation.fallback, [
|
|
1431
|
+
"deny",
|
|
1432
|
+
"fail",
|
|
1433
|
+
] as const);
|
|
1434
|
+
if (parsed !== undefined) settings.fleet.permissions.escalation.fallback = parsed;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1494
1438
|
}
|
|
1495
1439
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
} else {
|
|
1502
|
-
issues.unknownKeys("attribution", raw.attribution, ["gitCommits"]);
|
|
1503
|
-
if ("gitCommits" in raw.attribution) {
|
|
1504
|
-
const v = expectBoolean(issues, "attribution.gitCommits", raw.attribution.gitCommits);
|
|
1505
|
-
if (v !== undefined) settings.attribution.gitCommits = v;
|
|
1440
|
+
if ("concurrency" in rawFleet) {
|
|
1441
|
+
if (rawFleet.concurrency === "auto") settings.fleet.concurrency = "auto";
|
|
1442
|
+
else {
|
|
1443
|
+
const parsed = expectInteger(issues, "fleet.concurrency", rawFleet.concurrency, { min: 1 });
|
|
1444
|
+
if (parsed !== undefined) settings.fleet.concurrency = parsed;
|
|
1506
1445
|
}
|
|
1507
1446
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
if (
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
}
|
|
1531
|
-
if ("excludeLastTurns" in raw.compaction) {
|
|
1532
|
-
const v = expectInteger(issues, "compaction.excludeLastTurns", raw.compaction.excludeLastTurns, { min: 1 });
|
|
1533
|
-
if (v !== undefined) settings.compaction.excludeLastTurns = v;
|
|
1447
|
+
for (const [blockName, fields] of [
|
|
1448
|
+
[
|
|
1449
|
+
"retry",
|
|
1450
|
+
[
|
|
1451
|
+
["maxRetries", 0],
|
|
1452
|
+
["routeCooldownMs", 0],
|
|
1453
|
+
],
|
|
1454
|
+
],
|
|
1455
|
+
[
|
|
1456
|
+
"limits",
|
|
1457
|
+
[
|
|
1458
|
+
["toolCallsPerRun", 1],
|
|
1459
|
+
["internalRunTimeoutMs", 1],
|
|
1460
|
+
],
|
|
1461
|
+
],
|
|
1462
|
+
["history", [["maxRuns", 1]]],
|
|
1463
|
+
] as const) {
|
|
1464
|
+
if (!(blockName in rawFleet)) continue;
|
|
1465
|
+
const block = rawFleet[blockName];
|
|
1466
|
+
if (!isPlainObject(block)) {
|
|
1467
|
+
issues.add(`fleet.${blockName}`, `expected a map, got ${describe(block)}`);
|
|
1468
|
+
continue;
|
|
1534
1469
|
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1470
|
+
const known = fields.map(([key]) => key);
|
|
1471
|
+
if (blockName === "history") known.push("journal" as never);
|
|
1472
|
+
issues.unknownKeys(`fleet.${blockName}`, block, known);
|
|
1473
|
+
for (const [key, min] of fields) {
|
|
1474
|
+
if (!(key in block)) continue;
|
|
1475
|
+
const parsed = expectInteger(issues, `fleet.${blockName}.${key}`, block[key], { min });
|
|
1476
|
+
if (parsed !== undefined) (settings.fleet[blockName] as unknown as Record<string, unknown>)[key] = parsed;
|
|
1538
1477
|
}
|
|
1539
|
-
if ("
|
|
1540
|
-
const
|
|
1541
|
-
if (
|
|
1478
|
+
if (blockName === "history" && "journal" in block) {
|
|
1479
|
+
const parsed = expectBoolean(issues, "fleet.history.journal", block.journal);
|
|
1480
|
+
if (parsed !== undefined) settings.fleet.history.journal = parsed;
|
|
1542
1481
|
}
|
|
1543
1482
|
}
|
|
1544
1483
|
}
|
|
1545
1484
|
|
|
1546
1485
|
if ("context" in raw) {
|
|
1547
|
-
if (!isPlainObject(raw.context)) {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
issues.unknownKeys("context",
|
|
1551
|
-
if ("
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1486
|
+
if (!isPlainObject(raw.context)) issues.add("context", `expected a map, got ${describe(raw.context)}`);
|
|
1487
|
+
else {
|
|
1488
|
+
const context = raw.context;
|
|
1489
|
+
issues.unknownKeys("context", context, ["toolResultMaxBytes", "workingSet", "compaction", "memory"]);
|
|
1490
|
+
if ("toolResultMaxBytes" in context) {
|
|
1491
|
+
const parsed = expectInteger(issues, "context.toolResultMaxBytes", context.toolResultMaxBytes, { min: 4096 });
|
|
1492
|
+
if (parsed !== undefined) settings.context.toolResultMaxBytes = parsed;
|
|
1493
|
+
}
|
|
1494
|
+
if ("workingSet" in context) {
|
|
1495
|
+
if (!isPlainObject(context.workingSet))
|
|
1496
|
+
issues.add("context.workingSet", `expected a map, got ${describe(context.workingSet)}`);
|
|
1497
|
+
else {
|
|
1498
|
+
const workingSet = context.workingSet;
|
|
1556
1499
|
issues.unknownKeys("context.workingSet", workingSet, [
|
|
1557
1500
|
"enabled",
|
|
1558
1501
|
"policy",
|
|
@@ -1561,136 +1504,380 @@ export function validateSettings(raw: unknown): SettingsValidationResult {
|
|
|
1561
1504
|
"minEvictableTokens",
|
|
1562
1505
|
]);
|
|
1563
1506
|
if ("enabled" in workingSet) {
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1507
|
+
const parsed = expectBoolean(issues, "context.workingSet.enabled", workingSet.enabled);
|
|
1508
|
+
if (parsed !== undefined) settings.context.workingSet.enabled = parsed;
|
|
1566
1509
|
}
|
|
1567
1510
|
if ("policy" in workingSet) {
|
|
1568
|
-
const
|
|
1511
|
+
const parsed = expectEnum(issues, "context.workingSet.policy", workingSet.policy, [
|
|
1569
1512
|
"age-horizon",
|
|
1570
1513
|
"structural-v1",
|
|
1571
1514
|
] as const);
|
|
1572
|
-
if (
|
|
1515
|
+
if (parsed !== undefined) settings.context.workingSet.policy = parsed;
|
|
1573
1516
|
}
|
|
1574
1517
|
if ("target" in workingSet) {
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
issues.add("context.workingSet.target", `expected a number > 0 and < 1, got ${
|
|
1578
|
-
|
|
1579
|
-
|
|
1518
|
+
const parsed = expectNumber(issues, "context.workingSet.target", workingSet.target);
|
|
1519
|
+
if (parsed !== undefined && (parsed <= 0 || parsed >= 1))
|
|
1520
|
+
issues.add("context.workingSet.target", `expected a number > 0 and < 1, got ${parsed}`);
|
|
1521
|
+
else if (parsed !== undefined) settings.context.workingSet.target = parsed;
|
|
1522
|
+
}
|
|
1523
|
+
for (const [key, min] of [
|
|
1524
|
+
["protectLastTurns", 1],
|
|
1525
|
+
["minEvictableTokens", 0],
|
|
1526
|
+
] as const) {
|
|
1527
|
+
if (!(key in workingSet)) continue;
|
|
1528
|
+
const parsed = expectInteger(issues, `context.workingSet.${key}`, workingSet[key], { min });
|
|
1529
|
+
if (parsed !== undefined) settings.context.workingSet[key] = parsed;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
if ("compaction" in context) {
|
|
1534
|
+
if (!isPlainObject(context.compaction))
|
|
1535
|
+
issues.add("context.compaction", `expected a map, got ${describe(context.compaction)}`);
|
|
1536
|
+
else {
|
|
1537
|
+
const compaction = context.compaction;
|
|
1538
|
+
issues.unknownKeys("context.compaction", compaction, [
|
|
1539
|
+
"auto",
|
|
1540
|
+
"threshold",
|
|
1541
|
+
"model",
|
|
1542
|
+
"systemPrompt",
|
|
1543
|
+
"excludeLastTurns",
|
|
1544
|
+
]);
|
|
1545
|
+
if ("excludeLastTurns" in compaction)
|
|
1546
|
+
issues.add(
|
|
1547
|
+
"context.compaction.excludeLastTurns",
|
|
1548
|
+
"retired without replacement; use context.workingSet.protectLastTurns",
|
|
1549
|
+
);
|
|
1550
|
+
if ("auto" in compaction) {
|
|
1551
|
+
const parsed = expectBoolean(issues, "context.compaction.auto", compaction.auto);
|
|
1552
|
+
if (parsed !== undefined) settings.context.compaction.auto = parsed;
|
|
1553
|
+
}
|
|
1554
|
+
if ("threshold" in compaction) {
|
|
1555
|
+
const parsed = expectNumber(issues, "context.compaction.threshold", compaction.threshold, { min: 0, max: 1 });
|
|
1556
|
+
if (parsed !== undefined) settings.context.compaction.threshold = parsed;
|
|
1557
|
+
}
|
|
1558
|
+
for (const key of ["model", "systemPrompt"] as const) {
|
|
1559
|
+
if (!(key in compaction)) continue;
|
|
1560
|
+
const parsed = expectString(issues, `context.compaction.${key}`, compaction[key]);
|
|
1561
|
+
if (parsed !== undefined) settings.context.compaction[key] = parsed;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
if ("memory" in context) {
|
|
1566
|
+
if (!isPlainObject(context.memory)) issues.add("context.memory", `expected a map, got ${describe(context.memory)}`);
|
|
1567
|
+
else {
|
|
1568
|
+
const memory = context.memory;
|
|
1569
|
+
issues.unknownKeys("context.memory", memory, [
|
|
1570
|
+
"enabled",
|
|
1571
|
+
"target",
|
|
1572
|
+
"model",
|
|
1573
|
+
"cadenceToolCalls",
|
|
1574
|
+
"trajectorySteps",
|
|
1575
|
+
"maxOutputTokens",
|
|
1576
|
+
"timeoutMs",
|
|
1577
|
+
]);
|
|
1578
|
+
if ("enabled" in memory) {
|
|
1579
|
+
const parsed = expectBoolean(issues, "context.memory.enabled", memory.enabled);
|
|
1580
|
+
if (parsed !== undefined) settings.context.memory.enabled = parsed;
|
|
1581
|
+
}
|
|
1582
|
+
if ("target" in memory) {
|
|
1583
|
+
if (memory.target === null) settings.context.memory.target = null;
|
|
1584
|
+
else {
|
|
1585
|
+
const parsed = expectString(issues, "context.memory.target", memory.target);
|
|
1586
|
+
if (parsed !== undefined)
|
|
1587
|
+
settings.context.memory.target = settings.targets.some((target) => target.id === parsed) ? parsed : null;
|
|
1580
1588
|
}
|
|
1581
1589
|
}
|
|
1582
|
-
if ("
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1590
|
+
if ("model" in memory) {
|
|
1591
|
+
if (memory.model === null) settings.context.memory.model = null;
|
|
1592
|
+
else {
|
|
1593
|
+
const parsed = expectString(issues, "context.memory.model", memory.model);
|
|
1594
|
+
if (parsed !== undefined) settings.context.memory.model = parsed;
|
|
1595
|
+
}
|
|
1587
1596
|
}
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1597
|
+
if (!settings.context.memory.target) settings.context.memory.model = null;
|
|
1598
|
+
else if (settings.context.memory.model === null)
|
|
1599
|
+
settings.context.memory.model =
|
|
1600
|
+
settings.targets.find((target) => target.id === settings.context.memory.target)?.defaultModel ?? null;
|
|
1601
|
+
for (const [key, min] of [
|
|
1602
|
+
["cadenceToolCalls", 2],
|
|
1603
|
+
["trajectorySteps", 1],
|
|
1604
|
+
["maxOutputTokens", 1],
|
|
1605
|
+
["timeoutMs", 1],
|
|
1606
|
+
] as const) {
|
|
1607
|
+
if (!(key in memory)) continue;
|
|
1608
|
+
const parsed = expectInteger(issues, `context.memory.${key}`, memory[key], { min });
|
|
1609
|
+
if (parsed !== undefined) settings.context.memory[key] = parsed;
|
|
1593
1610
|
}
|
|
1594
1611
|
}
|
|
1595
1612
|
}
|
|
1596
1613
|
}
|
|
1597
1614
|
}
|
|
1598
1615
|
|
|
1599
|
-
if ("
|
|
1600
|
-
if (!isPlainObject(raw.
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
issues.unknownKeys("
|
|
1604
|
-
if ("
|
|
1605
|
-
const
|
|
1606
|
-
if (
|
|
1616
|
+
if ("safety" in raw) {
|
|
1617
|
+
if (!isPlainObject(raw.safety)) issues.add("safety", `expected a map, got ${describe(raw.safety)}`);
|
|
1618
|
+
else {
|
|
1619
|
+
const safety = raw.safety;
|
|
1620
|
+
issues.unknownKeys("safety", safety, ["autonomy", "limits", "review"]);
|
|
1621
|
+
if ("autonomy" in safety) {
|
|
1622
|
+
const parsed = expectEnum(issues, "safety.autonomy", safety.autonomy, AUTONOMY_LEVELS);
|
|
1623
|
+
if (parsed !== undefined) settings.safety.autonomy = parsed;
|
|
1624
|
+
}
|
|
1625
|
+
if ("limits" in safety) {
|
|
1626
|
+
if (!isPlainObject(safety.limits)) issues.add("safety.limits", `expected a map, got ${describe(safety.limits)}`);
|
|
1627
|
+
else {
|
|
1628
|
+
const limits = safety.limits;
|
|
1629
|
+
issues.unknownKeys("safety.limits", limits, [
|
|
1630
|
+
"sessionCostUsd",
|
|
1631
|
+
"chatToolCallsPerTurn",
|
|
1632
|
+
"readBytesPerCall",
|
|
1633
|
+
"observationBytesPerTurn",
|
|
1634
|
+
]);
|
|
1635
|
+
if ("sessionCostUsd" in limits) {
|
|
1636
|
+
const parsed = expectNumber(issues, "safety.limits.sessionCostUsd", limits.sessionCostUsd, { min: 0 });
|
|
1637
|
+
if (parsed !== undefined) settings.safety.limits.sessionCostUsd = parsed;
|
|
1638
|
+
}
|
|
1639
|
+
for (const key of ["chatToolCallsPerTurn", "readBytesPerCall", "observationBytesPerTurn"] as const) {
|
|
1640
|
+
if (!(key in limits)) continue;
|
|
1641
|
+
const parsed = expectInteger(issues, `safety.limits.${key}`, limits[key], { min: 1 });
|
|
1642
|
+
if (parsed !== undefined) settings.safety.limits[key] = parsed;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
if ("review" in safety) {
|
|
1647
|
+
if (!isPlainObject(safety.review)) issues.add("safety.review", `expected a map, got ${describe(safety.review)}`);
|
|
1648
|
+
else {
|
|
1649
|
+
const review = safety.review;
|
|
1650
|
+
issues.unknownKeys("safety.review", review, ["enabled", "target", "cadenceToolCalls"]);
|
|
1651
|
+
if ("enabled" in review) {
|
|
1652
|
+
const parsed = expectBoolean(issues, "safety.review.enabled", review.enabled);
|
|
1653
|
+
if (parsed !== undefined) settings.safety.review.enabled = parsed;
|
|
1654
|
+
}
|
|
1655
|
+
if ("target" in review && review.target !== null) {
|
|
1656
|
+
const parsed = expectString(issues, "safety.review.target", review.target);
|
|
1657
|
+
if (parsed !== undefined && settings.targets.some((target) => target.id === parsed))
|
|
1658
|
+
settings.safety.review.target = parsed;
|
|
1659
|
+
else if (parsed !== undefined) issues.add("safety.review.target", `unknown target '${parsed}'`);
|
|
1660
|
+
}
|
|
1661
|
+
if ("cadenceToolCalls" in review && review.cadenceToolCalls !== null) {
|
|
1662
|
+
const parsed = expectInteger(issues, "safety.review.cadenceToolCalls", review.cadenceToolCalls, { min: 1 });
|
|
1663
|
+
if (parsed !== undefined) settings.safety.review.cadenceToolCalls = parsed;
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1607
1666
|
}
|
|
1608
1667
|
}
|
|
1609
1668
|
}
|
|
1610
1669
|
|
|
1611
|
-
if ("
|
|
1612
|
-
if (!isPlainObject(raw.
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
if (
|
|
1670
|
+
if ("interface" in raw) {
|
|
1671
|
+
if (!isPlainObject(raw.interface)) issues.add("interface", `expected a map, got ${describe(raw.interface)}`);
|
|
1672
|
+
else {
|
|
1673
|
+
const ui = raw.interface;
|
|
1674
|
+
issues.unknownKeys("interface", ui, [
|
|
1675
|
+
"outputDetail",
|
|
1676
|
+
"smoothStreaming",
|
|
1677
|
+
"mode",
|
|
1678
|
+
"fullscreenScrollbar",
|
|
1679
|
+
"terminalProgress",
|
|
1680
|
+
"desktopNotifications",
|
|
1681
|
+
"panes",
|
|
1682
|
+
"keybindings",
|
|
1683
|
+
]);
|
|
1684
|
+
for (const key of ["terminalProgress", "desktopNotifications"] as const) {
|
|
1685
|
+
if (!(key in ui)) continue;
|
|
1686
|
+
const parsed = expectBoolean(issues, `interface.${key}`, ui[key]);
|
|
1687
|
+
if (parsed !== undefined) (settings.interface as unknown as Record<string, unknown>)[key] = parsed;
|
|
1627
1688
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1689
|
+
for (const [key, allowed] of [
|
|
1690
|
+
["outputDetail", ["minimal", "default", "verbose"]],
|
|
1691
|
+
["smoothStreaming", ["off", "auto", "on"]],
|
|
1692
|
+
["mode", ["regular", "fullscreen"]],
|
|
1693
|
+
["fullscreenScrollbar", ["hidden", "auto", "always"]],
|
|
1694
|
+
] as const) {
|
|
1695
|
+
if (!(key in ui)) continue;
|
|
1696
|
+
const parsed = expectEnum(issues, `interface.${key}`, ui[key], allowed);
|
|
1697
|
+
if (parsed !== undefined) (settings.interface as unknown as Record<string, unknown>)[key] = parsed;
|
|
1631
1698
|
}
|
|
1632
|
-
if ("
|
|
1633
|
-
if (!isPlainObject(
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1699
|
+
if ("panes" in ui) {
|
|
1700
|
+
if (!isPlainObject(ui.panes)) issues.add("interface.panes", `expected a map, got ${describe(ui.panes)}`);
|
|
1701
|
+
else {
|
|
1702
|
+
const panes = ui.panes;
|
|
1703
|
+
issues.unknownKeys("interface.panes", panes, ["enabled", "notifications", "layout", "workers", "files"]);
|
|
1704
|
+
if ("enabled" in panes) {
|
|
1705
|
+
const parsed = expectEnum(issues, "interface.panes.enabled", panes.enabled, ["auto", "embedded", "off"] as const);
|
|
1706
|
+
if (parsed !== undefined) settings.interface.panes.enabled = parsed;
|
|
1707
|
+
}
|
|
1708
|
+
if ("notifications" in panes) {
|
|
1709
|
+
const parsed = expectEnum(issues, "interface.panes.notifications", panes.notifications, [
|
|
1710
|
+
"failures",
|
|
1711
|
+
"all",
|
|
1712
|
+
"off",
|
|
1713
|
+
] as const);
|
|
1714
|
+
if (parsed !== undefined) settings.interface.panes.notifications = parsed;
|
|
1641
1715
|
}
|
|
1642
|
-
if ("
|
|
1643
|
-
const
|
|
1644
|
-
if (
|
|
1716
|
+
if ("layout" in panes) {
|
|
1717
|
+
const parsed = expectEnum(issues, "interface.panes.layout", panes.layout, ["off", "workers", "cockpit"] as const);
|
|
1718
|
+
if (parsed !== undefined) settings.interface.panes.layout = parsed;
|
|
1645
1719
|
}
|
|
1646
|
-
if ("
|
|
1647
|
-
|
|
1648
|
-
|
|
1720
|
+
if ("workers" in panes) {
|
|
1721
|
+
if (!isPlainObject(panes.workers))
|
|
1722
|
+
issues.add("interface.panes.workers", `expected a map, got ${describe(panes.workers)}`);
|
|
1723
|
+
else {
|
|
1724
|
+
const workers = panes.workers;
|
|
1725
|
+
issues.unknownKeys("interface.panes.workers", workers, ["ratio"]);
|
|
1726
|
+
if ("ratio" in workers) {
|
|
1727
|
+
const parsed = expectNumber(issues, "interface.panes.workers.ratio", workers.ratio, {
|
|
1728
|
+
min: 0.05,
|
|
1729
|
+
max: 0.5,
|
|
1730
|
+
});
|
|
1731
|
+
if (parsed !== undefined) settings.interface.panes.workers.ratio = parsed;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1649
1734
|
}
|
|
1650
|
-
if ("
|
|
1651
|
-
|
|
1652
|
-
|
|
1735
|
+
if ("files" in panes) {
|
|
1736
|
+
if (!isPlainObject(panes.files))
|
|
1737
|
+
issues.add("interface.panes.files", `expected a map, got ${describe(panes.files)}`);
|
|
1738
|
+
else {
|
|
1739
|
+
const files = panes.files;
|
|
1740
|
+
issues.unknownKeys("interface.panes.files", files, ["enabled", "mode", "profile", "followCwd", "ratio"]);
|
|
1741
|
+
for (const key of ["enabled", "followCwd"] as const) {
|
|
1742
|
+
if (!(key in files)) continue;
|
|
1743
|
+
const parsed = expectBoolean(issues, `interface.panes.files.${key}`, files[key]);
|
|
1744
|
+
if (parsed !== undefined) settings.interface.panes.files[key] = parsed;
|
|
1745
|
+
}
|
|
1746
|
+
if ("mode" in files) {
|
|
1747
|
+
const parsed = expectEnum(issues, "interface.panes.files.mode", files.mode, ["companion", "chooser"] as const);
|
|
1748
|
+
if (parsed !== undefined) settings.interface.panes.files.mode = parsed;
|
|
1749
|
+
}
|
|
1750
|
+
if ("profile" in files) {
|
|
1751
|
+
const parsed = expectEnum(issues, "interface.panes.files.profile", files.profile, ["managed", "user"] as const);
|
|
1752
|
+
if (parsed !== undefined) settings.interface.panes.files.profile = parsed;
|
|
1753
|
+
}
|
|
1754
|
+
if ("ratio" in files) {
|
|
1755
|
+
const parsed = expectNumber(issues, "interface.panes.files.ratio", files.ratio, { min: 0.05, max: 0.5 });
|
|
1756
|
+
if (parsed !== undefined) settings.interface.panes.files.ratio = parsed;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1653
1759
|
}
|
|
1654
1760
|
}
|
|
1655
1761
|
}
|
|
1762
|
+
if ("keybindings" in ui)
|
|
1763
|
+
settings.interface.keybindings = validateKeybindings(issues, "interface.keybindings", ui.keybindings);
|
|
1656
1764
|
}
|
|
1657
1765
|
}
|
|
1658
1766
|
|
|
1659
|
-
if ("
|
|
1660
|
-
if (!isPlainObject(raw.
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
issues.unknownKeys("
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1767
|
+
if ("integrations" in raw) {
|
|
1768
|
+
if (!isPlainObject(raw.integrations)) issues.add("integrations", `expected a map, got ${describe(raw.integrations)}`);
|
|
1769
|
+
else {
|
|
1770
|
+
const integrations = raw.integrations;
|
|
1771
|
+
issues.unknownKeys("integrations", integrations, [
|
|
1772
|
+
"projectResources",
|
|
1773
|
+
"externalAgents",
|
|
1774
|
+
"runtimePlugins",
|
|
1775
|
+
"library",
|
|
1776
|
+
"git",
|
|
1777
|
+
]);
|
|
1778
|
+
if ("projectResources" in integrations) {
|
|
1779
|
+
if (!isPlainObject(integrations.projectResources))
|
|
1780
|
+
issues.add("integrations.projectResources", `expected a map, got ${describe(integrations.projectResources)}`);
|
|
1781
|
+
else {
|
|
1782
|
+
issues.unknownKeys("integrations.projectResources", integrations.projectResources, ["trustProjectImports"]);
|
|
1783
|
+
if ("trustProjectImports" in integrations.projectResources) {
|
|
1784
|
+
const parsed = expectBoolean(
|
|
1785
|
+
issues,
|
|
1786
|
+
"integrations.projectResources.trustProjectImports",
|
|
1787
|
+
integrations.projectResources.trustProjectImports,
|
|
1788
|
+
);
|
|
1789
|
+
if (parsed !== undefined) settings.integrations.projectResources.trustProjectImports = parsed;
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
if ("runtimePlugins" in integrations) {
|
|
1794
|
+
const parsed = expectStringArray(issues, "integrations.runtimePlugins", integrations.runtimePlugins);
|
|
1795
|
+
if (parsed !== undefined) settings.integrations.runtimePlugins = parsed;
|
|
1667
1796
|
}
|
|
1668
|
-
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1671
|
-
|
|
1797
|
+
if ("library" in integrations) {
|
|
1798
|
+
if (!isPlainObject(integrations.library))
|
|
1799
|
+
issues.add("integrations.library", `expected a map, got ${describe(integrations.library)}`);
|
|
1800
|
+
else {
|
|
1801
|
+
const library = integrations.library;
|
|
1802
|
+
issues.unknownKeys("integrations.library", library, ["catalog", "remote", "confirmedRemote", "sync"]);
|
|
1803
|
+
for (const key of ["catalog", "remote", "confirmedRemote"] as const) {
|
|
1804
|
+
if (!(key in library)) continue;
|
|
1805
|
+
const value = library[key];
|
|
1806
|
+
if (value !== null && typeof value !== "string")
|
|
1807
|
+
issues.add(`integrations.library.${key}`, `expected a string or null, got ${describe(value)}`);
|
|
1808
|
+
else settings.integrations.library[key] = value as string | null;
|
|
1809
|
+
}
|
|
1810
|
+
if ("sync" in library) {
|
|
1811
|
+
const parsed = expectBoolean(issues, "integrations.library.sync", library.sync);
|
|
1812
|
+
if (parsed !== undefined) settings.integrations.library.sync = parsed;
|
|
1813
|
+
}
|
|
1672
1814
|
}
|
|
1673
1815
|
}
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1816
|
+
if ("git" in integrations) {
|
|
1817
|
+
if (!isPlainObject(integrations.git))
|
|
1818
|
+
issues.add("integrations.git", `expected a map, got ${describe(integrations.git)}`);
|
|
1819
|
+
else {
|
|
1820
|
+
issues.unknownKeys("integrations.git", integrations.git, ["commitAttribution"]);
|
|
1821
|
+
if ("commitAttribution" in integrations.git) {
|
|
1822
|
+
const parsed = expectBoolean(issues, "integrations.git.commitAttribution", integrations.git.commitAttribution);
|
|
1823
|
+
if (parsed !== undefined) settings.integrations.git.commitAttribution = parsed;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
if ("externalAgents" in integrations) {
|
|
1828
|
+
if (!isPlainObject(integrations.externalAgents))
|
|
1829
|
+
issues.add("integrations.externalAgents", `expected a map, got ${describe(integrations.externalAgents)}`);
|
|
1830
|
+
else {
|
|
1831
|
+
const external = integrations.externalAgents;
|
|
1832
|
+
issues.unknownKeys("integrations.externalAgents", external, ["entries", "defaults"]);
|
|
1833
|
+
if ("defaults" in external) {
|
|
1834
|
+
if (!isPlainObject(external.defaults))
|
|
1835
|
+
issues.add("integrations.externalAgents.defaults", `expected a map, got ${describe(external.defaults)}`);
|
|
1836
|
+
else {
|
|
1837
|
+
const defaults = external.defaults;
|
|
1838
|
+
issues.unknownKeys("integrations.externalAgents.defaults", defaults, [
|
|
1839
|
+
"connectTimeoutMs",
|
|
1840
|
+
"turnTimeoutMs",
|
|
1841
|
+
"permissionTimeoutMs",
|
|
1842
|
+
"toolGovernance",
|
|
1843
|
+
]);
|
|
1844
|
+
for (const key of ["connectTimeoutMs", "turnTimeoutMs", "permissionTimeoutMs"] as const) {
|
|
1845
|
+
if (!(key in defaults)) continue;
|
|
1846
|
+
const parsed = expectInteger(issues, `integrations.externalAgents.defaults.${key}`, defaults[key], {
|
|
1847
|
+
min: 1,
|
|
1848
|
+
max: MAX_TIMER_DELAY_MS,
|
|
1849
|
+
});
|
|
1850
|
+
if (parsed !== undefined) settings.integrations.externalAgents.defaults[key] = parsed;
|
|
1851
|
+
}
|
|
1852
|
+
if ("toolGovernance" in defaults) {
|
|
1853
|
+
const parsed = expectEnum(
|
|
1854
|
+
issues,
|
|
1855
|
+
"integrations.externalAgents.defaults.toolGovernance",
|
|
1856
|
+
normalizeLegacyNamingValue(defaults.toolGovernance, "clio-policy", "clio-coder-policy"),
|
|
1857
|
+
TOOL_GOVERNANCE,
|
|
1858
|
+
);
|
|
1859
|
+
if (parsed !== undefined) settings.integrations.externalAgents.defaults.toolGovernance = parsed;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
if ("entries" in external) {
|
|
1864
|
+
if (!Array.isArray(external.entries))
|
|
1865
|
+
issues.add("integrations.externalAgents.entries", `expected a list, got ${describe(external.entries)}`);
|
|
1866
|
+
else {
|
|
1867
|
+
const seen = new Set<string>();
|
|
1868
|
+
settings.integrations.externalAgents.entries = external.entries
|
|
1869
|
+
.map((entry, index) =>
|
|
1870
|
+
validateExternalAgent(
|
|
1871
|
+
issues,
|
|
1872
|
+
`integrations.externalAgents.entries[${index}]`,
|
|
1873
|
+
entry,
|
|
1874
|
+
settings.integrations.externalAgents.defaults,
|
|
1875
|
+
seen,
|
|
1876
|
+
),
|
|
1877
|
+
)
|
|
1878
|
+
.filter((entry): entry is ExternalAgent => entry !== null);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1694
1881
|
}
|
|
1695
1882
|
}
|
|
1696
1883
|
}
|
|
@@ -1699,12 +1886,6 @@ export function validateSettings(raw: unknown): SettingsValidationResult {
|
|
|
1699
1886
|
return { settings, issues: issues.list };
|
|
1700
1887
|
}
|
|
1701
1888
|
|
|
1702
|
-
/**
|
|
1703
|
-
* Validate the settings file on disk without throwing. Missing file is valid.
|
|
1704
|
-
* Resolves the path without the clioConfigDir mkdir side effect so read-only
|
|
1705
|
-
* surfaces (plain `clio-coder doctor`, readSettings on a fresh machine) never
|
|
1706
|
-
* create directories.
|
|
1707
|
-
*/
|
|
1708
1889
|
export function validateSettingsFile(): SettingsValidationResult {
|
|
1709
1890
|
const path = join(resolveClioDirs().config, "settings.yaml");
|
|
1710
1891
|
if (!existsSync(path)) return { settings: cloneValue(DEFAULT_SETTINGS), issues: [] };
|
|
@@ -1832,10 +2013,6 @@ export function updateSavedSettingsDocument(
|
|
|
1832
2013
|
}, options);
|
|
1833
2014
|
}
|
|
1834
2015
|
|
|
1835
|
-
export function settingsLockPath(): string {
|
|
1836
|
-
return `${settingsPath()}.lock`;
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
2016
|
/**
|
|
1840
2017
|
* Run `fn` while holding the settings.yaml advisory lock. Factored out of
|
|
1841
2018
|
* updateSettings so the one other sanctioned settings writer (lifecycle
|
|
@@ -1900,14 +2077,14 @@ export function useTargetInSettings(
|
|
|
1900
2077
|
: target;
|
|
1901
2078
|
if (!workerTarget) return null;
|
|
1902
2079
|
const sharedModel = options.model ?? target.defaultModel ?? null;
|
|
1903
|
-
settings.
|
|
1904
|
-
settings.
|
|
1905
|
-
settings.
|
|
1906
|
-
settings.
|
|
2080
|
+
settings.chat.target = target.id;
|
|
2081
|
+
settings.chat.model = options.orchestratorModel ?? sharedModel;
|
|
2082
|
+
settings.fleet.default.target = workerTarget.id;
|
|
2083
|
+
settings.fleet.default.model =
|
|
1907
2084
|
options.workerModel ?? (workerTarget === target ? sharedModel : (workerTarget.defaultModel ?? null));
|
|
1908
2085
|
if (options.backgroundModel !== undefined) {
|
|
1909
|
-
settings.
|
|
1910
|
-
settings.
|
|
2086
|
+
settings.context.memory.target = target.id;
|
|
2087
|
+
settings.context.memory.model = options.backgroundModel;
|
|
1911
2088
|
}
|
|
1912
2089
|
return { workerTargetId: workerTarget.id };
|
|
1913
2090
|
}
|
|
@@ -1916,22 +2093,25 @@ export function useTargetInSettings(
|
|
|
1916
2093
|
export function removeTargetFromSettings(settings: ClioSettings, id: string): boolean {
|
|
1917
2094
|
if (!settings.targets.some((entry) => entry.id === id)) return false;
|
|
1918
2095
|
settings.targets = settings.targets.filter((entry) => entry.id !== id);
|
|
1919
|
-
if (settings.
|
|
1920
|
-
settings.
|
|
1921
|
-
settings.
|
|
2096
|
+
if (settings.chat.target === id) {
|
|
2097
|
+
settings.chat.target = null;
|
|
2098
|
+
settings.chat.model = null;
|
|
1922
2099
|
}
|
|
1923
|
-
if (settings.
|
|
1924
|
-
settings.
|
|
1925
|
-
settings.
|
|
2100
|
+
if (settings.context.memory.target === id) {
|
|
2101
|
+
settings.context.memory.target = null;
|
|
2102
|
+
settings.context.memory.model = null;
|
|
1926
2103
|
}
|
|
1927
|
-
if (settings.
|
|
1928
|
-
settings.
|
|
1929
|
-
settings.
|
|
2104
|
+
if (settings.fleet.default.target === id) {
|
|
2105
|
+
settings.fleet.default.target = null;
|
|
2106
|
+
settings.fleet.default.model = null;
|
|
1930
2107
|
}
|
|
1931
|
-
for (const [name, profile] of Object.entries(settings.
|
|
1932
|
-
if (profile.target === id) delete settings.
|
|
2108
|
+
for (const [name, profile] of Object.entries(settings.fleet.profiles)) {
|
|
2109
|
+
if (profile.target === id) delete settings.fleet.profiles[name];
|
|
1933
2110
|
}
|
|
1934
|
-
settings.
|
|
2111
|
+
settings.chat.modelPicker.cycleSet = settings.chat.modelPicker.cycleSet.filter((entry) => entry.split("/")[0] !== id);
|
|
2112
|
+
settings.chat.modelPicker.favorites = settings.chat.modelPicker.favorites.filter(
|
|
2113
|
+
(entry) => entry.split("/")[0] !== id,
|
|
2114
|
+
);
|
|
1935
2115
|
return true;
|
|
1936
2116
|
}
|
|
1937
2117
|
|
|
@@ -1944,8 +2124,8 @@ export function setFleetProfileInSettings(
|
|
|
1944
2124
|
): boolean {
|
|
1945
2125
|
const target = settings.targets.find((entry) => entry.id === targetId);
|
|
1946
2126
|
if (!target) return false;
|
|
1947
|
-
const existing = settings.
|
|
1948
|
-
settings.
|
|
2127
|
+
const existing = settings.fleet.profiles[name];
|
|
2128
|
+
settings.fleet.profiles[name] = {
|
|
1949
2129
|
target: target.id,
|
|
1950
2130
|
model: options.model ?? target.defaultModel ?? null,
|
|
1951
2131
|
thinkingLevel: options.thinkingLevel ?? existing?.thinkingLevel ?? "off",
|
|
@@ -1955,11 +2135,11 @@ export function setFleetProfileInSettings(
|
|
|
1955
2135
|
|
|
1956
2136
|
/** Remove a fleet profile and its agent bindings; returns how many bindings went with it. */
|
|
1957
2137
|
export function removeFleetProfileFromSettings(settings: ClioSettings, name: string): number {
|
|
1958
|
-
delete settings.
|
|
2138
|
+
delete settings.fleet.profiles[name];
|
|
1959
2139
|
let removedBindings = 0;
|
|
1960
|
-
for (const [agentId, profileName] of Object.entries(settings.
|
|
2140
|
+
for (const [agentId, profileName] of Object.entries(settings.fleet.agentProfiles)) {
|
|
1961
2141
|
if (profileName !== name) continue;
|
|
1962
|
-
delete settings.
|
|
2142
|
+
delete settings.fleet.agentProfiles[agentId];
|
|
1963
2143
|
removedBindings += 1;
|
|
1964
2144
|
}
|
|
1965
2145
|
return removedBindings;
|
|
@@ -1967,7 +2147,7 @@ export function removeFleetProfileFromSettings(settings: ClioSettings, name: str
|
|
|
1967
2147
|
|
|
1968
2148
|
/** Bind a native agent to a profile. False for an ACP delegation agent, which ignores native routing. */
|
|
1969
2149
|
export function bindAgentProfileInSettings(settings: ClioSettings, agentId: string, profileName: string): boolean {
|
|
1970
|
-
if (settings.
|
|
1971
|
-
settings.
|
|
2150
|
+
if (settings.integrations.externalAgents.entries.some((agent) => agent.id === agentId)) return false;
|
|
2151
|
+
settings.fleet.agentProfiles[agentId] = profileName;
|
|
1972
2152
|
return true;
|
|
1973
2153
|
}
|