@skaile/workspaces 6.9.1 → 6.11.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 (397) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/ai-sdk.js +8 -8
  3. package/dist/app-sdk/index.js +1 -1
  4. package/dist/{asset-feeds-PANNQPEE.js → asset-feeds-PO2WC75V.js} +23 -23
  5. package/dist/{asset-feeds-PANNQPEE.js.map → asset-feeds-PO2WC75V.js.map} +1 -1
  6. package/dist/asset-manager/catalog-deployer.js +8 -8
  7. package/dist/asset-manager/history.js +8 -8
  8. package/dist/asset-manager/index.js +15 -15
  9. package/dist/asset-manager/installer.js +10 -10
  10. package/dist/asset-manager/renderers.js +9 -9
  11. package/dist/asset-manager/src/harness-switch-state.d.ts +30 -0
  12. package/dist/asset-manager/src/harness-switch-state.d.ts.map +1 -0
  13. package/dist/asset-manager/src/index.d.ts +49 -12
  14. package/dist/asset-manager/src/index.d.ts.map +1 -1
  15. package/dist/asset-manager/src/mcp-config.d.ts +6 -0
  16. package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
  17. package/dist/bridge/codex-app-server.js +1 -2
  18. package/dist/bridge/harnesses/claude-sdk.js +15 -15
  19. package/dist/bridge/harnesses/codex.js +16 -1927
  20. package/dist/bridge/harnesses/codex.js.map +1 -1
  21. package/dist/bridge/harnesses/continue.js +11 -11
  22. package/dist/bridge/harnesses/echo.js +5 -5
  23. package/dist/bridge/harnesses/gemini.js +8 -8
  24. package/dist/bridge/harnesses/goose.js +11 -11
  25. package/dist/bridge/harnesses/omp.js +62 -14
  26. package/dist/bridge/harnesses/omp.js.map +1 -1
  27. package/dist/bridge/harnesses/opencode.js +11 -11
  28. package/dist/bridge/harnesses/qwen.js +8 -8
  29. package/dist/bridge/index.js +21 -20
  30. package/dist/bridge/src/harness-model-check.d.ts +5 -4
  31. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  32. package/dist/bridge/src/harnesses/codex.d.ts +13 -0
  33. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  34. package/dist/bridge/src/harnesses/omp.d.ts +24 -1
  35. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  36. package/dist/bridge/src/index.d.ts +1 -0
  37. package/dist/bridge/src/index.d.ts.map +1 -1
  38. package/dist/bridge/src/types.d.ts +7 -0
  39. package/dist/bridge/src/types.d.ts.map +1 -1
  40. package/dist/{chunk-TMQFOJ6F.js → chunk-2PVYDAFN.js} +3 -3
  41. package/dist/{chunk-TMQFOJ6F.js.map → chunk-2PVYDAFN.js.map} +1 -1
  42. package/dist/{chunk-7NN3P6VF.js → chunk-342UX2MG.js} +10 -5
  43. package/dist/chunk-342UX2MG.js.map +1 -0
  44. package/dist/{chunk-7UCPGQCW.js → chunk-45XL75RO.js} +11 -11
  45. package/dist/chunk-45XL75RO.js.map +1 -0
  46. package/dist/{chunk-CPMLMNI5.js → chunk-4NJVF3DV.js} +4 -4
  47. package/dist/{chunk-CPMLMNI5.js.map → chunk-4NJVF3DV.js.map} +1 -1
  48. package/dist/{chunk-KNY356I3.js → chunk-5KSGZP3E.js} +11 -4
  49. package/dist/chunk-5KSGZP3E.js.map +1 -0
  50. package/dist/{chunk-J45JCYS4.js → chunk-5M3S6DLV.js} +4 -4
  51. package/dist/{chunk-J45JCYS4.js.map → chunk-5M3S6DLV.js.map} +1 -1
  52. package/dist/{chunk-RZRJTCP2.js → chunk-5XYZNMMC.js} +4 -4
  53. package/dist/{chunk-RZRJTCP2.js.map → chunk-5XYZNMMC.js.map} +1 -1
  54. package/dist/{chunk-S47KU4YB.js → chunk-6NNXBXYI.js} +3 -3
  55. package/dist/{chunk-S47KU4YB.js.map → chunk-6NNXBXYI.js.map} +1 -1
  56. package/dist/{chunk-GZL6RN4Z.js → chunk-7FXOOUOC.js} +170 -50
  57. package/dist/chunk-7FXOOUOC.js.map +1 -0
  58. package/dist/{chunk-V5KG6CCV.js → chunk-7HRZACI4.js} +7 -2
  59. package/dist/chunk-7HRZACI4.js.map +1 -0
  60. package/dist/{chunk-U3FI4DVT.js → chunk-7K73MCI6.js} +7 -5
  61. package/dist/chunk-7K73MCI6.js.map +1 -0
  62. package/dist/{chunk-NDBHEOIA.js → chunk-7LJUK5JK.js} +9 -9
  63. package/dist/{chunk-NDBHEOIA.js.map → chunk-7LJUK5JK.js.map} +1 -1
  64. package/dist/{chunk-Q5SSRVD5.js → chunk-7O6SCI7B.js} +16 -14
  65. package/dist/chunk-7O6SCI7B.js.map +1 -0
  66. package/dist/{chunk-QBUJTVMY.js → chunk-7VBD5XUM.js} +4 -4
  67. package/dist/{chunk-QBUJTVMY.js.map → chunk-7VBD5XUM.js.map} +1 -1
  68. package/dist/{chunk-YEOG7CWQ.js → chunk-7ZL23M3X.js} +3 -3
  69. package/dist/{chunk-YEOG7CWQ.js.map → chunk-7ZL23M3X.js.map} +1 -1
  70. package/dist/{chunk-FZO64PLQ.js → chunk-BNLXZXZN.js} +81 -8
  71. package/dist/chunk-BNLXZXZN.js.map +1 -0
  72. package/dist/{chunk-LYVLDGML.js → chunk-CG63XGVV.js} +3 -3
  73. package/dist/{chunk-LYVLDGML.js.map → chunk-CG63XGVV.js.map} +1 -1
  74. package/dist/{chunk-PLVM6OIV.js → chunk-CH6UVEM5.js} +19 -15
  75. package/dist/chunk-CH6UVEM5.js.map +1 -0
  76. package/dist/{chunk-WEPTGUR4.js → chunk-CI4I34F4.js} +27 -56
  77. package/dist/chunk-CI4I34F4.js.map +1 -0
  78. package/dist/{chunk-4ROXSQEG.js → chunk-CJO3XKO7.js} +4 -4
  79. package/dist/{chunk-4ROXSQEG.js.map → chunk-CJO3XKO7.js.map} +1 -1
  80. package/dist/{chunk-RP3ML3QD.js → chunk-CLMIZ4N6.js} +3 -3
  81. package/dist/{chunk-RP3ML3QD.js.map → chunk-CLMIZ4N6.js.map} +1 -1
  82. package/dist/{chunk-OSABUEWA.js → chunk-CVUMZTNO.js} +4 -4
  83. package/dist/{chunk-OSABUEWA.js.map → chunk-CVUMZTNO.js.map} +1 -1
  84. package/dist/{chunk-X5SGUBUV.js → chunk-DKRD6CZL.js} +3 -3
  85. package/dist/{chunk-X5SGUBUV.js.map → chunk-DKRD6CZL.js.map} +1 -1
  86. package/dist/{chunk-5KWQMCH7.js → chunk-DRUAQ7IY.js} +6 -6
  87. package/dist/{chunk-5KWQMCH7.js.map → chunk-DRUAQ7IY.js.map} +1 -1
  88. package/dist/{chunk-GTAHU4N4.js → chunk-EB2LKPI6.js} +4 -4
  89. package/dist/{chunk-GTAHU4N4.js.map → chunk-EB2LKPI6.js.map} +1 -1
  90. package/dist/{chunk-3AIEJSQR.js → chunk-ESUF2ZYT.js} +3 -3
  91. package/dist/{chunk-3AIEJSQR.js.map → chunk-ESUF2ZYT.js.map} +1 -1
  92. package/dist/{chunk-ZUROGXJM.js → chunk-FECB7RI7.js} +14 -24
  93. package/dist/chunk-FECB7RI7.js.map +1 -0
  94. package/dist/{chunk-PBEDRYHP.js → chunk-FO2GU5L7.js} +230 -49
  95. package/dist/chunk-FO2GU5L7.js.map +1 -0
  96. package/dist/{chunk-SME3PK4L.js → chunk-FVOQPTK2.js} +8 -8
  97. package/dist/{chunk-SME3PK4L.js.map → chunk-FVOQPTK2.js.map} +1 -1
  98. package/dist/{chunk-MPO5CQUZ.js → chunk-GODUKPGD.js} +3 -3
  99. package/dist/{chunk-MPO5CQUZ.js.map → chunk-GODUKPGD.js.map} +1 -1
  100. package/dist/{chunk-FZTHL6SK.js → chunk-GQQIMKEP.js} +27 -33
  101. package/dist/chunk-GQQIMKEP.js.map +1 -0
  102. package/dist/{chunk-BRPEW3UL.js → chunk-GYRIO6RA.js} +3 -3
  103. package/dist/{chunk-BRPEW3UL.js.map → chunk-GYRIO6RA.js.map} +1 -1
  104. package/dist/{chunk-E675QKFG.js → chunk-HPQ2WDYC.js} +5 -5
  105. package/dist/{chunk-E675QKFG.js.map → chunk-HPQ2WDYC.js.map} +1 -1
  106. package/dist/{chunk-VEIWFS7Z.js → chunk-IIELRGIZ.js} +346 -89
  107. package/dist/chunk-IIELRGIZ.js.map +1 -0
  108. package/dist/{chunk-TUOHA6BM.js → chunk-IOXFT5D7.js} +3 -3
  109. package/dist/{chunk-TUOHA6BM.js.map → chunk-IOXFT5D7.js.map} +1 -1
  110. package/dist/{chunk-6PVRP3LW.js → chunk-IPCRQWNC.js} +17 -6
  111. package/dist/chunk-IPCRQWNC.js.map +1 -0
  112. package/dist/{chunk-PTJTOPE5.js → chunk-KOI7QFDH.js} +3 -3
  113. package/dist/{chunk-PTJTOPE5.js.map → chunk-KOI7QFDH.js.map} +1 -1
  114. package/dist/{chunk-EMSU6L7K.js → chunk-L74W5TVC.js} +7 -7
  115. package/dist/{chunk-EMSU6L7K.js.map → chunk-L74W5TVC.js.map} +1 -1
  116. package/dist/{chunk-WS3BOCAT.js → chunk-LCXQ4LVP.js} +16 -3
  117. package/dist/chunk-LCXQ4LVP.js.map +1 -0
  118. package/dist/{chunk-7QYBKUAS.js → chunk-LKBRBVVS.js} +3 -3
  119. package/dist/{chunk-7QYBKUAS.js.map → chunk-LKBRBVVS.js.map} +1 -1
  120. package/dist/{chunk-USSP43U3.js → chunk-LQWOU7S2.js} +3 -3
  121. package/dist/{chunk-USSP43U3.js.map → chunk-LQWOU7S2.js.map} +1 -1
  122. package/dist/chunk-LXD37LHF.js +688 -0
  123. package/dist/chunk-LXD37LHF.js.map +1 -0
  124. package/dist/{chunk-4KPQ6ILH.js → chunk-MEU2HHGV.js} +18 -9
  125. package/dist/chunk-MEU2HHGV.js.map +1 -0
  126. package/dist/{chunk-KVTV4LT2.js → chunk-MRTOKIEJ.js} +4 -4
  127. package/dist/{chunk-KVTV4LT2.js.map → chunk-MRTOKIEJ.js.map} +1 -1
  128. package/dist/{chunk-QC5BYUED.js → chunk-MS2IXLTC.js} +4 -4
  129. package/dist/{chunk-QC5BYUED.js.map → chunk-MS2IXLTC.js.map} +1 -1
  130. package/dist/{chunk-5J6N6LHL.js → chunk-PZS55HOX.js} +3 -3
  131. package/dist/{chunk-5J6N6LHL.js.map → chunk-PZS55HOX.js.map} +1 -1
  132. package/dist/{chunk-XDVR7QIT.js → chunk-QC4Q7PMQ.js} +6 -3
  133. package/dist/chunk-QC4Q7PMQ.js.map +1 -0
  134. package/dist/{chunk-IISEBVMA.js → chunk-RRKJHADP.js} +5 -5
  135. package/dist/{chunk-IISEBVMA.js.map → chunk-RRKJHADP.js.map} +1 -1
  136. package/dist/{chunk-MDCI4RSG.js → chunk-RZL4TOK3.js} +20 -6
  137. package/dist/chunk-RZL4TOK3.js.map +1 -0
  138. package/dist/{chunk-2UKNI2HJ.js → chunk-RZQCBFIU.js} +2 -2
  139. package/dist/{chunk-2UKNI2HJ.js.map → chunk-RZQCBFIU.js.map} +1 -1
  140. package/dist/{chunk-7TF5MNFK.js → chunk-S6NS3I3P.js} +2 -2
  141. package/dist/{chunk-7TF5MNFK.js.map → chunk-S6NS3I3P.js.map} +1 -1
  142. package/dist/{chunk-LMADWO4Q.js → chunk-SBAUZ7XH.js} +4 -4
  143. package/dist/{chunk-LMADWO4Q.js.map → chunk-SBAUZ7XH.js.map} +1 -1
  144. package/dist/{chunk-XB4XHGIE.js → chunk-SZ3XCZHC.js} +4 -4
  145. package/dist/{chunk-XB4XHGIE.js.map → chunk-SZ3XCZHC.js.map} +1 -1
  146. package/dist/{chunk-AQTAULXT.js → chunk-UHTCOYFJ.js} +111 -47
  147. package/dist/chunk-UHTCOYFJ.js.map +1 -0
  148. package/dist/{chunk-HQAPUPBE.js → chunk-V2VDTQ7A.js} +3 -3
  149. package/dist/{chunk-HQAPUPBE.js.map → chunk-V2VDTQ7A.js.map} +1 -1
  150. package/dist/{chunk-GNUA7XT2.js → chunk-VS6XC5JE.js} +3 -3
  151. package/dist/{chunk-GNUA7XT2.js.map → chunk-VS6XC5JE.js.map} +1 -1
  152. package/dist/chunk-WCHGUS7X.js +2443 -0
  153. package/dist/chunk-WCHGUS7X.js.map +1 -0
  154. package/dist/{chunk-5J6JWGY4.js → chunk-WDG5IVEA.js} +3 -3
  155. package/dist/{chunk-5J6JWGY4.js.map → chunk-WDG5IVEA.js.map} +1 -1
  156. package/dist/{chunk-QIV7H3GJ.js → chunk-WPTNYDDS.js} +5 -5
  157. package/dist/{chunk-QIV7H3GJ.js.map → chunk-WPTNYDDS.js.map} +1 -1
  158. package/dist/{chunk-BDAXHJC5.js → chunk-YPX7LQSW.js} +7 -7
  159. package/dist/{chunk-BDAXHJC5.js.map → chunk-YPX7LQSW.js.map} +1 -1
  160. package/dist/{chunk-UWD7YBDR.js → chunk-ZLDAPZIX.js} +4 -4
  161. package/dist/{chunk-UWD7YBDR.js.map → chunk-ZLDAPZIX.js.map} +1 -1
  162. package/dist/{chunk-YPTDPN2B.js → chunk-ZRKU7BRI.js} +3 -3
  163. package/dist/{chunk-YPTDPN2B.js.map → chunk-ZRKU7BRI.js.map} +1 -1
  164. package/dist/{claude-code-ILZ46SLO.js → claude-code-TDMSETH6.js} +5 -5
  165. package/dist/{claude-code-ILZ46SLO.js.map → claude-code-TDMSETH6.js.map} +1 -1
  166. package/dist/cli/index.js +327 -201
  167. package/dist/cli/index.js.map +1 -1
  168. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  169. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  170. package/dist/cli/src/commands/config.d.ts.map +1 -1
  171. package/dist/cli/src/commands/connector.d.ts.map +1 -1
  172. package/dist/cli/src/commands/harness-preflight.d.ts +3 -1
  173. package/dist/cli/src/commands/harness-preflight.d.ts.map +1 -1
  174. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  175. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  176. package/dist/cli/src/commands/library-index.d.ts +3 -3
  177. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  178. package/dist/cli/src/commands/migrate-files.d.ts +8 -0
  179. package/dist/cli/src/commands/migrate-files.d.ts.map +1 -1
  180. package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
  181. package/dist/cli/src/commands/migrate-providers.d.ts.map +1 -1
  182. package/dist/cli/src/commands/migrate.d.ts.map +1 -1
  183. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  184. package/dist/cli/src/commands/project.d.ts.map +1 -1
  185. package/dist/cli/src/commands/run.d.ts.map +1 -1
  186. package/dist/cli/src/commands/serve-preflight.d.ts +7 -5
  187. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  188. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  189. package/dist/cli/src/commands/source.d.ts.map +1 -1
  190. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  191. package/dist/cli/src/config-checks.d.ts +50 -12
  192. package/dist/cli/src/config-checks.d.ts.map +1 -1
  193. package/dist/cli/src/ensure-sources.d.ts.map +1 -1
  194. package/dist/cli/src/harness-error.d.ts +7 -0
  195. package/dist/cli/src/harness-error.d.ts.map +1 -1
  196. package/dist/cli/src/helpers.d.ts.map +1 -1
  197. package/dist/client/index.js +1 -1
  198. package/dist/client/src/client.d.ts +3 -0
  199. package/dist/client/src/client.d.ts.map +1 -1
  200. package/dist/connectors/config.js +5 -5
  201. package/dist/connectors/index.js +25 -24
  202. package/dist/connectors/src/index.d.ts +1 -1
  203. package/dist/connectors/src/index.d.ts.map +1 -1
  204. package/dist/connectors/src/managed-gitconfig.d.ts +12 -0
  205. package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
  206. package/dist/connectors-IUJRBTCW.js +52 -0
  207. package/dist/{connectors-KTRUUKWG.js.map → connectors-IUJRBTCW.js.map} +1 -1
  208. package/dist/connectors-shared/index.js +2 -2
  209. package/dist/core/index.js +7 -7
  210. package/dist/core/logging.js +1 -1
  211. package/dist/core/manifest.js +2 -2
  212. package/dist/core/models.js +1 -1
  213. package/dist/core/publish-manifest.js +3 -3
  214. package/dist/core/ref.js +1 -1
  215. package/dist/core/runtime-assets.js +5 -5
  216. package/dist/core/src/index.d.ts +2 -2
  217. package/dist/core/src/index.d.ts.map +1 -1
  218. package/dist/core/src/lock.d.ts +7 -1
  219. package/dist/core/src/lock.d.ts.map +1 -1
  220. package/dist/core/src/models.d.ts.map +1 -1
  221. package/dist/core/src/repo-manager.d.ts +28 -0
  222. package/dist/core/src/repo-manager.d.ts.map +1 -1
  223. package/dist/core/src/run-state-ignore.d.ts +5 -3
  224. package/dist/core/src/run-state-ignore.d.ts.map +1 -1
  225. package/dist/core/src/workspace-config.d.ts.map +1 -1
  226. package/dist/core/workspace-config.js +4 -4
  227. package/dist/deploy/index.js +7 -7
  228. package/dist/discovery/index.js +5 -5
  229. package/dist/{ensure-sources-5QWKUIUD.js → ensure-sources-Q2TTZVLX.js} +35 -33
  230. package/dist/ensure-sources-Q2TTZVLX.js.map +1 -0
  231. package/dist/factory-assets/connectors/box.js +25 -24
  232. package/dist/factory-assets/connectors/deploy.js +25 -24
  233. package/dist/factory-assets/connectors/devserver.js +25 -24
  234. package/dist/factory-assets/connectors/flow/adapter.js +25 -24
  235. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  236. package/dist/factory-assets/connectors/flow/run-flow.js +27 -26
  237. package/dist/factory-assets/connectors/flow.js +25 -24
  238. package/dist/factory-assets/connectors/git/exec.d.ts +7 -0
  239. package/dist/factory-assets/connectors/git/exec.d.ts.map +1 -1
  240. package/dist/factory-assets/connectors/git/repo.d.ts.map +1 -1
  241. package/dist/factory-assets/connectors/git.js +25 -24
  242. package/dist/factory-assets/connectors/gmail/adapter.d.ts.map +1 -1
  243. package/dist/factory-assets/connectors/gmail.js +25 -24
  244. package/dist/factory-assets/connectors/googledrive.js +25 -24
  245. package/dist/factory-assets/connectors/local.js +25 -24
  246. package/dist/factory-assets/connectors/mattermost.js +25 -24
  247. package/dist/factory-assets/connectors/memory.js +25 -24
  248. package/dist/factory-assets/connectors/minio/adapter.d.ts.map +1 -1
  249. package/dist/factory-assets/connectors/minio.js +25 -24
  250. package/dist/factory-assets/connectors/postgres/adapter.d.ts.map +1 -1
  251. package/dist/factory-assets/connectors/postgres.js +25 -24
  252. package/dist/factory-assets/connectors/s3/driver.d.ts.map +1 -1
  253. package/dist/factory-assets/connectors/s3.js +25 -24
  254. package/dist/factory-assets/connectors/sharepoint.js +25 -24
  255. package/dist/factory-assets/connectors/sqlite/adapter.d.ts.map +1 -1
  256. package/dist/factory-assets/connectors/sqlite.js +25 -24
  257. package/dist/factory-assets/connectors/static-server.js +25 -24
  258. package/dist/factory-assets/connectors/tunnel.js +25 -24
  259. package/dist/factory-assets/connectors/webdav.js +25 -24
  260. package/dist/factory-assets/connectors/xstate-store.js +25 -24
  261. package/dist/factory-assets/connectors/xstate.js +25 -24
  262. package/dist/{flows-UCP6ZUYS.js → flows-J64L5MGJ.js} +12 -12
  263. package/dist/{flows-UCP6ZUYS.js.map → flows-J64L5MGJ.js.map} +1 -1
  264. package/dist/{helpers-INS4B7OQ.js → helpers-S6AQGXRH.js} +32 -30
  265. package/dist/{helpers-INS4B7OQ.js.map → helpers-S6AQGXRH.js.map} +1 -1
  266. package/dist/library/index.js +11 -11
  267. package/dist/library/install.js +4 -4
  268. package/dist/library/src/index.d.ts +2 -2
  269. package/dist/library/src/index.d.ts.map +1 -1
  270. package/dist/library/src/library.d.ts +6 -2
  271. package/dist/library/src/library.d.ts.map +1 -1
  272. package/dist/library/src/local/db.d.ts.map +1 -1
  273. package/dist/library/src/local/library.d.ts +10 -3
  274. package/dist/library/src/local/library.d.ts.map +1 -1
  275. package/dist/library/src/local/local-catalog-source.d.ts +0 -9
  276. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  277. package/dist/library/src/local/schema.d.ts +27 -20
  278. package/dist/library/src/local/schema.d.ts.map +1 -1
  279. package/dist/library/src/manifest-writer.d.ts +13 -0
  280. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  281. package/dist/library/src/remote/index.d.ts +1 -1
  282. package/dist/library/src/remote/index.d.ts.map +1 -1
  283. package/dist/library/src/remote/remote-catalog-source.d.ts +6 -0
  284. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  285. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  286. package/dist/{library-publish-AZTYRASL.js → library-publish-7U4TJNQX.js} +54 -55
  287. package/dist/library-publish-7U4TJNQX.js.map +1 -0
  288. package/dist/model-endpoint/index.js +10 -10
  289. package/dist/open-library-K6O6OVW5.js +61 -0
  290. package/dist/{open-library-3HMXYGUF.js.map → open-library-K6O6OVW5.js.map} +1 -1
  291. package/dist/open-registry-4HNCWOCN.js +32 -0
  292. package/dist/{open-registry-BHBHQMBA.js.map → open-registry-4HNCWOCN.js.map} +1 -1
  293. package/dist/paths-PXBWY532.js +22 -0
  294. package/dist/{paths-77PXOXZY.js.map → paths-PXBWY532.js.map} +1 -1
  295. package/dist/{plugin-store-XQP2CRYH.js → plugin-store-ZC3EGZ3D.js} +10 -10
  296. package/dist/{plugin-store-XQP2CRYH.js.map → plugin-store-ZC3EGZ3D.js.map} +1 -1
  297. package/dist/project-ZWIZZIUT.js +88 -0
  298. package/dist/{project-HVNPK2ZF.js.map → project-ZWIZZIUT.js.map} +1 -1
  299. package/dist/resolver/index.js +8 -8
  300. package/dist/runner/index.js +40 -40
  301. package/dist/runner/src/serve.d.ts.map +1 -1
  302. package/dist/runner/src/turn-ids.d.ts +70 -0
  303. package/dist/runner/src/turn-ids.d.ts.map +1 -0
  304. package/dist/runner/src/turn-scheduler.d.ts +7 -0
  305. package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
  306. package/dist/sdk/asset-manager.js +15 -15
  307. package/dist/sdk/bridge.js +21 -20
  308. package/dist/sdk/client.js +1 -1
  309. package/dist/sdk/core.js +7 -7
  310. package/dist/sdk/flow.js +8 -8
  311. package/dist/sdk/index.js +41 -41
  312. package/dist/sdk/resolver.js +8 -8
  313. package/dist/sdk/runner.js +40 -40
  314. package/dist/sdk/session.js +2 -2
  315. package/dist/sdk/transport/ws/server.js +8 -8
  316. package/dist/sdk/transport/ws.js +8 -8
  317. package/dist/sdk/transport.js +8 -8
  318. package/dist/sdk/types.js +1 -1
  319. package/dist/serve-preflight-E3IEZTTF.js +59 -0
  320. package/dist/{serve-preflight-NHZOKHIC.js.map → serve-preflight-E3IEZTTF.js.map} +1 -1
  321. package/dist/session/index.js +2 -2
  322. package/dist/session/src/dispatcher.d.ts +4 -1
  323. package/dist/session/src/dispatcher.d.ts.map +1 -1
  324. package/dist/{setup-EX7Z7XRN.js → setup-V4EXOMVQ.js} +33 -31
  325. package/dist/setup-V4EXOMVQ.js.map +1 -0
  326. package/dist/{skills-DE2BDQ6G.js → skills-5D4KDVPJ.js} +13 -13
  327. package/dist/{skills-DE2BDQ6G.js.map → skills-5D4KDVPJ.js.map} +1 -1
  328. package/dist/source-O7XXDX55.js +89 -0
  329. package/dist/{source-URRPRGMZ.js.map → source-O7XXDX55.js.map} +1 -1
  330. package/dist/{source-manifest-publish-ZWRYRJ2U.js → source-manifest-publish-GUU4LX2S.js} +54 -53
  331. package/dist/source-manifest-publish-GUU4LX2S.js.map +1 -0
  332. package/dist/transport/index.js +8 -8
  333. package/dist/transport/src/ws/server.d.ts.map +1 -1
  334. package/dist/transport/ws/server.js +8 -8
  335. package/dist/transport/ws.js +8 -8
  336. package/dist/tui/index.js +40 -40
  337. package/dist/types/index.js +1 -1
  338. package/dist/types/manifests.js +1 -1
  339. package/dist/types/src/capabilities.d.ts +2 -1
  340. package/dist/types/src/capabilities.d.ts.map +1 -1
  341. package/dist/types/src/events.d.ts +2 -1
  342. package/dist/types/src/events.d.ts.map +1 -1
  343. package/dist/types/src/index.d.ts +2 -0
  344. package/dist/types/src/index.d.ts.map +1 -1
  345. package/dist/types/src/manifests/agent.d.ts +2 -0
  346. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  347. package/dist/types/src/protocol.d.ts +2 -0
  348. package/dist/types/src/protocol.d.ts.map +1 -1
  349. package/dist/types/src/turn-ids.d.ts +62 -0
  350. package/dist/types/src/turn-ids.d.ts.map +1 -0
  351. package/dist/types/src/version.d.ts +12 -1
  352. package/dist/types/src/version.d.ts.map +1 -1
  353. package/dist/workspace-plugin/adapters/mcp.js +32 -31
  354. package/dist/workspace-plugin/adapters/omp.js +14 -14
  355. package/dist/workspace-plugin/index.js +2 -2
  356. package/package.json +1 -1
  357. package/dist/chunk-4KPQ6ILH.js.map +0 -1
  358. package/dist/chunk-6PVRP3LW.js.map +0 -1
  359. package/dist/chunk-7NN3P6VF.js.map +0 -1
  360. package/dist/chunk-7UCPGQCW.js.map +0 -1
  361. package/dist/chunk-AQTAULXT.js.map +0 -1
  362. package/dist/chunk-BLBXOG5Q.js +0 -299
  363. package/dist/chunk-BLBXOG5Q.js.map +0 -1
  364. package/dist/chunk-C324IAXI.js +0 -160
  365. package/dist/chunk-C324IAXI.js.map +0 -1
  366. package/dist/chunk-DJSGQW2Q.js +0 -334
  367. package/dist/chunk-DJSGQW2Q.js.map +0 -1
  368. package/dist/chunk-FZO64PLQ.js.map +0 -1
  369. package/dist/chunk-FZTHL6SK.js.map +0 -1
  370. package/dist/chunk-GYPPVANR.js +0 -357
  371. package/dist/chunk-GYPPVANR.js.map +0 -1
  372. package/dist/chunk-GZL6RN4Z.js.map +0 -1
  373. package/dist/chunk-KNY356I3.js.map +0 -1
  374. package/dist/chunk-LOO5CB5M.js +0 -12
  375. package/dist/chunk-LOO5CB5M.js.map +0 -1
  376. package/dist/chunk-MDCI4RSG.js.map +0 -1
  377. package/dist/chunk-PBEDRYHP.js.map +0 -1
  378. package/dist/chunk-PLVM6OIV.js.map +0 -1
  379. package/dist/chunk-Q5SSRVD5.js.map +0 -1
  380. package/dist/chunk-U3FI4DVT.js.map +0 -1
  381. package/dist/chunk-V5KG6CCV.js.map +0 -1
  382. package/dist/chunk-VEIWFS7Z.js.map +0 -1
  383. package/dist/chunk-WEPTGUR4.js.map +0 -1
  384. package/dist/chunk-WS3BOCAT.js.map +0 -1
  385. package/dist/chunk-XDVR7QIT.js.map +0 -1
  386. package/dist/chunk-ZUROGXJM.js.map +0 -1
  387. package/dist/connectors-KTRUUKWG.js +0 -51
  388. package/dist/ensure-sources-5QWKUIUD.js.map +0 -1
  389. package/dist/library-publish-AZTYRASL.js.map +0 -1
  390. package/dist/open-library-3HMXYGUF.js +0 -59
  391. package/dist/open-registry-BHBHQMBA.js +0 -32
  392. package/dist/paths-77PXOXZY.js +0 -22
  393. package/dist/project-HVNPK2ZF.js +0 -89
  394. package/dist/serve-preflight-NHZOKHIC.js +0 -59
  395. package/dist/setup-EX7Z7XRN.js.map +0 -1
  396. package/dist/source-URRPRGMZ.js +0 -88
  397. package/dist/source-manifest-publish-ZWRYRJ2U.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/src/commands/validate.ts"],"names":["parseYaml","parsed","a","c"],"mappings":";;;;;;;;;;;;;;;;;;AAuFA,IAAM,+BAAoC,IAAI,GAAA,CAAI,CAAC,SAAA,EAAW,QAAA,EAAU,MAAM,CAAC,CAAA;AAE/E,IAAM,SAAA,uBAAgB,GAAA,CAAI;AAAA,EACxB,cAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA,GAAG;AACL,CAAC,CAAA;AAQD,SAAS,uBAAuB,QAAA,EAAuC;AACrE,EAAA,MAAM,aAAkC,EAAC;AAEzC,EAAA,SAAS,KAAK,GAAA,EAAmB;AAC/B,IAAA,IAAI,OAAA;AACJ,IAAA,IAAI;AACF,MAAA,OAAA,GAAU,GAAG,WAAA,CAAY,GAAA,EAAK,EAAE,aAAA,EAAe,MAAM,CAAA;AAAA,IACvD,CAAA,CAAA,MAAQ;AACN,MAAA;AAAA,IACF;AACA,IAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,IAAA,CAAK,GAAA,EAAK,MAAM,IAAI,CAAA;AAC1C,MAAA,IAAI,KAAA,CAAM,aAAY,EAAG;AACvB,QAAA,IAAI,CAAC,SAAA,CAAU,GAAA,CAAI,M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IAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,MAAA,MAAA,CAAO,CAAA,EAAG,KAAK,CAAA,sEAAA,CAAmE,CAAA;AAAA,IACpF;AAEA,IAAA,IAAI,MAAM,MAAA,GAAS,OAAA,CAAQ,SAAS,CAAA,EAAG,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EACvD,CAAC,CAAA;AAEH,EAAA,OAAO,GAAA;AACT","file":"chunk-CI4I34F4.js","sourcesContent":["/**\n * Validate asset versions, changelogs, and manifest schemas across asset repos.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n ASSET_NAME_HINT,\n decodeSkaileYaml,\n isValidAssetName,\n isValidPublisher,\n loadSkPublishManifest,\n parseAssetRef,\n SKAILE_MANIFEST_FILENAME,\n readAssetBody,\n} from \"@skaile/workspaces/core\";\nimport {\n flowSkillVersionPins,\n loadFlow,\n} from \"@skaile/workspaces/factory-assets/connectors/flow/engine\";\nimport { parseManifestFile } from \"@skaile/workspaces/discovery\";\nimport { withYamlQuotingHint } from \"@skaile/workspaces/core/manifest\";\nimport { isNonAssetPath } from \"@skaile/workspaces/core/publish-manifest\";\nimport {\n assertManifestEditable,\n missingRootAssets,\n scanUnlistedAssets,\n UNLISTED_SCAN_SKIP_DIRS,\n} from \"@skaile/workspaces/library\";\nimport type { IAssetKindRegistry } from \"@skaile/workspaces/plugins\";\nimport type { FlowVersionNode } from \"@skaile/workspaces/resolver\";\nimport { validateFlowVersions } from \"@skaile/workspaces/resolver\";\nimport { Command } from \"commander\";\nimport { parse as parseYaml } from \"yaml\";\nimport { type ComposeRefContext, composeRefContext } from \"../agent-checks.ts\";\nimport {\n connectorErrorLines,\n connectorMountPathChecks,\n unknownConnectorDriverErrors,\n unknownHarnessErrors,\n unknownKeyWarnings,\n} from \"../config-checks.ts\";\nimport { logErr, logInfo, logOk, logWarn } from \"../helpers.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport {\n checkAsset,\n checkAssetFile,\n DEFAULT_VERSION,\n declaredVersion,\n findEntryManifestFile,\n invalidSemverText,\n MANIFEST_GLOBS,\n manifestParseErrorText,\n} from \"../skill-checks.ts\";\nimport {\n manifestEntryNameProblems,\n invalidPublisherMessage,\n manifestFilesProblems,\n manifestPublisherProblems,\n manifestRootProblems,\n manifestRequiresProblems,\n readOnlyLibraryAt,\n registeredAssetKeys,\n rejectRemovedDomainOption,\n removedDomainOption,\n reportLibrarySymlinks,\n rootSkillExtraAssetProblems,\n unresolvedManifestDependencies,\n warnIgnoredDomainFiles,\n warnLegacyBundleFiles,\n} from \"./library-index.ts\";\nimport { assetEntryRef, manifestVersionMismatchMessage } from \"./publish-core.ts\";\nimport { checkAgentInstances } from \"./validate-instances.ts\";\n\n// ---------------------------------------------------------------------------\n// Manifest schema validation (skaile validate [path])\n// ---------------------------------------------------------------------------\n\n// The manifest file patterns live in skill-checks.ts (`MANIFEST_GLOBS`): `library index` names\n// the kind of a file it cannot parse with the same table.\n\n/**\n * `.claude`, `.codex` and `.omp` hold the copies `skaile add` deploys for the harnesses (and\n * the harness's own state): a project `validate .` checks what the author owns, not the\n * deployed bytes of an asset published elsewhere (p853).\n */\nconst HARNESS_DIRS: ReadonlySet<string> = new Set([\".claude\", \".codex\", \".omp\"]);\n/** Directories to skip during tree walk. */\nconst SKIP_DIRS = new Set([\n \"node_modules\",\n \"dist\",\n \".git\",\n \".skaile\",\n \"__pycache__\",\n ...HARNESS_DIRS,\n]);\n\ninterface ManifestCandidate {\n filePath: string;\n kind: string;\n}\n\n/** Recursively walk a directory tree and find manifest candidates. */\nfunction findManifestCandidates(rootPath: string): ManifestCandidate[] {\n const candidates: ManifestCandidate[] = [];\n\n function walk(dir: string): void {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) walk(fullPath);\n } else if (entry.isFile()) {\n for (const glob of MANIFEST_GLOBS) {\n if (glob.pattern.test(fullPath)) {\n candidates.push({ filePath: fullPath, kind: glob.kind });\n break;\n }\n }\n }\n }\n }\n\n walk(rootPath);\n return candidates;\n}\n\n/**\n * Parse a single manifest candidate's bytes with the indexer's own parser\n * (`parseManifestFile`), so a manifest `library index` cannot parse — an empty\n * `SKILL.md`, no frontmatter, invalid YAML — is an error here too. On failure\n * the error is already logged; count it.\n */\nfunction parseManifestCandidate(\n c: ManifestCandidate,\n absRoot: string,\n): { kind: \"value\"; parsed: unknown; body?: string } | { kind: \"error\" } {\n const content = fs.readFileSync(c.filePath, \"utf-8\");\n const res = parseManifestFile(c.filePath, content);\n if (!res.ok) {\n logErr(\n `${path.relative(absRoot, c.filePath)} [${c.kind}] — ${manifestParseErrorText(res.reason)}`,\n );\n return { kind: \"error\" };\n }\n return {\n kind: \"value\",\n parsed: res.data,\n body: readAssetBody(c.filePath, content),\n };\n}\n\n/**\n * The library root a validated path belongs to: the nearest directory at or above `absRoot`\n * that holds a `skaile.yaml`, else `absRoot` itself.\n */\nfunction libraryRootOf(absRoot: string): string {\n for (let dir = absRoot; ; dir = path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, SKAILE_MANIFEST_FILENAME))) return dir;\n if (path.dirname(dir) === dir) return absRoot;\n }\n}\n\n/**\n * Validate a single parsed manifest candidate against identity rules + the kind\n * registry. Returns the error/warning deltas this candidate contributes.\n */\nfunction validateManifestCandidate(\n c: ManifestCandidate,\n parsed: unknown,\n body: string | undefined,\n absRoot: string,\n registry: IAssetKindRegistry,\n strictConformance: boolean,\n composeRefs: ComposeRefContext,\n): { errors: number; warnings: number } {\n const relPath = path.relative(absRoot, c.filePath);\n let errors = 0;\n let warnings = 0;\n\n // The shared per-asset checks (also run by `library index` and the publish plan):\n // errors fail validate; advisories are warnings (exit code unchanged) unless\n // --strict-conformance escalates the agentskills.io conformance ones to errors.\n const dirName = path.basename(path.dirname(c.filePath)); // the manifest's folder\n const checked = checkAsset(\n c.kind,\n (parsed ?? {}) as Record<string, unknown>,\n body,\n dirName,\n registry,\n fs.readFileSync(c.filePath, \"utf-8\"),\n path.basename(c.filePath),\n { dir: path.dirname(c.filePath), libraryRoot: libraryRootOf(absRoot), composeRefs },\n );\n for (const f of checked.errors) {\n logErr(`${relPath} [${f.tag}] — ${f.text}`);\n errors++;\n }\n for (const f of checked.advisories) {\n const line = `${relPath} [${f.tag}] — ${f.text}`;\n // An untouched scaffold body is an error: a passing `validate` means the asset can be published.\n if ((f.conformance && strictConformance) || f.scaffoldBody) {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n warnings++;\n }\n }\n\n return { errors, warnings };\n}\n\n/**\n * The `kind:name` identity of every asset manifest under `root`, read quietly: a manifest\n * that does not parse holds no identity (its own validation reports the error).\n */\nexport function scanIdentities(root: string): Set<string> {\n const identities = new Set<string>();\n for (const c of findManifestCandidates(root)) {\n let parsed: unknown;\n try {\n const res = parseManifestFile(c.filePath, fs.readFileSync(c.filePath, \"utf-8\"));\n if (!res.ok) continue;\n parsed = res.data;\n } catch {\n continue;\n }\n if (parsed === null || typeof parsed !== \"object\") continue;\n const identity = (parsed as Record<string, unknown>)[c.kind === \"flow\" ? \"id\" : \"name\"];\n if (typeof identity === \"string\" && identity.length > 0)\n identities.add(`${c.kind}:${identity}`);\n }\n return identities;\n}\n\n/** Validate all manifest files in a directory tree using the kind registry. */\nexport function validateManifests(\n rootPath: string,\n strictConformance: boolean,\n registeredAssets: ReadonlySet<string> = new Set(),\n): { total: number; errors: number; warnings: number } {\n const absRoot = path.resolve(rootPath);\n if (!fs.existsSync(absRoot)) {\n logErr(`Path does not exist: ${absRoot}`);\n return { total: 0, errors: 1, warnings: 0 };\n }\n\n const registry: IAssetKindRegistry = getKindRegistry();\n const candidates = findManifestCandidates(absRoot);\n // Symlinks are refused with the text `library index` and the publish plan print (p520). In a\n // library (a `skaile.manifest.yaml` at the root) any symlink is refused, as `git add -A`\n // would publish it; elsewhere (a project) only those inside an asset folder or aliasing one.\n // A link elsewhere in a project is not refused: the connector real-path check judges a\n // `mountPath` link (p1332).\n const isLibrary = fs.existsSync(path.join(absRoot, SKAILE_MANIFEST_FILENAME));\n // A project's deployed harness folders (`add --link` makes `.claude/skills/x` a link to the\n // project's own `skills/x`) are not sources: they are skipped here as in the manifest walk.\n let errors = reportLibrarySymlinks(absRoot, {\n wholeTree: isLibrary,\n skipDirs: isLibrary ? undefined : HARNESS_DIRS,\n });\n let warnings = 0;\n\n // kind:name → directory of the first manifest seen; a second directory with the same\n // identity cannot be told apart by `add`/`publish` (and `library index` skips it).\n const seenIdentity = new Map<string, string>();\n // `composes:` refs resolve against the assets of the whole library (the scanned tree plus,\n // when `validate` got a sub-directory, its siblings under the enclosing library root) and the\n // registered libraries of its publisher: a ref no library holds fails `skaile add` (p415).\n const libraryRoot = libraryRootOf(absRoot);\n const composeRefs = composeRefContext(\n scanIdentities(libraryRoot),\n registeredAssets,\n loadSkPublishManifest(libraryRoot)?.publisher,\n );\n for (const c of candidates) {\n const parseResult = parseManifestCandidate(c, absRoot);\n if (parseResult.kind === \"error\") {\n errors++;\n continue;\n }\n\n const delta = validateManifestCandidate(\n c,\n parseResult.parsed,\n parseResult.body,\n absRoot,\n registry,\n strictConformance,\n composeRefs,\n );\n errors += delta.errors;\n warnings += delta.warnings;\n const obj = parseResult.parsed as Record<string, unknown> | null;\n const identity = obj && typeof obj === \"object\" ? obj[c.kind === \"flow\" ? \"id\" : \"name\"] : null;\n if (typeof identity === \"string\" && identity.length > 0) {\n const dir = path.dirname(c.filePath);\n const key = `${c.kind}:${identity}`;\n const first = seenIdentity.get(key);\n if (first === undefined) {\n seenIdentity.set(key, dir);\n } else if (first !== dir) {\n logErr(\n `${path.relative(absRoot, c.filePath)} [${c.kind}] — ${key} is also defined in ${path.relative(absRoot, first) || \".\"}; ` +\n \"two directories cannot share a kind and name (`skaile library index` keeps only the first).\",\n );\n errors++;\n }\n }\n }\n\n return { total: candidates.length, errors, warnings };\n}\n\n/** Recursively find every `skaile.yaml` / `*.skaile.yaml` workspace manifest. */\nfunction findWorkspaceManifests(rootPath: string): string[] {\n const out: string[] = [];\n function walk(dir: string): void {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) walk(full);\n } else if (entry.isFile() && /(^|\\.)skaile\\.yaml$/.test(entry.name)) {\n out.push(full);\n }\n }\n }\n walk(rootPath);\n return out;\n}\n\n/**\n * Validate the dependency refs and asset identities declared in every\n * `skaile.yaml` under a tree. This is the manifest-level mirror of the\n * per-file identity check: it parses each `dependencies[]` /\n * `overrides[].ref` through `parseAssetRef` (the exact code path that produced\n * the original \"publisher required …\" / \"invalid asset name …\" hard error) and\n * checks each `assets[].name` against the canonical name grammar.\n */\n/**\n * Collect every `[field, ref]` pair to validate from a workspace manifest:\n * each string in `dependencies[]` and each `overrides[].ref`.\n */\nfunction collectWorkspaceRefFields(parsed: Record<string, unknown>): Array<[string, string]> {\n const refFields: Array<[string, string]> = [];\n if (Array.isArray(parsed.dependencies)) {\n for (const d of parsed.dependencies) {\n if (typeof d === \"string\") refFields.push([\"dependencies\", d]);\n }\n }\n if (Array.isArray(parsed.overrides)) {\n for (const o of parsed.overrides) {\n const ref = (o as Record<string, unknown>)?.ref;\n if (typeof ref === \"string\") refFields.push([\"overrides.ref\", ref]);\n }\n }\n return refFields;\n}\n\n/** Parse each declared ref through `parseAssetRef`; returns the error count. */\nfunction validateWorkspaceRefs(refFields: Array<[string, string]>, relPath: string): number {\n let errors = 0;\n for (const [field, ref] of refFields) {\n try {\n const parsedRef = parseAssetRef(ref);\n // The library-side slug rule (`library index`, the publish plan) holds for a project's\n // `dependencies:` too: `add` cannot resolve such a ref, so `check` fails on it (p1080).\n const publisher = parsedRef.publisher?.replace(/^@/, \"\");\n if (publisher !== undefined && !isValidPublisher(publisher)) {\n logErr(`${relPath} [${field}] — ${ref}: ${invalidPublisherMessage(publisher)}`);\n errors++;\n }\n } catch (e) {\n logErr(`${relPath} [${field}] — ${e instanceof Error ? e.message : String(e)}`);\n errors++;\n }\n }\n return errors;\n}\n\n/** Validate `assets[].name` against the canonical name/ref grammar. */\nfunction validateWorkspaceAssets(parsed: Record<string, unknown>, relPath: string): number {\n if (!Array.isArray(parsed.assets)) return 0;\n let errors = 0;\n const topPublisher = typeof parsed.publisher === \"string\" ? parsed.publisher : undefined;\n for (const a of parsed.assets) {\n const asset = a as Record<string, unknown>;\n const name = asset?.name;\n const kind = typeof asset?.kind === \"string\" ? asset.kind : \"skill\";\n if (typeof name !== \"string\" || name.length === 0) continue;\n const publisher = typeof asset?.publisher === \"string\" ? asset.publisher : topPublisher;\n if (publisher !== undefined) {\n try {\n parseAssetRef(`${kind}:@${publisher}/${name}`);\n } catch (e) {\n logErr(`${relPath} [assets] — ${e instanceof Error ? e.message : String(e)}`);\n errors++;\n }\n } else if (!isValidAssetName(name)) {\n logErr(`${relPath} [assets] — invalid asset name \"${name}\" — ${ASSET_NAME_HINT}`);\n errors++;\n }\n }\n return errors;\n}\n\nasync function validateWorkspaceManifests(rootPath: string): Promise<{\n total: number;\n errors: number;\n}> {\n const absRoot = path.resolve(rootPath);\n const files = findWorkspaceManifests(absRoot);\n let errors = 0;\n\n for (const file of files) {\n const relPath = path.relative(absRoot, file);\n let parsed: Record<string, unknown>;\n let text = \"\";\n try {\n text = fs.readFileSync(file, \"utf-8\");\n parsed = (parseYaml(text) ?? {}) as Record<string, unknown>;\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n logErr(`${relPath} — parse error: ${withYamlQuotingHint(message, text)}`);\n errors++;\n continue;\n }\n // A root that is no mapping, or a `dependencies:`/`sources:` of the wrong shape, is one\n // parse-error line, as `check` prints it (p1421, p1620).\n const unreadable = decodeSkaileYaml(text).diagnostics.find(\n (d) => d.code === \"non_object_root\" || d.code === \"invalid_value_shape\",\n );\n if (unreadable) {\n logErr(`${relPath} — parse error: ${unreadable.message}`);\n errors++;\n continue;\n }\n\n errors += validateWorkspaceRefs(collectWorkspaceRefFields(parsed), relPath);\n errors += validateWorkspaceAssets(parsed, relPath);\n for (const d of checkAgentInstances(path.dirname(file), parsed)) {\n const line = `${relPath} [agents] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${d.message}`;\n if (d.severity === \"error\") {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n }\n }\n // A connector the runner cannot mount or mounts wrongly: no `driver` (or the old `adapter`\n // spelling), no `id`, a duplicate `id`, an `access` that is neither read-only nor read-write.\n const decoded = decodeSkaileYaml(fs.readFileSync(file, \"utf-8\"));\n for (const line of connectorErrorLines(decoded.diagnostics, relPath)) {\n logErr(line);\n errors++;\n }\n // A `sources:` item with no url or a non-string publisher: `check`, `doctor` and `add` stop\n // on it, so `validate` must not call the file valid (p1620).\n for (const d of decoded.diagnostics) {\n if (d.code !== \"invalid_source_entry\") continue;\n logErr(`${relPath} — parse error: ${d.message}`);\n errors++;\n }\n // A key skaile.yaml no longer accepts (a legacy `provider:`): every command that reads the\n // file stops on it, so `validate` must not call the file valid (p1352).\n for (const d of decoded.diagnostics) {\n if (d.code !== \"legacy_key_rejected\") continue;\n logErr(relPath === \"skaile.yaml\" ? d.message : `${relPath} — ${d.message}`);\n errors++;\n }\n // The 5.x `driver` key of an agent-config profile: still read as `harness` until 7.0\n // (warning); setting both keys is an error. The retired `agent` key is ignored (warning).\n for (const d of decoded.diagnostics) {\n if (\n ![\"deprecated_harness_key\", \"retired_agent_key\", \"harness_key_conflict\"].includes(d.code)\n ) {\n continue;\n }\n const line = `${relPath} [agent-config] — ${d.code}: ${d.message}`;\n if (d.severity === \"error\") {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n }\n }\n // A mistyped key warns (p1474); a `harness:` no harness registers, plugins included, fails (p1022).\n for (const line of unknownKeyWarnings(decoded.diagnostics, relPath)) logWarn(line);\n for (const line of await unknownHarnessErrors(path.dirname(file), decoded.config, relPath)) {\n logErr(line);\n errors++;\n }\n const mountChecks = connectorMountPathChecks(\n path.dirname(file),\n relPath,\n decoded.config?.connectors ?? [],\n );\n for (const line of mountChecks.errors) {\n logErr(line);\n errors++;\n }\n for (const line of mountChecks.warnings) logWarn(line);\n // A `driver` no catalog entry provides: `serve` cannot mount it either, and stops on the\n // same line.\n for (const line of await unknownConnectorDriverErrors(\n path.dirname(file),\n relPath,\n decoded.config?.connectors ?? [],\n )) {\n logErr(line);\n errors++;\n }\n }\n\n return { total: files.length, errors };\n}\n\n/**\n * Check the library's publication manifest (`skaile.manifest.yaml` at the\n * validated root): every first-party `root:` must still exist. An entry whose\n * directory was deleted would otherwise stay publishable; the fix is\n * `skaile library index <lib>`, which drops it. A reader or source clone refuses `library index`:\n * its owner pushes the folder (or drops the entry), then the clone is refreshed.\n */\nasync function validatePublishManifestRoots(rootPath: string): Promise<number> {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest) return 0;\n // A library that is itself one skill holds that one asset (p2142).\n const extra = rootSkillExtraAssetProblems(absRoot);\n for (const message of extra) logErr(message);\n const missing = missingRootAssets(absRoot, manifest);\n const readOnly = missing.length > 0 ? await readOnlyLibraryAt(absRoot) : undefined;\n for (const a of missing) {\n logErr(\n `${SKAILE_MANIFEST_FILENAME} [assets] — ${assetEntryRef(a, manifest)}: root \"${a.root}\" does not exist. ` +\n (readOnly\n ? `\"${readOnly.name}\" is a read-only clone: ask the owner to push ${a.root}/ or drop the entry from ${SKAILE_MANIFEST_FILENAME}, then run \\`${readOnly.refresh}\\`.`\n : \"Run `skaile library index <library>` to drop the entry, or restore the directory.\"),\n );\n }\n return missing.length + extra.length;\n}\n\n/**\n * An asset directory the library's manifest does not list is an error: `add` refuses it (`not\n * listed in its skaile.manifest.yaml`), the publish plan does not ship it, yet `git add -A`\n * commits its files. The fix is `skaile library index <lib>`, which lists it (p1193). A directory\n * that holds a kind + name the manifest already names elsewhere is the duplicate check's finding.\n * An asset that already fails its own check is not listed here: `library index` refuses it, so\n * \"run `library index`\" would send the author round in a circle; the check line names the real\n * fix (p871).\n */\nasync function validatePublishManifestUnlisted(rootPath: string): Promise<number> {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest) return 0;\n const registry = getKindRegistry();\n const libraryRoot = libraryRootOf(absRoot);\n const composeRefs = composeRefContext(\n scanIdentities(libraryRoot),\n await registeredAssetKeys(libraryRoot),\n manifest.publisher,\n );\n const unlisted = (\n await scanUnlistedAssets(\n absRoot,\n manifest.publisher ?? path.basename(absRoot),\n registry,\n UNLISTED_SCAN_SKIP_DIRS,\n )\n ).filter(\n (u) =>\n !u.registeredAt &&\n !u.parseFailure && // a file that does not parse has its own parse error\n checkAssetFile(u.entry.source, u.entry.kind, registry, absRoot, composeRefs).length === 0,\n );\n for (const u of unlisted) {\n logErr(\n `${path.relative(absRoot, u.entry.source)} [${u.entry.kind}] — ${u.entry.kind}:${u.entry.name} is on disk but not in ${SKAILE_MANIFEST_FILENAME}, so it is not published. ` +\n \"Run `skaile library index <library>` to list it, or delete the directory.\",\n );\n }\n return unlisted.length;\n}\n\n/**\n * Check every `assets[].dependencies` entry of the publication manifest with the\n * same syntax rule (and message) `library index` applies, so a malformed ref\n * fails `validate` instead of being silently dropped by the manifest decoder.\n */\nfunction validatePublishManifestRequires(rootPath: string): number {\n const problems = manifestRequiresProblems(path.resolve(rootPath));\n for (const p of problems) {\n logErr(\n `${SKAILE_MANIFEST_FILENAME} [assets] — ${p.asset}: ${p.message}. ` +\n \"Use the `kind:@<publisher>/name[#version]` form.\",\n );\n }\n return problems.length;\n}\n\n/**\n * Check the publisher of the publication manifest (top-level and every\n * `assets[].publisher`) against the one publisher slug rule `library create`, `library\n * index` and the publish plan apply, with the same message.\n */\nfunction validatePublishManifestPublisherSlugs(rootPath: string): number {\n const problems = manifestPublisherProblems(path.resolve(rootPath));\n for (const message of problems) logErr(message);\n return problems.length;\n}\n\n/**\n * Check every first-party `assets[].root` and `files:` entry of the publication manifest stays\n * inside the library and crosses no symlink ({@link manifestRootProblems},\n * {@link manifestFilesProblems}), the refusal `library index` and the publish plan print too: a\n * path outside the library is never found by `add` (p701, p1403), a missing file is no asset (p1404).\n */\nfunction validatePublishManifestRootPaths(rootPath: string): number {\n const problems = [\n ...manifestRootProblems(path.resolve(rootPath)),\n ...manifestFilesProblems(path.resolve(rootPath)),\n ...manifestEntryNameProblems(path.resolve(rootPath)),\n ];\n for (const message of problems) logErr(message);\n return problems.length;\n}\n\n/**\n * Parse the publication manifest the way `library index` and `library publish` open it, so a\n * `skaile.manifest.yaml` that does not parse fails `validate` too, with the file and line.\n * Without the file there is nothing to check.\n */\nfunction validatePublishManifestParses(rootPath: string): number {\n try {\n assertManifestEditable(path.resolve(rootPath));\n return 0;\n } catch (err) {\n logErr(err instanceof Error ? err.message : String(err));\n return 1;\n }\n}\n\n/**\n * Warn when a first-party `assets[].version` of the publication manifest differs\n * from the version in the asset's own manifest file. The file is the source of\n * truth — `skaile library index` rewrites the entry from it — so a hand-edited\n * manifest version is silently overwritten by the next index. Returns the warning count.\n */\nfunction validatePublishManifestVersions(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest || manifest.source) return 0;\n let warnings = 0;\n for (const a of manifest.assets ?? []) {\n if (a.source || !a.version) continue;\n const file = findEntryManifestFile(absRoot, a);\n if (!file) continue;\n const res = parseManifestFile(file, fs.readFileSync(file, \"utf-8\"));\n if (!res.ok) continue; // reported by the per-file parse check\n const fileVersion = declaredVersion(res.data);\n if (fileVersion === undefined || fileVersion === a.version) continue;\n // A file version that is no semver is reported by the per-file check; it is no version to compare.\n if (invalidSemverText(fileVersion) !== undefined) continue;\n logWarn(\n manifestVersionMismatchMessage(\n assetEntryRef(a, manifest),\n a.version,\n toPosix(path.relative(absRoot, file)),\n fileVersion,\n ),\n );\n warnings++;\n }\n return warnings;\n}\n\n/**\n * Warn when a first-party asset file still carries a `metadata.publisher` that\n * differs from the publisher the manifest resolves for it (`assets[].publisher`,\n * else the top-level `publisher`). The manifest is the only source of an\n * asset's publisher; the file value is ignored by every resolver, so a stale\n * one only misleads the reader. Returns the warning count.\n */\nfunction validatePublishManifestPublishers(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest || manifest.source) return 0;\n const bare = (p: string) => p.trim().replace(/^@/, \"\");\n let warnings = 0;\n for (const a of manifest.assets ?? []) {\n const resolved = a.publisher ?? manifest.publisher;\n if (a.source || !resolved) continue;\n const file = findEntryManifestFile(absRoot, a);\n if (!file) continue;\n const res = parseManifestFile(file, fs.readFileSync(file, \"utf-8\"));\n if (!res.ok) continue; // reported by the per-file parse check\n const meta = (res.data as Record<string, unknown>).metadata;\n const declared =\n meta !== null && typeof meta === \"object\"\n ? (meta as Record<string, unknown>).publisher\n : null;\n if (typeof declared !== \"string\" || bare(declared) === bare(resolved)) continue;\n logWarn(\n `${toPosix(path.relative(absRoot, file))} [publisher] — metadata.publisher \"${bare(declared)}\" differs from ` +\n `the manifest publisher \"${bare(resolved)}\" for ${assetEntryRef(a, manifest)}. The manifest wins and the ` +\n \"file value is ignored: delete `metadata.publisher` from the file, or set the publisher in \" +\n `${SKAILE_MANIFEST_FILENAME}.`,\n );\n warnings++;\n }\n return warnings;\n}\n\n/** Root-relative path prefixes excluded from version/changelog checks. */\nconst EXCLUDED_PATHS = [\"skaileup-shared/\", \"external/\", \"docs/\"];\n\n/** Normalise to forward slashes so prefix and set comparisons work on any OS. */\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** True when a root-relative path sits under one of {@link EXCLUDED_PATHS}. */\nfunction isExcludedPath(relPath: string): boolean {\n const rel = toPosix(relPath);\n return EXCLUDED_PATHS.some((prefix) => rel.startsWith(prefix));\n}\n\ninterface AssetVersion {\n kind: \"skill\" | \"agent\" | \"flow\" | \"prompt\" | \"preset\" | \"contract\";\n name: string;\n version: string;\n filePath: string;\n}\n\n/** Manifest candidates whose kind carries a version `validate versions` checks. */\nconst VERSIONED_KINDS: Record<string, true> = {\n skill: true,\n agent: true,\n flow: true,\n prompt: true,\n preset: true,\n contract: true,\n};\n\n/**\n * Read one manifest candidate's identity and version. A manifest without a `version` reads as\n * {@link DEFAULT_VERSION}, as `validate`, `library index` and `add` read it (p1858); an unreadable\n * file has no version.\n */\nfunction readAssetVersion(c: ManifestCandidate): AssetVersion {\n const kind = c.kind as AssetVersion[\"kind\"];\n const fileName = path.basename(c.filePath);\n const dirName = path.basename(path.dirname(c.filePath));\n const content = fs.readFileSync(c.filePath, \"utf-8\");\n if (c.filePath.endsWith(\".md\")) {\n // The version `library index` records (top-level `version`, else `metadata.version`).\n const res = parseManifestFile(c.filePath, content);\n const data = res.ok ? (res.data as Record<string, unknown>) : {};\n const stem = fileName.replace(/\\.prompt\\.md$/, \"\");\n return {\n kind,\n name: typeof data.name === \"string\" ? data.name : kind === \"prompt\" ? stem : dirName,\n version: res.ok ? (declaredVersion(data) ?? DEFAULT_VERSION) : \"\",\n filePath: c.filePath,\n };\n }\n let parsed: Record<string, unknown> | null = null;\n try {\n parsed = parseYaml(content);\n } catch {\n // Reported by the default `skaile validate`; here the asset just has no readable version.\n }\n const version = parsed ? String(parsed.version ?? DEFAULT_VERSION) : \"\";\n if (kind === \"flow\") {\n return {\n kind,\n name: String(parsed?.id ?? fileName.replace(\".flow.yaml\", \"\")),\n version,\n filePath: c.filePath,\n };\n }\n return {\n kind,\n name: String(parsed?.name ?? dirName),\n version,\n filePath: c.filePath,\n };\n}\n\n/**\n * Walk `root` at any depth and collect the version of every skill, agent, flow, prompt,\n * preset and contract — the same tree walk the default `validate` uses, so a library laid out\n * as `<root>/<asset>/SKILL.md` is covered as well as `skills/<asset>/SKILL.md`.\n */\nfunction collectAssetVersions(root: string): AssetVersion[] {\n if (!fs.existsSync(root)) return [];\n const assets: AssetVersion[] = [];\n for (const c of findManifestCandidates(root)) {\n if (!VERSIONED_KINDS[c.kind]) continue;\n // Only the YAML flow form and `agent.yaml` / `AGENT.md` carry a readable version here.\n if (c.filePath.endsWith(\".flow.json\")) continue;\n if (isExcludedPath(path.relative(root, c.filePath))) continue;\n assets.push(readAssetVersion(c));\n }\n return assets;\n}\n\n/** Root-relative posix location of an asset file, for messages. */\nfunction assetLocation(a: AssetVersion, root: string): string {\n return toPosix(path.relative(root, a.filePath));\n}\n\n/**\n * Nearest ancestor directory of `assetRelPath` (root-relative, posix) that\n * holds a `CHANGELOG.md`, walking up from the asset's own directory to and\n * including `root`, never above it. Returns the changelog's root-relative\n * path, or `null` when no ancestor has one.\n */\nfunction findChangelogUnit(assetRelPath: string, root: string): string | null {\n let dir = path.posix.dirname(toPosix(assetRelPath));\n for (;;) {\n const candidate = dir === \".\" ? \"CHANGELOG.md\" : `${dir}/CHANGELOG.md`;\n if (fs.existsSync(path.join(root, candidate))) return candidate;\n if (dir === \".\") return null;\n dir = path.posix.dirname(dir);\n }\n}\n\n/** Outcome of {@link checkChangelogUnits}. All paths are root-relative posix. */\nexport interface ChangelogCheck {\n /** Changelog units whose `CHANGELOG.md` is among the modified files. */\n updated: string[];\n /** Changelog units covering a modified asset whose `CHANGELOG.md` is not modified. */\n stale: string[];\n /** Modified assets with no `CHANGELOG.md` in any ancestor up to the root. */\n orphans: string[];\n}\n\n/**\n * Group the modified asset files by their nearest-ancestor `CHANGELOG.md` and\n * report which units were updated alongside them. Assets under\n * {@link EXCLUDED_PATHS} are ignored.\n *\n * @param modifiedFiles - Changed paths relative to `root`.\n * @param root - The asset root (`ai-assets/`); the walk up never leaves it.\n */\nexport function checkChangelogUnits(modifiedFiles: string[], root: string): ChangelogCheck {\n const modified = new Set(modifiedFiles.map(toPosix));\n const assetPattern = /(SKILL\\.md|agent\\.yaml|\\.flow\\.yaml|\\.prompt\\.md)$/;\n const units = new Set<string>();\n const orphans: string[] = [];\n for (const f of modified) {\n if (!assetPattern.test(f) || isExcludedPath(f)) continue;\n const unit = findChangelogUnit(f, root);\n if (unit) units.add(unit);\n else orphans.push(f);\n }\n const updated = [...units].filter((u) => modified.has(u));\n const stale = [...units].filter((u) => !modified.has(u));\n return { updated, stale, orphans };\n}\n\n/** Extract version from file content using proper YAML parsing */\nfunction extractVersionFromContent(filePath: string, content: string): string | null {\n if (filePath.endsWith(\".yaml\")) {\n const parsed = parseYaml(content);\n return parsed?.version ?? null;\n }\n // SKILL.md / .prompt.md — YAML frontmatter\n const fmMatch = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!fmMatch) return null;\n const parsed = parseYaml(fmMatch[1]);\n return parsed?.metadata?.version ?? parsed?.version ?? null;\n}\n\n/** Check every asset has a present + semver-valid version. */\nfunction checkAssetVersions(\n assets: AssetVersion[],\n root: string,\n): { errors: number; warnings: number } {\n let errors = 0;\n const warnings = 0;\n for (const a of assets) {\n const location = assetLocation(a, root);\n if (!a.version) {\n logErr(`${a.kind}:${a.name} (${location}) — missing version`);\n errors++;\n continue;\n }\n const invalid = invalidSemverText(a.version);\n if (invalid) {\n logErr(`${a.kind}:${a.name} (${location}) — ${invalid}`);\n errors++;\n }\n }\n return { errors, warnings };\n}\n\n/** In --changed-only mode, warn when a changed asset's version was not bumped. */\nfunction checkVersionBumps(\n assets: AssetVersion[],\n root: string,\n changedByAsset: ReadonlyMap<AssetVersion, readonly string[]>,\n): number {\n let warnings = 0;\n for (const a of assets) {\n if (!a.version) continue; // already flagged above\n // `HEAD:./<path>` is relative to `root` (the cwd), not the repository top level.\n const relPath = toPosix(path.relative(root, a.filePath));\n try {\n const headContent = execFileSync(\"git\", [\"show\", `HEAD:./${relPath}`], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const headVersion = extractVersionFromContent(a.filePath, headContent);\n if (headVersion && headVersion === a.version) {\n logWarn(\n `${a.kind}:${a.name} (${assetLocation(a, root)}) — file changed but version not bumped (${a.version}); ${changedClause(changedByAsset.get(a) ?? [])}`,\n );\n warnings++;\n }\n } catch {\n // New file (no HEAD version) — that's fine\n }\n }\n return warnings;\n}\n\n/**\n * Validate flow node skill-version pins against the discovered skill versions.\n *\n * Flows are read through `loadFlow`, which normalizes legacy v1 documents into\n * the strict v2 shape — reading the authored YAML directly would miss every v2\n * pin, since those ride in `run.assets` rather than `node.data.version`.\n */\nfunction checkFlowVersionPins(\n assets: AssetVersion[],\n root: string,\n): { errors: number; warnings: number } {\n const flows = assets.filter((a) => a.kind === \"flow\");\n const skillVersionMap = new Map<string, string>();\n for (const a of assets.filter((a) => a.kind === \"skill\")) {\n skillVersionMap.set(a.name, a.version);\n }\n\n let errors = 0;\n let warnings = 0;\n for (const f of flows) {\n let pins: FlowVersionNode[];\n try {\n pins = flowSkillVersionPins(loadFlow(f.filePath));\n } catch (err) {\n // An unreadable flow is a gap in the check, not an absence of findings.\n // Report the path, not `f.name`: that id comes from a raw-YAML read that\n // falls back to the filename stem exactly when the file is unusable.\n logWarn(\n `flow:${f.name} (${path.relative(root, f.filePath)}) — could not be read: ` +\n `${err instanceof Error ? err.message : err}`,\n );\n warnings++;\n continue;\n }\n\n if (pins.length === 0) continue;\n const checks = validateFlowVersions(pins, skillVersionMap);\n for (const c of checks.filter((c) => !c.satisfied)) {\n logErr(\n `flow:${f.name} node ${c.nodeId} — wants ${c.requested}, found ${c.actual || \"(none)\"}`,\n );\n errors++;\n }\n }\n return { errors, warnings };\n}\n\n/**\n * Root of a `validate versions` / `validate changelog` run: the explicit `[path]`, else the\n * library the shell is in (the nearest directory at or above the cwd that holds\n * `skaile.manifest.yaml`), else the cwd itself, as plain `validate` reads it. The bundled\n * factory assets are never a default (p1194). Returns `null` after printing an error when\n * the path does not exist, or when the root holds no library (see {@link isCheckableRoot}).\n */\nfunction resolveCheckRoot(pathArg: string | undefined): string | null {\n let root = process.cwd();\n if (pathArg) {\n root = path.resolve(pathArg);\n if (!fs.existsSync(root)) {\n logErr(`Path does not exist: ${root}`);\n return null;\n }\n } else {\n for (let dir = root; ; dir = path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, SKAILE_MANIFEST_FILENAME))) {\n root = dir;\n break;\n }\n if (path.dirname(dir) === dir) break;\n }\n }\n if (!isCheckableRoot(root)) {\n logErr(\n `Nothing to check in ${root}: no ${SKAILE_MANIFEST_FILENAME} and no versioned asset (skill, agent, flow, prompt, contract or preset) found. Run it in a library or pass the library directory.`,\n );\n return null;\n }\n return root;\n}\n\n/** Whether `root` is a library: it holds a library manifest or at least one versioned asset. */\nfunction isCheckableRoot(root: string): boolean {\n return (\n fs.existsSync(path.join(root, SKAILE_MANIFEST_FILENAME)) ||\n collectAssetVersions(root).length > 0\n );\n}\n\n/** `true` when `root` lies inside a git work tree. */\nfunction isInGitWorkTree(root: string): boolean {\n try {\n return (\n execFileSync(\"git\", [\"rev-parse\", \"--is-inside-work-tree\"], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim() === \"true\"\n );\n } catch {\n return false;\n }\n}\n\n/** `true` when the git work tree at `root` has at least one commit (`HEAD` resolves). */\nfunction hasCommit(root: string): boolean {\n try {\n execFileSync(\"git\", [\"rev-parse\", \"--verify\", \"--quiet\", \"HEAD\"], {\n cwd: root,\n stdio: [\"ignore\", \"ignore\", \"ignore\"],\n });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Run `git diff --name-only --relative <ref>` in `root` and return the changed paths\n * (relative to `root`), plus — with `untracked` — the new files git does not track yet.\n * No git work tree prints `<what> needs a git repository`; any other git failure — a bad\n * ref, no `git` — prints one `git diff failed in <root>: <first stderr line>` line. Both\n * return `null`; git's own usage text never reaches the terminal.\n *\n * @param what The command that needs git, for the message (`--changed-only`, `changelog`).\n */\nfunction changedFiles(\n root: string,\n ref: string,\n what: string,\n opts: { untracked?: boolean } = {},\n): string[] | null {\n if (!isInGitWorkTree(root)) {\n logErr(`${what} needs a git repository: ${root} is not inside a git work tree.`);\n return null;\n }\n if (ref === \"HEAD\" && !hasCommit(root)) {\n logErr(\n `${what} compares with the last commit, and ${root} has no commit yet. Commit the library first (\\`skaile library commit <name>\\`), then run it again.`,\n );\n return null;\n }\n try {\n const out = execFileSync(\n \"git\",\n [\"diff\", \"--name-only\", \"--relative\", \"--end-of-options\", ref],\n {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n const changed = out.trim().split(\"\\n\").filter(Boolean);\n if (opts.untracked) {\n // New files git does not track yet (`--others` paths are relative to `root`).\n const fresh = execFileSync(\"git\", [\"ls-files\", \"--others\", \"--exclude-standard\"], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n changed.push(...fresh.trim().split(\"\\n\").filter(Boolean));\n }\n return changed;\n } catch (err) {\n const stderr = err instanceof Error && \"stderr\" in err ? String(err.stderr).trim() : \"\";\n const reason = (stderr || (err instanceof Error ? err.message : String(err))).split(\"\\n\")[0];\n logErr(`git diff failed in ${root}: ${reason}`);\n return null;\n }\n}\n\n/**\n * The directory whose files belong to `a`: the asset's own folder for a skill, agent, contract,\n * or a prompt/flow/preset that sits in a folder named after it — the folder `library create`\n * scaffolds. A single prompt/flow/preset file next to others is its own asset (`null`).\n */\nfunction assetOwnDir(a: AssetVersion): string | null {\n const dir = path.dirname(a.filePath);\n if ([\"skill\", \"agent\", \"contract\"].includes(a.kind) || path.basename(dir) === a.name) return dir;\n return null;\n}\n\n/**\n * The files that make `a` changed, relative to `root` in git order: its asset file, or any file\n * under its folder that a deploy ships (the lock hash covers them, minus the deploy ignore list),\n * among `changedAbs`. Empty when `a` did not change.\n */\nfunction changedPathsOf(a: AssetVersion, changedAbs: ReadonlySet<string>, root: string): string[] {\n const out: string[] = [];\n if (changedAbs.has(a.filePath)) out.push(toPosix(path.relative(root, a.filePath)));\n const dir = assetOwnDir(a);\n if (dir === null) return out;\n for (const f of changedAbs) {\n if (f === a.filePath) continue;\n const rel = path.relative(dir, f);\n if (rel.startsWith(\"..\") || path.isAbsolute(rel)) continue;\n if (!isNonAssetPath(toPosix(rel), \"asset-root\")) out.push(toPosix(path.relative(root, f)));\n }\n return out;\n}\n\n/** The changed files of a flagged asset as one clause: `changed: a, b, c (+2 more)`. */\nfunction changedClause(files: readonly string[]): string {\n const shown = files.slice(0, 5).join(\", \");\n return `changed: ${shown}${files.length > 5 ? ` (+${files.length - 5} more)` : \"\"}`;\n}\n\n/** Body of `skaile validate versions` — semver + bump + flow-pin checks. */\nfunction runVersionsCheck(\n pathArg: string | undefined,\n opts: { changedOnly?: boolean; strict?: boolean },\n): void {\n const root = resolveCheckRoot(pathArg);\n if (root === null) {\n process.exit(1);\n return;\n }\n let assets = collectAssetVersions(root);\n const changedByAsset = new Map<AssetVersion, string[]>();\n // A directory with no asset has nothing to check: `Checked 0 assets / All versions valid` would\n // read as a pass, so it fails as `validate` does for a path with no manifests (p1194).\n if (assets.length === 0) {\n logErr(\n `Nothing to check in ${root}: no versioned asset (skill, agent, flow, prompt, contract or preset) found. Pass the library directory.`,\n );\n process.exit(1);\n return;\n }\n\n // Filter to changed files only if requested\n if (opts.changedOnly) {\n const changed = changedFiles(root, \"HEAD\", \"--changed-only\", { untracked: true });\n if (changed === null) {\n process.exit(1);\n return;\n }\n const changedAbs = new Set(changed.map((f) => path.resolve(root, f)));\n for (const a of assets) {\n const files = changedPathsOf(a, changedAbs, root);\n if (files.length > 0) changedByAsset.set(a, files);\n }\n assets = assets.filter((a) => changedByAsset.has(a));\n }\n\n logInfo(`Checking versions in ${root}`);\n const versionCheck = checkAssetVersions(assets, root);\n let errors = versionCheck.errors;\n let warnings = versionCheck.warnings;\n\n // In --changed-only mode, check if version was actually bumped\n if (opts.changedOnly) {\n warnings += checkVersionBumps(assets, root, changedByAsset);\n }\n\n const pinCheck = checkFlowVersionPins(assets, root);\n errors += pinCheck.errors;\n warnings += pinCheck.warnings;\n\n // Summary\n console.log();\n logInfo(`Checked ${assets.length} assets`);\n if (errors === 0 && warnings === 0) {\n logOk(\"All versions valid\");\n } else {\n if (errors > 0) logErr(`${errors} error(s)`);\n if (warnings > 0) logWarn(`${warnings} warning(s)`);\n }\n\n if (errors > 0 || (opts.strict && warnings > 0)) {\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile validate` command group.\n *\n * Validates asset manifests, version fields, and changelogs in an asset\n * repository tree. Subcommands: default `validate [path]` (schema check),\n * `versions` (semver + flow pin validation), `changelog` (modified assets\n * must have an updated nearest-ancestor CHANGELOG.md).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/validate#make-validate-command\n */\nexport function makeValidateCommand(): Command {\n const cmd = new Command(\"validate\").description(\n \"Validate asset manifests, versions, and changelogs\",\n );\n\n // Default action: skaile validate [path]\n cmd\n .argument(\"[path]\", \"Path to asset repo or directory to validate\", \".\")\n .option(\n \"--strict-conformance\",\n \"Treat Agent Skills (agentskills.io) standard findings as errors\",\n )\n .action(async (targetPath: string, opts: { strictConformance?: boolean }) => {\n const absPath = path.resolve(targetPath);\n if (fs.existsSync(absPath) && !fs.statSync(absPath).isDirectory()) {\n logErr(`${absPath} is not a directory: nothing to validate. Pass the library directory.`);\n process.exit(1);\n return;\n }\n logInfo(`Validating manifests in ${absPath}`);\n const { total, errors, warnings } = validateManifests(\n absPath,\n opts.strictConformance ?? false,\n await registeredAssetKeys(libraryRootOf(absPath)),\n );\n const ws = await validateWorkspaceManifests(absPath);\n const rootErrors = await validatePublishManifestRoots(absPath);\n const slugErrors = validatePublishManifestPublisherSlugs(absPath);\n const rootPathErrors = validatePublishManifestRootPaths(absPath);\n const parseErrors = validatePublishManifestParses(absPath);\n const requiresErrors = validatePublishManifestRequires(absPath);\n const unlistedErrors = await validatePublishManifestUnlisted(absPath);\n const versionWarnings = validatePublishManifestVersions(absPath);\n const publisherWarnings = validatePublishManifestPublishers(absPath);\n // Advisory and offline: a dependency no registered library holds may live in a\n // library that is not registered on this machine.\n const dependencyProblems = await unresolvedManifestDependencies(absPath);\n for (const w of dependencyProblems) logWarn(w);\n const dependencyWarnings = dependencyProblems.length;\n const totalErrors =\n errors +\n ws.errors +\n rootErrors +\n slugErrors +\n rootPathErrors +\n parseErrors +\n requiresErrors +\n unlistedErrors;\n console.log();\n warnIgnoredDomainFiles(absPath);\n warnLegacyBundleFiles(absPath);\n logInfo(`Scanned ${total} asset manifest(s) and ${ws.total} skaile.yaml file(s)`);\n // Nothing scanned and no library manifest: a directory with nothing in it is not valid,\n // it is not validated (p745).\n if (\n total === 0 &&\n ws.total === 0 &&\n totalErrors === 0 &&\n !fs.existsSync(path.join(absPath, SKAILE_MANIFEST_FILENAME))\n ) {\n logErr(\n `Nothing to validate in ${absPath}: no asset manifest, skaile.yaml or ${SKAILE_MANIFEST_FILENAME} found.`,\n );\n process.exit(1);\n return;\n }\n const totalWarnings = warnings + versionWarnings + publisherWarnings + dependencyWarnings;\n if (totalWarnings > 0) logWarn(`${totalWarnings} warning(s)`);\n if (totalErrors === 0) {\n logOk(\"All manifests valid\");\n } else {\n logErr(`${totalErrors} validation error(s)`);\n process.exit(1);\n }\n });\n\n cmd\n .command(\"versions\")\n .description(\"Check version fields and flow version pins\")\n .argument(\"[path]\", \"Library or asset directory (default: the current library)\")\n .option(\"--changed-only\", \"Only check assets modified since last commit\")\n .option(\"--strict\", \"Exit 1 on warnings (for CI)\")\n .addOption(removedDomainOption())\n .action(\n (\n pathArg: string | undefined,\n opts: { changedOnly?: boolean; strict?: boolean; domain?: string },\n ) => {\n rejectRemovedDomainOption(opts);\n runVersionsCheck(pathArg, opts);\n },\n );\n\n cmd\n .command(\"changelog\")\n .description(\"Check that modified assets have an updated nearest CHANGELOG.md\")\n .argument(\"[path]\", \"Library or asset directory (default: the current library)\")\n .option(\"--base <ref>\", \"Git base ref for diff\", \"HEAD\")\n .action((pathArg: string | undefined, opts: { base: string }) => {\n const root = resolveCheckRoot(pathArg);\n if (root === null) {\n process.exit(1);\n return;\n }\n const modifiedFiles = changedFiles(root, opts.base, \"changelog\");\n if (modifiedFiles === null) {\n process.exit(1);\n return;\n }\n const { updated, stale, orphans } = checkChangelogUnits(modifiedFiles, root);\n\n if (updated.length + stale.length + orphans.length === 0) {\n logOk(\"No modified assets found\");\n return;\n }\n\n for (const unit of updated) logOk(`${unit} updated`);\n for (const unit of stale) logErr(`${unit} not updated (assets were modified)`);\n for (const asset of orphans) {\n logErr(`${asset} — no CHANGELOG.md in any ancestor directory up to the asset root`);\n }\n\n if (stale.length + orphans.length > 0) process.exit(1);\n });\n\n return cmd;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-FZO64PLQ.js';
2
- import { scanDirectory, tryWithFsDeadline } from './chunk-GNUA7XT2.js';
1
+ import { resolveSkWorkspaceConfig, readLinks, getGlobalCacheDir, sourceCacheKey } from './chunk-BNLXZXZN.js';
2
+ import { scanDirectory, tryWithFsDeadline } from './chunk-VS6XC5JE.js';
3
3
  import { existsSync, readFileSync } from 'fs';
4
4
  import { lstat, stat } from 'fs/promises';
5
5
  import { createRequire } from 'module';
@@ -240,5 +240,5 @@ function findCatalogEntry(entries, query) {
240
240
  }
241
241
 
242
242
  export { FACTORY_ASSETS_REPO_NAME, factoryAssetRoots, resolveFactoryAssetsRoot, resolveFactoryAssetsRootOrNull, resolvePackagedAssetsDir, resolveRuntimeAssets, resolveWorkspacesPackageRoot };
243
- //# sourceMappingURL=chunk-4ROXSQEG.js.map
244
- //# sourceMappingURL=chunk-4ROXSQEG.js.map
243
+ //# sourceMappingURL=chunk-CJO3XKO7.js.map
244
+ //# sourceMappingURL=chunk-CJO3XKO7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../core/src/runtime-assets.ts"],"names":["resolvePath","require"],"mappings":";;;;;;;;AAsDA,SAAS,sBACP,OAAA,EACmC;AACnC,EAAA,MAAM,aAAa,iB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AA,kBAAA,EAAqB,IAAA,CAAK,IAAI,CAAA,CAAA;AAAA,EAC1D;AACA,EAAA,OAAO,eAAe,IAAI,CAAA,2BAAA,CAAA;AAC5B;AAEA,SAAS,gBAAA,CACP,SACA,KAAA,EACiC;AACjC,EAAA,IAAI,MAAM,IAAA,EAAM;AACd,IAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,KAAS,KAAA,CAAM,IAAA,IAAQ,CAAA,CAAE,IAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAAA,EAC3E;AACA,EAAA,MAAM,OAAA,GAAU,QAAQ,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,IAAA,KAAS,MAAM,IAAI,CAAA;AAC3D,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,QAAQ,CAAC,CAAA;AAE1C,EAAA,OAAO,MAAA;AACT","file":"chunk-4ROXSQEG.js","sourcesContent":["/**\n * Runtime asset resolution — read `skaile.yaml`, scan all declared repositories\n * (including the built-in `factory-assets/` directory as an implicit default),\n * and produce a unified view of connector catalog entries plus the implicit refs\n * that the `skaile.yaml` `connectors:` section adds to the dependency graph.\n *\n * This module is the single source of truth for \"which connectors does this\n * project see at runtime, and where do their implementations live on disk\".\n * Both the runner (serve, REPL, flow) and the platform's mid-session\n * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass\n * it into `ConnectorManager` for catalog-based resolution.\n *\n * `factory-assets/` is the single first-party content tree (built-in connectors\n * + first-party skills + bundles) shipped inside the `@skaile/workspaces`\n * package — not a standalone package.\n *\n * It resolves to an **ordered list of roots** ({@link factoryAssetRoots}), not a\n * single dir. The bundled tree is always the baseline; an optional\n * `SKAILE_FACTORY_ASSETS_DIR` (legacy: `SKAILE_BASE_ASSETS_DIR`) is layered\n * **in front** as an additive override source — the agent container points it at\n * `/app/factory-assets/` (or a bind-mounted host dir) to ship updated skills /\n * flows / bundles / connector manifests without rebuilding the image. The two\n * roots resolve uniformly across every consumer (connector catalog scan, skill /\n * flow / completion discovery, the asset-manager factory source):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir, when set and existing (override layer).\n * 2. the bundled tree via {@link resolvePackagedAssetsDir} — the in-repo source\n * `packages/workspaces/factory-assets/` during dev, else the published\n * `dist/factory-assets/` after install (always-present baseline).\n *\n * Override semantics are **env-first**: on a name conflict the env root wins and\n * the bundled root fills the rest. Connector *code* still loads via the package's\n * static `exports` map, so the env root can override/add skills, flows, bundles,\n * and connector **manifests/metadata**, but cannot ship a new executable\n * connector — its `.js` is not on the package's import graph.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { lstat, stat } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve as resolvePath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { tryWithFsDeadline } from \"./fs-deadline.js\";\nimport { scanDirectory } from \"./manifest.js\";\nimport type { CatalogEntry } from \"./models.js\";\nimport { getGlobalCacheDir, readLinks, sourceCacheKey } from \"./repo-manager.js\";\nimport type { SourceDeclaration, SourceEntry } from \"./workspace-config.js\";\nimport { resolveSkWorkspaceConfig } from \"./workspace-config.js\";\n\n/**\n * Map declared `sources[]` to internal `SourceDeclaration`s keyed by the\n * collision-free {@link sourceCacheKey} (`<host>/<owner>/<repo>`), pointing at\n * the unified machine-cache clone path (`getGlobalCacheDir()/<key>/`). Keyed by\n * the same function every other cache writer/reader uses so the path resolves.\n */\nfunction sourcesToDeclarations(\n sources: SourceEntry[] | undefined,\n): Record<string, SourceDeclaration> {\n const sourcesDir = getGlobalCacheDir();\n const out: Record<string, SourceDeclaration> = {};\n for (const s of sources ?? []) {\n const key = sourceCacheKey(s.url);\n if (out[key]) continue;\n out[key] = {\n path: join(sourcesDir, key),\n url: s.url,\n branch: s.pin,\n ...(s.publisher ? { publisher: s.publisher } : {}),\n };\n }\n return out;\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`.\n * @docLink packages/core/concepts#runtime-catalog-entry\n */\nexport type RuntimeCatalogEntry = CatalogEntry;\n\n/**\n * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`.\n * Each connector driver becomes an implicit ref that must be resolved in the catalog.\n * @docLink packages/core/concepts#runtime-asset-ref\n */\nexport interface RuntimeAssetRef {\n kind: \"connector\";\n /** Driver name — matches `RuntimeCatalogEntry.name`. */\n name: string;\n /** Source declaration id from `skaile.yaml`. */\n declarationId: string;\n}\n\n/**\n * Aggregated npm packages required by all resolved mount/connector adapters.\n * Populated from `metadata.npm_deps` in each matched catalog entry.\n * @docLink packages/core/concepts#runtime-npm-deps\n */\nexport interface RuntimeNpmDeps {\n required: string[];\n optional: string[];\n}\n\n/**\n * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable\n * or a driver is not found in any catalog.\n * @docLink packages/core/concepts#runtime-asset-warning\n */\nexport interface RuntimeAssetWarning {\n /** Stable code for filtering / structured logging. */\n code: \"missing_driver\" | \"repo_unavailable\" | \"invalid_repo_decl\";\n message: string;\n /** Declaration id when applicable. */\n declarationId?: string;\n /** Driver / repository name when applicable. */\n name?: string;\n}\n\n/**\n * Repository name used for the implicit built-in `factory-assets` catalog entry\n * (the in-package connector tree).\n * @docLink packages/core/concepts#factory-assets-repo-name\n */\nexport const FACTORY_ASSETS_REPO_NAME = \"factory-assets\";\n\n/**\n * Repository name for the optional `SKAILE_FACTORY_ASSETS_DIR` override layer,\n * scanned ahead of (and overriding) the bundled {@link FACTORY_ASSETS_REPO_NAME}.\n */\nconst FACTORY_ASSETS_OVERRIDE_REPO_NAME = \"factory-assets:override\";\n\n/**\n * Result of `resolveRuntimeAssets`.\n * The same object is mutated in place by `refresh()`, allowing callers to hold\n * a stable reference and observe updates after a new repository is cloned or\n * a driver is installed mid-session.\n * @docLink packages/core/concepts#runtime-assets-result\n */\nexport interface RuntimeAssetsResult {\n catalogEntries: RuntimeCatalogEntry[];\n implicitRefs: RuntimeAssetRef[];\n requiredNpmDeps: RuntimeNpmDeps;\n warnings: RuntimeAssetWarning[];\n /** Re-scan repositories and re-derive implicit refs. Mutates in place. */\n refresh(): Promise<void>;\n /**\n * Catalog lookup. When `kind` is omitted and multiple entries share the\n * `name`, returns `undefined` (caller must disambiguate).\n */\n findEntry(query: { kind?: \"connector\"; name: string }): RuntimeCatalogEntry | undefined;\n}\n\n/** Options of {@link resolveRuntimeAssets}. */\nexport interface RuntimeAssetsOptions {\n /**\n * True when a connector driver is registered in the process (built-in or loaded plugin).\n * Core does not know the registry; the caller passes its lookup. Without it only the catalog\n * counts, so a driver a plugin registers is reported as `missing_driver`.\n */\n isDriverRegistered?: (driver: string) => boolean;\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Resolve all runtime assets visible to a project by scanning declared repositories.\n *\n * Reads `skaile.yaml`, scans every declared repository (plus the implicit\n * built-in `factory-assets` repo), and derives implicit refs from `mounts:` /\n * `connectors:` declarations. Does not clone or install anything — purely a\n * read-only scan of what is already on disk. URL-only repositories that have\n * not been cloned yet are reported as `repo_unavailable` warnings.\n *\n * @param projectDir - Absolute path to the project workspace root\n * @param options - `isDriverRegistered`: a driver that no catalog entry lists but a plugin\n * registered is not reported as `missing_driver`\n * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings\n * @docLink packages/core/concepts#resolve-runtime-assets\n */\nexport async function resolveRuntimeAssets(\n projectDir: string,\n options: RuntimeAssetsOptions = {},\n): Promise<RuntimeAssetsResult> {\n const result: RuntimeAssetsResult = {\n catalogEntries: [],\n implicitRefs: [],\n requiredNpmDeps: { required: [], optional: [] },\n warnings: [],\n refresh: async () => {\n await populate(projectDir, result, options);\n },\n findEntry: (query) => findCatalogEntry(result.catalogEntries, query),\n };\n\n await populate(projectDir, result, options);\n return result;\n}\n\n/**\n * Resolve the ordered list of on-disk roots for the built-in `factory-assets`\n * tree (built-in connectors + first-party skills + bundles). This is the single\n * shared resolver every consumer goes through, so the env override and the\n * bundled baseline are honoured uniformly.\n *\n * Order (env-first = override-wins):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir (legacy: `SKAILE_BASE_ASSETS_DIR`),\n * when set and existing — an additive override layer.\n * 2. {@link resolvePackagedAssetsDir} — the bundled tree (in-repo source in dev,\n * `dist/factory-assets/` after install). Always-present baseline.\n *\n * Returns `[]` only when the package cannot be located at all. De-duplicated, so\n * pointing the env var at the bundled dir collapses to one root.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function factoryAssetRoots(): string[] {\n const roots: string[] = [];\n const envDir = process.env.SKAILE_FACTORY_ASSETS_DIR ?? process.env.SKAILE_BASE_ASSETS_DIR;\n // Deliberately still synchronous after #454: both candidates are\n // container-local (the image's `/app/factory-assets/`, or the installed\n // package tree resolved by `resolvePackagedAssetsDir`), never the FUSE\n // workspace mount. The mount-reachable probes on this module's scan path —\n // the project-relative `sources[].path` candidates in `resolveRepoDir` — are\n // async and deadline-bounded.\n if (envDir && existsSync(envDir)) roots.push(resolvePath(envDir));\n const bundled = resolvePackagedAssetsDir(\"factory-assets\");\n if (bundled) roots.push(bundled);\n return [...new Set(roots)];\n}\n\n/**\n * Resolve the primary on-disk root of the `factory-assets` tree — the first of\n * {@link factoryAssetRoots} (the env override when set, else the bundled tree).\n * Prefer {@link factoryAssetRoots} when you need to scan every layer; this\n * single-dir form is for callers that want one canonical path.\n *\n * @returns Absolute path to the highest-precedence `factory-assets` directory\n * @throws When no root can be located\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolveFactoryAssetsRoot(): string {\n const hit = resolveFactoryAssetsRootOrNull();\n if (hit) return hit;\n\n throw new Error(\n `Cannot resolve the factory-assets directory. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR to the on-disk path, ` +\n `ensure @skaile/workspaces is installed, ` +\n `or run from within the @skaile/workspaces package tree.`,\n );\n}\n\n/**\n * Non-throwing variant of {@link resolveFactoryAssetsRoot}: the same\n * env-then-packaged resolution tiers, returning `null` instead of throwing when\n * none locate the directory. Callers that treat a missing factory tree as a\n * soft \"not present\" (e.g. the asset-manager's implicit-source injection) MUST\n * use this so they honour the `SKAILE_FACTORY_ASSETS_DIR` container override\n * identically to the runtime path.\n */\nexport function resolveFactoryAssetsRootOrNull(): string | null {\n return factoryAssetRoots()[0] ?? null;\n}\n\n/**\n * Resolve the `@skaile/workspaces` package root — the directory containing its\n * `package.json`. Tries `require.resolve` first (works when installed as a\n * dependency *and* in-repo via the self-reference), then walks upward from this\n * module looking for a `package.json` whose `name` is `@skaile/workspaces`\n * (bounded to 8 levels). Returns `null` when neither locates it.\n *\n * The single source of truth for finding content shipped inside the package —\n * the unified `factory-assets/` tree (built-in connectors + first-party skills\n * + bundles) resolves through {@link resolvePackagedAssetsDir} on top of this.\n *\n * Memoized: the package location is immutable for the process lifetime, but\n * this sits on the CLI hot path (every `findSkills` / flow / completion call\n * funnels through here), so the `require.resolve` + upward `package.json` walk\n * runs once. `undefined` = not yet computed.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nlet workspacesPackageRootCache: string | null | undefined;\n\nexport function resolveWorkspacesPackageRoot(): string | null {\n if (workspacesPackageRootCache !== undefined) return workspacesPackageRootCache;\n workspacesPackageRootCache = computeWorkspacesPackageRoot();\n return workspacesPackageRootCache;\n}\n\nfunction computeWorkspacesPackageRoot(): string | null {\n try {\n const require = createRequire(import.meta.url);\n return dirname(require.resolve(\"@skaile/workspaces/package.json\"));\n } catch {\n // Fall through to the workspace walk.\n }\n let dir: string;\n try {\n dir = dirname(fileURLToPath(import.meta.url));\n } catch {\n return null;\n }\n for (let i = 0; i < 8; i++) {\n const pkgPath = join(dir, \"package.json\");\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as { name?: string };\n if (pkg.name === \"@skaile/workspaces\") return dir;\n } catch {\n // Ignore malformed package.json and keep walking.\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Locate a content-asset directory inside the package. Prefers the in-repo\n * **source** dir `<pkgRoot>/<subdir>` when present — in a dev checkout it is the\n * full tree (e.g. `factory-assets/` keeps the connector `.ts` entry files that\n * `dist/` does not) — then the published `dist/<subdir>` copy (what\n * `files: [\"dist\"]` ships, the only one present after `npm i`). Returns `null`\n * when neither exists.\n *\n * `factory-assets/` resolves to the source tree in dev (code + skills + bundles)\n * and to `dist/factory-assets` post-install (compiled connectors + copied\n * manifests/skills/bundles).\n *\n * @param subdir - `\"factory-assets\"` | …\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolvePackagedAssetsDir(subdir: string): string | null {\n const root = resolveWorkspacesPackageRoot();\n if (!root) return null;\n for (const cand of [join(root, subdir), join(root, \"dist\", subdir)]) {\n if (existsSync(cand)) return cand;\n }\n return null;\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_SCAN_KINDS: ReadonlySet<string> = new Set([\"connector\"]);\n\nasync function populate(\n projectDir: string,\n target: RuntimeAssetsResult,\n options: RuntimeAssetsOptions,\n): Promise<void> {\n target.catalogEntries = [];\n target.implicitRefs = [];\n target.requiredNpmDeps = { required: [], optional: [] };\n target.warnings = [];\n\n const config = resolveSkWorkspaceConfig(projectDir);\n // Connector catalog scan runs over the project's declared sources[] (resolved\n // to their machine-cache clone paths) plus the implicit factory-assets repo.\n const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));\n const links = readLinks(projectDir);\n\n // Scan each repository for connector entries.\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = await resolveRepoDir(name, decl, projectDir, links);\n if (!repoDir) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: repoUnavailableMessage(name, decl),\n });\n continue;\n }\n try {\n // Both factory layers carry the same `factory-assets` provenance — the\n // override repo is an internal scan-order device, not a distinct source.\n const repoName = name === FACTORY_ASSETS_OVERRIDE_REPO_NAME ? FACTORY_ASSETS_REPO_NAME : name;\n // Only connector descriptors are consumed here, so only that kind is\n // \"known\": typed manifests of any other kind are irrelevant to this scan.\n const scanned = await scanDirectory(repoDir, repoName, {\n knownKinds: CONNECTOR_SCAN_KINDS,\n onDiagnostic: () => {},\n });\n const entries = scanned.filter((e) => e.kind === \"connector\");\n target.catalogEntries.push(...entries);\n } catch (err) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: `Failed to scan repository \"${name}\" at ${repoDir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n });\n }\n }\n\n // De-duplicate by (kind, name), keeping the first occurrence. Scan order is\n // declared sources → env override → bundled baseline, so an env-supplied\n // connector manifest overrides the bundled one and the bundled one fills the\n // rest (the override layer can refresh built-in manifests in place).\n const seen = new Set<string>();\n target.catalogEntries = target.catalogEntries.filter((e) => {\n const key = `${e.kind}:${e.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n\n // Derive implicit refs from skaile.yaml connectors.\n for (const [index, c] of (config.connectors ?? []).entries()) {\n // No `driver` (a misspelt or old `adapter:` key): say so with the text `validate` prints,\n // not a warning about the driver `\"undefined\"` (p1739).\n if (typeof c.driver !== \"string\" || c.driver === \"\") {\n const legacy = (c as unknown as Record<string, unknown>).adapter;\n const label = typeof c.id === \"string\" && c.id !== \"\" ? `\"${c.id}\"` : `#${index + 1}`;\n target.warnings.push({\n code: \"missing_driver\",\n ...(typeof c.id === \"string\" && c.id !== \"\" ? { declarationId: c.id } : {}),\n message:\n legacy !== undefined\n ? `Connector ${label} sets \\`adapter: ${String(legacy)}\\`; the key is \\`driver\\`. Rename \\`adapter\\` to \\`driver\\`.`\n : `Connector ${label} has no \\`driver\\`; the runner cannot mount it. Add \\`driver: <name>\\`.`,\n });\n continue;\n }\n target.implicitRefs.push({ kind: \"connector\", name: c.driver, declarationId: c.id });\n }\n\n // Validate refs and aggregate npm deps.\n const requiredSet = new Set<string>();\n const optionalSet = new Set<string>();\n for (const ref of target.implicitRefs) {\n const entry = findCatalogEntry(target.catalogEntries, ref);\n // A plugin's connector has no catalog entry: the process registry knows it.\n if (!entry && options.isDriverRegistered?.(ref.name)) continue;\n if (!entry) {\n target.warnings.push({\n code: \"missing_driver\",\n declarationId: ref.declarationId,\n name: ref.name,\n message:\n `Unknown ${ref.kind} driver \"${ref.name}\" referenced by ${ref.kind} \"${ref.declarationId}\". ` +\n `Run \\`skaile ${ref.kind} catalog\\` to see available drivers, ` +\n `or declare a repository in skaile.yaml that provides this driver.`,\n });\n continue;\n }\n const npm = (entry.metadata?.npm_deps ?? {}) as { required?: string[]; optional?: string[] };\n for (const p of npm.required ?? []) requiredSet.add(p);\n for (const p of npm.optional ?? []) optionalSet.add(p);\n }\n target.requiredNpmDeps.required = [...requiredSet];\n target.requiredNpmDeps.optional = [...optionalSet];\n}\n\n/**\n * Build the effective `repositories` map: caller's declarations first, then the\n * implicit built-in `factory-assets` repos. Each {@link factoryAssetRoots} layer\n * becomes its own repo, the env override inserted **before** the bundled\n * baseline so its connector entries win on the first-match dedup downstream.\n * When the package cannot be located at all, a path-less sentinel under\n * {@link FACTORY_ASSETS_REPO_NAME} drives the `repo_unavailable` warning.\n */\nfunction buildEffectiveRepositories(\n declared: Record<string, SourceDeclaration> | undefined,\n): Record<string, SourceDeclaration> {\n const result: Record<string, SourceDeclaration> = { ...(declared ?? {}) };\n const roots = factoryAssetRoots();\n if (roots.length === 0) {\n // Surface as a warning during scan rather than throwing here — let the\n // caller decide whether factory-assets is required. resolveRepoDir() /\n // repoUnavailableMessage re-discover the failure and emit it.\n if (!result[FACTORY_ASSETS_REPO_NAME]) result[FACTORY_ASSETS_REPO_NAME] = { path: \"\" };\n return result;\n }\n // override-first when both layers exist, so the env root's entries are scanned\n // (and matched) ahead of the bundled baseline.\n const keys =\n roots.length > 1\n ? [FACTORY_ASSETS_OVERRIDE_REPO_NAME, FACTORY_ASSETS_REPO_NAME]\n : [FACTORY_ASSETS_REPO_NAME];\n roots.forEach((dir, i) => {\n const key = keys[i] ?? `${FACTORY_ASSETS_REPO_NAME}:${i}`;\n if (!result[key]) result[key] = { path: dir };\n });\n return result;\n}\n\n/**\n * Resolve a repository declaration to an on-disk directory. Order:\n * 1. Linked override (`.skaile/links.yaml`).\n * 2. Local `path` — relative to `projectDir`.\n * 3. Cloned URL repo at `.skaile/cache/sources/<name>/` (must already exist).\n *\n * Returns `null` when none of these resolve. Does not clone.\n *\n * **Async and deadline-bounded since #454.** Every candidate here is a\n * project-relative or operator-supplied path, so a `sources[].path` of\n * `workspace/my-assets` resolves onto the rclone FUSE mount — the same tree the\n * scan that follows walks. Probing it with `existsSync`/`lstatSync` would park\n * the `skaile serve` event loop *before* the (now async) scan ever ran, which\n * would leave the H2 fix meaningless on the very declaration that triggers it.\n * A probe that misses its deadline reads as \"unavailable\", which is what the\n * caller already does with an absent path — it becomes a `repo_unavailable`\n * warning rather than a stall.\n */\nasync function resolveRepoDir(\n name: string,\n decl: SourceDeclaration,\n projectDir: string,\n links: Record<string, string>,\n): Promise<string | null> {\n // 1. Linked override\n const linked = links[name];\n if (linked && (await pathExists(linked))) return linked;\n\n // 2. Local path\n if (decl.path) {\n const resolved = resolvePath(projectDir, decl.path);\n return (await pathExists(resolved)) ? resolved : null;\n }\n\n // 3. URL repo cloned to project's .skaile/cache/sources/<name> — the\n // project-local clone dir (often a symlink into the global cache, which\n // lives at getGlobalCacheDir()); NOT the global clone root itself.\n if (decl.url) {\n const projectDest = join(projectDir, \".skaile\", \"cache\", \"sources\", name);\n // One `lstat` answers both questions the pre-#454 `existsSync` + `lstatSync`\n // pair asked, and `lstat` (not `stat`) keeps the \"a symlink into the global\n // cache counts\" behaviour intact.\n const found = await tryWithFsDeadline(\n `lstat ${projectDest}`,\n async () => {\n await lstat(projectDest);\n return true;\n },\n false,\n );\n return found ? projectDest : null;\n }\n\n return null;\n}\n\n/** Deadline-bounded `existsSync` replacement — a wedged mount reads as absent. */\nfunction pathExists(path: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${path}`,\n async () => {\n await stat(path);\n return true;\n },\n false,\n );\n}\n\nfunction repoUnavailableMessage(name: string, decl: SourceDeclaration): string {\n if (name === FACTORY_ASSETS_REPO_NAME && !decl.path && !decl.url) {\n return (\n `Cannot resolve the built-in factory-assets. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR or ensure @skaile/workspaces is installed.`\n );\n }\n if (decl.url) {\n return `Repository \"${name}\" (${decl.url}) is not available. Register it as a Library Source via \\`skaile source add\\`.`;\n }\n if (decl.path) {\n return `Repository \"${name}\" path not found: ${decl.path}`;\n }\n return `Repository \"${name}\" has neither url nor path.`;\n}\n\nfunction findCatalogEntry(\n entries: RuntimeCatalogEntry[],\n query: { kind?: \"connector\"; name: string },\n): RuntimeCatalogEntry | undefined {\n if (query.kind) {\n return entries.find((e) => e.kind === query.kind && e.name === query.name);\n }\n const matches = entries.filter((e) => e.name === query.name);\n if (matches.length === 1) return matches[0];\n // 0 or >1 with no kind — caller must disambiguate.\n return undefined;\n}\n"]}
1
+ {"version":3,"sources":["../core/src/runtime-assets.ts"],"names":["resolvePath","require"],"mappings":";;;;;;;;AAsDA,SAAS,sBACP,OAAA,EACmC;AACnC,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,MAAM,MAAyC,EAAC;AAChD,EAAA,KAAA,MAAW,CAAA,IAAK,OAAA,IAAW,EAAC,EAAG;AAC7B,IAAA,MAAM,GAAA,GAAM,cAAA,CAAe,CAAA,CAAE,GAAG,CAAA;AAChC,IAAA,IAAI,GAAA,CAAI,GAAG,CAAA,EAAG;AACd,IAAA,GAAA,CAAI,GAAG,CAAA,GAAI;AAAA,MACT,IAAA,EAAM,IAAA,CAAK,UAAA,EAAY,GAAG,CAAA;AAAA,MAC1B,KAAK,CAAA,CAAE,GAAA;AAAA,MACP,QAAQ,CAAA,CAAE,GAAA;AAAA,MACV,GAAI,EAAE,SAAA,GAAY,EAAE,WAAW,CAAA,CAAE,SAAA,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AI,CAAA;AAC3D,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,QAAQ,CAAC,CAAA;AAE1C,EAAA,OAAO,MAAA;AACT","file":"chunk-CJO3XKO7.js","sourcesContent":["/**\n * Runtime asset resolution — read `skaile.yaml`, scan all declared repositories\n * (including the built-in `factory-assets/` directory as an implicit default),\n * and produce a unified view of connector catalog entries plus the implicit refs\n * that the `skaile.yaml` `connectors:` section adds to the dependency graph.\n *\n * This module is the single source of truth for \"which connectors does this\n * project see at runtime, and where do their implementations live on disk\".\n * Both the runner (serve, REPL, flow) and the platform's mid-session\n * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass\n * it into `ConnectorManager` for catalog-based resolution.\n *\n * `factory-assets/` is the single first-party content tree (built-in connectors\n * + first-party skills + bundles) shipped inside the `@skaile/workspaces`\n * package — not a standalone package.\n *\n * It resolves to an **ordered list of roots** ({@link factoryAssetRoots}), not a\n * single dir. The bundled tree is always the baseline; an optional\n * `SKAILE_FACTORY_ASSETS_DIR` (legacy: `SKAILE_BASE_ASSETS_DIR`) is layered\n * **in front** as an additive override source — the agent container points it at\n * `/app/factory-assets/` (or a bind-mounted host dir) to ship updated skills /\n * flows / bundles / connector manifests without rebuilding the image. The two\n * roots resolve uniformly across every consumer (connector catalog scan, skill /\n * flow / completion discovery, the asset-manager factory source):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir, when set and existing (override layer).\n * 2. the bundled tree via {@link resolvePackagedAssetsDir} — the in-repo source\n * `packages/workspaces/factory-assets/` during dev, else the published\n * `dist/factory-assets/` after install (always-present baseline).\n *\n * Override semantics are **env-first**: on a name conflict the env root wins and\n * the bundled root fills the rest. Connector *code* still loads via the package's\n * static `exports` map, so the env root can override/add skills, flows, bundles,\n * and connector **manifests/metadata**, but cannot ship a new executable\n * connector — its `.js` is not on the package's import graph.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { lstat, stat } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve as resolvePath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { tryWithFsDeadline } from \"./fs-deadline.js\";\nimport { scanDirectory } from \"./manifest.js\";\nimport type { CatalogEntry } from \"./models.js\";\nimport { getGlobalCacheDir, readLinks, sourceCacheKey } from \"./repo-manager.js\";\nimport type { SourceDeclaration, SourceEntry } from \"./workspace-config.js\";\nimport { resolveSkWorkspaceConfig } from \"./workspace-config.js\";\n\n/**\n * Map declared `sources[]` to internal `SourceDeclaration`s keyed by the\n * collision-free {@link sourceCacheKey} (`<host>/<owner>/<repo>`), pointing at\n * the unified machine-cache clone path (`getGlobalCacheDir()/<key>/`). Keyed by\n * the same function every other cache writer/reader uses so the path resolves.\n */\nfunction sourcesToDeclarations(\n sources: SourceEntry[] | undefined,\n): Record<string, SourceDeclaration> {\n const sourcesDir = getGlobalCacheDir();\n const out: Record<string, SourceDeclaration> = {};\n for (const s of sources ?? []) {\n const key = sourceCacheKey(s.url);\n if (out[key]) continue;\n out[key] = {\n path: join(sourcesDir, key),\n url: s.url,\n branch: s.pin,\n ...(s.publisher ? { publisher: s.publisher } : {}),\n };\n }\n return out;\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`.\n * @docLink packages/core/concepts#runtime-catalog-entry\n */\nexport type RuntimeCatalogEntry = CatalogEntry;\n\n/**\n * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`.\n * Each connector driver becomes an implicit ref that must be resolved in the catalog.\n * @docLink packages/core/concepts#runtime-asset-ref\n */\nexport interface RuntimeAssetRef {\n kind: \"connector\";\n /** Driver name — matches `RuntimeCatalogEntry.name`. */\n name: string;\n /** Source declaration id from `skaile.yaml`. */\n declarationId: string;\n}\n\n/**\n * Aggregated npm packages required by all resolved mount/connector adapters.\n * Populated from `metadata.npm_deps` in each matched catalog entry.\n * @docLink packages/core/concepts#runtime-npm-deps\n */\nexport interface RuntimeNpmDeps {\n required: string[];\n optional: string[];\n}\n\n/**\n * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable\n * or a driver is not found in any catalog.\n * @docLink packages/core/concepts#runtime-asset-warning\n */\nexport interface RuntimeAssetWarning {\n /** Stable code for filtering / structured logging. */\n code: \"missing_driver\" | \"repo_unavailable\" | \"invalid_repo_decl\";\n message: string;\n /** Declaration id when applicable. */\n declarationId?: string;\n /** Driver / repository name when applicable. */\n name?: string;\n}\n\n/**\n * Repository name used for the implicit built-in `factory-assets` catalog entry\n * (the in-package connector tree).\n * @docLink packages/core/concepts#factory-assets-repo-name\n */\nexport const FACTORY_ASSETS_REPO_NAME = \"factory-assets\";\n\n/**\n * Repository name for the optional `SKAILE_FACTORY_ASSETS_DIR` override layer,\n * scanned ahead of (and overriding) the bundled {@link FACTORY_ASSETS_REPO_NAME}.\n */\nconst FACTORY_ASSETS_OVERRIDE_REPO_NAME = \"factory-assets:override\";\n\n/**\n * Result of `resolveRuntimeAssets`.\n * The same object is mutated in place by `refresh()`, allowing callers to hold\n * a stable reference and observe updates after a new repository is cloned or\n * a driver is installed mid-session.\n * @docLink packages/core/concepts#runtime-assets-result\n */\nexport interface RuntimeAssetsResult {\n catalogEntries: RuntimeCatalogEntry[];\n implicitRefs: RuntimeAssetRef[];\n requiredNpmDeps: RuntimeNpmDeps;\n warnings: RuntimeAssetWarning[];\n /** Re-scan repositories and re-derive implicit refs. Mutates in place. */\n refresh(): Promise<void>;\n /**\n * Catalog lookup. When `kind` is omitted and multiple entries share the\n * `name`, returns `undefined` (caller must disambiguate).\n */\n findEntry(query: { kind?: \"connector\"; name: string }): RuntimeCatalogEntry | undefined;\n}\n\n/** Options of {@link resolveRuntimeAssets}. */\nexport interface RuntimeAssetsOptions {\n /**\n * True when a connector driver is registered in the process (built-in or loaded plugin).\n * Core does not know the registry; the caller passes its lookup. Without it only the catalog\n * counts, so a driver a plugin registers is reported as `missing_driver`.\n */\n isDriverRegistered?: (driver: string) => boolean;\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Resolve all runtime assets visible to a project by scanning declared repositories.\n *\n * Reads `skaile.yaml`, scans every declared repository (plus the implicit\n * built-in `factory-assets` repo), and derives implicit refs from `mounts:` /\n * `connectors:` declarations. Does not clone or install anything — purely a\n * read-only scan of what is already on disk. URL-only repositories that have\n * not been cloned yet are reported as `repo_unavailable` warnings.\n *\n * @param projectDir - Absolute path to the project workspace root\n * @param options - `isDriverRegistered`: a driver that no catalog entry lists but a plugin\n * registered is not reported as `missing_driver`\n * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings\n * @docLink packages/core/concepts#resolve-runtime-assets\n */\nexport async function resolveRuntimeAssets(\n projectDir: string,\n options: RuntimeAssetsOptions = {},\n): Promise<RuntimeAssetsResult> {\n const result: RuntimeAssetsResult = {\n catalogEntries: [],\n implicitRefs: [],\n requiredNpmDeps: { required: [], optional: [] },\n warnings: [],\n refresh: async () => {\n await populate(projectDir, result, options);\n },\n findEntry: (query) => findCatalogEntry(result.catalogEntries, query),\n };\n\n await populate(projectDir, result, options);\n return result;\n}\n\n/**\n * Resolve the ordered list of on-disk roots for the built-in `factory-assets`\n * tree (built-in connectors + first-party skills + bundles). This is the single\n * shared resolver every consumer goes through, so the env override and the\n * bundled baseline are honoured uniformly.\n *\n * Order (env-first = override-wins):\n * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir (legacy: `SKAILE_BASE_ASSETS_DIR`),\n * when set and existing — an additive override layer.\n * 2. {@link resolvePackagedAssetsDir} — the bundled tree (in-repo source in dev,\n * `dist/factory-assets/` after install). Always-present baseline.\n *\n * Returns `[]` only when the package cannot be located at all. De-duplicated, so\n * pointing the env var at the bundled dir collapses to one root.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function factoryAssetRoots(): string[] {\n const roots: string[] = [];\n const envDir = process.env.SKAILE_FACTORY_ASSETS_DIR ?? process.env.SKAILE_BASE_ASSETS_DIR;\n // Deliberately still synchronous after #454: both candidates are\n // container-local (the image's `/app/factory-assets/`, or the installed\n // package tree resolved by `resolvePackagedAssetsDir`), never the FUSE\n // workspace mount. The mount-reachable probes on this module's scan path —\n // the project-relative `sources[].path` candidates in `resolveRepoDir` — are\n // async and deadline-bounded.\n if (envDir && existsSync(envDir)) roots.push(resolvePath(envDir));\n const bundled = resolvePackagedAssetsDir(\"factory-assets\");\n if (bundled) roots.push(bundled);\n return [...new Set(roots)];\n}\n\n/**\n * Resolve the primary on-disk root of the `factory-assets` tree — the first of\n * {@link factoryAssetRoots} (the env override when set, else the bundled tree).\n * Prefer {@link factoryAssetRoots} when you need to scan every layer; this\n * single-dir form is for callers that want one canonical path.\n *\n * @returns Absolute path to the highest-precedence `factory-assets` directory\n * @throws When no root can be located\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolveFactoryAssetsRoot(): string {\n const hit = resolveFactoryAssetsRootOrNull();\n if (hit) return hit;\n\n throw new Error(\n `Cannot resolve the factory-assets directory. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR to the on-disk path, ` +\n `ensure @skaile/workspaces is installed, ` +\n `or run from within the @skaile/workspaces package tree.`,\n );\n}\n\n/**\n * Non-throwing variant of {@link resolveFactoryAssetsRoot}: the same\n * env-then-packaged resolution tiers, returning `null` instead of throwing when\n * none locate the directory. Callers that treat a missing factory tree as a\n * soft \"not present\" (e.g. the asset-manager's implicit-source injection) MUST\n * use this so they honour the `SKAILE_FACTORY_ASSETS_DIR` container override\n * identically to the runtime path.\n */\nexport function resolveFactoryAssetsRootOrNull(): string | null {\n return factoryAssetRoots()[0] ?? null;\n}\n\n/**\n * Resolve the `@skaile/workspaces` package root — the directory containing its\n * `package.json`. Tries `require.resolve` first (works when installed as a\n * dependency *and* in-repo via the self-reference), then walks upward from this\n * module looking for a `package.json` whose `name` is `@skaile/workspaces`\n * (bounded to 8 levels). Returns `null` when neither locates it.\n *\n * The single source of truth for finding content shipped inside the package —\n * the unified `factory-assets/` tree (built-in connectors + first-party skills\n * + bundles) resolves through {@link resolvePackagedAssetsDir} on top of this.\n *\n * Memoized: the package location is immutable for the process lifetime, but\n * this sits on the CLI hot path (every `findSkills` / flow / completion call\n * funnels through here), so the `require.resolve` + upward `package.json` walk\n * runs once. `undefined` = not yet computed.\n *\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nlet workspacesPackageRootCache: string | null | undefined;\n\nexport function resolveWorkspacesPackageRoot(): string | null {\n if (workspacesPackageRootCache !== undefined) return workspacesPackageRootCache;\n workspacesPackageRootCache = computeWorkspacesPackageRoot();\n return workspacesPackageRootCache;\n}\n\nfunction computeWorkspacesPackageRoot(): string | null {\n try {\n const require = createRequire(import.meta.url);\n return dirname(require.resolve(\"@skaile/workspaces/package.json\"));\n } catch {\n // Fall through to the workspace walk.\n }\n let dir: string;\n try {\n dir = dirname(fileURLToPath(import.meta.url));\n } catch {\n return null;\n }\n for (let i = 0; i < 8; i++) {\n const pkgPath = join(dir, \"package.json\");\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as { name?: string };\n if (pkg.name === \"@skaile/workspaces\") return dir;\n } catch {\n // Ignore malformed package.json and keep walking.\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Locate a content-asset directory inside the package. Prefers the in-repo\n * **source** dir `<pkgRoot>/<subdir>` when present — in a dev checkout it is the\n * full tree (e.g. `factory-assets/` keeps the connector `.ts` entry files that\n * `dist/` does not) — then the published `dist/<subdir>` copy (what\n * `files: [\"dist\"]` ships, the only one present after `npm i`). Returns `null`\n * when neither exists.\n *\n * `factory-assets/` resolves to the source tree in dev (code + skills + bundles)\n * and to `dist/factory-assets` post-install (compiled connectors + copied\n * manifests/skills/bundles).\n *\n * @param subdir - `\"factory-assets\"` | …\n * @docLink packages/core/concepts#resolve-factory-assets-root\n */\nexport function resolvePackagedAssetsDir(subdir: string): string | null {\n const root = resolveWorkspacesPackageRoot();\n if (!root) return null;\n for (const cand of [join(root, subdir), join(root, \"dist\", subdir)]) {\n if (existsSync(cand)) return cand;\n }\n return null;\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────────\n\nconst CONNECTOR_SCAN_KINDS: ReadonlySet<string> = new Set([\"connector\"]);\n\nasync function populate(\n projectDir: string,\n target: RuntimeAssetsResult,\n options: RuntimeAssetsOptions,\n): Promise<void> {\n target.catalogEntries = [];\n target.implicitRefs = [];\n target.requiredNpmDeps = { required: [], optional: [] };\n target.warnings = [];\n\n const config = resolveSkWorkspaceConfig(projectDir);\n // Connector catalog scan runs over the project's declared sources[] (resolved\n // to their machine-cache clone paths) plus the implicit factory-assets repo.\n const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));\n const links = readLinks(projectDir);\n\n // Scan each repository for connector entries.\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = await resolveRepoDir(name, decl, projectDir, links);\n if (!repoDir) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: repoUnavailableMessage(name, decl),\n });\n continue;\n }\n try {\n // Both factory layers carry the same `factory-assets` provenance — the\n // override repo is an internal scan-order device, not a distinct source.\n const repoName = name === FACTORY_ASSETS_OVERRIDE_REPO_NAME ? FACTORY_ASSETS_REPO_NAME : name;\n // Only connector descriptors are consumed here, so only that kind is\n // \"known\": typed manifests of any other kind are irrelevant to this scan.\n const scanned = await scanDirectory(repoDir, repoName, {\n knownKinds: CONNECTOR_SCAN_KINDS,\n onDiagnostic: () => {},\n });\n const entries = scanned.filter((e) => e.kind === \"connector\");\n target.catalogEntries.push(...entries);\n } catch (err) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: `Failed to scan repository \"${name}\" at ${repoDir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n });\n }\n }\n\n // De-duplicate by (kind, name), keeping the first occurrence. Scan order is\n // declared sources → env override → bundled baseline, so an env-supplied\n // connector manifest overrides the bundled one and the bundled one fills the\n // rest (the override layer can refresh built-in manifests in place).\n const seen = new Set<string>();\n target.catalogEntries = target.catalogEntries.filter((e) => {\n const key = `${e.kind}:${e.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n\n // Derive implicit refs from skaile.yaml connectors.\n for (const [index, c] of (config.connectors ?? []).entries()) {\n // No `driver` (a misspelt or old `adapter:` key): say so with the text `validate` prints,\n // not a warning about the driver `\"undefined\"` (p1739).\n if (typeof c.driver !== \"string\" || c.driver === \"\") {\n const legacy = (c as unknown as Record<string, unknown>).adapter;\n const label = typeof c.id === \"string\" && c.id !== \"\" ? `\"${c.id}\"` : `#${index + 1}`;\n target.warnings.push({\n code: \"missing_driver\",\n ...(typeof c.id === \"string\" && c.id !== \"\" ? { declarationId: c.id } : {}),\n message:\n legacy !== undefined\n ? `Connector ${label} sets \\`adapter: ${String(legacy)}\\`; the key is \\`driver\\`. Rename \\`adapter\\` to \\`driver\\`.`\n : `Connector ${label} has no \\`driver\\`; the runner cannot mount it. Add \\`driver: <name>\\`.`,\n });\n continue;\n }\n target.implicitRefs.push({ kind: \"connector\", name: c.driver, declarationId: c.id });\n }\n\n // Validate refs and aggregate npm deps.\n const requiredSet = new Set<string>();\n const optionalSet = new Set<string>();\n for (const ref of target.implicitRefs) {\n const entry = findCatalogEntry(target.catalogEntries, ref);\n // A plugin's connector has no catalog entry: the process registry knows it.\n if (!entry && options.isDriverRegistered?.(ref.name)) continue;\n if (!entry) {\n target.warnings.push({\n code: \"missing_driver\",\n declarationId: ref.declarationId,\n name: ref.name,\n message:\n `Unknown ${ref.kind} driver \"${ref.name}\" referenced by ${ref.kind} \"${ref.declarationId}\". ` +\n `Run \\`skaile ${ref.kind} catalog\\` to see available drivers, ` +\n `or declare a repository in skaile.yaml that provides this driver.`,\n });\n continue;\n }\n const npm = (entry.metadata?.npm_deps ?? {}) as { required?: string[]; optional?: string[] };\n for (const p of npm.required ?? []) requiredSet.add(p);\n for (const p of npm.optional ?? []) optionalSet.add(p);\n }\n target.requiredNpmDeps.required = [...requiredSet];\n target.requiredNpmDeps.optional = [...optionalSet];\n}\n\n/**\n * Build the effective `repositories` map: caller's declarations first, then the\n * implicit built-in `factory-assets` repos. Each {@link factoryAssetRoots} layer\n * becomes its own repo, the env override inserted **before** the bundled\n * baseline so its connector entries win on the first-match dedup downstream.\n * When the package cannot be located at all, a path-less sentinel under\n * {@link FACTORY_ASSETS_REPO_NAME} drives the `repo_unavailable` warning.\n */\nfunction buildEffectiveRepositories(\n declared: Record<string, SourceDeclaration> | undefined,\n): Record<string, SourceDeclaration> {\n const result: Record<string, SourceDeclaration> = { ...(declared ?? {}) };\n const roots = factoryAssetRoots();\n if (roots.length === 0) {\n // Surface as a warning during scan rather than throwing here — let the\n // caller decide whether factory-assets is required. resolveRepoDir() /\n // repoUnavailableMessage re-discover the failure and emit it.\n if (!result[FACTORY_ASSETS_REPO_NAME]) result[FACTORY_ASSETS_REPO_NAME] = { path: \"\" };\n return result;\n }\n // override-first when both layers exist, so the env root's entries are scanned\n // (and matched) ahead of the bundled baseline.\n const keys =\n roots.length > 1\n ? [FACTORY_ASSETS_OVERRIDE_REPO_NAME, FACTORY_ASSETS_REPO_NAME]\n : [FACTORY_ASSETS_REPO_NAME];\n roots.forEach((dir, i) => {\n const key = keys[i] ?? `${FACTORY_ASSETS_REPO_NAME}:${i}`;\n if (!result[key]) result[key] = { path: dir };\n });\n return result;\n}\n\n/**\n * Resolve a repository declaration to an on-disk directory. Order:\n * 1. Linked override (`.skaile/links.yaml`).\n * 2. Local `path` — relative to `projectDir`.\n * 3. Cloned URL repo at `.skaile/cache/sources/<name>/` (must already exist).\n *\n * Returns `null` when none of these resolve. Does not clone.\n *\n * **Async and deadline-bounded since #454.** Every candidate here is a\n * project-relative or operator-supplied path, so a `sources[].path` of\n * `workspace/my-assets` resolves onto the rclone FUSE mount — the same tree the\n * scan that follows walks. Probing it with `existsSync`/`lstatSync` would park\n * the `skaile serve` event loop *before* the (now async) scan ever ran, which\n * would leave the H2 fix meaningless on the very declaration that triggers it.\n * A probe that misses its deadline reads as \"unavailable\", which is what the\n * caller already does with an absent path — it becomes a `repo_unavailable`\n * warning rather than a stall.\n */\nasync function resolveRepoDir(\n name: string,\n decl: SourceDeclaration,\n projectDir: string,\n links: Record<string, string>,\n): Promise<string | null> {\n // 1. Linked override\n const linked = links[name];\n if (linked && (await pathExists(linked))) return linked;\n\n // 2. Local path\n if (decl.path) {\n const resolved = resolvePath(projectDir, decl.path);\n return (await pathExists(resolved)) ? resolved : null;\n }\n\n // 3. URL repo cloned to project's .skaile/cache/sources/<name> — the\n // project-local clone dir (often a symlink into the global cache, which\n // lives at getGlobalCacheDir()); NOT the global clone root itself.\n if (decl.url) {\n const projectDest = join(projectDir, \".skaile\", \"cache\", \"sources\", name);\n // One `lstat` answers both questions the pre-#454 `existsSync` + `lstatSync`\n // pair asked, and `lstat` (not `stat`) keeps the \"a symlink into the global\n // cache counts\" behaviour intact.\n const found = await tryWithFsDeadline(\n `lstat ${projectDest}`,\n async () => {\n await lstat(projectDest);\n return true;\n },\n false,\n );\n return found ? projectDest : null;\n }\n\n return null;\n}\n\n/** Deadline-bounded `existsSync` replacement — a wedged mount reads as absent. */\nfunction pathExists(path: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${path}`,\n async () => {\n await stat(path);\n return true;\n },\n false,\n );\n}\n\nfunction repoUnavailableMessage(name: string, decl: SourceDeclaration): string {\n if (name === FACTORY_ASSETS_REPO_NAME && !decl.path && !decl.url) {\n return (\n `Cannot resolve the built-in factory-assets. ` +\n `Set SKAILE_FACTORY_ASSETS_DIR or ensure @skaile/workspaces is installed.`\n );\n }\n if (decl.url) {\n return `Repository \"${name}\" (${decl.url}) is not available. Register it as a Library Source via \\`skaile source add\\`.`;\n }\n if (decl.path) {\n return `Repository \"${name}\" path not found: ${decl.path}`;\n }\n return `Repository \"${name}\" has neither url nor path.`;\n}\n\nfunction findCatalogEntry(\n entries: RuntimeCatalogEntry[],\n query: { kind?: \"connector\"; name: string },\n): RuntimeCatalogEntry | undefined {\n if (query.kind) {\n return entries.find((e) => e.kind === query.kind && e.name === query.name);\n }\n const matches = entries.filter((e) => e.name === query.name);\n if (matches.length === 1) return matches[0];\n // 0 or >1 with no kind — caller must disambiguate.\n return undefined;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { registryCredentialEnv, providerCredentialEnvName, BUILTIN_HARNESS_CATALOG } from './chunk-7TF5MNFK.js';
1
+ import { registryCredentialEnv, providerCredentialEnvName, BUILTIN_HARNESS_CATALOG } from './chunk-S6NS3I3P.js';
2
2
  import { getProviderPreset } from './chunk-6UP2EDFN.js';
3
3
  import { mergeRegistries, resolveEntryBaseUrl, normalizeEntryBaseUrl, registryEntries, isEntryEnabled, parseModelRef } from './chunk-RXGPFAMN.js';
4
4
 
@@ -138,5 +138,5 @@ function continueRoleBinding(session) {
138
138
  }
139
139
 
140
140
  export { bindSingleProviderEntry, continueRoleBinding, credentialsForEveryProvider, entryBaseUrl, entryModelIds, entrySurface, harnessModelSelector, harnessProviderName, isStockCatalogEndpoint, registryModelEntries, resolveEnvHarnessSession, resolveRegistryBinding, selectableEntries, versionedAnthropicBaseUrl };
141
- //# sourceMappingURL=chunk-RP3ML3QD.js.map
142
- //# sourceMappingURL=chunk-RP3ML3QD.js.map
141
+ //# sourceMappingURL=chunk-CLMIZ4N6.js.map
142
+ //# sourceMappingURL=chunk-CLMIZ4N6.js.map
@@ -1 +1 @@
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,QAA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,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-RP3ML3QD.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"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AAA,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-CLMIZ4N6.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,5 +1,5 @@
1
- import { compositeSha256 } from './chunk-QC5BYUED.js';
2
- import { parseAssetRef } from './chunk-V5KG6CCV.js';
1
+ import { compositeSha256 } from './chunk-MS2IXLTC.js';
2
+ import { parseAssetRef } from './chunk-7HRZACI4.js';
3
3
  import { createHash } from 'crypto';
4
4
  import { openSync, fstatSync, readSync, chmodSync, closeSync } from 'fs';
5
5
  import { rm, mkdir, writeFile, chmod } from 'fs/promises';
@@ -146,5 +146,5 @@ async function installFlat(manifest, targetDir, fetcher) {
146
146
  }
147
147
 
148
148
  export { assertSafeManifestPath, installFromManifest, isScriptBytes, longestCommonDirPrefix, restoreScriptModes };
149
- //# sourceMappingURL=chunk-OSABUEWA.js.map
150
- //# sourceMappingURL=chunk-OSABUEWA.js.map
149
+ //# sourceMappingURL=chunk-CVUMZTNO.js.map
150
+ //# sourceMappingURL=chunk-CVUMZTNO.js.map