@skaile/workspaces 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/dist/{asset-feeds-PXUWCXVI.js → asset-feeds-KPKCE64E.js} +31 -23
  3. package/dist/asset-feeds-KPKCE64E.js.map +1 -0
  4. package/dist/asset-manager/catalog-deployer.js +10 -10
  5. package/dist/asset-manager/fragments.js +1 -1
  6. package/dist/asset-manager/index.js +19 -19
  7. package/dist/asset-manager/installer.js +13 -13
  8. package/dist/asset-manager/renderers.js +11 -11
  9. package/dist/asset-manager/src/index.d.ts +339 -19
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/installer.d.ts +40 -0
  12. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  13. package/dist/asset-manager/src/mcp-config.d.ts +21 -0
  14. package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
  15. package/dist/asset-manager/src/renderers.d.ts +7 -0
  16. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  17. package/dist/bridge/harnesses/claude-sdk.js +18 -22
  18. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  19. package/dist/bridge/harnesses/codex.js +24 -17
  20. package/dist/bridge/harnesses/codex.js.map +1 -1
  21. package/dist/bridge/harnesses/continue.js +14 -14
  22. package/dist/bridge/harnesses/echo.js +4 -4
  23. package/dist/bridge/harnesses/gemini.js +10 -10
  24. package/dist/bridge/harnesses/goose.js +14 -14
  25. package/dist/bridge/harnesses/omp.js +15 -8
  26. package/dist/bridge/harnesses/omp.js.map +1 -1
  27. package/dist/bridge/harnesses/opencode.js +14 -14
  28. package/dist/bridge/harnesses/qwen.js +10 -10
  29. package/dist/bridge/index.js +19 -19
  30. package/dist/bridge/src/claude-sdk-surface.d.ts +17 -0
  31. package/dist/bridge/src/claude-sdk-surface.d.ts.map +1 -0
  32. package/dist/bridge/src/harness-model-check.d.ts +30 -0
  33. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  34. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -1
  35. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  36. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  37. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  38. package/dist/bridge/src/index.d.ts +2 -1
  39. package/dist/bridge/src/index.d.ts.map +1 -1
  40. package/dist/bridge/src/normalizer.d.ts +3 -1
  41. package/dist/bridge/src/normalizer.d.ts.map +1 -1
  42. package/dist/bridge/src/runner-private-env.d.ts +7 -0
  43. package/dist/bridge/src/runner-private-env.d.ts.map +1 -1
  44. package/dist/{chunk-HK7HMEPT.js → chunk-27SXN33H.js} +13 -5
  45. package/dist/chunk-27SXN33H.js.map +1 -0
  46. package/dist/{chunk-TKHJXPSB.js → chunk-2XM3ZH36.js} +183 -33
  47. package/dist/chunk-2XM3ZH36.js.map +1 -0
  48. package/dist/{chunk-E3GPGTW3.js → chunk-3HACK2Z7.js} +142 -28
  49. package/dist/chunk-3HACK2Z7.js.map +1 -0
  50. package/dist/{chunk-T2BDID2J.js → chunk-5JPW27BI.js} +10 -9
  51. package/dist/chunk-5JPW27BI.js.map +1 -0
  52. package/dist/{chunk-2UUKCROR.js → chunk-5LQ62LNT.js} +4 -4
  53. package/dist/{chunk-2UUKCROR.js.map → chunk-5LQ62LNT.js.map} +1 -1
  54. package/dist/{chunk-UL22SDGR.js → chunk-6CYKTHNT.js} +194 -127
  55. package/dist/chunk-6CYKTHNT.js.map +1 -0
  56. package/dist/{chunk-XFIEVEU7.js → chunk-6OHZUUR7.js} +5 -4
  57. package/dist/chunk-6OHZUUR7.js.map +1 -0
  58. package/dist/{chunk-E572OHGY.js → chunk-76FLBODK.js} +4 -3
  59. package/dist/chunk-76FLBODK.js.map +1 -0
  60. package/dist/{chunk-GN4VVSAA.js → chunk-7DRFKAJZ.js} +7 -7
  61. package/dist/{chunk-GN4VVSAA.js.map → chunk-7DRFKAJZ.js.map} +1 -1
  62. package/dist/chunk-7H6XRCPG.js +31 -0
  63. package/dist/chunk-7H6XRCPG.js.map +1 -0
  64. package/dist/{chunk-MCUJTNY5.js → chunk-7Y6S4XLL.js} +3 -3
  65. package/dist/{chunk-MCUJTNY5.js.map → chunk-7Y6S4XLL.js.map} +1 -1
  66. package/dist/{chunk-DHYSUJ3H.js → chunk-BEYNH2LS.js} +4 -4
  67. package/dist/{chunk-DHYSUJ3H.js.map → chunk-BEYNH2LS.js.map} +1 -1
  68. package/dist/{chunk-GEQSUC6U.js → chunk-BOT64P3U.js} +4 -4
  69. package/dist/{chunk-GEQSUC6U.js.map → chunk-BOT64P3U.js.map} +1 -1
  70. package/dist/{chunk-L4YKW5AY.js → chunk-BRK5QZKI.js} +121 -20
  71. package/dist/chunk-BRK5QZKI.js.map +1 -0
  72. package/dist/{chunk-YGRZNFRO.js → chunk-BY5WIRCU.js} +58 -5
  73. package/dist/chunk-BY5WIRCU.js.map +1 -0
  74. package/dist/{chunk-Z7ZEZZB6.js → chunk-C5HFK34M.js} +3 -3
  75. package/dist/chunk-C5HFK34M.js.map +1 -0
  76. package/dist/{chunk-DUMTLYSO.js → chunk-COAFAYBS.js} +31 -7
  77. package/dist/chunk-COAFAYBS.js.map +1 -0
  78. package/dist/{chunk-7XSAW5OC.js → chunk-E5NQRHEB.js} +30 -7
  79. package/dist/chunk-E5NQRHEB.js.map +1 -0
  80. package/dist/{chunk-BFMYYNDT.js → chunk-F3D25RGM.js} +11 -3
  81. package/dist/chunk-F3D25RGM.js.map +1 -0
  82. package/dist/{chunk-VBI7HGHB.js → chunk-GF5JXQIZ.js} +3 -3
  83. package/dist/{chunk-VBI7HGHB.js.map → chunk-GF5JXQIZ.js.map} +1 -1
  84. package/dist/{chunk-ZFUZ5AKM.js → chunk-I7LC5TDY.js} +3 -3
  85. package/dist/{chunk-ZFUZ5AKM.js.map → chunk-I7LC5TDY.js.map} +1 -1
  86. package/dist/{chunk-3IXIEHUB.js → chunk-ICSGNT5P.js} +7 -7
  87. package/dist/{chunk-3IXIEHUB.js.map → chunk-ICSGNT5P.js.map} +1 -1
  88. package/dist/{chunk-WEH33JSG.js → chunk-ITFCWMOY.js} +93 -29
  89. package/dist/chunk-ITFCWMOY.js.map +1 -0
  90. package/dist/{chunk-WDXZA7QW.js → chunk-IZQOO6MN.js} +2 -2
  91. package/dist/{chunk-WDXZA7QW.js.map → chunk-IZQOO6MN.js.map} +1 -1
  92. package/dist/{chunk-WDAIWDLK.js → chunk-JFLQICIU.js} +5 -5
  93. package/dist/{chunk-WDAIWDLK.js.map → chunk-JFLQICIU.js.map} +1 -1
  94. package/dist/{chunk-ARWKK325.js → chunk-JJJ2G4K2.js} +5 -5
  95. package/dist/{chunk-ARWKK325.js.map → chunk-JJJ2G4K2.js.map} +1 -1
  96. package/dist/{chunk-GOCWM7FN.js → chunk-JMIKGAUA.js} +43 -4
  97. package/dist/chunk-JMIKGAUA.js.map +1 -0
  98. package/dist/{chunk-X3RMRJNR.js → chunk-JRN5QF4C.js} +8 -3
  99. package/dist/chunk-JRN5QF4C.js.map +1 -0
  100. package/dist/{chunk-SNEE6UGY.js → chunk-K3R2UKG7.js} +18 -12
  101. package/dist/chunk-K3R2UKG7.js.map +1 -0
  102. package/dist/{chunk-VXEYX73S.js → chunk-KB56WBQ3.js} +4 -4
  103. package/dist/{chunk-VXEYX73S.js.map → chunk-KB56WBQ3.js.map} +1 -1
  104. package/dist/{chunk-OHNKYHRR.js → chunk-KJSC2ZD6.js} +264 -18
  105. package/dist/chunk-KJSC2ZD6.js.map +1 -0
  106. package/dist/{chunk-UQ33Y4DM.js → chunk-KPKGWXUJ.js} +4 -4
  107. package/dist/{chunk-UQ33Y4DM.js.map → chunk-KPKGWXUJ.js.map} +1 -1
  108. package/dist/{chunk-AF432MS3.js → chunk-KXJMQTOU.js} +3 -3
  109. package/dist/{chunk-AF432MS3.js.map → chunk-KXJMQTOU.js.map} +1 -1
  110. package/dist/chunk-LRBP3234.js +302 -0
  111. package/dist/chunk-LRBP3234.js.map +1 -0
  112. package/dist/{chunk-UVVVR4XO.js → chunk-M4OG2YN4.js} +4 -4
  113. package/dist/{chunk-UVVVR4XO.js.map → chunk-M4OG2YN4.js.map} +1 -1
  114. package/dist/{chunk-QOM5Z62G.js → chunk-MAZ3UXJK.js} +17 -24
  115. package/dist/chunk-MAZ3UXJK.js.map +1 -0
  116. package/dist/{chunk-Y2TO2U7W.js → chunk-MM4YO3EL.js} +3 -3
  117. package/dist/{chunk-Y2TO2U7W.js.map → chunk-MM4YO3EL.js.map} +1 -1
  118. package/dist/{chunk-OULSJRXV.js → chunk-OCQNUV4T.js} +7 -7
  119. package/dist/{chunk-OULSJRXV.js.map → chunk-OCQNUV4T.js.map} +1 -1
  120. package/dist/{chunk-SZXGRHQQ.js → chunk-PJJSBZZP.js} +4 -4
  121. package/dist/{chunk-SZXGRHQQ.js.map → chunk-PJJSBZZP.js.map} +1 -1
  122. package/dist/{chunk-OAHVKSQJ.js → chunk-PKBLJI23.js} +1471 -126
  123. package/dist/chunk-PKBLJI23.js.map +1 -0
  124. package/dist/{chunk-NOA6EJXE.js → chunk-PKE3PXOK.js} +3 -3
  125. package/dist/{chunk-NOA6EJXE.js.map → chunk-PKE3PXOK.js.map} +1 -1
  126. package/dist/{chunk-WYHQUCHR.js → chunk-PMWRM4EJ.js} +109 -48
  127. package/dist/chunk-PMWRM4EJ.js.map +1 -0
  128. package/dist/{chunk-H6UVIKQ2.js → chunk-PNUM7GUY.js} +3 -3
  129. package/dist/{chunk-H6UVIKQ2.js.map → chunk-PNUM7GUY.js.map} +1 -1
  130. package/dist/{chunk-SRODW6M2.js → chunk-Q5RN4PWV.js} +3 -3
  131. package/dist/{chunk-SRODW6M2.js.map → chunk-Q5RN4PWV.js.map} +1 -1
  132. package/dist/{chunk-LN6QB7XI.js → chunk-QIHL3YPL.js} +4 -4
  133. package/dist/{chunk-LN6QB7XI.js.map → chunk-QIHL3YPL.js.map} +1 -1
  134. package/dist/{chunk-U56GGCC2.js → chunk-QK7AG5AV.js} +4 -4
  135. package/dist/{chunk-U56GGCC2.js.map → chunk-QK7AG5AV.js.map} +1 -1
  136. package/dist/{chunk-OTIB4D2K.js → chunk-QPWR3YMY.js} +15 -5
  137. package/dist/chunk-QPWR3YMY.js.map +1 -0
  138. package/dist/{chunk-4DWBSTYA.js → chunk-QXKUFROW.js} +22 -5
  139. package/dist/chunk-QXKUFROW.js.map +1 -0
  140. package/dist/{chunk-4XWLB7JB.js → chunk-RQMIZONH.js} +95 -35
  141. package/dist/chunk-RQMIZONH.js.map +1 -0
  142. package/dist/{chunk-LSI2IVFT.js → chunk-RXGPFAMN.js} +4 -3
  143. package/dist/chunk-RXGPFAMN.js.map +1 -0
  144. package/dist/{chunk-3JKGY2YC.js → chunk-S2H3RBK7.js} +182 -33
  145. package/dist/chunk-S2H3RBK7.js.map +1 -0
  146. package/dist/{chunk-VJRTDKXS.js → chunk-SJNZ4WPA.js} +165 -106
  147. package/dist/chunk-SJNZ4WPA.js.map +1 -0
  148. package/dist/{chunk-KX2PT5Q4.js → chunk-T2VBPVWZ.js} +77 -18
  149. package/dist/chunk-T2VBPVWZ.js.map +1 -0
  150. package/dist/{chunk-6Z5KTFJT.js → chunk-TSTRH4SM.js} +3 -3
  151. package/dist/{chunk-6Z5KTFJT.js.map → chunk-TSTRH4SM.js.map} +1 -1
  152. package/dist/{chunk-7CV3HFWJ.js → chunk-TZERN27L.js} +5 -5
  153. package/dist/{chunk-7CV3HFWJ.js.map → chunk-TZERN27L.js.map} +1 -1
  154. package/dist/{chunk-JDR6ILCW.js → chunk-U673DB5U.js} +4 -4
  155. package/dist/{chunk-JDR6ILCW.js.map → chunk-U673DB5U.js.map} +1 -1
  156. package/dist/{chunk-FKU57Q5Q.js → chunk-URCJIV7T.js} +3 -3
  157. package/dist/{chunk-FKU57Q5Q.js.map → chunk-URCJIV7T.js.map} +1 -1
  158. package/dist/{chunk-ADPM6AYF.js → chunk-VSX2G7LA.js} +3 -3
  159. package/dist/{chunk-ADPM6AYF.js.map → chunk-VSX2G7LA.js.map} +1 -1
  160. package/dist/{chunk-F2GOZMRA.js → chunk-X37JUNEW.js} +49 -49
  161. package/dist/chunk-X37JUNEW.js.map +1 -0
  162. package/dist/{chunk-NMI2TWMH.js → chunk-Z3IRZBXB.js} +158 -344
  163. package/dist/chunk-Z3IRZBXB.js.map +1 -0
  164. package/dist/{chunk-7TPYPVAH.js → chunk-ZWJCRHP3.js} +3 -3
  165. package/dist/{chunk-7TPYPVAH.js.map → chunk-ZWJCRHP3.js.map} +1 -1
  166. package/dist/{claude-code-VJGYBXQR.js → claude-code-BBMNVH2J.js} +5 -5
  167. package/dist/{claude-code-VJGYBXQR.js.map → claude-code-BBMNVH2J.js.map} +1 -1
  168. package/dist/cli/index.js +964 -501
  169. package/dist/cli/index.js.map +1 -1
  170. package/dist/cli/src/agent-pins.d.ts +11 -0
  171. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  172. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  173. package/dist/cli/src/commands/catalog.d.ts +1 -1
  174. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  175. package/dist/cli/src/commands/config.d.ts.map +1 -1
  176. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  177. package/dist/cli/src/commands/harness.d.ts +24 -0
  178. package/dist/cli/src/commands/harness.d.ts.map +1 -0
  179. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  180. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  181. package/dist/cli/src/commands/library-index.d.ts +28 -3
  182. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  183. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  184. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  185. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  186. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  187. package/dist/cli/src/commands/project.d.ts +19 -1
  188. package/dist/cli/src/commands/project.d.ts.map +1 -1
  189. package/dist/cli/src/commands/rebuild.d.ts.map +1 -1
  190. package/dist/cli/src/commands/run.d.ts.map +1 -1
  191. package/dist/cli/src/commands/serve-preflight.d.ts +31 -1
  192. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  193. package/dist/cli/src/commands/serve.d.ts +10 -0
  194. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  195. package/dist/cli/src/commands/session-logs/local-query.d.ts +2 -0
  196. package/dist/cli/src/commands/session-logs/local-query.d.ts.map +1 -1
  197. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  198. package/dist/cli/src/commands/source-manifest.d.ts +19 -7
  199. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  200. package/dist/cli/src/commands/source.d.ts +9 -2
  201. package/dist/cli/src/commands/source.d.ts.map +1 -1
  202. package/dist/cli/src/commands/store.d.ts.map +1 -1
  203. package/dist/cli/src/commands/update.d.ts.map +1 -1
  204. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
  205. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  206. package/dist/cli/src/commands/why.d.ts.map +1 -1
  207. package/dist/cli/src/config-checks.d.ts +55 -0
  208. package/dist/cli/src/config-checks.d.ts.map +1 -0
  209. package/dist/cli/src/harness-error.d.ts +12 -1
  210. package/dist/cli/src/harness-error.d.ts.map +1 -1
  211. package/dist/cli/src/helpers.d.ts +18 -8
  212. package/dist/cli/src/helpers.d.ts.map +1 -1
  213. package/dist/cli/src/plugin-store/index.d.ts +10 -1
  214. package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
  215. package/dist/cli/src/plugin-store/spec.d.ts +8 -0
  216. package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
  217. package/dist/cli/src/skill-checks.d.ts +27 -0
  218. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  219. package/dist/cli/src/store-addable.d.ts +11 -0
  220. package/dist/cli/src/store-addable.d.ts.map +1 -1
  221. package/dist/connectors/config.js +5 -5
  222. package/dist/connectors/index.js +23 -23
  223. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  224. package/dist/connectors-47EM6C2P.js +48 -0
  225. package/dist/{connectors-CXZLXAFZ.js.map → connectors-47EM6C2P.js.map} +1 -1
  226. package/dist/core/framework.js +1 -1
  227. package/dist/core/index.js +9 -9
  228. package/dist/core/manifest.js +2 -2
  229. package/dist/core/models.js +1 -1
  230. package/dist/core/provider-registry-credentials.js +2 -2
  231. package/dist/core/provider-registry.js +1 -1
  232. package/dist/core/publish-manifest.js +3 -3
  233. package/dist/core/ref.js +1 -1
  234. package/dist/core/runtime-assets.js +5 -5
  235. package/dist/core/src/agent-instances.d.ts.map +1 -1
  236. package/dist/core/src/config-key-diagnostics.d.ts +9 -0
  237. package/dist/core/src/config-key-diagnostics.d.ts.map +1 -0
  238. package/dist/core/src/framework.d.ts +5 -3
  239. package/dist/core/src/framework.d.ts.map +1 -1
  240. package/dist/core/src/index.d.ts +3 -2
  241. package/dist/core/src/index.d.ts.map +1 -1
  242. package/dist/core/src/lock.d.ts +12 -0
  243. package/dist/core/src/lock.d.ts.map +1 -1
  244. package/dist/core/src/manifest.d.ts +25 -0
  245. package/dist/core/src/manifest.d.ts.map +1 -1
  246. package/dist/core/src/models.d.ts +15 -0
  247. package/dist/core/src/models.d.ts.map +1 -1
  248. package/dist/core/src/provider-registry.d.ts +6 -0
  249. package/dist/core/src/provider-registry.d.ts.map +1 -1
  250. package/dist/core/src/workspace-config.d.ts +18 -1
  251. package/dist/core/src/workspace-config.d.ts.map +1 -1
  252. package/dist/core/src/workspace-yaml-editor.d.ts +9 -2
  253. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  254. package/dist/core/workspace-config.js +4 -4
  255. package/dist/deploy/index.js +9 -9
  256. package/dist/discovery/index.js +5 -5
  257. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  258. package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
  259. package/dist/{ensure-sources-UPTHZKGF.js → ensure-sources-K5EFNC3L.js} +36 -22
  260. package/dist/ensure-sources-K5EFNC3L.js.map +1 -0
  261. package/dist/factory-assets/connectors/box.js +23 -23
  262. package/dist/factory-assets/connectors/deploy.js +23 -23
  263. package/dist/factory-assets/connectors/devserver.js +23 -23
  264. package/dist/factory-assets/connectors/flow/adapter.js +23 -23
  265. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  266. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  267. package/dist/factory-assets/connectors/flow/engine.js +11 -11
  268. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  269. package/dist/factory-assets/connectors/flow/run-flow.js +25 -25
  270. package/dist/factory-assets/connectors/flow.js +23 -23
  271. package/dist/factory-assets/connectors/git.js +23 -23
  272. package/dist/factory-assets/connectors/gmail.js +23 -23
  273. package/dist/factory-assets/connectors/googledrive.js +23 -23
  274. package/dist/factory-assets/connectors/local.js +23 -23
  275. package/dist/factory-assets/connectors/mattermost.js +23 -23
  276. package/dist/factory-assets/connectors/memory.js +23 -23
  277. package/dist/factory-assets/connectors/minio.js +23 -23
  278. package/dist/factory-assets/connectors/postgres.js +23 -23
  279. package/dist/factory-assets/connectors/s3.js +23 -23
  280. package/dist/factory-assets/connectors/sharepoint.js +23 -23
  281. package/dist/factory-assets/connectors/sqlite.js +23 -23
  282. package/dist/factory-assets/connectors/static-server.js +23 -23
  283. package/dist/factory-assets/connectors/tunnel.js +23 -23
  284. package/dist/factory-assets/connectors/webdav.js +23 -23
  285. package/dist/factory-assets/connectors/xstate-store.js +23 -23
  286. package/dist/factory-assets/connectors/xstate.js +23 -23
  287. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +1 -1
  288. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +2 -2
  289. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +3 -3
  290. package/dist/flows-KLBNSKLO.js +26 -0
  291. package/dist/{flows-TJQIMGUX.js.map → flows-KLBNSKLO.js.map} +1 -1
  292. package/dist/helpers-LUSV2ICC.js +52 -0
  293. package/dist/{helpers-DE53KG3E.js.map → helpers-LUSV2ICC.js.map} +1 -1
  294. package/dist/library/index.js +14 -14
  295. package/dist/library/install.js +5 -5
  296. package/dist/library/src/index.d.ts +2 -2
  297. package/dist/library/src/index.d.ts.map +1 -1
  298. package/dist/library/src/install/index.d.ts +1 -1
  299. package/dist/library/src/install/index.d.ts.map +1 -1
  300. package/dist/library/src/install/install-from-manifest.d.ts +13 -0
  301. package/dist/library/src/install/install-from-manifest.d.ts.map +1 -1
  302. package/dist/library/src/install/source-fetch-github.d.ts.map +1 -1
  303. package/dist/library/src/local/library-dir.d.ts +22 -5
  304. package/dist/library/src/local/library-dir.d.ts.map +1 -1
  305. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  306. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  307. package/dist/library/src/remote/remote-catalog-source.d.ts +8 -0
  308. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  309. package/dist/library/src/remote/rest-catalog-source.d.ts +3 -2
  310. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  311. package/dist/{library-publish-KKQ2ULLX.js → library-publish-XMRCKRNR.js} +59 -58
  312. package/dist/library-publish-XMRCKRNR.js.map +1 -0
  313. package/dist/model-endpoint/index.js +12 -12
  314. package/dist/model-endpoint/src/openai-chat.d.ts +7 -2
  315. package/dist/model-endpoint/src/openai-chat.d.ts.map +1 -1
  316. package/dist/model-endpoint/src/openai-shared.d.ts +8 -0
  317. package/dist/model-endpoint/src/openai-shared.d.ts.map +1 -1
  318. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  319. package/dist/model-endpoint/src/types.d.ts +1 -1
  320. package/dist/model-endpoint/src/types.d.ts.map +1 -1
  321. package/dist/model-endpoint/src/usage-cost.d.ts +23 -0
  322. package/dist/model-endpoint/src/usage-cost.d.ts.map +1 -0
  323. package/dist/open-library-XBR46DJL.js +56 -0
  324. package/dist/{open-library-RJGJIW5H.js.map → open-library-XBR46DJL.js.map} +1 -1
  325. package/dist/open-registry-W562DCDL.js +32 -0
  326. package/dist/{open-registry-3QS3J7KO.js.map → open-registry-W562DCDL.js.map} +1 -1
  327. package/dist/paths-2AZXB3QL.js +22 -0
  328. package/dist/{paths-QAV4C3KX.js.map → paths-2AZXB3QL.js.map} +1 -1
  329. package/dist/plugin-store-36SIL4TV.js +23 -0
  330. package/dist/{plugin-store-MSH6GK6T.js.map → plugin-store-36SIL4TV.js.map} +1 -1
  331. package/dist/project-D7GN7WLS.js +86 -0
  332. package/dist/{project-HZW2MZPA.js.map → project-D7GN7WLS.js.map} +1 -1
  333. package/dist/resolver/index.js +10 -10
  334. package/dist/runner/index.js +40 -40
  335. package/dist/runner/src/capability-roundtrip.d.ts +7 -6
  336. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  337. package/dist/runner/src/composition/content-source.d.ts.map +1 -1
  338. package/dist/runner/src/composition/errors.d.ts +16 -1
  339. package/dist/runner/src/composition/errors.d.ts.map +1 -1
  340. package/dist/runner/src/credential-notice.d.ts +3 -3
  341. package/dist/runner/src/credential-notice.d.ts.map +1 -1
  342. package/dist/runner/src/serve.d.ts +20 -7
  343. package/dist/runner/src/serve.d.ts.map +1 -1
  344. package/dist/sdk/asset-manager.js +19 -19
  345. package/dist/sdk/bridge.js +19 -19
  346. package/dist/sdk/core.js +9 -9
  347. package/dist/sdk/flow.js +11 -11
  348. package/dist/sdk/index.js +40 -40
  349. package/dist/sdk/resolver.js +10 -10
  350. package/dist/sdk/runner.js +40 -40
  351. package/dist/sdk/transport/ws/server.js +10 -10
  352. package/dist/sdk/transport/ws.js +10 -10
  353. package/dist/sdk/transport.js +10 -10
  354. package/dist/serve-preflight-CGA5G3AE.js +135 -0
  355. package/dist/serve-preflight-CGA5G3AE.js.map +1 -0
  356. package/dist/{setup-AGYB4PKR.js → setup-IBDNJAOU.js} +32 -32
  357. package/dist/{setup-AGYB4PKR.js.map → setup-IBDNJAOU.js.map} +1 -1
  358. package/dist/skills-CTTO7SZK.js +26 -0
  359. package/dist/{skills-2LMQ2IAD.js.map → skills-CTTO7SZK.js.map} +1 -1
  360. package/dist/source-2DJ5KNOI.js +85 -0
  361. package/dist/{source-GBMYD3RO.js.map → source-2DJ5KNOI.js.map} +1 -1
  362. package/dist/source-fetch-github-RWHV4I5Z.js +4 -0
  363. package/dist/{source-fetch-github-ST4MFL3D.js.map → source-fetch-github-RWHV4I5Z.js.map} +1 -1
  364. package/dist/{source-manifest-publish-FK22TVQT.js → source-manifest-publish-IYWUMUCY.js} +55 -57
  365. package/dist/source-manifest-publish-IYWUMUCY.js.map +1 -0
  366. package/dist/transport/index.js +10 -10
  367. package/dist/transport/ws/server.js +10 -10
  368. package/dist/transport/ws.js +10 -10
  369. package/dist/tui/index.js +48 -41
  370. package/dist/tui/index.js.map +1 -1
  371. package/dist/tui/src/repl.d.ts.map +1 -1
  372. package/dist/types/manifests.js +1 -1
  373. package/dist/types/src/install-manifest.d.ts +1 -1
  374. package/dist/types/src/install-manifest.d.ts.map +1 -1
  375. package/dist/types/src/manifests/index.d.ts +1 -1
  376. package/dist/types/src/manifests/index.d.ts.map +1 -1
  377. package/dist/types/src/manifests/scaffold-body.d.ts +2 -0
  378. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  379. package/dist/workspace-plugin/adapters/mcp.js +30 -30
  380. package/dist/workspace-plugin/adapters/omp.js +15 -15
  381. package/dist/workspace-plugin/index.js +2 -2
  382. package/package.json +1 -1
  383. package/dist/asset-feeds-PXUWCXVI.js.map +0 -1
  384. package/dist/chunk-3JKGY2YC.js.map +0 -1
  385. package/dist/chunk-4DWBSTYA.js.map +0 -1
  386. package/dist/chunk-4XWLB7JB.js.map +0 -1
  387. package/dist/chunk-7XSAW5OC.js.map +0 -1
  388. package/dist/chunk-BFMYYNDT.js.map +0 -1
  389. package/dist/chunk-DUMTLYSO.js.map +0 -1
  390. package/dist/chunk-E3GPGTW3.js.map +0 -1
  391. package/dist/chunk-E572OHGY.js.map +0 -1
  392. package/dist/chunk-F2GOZMRA.js.map +0 -1
  393. package/dist/chunk-GOCWM7FN.js.map +0 -1
  394. package/dist/chunk-HK7HMEPT.js.map +0 -1
  395. package/dist/chunk-KX2PT5Q4.js.map +0 -1
  396. package/dist/chunk-L4YKW5AY.js.map +0 -1
  397. package/dist/chunk-LSI2IVFT.js.map +0 -1
  398. package/dist/chunk-NMI2TWMH.js.map +0 -1
  399. package/dist/chunk-OAHVKSQJ.js.map +0 -1
  400. package/dist/chunk-OHNKYHRR.js.map +0 -1
  401. package/dist/chunk-OTIB4D2K.js.map +0 -1
  402. package/dist/chunk-PUK7TQT4.js +0 -13
  403. package/dist/chunk-PUK7TQT4.js.map +0 -1
  404. package/dist/chunk-QOM5Z62G.js.map +0 -1
  405. package/dist/chunk-SNEE6UGY.js.map +0 -1
  406. package/dist/chunk-T2BDID2J.js.map +0 -1
  407. package/dist/chunk-TKHJXPSB.js.map +0 -1
  408. package/dist/chunk-UL22SDGR.js.map +0 -1
  409. package/dist/chunk-VJRTDKXS.js.map +0 -1
  410. package/dist/chunk-WEH33JSG.js.map +0 -1
  411. package/dist/chunk-WYHQUCHR.js.map +0 -1
  412. package/dist/chunk-X3RMRJNR.js.map +0 -1
  413. package/dist/chunk-XFIEVEU7.js.map +0 -1
  414. package/dist/chunk-YGRZNFRO.js.map +0 -1
  415. package/dist/chunk-Z7ZEZZB6.js.map +0 -1
  416. package/dist/connectors-CXZLXAFZ.js +0 -48
  417. package/dist/ensure-sources-UPTHZKGF.js.map +0 -1
  418. package/dist/flows-TJQIMGUX.js +0 -26
  419. package/dist/helpers-DE53KG3E.js +0 -38
  420. package/dist/library-publish-KKQ2ULLX.js.map +0 -1
  421. package/dist/open-library-RJGJIW5H.js +0 -42
  422. package/dist/open-registry-3QS3J7KO.js +0 -32
  423. package/dist/paths-QAV4C3KX.js +0 -22
  424. package/dist/plugin-store-MSH6GK6T.js +0 -23
  425. package/dist/project-HZW2MZPA.js +0 -84
  426. package/dist/serve-preflight-L4POEHNQ.js +0 -108
  427. package/dist/serve-preflight-L4POEHNQ.js.map +0 -1
  428. package/dist/skills-2LMQ2IAD.js +0 -26
  429. package/dist/source-GBMYD3RO.js +0 -85
  430. package/dist/source-fetch-github-ST4MFL3D.js +0 -4
  431. package/dist/source-manifest-publish-FK22TVQT.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/store-publisher.ts"],"names":[],"mappings":";;;AA+FO,SAAS,uBAAA,CACd,MAAA,GAAsB,cAAA,EAAe,EACrC,YAAY,GAAA,EACK;AAGjB,EAAA,MAAM,IAAA,GAAO,OACX,IAAA,EACA,IAAA,KACe;AACf,IAAA,MAAM,GAAA,GAAM,MAAM,aAAA,EAAc;AAChC,IAAA,OAAO,UAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,GAAA,EAAI,EAAG,IAAA,EAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAM,CAAA;AAAA,EACvE,CAAA;AACA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,MAAM,IAAA,CAAK,YAAY,CAAA;AAAA,IAC3B,UAAA,EAAY,CAAC,IAAA,KAAS,IAAA,CAAK,mBAAmB,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,IACtE,WAAA,EAAa,MAAM,IAAA,CAAK,iBAAiB,CAAA;AAAA,IACzC,UAAA,EAAY,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,KAAA,CAAA,EAAS,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IACnF,QAAQ,CAAC,KAAA,KAAU,IAAA,CAAK,CAAA,aAAA,EAAgB,KAAK,CAAA,CAAE,CAAA;AAAA,IAC/C,kBAAkB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,WAAA,CAAa,CAAA;AAAA,IACjE,cAAc,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,QAAA,CAAU,CAAA;AAAA,IACzD,YAAA,EAAc,CAAC,EAAA,EAAI,IAAA,EAAM,WACvB,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,QAAA,CAAA,EAAY;AAAA,MACnC,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA;AAAA,MACA,GAAI,SAAS,EAAE,MAAA,EAAQ,EAAE,MAAA,EAAQ,GAAA,EAAI,EAAE,GAAI;AAAC,KAC7C,CAAA;AAAA,IACH,cAAA,EAAgB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,UAAA,CAAA,EAAc,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IAC3F,qBAAA,EAAuB,CAAC,EAAA,KACtB,IAAA,CAAK,sBAAsB,kBAAA,CAAmB,EAAE,CAAC,CAAA,aAAA,CAAe;AAAA,GACpE;AACF","file":"chunk-MCUJTNY5.js","sourcesContent":["/**\n * Typed REST client for the AI Asset Store **publisher** surface — the\n * curator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/store-publisher.ts"],"names":[],"mappings":";;;AA+FO,SAAS,uBAAA,CACd,MAAA,GAAsB,cAAA,EAAe,EACrC,YAAY,GAAA,EACK;AAGjB,EAAA,MAAM,IAAA,GAAO,OACX,IAAA,EACA,IAAA,KACe;AACf,IAAA,MAAM,GAAA,GAAM,MAAM,aAAA,EAAc;AAChC,IAAA,OAAO,UAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,GAA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AA,EAAuB,CAAC,EAAA,KACtB,IAAA,CAAK,sBAAsB,kBAAA,CAAmB,EAAE,CAAC,CAAA,aAAA,CAAe;AAAA,GACpE;AACF","file":"chunk-7Y6S4XLL.js","sourcesContent":["/**\n * Typed REST client for the AI Asset Store **publisher** surface — the\n * curator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { logErr } from './chunk-KX2PT5Q4.js';
2
- import { getKindRegistry } from './chunk-ARWKK325.js';
1
+ import { logErr } from './chunk-T2VBPVWZ.js';
2
+ import { getKindRegistry } from './chunk-JJJ2G4K2.js';
3
3
  import { userConfigPath } from './chunk-L5VSIPQD.js';
4
4
 
5
5
  // cli/src/open-library.ts
@@ -90,5 +90,5 @@ async function openLibraryManager() {
90
90
  }
91
91
 
92
92
  export { LocalCatalogDisabledError, openCatalogSource, openLibrary, openLibraryManager, resolveCatalogSource };
93
- //# sourceMappingURL=chunk-DHYSUJ3H.js.map
94
- //# sourceMappingURL=chunk-DHYSUJ3H.js.map
93
+ //# sourceMappingURL=chunk-BEYNH2LS.js.map
94
+ //# sourceMappingURL=chunk-BEYNH2LS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/open-library.ts"],"names":["source"],"mappings":";;;;;AAkBO,IAAM,yBAAA,GAAN,cAAwC,KAAA,CAAM;AAAA,EACnD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AASA,eAAsB,WAAA,GAAc;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,OAAO,oBAA4B,CAAA;AAChE,IAAA,OAAO,IAAI,UAAA,CAAW,EAAE,YA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@skaile/workspaces/library` subpath and returns the\n * LocalIndex instance (backed by `@libsql/client`; runs on Node and Bun).\n * The catalog-source helper reads\n * `~/.skaile/config.yaml` (and project-level overlay if `projectDir` is given)\n * to decide between {@link RemoteCatalogSource} (default — points at\n * `https://skaile.store`) and a {@link LocalCatalogSource} bound to the most\n * recent local library registered via `skaile source add`.\n */\n\nimport { userConfigPath } from \"@skaile/workspaces/core\";\nimport { logErr } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/** Thrown by {@link openCatalogSource} when `catalog.url` is the `local` sentinel. */\nexport class LocalCatalogDisabledError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LocalCatalogDisabledError\";\n }\n}\n\n/**\n * Open the LocalIndex with the full kind registry. Exits with code 1\n * if the library directory cannot be created.\n *\n * @returns A `LocalIndex` instance ready for use.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibrary() {\n try {\n const { LocalIndex } = await import(\"@skaile/workspaces/library\");\n return new LocalIndex({ kindRegistry: getKindRegistry() });\n } catch (err) {\n logErr(`Could not open LocalIndex: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/**\n * Resolve the configured **remote** Catalog source for the CLI.\n *\n * Reads `~/.skaile/config.yaml` (plus the optional project-level overlay) and\n * returns a {@link RemoteCatalogSource} pointing at `catalog.url` (default:\n * `https://skaile.store`). The `cache_ttl: 0` config flag flips the source\n * into air-gapped mode: network reads are disabled, only `skaile update`\n * performs refreshes.\n *\n * **Local-mode rejection.** If the resolved config has `catalog.url: local`\n * this helper throws — callers wanting the dispatched local-or-remote source\n * must use {@link resolveCatalogSource}. Remote-only consumers like\n * `skaile update --catalog-only` rely on this strict behaviour.\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A configured {@link RemoteCatalogSource}.\n * @throws When `catalog.url` is the `local` sentinel.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<\n | import(\"@skaile/workspaces/library\").RemoteCatalogSource\n | import(\"@skaile/workspaces/library\").RestCatalogSource\n> {\n const { resolveConfig, RemoteCatalogSource, RestCatalogSource, isLocalCatalogUrl } = await import(\n \"@skaile/workspaces/library\"\n );\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n if (isLocalCatalogUrl(baseUrl)) {\n throw new LocalCatalogDisabledError(\n \"catalog.url is set to 'local' — remote catalog is disabled. \" +\n \"Use `skaile library init <name> --path <dir>` for a local folder, \" +\n `or set \\`catalog.url: https://skaile.store\\` in ${userConfigPath()}.`,\n );\n }\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n if (cfg.catalog.framing === \"rest\") {\n return new RestCatalogSource({ baseUrl, cacheTtlMs });\n }\n return new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n}\n\n/**\n * Resolved catalog source plus a close handle for releasing any underlying\n * resources (e.g. the `LocalIndex` SQLite connection in local mode).\n *\n * Callers MUST invoke `close()` when done — typically in a `finally` block.\n * For remote-mode sources `close()` is a no-op, but the contract is uniform\n * so consumers don't have to branch.\n *\n * @docLink cli/dev-guide#open-library\n */\nexport interface ResolvedCatalogSource {\n /** The {@link ICatalogSource} ready for use. */\n source: import(\"@skaile/workspaces/library\").ICatalogSource;\n /** Release any underlying resources (SQLite handle in local mode). */\n close(): void;\n}\n\n/**\n * Resolve the configured Catalog source — local or remote — based on\n * `~/.skaile/config.yaml`.\n *\n * Dispatch:\n * - `catalog.url: local` → opens {@link LocalIndex}, picks the most recently\n * registered local library whose `path` still exists on disk, and returns a\n * {@link LocalCatalogSource} bound to that library. Throws if no usable\n * local library is registered.\n * - any URL → returns {@link RemoteCatalogSource} (same as\n * {@link openCatalogSource}).\n *\n * The returned `close()` releases the underlying `LocalIndex` SQLite handle\n * in local mode (no-op in remote mode). Callers MUST invoke it — typically in\n * a `finally` block — to satisfy `library/CLAUDE.md` § \"Notes for Consumers\".\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A `ResolvedCatalogSource` carrying the source and a close handle.\n * @throws When `local` is configured but no usable local library is registered.\n * @docLink cli/dev-guide#open-library\n */\nexport async function resolveCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<ResolvedCatalogSource> {\n const {\n resolveConfig,\n RemoteCatalogSource,\n RestCatalogSource,\n LocalCatalogSource,\n isLocalCatalogUrl,\n libraryDirMissing,\n missingLibraryDirMessage,\n } = await import(\"@skaile/workspaces/library\");\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n\n if (isLocalCatalogUrl(baseUrl)) {\n const fs = await import(\"node:fs\");\n const library = await openLibrary();\n try {\n const sources = await library.listSources();\n type LibraryRow = (typeof sources)[number];\n // Type-narrow: `path` is required for local libraries after the filter.\n const usable = sources\n .filter(\n (s): s is LibraryRow & { path: string } =>\n s.backend === \"local\" && typeof s.path === \"string\" && s.path.length > 0,\n )\n .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());\n\n // A registered library whose directory is gone has one wording everywhere.\n const gone = sources.filter(libraryDirMissing);\n if (usable.length === 0) {\n if (gone.length > 0) throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n throw new Error(\n \"catalog.url is set to 'local' but no local library is registered. \" +\n \"Run `skaile library init <name> --path <dir>` first (a git repo: `skaile source add <git-url>`).\",\n );\n }\n\n // Prefer the most recently added library whose path still exists.\n const present = usable.find((s) => fs.existsSync(s.path));\n if (!present) {\n throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n }\n\n const source = new LocalCatalogSource(library, present.id, present.path, getKindRegistry());\n return { source, close: () => library.close() };\n } catch (err) {\n // Release the handle on any failure during dispatch — otherwise the\n // SQLite WAL state leaks for the lifetime of the process.\n library.close();\n throw err;\n }\n }\n\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n const source =\n cfg.catalog.framing === \"rest\"\n ? new RestCatalogSource({ baseUrl, cacheTtlMs })\n : new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n return { source, close: () => {} };\n}\n\n/**\n * Open the LibraryManager bound to the active LocalIndex.\n * Caller owns lifetime — must call `close()` (returned helper closes the\n * underlying LocalIndex).\n *\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibraryManager(): Promise<{\n manager: import(\"@skaile/workspaces/library\").LibraryManager;\n library: import(\"@skaile/workspaces/library\").LocalIndex;\n close: () => void;\n}> {\n const { LibraryManager } = await import(\"@skaile/workspaces/library\");\n const library = await openLibrary();\n const manager = new LibraryManager(library);\n return { manager, library, close: () => library.close() };\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/open-library.ts"],"names":["source"],"mappings":";;;;;AAkBO,IAAM,yBAAA,GAAN,cAAwC,KAAA,CAAM;AAAA,EACnD,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AAAA,EACd;AACF;AASA,eAAsB,WAAA,GAAc;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,OAAO,oBAA4B,CAAA;AAChE,IAAA,OAAO,IAAI,UAAA,CAAW,EAAE,YAAA,EAAc,eAAA,IAAmB,CAAA;AAAA,EAC3D,SAAS,GAAA,EAAK;AACZ,IAAA,MAAA,CAAO,CAAA,2BAAA,EAA8B,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AACvF,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAqBA,eAAsB,kBAAkB,IAAA,EAQtC;AACA,EA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,CAAA;AAC1F,MAAA,OAAO,EAAE,MAAA,EAAAA,OAAAA,EAAQ,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAAA,IAChD,SAAS,GAAA,EAAK;AAGZ,MAAA,OAAA,CAAQ,KAAA,EAAM;AACd,MAAA,MAAM,GAAA;AAAA,IACR;AAAA,EACF;AAEA,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,OAAA,CAAQ,SAAA,GAAY,GAAA;AAC3C,EAAA,MAAM,SACJ,GAAA,CAAI,OAAA,CAAQ,OAAA,KAAY,MAAA,GACpB,IAAI,iBAAA,CAAkB,EAAE,OAAA,EAAS,UAAA,EAAY,CAAA,GAC7C,IAAI,oBAAoB,EAAE,OAAA,EAAS,YAAY,CAAA;AACrD,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAM;AAAA,EAAC,CAAA,EAAE;AACnC;AASA,eAAsB,kBAAA,GAInB;AACD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,oBAA4B,CAAA;AACpE,EAAA,MAAM,OAAA,GAAU,MAAM,WAAA,EAAY;AAClC,EAAA,MAAM,OAAA,GAAU,IAAI,cAAA,CAAe,OAAO,CAAA;AAC1C,EAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAC1D","file":"chunk-BEYNH2LS.js","sourcesContent":["/**\n * open-library.ts — shared helpers to open the LocalIndex and the configured\n * Catalog source.\n *\n * Lazy-loads the `@skaile/workspaces/library` subpath and returns the\n * LocalIndex instance (backed by `@libsql/client`; runs on Node and Bun).\n * The catalog-source helper reads\n * `~/.skaile/config.yaml` (and project-level overlay if `projectDir` is given)\n * to decide between {@link RemoteCatalogSource} (default — points at\n * `https://skaile.store`) and a {@link LocalCatalogSource} bound to the most\n * recent local library registered via `skaile source add`.\n */\n\nimport { userConfigPath } from \"@skaile/workspaces/core\";\nimport { logErr } from \"./helpers.ts\";\nimport { getKindRegistry } from \"./open-registry.ts\";\n\n/** Thrown by {@link openCatalogSource} when `catalog.url` is the `local` sentinel. */\nexport class LocalCatalogDisabledError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LocalCatalogDisabledError\";\n }\n}\n\n/**\n * Open the LocalIndex with the full kind registry. Exits with code 1\n * if the library directory cannot be created.\n *\n * @returns A `LocalIndex` instance ready for use.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibrary() {\n try {\n const { LocalIndex } = await import(\"@skaile/workspaces/library\");\n return new LocalIndex({ kindRegistry: getKindRegistry() });\n } catch (err) {\n logErr(`Could not open LocalIndex: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/**\n * Resolve the configured **remote** Catalog source for the CLI.\n *\n * Reads `~/.skaile/config.yaml` (plus the optional project-level overlay) and\n * returns a {@link RemoteCatalogSource} pointing at `catalog.url` (default:\n * `https://skaile.store`). The `cache_ttl: 0` config flag flips the source\n * into air-gapped mode: network reads are disabled, only `skaile update`\n * performs refreshes.\n *\n * **Local-mode rejection.** If the resolved config has `catalog.url: local`\n * this helper throws — callers wanting the dispatched local-or-remote source\n * must use {@link resolveCatalogSource}. Remote-only consumers like\n * `skaile update --catalog-only` rely on this strict behaviour.\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A configured {@link RemoteCatalogSource}.\n * @throws When `catalog.url` is the `local` sentinel.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<\n | import(\"@skaile/workspaces/library\").RemoteCatalogSource\n | import(\"@skaile/workspaces/library\").RestCatalogSource\n> {\n const { resolveConfig, RemoteCatalogSource, RestCatalogSource, isLocalCatalogUrl } = await import(\n \"@skaile/workspaces/library\"\n );\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n if (isLocalCatalogUrl(baseUrl)) {\n throw new LocalCatalogDisabledError(\n \"catalog.url is set to 'local' — remote catalog is disabled. \" +\n \"Use `skaile library init <name> --path <dir>` for a local folder, \" +\n `or set \\`catalog.url: https://skaile.store\\` in ${userConfigPath()}.`,\n );\n }\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n if (cfg.catalog.framing === \"rest\") {\n return new RestCatalogSource({ baseUrl, cacheTtlMs });\n }\n return new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n}\n\n/**\n * Resolved catalog source plus a close handle for releasing any underlying\n * resources (e.g. the `LocalIndex` SQLite connection in local mode).\n *\n * Callers MUST invoke `close()` when done — typically in a `finally` block.\n * For remote-mode sources `close()` is a no-op, but the contract is uniform\n * so consumers don't have to branch.\n *\n * @docLink cli/dev-guide#open-library\n */\nexport interface ResolvedCatalogSource {\n /** The {@link ICatalogSource} ready for use. */\n source: import(\"@skaile/workspaces/library\").ICatalogSource;\n /** Release any underlying resources (SQLite handle in local mode). */\n close(): void;\n}\n\n/**\n * Resolve the configured Catalog source — local or remote — based on\n * `~/.skaile/config.yaml`.\n *\n * Dispatch:\n * - `catalog.url: local` → opens {@link LocalIndex}, picks the most recently\n * registered local library whose `path` still exists on disk, and returns a\n * {@link LocalCatalogSource} bound to that library. Throws if no usable\n * local library is registered.\n * - any URL → returns {@link RemoteCatalogSource} (same as\n * {@link openCatalogSource}).\n *\n * The returned `close()` releases the underlying `LocalIndex` SQLite handle\n * in local mode (no-op in remote mode). Callers MUST invoke it — typically in\n * a `finally` block — to satisfy `library/CLAUDE.md` § \"Notes for Consumers\".\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A `ResolvedCatalogSource` carrying the source and a close handle.\n * @throws When `local` is configured but no usable local library is registered.\n * @docLink cli/dev-guide#open-library\n */\nexport async function resolveCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<ResolvedCatalogSource> {\n const {\n resolveConfig,\n RemoteCatalogSource,\n RestCatalogSource,\n LocalCatalogSource,\n isLocalCatalogUrl,\n libraryDirMissing,\n missingLibraryDirMessage,\n } = await import(\"@skaile/workspaces/library\");\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n\n if (isLocalCatalogUrl(baseUrl)) {\n const fs = await import(\"node:fs\");\n const library = await openLibrary();\n try {\n const sources = await library.listSources();\n type LibraryRow = (typeof sources)[number];\n // Type-narrow: `path` is required for local libraries after the filter.\n const usable = sources\n .filter(\n (s): s is LibraryRow & { path: string } =>\n s.backend === \"local\" && typeof s.path === \"string\" && s.path.length > 0,\n )\n .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());\n\n // A registered library whose directory is gone has one wording everywhere.\n const gone = sources.filter(libraryDirMissing);\n if (usable.length === 0) {\n if (gone.length > 0) throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n throw new Error(\n \"catalog.url is set to 'local' but no local library is registered. \" +\n \"Run `skaile library init <name> --path <dir>` first (a git repo: `skaile source add <git-url>`).\",\n );\n }\n\n // Prefer the most recently added library whose path still exists.\n const present = usable.find((s) => fs.existsSync(s.path));\n if (!present) {\n throw new Error(gone.map(missingLibraryDirMessage).join(\"\\n\"));\n }\n\n const source = new LocalCatalogSource(library, present.id, present.path, getKindRegistry());\n return { source, close: () => library.close() };\n } catch (err) {\n // Release the handle on any failure during dispatch — otherwise the\n // SQLite WAL state leaks for the lifetime of the process.\n library.close();\n throw err;\n }\n }\n\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n const source =\n cfg.catalog.framing === \"rest\"\n ? new RestCatalogSource({ baseUrl, cacheTtlMs })\n : new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n return { source, close: () => {} };\n}\n\n/**\n * Open the LibraryManager bound to the active LocalIndex.\n * Caller owns lifetime — must call `close()` (returned helper closes the\n * underlying LocalIndex).\n *\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibraryManager(): Promise<{\n manager: import(\"@skaile/workspaces/library\").LibraryManager;\n library: import(\"@skaile/workspaces/library\").LocalIndex;\n close: () => void;\n}> {\n const { LibraryManager } = await import(\"@skaile/workspaces/library\");\n const library = await openLibrary();\n const manager = new LibraryManager(library);\n return { manager, library, close: () => library.close() };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { getProviderPreset, registryCredentialEnv, providerCredentialEnvName, BUILTIN_HARNESS_CATALOG } from './chunk-F2GOZMRA.js';
2
- import { mergeRegistries, resolveEntryBaseUrl, normalizeEntryBaseUrl, registryEntries, isEntryEnabled, parseModelRef } from './chunk-LSI2IVFT.js';
1
+ import { getProviderPreset, registryCredentialEnv, providerCredentialEnvName, BUILTIN_HARNESS_CATALOG } from './chunk-X37JUNEW.js';
2
+ import { mergeRegistries, resolveEntryBaseUrl, normalizeEntryBaseUrl, registryEntries, isEntryEnabled, parseModelRef } from './chunk-RXGPFAMN.js';
3
3
 
4
4
  // bridge/src/provider-materialize/env-harnesses.ts
5
5
  function resolveEnvHarnessSession(config, processEnv = process.env) {
@@ -137,5 +137,5 @@ function continueRoleBinding(session) {
137
137
  }
138
138
 
139
139
  export { bindSingleProviderEntry, continueRoleBinding, credentialsForEveryProvider, entryBaseUrl, entryModelIds, entrySurface, harnessModelSelector, harnessProviderName, isStockCatalogEndpoint, registryModelEntries, resolveEnvHarnessSession, resolveRegistryBinding, selectableEntries, versionedAnthropicBaseUrl };
140
- //# sourceMappingURL=chunk-GEQSUC6U.js.map
141
- //# sourceMappingURL=chunk-GEQSUC6U.js.map
140
+ //# sourceMappingURL=chunk-BOT64P3U.js.map
141
+ //# sourceMappingURL=chunk-BOT64P3U.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../bridge/src/provider-materialize/env-harnesses.ts"],"names":[],"mappings":";;;;AAyEO,SAAS,wBAAA,CACd,MAAA,EACA,U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,eAAe,CAAA,CAAA;AAChE;AAgCO,SAAS,oBAAoB,OAAA,EAA6D;AAC/F,EAAA,MAAM,OAAA,GAAU,uBAAuB,OAAO,CAAA;AAC9C,EAAA,IAAI,CAAC,SAAS,OAAO,MAAA;AACrB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,YAAY,OAAA,CAAQ,UAAA;AAAA,IACpB,UAAU,OAAA,CAAQ,iBAAA;AAAA,IAClB,GAAI,QAAQ,eAAA,GAAkB,EAAE,OAAO,OAAA,CAAQ,eAAA,KAAoB,EAAC;AAAA,IACpE,GAAI,OAAA,CAAQ,OAAA,GACR,EAAE,OAAA,EAAS,yBAAA,CAA0B,OAAA,CAAQ,OAAA,EAAS,OAAA,CAAQ,OAAO,CAAA,EAAE,GACvE,EAAC;AAAA,IACL,SAAA,EAAW,yBAAA,CAA0B,OAAA,CAAQ,UAAU;AAAA,GACzD;AACF","file":"chunk-GEQSUC6U.js","sourcesContent":["/**\n * Registry adapter for the **env-shaped CLI harnesses** — Gemini, Qwen, OpenCode,\n * Goose and Continue (§2.3).\n *\n * These harnesses take their endpoint from the environment rather than from a\n * config file, so the adapter's job is three things: resolve which registry\n * entry the session's model selector names, refuse at start when that entry\n * speaks a wire surface the harness cannot, and hand the harness the\n * provider-side model id it must put on the command line.\n *\n * Two pluralities meet here (`BUILTIN_HARNESS_CATALOG.providerPlurality`):\n *\n * - `single` — Gemini and Qwen address exactly one endpoint. The bound entry\n * supplies the credential *and* the base URL, and a surface mismatch is\n * fatal: a Gemini CLI pointed at an `openai-completions` endpoint cannot\n * work, and failing at start names the surface instead of leaving the user\n * with an opaque error mid-turn.\n * - `credentials-n` — OpenCode, Goose and Continue accept every enabled\n * entry's credential at once and select one active model. The credential\n * fan-out is `registryCredentialEnv`; the active model is this module's\n * `<provider>/<model>` binding.\n *\n * Writing the per-endpoint config files those three need for *custom*\n * endpoints (`opencode.json`, Goose `custom_providers/*.json`, Continue\n * `config.yaml`) is the file half, and is deliberately not here.\n *\n * @see PROVIDER-CONFIG-PLAN.md §2.3\n */\n\nimport {\n type AIProviderLlmEntry,\n type AIProviderSurface,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n mergeRegistries,\n normalizeEntryBaseUrl,\n parseModelRef,\n registryEntries,\n resolveEntryBaseUrl,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { ModelEntry } from \"../models.js\";\nimport { getProviderPreset } from \"../provider-catalog.js\";\nimport { BUILTIN_HARNESS_CATALOG } from \"../registry.js\";\nimport type { AgentConfig } from \"../types.js\";\nimport { providerCredentialEnvName, registryCredentialEnv } from \"./credential-env.js\";\n\n/**\n * Everything a CLI harness needs to know about this session's AI providers,\n * resolved once from its {@link AgentConfig}.\n */\nexport interface EnvHarnessSession {\n /** The merged registry this session may address. Empty when none was configured. */\n registry: MergedAIProviderRegistry;\n /**\n * Environment `credential.ref` lookups resolve against — the process\n * environment widened with `config.env`, which is where the session\n * boundary delivered every resolved `SKAILE_AIP_<ID>_KEY`.\n */\n lookupEnv: Record<string, string | undefined>;\n /** Model selector: `<providerId>/<modelId>`, a bare id, or `@role`. */\n modelRef?: string;\n /** Roles table an `@role` selector resolves through. */\n roles?: Record<string, string>;\n}\n\n/**\n * Resolve the session's providers once, from its {@link AgentConfig}.\n *\n * `config.env` is folded into `lookupEnv` rather than kept apart: it is part\n * of the session's environment, not an extra, and a credential or\n * `*_BASE_URL` delivered there must be visible exactly as the child will see\n * it.\n */\nexport function resolveEnvHarnessSession(\n config: AgentConfig,\n processEnv: Record<string, string | undefined> = process.env,\n): EnvHarnessSession {\n return {\n registry: config.registry ?? mergeRegistries([]),\n lookupEnv: { ...processEnv, ...config.env },\n ...(config.modelRef ? { modelRef: config.modelRef } : {}),\n ...(config.roles ? { roles: config.roles } : {}),\n };\n}\n\n/** One resolved endpoint + model — everything a harness needs to spawn. */\nexport interface RegistryModelBinding {\n /** Registry id of the selected entry. */\n providerId: string;\n /** The selected entry itself. */\n entry: AIProviderLlmEntry;\n /** Logical model id, after `@role` expansion and before `model_map`. */\n modelId?: string;\n /** Provider-side model id — what goes on the wire / command line. */\n providerModelId?: string;\n /** Wire protocol, from the entry or its preset. */\n surface?: AIProviderSurface;\n /** Resolved endpoint, from the entry, its transport params, or its preset. */\n baseUrl?: string;\n /**\n * The provider name the *harness* knows this endpoint by — a catalog preset\n * id for a stock endpoint, the registry id for anything custom. See\n * {@link harnessProviderName}.\n */\n harnessProviderId: string;\n /** Non-fatal notes from `parseModelRef` (dangling role, disabled provider). */\n warnings: string[];\n}\n\n/** The entry's wire surface: its own, else its preset's. */\nexport function entrySurface(entry: AIProviderLlmEntry): AIProviderSurface | undefined {\n if (entry.surface) return entry.surface;\n return entry.preset ? getProviderPreset(entry.preset)?.surface : undefined;\n}\n\n/**\n * The entry's endpoint: its literal or transport-derived URL, else its\n * preset's literal, in the canonical spelling for its surface\n * (`normalizeEntryBaseUrl`: an `anthropic-messages` endpoint is its host root,\n * so `https://api.anthropic.com/v1` reads as `https://api.anthropic.com`).\n * Transport templates that still carry `{param}` placeholders never come\n * back — `resolveEntryBaseUrl` withholds those, and a preset's template is not\n * a URL.\n *\n * Every adapter reads the endpoint here and only re-spells it for a client\n * that wants something else ({@link versionedAnthropicBaseUrl}).\n */\nexport function entryBaseUrl(entry: AIProviderLlmEntry): string | undefined {\n const resolved =\n resolveEntryBaseUrl(entry) ??\n (entry.preset ? getProviderPreset(entry.preset)?.base_url : undefined);\n return normalizeEntryBaseUrl(resolved, entrySurface(entry));\n}\n\n/**\n * An `anthropic-messages` endpoint spelled for a client that appends only\n * `/messages` — `@ai-sdk/anthropic` (OpenCode) and Continue — rather than\n * `/v1/messages` like the Claude CLI, the Anthropic SDK and Goose. `baseUrl`\n * must already be canonical ({@link entryBaseUrl}); every other surface passes\n * through unchanged.\n */\nexport function versionedAnthropicBaseUrl(\n baseUrl: string,\n surface: AIProviderSurface | undefined,\n): string {\n if (surface !== \"anthropic-messages\") return baseUrl;\n // Append to the path, not the string: a query or fragment stays at the end.\n try {\n const url = new URL(baseUrl);\n url.pathname = `${url.pathname.replace(/\\/+$/, \"\")}/v1`;\n return url.toString();\n } catch {\n return `${baseUrl}/v1`;\n }\n}\n\n/**\n * True when a `credentials-n` harness already knows this endpoint under its\n * own catalog name — the entry names a preset and did not move it somewhere\n * else. Both sides are compared canonically, so `https://api.anthropic.com/v1`\n * is still the `anthropic` preset's endpoint.\n *\n * The one rule both halves of §2.3 read: it decides the name the env half\n * puts on the command line ({@link harnessProviderName}) *and* whether the\n * file half has to describe the endpoint at all. Reading it twice is what\n * keeps `-m <name>/<model>` and the generated provider file talking about the\n * same thing.\n */\nexport function isStockCatalogEndpoint(entry: AIProviderLlmEntry): boolean {\n const preset = entry.preset ? getProviderPreset(entry.preset) : undefined;\n if (!preset) return false;\n return entryBaseUrl(entry) === normalizeEntryBaseUrl(preset.base_url, entrySurface(entry));\n}\n\n/**\n * The provider name to give a `credentials-n` harness (`-m <name>/<model>`,\n * `GOOSE_PROVIDER`).\n *\n * A stock catalog endpoint is named by its preset, because that is the name\n * OpenCode's models.dev list and Goose's built-in provider table already use —\n * `prod-claude: {preset: anthropic}` is still Anthropic to them. An entry with\n * an endpoint of its own is named by its registry id: no built-in table knows\n * it, so the id is what its generated provider file is keyed by (the file half\n * of §2.3).\n */\nexport function harnessProviderName(providerId: string, entry: AIProviderLlmEntry): string {\n const preset = entry.preset ? getProviderPreset(entry.preset) : undefined;\n if (!preset || !isStockCatalogEndpoint(entry)) return providerId;\n return preset.id;\n}\n\n/**\n * Enabled `llm`/`embed` entries, in registry order. Also the set the file\n * adapters render (`opencode-config.ts`, `goose-custom-providers.ts`,\n * `continue-config-yaml.ts`): the env half and the file half must agree on\n * which entries exist before they can agree on what to call them.\n */\nexport function selectableEntries(\n registry: MergedAIProviderRegistry,\n): Array<[string, AIProviderLlmEntry]> {\n return registryEntries(registry).filter(\n (pair): pair is [string, AIProviderLlmEntry] =>\n (pair[1].kind === \"llm\" || pair[1].kind === \"embed\") && isEntryEnabled(pair[1]),\n );\n}\n\n/**\n * The provider-side model ids an entry declares, as `[logicalId, providerId]`\n * pairs in declaration order: every `model_map` entry, plus every\n * `capabilities` key the map does not rename.\n */\nexport function entryModelIds(entry: AIProviderLlmEntry): Array<[string, string]> {\n const logicalIds = [\n ...Object.keys(entry.model_map ?? {}),\n ...Object.keys(entry.capabilities ?? {}).filter((id) => !(id in (entry.model_map ?? {}))),\n ];\n return logicalIds.map((id) => [id, entry.model_map?.[id] ?? id]);\n}\n\nfunction describeBinding(\n providerId: string,\n entry: AIProviderLlmEntry,\n modelId: string | undefined,\n providerModelId: string | undefined,\n warnings: string[],\n): RegistryModelBinding {\n const surface = entrySurface(entry);\n const baseUrl = entryBaseUrl(entry);\n return {\n providerId,\n entry,\n ...(modelId === undefined ? {} : { modelId }),\n ...(providerModelId === undefined ? {} : { providerModelId }),\n ...(surface ? { surface } : {}),\n ...(baseUrl ? { baseUrl } : {}),\n harnessProviderId: harnessProviderName(providerId, entry),\n warnings,\n };\n}\n\n/**\n * Resolve the session's endpoint + model.\n *\n * With no selector the first entry in registry order wins and the harness\n * keeps its own default model — exactly what an absent `model` meant before\n * the registry existed. Returns `undefined` when no entry can serve a model\n * (an empty, fully-disabled or voice-only registry).\n */\nexport function resolveRegistryBinding(\n session: EnvHarnessSession,\n): RegistryModelBinding | undefined {\n const entries = selectableEntries(session.registry);\n if (entries.length === 0) return undefined;\n\n const selector = session.modelRef?.trim();\n if (!selector) {\n const [providerId, entry] = entries[0];\n return describeBinding(providerId, entry, undefined, undefined, []);\n }\n\n // A selector that is exactly an entry id names the endpoint and nothing\n // else: the harness keeps its own default model. `parseModelRef` would read\n // it as a bare *model* id and fall back to registry order.\n const named = entries.find(([id]) => id === selector);\n if (named) return describeBinding(named[0], named[1], undefined, undefined, []);\n\n const resolved = parseModelRef(selector, session.registry, session.roles);\n if (!resolved) return undefined;\n const match = entries.find(([id]) => id === resolved.providerId);\n if (!match) return undefined;\n return describeBinding(\n match[0],\n match[1],\n resolved.modelId,\n resolved.providerModelId,\n resolved.warnings,\n );\n}\n\n/**\n * Every credential a `credentials-n` harness may use: one variable per\n * enabled registry entry. OpenCode, Goose and Continue have always received\n * *all* of them, not just the selected endpoint's, because they route across\n * providers inside a single session.\n */\nexport function credentialsForEveryProvider(session: EnvHarnessSession): Record<string, string> {\n return registryCredentialEnv(session.registry, { env: session.lookupEnv });\n}\n\n/**\n * Throw when the bound entry speaks a wire surface this harness cannot.\n *\n * The message names the offending surface and lists the ones the harness does\n * speak (`BUILTIN_HARNESS_CATALOG[harnessId].surfaces`). An entry that declares\n * no surface and names no preset is not judged — there is nothing to compare.\n */\nexport function assertHarnessSpeaksSurface(\n harnessId: string,\n productName: string,\n binding: RegistryModelBinding,\n): void {\n const supported = BUILTIN_HARNESS_CATALOG[harnessId]?.surfaces;\n if (!supported || supported.length === 0) return;\n const surface = binding.surface;\n if (!surface || supported.includes(surface)) return;\n throw new Error(\n `${productName} cannot speak the '${surface}' surface of AI provider entry ` +\n `'${binding.providerId}'. ${productName} speaks: ${supported.join(\", \")}. ` +\n `Point this session's model at an entry with one of those surfaces, ` +\n `or run it on a harness that speaks '${surface}'.`,\n );\n}\n\n/**\n * The models a `credentials-n` harness can be pointed at, straight from the\n * registry: every enabled entry's mapped ids, namespaced the way the harness\n * takes them (`-m <provider>/<model>`).\n *\n * These harnesses have no model-list endpoint of their own — OpenCode reads\n * models.dev, Goose and Continue read their config — so the registry is the\n * only list that describes *this* session's reachable models, and it needs no\n * network call to produce.\n */\nexport function registryModelEntries(session: EnvHarnessSession): ModelEntry[] {\n const out: ModelEntry[] = [];\n const seen = new Set<string>();\n for (const [providerId, entry] of selectableEntries(session.registry)) {\n const harnessId = harnessProviderName(providerId, entry);\n const label = entry.label ?? providerId;\n for (const [logicalId, providerModelId] of entryModelIds(entry)) {\n const id = `${harnessId}/${providerModelId}`;\n if (seen.has(id)) continue;\n seen.add(id);\n out.push({ id, name: `${label} ${logicalId}` });\n }\n }\n return out;\n}\n\n/**\n * Resolve the binding and enforce the surface — what a `single`-plurality\n * harness does at start.\n *\n * The registry is authoritative: pointing the harness at an entry it cannot\n * speak throws rather than silently running somewhere else. `undefined` when\n * the session configured no endpoint at all, which leaves the harness on its\n * own native auth.\n */\nexport function bindSingleProviderEntry(\n harnessId: string,\n productName: string,\n session: EnvHarnessSession,\n): RegistryModelBinding | undefined {\n const binding = resolveRegistryBinding(session);\n if (!binding) return undefined;\n assertHarnessSpeaksSurface(harnessId, productName, binding);\n return binding;\n}\n\n/**\n * The `<provider>/<model>` selector a `credentials-n` harness takes on its\n * command line (`opencode -m`). `undefined` when no model was selected — the\n * harness then uses its own default rather than being handed a bare provider.\n */\nexport function harnessModelSelector(binding: RegistryModelBinding): string | undefined {\n if (!binding.providerModelId) return undefined;\n return `${binding.harnessProviderId}/${binding.providerModelId}`;\n}\n\n/**\n * Continue's model selection is a **role binding**, not a flag: `cn` has no\n * `--model` option (only `--config <slug>`), and its `config.yaml` binds each\n * model to roles (`chat`, `edit`, `apply`, …). This is the binding for the\n * role a headless `cn -p` turn runs as, and the shape its generated\n * `config.yaml` is rendered from.\n *\n * `apiKeyEnv` is a variable *name*: the secret travels in the child\n * environment, never in a rendered config.\n */\nexport interface ContinueRoleBinding {\n /** Continue role this model serves. A headless prompt is a `chat` turn. */\n role: \"chat\";\n /** Registry id of the entry. */\n providerId: string;\n /** Provider name Continue knows the endpoint by. */\n provider: string;\n /** Provider-side model id. */\n model?: string;\n /** Endpoint, when the entry states one, spelled the way Continue's `apiBase` wants it. */\n apiBase?: string;\n /** Env var holding the credential — the name, never the value. */\n apiKeyEnv: string;\n}\n\n/**\n * Map the session's chosen endpoint onto the Continue role a headless turn\n * runs as. `undefined` when the session configured no endpoint — `cn` then\n * runs against whatever its own `config.yaml` / Hub login provides.\n */\nexport function continueRoleBinding(session: EnvHarnessSession): ContinueRoleBinding | undefined {\n const binding = resolveRegistryBinding(session);\n if (!binding) return undefined;\n return {\n role: \"chat\",\n providerId: binding.providerId,\n provider: binding.harnessProviderId,\n ...(binding.providerModelId ? { model: binding.providerModelId } : {}),\n ...(binding.baseUrl\n ? { apiBase: versionedAnthropicBaseUrl(binding.baseUrl, binding.surface) }\n : {}),\n apiKeyEnv: providerCredentialEnvName(binding.providerId),\n };\n}\n"]}
1
+ {"version":3,"sources":["../bridge/src/provider-materialize/env-harnesses.ts"],"names":[],"mappings":";;;;AAyEO,SAAS,wBAAA,CACd,MAAA,EACA,UAAA,GAAiD,OAAA,CAAQ,GAAA,EACtC;AACnB,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,MAAA,CAAO,QAAA,IAAY,eAAA,CAAgB,EAAE,CAAA;AAAA,IAC/C,WAAW,EAAE,GAAG,UAAA,EAAY,GAAG,OAAO,GAAA,EAAI;AAAA,IAC1C,GAAI,OAAO,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,IACvD,GAAI,OAAO,KAAA,GAAQ,EAAE,OAAO,MAAA,CAAO,KAAA,KAAU;AAAC,GAChD;AACF;AA2BO,SAAS,aAAa,KAAA,EAA0D;AACrF,EAAA,IAAI,KAAA,CAAM,OAAA,EAAS,OAAO,KAAA,CAAM,OAAA;AAChC,EAAA,OAAO,MAAM,MAAA,GAAS,iBAAA,CAAkB,KAAA,CAAM,MAAM,GAAG,OAAA,GAAU,MAAA;AACnE;AAcO,SAAS,aAAa,KAAA,EAA+C;AAC1E,EAAA,MAAM,QAAA,GACJ,mBAAA,CAAoB,KAAK,CAAA,KACxB,KAAA,CAAM,SAAS,iBAAA,CAAkB,KAAA,CAAM,MAAM,CAAA,EAAG,QAAA,GAAW,MAAA,CAAA;AAC9D,EAAA,OAAO,qBAAA,CAAsB,QAAA,EAAU,YAAA,CAAa,KAAK,CAAC,CAAA;AAC5D;AASO,SAAS,yBAAA,CACd,SACA,OAAA,EACQ;AACR,EAAA,IAAI,OAAA,KAAY,sBAAsB,OAAO,OAAA;AAE7C,EAAA,IAAI;AACF,IAAA,MAAM,G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C,SAAS,OAAO,MAAA;AACrB,EAAA,0BAAA,CAA2B,SAAA,EAAW,aAAa,OAAO,CAAA;AAC1D,EAAA,OAAO,OAAA;AACT;AAOO,SAAS,qBAAqB,OAAA,EAAmD;AACtF,EAAA,IAAI,CAAC,OAAA,CAAQ,eAAA,EAAiB,OAAO,MAAA;AACrC,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,iBAAiB,CAAA,CAAA,EAAI,QAAQ,eAAe,CAAA,CAAA;AAChE;AAgCO,SAAS,oBAAoB,OAAA,EAA6D;AAC/F,EAAA,MAAM,OAAA,GAAU,uBAAuB,OAAO,CAAA;AAC9C,EAAA,IAAI,CAAC,SAAS,OAAO,MAAA;AACrB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,YAAY,OAAA,CAAQ,UAAA;AAAA,IACpB,UAAU,OAAA,CAAQ,iBAAA;AAAA,IAClB,GAAI,QAAQ,eAAA,GAAkB,EAAE,OAAO,OAAA,CAAQ,eAAA,KAAoB,EAAC;AAAA,IACpE,GAAI,OAAA,CAAQ,OAAA,GACR,EAAE,OAAA,EAAS,yBAAA,CAA0B,OAAA,CAAQ,OAAA,EAAS,OAAA,CAAQ,OAAO,CAAA,EAAE,GACvE,EAAC;AAAA,IACL,SAAA,EAAW,yBAAA,CAA0B,OAAA,CAAQ,UAAU;AAAA,GACzD;AACF","file":"chunk-BOT64P3U.js","sourcesContent":["/**\n * Registry adapter for the **env-shaped CLI harnesses** — Gemini, Qwen, OpenCode,\n * Goose and Continue (§2.3).\n *\n * These harnesses take their endpoint from the environment rather than from a\n * config file, so the adapter's job is three things: resolve which registry\n * entry the session's model selector names, refuse at start when that entry\n * speaks a wire surface the harness cannot, and hand the harness the\n * provider-side model id it must put on the command line.\n *\n * Two pluralities meet here (`BUILTIN_HARNESS_CATALOG.providerPlurality`):\n *\n * - `single` — Gemini and Qwen address exactly one endpoint. The bound entry\n * supplies the credential *and* the base URL, and a surface mismatch is\n * fatal: a Gemini CLI pointed at an `openai-completions` endpoint cannot\n * work, and failing at start names the surface instead of leaving the user\n * with an opaque error mid-turn.\n * - `credentials-n` — OpenCode, Goose and Continue accept every enabled\n * entry's credential at once and select one active model. The credential\n * fan-out is `registryCredentialEnv`; the active model is this module's\n * `<provider>/<model>` binding.\n *\n * Writing the per-endpoint config files those three need for *custom*\n * endpoints (`opencode.json`, Goose `custom_providers/*.json`, Continue\n * `config.yaml`) is the file half, and is deliberately not here.\n *\n * @see PROVIDER-CONFIG-PLAN.md §2.3\n */\n\nimport {\n type AIProviderLlmEntry,\n type AIProviderSurface,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n mergeRegistries,\n normalizeEntryBaseUrl,\n parseModelRef,\n registryEntries,\n resolveEntryBaseUrl,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { ModelEntry } from \"../models.js\";\nimport { getProviderPreset } from \"../provider-catalog.js\";\nimport { BUILTIN_HARNESS_CATALOG } from \"../registry.js\";\nimport type { AgentConfig } from \"../types.js\";\nimport { providerCredentialEnvName, registryCredentialEnv } from \"./credential-env.js\";\n\n/**\n * Everything a CLI harness needs to know about this session's AI providers,\n * resolved once from its {@link AgentConfig}.\n */\nexport interface EnvHarnessSession {\n /** The merged registry this session may address. Empty when none was configured. */\n registry: MergedAIProviderRegistry;\n /**\n * Environment `credential.ref` lookups resolve against — the process\n * environment widened with `config.env`, which is where the session\n * boundary delivered every resolved `SKAILE_AIP_<ID>_KEY`.\n */\n lookupEnv: Record<string, string | undefined>;\n /** Model selector: `<providerId>/<modelId>`, a bare id, or `@role`. */\n modelRef?: string;\n /** Roles table an `@role` selector resolves through. */\n roles?: Record<string, string>;\n}\n\n/**\n * Resolve the session's providers once, from its {@link AgentConfig}.\n *\n * `config.env` is folded into `lookupEnv` rather than kept apart: it is part\n * of the session's environment, not an extra, and a credential or\n * `*_BASE_URL` delivered there must be visible exactly as the child will see\n * it.\n */\nexport function resolveEnvHarnessSession(\n config: AgentConfig,\n processEnv: Record<string, string | undefined> = process.env,\n): EnvHarnessSession {\n return {\n registry: config.registry ?? mergeRegistries([]),\n lookupEnv: { ...processEnv, ...config.env },\n ...(config.modelRef ? { modelRef: config.modelRef } : {}),\n ...(config.roles ? { roles: config.roles } : {}),\n };\n}\n\n/** One resolved endpoint + model — everything a harness needs to spawn. */\nexport interface RegistryModelBinding {\n /** Registry id of the selected entry. */\n providerId: string;\n /** The selected entry itself. */\n entry: AIProviderLlmEntry;\n /** Logical model id, after `@role` expansion and before `model_map`. */\n modelId?: string;\n /** Provider-side model id — what goes on the wire / command line. */\n providerModelId?: string;\n /** Wire protocol, from the entry or its preset. */\n surface?: AIProviderSurface;\n /** Resolved endpoint, from the entry, its transport params, or its preset. */\n baseUrl?: string;\n /**\n * The provider name the *harness* knows this endpoint by — a catalog preset\n * id for a stock endpoint, the registry id for anything custom. See\n * {@link harnessProviderName}.\n */\n harnessProviderId: string;\n /** Non-fatal notes from `parseModelRef` (dangling role, disabled provider). */\n warnings: string[];\n}\n\n/** The entry's wire surface: its own, else its preset's. */\nexport function entrySurface(entry: AIProviderLlmEntry): AIProviderSurface | undefined {\n if (entry.surface) return entry.surface;\n return entry.preset ? getProviderPreset(entry.preset)?.surface : undefined;\n}\n\n/**\n * The entry's endpoint: its literal or transport-derived URL, else its\n * preset's literal, in the canonical spelling for its surface\n * (`normalizeEntryBaseUrl`: an `anthropic-messages` endpoint is its host root,\n * so `https://api.anthropic.com/v1` reads as `https://api.anthropic.com`).\n * Transport templates that still carry `{param}` placeholders never come\n * back — `resolveEntryBaseUrl` withholds those, and a preset's template is not\n * a URL.\n *\n * Every adapter reads the endpoint here and only re-spells it for a client\n * that wants something else ({@link versionedAnthropicBaseUrl}).\n */\nexport function entryBaseUrl(entry: AIProviderLlmEntry): string | undefined {\n const resolved =\n resolveEntryBaseUrl(entry) ??\n (entry.preset ? getProviderPreset(entry.preset)?.base_url : undefined);\n return normalizeEntryBaseUrl(resolved, entrySurface(entry));\n}\n\n/**\n * An `anthropic-messages` endpoint spelled for a client that appends only\n * `/messages` — `@ai-sdk/anthropic` (OpenCode) and Continue — rather than\n * `/v1/messages` like the Claude CLI, the Anthropic SDK and Goose. `baseUrl`\n * must already be canonical ({@link entryBaseUrl}); every other surface passes\n * through unchanged.\n */\nexport function versionedAnthropicBaseUrl(\n baseUrl: string,\n surface: AIProviderSurface | undefined,\n): string {\n if (surface !== \"anthropic-messages\") return baseUrl;\n // Append to the path, not the string: a query or fragment stays at the end.\n try {\n const url = new URL(baseUrl);\n url.pathname = `${url.pathname.replace(/\\/+$/, \"\")}/v1`;\n return url.toString();\n } catch {\n return `${baseUrl}/v1`;\n }\n}\n\n/**\n * True when a `credentials-n` harness already knows this endpoint under its\n * own catalog name — the entry names a preset and did not move it somewhere\n * else. Both sides are compared canonically, so `https://api.anthropic.com/v1`\n * is still the `anthropic` preset's endpoint.\n *\n * The one rule both halves of §2.3 read: it decides the name the env half\n * puts on the command line ({@link harnessProviderName}) *and* whether the\n * file half has to describe the endpoint at all. Reading it twice is what\n * keeps `-m <name>/<model>` and the generated provider file talking about the\n * same thing.\n */\nexport function isStockCatalogEndpoint(entry: AIProviderLlmEntry): boolean {\n const preset = entry.preset ? getProviderPreset(entry.preset) : undefined;\n if (!preset) return false;\n return entryBaseUrl(entry) === normalizeEntryBaseUrl(preset.base_url, entrySurface(entry));\n}\n\n/**\n * The provider name to give a `credentials-n` harness (`-m <name>/<model>`,\n * `GOOSE_PROVIDER`).\n *\n * A stock catalog endpoint is named by its preset, because that is the name\n * OpenCode's models.dev list and Goose's built-in provider table already use —\n * `prod-claude: {preset: anthropic}` is still Anthropic to them. An entry with\n * an endpoint of its own is named by its registry id: no built-in table knows\n * it, so the id is what its generated provider file is keyed by (the file half\n * of §2.3).\n */\nexport function harnessProviderName(providerId: string, entry: AIProviderLlmEntry): string {\n const preset = entry.preset ? getProviderPreset(entry.preset) : undefined;\n if (!preset || !isStockCatalogEndpoint(entry)) return providerId;\n return preset.id;\n}\n\n/**\n * Enabled `llm`/`embed` entries, in registry order. Also the set the file\n * adapters render (`opencode-config.ts`, `goose-custom-providers.ts`,\n * `continue-config-yaml.ts`): the env half and the file half must agree on\n * which entries exist before they can agree on what to call them.\n */\nexport function selectableEntries(\n registry: MergedAIProviderRegistry,\n): Array<[string, AIProviderLlmEntry]> {\n return registryEntries(registry).filter(\n (pair): pair is [string, AIProviderLlmEntry] =>\n (pair[1].kind === \"llm\" || pair[1].kind === \"embed\") && isEntryEnabled(pair[1]),\n );\n}\n\n/**\n * The provider-side model ids an entry declares, as `[logicalId, providerId]`\n * pairs in declaration order: every `model_map` entry, plus every\n * `capabilities` key the map does not rename.\n */\nexport function entryModelIds(entry: AIProviderLlmEntry): Array<[string, string]> {\n const logicalIds = [\n ...Object.keys(entry.model_map ?? {}),\n ...Object.keys(entry.capabilities ?? {}).filter((id) => !(id in (entry.model_map ?? {}))),\n ];\n return logicalIds.map((id) => [id, entry.model_map?.[id] ?? id]);\n}\n\nfunction describeBinding(\n providerId: string,\n entry: AIProviderLlmEntry,\n modelId: string | undefined,\n providerModelId: string | undefined,\n warnings: string[],\n): RegistryModelBinding {\n const surface = entrySurface(entry);\n const baseUrl = entryBaseUrl(entry);\n return {\n providerId,\n entry,\n ...(modelId === undefined ? {} : { modelId }),\n ...(providerModelId === undefined ? {} : { providerModelId }),\n ...(surface ? { surface } : {}),\n ...(baseUrl ? { baseUrl } : {}),\n harnessProviderId: harnessProviderName(providerId, entry),\n warnings,\n };\n}\n\n/**\n * Resolve the session's endpoint + model.\n *\n * With no selector the first entry in registry order wins and the harness\n * keeps its own default model — exactly what an absent `model` meant before\n * the registry existed. Returns `undefined` when no entry can serve a model\n * (an empty, fully-disabled or voice-only registry).\n */\nexport function resolveRegistryBinding(\n session: EnvHarnessSession,\n): RegistryModelBinding | undefined {\n const entries = selectableEntries(session.registry);\n if (entries.length === 0) return undefined;\n\n const selector = session.modelRef?.trim();\n if (!selector) {\n const [providerId, entry] = entries[0];\n return describeBinding(providerId, entry, undefined, undefined, []);\n }\n\n // A selector that is exactly an entry id names the endpoint and nothing\n // else: the harness keeps its own default model. `parseModelRef` would read\n // it as a bare *model* id and fall back to registry order.\n const named = entries.find(([id]) => id === selector);\n if (named) return describeBinding(named[0], named[1], undefined, undefined, []);\n\n const resolved = parseModelRef(selector, session.registry, session.roles);\n if (!resolved) return undefined;\n const match = entries.find(([id]) => id === resolved.providerId);\n if (!match) return undefined;\n return describeBinding(\n match[0],\n match[1],\n resolved.modelId,\n resolved.providerModelId,\n resolved.warnings,\n );\n}\n\n/**\n * Every credential a `credentials-n` harness may use: one variable per\n * enabled registry entry. OpenCode, Goose and Continue have always received\n * *all* of them, not just the selected endpoint's, because they route across\n * providers inside a single session.\n */\nexport function credentialsForEveryProvider(session: EnvHarnessSession): Record<string, string> {\n return registryCredentialEnv(session.registry, { env: session.lookupEnv });\n}\n\n/**\n * Throw when the bound entry speaks a wire surface this harness cannot.\n *\n * The message names the offending surface and lists the ones the harness does\n * speak (`BUILTIN_HARNESS_CATALOG[harnessId].surfaces`). An entry that declares\n * no surface and names no preset is not judged — there is nothing to compare.\n */\nexport function assertHarnessSpeaksSurface(\n harnessId: string,\n productName: string,\n binding: RegistryModelBinding,\n): void {\n const supported = BUILTIN_HARNESS_CATALOG[harnessId]?.surfaces;\n if (!supported || supported.length === 0) return;\n const surface = binding.surface;\n if (!surface || supported.includes(surface)) return;\n throw new Error(\n `${productName} cannot speak the '${surface}' surface of AI provider entry ` +\n `'${binding.providerId}'. ${productName} speaks: ${supported.join(\", \")}. ` +\n `Point this session's model at an entry with one of those surfaces, ` +\n `or run it on a harness that speaks '${surface}'.`,\n );\n}\n\n/**\n * The models a `credentials-n` harness can be pointed at, straight from the\n * registry: every enabled entry's mapped ids, namespaced the way the harness\n * takes them (`-m <provider>/<model>`).\n *\n * These harnesses have no model-list endpoint of their own — OpenCode reads\n * models.dev, Goose and Continue read their config — so the registry is the\n * only list that describes *this* session's reachable models, and it needs no\n * network call to produce.\n */\nexport function registryModelEntries(session: EnvHarnessSession): ModelEntry[] {\n const out: ModelEntry[] = [];\n const seen = new Set<string>();\n for (const [providerId, entry] of selectableEntries(session.registry)) {\n const harnessId = harnessProviderName(providerId, entry);\n const label = entry.label ?? providerId;\n for (const [logicalId, providerModelId] of entryModelIds(entry)) {\n const id = `${harnessId}/${providerModelId}`;\n if (seen.has(id)) continue;\n seen.add(id);\n out.push({ id, name: `${label} ${logicalId}` });\n }\n }\n return out;\n}\n\n/**\n * Resolve the binding and enforce the surface — what a `single`-plurality\n * harness does at start.\n *\n * The registry is authoritative: pointing the harness at an entry it cannot\n * speak throws rather than silently running somewhere else. `undefined` when\n * the session configured no endpoint at all, which leaves the harness on its\n * own native auth.\n */\nexport function bindSingleProviderEntry(\n harnessId: string,\n productName: string,\n session: EnvHarnessSession,\n): RegistryModelBinding | undefined {\n const binding = resolveRegistryBinding(session);\n if (!binding) return undefined;\n assertHarnessSpeaksSurface(harnessId, productName, binding);\n return binding;\n}\n\n/**\n * The `<provider>/<model>` selector a `credentials-n` harness takes on its\n * command line (`opencode -m`). `undefined` when no model was selected — the\n * harness then uses its own default rather than being handed a bare provider.\n */\nexport function harnessModelSelector(binding: RegistryModelBinding): string | undefined {\n if (!binding.providerModelId) return undefined;\n return `${binding.harnessProviderId}/${binding.providerModelId}`;\n}\n\n/**\n * Continue's model selection is a **role binding**, not a flag: `cn` has no\n * `--model` option (only `--config <slug>`), and its `config.yaml` binds each\n * model to roles (`chat`, `edit`, `apply`, …). This is the binding for the\n * role a headless `cn -p` turn runs as, and the shape its generated\n * `config.yaml` is rendered from.\n *\n * `apiKeyEnv` is a variable *name*: the secret travels in the child\n * environment, never in a rendered config.\n */\nexport interface ContinueRoleBinding {\n /** Continue role this model serves. A headless prompt is a `chat` turn. */\n role: \"chat\";\n /** Registry id of the entry. */\n providerId: string;\n /** Provider name Continue knows the endpoint by. */\n provider: string;\n /** Provider-side model id. */\n model?: string;\n /** Endpoint, when the entry states one, spelled the way Continue's `apiBase` wants it. */\n apiBase?: string;\n /** Env var holding the credential — the name, never the value. */\n apiKeyEnv: string;\n}\n\n/**\n * Map the session's chosen endpoint onto the Continue role a headless turn\n * runs as. `undefined` when the session configured no endpoint — `cn` then\n * runs against whatever its own `config.yaml` / Hub login provides.\n */\nexport function continueRoleBinding(session: EnvHarnessSession): ContinueRoleBinding | undefined {\n const binding = resolveRegistryBinding(session);\n if (!binding) return undefined;\n return {\n role: \"chat\",\n providerId: binding.providerId,\n provider: binding.harnessProviderId,\n ...(binding.providerModelId ? { model: binding.providerModelId } : {}),\n ...(binding.baseUrl\n ? { apiBase: versionedAnthropicBaseUrl(binding.baseUrl, binding.surface) }\n : {}),\n apiKeyEnv: providerCredentialEnvName(binding.providerId),\n };\n}\n"]}
@@ -1,12 +1,13 @@
1
- import { factoryAssetRoots } from './chunk-OTIB4D2K.js';
1
+ import { factoryAssetRoots, resolveWorkspacesPackageRoot } from './chunk-QPWR3YMY.js';
2
2
  import { deployedBase } from './chunk-5KRMNUL4.js';
3
- import { DEFAULT_HARNESS_ID } from './chunk-Z7ZEZZB6.js';
4
- import { parseSourceEntries, resolveSkWorkspaceConfig } from './chunk-OHNKYHRR.js';
3
+ import { DEFAULT_HARNESS_ID } from './chunk-C5HFK34M.js';
4
+ import { valueShapeError, parseSourceEntries, resolveSkWorkspaceConfig } from './chunk-KJSC2ZD6.js';
5
5
  import { globalSkaileDir } from './chunk-L5VSIPQD.js';
6
6
  import { harnessNameForHarnessId, SUPPORTED_HARNESSES } from './chunk-VTETQCR6.js';
7
- import { sha256Hex, compositeSha256, orderedAsset, ASSET_KEY_ORDER } from './chunk-UQ33Y4DM.js';
8
- import { parseAssetRefLoose } from './chunk-WDXZA7QW.js';
9
- import { validateRegistry, mergeRegistries, validateMergedRegistry } from './chunk-LSI2IVFT.js';
7
+ import { sha256Hex, compositeSha256, orderedAsset, ASSET_KEY_ORDER } from './chunk-KPKGWXUJ.js';
8
+ import { yamlQuotingHint } from './chunk-JMIKGAUA.js';
9
+ import { parseAssetRefLoose } from './chunk-IZQOO6MN.js';
10
+ import { validateRegistry, mergeRegistries, validateMergedRegistry } from './chunk-RXGPFAMN.js';
10
11
  import fs, { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, readdirSync, realpathSync } from 'fs';
11
12
  import path, { join, resolve, dirname, basename } from 'path';
12
13
  import { parseDocument, Document, isMap, isSeq, parse, stringify, isScalar, visit } from 'yaml';
@@ -47,6 +48,83 @@ function projectAssetRoots(projectDir = process.cwd()) {
47
48
  const roots = [...installRoots(false, projectDir), ...factoryAssetRoots()];
48
49
  return [...new Set(roots)].filter((r) => existsSync(r));
49
50
  }
51
+ var FACTORY_SOURCE_URL = "https://github.com/skaile-ai/ai-assets";
52
+ var LOCK_FACTORY_URL = "factory";
53
+ var FACTORY_MEMORY_COMMIT = "0".repeat(40);
54
+ function repoUrlKey(url) {
55
+ return url.trim().replace(/^git@([^:]+):/, "https://$1/").replace(/^[a-z]+:\/\//i, "").replace(/\/+$/, "").replace(/\.git$/i, "").replace(/\/+$/, "").toLowerCase();
56
+ }
57
+ var FACTORY_URL_KEY = repoUrlKey(FACTORY_SOURCE_URL);
58
+ var factoryVersionCache;
59
+ function factoryBundleVersion() {
60
+ if (factoryVersionCache !== void 0) return factoryVersionCache;
61
+ let version = "unknown";
62
+ const root = resolveWorkspacesPackageRoot();
63
+ if (root) {
64
+ try {
65
+ const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
66
+ if (typeof pkg.version === "string" && pkg.version !== "") version = pkg.version;
67
+ } catch {
68
+ }
69
+ }
70
+ factoryVersionCache = version;
71
+ return version;
72
+ }
73
+ function isFactoryMemorySource(source) {
74
+ return source !== void 0 && repoUrlKey(source.url) === FACTORY_URL_KEY && source.commit === FACTORY_MEMORY_COMMIT;
75
+ }
76
+ function lockToDisk(lock) {
77
+ const version = factoryBundleVersion();
78
+ let anyFactory = false;
79
+ const assets = {};
80
+ for (const [key, entry] of Object.entries(lock.assets)) {
81
+ if (isFactoryMemorySource(entry.source)) {
82
+ anyFactory = true;
83
+ assets[key] = { ...entry, source: { url: LOCK_FACTORY_URL, commit: version } };
84
+ } else {
85
+ assets[key] = entry;
86
+ }
87
+ }
88
+ const hasMemoryRow = lock.sources.some((s) => isFactoryMemorySource(s));
89
+ if (!anyFactory && !hasMemoryRow) return lock;
90
+ const rows = /* @__PURE__ */ new Map();
91
+ for (const s of lock.sources) if (!isFactoryMemorySource(s)) rows.set(s.url, s);
92
+ for (const s of sourcesOfAssets(assets)) if (!rows.has(s.url)) rows.set(s.url, s);
93
+ return {
94
+ ...lock,
95
+ assets,
96
+ sources: [...rows.values()].sort((a, b) => a.url.localeCompare(b.url))
97
+ };
98
+ }
99
+ function lockFromDisk(lock) {
100
+ const assets = {};
101
+ let any = false;
102
+ for (const [key, entry] of Object.entries(lock.assets ?? {})) {
103
+ if (entry.source?.url === LOCK_FACTORY_URL) {
104
+ any = true;
105
+ assets[key] = {
106
+ ...entry,
107
+ source: { url: FACTORY_SOURCE_URL, commit: FACTORY_MEMORY_COMMIT }
108
+ };
109
+ } else {
110
+ assets[key] = entry;
111
+ }
112
+ }
113
+ const sources = Array.isArray(lock.sources) ? lock.sources : [];
114
+ if (!any && !sources.some((s) => s.url === LOCK_FACTORY_URL)) return lock;
115
+ const rows = /* @__PURE__ */ new Map();
116
+ for (const s of sources) {
117
+ if (s.url !== LOCK_FACTORY_URL) rows.set(repoUrlKey(s.url), s);
118
+ }
119
+ if (!rows.has(FACTORY_URL_KEY)) {
120
+ rows.set(FACTORY_URL_KEY, { url: FACTORY_SOURCE_URL, commit: FACTORY_MEMORY_COMMIT });
121
+ }
122
+ return {
123
+ ...lock,
124
+ assets,
125
+ sources: [...rows.values()].sort((a, b) => a.url.localeCompare(b.url))
126
+ };
127
+ }
50
128
  var LOCK_SCHEMA_VERSION = 4;
51
129
  function canonicalize(value) {
52
130
  if (Array.isArray(value)) return value.map(canonicalize);
@@ -85,7 +163,7 @@ function parseLockYaml(text) {
85
163
  return doc.toJS();
86
164
  }
87
165
  function writeLock(lockPath, data) {
88
- const next = stringifyLock(data);
166
+ const next = stringifyLock(lockToDisk(data));
89
167
  if (existsSync(lockPath)) {
90
168
  try {
91
169
  const prev = parseLockYaml(readFileSync(lockPath, "utf8"));
@@ -114,7 +192,7 @@ function readLock(lockPath) {
114
192
  "outdated lockfile schema detected \u2014 the lockfile shape changed. Regenerate: `rm skaile.lock.yaml && skaile install`."
115
193
  );
116
194
  }
117
- return r;
195
+ return lockFromDisk(r);
118
196
  }
119
197
  function assertLockHashes(lock) {
120
198
  const isHex = (value) => typeof value === "string" && /^[0-9a-f]+$/i.test(value);
@@ -1096,6 +1174,10 @@ ${input.duties.trim()}`);
1096
1174
  pushParts("extensions", input.promptExtensions);
1097
1175
  return sections;
1098
1176
  }
1177
+ function appendToSeq(node, value) {
1178
+ if (node.items.length === 0) node.flow = false;
1179
+ node.add(value);
1180
+ }
1099
1181
  var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1100
1182
  path;
1101
1183
  doc;
@@ -1103,13 +1185,32 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1103
1185
  this.path = path3;
1104
1186
  this.doc = doc;
1105
1187
  }
1106
- /** Load an existing skaile.yaml file. */
1188
+ /**
1189
+ * Load an existing skaile.yaml file.
1190
+ *
1191
+ * @throws {Error} `<file> — parse error: <reason>` (one line, the one every other command
1192
+ * prints) when the file does not parse. A document with errors cannot be written back, so
1193
+ * it is never handed out: `source add` used to crash in `save()` and `source list` read it
1194
+ * as empty (p1421).
1195
+ */
1107
1196
  static load(filePath) {
1108
1197
  if (!existsSync(filePath)) {
1109
1198
  throw new Error(`File not found: ${filePath}`);
1110
1199
  }
1111
1200
  const raw = readFileSync(filePath, "utf-8");
1112
1201
  const doc = parseDocument(raw);
1202
+ const first = doc.errors[0];
1203
+ if (first) {
1204
+ const reason = (first.message.split("\n")[0] ?? "").replace(/:$/, "");
1205
+ const hint = yamlQuotingHint(reason, raw);
1206
+ throw new Error(`${basename(filePath)} \u2014 parse error: ${reason}${hint ? `.${hint}` : ""}`);
1207
+ }
1208
+ const label = basename(filePath);
1209
+ if (doc.contents !== null && !isMap(doc.contents)) {
1210
+ throw new Error(`${label} \u2014 parse error: skaile.yaml must be a mapping at the top level.`);
1211
+ }
1212
+ const wrongShape = valueShapeError(doc.toJS() ?? {});
1213
+ if (wrongShape) throw new Error(`${label} \u2014 parse error: ${wrongShape.message}`);
1113
1214
  return new _WorkspaceYamlEditor(filePath, doc);
1114
1215
  }
1115
1216
  /** Create a new empty document (for use when no file exists yet). */
@@ -1216,7 +1317,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1216
1317
  }
1217
1318
  }
1218
1319
  if (!found) {
1219
- node.add(this.doc.createNode(connector));
1320
+ appendToSeq(node, this.doc.createNode(connector));
1220
1321
  }
1221
1322
  }
1222
1323
  /** Remove a connector by id. */
@@ -1256,14 +1357,14 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1256
1357
  }
1257
1358
  }
1258
1359
  if (!found) {
1259
- node.add(this.doc.createNode(mcp));
1360
+ appendToSeq(node, this.doc.createNode(mcp));
1260
1361
  }
1261
1362
  }
1262
1363
  // ── Dependencies ───────────────────────────────────────────────────────────
1263
1364
  /**
1264
1365
  * Append a dependency ref to `dependencies:`, deduped by exact ref string.
1265
1366
  *
1266
- * @param ref - Canonical dependency ref (e.g. `skill:@skaile/foo#1.0.0`).
1367
+ * @param ref - Canonical dependency ref (e.g. `skill:@skaile-ai/foo#1.0.0`).
1267
1368
  * @returns `true` when the ref was newly added, `false` when it was already present.
1268
1369
  */
1269
1370
  addDependency(ref) {
@@ -1276,7 +1377,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1276
1377
  const cur = item != null && typeof item === "object" && "value" in item ? item.value : item;
1277
1378
  if (cur === ref) return false;
1278
1379
  }
1279
- node.add(this.doc.createNode(ref));
1380
+ appendToSeq(node, this.doc.createNode(ref));
1280
1381
  return true;
1281
1382
  }
1282
1383
  // ── Plugins ────────────────────────────────────────────────────────────────
@@ -1315,7 +1416,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1315
1416
  return true;
1316
1417
  }
1317
1418
  }
1318
- node.add(this.doc.createNode(spec));
1419
+ appendToSeq(node, this.doc.createNode(spec));
1319
1420
  return false;
1320
1421
  }
1321
1422
  /**
@@ -1369,7 +1470,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1369
1470
  break;
1370
1471
  }
1371
1472
  }
1372
- if (!found) node.add(this.doc.createNode(entry));
1473
+ if (!found) appendToSeq(node, this.doc.createNode(entry));
1373
1474
  }
1374
1475
  /** Remove a source entry by url. Returns true when an entry was removed. */
1375
1476
  removeSource(url) {
@@ -1407,7 +1508,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1407
1508
  break;
1408
1509
  }
1409
1510
  }
1410
- if (!found) node.add(this.doc.createNode(entry));
1511
+ if (!found) appendToSeq(node, this.doc.createNode(entry));
1411
1512
  }
