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