@skaile/workspaces 6.1.0 → 6.3.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 (406) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/ai-sdk.d.ts +2 -0
  3. package/dist/ai-sdk.js +111 -0
  4. package/dist/ai-sdk.js.map +1 -0
  5. package/dist/{asset-feeds-HJFV7UPW.js → asset-feeds-3YO2352Y.js} +26 -26
  6. package/dist/{asset-feeds-HJFV7UPW.js.map → asset-feeds-3YO2352Y.js.map} +1 -1
  7. package/dist/asset-manager/catalog-deployer.js +10 -10
  8. package/dist/asset-manager/fragments.js +1 -1
  9. package/dist/asset-manager/index.js +18 -18
  10. package/dist/asset-manager/installer.js +13 -13
  11. package/dist/asset-manager/renderers.js +11 -11
  12. package/dist/asset-manager/src/index.d.ts +149 -16
  13. package/dist/asset-manager/src/index.d.ts.map +1 -1
  14. package/dist/asset-manager/src/installer.d.ts +9 -0
  15. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  16. package/dist/asset-manager/src/renderers.d.ts +7 -0
  17. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  18. package/dist/bridge/harnesses/claude-sdk.js +16 -15
  19. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  20. package/dist/bridge/harnesses/codex.js +25 -17
  21. package/dist/bridge/harnesses/codex.js.map +1 -1
  22. package/dist/bridge/harnesses/continue.js +15 -14
  23. package/dist/bridge/harnesses/continue.js.map +1 -1
  24. package/dist/bridge/harnesses/echo.js +5 -4
  25. package/dist/bridge/harnesses/echo.js.map +1 -1
  26. package/dist/bridge/harnesses/gemini.js +11 -10
  27. package/dist/bridge/harnesses/goose.js +15 -14
  28. package/dist/bridge/harnesses/goose.js.map +1 -1
  29. package/dist/bridge/harnesses/omp.js +16 -8
  30. package/dist/bridge/harnesses/omp.js.map +1 -1
  31. package/dist/bridge/harnesses/opencode.js +15 -14
  32. package/dist/bridge/harnesses/opencode.js.map +1 -1
  33. package/dist/bridge/harnesses/qwen.js +11 -10
  34. package/dist/bridge/harnesses/qwen.js.map +1 -1
  35. package/dist/bridge/index.js +21 -19
  36. package/dist/bridge/src/ai-sdk.d.ts +46 -0
  37. package/dist/bridge/src/ai-sdk.d.ts.map +1 -0
  38. package/dist/bridge/src/harness-model-check.d.ts +15 -0
  39. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  40. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -1
  41. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  42. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  43. package/dist/bridge/src/index.d.ts +2 -1
  44. package/dist/bridge/src/index.d.ts.map +1 -1
  45. package/dist/bridge/src/provider-registry-load.d.ts +30 -0
  46. package/dist/bridge/src/provider-registry-load.d.ts.map +1 -0
  47. package/dist/bridge/src/runner-private-env.d.ts +7 -0
  48. package/dist/bridge/src/runner-private-env.d.ts.map +1 -1
  49. package/dist/{chunk-SVTMNSPI.js → chunk-2TFKXSB5.js} +5 -5
  50. package/dist/{chunk-SVTMNSPI.js.map → chunk-2TFKXSB5.js.map} +1 -1
  51. package/dist/{chunk-NB7SYQYP.js → chunk-32FYVSSW.js} +9 -28
  52. package/dist/chunk-32FYVSSW.js.map +1 -0
  53. package/dist/{chunk-QAKUD6QN.js → chunk-4QRJBY2P.js} +3 -3
  54. package/dist/{chunk-QAKUD6QN.js.map → chunk-4QRJBY2P.js.map} +1 -1
  55. package/dist/{chunk-XFIEVEU7.js → chunk-6OHZUUR7.js} +5 -4
  56. package/dist/chunk-6OHZUUR7.js.map +1 -0
  57. package/dist/{chunk-ILLTBKDJ.js → chunk-6UP2EDFN.js} +4 -313
  58. package/dist/chunk-6UP2EDFN.js.map +1 -0
  59. package/dist/{chunk-ZDLUQLI6.js → chunk-6WH2WE4B.js} +15 -5
  60. package/dist/chunk-6WH2WE4B.js.map +1 -0
  61. package/dist/{chunk-HPMQRAIF.js → chunk-72NT2TJU.js} +8 -7
  62. package/dist/chunk-72NT2TJU.js.map +1 -0
  63. package/dist/{chunk-E572OHGY.js → chunk-76FLBODK.js} +4 -3
  64. package/dist/chunk-76FLBODK.js.map +1 -0
  65. package/dist/{chunk-5Y2KGB4H.js → chunk-7MV3NHPT.js} +35 -9
  66. package/dist/chunk-7MV3NHPT.js.map +1 -0
  67. package/dist/{chunk-QEULL4Q3.js → chunk-7QG2WRSN.js} +77 -18
  68. package/dist/chunk-7QG2WRSN.js.map +1 -0
  69. package/dist/{chunk-6YR4ALVX.js → chunk-7RH6E332.js} +7 -7
  70. package/dist/{chunk-6YR4ALVX.js.map → chunk-7RH6E332.js.map} +1 -1
  71. package/dist/{chunk-BBBCJSSU.js → chunk-7TSNR5H5.js} +4 -4
  72. package/dist/{chunk-BBBCJSSU.js.map → chunk-7TSNR5H5.js.map} +1 -1
  73. package/dist/{chunk-3GMOPFWH.js → chunk-AMJ6KEV7.js} +4 -4
  74. package/dist/{chunk-3GMOPFWH.js.map → chunk-AMJ6KEV7.js.map} +1 -1
  75. package/dist/{chunk-X3YGUKCG.js → chunk-BPTWWKGF.js} +3 -3
  76. package/dist/{chunk-X3YGUKCG.js.map → chunk-BPTWWKGF.js.map} +1 -1
  77. package/dist/{chunk-Z7ZEZZB6.js → chunk-C5HFK34M.js} +3 -3
  78. package/dist/chunk-C5HFK34M.js.map +1 -0
  79. package/dist/{chunk-EJPMNDTP.js → chunk-COUJOTAJ.js} +3 -3
  80. package/dist/{chunk-EJPMNDTP.js.map → chunk-COUJOTAJ.js.map} +1 -1
  81. package/dist/{chunk-J72MO2WA.js → chunk-DU26AVK2.js} +10 -9
  82. package/dist/chunk-DU26AVK2.js.map +1 -0
  83. package/dist/{chunk-YLLVSR2U.js → chunk-E5NQRHEB.js} +30 -7
  84. package/dist/chunk-E5NQRHEB.js.map +1 -0
  85. package/dist/{chunk-XGULGQA3.js → chunk-ELSGFI3I.js} +5 -4
  86. package/dist/chunk-ELSGFI3I.js.map +1 -0
  87. package/dist/{chunk-IHFGPHCT.js → chunk-EQNIBBB6.js} +49 -25
  88. package/dist/chunk-EQNIBBB6.js.map +1 -0
  89. package/dist/{chunk-BFMYYNDT.js → chunk-F3D25RGM.js} +11 -3
  90. package/dist/chunk-F3D25RGM.js.map +1 -0
  91. package/dist/{chunk-GNZBFSRB.js → chunk-H622YULS.js} +5 -4
  92. package/dist/chunk-H622YULS.js.map +1 -0
  93. package/dist/{chunk-FKQNBCDW.js → chunk-HDVLBEEX.js} +4 -4
  94. package/dist/{chunk-FKQNBCDW.js.map → chunk-HDVLBEEX.js.map} +1 -1
  95. package/dist/{chunk-AATHJRKL.js → chunk-HGOJEVHY.js} +4 -4
  96. package/dist/{chunk-AATHJRKL.js.map → chunk-HGOJEVHY.js.map} +1 -1
  97. package/dist/{chunk-CEKW3KXP.js → chunk-HH2H2ZV7.js} +18 -15
  98. package/dist/chunk-HH2H2ZV7.js.map +1 -0
  99. package/dist/{chunk-ZFUZ5AKM.js → chunk-HTGTNN2B.js} +3 -3
  100. package/dist/{chunk-ZFUZ5AKM.js.map → chunk-HTGTNN2B.js.map} +1 -1
  101. package/dist/{chunk-LSSYC5IC.js → chunk-IZQOO6MN.js} +2 -2
  102. package/dist/{chunk-LSSYC5IC.js.map → chunk-IZQOO6MN.js.map} +1 -1
  103. package/dist/{chunk-VMVDAZLA.js → chunk-J5JRGBKK.js} +108 -19
  104. package/dist/chunk-J5JRGBKK.js.map +1 -0
  105. package/dist/{chunk-7LP7RCZI.js → chunk-JGH7NB47.js} +5 -5
  106. package/dist/{chunk-7LP7RCZI.js.map → chunk-JGH7NB47.js.map} +1 -1
  107. package/dist/{chunk-RHN5MRQO.js → chunk-JMIKGAUA.js} +27 -5
  108. package/dist/chunk-JMIKGAUA.js.map +1 -0
  109. package/dist/{chunk-HWNK3F3X.js → chunk-KGHYXXXV.js} +588 -76
  110. package/dist/chunk-KGHYXXXV.js.map +1 -0
  111. package/dist/{chunk-7HX6FNKL.js → chunk-KIPCBIFJ.js} +41 -56
  112. package/dist/chunk-KIPCBIFJ.js.map +1 -0
  113. package/dist/{chunk-ZBHZLWV3.js → chunk-KPKGWXUJ.js} +4 -4
  114. package/dist/{chunk-ZBHZLWV3.js.map → chunk-KPKGWXUJ.js.map} +1 -1
  115. package/dist/{chunk-ABFPSVIS.js → chunk-LD6O6QKU.js} +31 -7
  116. package/dist/chunk-LD6O6QKU.js.map +1 -0
  117. package/dist/{chunk-AZ2H6R5I.js → chunk-LEJQAX7G.js} +74 -39
  118. package/dist/chunk-LEJQAX7G.js.map +1 -0
  119. package/dist/{chunk-ZAELRYKS.js → chunk-MD3FUZS3.js} +3 -3
  120. package/dist/{chunk-ZAELRYKS.js.map → chunk-MD3FUZS3.js.map} +1 -1
  121. package/dist/{chunk-NUA33BYO.js → chunk-MYXFR27L.js} +42 -15
  122. package/dist/chunk-MYXFR27L.js.map +1 -0
  123. package/dist/{chunk-KUQAJVYT.js → chunk-PHAMYCZH.js} +142 -28
  124. package/dist/chunk-PHAMYCZH.js.map +1 -0
  125. package/dist/{chunk-NOA6EJXE.js → chunk-PKE3PXOK.js} +3 -3
  126. package/dist/{chunk-NOA6EJXE.js.map → chunk-PKE3PXOK.js.map} +1 -1
  127. package/dist/{chunk-RDTLPOPD.js → chunk-PL52CI4U.js} +4 -4
  128. package/dist/{chunk-RDTLPOPD.js.map → chunk-PL52CI4U.js.map} +1 -1
  129. package/dist/{chunk-VYVTEMAW.js → chunk-PNUM7GUY.js} +3 -3
  130. package/dist/{chunk-VYVTEMAW.js.map → chunk-PNUM7GUY.js.map} +1 -1
  131. package/dist/{chunk-DIGFA7Z5.js → chunk-Q7CU5GQO.js} +13 -5
  132. package/dist/chunk-Q7CU5GQO.js.map +1 -0
  133. package/dist/chunk-QFFMFZIR.js +32 -0
  134. package/dist/chunk-QFFMFZIR.js.map +1 -0
  135. package/dist/{chunk-HMISULVD.js → chunk-QK7AG5AV.js} +4 -4
  136. package/dist/{chunk-HMISULVD.js.map → chunk-QK7AG5AV.js.map} +1 -1
  137. package/dist/{chunk-2LAPHLDH.js → chunk-QTLUZUF2.js} +45 -35
  138. package/dist/chunk-QTLUZUF2.js.map +1 -0
  139. package/dist/{chunk-4MUDQCBP.js → chunk-RFQONXET.js} +3 -3
  140. package/dist/{chunk-4MUDQCBP.js.map → chunk-RFQONXET.js.map} +1 -1
  141. package/dist/{chunk-AITJ7ELM.js → chunk-ROVZCGTN.js} +59 -23
  142. package/dist/chunk-ROVZCGTN.js.map +1 -0
  143. package/dist/{chunk-LSI2IVFT.js → chunk-RXGPFAMN.js} +4 -3
  144. package/dist/chunk-RXGPFAMN.js.map +1 -0
  145. package/dist/chunk-S6KZHPR4.js +315 -0
  146. package/dist/chunk-S6KZHPR4.js.map +1 -0
  147. package/dist/{chunk-EX3GLAL6.js → chunk-TGV2EWGL.js} +5 -5
  148. package/dist/{chunk-EX3GLAL6.js.map → chunk-TGV2EWGL.js.map} +1 -1
  149. package/dist/{chunk-QSYQOTWN.js → chunk-TO5SSMRI.js} +58 -5
  150. package/dist/chunk-TO5SSMRI.js.map +1 -0
  151. package/dist/{chunk-Z3VKUWAX.js → chunk-TSTRH4SM.js} +3 -3
  152. package/dist/{chunk-Z3VKUWAX.js.map → chunk-TSTRH4SM.js.map} +1 -1
  153. package/dist/{chunk-5J4NPGFM.js → chunk-U3SXCVR7.js} +5 -5
  154. package/dist/{chunk-5J4NPGFM.js.map → chunk-U3SXCVR7.js.map} +1 -1
  155. package/dist/{chunk-IRYKRKVQ.js → chunk-URCJIV7T.js} +3 -3
  156. package/dist/{chunk-IRYKRKVQ.js.map → chunk-URCJIV7T.js.map} +1 -1
  157. package/dist/{chunk-ASWTQQ7E.js → chunk-V5BPDB4J.js} +3 -3
  158. package/dist/{chunk-ASWTQQ7E.js.map → chunk-V5BPDB4J.js.map} +1 -1
  159. package/dist/{chunk-ADPM6AYF.js → chunk-VSX2G7LA.js} +3 -3
  160. package/dist/{chunk-ADPM6AYF.js.map → chunk-VSX2G7LA.js.map} +1 -1
  161. package/dist/{chunk-4FVIT5DI.js → chunk-VUWRGMT6.js} +3 -3
  162. package/dist/{chunk-4FVIT5DI.js.map → chunk-VUWRGMT6.js.map} +1 -1
  163. package/dist/{chunk-ZHGKAZJ7.js → chunk-XBQTXGY4.js} +56 -8
  164. package/dist/chunk-XBQTXGY4.js.map +1 -0
  165. package/dist/{chunk-UI745XC3.js → chunk-XEVFSDIF.js} +13 -7
  166. package/dist/chunk-XEVFSDIF.js.map +1 -0
  167. package/dist/{chunk-S2XHGWQC.js → chunk-Y3I4KGLX.js} +44 -15
  168. package/dist/chunk-Y3I4KGLX.js.map +1 -0
  169. package/dist/{chunk-COYF6IG2.js → chunk-YW4ASEUP.js} +5 -5
  170. package/dist/{chunk-COYF6IG2.js.map → chunk-YW4ASEUP.js.map} +1 -1
  171. package/dist/{chunk-DGTI65OC.js → chunk-ZEH4WFEG.js} +17 -11
  172. package/dist/chunk-ZEH4WFEG.js.map +1 -0
  173. package/dist/{claude-code-RE46FJXI.js → claude-code-EUKDGOOO.js} +5 -5
  174. package/dist/{claude-code-RE46FJXI.js.map → claude-code-EUKDGOOO.js.map} +1 -1
  175. package/dist/cli/index.js +350 -141
  176. package/dist/cli/index.js.map +1 -1
  177. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  178. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  179. package/dist/cli/src/commands/config.d.ts.map +1 -1
  180. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  181. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  182. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  183. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  184. package/dist/cli/src/commands/library-index.d.ts +8 -1
  185. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  186. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  187. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  188. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  189. package/dist/cli/src/commands/project.d.ts.map +1 -1
  190. package/dist/cli/src/commands/providers.d.ts.map +1 -1
  191. package/dist/cli/src/commands/rebuild.d.ts.map +1 -1
  192. package/dist/cli/src/commands/run.d.ts.map +1 -1
  193. package/dist/cli/src/commands/serve-preflight.d.ts +31 -1
  194. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  195. package/dist/cli/src/commands/serve.d.ts +10 -0
  196. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  197. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  198. package/dist/cli/src/commands/source-manifest.d.ts +19 -7
  199. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  200. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
  201. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  202. package/dist/cli/src/commands/why.d.ts.map +1 -1
  203. package/dist/cli/src/config-checks.d.ts +23 -5
  204. package/dist/cli/src/config-checks.d.ts.map +1 -1
  205. package/dist/cli/src/harness-error.d.ts +12 -1
  206. package/dist/cli/src/harness-error.d.ts.map +1 -1
  207. package/dist/cli/src/helpers.d.ts +18 -8
  208. package/dist/cli/src/helpers.d.ts.map +1 -1
  209. package/dist/cli/src/plugin-store/index.d.ts +10 -1
  210. package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
  211. package/dist/cli/src/plugin-store/spec.d.ts +8 -0
  212. package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
  213. package/dist/cli/src/skill-checks.d.ts +2 -2
  214. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  215. package/dist/connectors/config.js +5 -5
  216. package/dist/connectors/index.js +24 -22
  217. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  218. package/dist/connectors-XYPE2DCQ.js +50 -0
  219. package/dist/{connectors-7THEF7YA.js.map → connectors-XYPE2DCQ.js.map} +1 -1
  220. package/dist/core/framework.js +1 -1
  221. package/dist/core/index.js +9 -9
  222. package/dist/core/manifest.js +2 -2
  223. package/dist/core/models.js +1 -1
  224. package/dist/core/provider-registry-credentials.js +2 -2
  225. package/dist/core/provider-registry.js +1 -1
  226. package/dist/core/publish-manifest.js +3 -3
  227. package/dist/core/ref.js +1 -1
  228. package/dist/core/runtime-assets.js +5 -5
  229. package/dist/core/src/framework.d.ts +5 -3
  230. package/dist/core/src/framework.d.ts.map +1 -1
  231. package/dist/core/src/index.d.ts +2 -1
  232. package/dist/core/src/index.d.ts.map +1 -1
  233. package/dist/core/src/lock.d.ts +12 -0
  234. package/dist/core/src/lock.d.ts.map +1 -1
  235. package/dist/core/src/manifest.d.ts +15 -0
  236. package/dist/core/src/manifest.d.ts.map +1 -1
  237. package/dist/core/src/models.d.ts +7 -0
  238. package/dist/core/src/models.d.ts.map +1 -1
  239. package/dist/core/src/provider-registry.d.ts +6 -0
  240. package/dist/core/src/provider-registry.d.ts.map +1 -1
  241. package/dist/core/src/workspace-config.d.ts +10 -1
  242. package/dist/core/src/workspace-config.d.ts.map +1 -1
  243. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  244. package/dist/core/workspace-config.js +4 -4
  245. package/dist/deploy/index.js +9 -9
  246. package/dist/discovery/index.js +5 -5
  247. package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
  248. package/dist/{ensure-sources-IH7CHSJF.js → ensure-sources-IN3VKHUA.js} +37 -21
  249. package/dist/ensure-sources-IN3VKHUA.js.map +1 -0
  250. package/dist/factory-assets/connectors/box.js +24 -22
  251. package/dist/factory-assets/connectors/deploy.js +24 -22
  252. package/dist/factory-assets/connectors/devserver.js +24 -22
  253. package/dist/factory-assets/connectors/flow/adapter.js +24 -22
  254. package/dist/factory-assets/connectors/flow/engine.js +10 -10
  255. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  256. package/dist/factory-assets/connectors/flow/run-flow.js +26 -24
  257. package/dist/factory-assets/connectors/flow.js +24 -22
  258. package/dist/factory-assets/connectors/git.js +24 -22
  259. package/dist/factory-assets/connectors/gmail.js +24 -22
  260. package/dist/factory-assets/connectors/googledrive.js +24 -22
  261. package/dist/factory-assets/connectors/local.js +24 -22
  262. package/dist/factory-assets/connectors/mattermost.js +24 -22
  263. package/dist/factory-assets/connectors/memory.js +24 -22
  264. package/dist/factory-assets/connectors/minio.js +24 -22
  265. package/dist/factory-assets/connectors/postgres.js +24 -22
  266. package/dist/factory-assets/connectors/s3.js +24 -22
  267. package/dist/factory-assets/connectors/sharepoint.js +24 -22
  268. package/dist/factory-assets/connectors/sqlite.js +24 -22
  269. package/dist/factory-assets/connectors/static-server.js +24 -22
  270. package/dist/factory-assets/connectors/tunnel.js +24 -22
  271. package/dist/factory-assets/connectors/webdav.js +24 -22
  272. package/dist/factory-assets/connectors/xstate-store.js +24 -22
  273. package/dist/factory-assets/connectors/xstate.js +24 -22
  274. package/dist/flows-QAO63TDV.js +26 -0
  275. package/dist/{flows-4JZQ3XFK.js.map → flows-QAO63TDV.js.map} +1 -1
  276. package/dist/helpers-HDVGCF3M.js +54 -0
  277. package/dist/{helpers-JNMK3FC2.js.map → helpers-HDVGCF3M.js.map} +1 -1
  278. package/dist/library/index.js +14 -14
  279. package/dist/library/install.js +5 -5
  280. package/dist/library/src/index.d.ts +1 -1
  281. package/dist/library/src/index.d.ts.map +1 -1
  282. package/dist/library/src/install/index.d.ts +1 -1
  283. package/dist/library/src/install/index.d.ts.map +1 -1
  284. package/dist/library/src/install/install-from-manifest.d.ts +13 -0
  285. package/dist/library/src/install/install-from-manifest.d.ts.map +1 -1
  286. package/dist/library/src/install/source-fetch-github.d.ts.map +1 -1
  287. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  288. package/dist/library/src/remote/remote-catalog-source.d.ts +3 -1
  289. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  290. package/dist/library/src/remote/rest-catalog-source.d.ts +3 -2
  291. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  292. package/dist/{library-publish-I3UWXAHI.js → library-publish-62OWCNB5.js} +56 -55
  293. package/dist/library-publish-62OWCNB5.js.map +1 -0
  294. package/dist/model-endpoint/index.js +13 -12
  295. package/dist/model-endpoint/src/openai-chat.d.ts +7 -2
  296. package/dist/model-endpoint/src/openai-chat.d.ts.map +1 -1
  297. package/dist/model-endpoint/src/openai-shared.d.ts +8 -0
  298. package/dist/model-endpoint/src/openai-shared.d.ts.map +1 -1
  299. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  300. package/dist/model-endpoint/src/types.d.ts +1 -1
  301. package/dist/model-endpoint/src/types.d.ts.map +1 -1
  302. package/dist/model-endpoint/src/usage-cost.d.ts +23 -0
  303. package/dist/model-endpoint/src/usage-cost.d.ts.map +1 -0
  304. package/dist/open-library-TZ7OSDEJ.js +58 -0
  305. package/dist/{open-library-NKKUJLWA.js.map → open-library-TZ7OSDEJ.js.map} +1 -1
  306. package/dist/open-registry-RLZKTJG3.js +32 -0
  307. package/dist/{open-registry-BYAXSHUI.js.map → open-registry-RLZKTJG3.js.map} +1 -1
  308. package/dist/paths-D6LBQETQ.js +22 -0
  309. package/dist/{paths-UKWE35XS.js.map → paths-D6LBQETQ.js.map} +1 -1
  310. package/dist/plugin-store-A5J4TLCH.js +23 -0
  311. package/dist/{plugin-store-ABE35NRX.js.map → plugin-store-A5J4TLCH.js.map} +1 -1
  312. package/dist/project-4AVRES3M.js +88 -0
  313. package/dist/{project-BIPK47JK.js.map → project-4AVRES3M.js.map} +1 -1
  314. package/dist/resolver/index.js +10 -10
  315. package/dist/runner/index.js +41 -39
  316. package/dist/runner/src/capability-roundtrip.d.ts +7 -6
  317. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  318. package/dist/runner/src/serve.d.ts +6 -5
  319. package/dist/runner/src/serve.d.ts.map +1 -1
  320. package/dist/sdk/asset-manager.js +18 -18
  321. package/dist/sdk/bridge.js +21 -19
  322. package/dist/sdk/core.js +9 -9
  323. package/dist/sdk/flow.js +10 -10
  324. package/dist/sdk/index.js +41 -39
  325. package/dist/sdk/index.js.map +1 -1
  326. package/dist/sdk/resolver.js +10 -10
  327. package/dist/sdk/runner.js +41 -39
  328. package/dist/sdk/transport/ws/server.js +10 -10
  329. package/dist/sdk/transport/ws.js +10 -10
  330. package/dist/sdk/transport.js +10 -10
  331. package/dist/{serve-preflight-FLTIBTEX.js → serve-preflight-H2AYMGJ6.js} +65 -35
  332. package/dist/serve-preflight-H2AYMGJ6.js.map +1 -0
  333. package/dist/{setup-AG6NFHSN.js → setup-NSPQD4V4.js} +33 -31
  334. package/dist/setup-NSPQD4V4.js.map +1 -0
  335. package/dist/skills-B533SRVZ.js +26 -0
  336. package/dist/{skills-UQYUHVKO.js.map → skills-B533SRVZ.js.map} +1 -1
  337. package/dist/source-VTECABUO.js +87 -0
  338. package/dist/{source-ASEHI2XS.js.map → source-VTECABUO.js.map} +1 -1
  339. package/dist/source-fetch-github-RWHV4I5Z.js +4 -0
  340. package/dist/{source-fetch-github-ST4MFL3D.js.map → source-fetch-github-RWHV4I5Z.js.map} +1 -1
  341. package/dist/{source-manifest-publish-IEVV3W6J.js → source-manifest-publish-YORI42MN.js} +56 -56
  342. package/dist/source-manifest-publish-YORI42MN.js.map +1 -0
  343. package/dist/transport/index.js +10 -10
  344. package/dist/transport/ws/server.js +10 -10
  345. package/dist/transport/ws.js +10 -10
  346. package/dist/tui/index.js +49 -40
  347. package/dist/tui/index.js.map +1 -1
  348. package/dist/tui/src/repl.d.ts.map +1 -1
  349. package/dist/types/manifests.js +1 -1
  350. package/dist/types/src/manifests/index.d.ts +1 -1
  351. package/dist/types/src/manifests/index.d.ts.map +1 -1
  352. package/dist/types/src/manifests/scaffold-body.d.ts +2 -0
  353. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  354. package/dist/workspace-plugin/adapters/mcp.js +31 -29
  355. package/dist/workspace-plugin/adapters/omp.js +15 -15
  356. package/dist/workspace-plugin/index.js +2 -2
  357. package/package.json +27 -1
  358. package/dist/chunk-2LAPHLDH.js.map +0 -1
  359. package/dist/chunk-5Y2KGB4H.js.map +0 -1
  360. package/dist/chunk-7HX6FNKL.js.map +0 -1
  361. package/dist/chunk-ABFPSVIS.js.map +0 -1
  362. package/dist/chunk-AITJ7ELM.js.map +0 -1
  363. package/dist/chunk-AZ2H6R5I.js.map +0 -1
  364. package/dist/chunk-BFMYYNDT.js.map +0 -1
  365. package/dist/chunk-CEKW3KXP.js.map +0 -1
  366. package/dist/chunk-DGTI65OC.js.map +0 -1
  367. package/dist/chunk-DIGFA7Z5.js.map +0 -1
  368. package/dist/chunk-E572OHGY.js.map +0 -1
  369. package/dist/chunk-GNZBFSRB.js.map +0 -1
  370. package/dist/chunk-HPMQRAIF.js.map +0 -1
  371. package/dist/chunk-HWNK3F3X.js.map +0 -1
  372. package/dist/chunk-IHFGPHCT.js.map +0 -1
  373. package/dist/chunk-ILLTBKDJ.js.map +0 -1
  374. package/dist/chunk-J72MO2WA.js.map +0 -1
  375. package/dist/chunk-KUQAJVYT.js.map +0 -1
  376. package/dist/chunk-LSI2IVFT.js.map +0 -1
  377. package/dist/chunk-NB7SYQYP.js.map +0 -1
  378. package/dist/chunk-NUA33BYO.js.map +0 -1
  379. package/dist/chunk-QEULL4Q3.js.map +0 -1
  380. package/dist/chunk-QSYQOTWN.js.map +0 -1
  381. package/dist/chunk-RHN5MRQO.js.map +0 -1
  382. package/dist/chunk-S2XHGWQC.js.map +0 -1
  383. package/dist/chunk-UI745XC3.js.map +0 -1
  384. package/dist/chunk-VMVDAZLA.js.map +0 -1
  385. package/dist/chunk-XFIEVEU7.js.map +0 -1
  386. package/dist/chunk-XGULGQA3.js.map +0 -1
  387. package/dist/chunk-YLLVSR2U.js.map +0 -1
  388. package/dist/chunk-Z7ZEZZB6.js.map +0 -1
  389. package/dist/chunk-ZDLUQLI6.js.map +0 -1
  390. package/dist/chunk-ZHGKAZJ7.js.map +0 -1
  391. package/dist/connectors-7THEF7YA.js +0 -48
  392. package/dist/ensure-sources-IH7CHSJF.js.map +0 -1
  393. package/dist/flows-4JZQ3XFK.js +0 -26
  394. package/dist/helpers-JNMK3FC2.js +0 -38
  395. package/dist/library-publish-I3UWXAHI.js.map +0 -1
  396. package/dist/open-library-NKKUJLWA.js +0 -42
  397. package/dist/open-registry-BYAXSHUI.js +0 -32
  398. package/dist/paths-UKWE35XS.js +0 -22
  399. package/dist/plugin-store-ABE35NRX.js +0 -23
  400. package/dist/project-BIPK47JK.js +0 -86
  401. package/dist/serve-preflight-FLTIBTEX.js.map +0 -1
  402. package/dist/setup-AG6NFHSN.js.map +0 -1
  403. package/dist/skills-UQYUHVKO.js +0 -26
  404. package/dist/source-ASEHI2XS.js +0 -85
  405. package/dist/source-fetch-github-ST4MFL3D.js +0 -4
  406. package/dist/source-manifest-publish-IEVV3W6J.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../cli/src/commands/validate.ts"],"names":["parseYaml","parsed","a","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmFA,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,IAA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MAAA,GAAS,OAAA,CAAQ,WAAW,CAAA,EAAG;AACxD,MAAA,KAAA,CAAM,0BAA0B,CAAA;AAChC,MAAA;AAAA,IACF;AAEA,IAAA,KAAA,MAAW,IAAA,IAAQ,OAAA,EAAS,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA,QAAA,CAAU,CAAA;AACnD,IAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,EAAO,MAAA,CAAO,CAAA,EAAG,IAAI,CAAA,mCAAA,CAAqC,CAAA;AAC7E,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-IHFGPHCT.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 type ConnectorDeclaration,\n decodeSkaileYaml,\n isInsideProject,\n symlinkEscapeOfProject,\n isValidAssetName,\n isValidPublisher,\n loadSkPublishManifest,\n localConnectorMountDir,\n parseAssetRef,\n resolveRuntimeAssets,\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 { 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 { unknownHarnessErrors, unknownKeyWarnings } from \"../config-checks.ts\";\nimport { logErr, logInfo, logOk, logWarn } from \"../helpers.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { AI_RESOURCES } from \"../paths.ts\";\nimport {\n checkAsset,\n checkAssetFile,\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 registeredAssetKeys,\n rejectRemovedDomainOption,\n removedDomainOption,\n reportLibrarySymlinks,\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\n/** `skaile.yaml` connector diagnostics that fail `validate` (the runner cannot mount it right). */\nconst CONNECTOR_ERROR_CODES: readonly string[] = [\n \"connector_missing_driver\",\n \"connector_missing_id\",\n \"connector_duplicate_id\",\n \"connector_invalid_access\",\n];\n\n/**\n * A `local` connector's `mountPath` is mounted read-write as given: one that does not exist\n * fails (`serve` refuses it too), one outside the project is a warning, one that reaches outside\n * through a symlink fails (p833).\n */\nfunction validateLocalConnectorMountPaths(\n projectDir: string,\n relPath: string,\n connectors: ReadonlyArray<ConnectorDeclaration>,\n): number {\n let errors = 0;\n for (const c of connectors) {\n if (c.driver !== \"local\" || c.mount) continue;\n const dir = localConnectorMountDir(c, projectDir);\n if (!dir) continue;\n const escapesTo = symlinkEscapeOfProject(dir, projectDir);\n if (!fs.existsSync(dir)) {\n logErr(\n `${relPath} [connectors] — connector_mount_path_missing: connectors.${c.id}.mountPath: ${dir} does not exist; create the directory or fix the path`,\n );\n errors++;\n } else if (escapesTo !== null) {\n logErr(\n `${relPath} [connectors] — connector_mount_path_symlink: connectors.${c.id}.mountPath: ${dir} is a symlink to ${escapesTo}, outside the project ${projectDir}; point mountPath at the real directory`,\n );\n errors++;\n } else if (!isInsideProject(dir, projectDir)) {\n logWarn(\n `${relPath} [connectors] — connectors.${c.id}.mountPath: ${dir} is outside the project ${projectDir}; the agent reads${c.access === \"read-write\" ? \" and writes\" : \"\"} there`,\n );\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 try {\n parsed = (parseYaml(fs.readFileSync(file, \"utf-8\")) ?? {}) as Record<string, unknown>;\n } catch (e) {\n logErr(`${relPath} — parse error: ${e instanceof Error ? e.message : String(e)}`);\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 d of decoded.diagnostics) {\n if (!CONNECTOR_ERROR_CODES.includes(d.code)) continue;\n logErr(`${relPath} [connectors] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${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.\n for (const d of decoded.diagnostics) {\n if (d.code !== \"deprecated_harness_key\" && d.code !== \"harness_key_conflict\") continue;\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 errors += validateLocalConnectorMountPaths(\n path.dirname(file),\n relPath,\n decoded.config?.connectors ?? [],\n );\n // A `driver` no catalog entry provides: `serve` cannot mount it either. The text is the one\n // `serve` logs as `validation_warning`. An unreachable source (not cloned yet) may hold the\n // driver, so nothing is reported while one is missing.\n if ((decoded.config?.connectors ?? []).length > 0) {\n const assets = await resolveRuntimeAssets(path.dirname(file));\n if (!assets.warnings.some((w) => w.code === \"repo_unavailable\")) {\n for (const w of assets.warnings) {\n if (w.code !== \"missing_driver\" || !w.name) continue;\n logErr(`${relPath} [connectors] — ${w.code}: ${w.message}`);\n errors++;\n }\n }\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.\n */\nfunction validatePublishManifestRoots(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest) return 0;\n const missing = missingRootAssets(absRoot, manifest);\n for (const a of missing) {\n logErr(\n `${SKAILE_MANIFEST_FILENAME} [assets] — ${assetEntryRef(a, manifest)}: root \"${a.root}\" does not exist. ` +\n \"Run `skaile library index <library>` to drop the entry, or restore the directory.\",\n );\n }\n return missing.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 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/** Read one manifest candidate's identity and version; unreadable YAML yields an empty version. */\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: declaredVersion(data) ?? \"\",\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 if (kind === \"flow\") {\n return {\n kind,\n name: String(parsed?.id ?? fileName.replace(\".flow.yaml\", \"\")),\n version: String(parsed?.version ?? \"\"),\n filePath: c.filePath,\n };\n }\n return {\n kind,\n name: String(parsed?.name ?? dirName),\n version: String(parsed?.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(assets: AssetVersion[], root: string): 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})`,\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]`,\n * else the library the shell is in (the nearest directory at or above the cwd\n * that holds `skaile.manifest.yaml`), else the bundled factory assets\n * ({@link AI_RESOURCES}). Returns `null` after printing an error when an explicit\n * path does not exist.\n */\nfunction resolveCheckRoot(pathArg: string | undefined): string | null {\n if (pathArg) {\n const abs = path.resolve(pathArg);\n if (!fs.existsSync(abs)) {\n logErr(`Path does not exist: ${abs}`);\n return null;\n }\n return abs;\n }\n for (let dir = process.cwd(); ; dir = path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, SKAILE_MANIFEST_FILENAME))) return dir;\n if (path.dirname(dir) === dir) return AI_RESOURCES;\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 * `true` when `a` changed: its asset file, or any file under its folder that a deploy ships\n * (the lock hash covers them, minus the deploy ignore list), is among `changedAbs`.\n */\nfunction assetChanged(a: AssetVersion, changedAbs: ReadonlySet<string>): boolean {\n if (changedAbs.has(a.filePath)) return true;\n const dir = assetOwnDir(a);\n if (dir === null) return false;\n for (const f of changedAbs) {\n const rel = path.relative(dir, f);\n if (rel.startsWith(\"..\") || path.isAbsolute(rel)) continue;\n if (!isNonAssetPath(toPosix(rel))) return true;\n }\n return false;\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 // 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 assets = assets.filter((a) => assetChanged(a, changedAbs));\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);\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 = 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 +0,0 @@
1
- {"version":3,"sources":["../bridge/src/harness-capabilities.ts","../bridge/src/provider-catalog.ts","../bridge/src/provider-materialize/credential-env.ts","../bridge/src/registry.ts"],"names":[],"mappings":";;;;;AAqBA,IAAM,4BAAA,GAAoD;AAAA,EACxD,mBAAA,EAAqB,KAAA;AAAA,EACrB,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,KAAA;AAAA,EAChB,qBAAA,EAAuB,KAAA;AAAA,EACvB,qBAAA,EAAuB;AACzB,CAAA;AAQO,IAAM,4BAAA,GAA+B;AAAA;AAAA,EAE1C,GAAA,EAAK;AAAA,IACH,mBAAA,EAAqB,KAAA;AAAA,IACrB,eAAA,EAAiB,IAAA;AAAA,IACjB,cAAA,EAAgB,KAAA;AAAA,IAChB,qBAAA,EAAuB,KAAA;AAAA,IACvB,qBAAA,EAAuB;AAAA,GACzB;AAAA;AAAA;AAAA,EAGA,YAAA,EAAc;AAAA,IACZ,mBAAA,EAAqB,IAAA;AAAA,IACrB,eAAA,EAAiB,KAAA;AAAA,IACjB,cAAA,EAAgB,KAAA;AAAA,IAChB,qBAAA,EAAuB,IAAA;AAAA,IACvB,qBAAA,EAAuB;AAAA,GACzB;AAAA;AAAA;AAAA,EAGA,KAAA,EAAO;AAAA,IACL,mBAAA,EAAqB,KAAA;AAAA,IACrB,eAAA,EAAiB,IAAA;AAAA,IACjB,cAAA,EAAgB,IAAA;AAAA,IAChB,qBAAA,EAAuB,KAAA;AAAA,IACvB,qBAAA,EAAuB;AAAA;AAE3B,CAAA;AAcO,SAAS,oBAAoB,EAAA,EAA6C;AAC/E,EAAA,MAAM,QAAA,GAAW,EAAA,GACb,MAAA,CAAO,MAAA,CAAO,8BAA8B,EAAE,CAAA,GAC5C,4BAAA,CAA6B,EAA+C,IAC5E,cAAA,CAAe,GAAA,CAAI,SAAA,EAAW,EAAE,GAAG,YAAA,GACrC,MAAA;AACJ,EAAA,OAAO,EAAE,GAAG,4BAAA,EAA8B,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AA,EAAI,IAAI,CAAA;AAAA,EAC1B;AACA,EAAA,KAAA,MAAW,IAAA,IAAQ,cAAA,CAAe,IAAA,CAAK,SAAS,CAAA,EAAG;AACjD,IAAA,IAAI,CAAC,MAAA,CAAO,GAAA,CAAI,IAAA,CAAK,EAAE,CAAA,EAAG;AAIxB,MAAA,MAAM,MAAA,GAAS,cAAA,CAAe,GAAA,CAAI,SAAA,EAAW,KAAK,EAAE,CAAA;AACpD,MAAA,MAAA,CAAO,GAAA,CAAI,KAAK,EAAA,EAAI;AAAA,QAClB,IAAI,IAAA,CAAK,EAAA;AAAA,QACT,MAAM,IAAA,CAAK,WAAA;AAAA,QACX,aAAA,EAAe,QAAQ,aAAA,IAAiB,KAAA;AAAA,QACxC,mBAAA,EAAqB,QAAQ,mBAAA,IAAuB,KAAA;AAAA;AAAA;AAAA;AAAA,QAIpD,GAAI,QAAQ,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,QACxD,GAAI,QAAQ,iBAAA,GAAoB,EAAE,mBAAmB,MAAA,CAAO,iBAAA,KAAsB,EAAC;AAAA,QACnF,GAAI,QAAQ,YAAA,GAAe,EAAE,cAAc,MAAA,CAAO,YAAA,KAAiB;AAAC,OACrE,CAAA;AAAA,IACH;AAAA,EACF;AACA,EAAA,OAAO,CAAC,GAAG,MAAA,CAAO,MAAA,EAAQ,CAAA;AAC5B;AAqBA,eAAsB,oBAAA,CACpB,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,oBAAA,CAAqB,SAAS,CAAA;AACnD,EAAA,OAAQ,MAAM,MAAA,CAAO,UAAA,GAAa,QAAA,EAAU,OAAO,KAAM,EAAC;AAC5D","file":"chunk-ILLTBKDJ.js","sourcesContent":["/**\n * What the runner may ask of a harness, by harness id.\n *\n * Deliberately light: this module imports no harness, no SDK and no `zod`, so a\n * runner file that only needs a capability can import it without loading the\n * harness graph. The plugin-registry singleton is read through its `internal`\n * module (the same file `@skaile/workspaces/plugin-registry` re-exports, so one\n * instance under the bundler's shared chunks), not through the package index,\n * which pulls in the deploy helpers and their `zod` schemas.\n *\n * @docLink packages/bridge/api-reference#registry\n */\n\nimport { pluginRegistry } from \"../../plugin-registry/src/internal.js\";\nimport type { HarnessCapabilities } from \"@skaile/workspaces/types\";\n\n/**\n * Capabilities of a harness that declares none: it recomposes its tools per\n * turn like every bridge harness that is not an in-process SDK, and has no\n * managed session, credentials file or transcript-file resume.\n */\nconst GENERIC_HARNESS_CAPABILITIES: HarnessCapabilities = {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n};\n\n/**\n * Declared capabilities of the built-in harnesses that differ from nothing.\n * `BUILTIN_HARNESS_CATALOG` rows point at these entries, so `listHarnesses()` and\n * {@link harnessCapabilities} read one table. A built-in absent here (echo,\n * gemini, qwen, opencode, goose, continue) takes the generic defaults.\n */\nexport const BUILTIN_HARNESS_CAPABILITIES = {\n // Recomposes its tools per turn, so a hot-plugged MCP server is live.\n omp: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n // The SDK takes in-process server instances and bakes its tool set at\n // creation; it reads Claude's `~/.claude` credentials and JSONL transcripts.\n \"claude-sdk\": {\n inProcessMcpServers: true,\n liveToolUpdates: false,\n managedSession: false,\n claudeCodeCredentials: true,\n resumeNeedsTranscript: true,\n },\n // Standalone SDK recomposes its tools per turn. A host-managed session\n // (native app-server) refreshes its own native tool snapshot instead.\n codex: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: true,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n} as const satisfies Record<string, HarnessCapabilities>;\n\n/**\n * Resolve what the runner may ask of a harness, by harness id, without loading\n * its module. Built-ins read {@link BUILTIN_HARNESS_CAPABILITIES}; a third-party\n * harness reads its registered `HarnessTarget`; an unknown or absent id gets the\n * generic defaults. Fields a harness omits take the generic default too.\n *\n * This is the one place the runner learns harness facts — it never compares an\n * id against `\"claude-sdk\"`, `\"codex\"` or `\"omp\"`.\n *\n * @param id - Harness id (e.g. a session's `harnessType`); `undefined` resolves to the defaults.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function harnessCapabilities(id: string | undefined): HarnessCapabilities {\n const declared = id\n ? Object.hasOwn(BUILTIN_HARNESS_CAPABILITIES, id)\n ? BUILTIN_HARNESS_CAPABILITIES[id as keyof typeof BUILTIN_HARNESS_CAPABILITIES]\n : pluginRegistry.get(\"harness\", id)?.capabilities\n : undefined;\n return { ...GENERIC_HARNESS_CAPABILITIES, ...declared };\n}\n\n/**\n * Whether a hot-plugged MCP server reaches the agent's next turn without a\n * harness restart. A host-managed session refreshes its native tool snapshot\n * itself, so it never takes live updates, whatever the standalone harness does.\n *\n * @param id - Harness id of the live session.\n * @param managed - Whether the session is host-managed (`managedCodex`).\n * @docLink packages/bridge/api-reference#registry\n */\nexport function supportsLiveToolUpdates(id: string | undefined, managed = false): boolean {\n const caps = harnessCapabilities(id);\n return caps.liveToolUpdates && !(managed && caps.managedSession);\n}\n","/**\n * The AI provider catalog — the preset layer of the provider registry (§1.5,\n * layer 5).\n *\n * A preset is the three-or-four literals an endpoint needs beyond a credential:\n * its wire `surface`, its `base_url` (or the transport that derives one), the\n * header the credential rides in, and the path a read-only probe can GET. With\n * them, `skaile providers add --preset groq` needs nothing but an env var name.\n *\n * This replaced `provider-endpoints.ts` `PROVIDER_ENDPOINTS`: every endpoint\n * that table knew is present here, with the surface/transport/credential facts\n * it could not express.\n *\n * The record types come from `@skaile/workspaces/core/provider-registry` — the\n * schema has exactly one home.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.2, §1.3, §2.5\n */\n\nimport {\n AI_PROVIDER_BASE_URL_TEMPLATES,\n type AIProviderCredentialKind,\n type AIProviderDiscovery,\n type AIProviderEntry,\n type AIProviderKind,\n type AIProviderLlmEntry,\n type AIProviderRegistry,\n type AIProviderRegistryLayer,\n type AIProviderRegistryPatch,\n type AIProviderSurface,\n type AIProviderTransport,\n type AIProviderVoiceParams,\n resolveEntryBaseUrl,\n} from \"@skaile/workspaces/core/provider-registry\";\n\n/**\n * Where the credential goes on the wire. `{credential}` is replaced with the\n * resolved secret. Needed because `credential.kind` alone is ambiguous:\n * `api_key_header` is `x-api-key` for Anthropic, `x-goog-api-key` for Gemini,\n * `api-key` for Azure OpenAI and `Authorization: Token …` for Deepgram.\n */\nexport interface AIProviderAuthHeader {\n name: string;\n template: string;\n}\n\n/** A catalog preset — the fields an entry inherits by naming it. */\nexport interface AIProviderPreset {\n /** Preset id; also the default entry id `skaile providers add` writes. */\n id: string;\n kind: AIProviderKind;\n label: string;\n /** `llm`/`embed` only. */\n surface?: AIProviderSurface;\n /** `llm`/`embed` only; omitted means `direct`. */\n transport?: AIProviderTransport;\n /** Literal endpoint. Absent when the transport derives one from `params`. */\n base_url?: string;\n /**\n * Env var the vendor's own SDK reads as a base-URL override, when one\n * exists. Consulted by the callers that still address an endpoint by preset\n * id — model discovery, key validation, and `skaile migrate providers` — so\n * a shell already pointed at a gateway keeps pointing there.\n */\n base_url_env?: string;\n /** Static non-secret headers, e.g. Anthropic's `anthropic-version`. */\n headers?: Record<string, string>;\n /** Credential shape plus the conventional env var holding the secret. */\n credential: { kind: AIProviderCredentialKind; env?: string };\n /** Header the credential rides in; defaults per surface when omitted. */\n auth_header?: AIProviderAuthHeader;\n /** Default routing/voice parameters. */\n params?: Record<string, string>;\n /** `params` keys the operator must supply — the preset cannot know them. */\n required_params?: string[];\n /**\n * Read-only path a health probe GETs, relative to `base_url`: the models\n * list for LLM surfaces, an equivalent authenticated read for voice.\n * Absent when the endpoint has none (Bedrock's runtime host).\n */\n probe_path?: string;\n discovery?: AIProviderDiscovery;\n /** Anything the operator has to know that the fields do not say. */\n notes?: string;\n}\n\nconst ANTHROPIC_VERSION_HEADER: Record<string, string> = { \"anthropic-version\": \"2023-06-01\" };\n\nconst X_API_KEY: AIProviderAuthHeader = { name: \"x-api-key\", template: \"{credential}\" };\n\nconst OPENAI_MODELS_PATH = \"/v1/models\";\n\n/**\n * Every preset the runtime ships.\n *\n * Insertion order is display order in `skaile providers list`: first-party\n * clouds, then OpenAI-compatible vendors, then the transports that need\n * routing parameters, then local runtimes and gateways, then voice.\n *\n * Sources: `platform/_devlog/reports/2026-09-20-inference-provider-market-survey.md`\n * (36 endpoints, base URLs and auth headers verified there).\n */\nexport const AI_PROVIDER_PRESETS: Record<string, AIProviderPreset> = {\n anthropic: {\n id: \"anthropic\",\n kind: \"llm\",\n label: \"Anthropic\",\n surface: \"anthropic-messages\",\n base_url: \"https://api.anthropic.com\",\n base_url_env: \"ANTHROPIC_BASE_URL\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_API_KEY\" },\n auth_header: X_API_KEY,\n probe_path: \"/v1/models\",\n discovery: { type: \"anthropic-models-list\" },\n },\n openai: {\n id: \"openai\",\n kind: \"llm\",\n label: \"OpenAI\",\n surface: \"openai-responses\",\n base_url: \"https://api.openai.com/v1\",\n base_url_env: \"OPENAI_BASE_URL\",\n credential: { kind: \"bearer\", env: \"OPENAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Responses is OpenAI's current API; set surface openai-completions for chat-only clients.\",\n },\n google: {\n id: \"google\",\n kind: \"llm\",\n label: \"Google Gemini API\",\n surface: \"google-generative-ai\",\n base_url: \"https://generativelanguage.googleapis.com/v1beta\",\n credential: { kind: \"api_key_header\", env: \"GEMINI_API_KEY\" },\n auth_header: { name: \"x-goog-api-key\", template: \"{credential}\" },\n probe_path: \"/v1beta/models\",\n discovery: { type: \"google-models-list\" },\n },\n groq: {\n id: \"groq\",\n kind: \"llm\",\n label: \"Groq\",\n surface: \"openai-completions\",\n base_url: \"https://api.groq.com/openai/v1\",\n credential: { kind: \"bearer\", env: \"GROQ_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n deepseek: {\n id: \"deepseek\",\n kind: \"llm\",\n label: \"DeepSeek\",\n surface: \"openai-completions\",\n base_url: \"https://api.deepseek.com\",\n credential: { kind: \"bearer\", env: \"DEEPSEEK_API_KEY\" },\n probe_path: \"/models\",\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Anthropic-shaped clients use https://api.deepseek.com/anthropic with surface anthropic-messages.\",\n },\n openrouter: {\n id: \"openrouter\",\n kind: \"llm\",\n label: \"OpenRouter\",\n surface: \"openai-completions\",\n base_url: \"https://openrouter.ai/api/v1\",\n credential: { kind: \"bearer\", env: \"OPENROUTER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n mistral: {\n id: \"mistral\",\n kind: \"llm\",\n label: \"Mistral\",\n surface: \"openai-completions\",\n base_url: \"https://api.mistral.ai/v1\",\n credential: { kind: \"bearer\", env: \"MISTRAL_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n xai: {\n id: \"xai\",\n kind: \"llm\",\n label: \"xAI (Grok)\",\n surface: \"openai-completions\",\n base_url: \"https://api.x.ai/v1\",\n credential: { kind: \"bearer\", env: \"XAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n together: {\n id: \"together\",\n kind: \"llm\",\n label: \"Together AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.together.ai/v1\",\n credential: { kind: \"bearer\", env: \"TOGETHER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n fireworks: {\n id: \"fireworks\",\n kind: \"llm\",\n label: \"Fireworks AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.fireworks.ai/inference/v1\",\n credential: { kind: \"bearer\", env: \"FIREWORKS_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n bedrock: {\n id: \"bedrock\",\n kind: \"llm\",\n label: \"AWS Bedrock\",\n surface: \"bedrock-converse-stream\",\n transport: \"bedrock\",\n credential: { kind: \"sigv4\" },\n required_params: [\"region\"],\n notes: \"Credentials come from the AWS default chain; the runtime host serves no models list.\",\n },\n vertex: {\n id: \"vertex\",\n kind: \"llm\",\n label: \"Google Vertex AI\",\n surface: \"google-vertex\",\n transport: \"vertex\",\n credential: { kind: \"google_adc\" },\n params: { publisher: \"google\" },\n required_params: [\"project\", \"location\"],\n probe_path: \"/models\",\n },\n \"azure-openai\": {\n id: \"azure-openai\",\n kind: \"llm\",\n label: \"Azure OpenAI\",\n surface: \"azure-openai-responses\",\n transport: \"azure-openai\",\n credential: { kind: \"api_key_header\", env: \"AZURE_OPENAI_API_KEY\" },\n auth_header: { name: \"api-key\", template: \"{credential}\" },\n required_params: [\"resource\", \"deployment\", \"api_version\"],\n probe_path: \"/models\",\n notes:\n \"api_version is mirrored into query_params['api-version']; switch credential.kind to azure_entra for Entra tokens.\",\n },\n foundry: {\n id: \"foundry\",\n kind: \"llm\",\n label: \"Claude on Microsoft Foundry\",\n surface: \"anthropic-messages\",\n transport: \"foundry\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_FOUNDRY_API_KEY\" },\n auth_header: X_API_KEY,\n required_params: [\"resource\"],\n probe_path: \"/v1/models\",\n },\n ollama: {\n id: \"ollama\",\n kind: \"llm\",\n label: \"Ollama (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:11434/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n lmstudio: {\n id: \"lmstudio\",\n kind: \"llm\",\n label: \"LM Studio (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:1234/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n vllm: {\n id: \"vllm\",\n kind: \"llm\",\n label: \"vLLM (self-hosted)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:8000/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"A server started with --api-key expects credential.kind bearer and an env: ref.\",\n },\n litellm: {\n id: \"litellm\",\n kind: \"llm\",\n label: \"LiteLLM proxy\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:4000\",\n credential: { kind: \"bearer\", env: \"LITELLM_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"The credential is the proxy's virtual key; upstream keys stay in the proxy config.\",\n },\n deepgram: {\n id: \"deepgram\",\n kind: \"stt\",\n label: \"Deepgram\",\n base_url: \"https://api.deepgram.com\",\n credential: { kind: \"api_key_header\", env: \"DEEPGRAM_API_KEY\" },\n auth_header: { name: \"Authorization\", template: \"Token {credential}\" },\n params: { model: \"nova-3\", language: \"en\" },\n probe_path: \"/v1/projects\",\n },\n elevenlabs: {\n id: \"elevenlabs\",\n kind: \"tts\",\n label: \"ElevenLabs\",\n base_url: \"https://api.elevenlabs.io\",\n credential: { kind: \"api_key_header\", env: \"ELEVENLABS_API_KEY\" },\n auth_header: { name: \"xi-api-key\", template: \"{credential}\" },\n params: { voice_id: \"21m00Tcm4TlvDq8ikWAM\", output_format: \"mp3_44100_128\" },\n probe_path: \"/v1/models\",\n },\n};\n\n/** Presets in catalog order. */\nexport function listProviderPresets(): AIProviderPreset[] {\n return Object.values(AI_PROVIDER_PRESETS);\n}\n\n/** Look up a preset by id. */\nexport function getProviderPreset(id: string): AIProviderPreset | undefined {\n return AI_PROVIDER_PRESETS[id];\n}\n\n/**\n * The endpoint `skaile providers list` shows for a preset: the literal when\n * there is one, otherwise the transport's `base_url` template (§1.3) with its\n * `{param}` placeholders left in — they are exactly what the operator must\n * supply.\n */\nexport function presetBaseUrl(preset: AIProviderPreset): string | undefined {\n if (preset.base_url) return preset.base_url;\n if (!preset.transport || preset.transport === \"direct\") return undefined;\n return AI_PROVIDER_BASE_URL_TEMPLATES[preset.transport];\n}\n\n/**\n * The endpoint a request to this preset should actually go to: an explicit\n * override first, then the vendor's own `*_BASE_URL` variable\n * ({@link AIProviderPreset.base_url_env}), then the preset literal.\n *\n * Behind a gateway the credential in play is the *gateway's*, not the\n * vendor's, so discovery and key validation have to follow dispatch — firing\n * either at the vendor's public API 401s and yields an empty catalog, which a\n * caller that reads \"empty\" as \"unknown\" then degrades into \"accept anything\".\n *\n * Pure: reads only the `env` record it is handed.\n */\nexport function resolvePresetBaseUrl(\n preset: AIProviderPreset,\n options: { baseUrl?: string; env?: Record<string, string | undefined> } = {},\n): string | undefined {\n const explicit = options.baseUrl?.trim();\n if (explicit) return explicit;\n const fromEnv = preset.base_url_env ? options.env?.[preset.base_url_env]?.trim() : undefined;\n return fromEnv || preset.base_url;\n}\n\n/** Overrides {@link expandPreset} accepts from `skaile providers add`. */\nexport interface ExpandPresetOptions {\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…`. Never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n /** Transport routing parameters, or voice parameters for `stt`/`tts`. */\n params?: Record<string, string>;\n}\n\n/**\n * Materialize a preset into a registry entry.\n *\n * The credential is always a reference: the preset's conventional `env:` var\n * unless the caller names another ref. No code path here can write a secret.\n * For `transport: azure-openai` the `api_version` parameter is mirrored into\n * `query_params['api-version']`, which is where the wire expects it (§1.3).\n */\nexport function expandPreset(\n preset: AIProviderPreset,\n options: ExpandPresetOptions = {},\n): AIProviderEntry {\n const ref =\n options.credentialRef ?? (preset.credential.env ? `env:${preset.credential.env}` : undefined);\n const credential = ref ? { kind: preset.credential.kind, ref } : { kind: preset.credential.kind };\n const base_url = options.baseUrl ?? preset.base_url;\n const params = { ...preset.params, ...options.params };\n\n if (preset.kind === \"stt\" || preset.kind === \"tts\") {\n return {\n kind: preset.kind,\n label: options.label ?? preset.label,\n preset: preset.id,\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(Object.keys(params).length > 0 ? { params: params as AIProviderVoiceParams } : {}),\n };\n }\n\n const transport = preset.transport ?? \"direct\";\n const entry: AIProviderLlmEntry = {\n kind: preset.kind === \"embed\" ? \"embed\" : \"llm\",\n label: options.label ?? preset.label,\n preset: preset.id,\n ...((options.surface ?? preset.surface) ? { surface: options.surface ?? preset.surface } : {}),\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(preset.discovery ? { discovery: { ...preset.discovery } } : {}),\n } as AIProviderLlmEntry;\n\n if (transport !== \"direct\") {\n Object.assign(entry, { transport, params });\n if (transport === \"azure-openai\" && params.api_version) {\n entry.query_params = { \"api-version\": params.api_version };\n }\n }\n return entry;\n}\n\n/**\n * Build the catalog merge layer for a set of configured entries (§1.5).\n *\n * Only the presets actually referenced by a `preset:` key are expanded, keyed\n * by the *entry* id — so `groq: {kind: llm, preset: groq}` deep-merges onto a\n * full Groq definition while an unreferenced preset stays out of the registry.\n *\n * Takes the **pre-gate** merge (`LoadedProviderRegistry.patches`), not the\n * gated registry: an entry that leaves `kind` or its transport `params` to the\n * preset is exactly the one the gate drops before this layer exists, and a\n * dropped entry names no preset to expand.\n */\nexport function catalogLayer(providers: AIProviderRegistryPatch): AIProviderRegistryLayer {\n const expanded: AIProviderRegistry = {};\n for (const [id, entry] of Object.entries(providers)) {\n if (!entry.preset) continue;\n const preset = AI_PROVIDER_PRESETS[entry.preset];\n if (!preset) continue;\n expanded[id] = expandPreset(preset);\n }\n return { layer: \"catalog\", providers: expanded };\n}\n\n/**\n * Join a base URL and a path without duplicating a shared leading segment:\n * `(\"https://gw/v1\", \"/v1/models\")` → `https://gw/v1/models`. Both spellings\n * are common in the wild, and a preset's path must work against a gateway base\n * the operator typed either way.\n */\nfunction joinBaseAndPath(base: string, path: string): string {\n const trimmed = base.replace(/\\/+$/, \"\");\n const segments = path.split(\"/\").filter(Boolean);\n const lead = segments[0];\n if (lead && trimmed.toLowerCase().endsWith(`/${lead.toLowerCase()}`)) {\n return `${trimmed}/${segments.slice(1).join(\"/\")}`;\n }\n return `${trimmed}${path}`;\n}\n\n/**\n * The read-only URL a health probe or model discovery can GET for an entry —\n * the models list on LLM surfaces, the equivalent authenticated read on voice\n * ones. `undefined` when the entry has no endpoint yet (missing transport\n * parameters) or the surface serves no such path (Bedrock runtime).\n *\n * This is the catalog method that supersedes `resolveProviderModelsUrl`.\n */\nexport function resolveProbeUrl(entry: AIProviderEntry): string | undefined {\n const base = resolveEntryBaseUrl(entry);\n if (!base) return undefined;\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n const path = (entry as AIProviderLlmEntry).discovery?.path ?? preset?.probe_path;\n if (!path) return undefined;\n const url = joinBaseAndPath(base, path);\n const query = (entry as AIProviderLlmEntry).query_params;\n if (!query || Object.keys(query).length === 0) return url;\n const search = new URLSearchParams(query).toString();\n return `${url}${url.includes(\"?\") ? \"&\" : \"?\"}${search}`;\n}\n\n/**\n * The header(s) that present a credential on the wire for an entry.\n *\n * `credential.kind` alone does not determine the header — `api_key_header` is\n * `x-api-key` at Anthropic, `x-goog-api-key` at Google and `api-key` at Azure —\n * so the preset's `auth_header` wins, then a per-surface default.\n * Returns `{}` when the credential is signed elsewhere (`sigv4`, `google_adc`)\n * or absent.\n */\nexport function buildCredentialHeaders(\n entry: AIProviderEntry,\n secret: string | undefined,\n): Record<string, string> {\n const kind = entry.credential?.kind ?? \"none\";\n if (!secret || kind === \"none\" || kind === \"sigv4\" || kind === \"google_adc\") return {};\n\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.auth_header) {\n return {\n [preset.auth_header.name]: preset.auth_header.template.replace(\"{credential}\", secret),\n };\n }\n if (kind === \"api_key_header\") {\n const surface = (entry as AIProviderLlmEntry).surface;\n if (surface === \"google-generative-ai\") return { \"x-goog-api-key\": secret };\n if (surface === \"azure-openai-responses\") return { \"api-key\": secret };\n return { \"x-api-key\": secret };\n }\n return { Authorization: `Bearer ${secret}` };\n}\n\n/** Outcome of {@link probeProviderEntry}. Never carries the credential. */\nexport interface AIProviderProbeResult {\n /** The endpoint answered 2xx. */\n ok: boolean;\n /** `false` when no request was made — nothing was verified either way. */\n probed: boolean;\n url?: string;\n status?: number;\n /** Human-readable outcome. Secret-free. */\n detail: string;\n}\n\n/** Options for {@link probeProviderEntry}. */\nexport interface ProbeProviderOptions {\n /** Resolved credential value, if the entry has one. Never logged. */\n secret?: string;\n /** Request deadline; default 8000 ms, matching `validateApiKey`. */\n timeoutMs?: number;\n}\n\n/**\n * Send one minimal, read-only request to an entry's endpoint and report what\n * came back.\n *\n * Returns `probed: false` — rather than a false negative — when the entry has\n * no probe path (Bedrock's runtime host) or no resolvable endpoint yet: a\n * SigV4- or ADC-signed request is the transport SDK's job, not this function's.\n */\nexport async function probeProviderEntry(\n entry: AIProviderEntry,\n options: ProbeProviderOptions = {},\n): Promise<AIProviderProbeResult> {\n const url = resolveProbeUrl(entry);\n if (!url) {\n const base = resolveEntryBaseUrl(entry);\n return {\n ok: false,\n probed: false,\n detail: base\n ? `no read-only probe endpoint is defined for this entry (${base})`\n : \"no base_url could be resolved — set base_url or the transport's params\",\n };\n }\n\n const headers: Record<string, string> = {\n ...entry.headers,\n ...buildCredentialHeaders(entry, options.secret),\n };\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 8000);\n try {\n const response = await fetch(url, { method: \"GET\", headers, signal: controller.signal });\n if (response.ok) {\n return { ok: true, probed: true, url, status: response.status, detail: \"endpoint reachable\" };\n }\n const detail =\n response.status === 401 || response.status === 403\n ? \"credential rejected (authentication failed)\"\n : `endpoint returned HTTP ${response.status}`;\n return { ok: false, probed: true, url, status: response.status, detail };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const detail =\n err instanceof Error && err.name === \"AbortError\"\n ? `request timed out after ${options.timeoutMs ?? 8000}ms`\n : message;\n return { ok: false, probed: true, url, detail };\n } finally {\n clearTimeout(timeout);\n }\n}\n","/**\n * Credential delivery for harness adapters — the one naming rule (§2.3).\n *\n * Every adapter that hands a registry entry's secret to a child process, and\n * every renderer that has to *name* that secret in a config file it writes\n * (omp's `models.yml` `apiKey:`, Codex's `env_key`, OpenCode's `{env:…}`),\n * agrees on one env-var name per entry: `SKAILE_AIP_<UPPER_ID>_KEY`. The name\n * goes in the file, the value goes in the child environment — a rendered\n * config never contains a secret.\n *\n * The platform's secret-env allowlist is a prefix rule on exactly that name,\n * and forge-common delivers the same names when it spawns `skaile serve`, so\n * the transform below is a cross-repo contract: uppercase, every character\n * outside `[A-Za-z0-9]` mapped to `_` (registry ids are `[a-z0-9][a-z0-9_-]*`,\n * so in practice only `-`).\n *\n * Alongside the canonical name, {@link registryCredentialEnv} also sets the\n * *conventional* carrier a CLI already reads (`ANTHROPIC_API_KEY`,\n * `GEMINI_API_KEY`, `GROQ_API_KEY`, …) so a catalog-preset entry works in a\n * harness that has no per-endpoint config file yet.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.4, §2.3\n */\n\nimport {\n type AIProviderEntry,\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n parseCredentialRef,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { resolveCredential } from \"@skaile/workspaces/core/provider-registry-credentials\";\nimport { AI_PROVIDER_PRESETS } from \"../provider-catalog.js\";\n\n/** Options shared by every registry-shaped credential resolution. */\nexport interface RegistryCredentialOptions {\n /** Restrict resolution to one entry — the provider half of a `modelRef`. */\n providerId?: string;\n /** Environment `env:` refs resolve against. Defaults to `process.env`. */\n env?: Record<string, string | undefined>;\n /** Control-plane secrets keyed by config id, for `platform:` refs. */\n secrets?: Record<string, string>;\n /** Run `cmd:` references. Default `true`. */\n allowCommand?: boolean;\n}\n\n/** Prefix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_PREFIX = \"SKAILE_AIP_\";\n\n/** Suffix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_SUFFIX = \"_KEY\";\n\n/**\n * The env-var name that carries a registry entry's credential:\n * `anthropic` → `SKAILE_AIP_ANTHROPIC_KEY`, `my-gw.eu` → `SKAILE_AIP_MY_GW_EU_KEY`.\n *\n * Pure: no environment, no registry, no I/O. Renderers call it per entry while\n * emitting a config file, adapters call it while assembling a child env, and\n * the platform allowlist matches the prefix.\n */\nexport function providerCredentialEnvName(providerId: string): string {\n const slug = providerId.replace(/[^A-Za-z0-9]/g, \"_\").toUpperCase();\n return `${PROVIDER_CREDENTIAL_ENV_PREFIX}${slug}${PROVIDER_CREDENTIAL_ENV_SUFFIX}`;\n}\n\n/**\n * The env var a harness already looks for on its own, when the entry names one.\n *\n * The catalog preset's conventional carrier wins (`GEMINI_API_KEY` for\n * `google`), because that is the name the vendor's own CLI reads; otherwise an\n * `env:NAME` credential reference is taken at face value — the operator named\n * that variable, so the child gets it under the same name. `cmd:`, `platform:`\n * and `keyring:` refs have no conventional carrier and return `undefined`.\n */\nexport function conventionalCredentialEnvName(entry: AIProviderEntry): string | undefined {\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.credential.env) return preset.credential.env;\n const ref = entry.credential?.ref ? parseCredentialRef(entry.credential.ref) : undefined;\n return ref?.form === \"env\" ? ref.name : undefined;\n}\n\n/**\n * Resolve one entry's credential to its value, or `undefined` when there is\n * none to hand over (`kind: none`, an ambient `sigv4`/`google_adc` chain, an\n * unset variable, a reserved `keyring:` ref).\n */\nexport function resolveEntryCredential(\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n }).value;\n}\n\n/**\n * One entry's credential value, including the one the session boundary\n * already resolved for it.\n *\n * A `platform:<configId>` reference is resolved by the runner — it holds the\n * `session_init` secrets map, the harness does not — and materialized into the\n * child environment under {@link providerCredentialEnvName}. So when the\n * reference itself yields nothing, that carrier is consulted: it is the same\n * secret, delivered one step earlier.\n */\nexport function entryCredentialValue(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return (\n resolveEntryCredential(entry, options) ?? options.env?.[providerCredentialEnvName(providerId)]\n );\n}\n\n/** One enabled entry whose credential is declared but cannot be resolved. */\nexport interface UnresolvedProviderCredential {\n providerId: string;\n /** Why it does not resolve, e.g. `environment variable ANTHROPIC_API_KEY is not set`. */\n reason: string;\n}\n\n/**\n * The enabled LLM/embed entries that name a credential this process cannot\n * resolve (the variable is unset, the command fails). A harness must not be\n * handed such an entry: the child would send an empty key and fail with a 401\n * instead of using its own login. Entries with no credential, an ambient\n * signing chain, or a value the session boundary already delivered under\n * {@link providerCredentialEnvName} are fine.\n */\nexport function unresolvedProviderCredentials(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialOptions = {},\n): UnresolvedProviderCredential[] {\n const out: UnresolvedProviderCredential[] = [];\n for (const [id, entry] of registryEntries(registry)) {\n if (entry.kind !== \"llm\" && entry.kind !== \"embed\") continue;\n if (!isEntryEnabled(entry)) continue;\n if (options.providerId && id !== options.providerId) continue;\n const resolved = resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n });\n if (!resolved.error) continue;\n if (options.env?.[providerCredentialEnvName(id)]) continue;\n out.push({ providerId: id, reason: resolved.error });\n }\n return out;\n}\n\n/** Options for {@link entryCredentialEnv} / {@link registryCredentialEnv}. */\nexport interface RegistryCredentialEnvOptions extends RegistryCredentialOptions {\n /**\n * Also set the harness-conventional carrier\n * ({@link conventionalCredentialEnvName}). Default `true`. Set `false` for a\n * harness that reads every endpoint out of a rendered config file and must\n * not inherit a vendor default from a neighbouring entry.\n */\n aliases?: boolean;\n}\n\n/**\n * The credential variables one entry contributes: always\n * `SKAILE_AIP_<ID>_KEY`, plus the conventional carrier unless `aliases` is\n * `false`. Empty when the entry has no resolvable secret.\n */\nexport function entryCredentialEnv(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const value = resolveEntryCredential(entry, options);\n if (!value) return {};\n const out: Record<string, string> = { [providerCredentialEnvName(providerId)]: value };\n if (options.aliases !== false) {\n const alias = conventionalCredentialEnvName(entry);\n if (alias) out[alias] = value;\n }\n return out;\n}\n\n/**\n * Every enabled entry's credential, as a child-process environment fragment.\n *\n * One canonical `SKAILE_AIP_<ID>_KEY` per entry whose credential resolves; the\n * conventional carriers are added underneath, first entry in registry order\n * winning a collision (registry order is highest-precedence layer first, so\n * the alias follows the same precedence the selector does). Entries whose\n * credential cannot be resolved contribute nothing.\n */\nexport function registryCredentialEnv(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const canonical: Record<string, string> = {};\n const aliases: Record<string, string> = {};\n for (const [id, entry] of registryEntries(registry)) {\n if (options.providerId && id !== options.providerId) continue;\n if (!isEntryEnabled(entry)) continue;\n const value = resolveEntryCredential(entry, options);\n if (!value) continue;\n canonical[providerCredentialEnvName(id)] = value;\n if (options.aliases === false) continue;\n const alias = conventionalCredentialEnvName(entry);\n if (alias && aliases[alias] === undefined) aliases[alias] = value;\n }\n return { ...aliases, ...canonical };\n}\n","import type {\n AIProviderRegistry,\n AIProviderSurface,\n MergedAIProviderRegistry,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { HarnessContext } from \"@skaile/workspaces/plugin-registry\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { ModelEntry } from \"./models.js\";\nimport type { RegistryCredentialOptions } from \"./provider-materialize/credential-env.js\";\nimport { BUILTIN_HARNESS_CAPABILITIES } from \"./harness-capabilities.js\";\nimport type { AgentConfig, AgentHarness, HarnessInfo } from \"./types.js\";\n\n// Build-time harness gating. `bun build --compile --define:__INCLUDE_*__=...`\n// folds these to literal booleans so an excluded harness module and\n// its SDK are dead-code-stripped from the binary. Under tsup / vitest / bun\n// run-on-source no `--define` runs and the `typeof` guard defaults to `true` —\n// every harness is available (the SDKs stay optional peers).\ndeclare const __INCLUDE_CLAUDE_SDK__: boolean;\ndeclare const __INCLUDE_CODEX__: boolean;\nconst INCLUDE_CLAUDE_SDK =\n typeof __INCLUDE_CLAUDE_SDK__ === \"undefined\" ? true : __INCLUDE_CLAUDE_SDK__;\nconst INCLUDE_CODEX = typeof __INCLUDE_CODEX__ === \"undefined\" ? true : __INCLUDE_CODEX__;\n\n/**\n * Every wire surface omp can speak — it is the harness the `surface` enum was\n * lifted from, so its list is the enum.\n */\nconst OMP_SURFACES = [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"openai-codex-responses\",\n \"azure-openai-responses\",\n \"bedrock-converse-stream\",\n \"google-generative-ai\",\n \"google-vertex\",\n] as const satisfies readonly AIProviderSurface[];\n\n/**\n * Static capability metadata for every built-in harness.\n *\n * Pure data — this object imports no harness module and references no harness\n * SDK. {@link listHarnesses} returns it (merged with any third-party harnesses)\n * so selection UIs can enumerate every harness without loading a single\n * harness module. The matching harness module's `HarnessTarget` is registered\n * into the plugin registry by {@link registerBuiltinHarnesses}.\n *\n * `surfaces` and `providerPlurality` are the harness-capability declaration\n * the AI provider registry resolves against (plan §2.3): which wire protocols\n * a harness can be pointed at, and how many registry entries it can use at\n * once. The platform's resolver filters candidate entries on `surfaces`\n * instead of matching vendor names.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const BUILTIN_HARNESS_CATALOG: Record<string, HarnessInfo> = {\n omp: {\n id: \"omp\",\n name: \"omp (oh-my-pi)\",\n modelAgnostic: true,\n supportsInBandAbort: true,\n surfaces: OMP_SURFACES,\n // omp renders the whole registry as its own `models.yml`, so every entry\n // stays selectable and roles / per-subagent models resolve across them.\n providerPlurality: \"registry\",\n capabilities: BUILTIN_HARNESS_CAPABILITIES.omp,\n },\n \"claude-sdk\": {\n id: \"claude-sdk\",\n name: \"Claude Agent SDK\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Anthropic's own API, plus the two clouds the SDK addresses natively.\n // Foundry is `anthropic-messages` at a different host, not a surface.\n surfaces: [\"anthropic-messages\", \"bedrock-converse-stream\", \"google-vertex\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_HARNESS_CAPABILITIES[\"claude-sdk\"],\n },\n codex: {\n id: \"codex\",\n name: \"OpenAI Codex\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Codex's `wire_api` is `responses` or `chat`; its subscription transport\n // is the codex-specific responses flavour.\n surfaces: [\"openai-codex-responses\", \"openai-responses\", \"openai-completions\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_HARNESS_CAPABILITIES.codex,\n },\n echo: {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Deterministic mock: it never opens a connection, so it speaks no wire\n // surface and no registry entry can be dispatched to it.\n surfaces: [],\n providerPlurality: \"single\",\n },\n gemini: {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n surfaces: [\"google-generative-ai\"],\n providerPlurality: \"single\",\n },\n qwen: {\n id: \"qwen\",\n name: \"Qwen Code\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Driven entirely through OPENAI_BASE_URL / OPENAI_API_KEY.\n surfaces: [\"openai-completions\"],\n providerPlurality: \"single\",\n },\n opencode: {\n id: \"opencode\",\n name: \"OpenCode\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"google-generative-ai\",\n ],\n providerPlurality: \"credentials-n\",\n },\n goose: {\n id: \"goose\",\n name: \"Goose\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"google-generative-ai\",\n \"bedrock-converse-stream\",\n ],\n providerPlurality: \"credentials-n\",\n },\n continue: {\n id: \"continue\",\n name: \"Continue CLI\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\"anthropic-messages\", \"openai-completions\", \"google-generative-ai\"],\n providerPlurality: \"credentials-n\",\n },\n};\n\nlet _harnessesRegistered = false;\n\n/**\n * Register every built-in harness's `HarnessTarget` into the plugin registry.\n *\n * This is the single id → module map in bridge core. Every specifier is a\n * literal string so `bun --compile` can statically bundle the harness module\n * (and, transitively, its SDK). The in-process-SDK harnesses (`claude-sdk`,\n * `codex`) are wrapped in build-constant guards so an excluded harness's\n * `await import` folds to dead code in the compiled binary. `omp` and `echo`\n * carry no SDK weight and are always available.\n *\n * **Static import discipline.** Every `import()` specifier below must be a\n * string literal — never aliased through a variable. Indirection defeats\n * `bun --compile`'s static analysis and silently drops the module from the\n * binary.\n *\n * Idempotent: guarded by a module flag so a second call is a no-op (a duplicate\n * `register` would otherwise throw `RegistrationError`).\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function registerBuiltinHarnesses(\n registry: PluginRegistry = pluginRegistry,\n): Promise<void> {\n if (registry === pluginRegistry && _harnessesRegistered) return;\n\n if (!registry.get(\"harness\", \"omp\")) {\n const m = await import(\"@skaile/workspaces/harnesses/omp\");\n registry.register(\"harness\", m.ompHarnessTarget);\n }\n if (!registry.get(\"harness\", \"echo\")) {\n const m = await import(\"@skaile/workspaces/harnesses/echo\");\n registry.register(\"harness\", m.echoHarnessTarget);\n }\n if (INCLUDE_CLAUDE_SDK && !registry.get(\"harness\", \"claude-sdk\")) {\n const m = await import(\"@skaile/workspaces/harnesses/claude-sdk\");\n registry.register(\"harness\", m.claudeSdkHarnessTarget);\n }\n if (INCLUDE_CODEX && !registry.get(\"harness\", \"codex\")) {\n const m = await import(\"@skaile/workspaces/harnesses/codex\");\n registry.register(\"harness\", m.codexHarnessTarget);\n }\n // Subprocess CLI harnesses spawn an external binary the user installs\n // separately — no bundled SDK to dead-code-strip, so (like omp/echo) they\n // carry no build constant and are always registered.\n if (!registry.get(\"harness\", \"gemini\")) {\n const m = await import(\"@skaile/workspaces/harnesses/gemini\");\n registry.register(\"harness\", m.geminiHarnessTarget);\n }\n if (!registry.get(\"harness\", \"qwen\")) {\n const m = await import(\"@skaile/workspaces/harnesses/qwen\");\n registry.register(\"harness\", m.qwenHarnessTarget);\n }\n if (!registry.get(\"harness\", \"opencode\")) {\n const m = await import(\"@skaile/workspaces/harnesses/opencode\");\n registry.register(\"harness\", m.opencodeHarnessTarget);\n }\n if (!registry.get(\"harness\", \"goose\")) {\n const m = await import(\"@skaile/workspaces/harnesses/goose\");\n registry.register(\"harness\", m.gooseHarnessTarget);\n }\n if (!registry.get(\"harness\", \"continue\")) {\n const m = await import(\"@skaile/workspaces/harnesses/continue\");\n registry.register(\"harness\", m.continueHarnessTarget);\n }\n\n if (registry === pluginRegistry) _harnessesRegistered = true;\n}\n\n/**\n * Creates a new harness instance for the given harness id.\n *\n * Ensures the built-in harness targets are registered (idempotent), then looks\n * up the target in the plugin registry and calls its `create()`. The returned\n * harness has not been started yet — call `harness.start()` before sending\n * prompts.\n *\n * @param id - Registered harness identifier (e.g. `\"omp\"`, `\"claude-sdk\"`).\n * @param config - Configuration forwarded to the harness constructor.\n * @param ctx - Optional harness context (logger / abort signal). Defaults to `{}`.\n * @returns A freshly constructed (not yet started) {@link AgentHarness}.\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered harness at all.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function createHarness(\n id: string,\n config: AgentConfig,\n ctx?: HarnessContext,\n): Promise<AgentHarness> {\n const target = await resolveHarnessTarget(id);\n return target.create(config, ctx ?? {});\n}\n\n/**\n * Resolve a registered harness target by id, ensuring the built-ins are\n * registered first. Throws the canonical \"not bundled\" / \"unknown harness\"\n * errors so every caller (`createHarness`, `listModelsForHarness`) reports an\n * unrecognized id the same way instead of silently degrading.\n *\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered harness at all.\n */\nasync function resolveHarnessTarget(id: string) {\n await registerBuiltinHarnesses();\n const target = pluginRegistry.get(\"harness\", id);\n if (!target) {\n if (id in BUILTIN_HARNESS_CATALOG) {\n throw new Error(`Agent harness \"${id}\" is not bundled in this build.`);\n }\n throw new Error(\n `Unknown agent harness: \"${id}\". Available: ${listHarnesses()\n .map((d) => d.id)\n .join(\", \")}`,\n );\n }\n return target;\n}\n\n/**\n * Returns the capability metadata for every available harness.\n *\n * Enumerates every built-in harness from {@link BUILTIN_HARNESS_CATALOG} without\n * loading a single harness module or harness SDK, then merges in any third-party\n * harness targets registered into the plugin registry that are not already in\n * the catalog. Use this to populate harness selection UIs.\n *\n * @returns Array of {@link HarnessInfo} objects, one per available harness.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function listHarnesses(): HarnessInfo[] {\n const merged = new Map<string, HarnessInfo>();\n for (const info of Object.values(BUILTIN_HARNESS_CATALOG)) {\n merged.set(info.id, info);\n }\n for (const meta of pluginRegistry.list(\"harness\")) {\n if (!merged.has(meta.id)) {\n // Third-party harnesses carry no HarnessInfo row; read the capability flags\n // off the registered target (defaulting to conservative false) so a\n // model-agnostic / in-band-abort harness can still advertise them.\n const target = pluginRegistry.get(\"harness\", meta.id);\n merged.set(meta.id, {\n id: meta.id,\n name: meta.displayName,\n modelAgnostic: target?.modelAgnostic ?? false,\n supportsInBandAbort: target?.supportsInBandAbort ?? false,\n // Left absent when the target declares nothing: \"speaks no surface\" and\n // \"did not say\" are different claims, and the platform resolver must be\n // able to tell them apart before it filters a harness out.\n ...(target?.surfaces ? { surfaces: target.surfaces } : {}),\n ...(target?.providerPlurality ? { providerPlurality: target.providerPlurality } : {}),\n ...(target?.capabilities ? { capabilities: target.capabilities } : {}),\n });\n }\n }\n return [...merged.values()];\n}\n\n/**\n * List models available to a specific harness without starting a full agent session.\n *\n * Ensures the built-in harness targets are registered (idempotent), then\n * delegates to the target's optional `listModels()`. Throws on an unknown /\n * not-bundled id (same contract as {@link createHarness}); returns `[]` only\n * when the target exists but exposes no `listModels`.\n *\n * @param harnessId - Registered harness id (e.g. `\"omp\"`, `\"claude-sdk\"`, `\"codex\"`).\n * @param registry - The AI provider registry to discover against — either the\n * bare `id → entry` map or a merged view. Each entry names its credential by\n * reference, resolved through `options` and delivered to the throwaway\n * harness as `SKAILE_AIP_<ID>_KEY` environment entries.\n * @param options - Which entry to restrict to, and where `env:` / `platform:`\n * references resolve from. Defaults to the whole registry against\n * `process.env`.\n * @throws {Error} When `harnessId` is unknown or excluded from this build.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function listModelsForHarness(\n harnessId: string,\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options?: RegistryCredentialOptions,\n): Promise<ModelEntry[]> {\n const target = await resolveHarnessTarget(harnessId);\n return (await target.listModels?.(registry, options)) ?? [];\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../factory-assets/connectors/flow/run-flow.ts"],"names":["c"],"mappings":";;;;;;;;;;;;;;;AAiEA,IAAI,aAAA;AAEJ,eAAe,gBAAA,GAAiC;AAC9C,EAAA,IAAI,eAAe,OAAO,aAAA;AAC1B,EAAA,aAAA,GAAgB,MAAM,OAAO,mBAA2B,CAAA;AACxD,EAAA,OAAO,aAAA;AACT;AAMA,IAAM,0BAAA,GAA6B,CAAA,GAAI,EAAA,GAAK,EAAA,GAAK,GAAA;AAEjD,IAAM,0BAAA,uBAAiC,GAAA,CAAI;AAAA,EACzC,eAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,E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S,GAAG,WAAA,CAAY,GAAA,EAAK,EAAE,aAAA,EAAe,IAAA,EAAM,CAAA,EAAG;AAChE,IAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,EAAG;AAC1B,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,GAAA,EAAK,MAAM,IAAI,CAAA;AACtC,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,UAAU,CAAA;AAC1C,IAAA,IAAI,EAAA,CAAG,UAAA,CAAW,OAAO,CAAA,EAAG;AAC1B,MAAA,IAAI,KAAA,CAAM,IAAA,KAAS,OAAA,EAAS,OAAO,OAAA;AAAA,IACrC,CAAA,MAAO;AACL,MAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,IAAA,EAAM,OAAO,CAAA;AACxC,MAAA,IAAI,OAAO,OAAO,KAAA;AAAA,IACpB;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-J72MO2WA.js","sourcesContent":["/**\n * runFlow / resumeFlow — CLI entry helpers for the flow connector.\n *\n * Moved from `runner/src/runner.ts` to `factory-assets/connectors/flow/run-flow.ts`\n * in Phase 3 of the flow-connector extraction (2026-05-08). Behaviour is\n * byte-identical to the previous runner-side implementation; only the log\n * source changes from `runner:flow:<runId>` to `flow-connector:run:<runId>`.\n *\n * The runner re-exports these symbols with a deprecation warning for one\n * release. CLI consumers should switch to\n * `import { runFlow, resumeFlow } from \"@skaile/workspaces/factory-assets/connectors/flow/run-flow\"`.\n *\n * Internal runner helpers (FlowOrchestrator, bootstrapRunnerLogStore,\n * createAgentSession, resolveHarnessPaths, session helpers) are loaded lazily\n * via dynamic `await import(\"@skaile/workspaces/runner\")` inside\n * `loadRunnerModule()` below. The lazy load avoids a static package-level\n * cycle (runner → connectors → factory-assets → runner) — the cycle exists at\n * the workspace level but never resolves at module-load time because\n * factory-assets only ever calls `import` from inside an async function body.\n * The string-literal specifier preserves `bun --compile` and tsup static\n * analysis.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { AgentEvent } from \"@skaile/workspaces/bridge\";\nimport {\n findKindDirs,\n isValidAssetName,\n resolveAgentDir,\n resolveSettings,\n resolveSkWorkspaceConfig,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport { parseSkillFrontmatter, validateFlowVersions } from \"@skaile/workspaces/resolver\";\nimport { initTelemetry } from \"@skaile/workspaces/telemetry\";\nimport type { FlowExecution, FlowPromptEvent } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { FlowAdapter } from \"./adapter.js\";\nimport {\n findFlowFileInRoots,\n FLOW_FILE_EXTENSIONS,\n type FlowLookupMiss,\n flowLookupRoots,\n loadFlow,\n} from \"./engine/index.js\";\nimport { flowSkillVersionPins } from \"./engine/node-shape.js\";\nimport { SessionInlineSubFlowRunner } from \"./inline-sub-flow-host.js\";\nimport { SessionNodeExecutor } from \"./node-executor.js\";\nimport { driveOrchestratorTurn } from \"./orchestrator-turn.js\";\nimport { renderStimulusPrompt, type TurnStimulus } from \"./prompt-fragments.js\";\nimport { SessionSubpromptRunner } from \"./subprompt-runner.js\";\n\n/**\n * Lazy `import(\"@skaile/workspaces/runner\")` accessor. Cached on first call so\n * subsequent `runFlow` invocations don't re-evaluate the runner module.\n *\n * Dynamic ESM import is used (not `require`) so vitest and other ESM\n * bundlers honour their alias resolution — `require` would side-step the\n * configured aliases and pick up two distinct module instances when run\n * under vitest. The string-literal specifier ensures bun --compile keeps\n * the dependency (per the static-import-or-die rule in\n * connectors/CLAUDE.md).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _runnerModule: any | undefined;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nasync function loadRunnerModule(): Promise<any> {\n if (_runnerModule) return _runnerModule;\n _runnerModule = await import(\"@skaile/workspaces/runner\");\n return _runnerModule;\n}\n\n/** Type-only re-export of SessionState so the runner tombstone shim still works. */\nexport type SessionState = import(\"@skaile/workspaces/runner\").SessionState;\n\n/** Maximum agent session duration (4 hours). Configurable via {@link RunOptions.sessionTimeoutMs}. */\nconst DEFAULT_SESSION_TIMEOUT_MS = 4 * 60 * 60 * 1000; // 4 hours\n\nconst FLOW_AGENT_OPERATION_NAMES = new Set([\n \"get_available\",\n \"get_state\",\n \"get_globals\",\n \"build_handoff\",\n \"validate_node\",\n \"start_node\",\n \"request_approval\",\n \"request_input\",\n \"complete_node\",\n \"skip_node\",\n \"fail_node\",\n]);\n\n/**\n * Options for {@link runFlow}.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default. First-class\n * gate nodes remain mandatory human decisions in every mode.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport interface RunOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /** Absolute path to the `.flow.yaml` or `.flow.json` definition file. */\n flowPath: string;\n /**\n * Directory containing `agent.yaml`, `SOUL.md`, `RULES.md`, `knowledge/`.\n * Resolved from `skaile.yaml` via `resolveAgentDir` when absent.\n */\n agentDir?: string;\n /**\n * Agent harness. Defaults to `settings.harness` (`\"omp\"` or `\"claude-sdk\"`).\n */\n harness?: string;\n /**\n */\n /**\n * Model name override. Falls back to `settings.model` when absent.\n */\n model?: string;\n /**\n * Path to a specific `settings.json` to load instead of the default\n * layered resolution chain (project → parent → global → built-in defaults).\n */\n settingsFile?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /** Optional human-readable label shown in the session list. */\n sessionLabel?: string;\n /**\n * The session `skaile resume` continues. Its run id is kept and its harness thread resumed,\n * instead of starting a second session. Set by {@link resumeFlow}; not for other callers.\n */\n resumeSession?: SessionState;\n /** Autonomous mode for CLI runs. Defaults to true; first-class gate nodes are never bypassed. */\n autonomousMode?: boolean;\n /**\n * Called for each {@link AgentEvent} emitted during the run\n * (e.g. `text`, `tool_call`, `state_changed`).\n */\n onEvent?: (event: AgentEvent) => void;\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: (line: string) => void;\n}\n\n/**\n * Options for resuming an existing CLI session.\n *\n * Reconnects the harness's conversation thread (conversation history is\n * preserved via the stored `harnessSessionId`) but restarts flow execution\n * from scratch — flow state is not persisted in CLI mode. For governed,\n * resumable flow runs use a host that persists flow state (e.g. the Skaile\n * platform).\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport interface ResumeOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /**\n * Specific run ID to resume. When absent, the current session pointer\n * at `<projectDir>/.skaile/current` is used.\n */\n sessionId?: string;\n /**\n * Agent definition directory override. Defaults to the directory stored\n * in the session file.\n */\n agentDir?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /**\n * Called for each {@link AgentEvent} emitted during the run.\n */\n onEvent?: RunOptions[\"onEvent\"];\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: RunOptions[\"onLog\"];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Start a new flow session from the CLI.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default. The\n * runner remains idle between turns; first-class gates always park for a human\n * decision, including in autonomous mode. Non-CLI hosts (Skaile platform,\n * Pichi) use the orchestrator directly via the serve command surface and drive\n * gates through user actions.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport async function runFlow(opts: RunOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const {\n bootstrapRunnerLogStore,\n bootstrapCapabilityRegistry,\n CapabilityRegistry,\n createAgentSession,\n createSessionStimulusBus,\n defineCapability,\n registerCompositionCapabilities,\n resolveHarnessPaths,\n newSession,\n saveSession,\n touchSession,\n } = runner;\n\n const flow = loadFlow(opts.flowPath);\n const agentDir = opts.agentDir ?? resolveAgentDir(opts.projectDir);\n const settings = await resolveSettings(opts.projectDir, {\n harness: opts.harness,\n model: opts.model,\n });\n\n // `skaile resume` continues the session it was given: same run id, so the harness thread\n // (`harnessSessionId`) resumes and `session list` shows one run, not a second one (p850).\n const session = opts.resumeSession\n ? (({ error: _prior, ...kept }) => touchSession({ ...kept, status: \"running\" }))(\n opts.resumeSession,\n )\n : newSession({\n flowId: flow.id,\n projectDir: opts.projectDir,\n agentDir,\n harness: settings.harness ?? \"omp\",\n model: settings.model,\n label: opts.sessionLabel,\n });\n\n // A dry run only prints the plan: it must not leave a `running` session behind.\n if (!opts.dryRun) await saveSession(opts.projectDir, session);\n\n // Bootstrap structured logging — registers a process-singleton LogStore.\n // OnLogBridgeSink mirrors entries to opts.onLog when caller provides one,\n // preserving back-compat with CLI hosts that consume plain text lines.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: wsConfigEarly.logging,\n onLog: opts.onLog,\n // A host that takes lines through `onLog` prints them itself; the stdout\n // sink would add every record again as a raw JSON line.\n stdout: opts.onLog === undefined,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n const log = (line: string) => flowLog.info(line);\n const capabilityRegistry = new CapabilityRegistry();\n bootstrapCapabilityRegistry(capabilityRegistry);\n const capabilityHooks = {\n sessionId: session.runId,\n composeTools: () => capabilityRegistry.composeLLMTools(),\n resolve: (name: string) =>\n capabilityRegistry.list().find((cap: { name: string }) => cap.name === name) ?? null,\n invoke: (name: string, input: unknown, _signal?: AbortSignal, callId?: string) =>\n capabilityRegistry.invoke(name, input, { sessionId: session.runId, callId }),\n };\n\n try {\n // ── Dry run ────────────────────────────────────────────────────────────\n if (opts.dryRun) {\n const adapter = new FlowAdapter();\n const handle = await adapter.connect(\n {\n id: \"flow\",\n driver: \"flow\",\n access: \"read-only\" as const,\n options: { flow, seed: { runId: session.runId, startedBy: \"cli\" } },\n },\n {}, // flow needs no connect context\n );\n const state = adapter.getExecution(handle);\n const available = Object.values(state.nodes)\n .filter((n) => n.status === \"available\")\n .map((n) => n.id);\n // The plan is the command's output, not a log event: print it as plain lines\n // (no `[info] [flow-connector:run:…]` prefix from the log formatter).\n const printPlan = opts.onLog ?? ((line: string) => console.log(line));\n printPlan(`[dry-run] Flow: ${flow.name} (${flow.id})`);\n printPlan(`[dry-run] Available: ${available.join(\", \") || \"(none)\"}`);\n await adapter.disconnect(handle);\n return;\n }\n\n await validatePinnedVersions(flow, opts.projectDir, log);\n\n // ── Telemetry initialization ────────────────────────────────────────────\n const wsConfig = wsConfigEarly;\n const telemetry = await initTelemetry(wsConfig.telemetry);\n const flowTrace = telemetry.startTrace({\n name: `flow:${flow.id}`,\n kind: \"flow_run\",\n attributes: {\n \"skaile.flow.id\": flow.id,\n \"skaile.flow.run_id\": session.runId,\n },\n });\n\n // ── Agent session setup ─────────────────────────────────────────────────\n const harnessPaths = resolveHarnessPaths(settings);\n const agentSession = await createAgentSession({\n projectDir: opts.projectDir,\n agentDir: session.agentDir,\n harness: session.harness,\n model: session.model,\n resumeSessionId: session.harnessSessionId,\n projectClaudeMd: path.join(opts.projectDir, \"CLAUDE.md\"),\n promptsDir: path.join(opts.projectDir, harnessPaths.promptsDir),\n sessionId: session.runId,\n onLog: log,\n telemetry,\n trace: flowTrace,\n wsConfig,\n capabilities: capabilityHooks,\n capabilityRegistry,\n // A flow step has no one to answer an approval card: with `permission_mode: interactive`\n // a tool call that needs approval is refused instead of hanging the step.\n unattended: true,\n });\n if (agentSession.composition?.discoverableEntries.length) {\n registerCompositionCapabilities(\n capabilityRegistry,\n agentSession.composition.discoverableEntries,\n );\n }\n const { harness } = agentSession;\n const nodeExecutor = new SessionNodeExecutor({ workspaceDir: opts.projectDir });\n // Same endpoints and credentials the session harness used: the registry\n // and the credential env `createAgentSession` already resolved — not a\n // new resolution, not a new secret channel.\n const subpromptRunner = new SessionSubpromptRunner({\n harnessType: agentSession.harnessType,\n sessionModel: agentSession.model,\n workspaceDir: opts.projectDir,\n registry: agentSession.registry,\n credentialEnv: agentSession.credentialEnv,\n ...(agentSession.modelRef ? { modelRef: agentSession.modelRef } : {}),\n });\n let harnessStarted = false;\n const updatedSession = { ...session };\n\n // Track harness session ID so future resumes can reconnect the SDK thread.\n harness.on(\"agent-event\", () => {\n const runtimeSessionId = harness.runtimeSessionId;\n if (!runtimeSessionId || runtimeSessionId === updatedSession.harnessSessionId) return;\n updatedSession.harnessSessionId = runtimeSessionId;\n void saveSession(opts.projectDir, updatedSession).catch(() => {});\n });\n\n // ── FlowAdapter + stimulus bus ─────────────────────────────────────────\n //\n // Phase 4 of the flow-connector extraction: SessionStimulusBus is the sole\n // turn driver. The legacy FlowOrchestrator + onStateChange subscription\n // are gone — every turn is initiated either by the bus (after an adapter\n // mutation observed via `useBusForStimulus: true`) or by an explicit\n // `bus.signal()` call from this function (the initial flow_started turn).\n //\n // The bus's `driveTurn` callback receives the stimulus paragraph the\n // adapter rendered (not the full orchestrator prompt). It hands the turn to\n // `driveOrchestratorTurn`, which rebuilds the five-section prompt so the\n // agent sees the same flow context the legacy orchestrator produced — and\n // announces it, so a CLI consumer's `onEvent` stream carries the prompt too.\n const flowConnectorId = \"flow\";\n const turnTimeoutMs = opts.sessionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;\n\n const ensureHarnessStarted = async (): Promise<void> => {\n if (harnessStarted) return;\n await harness.start();\n harnessStarted = true;\n };\n\n // Same widening the `state_changed` forwarder below performs: `onEvent` is\n // typed against the bridge's harness-level union, which has no case for a\n // runtime-level event.\n const emitFlowPrompt = (event: FlowPromptEvent): void => {\n opts.onEvent?.(event as unknown as AgentEvent);\n };\n\n const inlineSubFlowRunner = new SessionInlineSubFlowRunner({\n resolveFlow: (flowId) => loadFlow(resolveFlowPath(flowId, opts.projectDir)),\n nodeExecutor,\n subpromptRunner,\n driveAgentTurn: async ({ flow: childFlow, execution, stimulus }) => {\n await ensureHarnessStarted();\n await driveOrchestratorTurn({\n flow: childFlow,\n execution,\n stimulus,\n emit: emitFlowPrompt,\n deliver: (prompt) => awaitAgentEnd(harness, prompt, opts.onEvent, turnTimeoutMs),\n });\n },\n });\n\n // Forward declaration so `driveTurn` can read the live execution\n // snapshot. Assigned just below, before the bus can fire.\n let flowAdapterRef: FlowAdapter | null = null;\n let flowHandleRef: import(\"@skaile/workspaces/connectors\").ConnectorHandle | null = null;\n\n const stimulusBus = createSessionStimulusBus({\n driveTurn: async (\n promptFragment: string,\n metas: Array<Record<string, unknown>>,\n ): Promise<void> => {\n // The adapter signal carries `meta.kind` per stimulus. Use that to\n // reconstruct the typed `TurnStimulus`; for compound batches, fall\n // back to `state_changed` (the union element that means \"look at\n // current state and continue\").\n const lastKind = metas[metas.length - 1]?.kind;\n let stimulus: TurnStimulus;\n if (lastKind === \"flow_started\") {\n stimulus = { kind: \"flow_started\" };\n } else if (\n lastKind === \"user_message\" &&\n typeof metas[metas.length - 1]?.text === \"string\"\n ) {\n const meta = metas[metas.length - 1] as Record<string, unknown>;\n stimulus = {\n kind: \"user_message\",\n text: String(meta.text ?? \"\"),\n senderId: String(meta.senderId ?? \"user\"),\n };\n } else {\n stimulus = { kind: \"state_changed\" };\n }\n // The fragment passed in by the bus is the adapter's\n // `renderStimulusPrompt(stim)` joined across coalesced signals. It is\n // discarded in favour of the structured stimulus, which\n // `driveOrchestratorTurn` rebuilds the full prompt from; that keeps the\n // prompt shape stable and the structured form already contains\n // everything the fragment encoded.\n void promptFragment;\n if (!flowAdapterRef || !flowHandleRef) {\n throw new Error(\"driveTurn fired before FlowAdapter was wired\");\n }\n await flowAdapterRef.drainRuntimeNodes(flowHandleRef);\n const execution = flowAdapterRef.getExecution(flowHandleRef);\n if (execution.done || execution.status === \"failed\" || execution.status === \"cancelled\") {\n return;\n }\n if (!flowAdapterRef.shouldDriveAgentTurn(flowHandleRef, stimulus)) return;\n await ensureHarnessStarted();\n await driveOrchestratorTurn({\n flow,\n execution,\n stimulus,\n emit: emitFlowPrompt,\n deliver: (prompt) => awaitAgentEnd(harness, prompt, opts.onEvent, turnTimeoutMs),\n });\n },\n log: flowLog,\n });\n\n const flowAdapter = new FlowAdapter();\n const flowHandle = await flowAdapter.connect(\n {\n id: flowConnectorId,\n driver: \"flow\",\n access: \"read-write\" as const,\n options: {\n flow,\n seed: {\n runId: session.runId,\n startedBy: \"cli\",\n autonomousMode: opts.autonomousMode ?? true,\n },\n stimulusBus,\n useBusForStimulus: true,\n nodeExecutor,\n subpromptRunner,\n inlineSubFlowRunner,\n },\n },\n {}, // flow needs no connect context\n );\n flowAdapterRef = flowAdapter;\n flowHandleRef = flowHandle;\n\n // Flow operations retain the connector's published bare protocol names;\n // this is the intentional exception to generic capability namespaces.\n for (const operation of flowAdapter.tools\n .describeOperations(flowHandle)\n .filter(({ name }) => FLOW_AGENT_OPERATION_NAMES.has(name))) {\n const shape: Record<string, z.ZodType> = {};\n for (const arg of operation.args) {\n let schema: z.ZodType;\n switch (arg.type) {\n case \"boolean\":\n schema = z.boolean();\n break;\n case \"number\":\n schema = z.number();\n break;\n case \"json\":\n schema = z.json();\n break;\n default:\n schema = z.string();\n }\n shape[arg.name] = arg.required ? schema : schema.optional();\n }\n capabilityRegistry.register(\n defineCapability({\n name: operation.name,\n displayName: operation.name,\n description: operation.description,\n input: z.object(shape),\n side: \"agent\",\n origin: { kind: \"flow\", flowId: flow.id },\n scope: \"session\",\n audience: [\"llm\"],\n kind: operation.accessLevel === \"read\" ? \"query\" : \"effect\",\n handler: async (args: Record<string, unknown>) =>\n flowAdapter.executeOp(flowHandle, operation.name, args),\n }),\n \"agent\",\n );\n }\n\n // Forward state_changed events to the caller. The bus computes a\n // turn-kicking stimulus on each adapter mutation; the host-facing\n // event stream still observes the full snapshot via onChange.\n flowAdapter.onStateChange(flowHandle, (state: FlowExecution) => {\n opts.onEvent?.({\n type: \"state_changed\",\n store: `flow:${state.runId}`,\n state: state as unknown as Record<string, unknown>,\n } as unknown as AgentEvent);\n });\n\n // ── Execute ────────────────────────────────────────────────────────────\n flowLog.info(\"starting flow\", {\n flowId: flow.id,\n flowName: flow.name,\n runId: session.runId,\n });\n\n let runError: unknown;\n try {\n // Kick the initial flow_started turn explicitly. Subsequent turns are\n // driven by the bus signaling whenever the adapter mutates.\n const initialStimulus: TurnStimulus = { kind: \"flow_started\" };\n await stimulusBus.signal(flowConnectorId, {\n promptFragment: renderStimulusPrompt(initialStimulus),\n meta: { kind: initialStimulus.kind },\n });\n\n const finalState = flowAdapter.getExecution(flowHandle);\n if (finalState.done) {\n flowLog.info(\"flow complete\", { flowId: flow.id, flowName: flow.name });\n } else if (finalState.status === \"failed\") {\n flowLog.error(\"flow failed\", undefined, { flowId: flow.id, flowName: flow.name });\n } else {\n flowLog.warn(\"flow paused awaiting further stimulus\", {\n flowId: flow.id,\n status: finalState.status,\n note: \"CLI mode does not supply human approval/input decisions\",\n });\n }\n } catch (err) {\n // The harness could not start (SDK missing, bad credentials, …): no node ran, so the\n // session is `failed` with the cause, not a `paused` run that `resume` would pick up.\n runError = err;\n throw err;\n } finally {\n harness.kill();\n const lastState = flowAdapter.getExecution(flowHandle);\n const failed = runError !== undefined;\n let status: \"complete\" | \"failed\" | \"paused\" = \"paused\";\n if (failed) status = \"failed\";\n else if (lastState.status === \"complete\") status = \"complete\";\n await saveSession(\n opts.projectDir,\n touchSession({\n ...updatedSession,\n harnessSessionId: harness.runtimeSessionId ?? updatedSession.harnessSessionId,\n status,\n ...(failed\n ? { error: runError instanceof Error ? runError.message : String(runError) }\n : {}),\n }),\n ).catch(() => {});\n await flowAdapter.disconnect(flowHandle).catch(() => {});\n await agentSession.dispose();\n telemetry.endTrace(flowTrace, {\n status: flowAdapter.getExecution(flowHandle).status === \"complete\" ? \"ok\" : \"error\",\n });\n await telemetry.flush().catch(() => {});\n }\n } finally {\n disposeLogStore();\n }\n}\n\n/**\n * Resume an existing session from the CLI.\n *\n * With the Phase 2 turn-based model, flow state is NOT persisted to\n * local session files — only the harness session ID is kept. The CLI\n * can resume the agent's conversation thread, but the flow execution\n * itself starts from scratch because the runner has no durable store\n * for per-run state.\n *\n * For a governed, resumable flow run, use a host that persists flow\n * state (e.g. the Skaile platform). CLI resume is retained as a\n * harness-level convenience only: we load the session, restart the\n * flow, and the SDK will reconnect to the prior conversation thread.\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport async function resumeFlow(opts: ResumeOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const { loadSession, loadSessionById, bootstrapRunnerLogStore } = runner;\n\n const session = opts.sessionId\n ? await loadSessionById(opts.projectDir, opts.sessionId)\n : await loadSession(opts.projectDir);\n\n if (!session) {\n const hint = opts.sessionId\n ? `session ${opts.sessionId}`\n : `current session in ${opts.projectDir}/.skaile`;\n throw new Error(`No session found (${hint}) — run 'start' first`);\n }\n\n const flowPath = resolveFlowPath(session.flowId, opts.projectDir);\n\n // Bootstrap a transient logger for the resume diagnostics. The inner\n // runFlow() call will register its own LogStore for the new run. Keep\n // OnLogBridgeSink wiring so callers passing onLog still see this line.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: wsConfigEarly.logging,\n onLog: opts.onLog,\n stdout: opts.onLog === undefined,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n flowLog.info(\"resuming session\", {\n runId: session.runId,\n flowId: session.flowId,\n note: \"CLI mode does not persist flow state — flow restarts from scratch; harness thread resumes\",\n });\n\n try {\n await runFlow({\n projectDir: opts.projectDir,\n flowPath,\n agentDir: opts.agentDir ?? session.agentDir,\n harness: session.harness,\n model: session.model,\n sessionLabel: session.label,\n resumeSession: session,\n dryRun: opts.dryRun,\n sessionTimeoutMs: opts.sessionTimeoutMs,\n onEvent: opts.onEvent,\n onLog: opts.onLog,\n });\n } finally {\n disposeLogStore();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nasync function validatePinnedVersions(\n flow: Awaited<ReturnType<typeof loadFlow>>,\n projectDir: string,\n log: (line: string) => void,\n): Promise<void> {\n const pinnedNodes = flowSkillVersionPins(flow);\n if (pinnedNodes.length === 0) return;\n\n const skillVersions = new Map<string, string>();\n const aiResourcesDir = findAiResourcesDir(projectDir);\n if (aiResourcesDir) {\n for (const node of pinnedNodes) {\n const skillId = node.skillId;\n if (skillVersions.has(skillId)) continue;\n const skillPath = findSkillMd(aiResourcesDir, skillId);\n if (skillPath) {\n const content = fs.readFileSync(skillPath, \"utf-8\");\n const fm = parseSkillFrontmatter(content);\n skillVersions.set(skillId, fm.metadata?.version ?? fm.version ?? \"\");\n }\n }\n }\n\n const checks = validateFlowVersions(pinnedNodes, skillVersions);\n const failures = checks.filter((c) => !c.satisfied);\n if (failures.length > 0) {\n const lines = failures.map(\n (f) => ` ${f.nodeId}: wants ${f.requested}, found ${f.actual || \"(none)\"}`,\n );\n throw new Error(`Skill version mismatch:\\n${lines.join(\"\\n\")}`);\n }\n for (const c of checks.filter((c) => c.satisfied)) {\n log(` Version OK: ${c.skillId} ${c.actual} satisfies ${c.requested}`);\n }\n}\n\n/**\n * Assert `found` sits inside one of `roots`.\n *\n * A backstop, not the primary control: `isValidAssetName` already rejects every\n * id containing a separator, and `findFlowFileInRoots` skips any candidate that\n * escapes its search dir. So on today's code this cannot fire — it is here to\n * fail loudly rather than silently if a future lookup stops enforcing\n * containment itself. Widening the accepted extensions must never widen which\n * paths are reachable, and this is the line that keeps that honest.\n */\nfunction assertContainedInAnyRoot(found: string, roots: string[], flowId: string): void {\n const resolved = path.resolve(found);\n const inside = roots.some((root) => {\n const relative = path.relative(path.resolve(root), resolved);\n return !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n });\n if (!inside) {\n throw new Error(`Flow path escapes its lookup root: ${JSON.stringify(flowId)}`);\n }\n}\n\n/** One line per near-miss: a file that is right there but was still rejected. */\nfunction describeMisses(misses: FlowLookupMiss[], heading: string): string {\n const seen = new Set<string>();\n const lines: string[] = [];\n for (const miss of misses) {\n if (seen.has(miss.path)) continue;\n seen.add(miss.path);\n lines.push(\n miss.reason === \"id-mismatch\"\n ? ` ${miss.path}: declares id ${JSON.stringify(miss.declaredId ?? \"\")}`\n : ` ${miss.path}: could not be parsed (${miss.error ?? \"unknown error\"})`,\n );\n }\n return lines.length > 0 ? `\\n${heading}\\n${lines.join(\"\\n\")}` : \"\";\n}\n\n/**\n * Resolve one flow identity through the CLI/serve host's normal lookup order —\n * the same roots and filenames `skaile run` and `flow list` use, via\n * {@link flowLookupRoots} / {@link findFlowFileInRoots}. Resolution is by the\n * **declared** `id`, not by filename.\n *\n * @throws {Error} When `flowId` is not a canonical asset name, when no file\n * declares it, or when a match somehow resolves outside every lookup root.\n */\nexport function resolveFlowPath(flowId: string, projectDir: string): string {\n // Sub-flow targets and resumed session records are the two callers, so an\n // identity that is not canonical is a bug in the caller, not a missing file.\n if (!isValidAssetName(flowId)) {\n throw new Error(`Invalid canonical flow identity: ${JSON.stringify(flowId)}`);\n }\n\n const roots = flowLookupRoots(projectDir);\n const misses: FlowLookupMiss[] = [];\n const found = findFlowFileInRoots(flowId, roots, { onMiss: (m) => misses.push(m) });\n if (found) {\n assertContainedInAnyRoot(found, roots, flowId);\n return found;\n }\n\n // A file that is present but unparseable is a different problem from a missing\n // one, and \"not found\" is the wrong headline for it — that exact misdirection\n // is what this change exists to remove, so don't reintroduce it here.\n if (misses.length > 0 && misses.every((m) => m.reason === \"unparseable\")) {\n throw new Error(\n `Flow ${flowId} was found but could not be loaded.` + describeMisses(misses, \"Candidates:\"),\n );\n }\n\n const shown = roots.slice(0, 3).join(\", \");\n const more = roots.length > 3 ? \", …\" : \"\";\n // Spelled from FLOW_FILE_EXTENSIONS so the message cannot drift from the\n // candidate list the lookup actually probes.\n const accepted = FLOW_FILE_EXTENSIONS.map((ext) => `${flowId}${ext}`).join(\" | \");\n throw new Error(\n `Flow not found: ${flowId}. Searched ${roots.length} root(s) (${shown || \"none\"}${more}) ` +\n `for ${accepted} — flat, or inside a ${flowId}/ directory. ` +\n `Only the flows of this project are found: run \\`skaile add flow:@<publisher>/<name>\\` first for a flow that lives in a library or source.` +\n describeMisses(misses, \"Near misses:\"),\n );\n}\n\n/** Walk up from projectDir to find ai-assets/ */\nfunction findAiResourcesDir(projectDir: string): string | null {\n let dir = projectDir;\n for (let i = 0; i < 6; i++) {\n const candidate = path.join(dir, \"ai-assets\");\n if (fs.existsSync(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/** Find SKILL.md for a given skill ID in any `skills/` directory under ai-assets */\nfunction findSkillMd(aiResourcesDir: string, skillId: string): string | null {\n for (const skillsDir of findKindDirs(aiResourcesDir, \"skills\")) {\n const found = walkForSkill(skillsDir, skillId);\n if (found) return found;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Turn-wait helper\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal harness surface needed by the bus's `driveTurn` callback. Mirrors\n * the slice the legacy `FlowOrchestrator` consumed (`prompt` + `on` +\n * `removeAllListeners`) so we can keep the wait helper private to this\n * module without pulling in a runtime dep on `@skaile/workspaces/bridge`.\n */\ninterface TurnHarnessSurface {\n prompt(message: string): Promise<void>;\n on(event: \"agent-event\", handler: (event: AgentEvent) => void): void;\n removeAllListeners(event: \"agent-event\"): void;\n}\n\n/**\n * Send a prompt to the harness and resolve when the agent emits\n * `agent_end` (or reject on an `error` that is not an in-place retry).\n * Identical contract to the legacy `awaitAgentEnd` helper from\n * `flow-orchestrator.ts`. Phase 4 lifts the helper into `run-flow.ts` because\n * the bus now owns turn driving. Exported for tests only.\n */\nexport function awaitAgentEnd(\n harness: TurnHarnessSurface,\n prompt: string,\n onEvent: ((event: AgentEvent) => void) | undefined,\n timeoutMs: number,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n let settled = false;\n\n const done = (err?: Error) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n harness.removeAllListeners(\"agent-event\");\n if (err) reject(err);\n else resolve();\n };\n\n const timer = setTimeout(\n () => done(new Error(`Flow turn timed out after ${timeoutMs / 1000}s`)),\n timeoutMs,\n );\n\n harness.on(\"agent-event\", (event: AgentEvent) => {\n onEvent?.(event);\n if (event.type === \"agent_end\") done();\n // An in-place retry replays this same turn; its own end settles it.\n else if (event.type === \"error\" && event.retrying !== true) {\n const msg =\n (event as { error?: string; message?: string }).error ??\n (event as { message?: string }).message ??\n \"Agent error\";\n done(new Error(msg));\n }\n });\n\n harness.prompt(prompt).catch(done);\n });\n}\n\nfunction walkForSkill(dir: string, skillId: string): string | null {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const full = path.join(dir, entry.name);\n const skillMd = path.join(full, \"SKILL.md\");\n if (fs.existsSync(skillMd)) {\n if (entry.name === skillId) return skillMd;\n } else {\n const found = walkForSkill(full, skillId);\n if (found) return found;\n }\n }\n return null;\n}\n"]}