1412
1513
  /** Remove a store entry by url. Returns true when an entry was removed. */
1413
1514
  removeStore(url) {
@@ -1445,7 +1546,7 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1445
1546
  break;
1446
1547
  }
1447
1548
  }
1448
- if (!found) node.add(this.doc.createNode(entry));
1549
+ if (!found) appendToSeq(node, this.doc.createNode(entry));
1449
1550
  }
1450
1551
  /** Remove an override entry by ref. Returns true when an entry was removed. */
1451
1552
  removeOverride(ref) {
@@ -1467,6 +1568,6 @@ var WorkspaceYamlEditor = class _WorkspaceYamlEditor {
1467
1568
  }
1468
1569
  };
1469
1570
 
1470
- export { AGENT_PROMPT_SECTION_ORDER, GLOBAL_INSTALL_DIR_NAME, LOCK_SCHEMA_VERSION, ManifestYamlEditor, PROVIDERS_FILENAME, SETTINGS_DEFAULTS, WorkspaceYamlEditor, aiResourceRoots, applyPatch, assertLockHashes, buildAgentPromptSections, buildLibraryLockEntries, buildLockFile, capMemoryContent, checkAgentSkillConformance, computeHash, connectProbe, defaultLibraryDir, detectPackageManager, extractForPatch, findProjectPackageDir, generatePatch, globalInstallDir, globalSettingsPath, harnessSdkMissingError, holdsWildcard, installCommand, installCommandFor, listPatches, listenWithProbe, loadHarnessSdk, loadHarnessSdkSubpath, loadProviderRegistry, loadProviderRegistryFile, loadSettings, mapLegacyFields, maskApiKey, mergeLockFile, migrateSettings, needsWildcardProbe, portIsHeld, probeHosts, projectAssetRoots, projectSettingsPath, readLock, readPatch, readPluginsLockSlice, renderMemorySection, resolveConfiguredHarnessName, resolveLibraryDir, resolveSettings, resolveSettingsWithSources, resyncLockSources, savePatch, saveProviderRegistryFile, saveSettings, sdkLookupPlaces, skaileInstallDir, userProviderRegistryPath, verifyLock, verifyLockEntry, walkForSettings, workspaceProviderRegistryPath, writeLock, writePluginsLockSlice };
1471
- //# sourceMappingURL=chunk-L4YKW5AY.js.map
1472
- //# sourceMappingURL=chunk-L4YKW5AY.js.map
1571
+ export { AGENT_PROMPT_SECTION_ORDER, FACTORY_SOURCE_URL, GLOBAL_INSTALL_DIR_NAME, LOCK_FACTORY_URL, LOCK_SCHEMA_VERSION, ManifestYamlEditor, PROVIDERS_FILENAME, SETTINGS_DEFAULTS, WorkspaceYamlEditor, aiResourceRoots, applyPatch, assertLockHashes, buildAgentPromptSections, buildLibraryLockEntries, buildLockFile, capMemoryContent, checkAgentSkillConformance, computeHash, connectProbe, defaultLibraryDir, detectPackageManager, extractForPatch, findProjectPackageDir, generatePatch, globalInstallDir, globalSettingsPath, harnessSdkMissingError, holdsWildcard, installCommand, installCommandFor, listPatches, listenWithProbe, loadHarnessSdk, loadHarnessSdkSubpath, loadProviderRegistry, loadProviderRegistryFile, loadSettings, mapLegacyFields, maskApiKey, mergeLockFile, migrateSettings, needsWildcardProbe, portIsHeld, probeHosts, projectAssetRoots, projectSettingsPath, readLock, readPatch, readPluginsLockSlice, renderMemorySection, resolveConfiguredHarnessName, resolveLibraryDir, resolveSettings, resolveSettingsWithSources, resyncLockSources, savePatch, saveProviderRegistryFile, saveSettings, sdkLookupPlaces, skaileInstallDir, userProviderRegistryPath, verifyLock, verifyLockEntry, walkForSettings, workspaceProviderRegistryPath, writeLock, writePluginsLockSlice };
1572
+ //# sourceMappingURL=chunk-BRK5QZKI.js.map
1573
+ //# sourceMappingURL=chunk-BRK5QZKI.js.map