@skaile/workspaces 6.5.0 → 6.7.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 (392) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/ai-sdk.js +12 -19
  3. package/dist/ai-sdk.js.map +1 -1
  4. package/dist/app-sdk/index.js +1 -1
  5. package/dist/{asset-feeds-4I6Z4OI3.js → asset-feeds-4A7PJ4OB.js} +20 -20
  6. package/dist/{asset-feeds-4I6Z4OI3.js.map → asset-feeds-4A7PJ4OB.js.map} +1 -1
  7. package/dist/asset-manager/catalog-deployer.js +7 -7
  8. package/dist/asset-manager/index.js +12 -12
  9. package/dist/asset-manager/installer.js +8 -8
  10. package/dist/asset-manager/renderers.js +7 -7
  11. package/dist/asset-manager/src/index.d.ts +89 -15
  12. package/dist/asset-manager/src/index.d.ts.map +1 -1
  13. package/dist/asset-manager/src/install-agent.d.ts +22 -1
  14. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  15. package/dist/asset-manager/src/install-instances.d.ts +30 -1
  16. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  17. package/dist/asset-manager/src/installer.d.ts +12 -0
  18. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  19. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  20. package/dist/bridge/harnesses/claude-sdk.js +23 -17
  21. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  22. package/dist/bridge/harnesses/codex.js +12 -11
  23. package/dist/bridge/harnesses/codex.js.map +1 -1
  24. package/dist/bridge/harnesses/continue.js +13 -11
  25. package/dist/bridge/harnesses/continue.js.map +1 -1
  26. package/dist/bridge/harnesses/echo.js +6 -5
  27. package/dist/bridge/harnesses/echo.js.map +1 -1
  28. package/dist/bridge/harnesses/gemini.js +9 -7
  29. package/dist/bridge/harnesses/goose.js +13 -11
  30. package/dist/bridge/harnesses/goose.js.map +1 -1
  31. package/dist/bridge/harnesses/omp.js +10 -8
  32. package/dist/bridge/harnesses/omp.js.map +1 -1
  33. package/dist/bridge/harnesses/opencode.js +13 -11
  34. package/dist/bridge/harnesses/opencode.js.map +1 -1
  35. package/dist/bridge/harnesses/qwen.js +10 -8
  36. package/dist/bridge/harnesses/qwen.js.map +1 -1
  37. package/dist/bridge/index.js +19 -17
  38. package/dist/bridge/src/ai-sdk.d.ts.map +1 -1
  39. package/dist/bridge/src/claude-sdk-surface.d.ts +2 -1
  40. package/dist/bridge/src/claude-sdk-surface.d.ts.map +1 -1
  41. package/dist/bridge/src/harness-binaries.d.ts +21 -0
  42. package/dist/bridge/src/harness-binaries.d.ts.map +1 -0
  43. package/dist/bridge/src/harness-model-check.d.ts +22 -6
  44. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  45. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  46. package/dist/bridge/src/harnesses/continue.d.ts.map +1 -1
  47. package/dist/bridge/src/harnesses/gemini.d.ts.map +1 -1
  48. package/dist/bridge/src/harnesses/goose.d.ts.map +1 -1
  49. package/dist/bridge/src/harnesses/omp-models-yml.d.ts.map +1 -1
  50. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  51. package/dist/bridge/src/harnesses/opencode.d.ts.map +1 -1
  52. package/dist/bridge/src/harnesses/qwen.d.ts.map +1 -1
  53. package/dist/bridge/src/index.d.ts +2 -1
  54. package/dist/bridge/src/index.d.ts.map +1 -1
  55. package/dist/{chunk-UZET67SO.js → chunk-237BMOZW.js} +4 -4
  56. package/dist/{chunk-UZET67SO.js.map → chunk-237BMOZW.js.map} +1 -1
  57. package/dist/{chunk-J5JWLKLB.js → chunk-37AYPPOO.js} +41 -19
  58. package/dist/chunk-37AYPPOO.js.map +1 -0
  59. package/dist/{chunk-3KSLUVKB.js → chunk-37X4A6VZ.js} +7 -7
  60. package/dist/{chunk-3KSLUVKB.js.map → chunk-37X4A6VZ.js.map} +1 -1
  61. package/dist/{chunk-EO7KGX6P.js → chunk-3HSLJAMJ.js} +4 -4
  62. package/dist/{chunk-EO7KGX6P.js.map → chunk-3HSLJAMJ.js.map} +1 -1
  63. package/dist/{chunk-AFTZNR2W.js → chunk-3W6XZQ2Y.js} +3 -3
  64. package/dist/{chunk-AFTZNR2W.js.map → chunk-3W6XZQ2Y.js.map} +1 -1
  65. package/dist/{chunk-SZTHSPRC.js → chunk-4C2E5QUP.js} +4 -3
  66. package/dist/chunk-4C2E5QUP.js.map +1 -0
  67. package/dist/{chunk-T7HGEMNB.js → chunk-4CD2R4MJ.js} +5 -4
  68. package/dist/chunk-4CD2R4MJ.js.map +1 -0
  69. package/dist/{chunk-TNQLDEM6.js → chunk-6RPS7JEH.js} +302 -54
  70. package/dist/chunk-6RPS7JEH.js.map +1 -0
  71. package/dist/{chunk-NSIOBKDX.js → chunk-6UP2EDFN.js} +4 -313
  72. package/dist/chunk-6UP2EDFN.js.map +1 -0
  73. package/dist/{chunk-KUADKMNX.js → chunk-72TLO2AG.js} +4 -4
  74. package/dist/{chunk-KUADKMNX.js.map → chunk-72TLO2AG.js.map} +1 -1
  75. package/dist/{chunk-HPA3RP5E.js → chunk-AO57IFME.js} +3 -3
  76. package/dist/{chunk-HPA3RP5E.js.map → chunk-AO57IFME.js.map} +1 -1
  77. package/dist/{chunk-G5SYFFMD.js → chunk-ASBZOTEO.js} +2 -2
  78. package/dist/{chunk-G5SYFFMD.js.map → chunk-ASBZOTEO.js.map} +1 -1
  79. package/dist/{chunk-YBEJCQE5.js → chunk-BB5EJLKZ.js} +3 -3
  80. package/dist/{chunk-YBEJCQE5.js.map → chunk-BB5EJLKZ.js.map} +1 -1
  81. package/dist/{chunk-LE6QS4PG.js → chunk-BKLDBUQA.js} +3 -3
  82. package/dist/{chunk-LE6QS4PG.js.map → chunk-BKLDBUQA.js.map} +1 -1
  83. package/dist/{chunk-HTGTNN2B.js → chunk-CMXDFTA2.js} +3 -3
  84. package/dist/{chunk-HTGTNN2B.js.map → chunk-CMXDFTA2.js.map} +1 -1
  85. package/dist/{chunk-J6YPKMMY.js → chunk-CTRTFMCX.js} +6 -6
  86. package/dist/{chunk-J6YPKMMY.js.map → chunk-CTRTFMCX.js.map} +1 -1
  87. package/dist/{chunk-ETF6Q3R3.js → chunk-DFP476EU.js} +8 -4
  88. package/dist/chunk-DFP476EU.js.map +1 -0
  89. package/dist/{chunk-TGUMN5G7.js → chunk-G44FFUMA.js} +13 -11
  90. package/dist/chunk-G44FFUMA.js.map +1 -0
  91. package/dist/{chunk-G4NCSYWR.js → chunk-G7NMF5WQ.js} +4 -4
  92. package/dist/{chunk-G4NCSYWR.js.map → chunk-G7NMF5WQ.js.map} +1 -1
  93. package/dist/{chunk-KA2GLAPS.js → chunk-GAIMSCZ7.js} +10 -8
  94. package/dist/chunk-GAIMSCZ7.js.map +1 -0
  95. package/dist/{chunk-AVFRFGM2.js → chunk-GNUA7XT2.js} +3 -2
  96. package/dist/chunk-GNUA7XT2.js.map +1 -0
  97. package/dist/{chunk-6Y3SC7O4.js → chunk-GTAHU4N4.js} +4 -4
  98. package/dist/{chunk-6Y3SC7O4.js.map → chunk-GTAHU4N4.js.map} +1 -1
  99. package/dist/{chunk-7H4GTP7V.js → chunk-HLAEYFUN.js} +3 -3
  100. package/dist/{chunk-7H4GTP7V.js.map → chunk-HLAEYFUN.js.map} +1 -1
  101. package/dist/{chunk-B436SG5P.js → chunk-HMVAGPYR.js} +48 -12
  102. package/dist/chunk-HMVAGPYR.js.map +1 -0
  103. package/dist/{chunk-EN5REMWV.js → chunk-HPXONAI2.js} +7 -5
  104. package/dist/chunk-HPXONAI2.js.map +1 -0
  105. package/dist/{chunk-KYNCY3F3.js → chunk-HQAPUPBE.js} +3 -3
  106. package/dist/{chunk-KYNCY3F3.js.map → chunk-HQAPUPBE.js.map} +1 -1
  107. package/dist/{chunk-USVUS4DJ.js → chunk-IRK3LNG3.js} +7 -7
  108. package/dist/{chunk-USVUS4DJ.js.map → chunk-IRK3LNG3.js.map} +1 -1
  109. package/dist/{chunk-7EMS2GZO.js → chunk-J7VEQORJ.js} +70 -17
  110. package/dist/chunk-J7VEQORJ.js.map +1 -0
  111. package/dist/{chunk-2HS357RA.js → chunk-KO3VSZQP.js} +48 -19
  112. package/dist/chunk-KO3VSZQP.js.map +1 -0
  113. package/dist/{chunk-KSH5CFQS.js → chunk-KORDNXKA.js} +3 -3
  114. package/dist/{chunk-KSH5CFQS.js.map → chunk-KORDNXKA.js.map} +1 -1
  115. package/dist/{chunk-Z2X7UZEZ.js → chunk-L3JQJ6D5.js} +6 -6
  116. package/dist/{chunk-Z2X7UZEZ.js.map → chunk-L3JQJ6D5.js.map} +1 -1
  117. package/dist/{chunk-OBZ5WQ32.js → chunk-L7QOZG5V.js} +3 -3
  118. package/dist/{chunk-OBZ5WQ32.js.map → chunk-L7QOZG5V.js.map} +1 -1
  119. package/dist/{chunk-B4BLJUYN.js → chunk-LX4TTTRR.js} +79 -36
  120. package/dist/chunk-LX4TTTRR.js.map +1 -0
  121. package/dist/{chunk-KSUT5KAE.js → chunk-LZPJOF7Y.js} +3 -3
  122. package/dist/{chunk-KSUT5KAE.js.map → chunk-LZPJOF7Y.js.map} +1 -1
  123. package/dist/{chunk-OLHHN3NO.js → chunk-N6ZGB5ES.js} +4 -3
  124. package/dist/chunk-N6ZGB5ES.js.map +1 -0
  125. package/dist/{chunk-2M3VLKT2.js → chunk-NURTGAWM.js} +3 -3
  126. package/dist/{chunk-2M3VLKT2.js.map → chunk-NURTGAWM.js.map} +1 -1
  127. package/dist/{chunk-22ZX33H6.js → chunk-O5Y7VMVQ.js} +16 -15
  128. package/dist/chunk-O5Y7VMVQ.js.map +1 -0
  129. package/dist/{chunk-IWKKTCXY.js → chunk-O7ADRMCR.js} +67 -16
  130. package/dist/chunk-O7ADRMCR.js.map +1 -0
  131. package/dist/{chunk-SRTWKZP2.js → chunk-OGTQUEAO.js} +21 -14
  132. package/dist/chunk-OGTQUEAO.js.map +1 -0
  133. package/dist/{chunk-U6KRTCNA.js → chunk-OSABUEWA.js} +3 -3
  134. package/dist/{chunk-U6KRTCNA.js.map → chunk-OSABUEWA.js.map} +1 -1
  135. package/dist/{chunk-E6UWI3TP.js → chunk-PLLZSKOO.js} +3 -3
  136. package/dist/{chunk-E6UWI3TP.js.map → chunk-PLLZSKOO.js.map} +1 -1
  137. package/dist/{chunk-W5KCAWGN.js → chunk-PTJTOPE5.js} +3 -3
  138. package/dist/{chunk-W5KCAWGN.js.map → chunk-PTJTOPE5.js.map} +1 -1
  139. package/dist/{chunk-TROEC2Z2.js → chunk-Q2NYTMT6.js} +18 -17
  140. package/dist/chunk-Q2NYTMT6.js.map +1 -0
  141. package/dist/{chunk-23SG4JRV.js → chunk-QC5BYUED.js} +52 -16
  142. package/dist/chunk-QC5BYUED.js.map +1 -0
  143. package/dist/{chunk-WFLQMAR5.js → chunk-QCR5AE5E.js} +5 -5
  144. package/dist/{chunk-WFLQMAR5.js.map → chunk-QCR5AE5E.js.map} +1 -1
  145. package/dist/{chunk-THX5EE3K.js → chunk-QW5B3TEO.js} +10 -4
  146. package/dist/chunk-QW5B3TEO.js.map +1 -0
  147. package/dist/{chunk-TDPQOR3C.js → chunk-RAHAZ7LP.js} +2 -2
  148. package/dist/{chunk-TDPQOR3C.js.map → chunk-RAHAZ7LP.js.map} +1 -1
  149. package/dist/{chunk-ZUU2PLA3.js → chunk-SBNUXJ6E.js} +3 -3
  150. package/dist/{chunk-ZUU2PLA3.js.map → chunk-SBNUXJ6E.js.map} +1 -1
  151. package/dist/{chunk-DKXNKFKP.js → chunk-SGI5MRKP.js} +75 -3
  152. package/dist/chunk-SGI5MRKP.js.map +1 -0
  153. package/dist/{chunk-UMLCKKIA.js → chunk-TMJBEGS4.js} +36 -7
  154. package/dist/chunk-TMJBEGS4.js.map +1 -0
  155. package/dist/{chunk-K4DHYTUM.js → chunk-TXX3OUYI.js} +3 -3
  156. package/dist/{chunk-K4DHYTUM.js.map → chunk-TXX3OUYI.js.map} +1 -1
  157. package/dist/{chunk-SN663FCA.js → chunk-U52FYGK5.js} +5 -5
  158. package/dist/{chunk-SN663FCA.js.map → chunk-U52FYGK5.js.map} +1 -1
  159. package/dist/{chunk-S7DVT2BV.js → chunk-UCB7FK25.js} +10 -8
  160. package/dist/chunk-UCB7FK25.js.map +1 -0
  161. package/dist/{chunk-3DA74PLW.js → chunk-USSP43U3.js} +3 -3
  162. package/dist/{chunk-3DA74PLW.js.map → chunk-USSP43U3.js.map} +1 -1
  163. package/dist/{chunk-X44XKBZX.js → chunk-WFK4MUBL.js} +21 -7
  164. package/dist/chunk-WFK4MUBL.js.map +1 -0
  165. package/dist/{chunk-YRC2EFOU.js → chunk-WIYVR24B.js} +4 -4
  166. package/dist/{chunk-YRC2EFOU.js.map → chunk-WIYVR24B.js.map} +1 -1
  167. package/dist/{chunk-6EKQENAP.js → chunk-WKENHNDM.js} +6 -6
  168. package/dist/{chunk-6EKQENAP.js.map → chunk-WKENHNDM.js.map} +1 -1
  169. package/dist/chunk-WWSRIT3J.js +59 -0
  170. package/dist/chunk-WWSRIT3J.js.map +1 -0
  171. package/dist/chunk-XON6ODIC.js +315 -0
  172. package/dist/chunk-XON6ODIC.js.map +1 -0
  173. package/dist/{chunk-2IAWVUW3.js → chunk-ZBA4P5TD.js} +4 -4
  174. package/dist/{chunk-2IAWVUW3.js.map → chunk-ZBA4P5TD.js.map} +1 -1
  175. package/dist/{chunk-IS3NIZBX.js → chunk-ZDTDS62B.js} +596 -127
  176. package/dist/chunk-ZDTDS62B.js.map +1 -0
  177. package/dist/{chunk-DNXPXJ3X.js → chunk-ZM4SDVUV.js} +79 -20
  178. package/dist/chunk-ZM4SDVUV.js.map +1 -0
  179. package/dist/{claude-code-JY6CYEG7.js → claude-code-BLFRZU2X.js} +5 -5
  180. package/dist/{claude-code-JY6CYEG7.js.map → claude-code-BLFRZU2X.js.map} +1 -1
  181. package/dist/cli/index.js +481 -205
  182. package/dist/cli/index.js.map +1 -1
  183. package/dist/cli/src/agent-pins.d.ts +9 -3
  184. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  185. package/dist/cli/src/commands/asset-cmd.d.ts +1 -1
  186. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  187. package/dist/cli/src/commands/cache.d.ts.map +1 -1
  188. package/dist/cli/src/commands/catalog.d.ts +2 -0
  189. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  190. package/dist/cli/src/commands/config.d.ts.map +1 -1
  191. package/dist/cli/src/commands/harness-preflight.d.ts +38 -0
  192. package/dist/cli/src/commands/harness-preflight.d.ts.map +1 -0
  193. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  194. package/dist/cli/src/commands/library-index.d.ts +16 -0
  195. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  196. package/dist/cli/src/commands/migrate-assets.d.ts +5 -0
  197. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  198. package/dist/cli/src/commands/migrate-harness.d.ts +15 -7
  199. package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
  200. package/dist/cli/src/commands/migrate.d.ts.map +1 -1
  201. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  202. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  203. package/dist/cli/src/commands/project.d.ts +14 -0
  204. package/dist/cli/src/commands/project.d.ts.map +1 -1
  205. package/dist/cli/src/commands/run.d.ts.map +1 -1
  206. package/dist/cli/src/commands/serve-preflight.d.ts +6 -5
  207. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  208. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  209. package/dist/cli/src/commands/session.d.ts.map +1 -1
  210. package/dist/cli/src/commands/source.d.ts +11 -0
  211. package/dist/cli/src/commands/source.d.ts.map +1 -1
  212. package/dist/cli/src/commands/update.d.ts.map +1 -1
  213. package/dist/cli/src/commands/validate-instances.d.ts +6 -0
  214. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
  215. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  216. package/dist/cli/src/commands/why.d.ts.map +1 -1
  217. package/dist/cli/src/plugin-store/reconcile.d.ts.map +1 -1
  218. package/dist/cli/src/session-hint.d.ts +7 -0
  219. package/dist/cli/src/session-hint.d.ts.map +1 -0
  220. package/dist/connectors/config.js +4 -4
  221. package/dist/connectors/index.js +23 -21
  222. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  223. package/dist/connectors/src/managed-gitconfig.d.ts +6 -4
  224. package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
  225. package/dist/connectors/src/mount-ledger.d.ts.map +1 -1
  226. package/dist/{connectors-VLFOQNS6.js → connectors-OJJU4LSN.js} +26 -24
  227. package/dist/{connectors-VLFOQNS6.js.map → connectors-OJJU4LSN.js.map} +1 -1
  228. package/dist/connectors-shared/index.js +2 -2
  229. package/dist/core/index.js +6 -6
  230. package/dist/core/logging.js +1 -1
  231. package/dist/core/manifest.js +1 -1
  232. package/dist/core/publish-manifest.js +2 -2
  233. package/dist/core/runtime-assets.js +4 -4
  234. package/dist/core/src/agent-instances.d.ts +11 -0
  235. package/dist/core/src/agent-instances.d.ts.map +1 -1
  236. package/dist/core/src/index.d.ts +3 -2
  237. package/dist/core/src/index.d.ts.map +1 -1
  238. package/dist/core/src/logging/index.d.ts +1 -0
  239. package/dist/core/src/logging/index.d.ts.map +1 -1
  240. package/dist/core/src/logging/log-safe-text.d.ts +20 -0
  241. package/dist/core/src/logging/log-safe-text.d.ts.map +1 -0
  242. package/dist/core/src/manifest.d.ts.map +1 -1
  243. package/dist/core/src/publish-manifest.d.ts +20 -6
  244. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  245. package/dist/core/src/repo-manager.d.ts +9 -0
  246. package/dist/core/src/repo-manager.d.ts.map +1 -1
  247. package/dist/core/src/run-state-ignore.d.ts +17 -0
  248. package/dist/core/src/run-state-ignore.d.ts.map +1 -0
  249. package/dist/core/src/workspace-config.d.ts +6 -0
  250. package/dist/core/src/workspace-config.d.ts.map +1 -1
  251. package/dist/core/workspace-config.js +3 -3
  252. package/dist/deploy/index.js +6 -6
  253. package/dist/discovery/index.js +3 -3
  254. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  255. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  256. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  257. package/dist/{ensure-sources-6O54DUQB.js → ensure-sources-F6VQDCWY.js} +28 -26
  258. package/dist/ensure-sources-F6VQDCWY.js.map +1 -0
  259. package/dist/factory-assets/connectors/box.js +23 -21
  260. package/dist/factory-assets/connectors/deploy.js +23 -21
  261. package/dist/factory-assets/connectors/devserver.js +23 -21
  262. package/dist/factory-assets/connectors/flow/adapter.js +23 -21
  263. package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts +2 -0
  264. package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts.map +1 -1
  265. package/dist/factory-assets/connectors/flow/engine.js +7 -7
  266. package/dist/factory-assets/connectors/flow/run-flow.js +25 -23
  267. package/dist/factory-assets/connectors/flow.js +23 -21
  268. package/dist/factory-assets/connectors/git/CONNECTOR.md +4 -1
  269. package/dist/factory-assets/connectors/git/exec.d.ts.map +1 -1
  270. package/dist/factory-assets/connectors/git.js +23 -21
  271. package/dist/factory-assets/connectors/gmail.js +23 -21
  272. package/dist/factory-assets/connectors/googledrive.js +23 -21
  273. package/dist/factory-assets/connectors/local.js +23 -21
  274. package/dist/factory-assets/connectors/mattermost.js +23 -21
  275. package/dist/factory-assets/connectors/memory.js +23 -21
  276. package/dist/factory-assets/connectors/minio.js +23 -21
  277. package/dist/factory-assets/connectors/postgres.js +23 -21
  278. package/dist/factory-assets/connectors/s3.js +23 -21
  279. package/dist/factory-assets/connectors/sharepoint.js +23 -21
  280. package/dist/factory-assets/connectors/sqlite.js +23 -21
  281. package/dist/factory-assets/connectors/static-server.js +23 -21
  282. package/dist/factory-assets/connectors/tunnel.js +23 -21
  283. package/dist/factory-assets/connectors/webdav.js +23 -21
  284. package/dist/factory-assets/connectors/xstate-store.js +23 -21
  285. package/dist/factory-assets/connectors/xstate.js +23 -21
  286. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +14 -1
  287. package/dist/{flows-CIUPK7SB.js → flows-I6ODIPZZ.js} +11 -11
  288. package/dist/{flows-CIUPK7SB.js.map → flows-I6ODIPZZ.js.map} +1 -1
  289. package/dist/{helpers-YHDQHQEQ.js → helpers-PJNUTZXZ.js} +28 -26
  290. package/dist/{helpers-YHDQHQEQ.js.map → helpers-PJNUTZXZ.js.map} +1 -1
  291. package/dist/library/index.js +9 -9
  292. package/dist/library/install.js +3 -3
  293. package/dist/library/src/manifest-writer.d.ts +5 -0
  294. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  295. package/dist/{library-publish-MUGUST43.js → library-publish-FNNDWVBO.js} +54 -52
  296. package/dist/library-publish-FNNDWVBO.js.map +1 -0
  297. package/dist/model-endpoint/index.js +10 -9
  298. package/dist/open-library-R5EZROFN.js +59 -0
  299. package/dist/{open-library-BVQCB37E.js.map → open-library-R5EZROFN.js.map} +1 -1
  300. package/dist/{open-registry-JCSIAKEC.js → open-registry-RZW2AFD6.js} +13 -13
  301. package/dist/{open-registry-JCSIAKEC.js.map → open-registry-RZW2AFD6.js.map} +1 -1
  302. package/dist/{paths-XLKCAFRZ.js → paths-RPK5PNZQ.js} +9 -9
  303. package/dist/{paths-XLKCAFRZ.js.map → paths-RPK5PNZQ.js.map} +1 -1
  304. package/dist/{plugin-store-NGRUTCJI.js → plugin-store-OJTERUEZ.js} +9 -9
  305. package/dist/{plugin-store-NGRUTCJI.js.map → plugin-store-OJTERUEZ.js.map} +1 -1
  306. package/dist/project-S2FT3LLR.js +90 -0
  307. package/dist/{project-BGYMLAS6.js.map → project-S2FT3LLR.js.map} +1 -1
  308. package/dist/resolver/index.js +7 -7
  309. package/dist/runner/index.js +39 -37
  310. package/dist/runner/src/capability-roundtrip.d.ts +6 -6
  311. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  312. package/dist/runner/src/composition/run-snapshot.d.ts +7 -1
  313. package/dist/runner/src/composition/run-snapshot.d.ts.map +1 -1
  314. package/dist/runner/src/external-mcp.d.ts +22 -0
  315. package/dist/runner/src/external-mcp.d.ts.map +1 -1
  316. package/dist/runner/src/mcp-tools-snapshot.d.ts +13 -0
  317. package/dist/runner/src/mcp-tools-snapshot.d.ts.map +1 -0
  318. package/dist/runner/src/resources.d.ts +14 -0
  319. package/dist/runner/src/resources.d.ts.map +1 -1
  320. package/dist/runner/src/serve.d.ts.map +1 -1
  321. package/dist/sdk/asset-manager.js +12 -12
  322. package/dist/sdk/bridge.js +19 -17
  323. package/dist/sdk/core.js +6 -6
  324. package/dist/sdk/flow.js +7 -7
  325. package/dist/sdk/index.js +39 -37
  326. package/dist/sdk/index.js.map +1 -1
  327. package/dist/sdk/resolver.js +7 -7
  328. package/dist/sdk/runner.js +39 -37
  329. package/dist/sdk/session.js +2 -2
  330. package/dist/sdk/transport/ws/server.js +7 -7
  331. package/dist/sdk/transport/ws.js +7 -7
  332. package/dist/sdk/transport.js +7 -7
  333. package/dist/sdk/types.js +1 -1
  334. package/dist/serve-preflight-AADSOUO2.js +58 -0
  335. package/dist/{serve-preflight-GQY5DZX6.js.map → serve-preflight-AADSOUO2.js.map} +1 -1
  336. package/dist/session/index.js +2 -2
  337. package/dist/{setup-2NWSKSCO.js → setup-HOAJHUFQ.js} +29 -27
  338. package/dist/setup-HOAJHUFQ.js.map +1 -0
  339. package/dist/{skills-PXZOL2FZ.js → skills-KHHW3RZ3.js} +12 -12
  340. package/dist/{skills-PXZOL2FZ.js.map → skills-KHHW3RZ3.js.map} +1 -1
  341. package/dist/source-FOELFCY6.js +88 -0
  342. package/dist/{source-XA3L4H6I.js.map → source-FOELFCY6.js.map} +1 -1
  343. package/dist/{source-manifest-publish-QEGMTS33.js → source-manifest-publish-Q7P5AEVU.js} +51 -49
  344. package/dist/source-manifest-publish-Q7P5AEVU.js.map +1 -0
  345. package/dist/transport/index.js +7 -7
  346. package/dist/transport/ws/server.js +7 -7
  347. package/dist/transport/ws.js +7 -7
  348. package/dist/tui/index.js +63 -44
  349. package/dist/tui/index.js.map +1 -1
  350. package/dist/tui/src/repl.d.ts +10 -0
  351. package/dist/tui/src/repl.d.ts.map +1 -1
  352. package/dist/types/index.js +1 -1
  353. package/dist/types/src/version.d.ts +4 -4
  354. package/dist/workspace-plugin/adapters/mcp.js +30 -28
  355. package/dist/workspace-plugin/adapters/omp.js +14 -14
  356. package/dist/workspace-plugin/index.js +2 -2
  357. package/package.json +1 -1
  358. package/dist/chunk-22ZX33H6.js.map +0 -1
  359. package/dist/chunk-23SG4JRV.js.map +0 -1
  360. package/dist/chunk-2HS357RA.js.map +0 -1
  361. package/dist/chunk-7EMS2GZO.js.map +0 -1
  362. package/dist/chunk-AVFRFGM2.js.map +0 -1
  363. package/dist/chunk-B436SG5P.js.map +0 -1
  364. package/dist/chunk-B4BLJUYN.js.map +0 -1
  365. package/dist/chunk-DKXNKFKP.js.map +0 -1
  366. package/dist/chunk-DNXPXJ3X.js.map +0 -1
  367. package/dist/chunk-EN5REMWV.js.map +0 -1
  368. package/dist/chunk-ETF6Q3R3.js.map +0 -1
  369. package/dist/chunk-IS3NIZBX.js.map +0 -1
  370. package/dist/chunk-IWKKTCXY.js.map +0 -1
  371. package/dist/chunk-J5JWLKLB.js.map +0 -1
  372. package/dist/chunk-KA2GLAPS.js.map +0 -1
  373. package/dist/chunk-NSIOBKDX.js.map +0 -1
  374. package/dist/chunk-OLHHN3NO.js.map +0 -1
  375. package/dist/chunk-S7DVT2BV.js.map +0 -1
  376. package/dist/chunk-SRTWKZP2.js.map +0 -1
  377. package/dist/chunk-SZTHSPRC.js.map +0 -1
  378. package/dist/chunk-T7HGEMNB.js.map +0 -1
  379. package/dist/chunk-TGUMN5G7.js.map +0 -1
  380. package/dist/chunk-THX5EE3K.js.map +0 -1
  381. package/dist/chunk-TNQLDEM6.js.map +0 -1
  382. package/dist/chunk-TROEC2Z2.js.map +0 -1
  383. package/dist/chunk-UMLCKKIA.js.map +0 -1
  384. package/dist/chunk-X44XKBZX.js.map +0 -1
  385. package/dist/ensure-sources-6O54DUQB.js.map +0 -1
  386. package/dist/library-publish-MUGUST43.js.map +0 -1
  387. package/dist/open-library-BVQCB37E.js +0 -57
  388. package/dist/project-BGYMLAS6.js +0 -88
  389. package/dist/serve-preflight-GQY5DZX6.js +0 -56
  390. package/dist/setup-2NWSKSCO.js.map +0 -1
  391. package/dist/source-XA3L4H6I.js +0 -86
  392. package/dist/source-manifest-publish-QEGMTS33.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../factory-assets/connectors/flow/engine/bindings.ts","../factory-assets/connectors/flow/engine/router-settlement.ts","../factory-assets/connectors/flow/engine/engine.ts","../factory-assets/connectors/flow/engine/output-schema.ts","../factory-assets/connectors/flow/engine/flow-output.ts","../factory-assets/connectors/flow/engine/node-deadline.ts","../factory-assets/connectors/flow/engine/node-attempts.ts","../factory-assets/connectors/flow/engine/optional-failure.ts","../factory-assets/connectors/flow/engine/check-provenance.ts","../factory-assets/connectors/flow/engine/flow-manifest.ts","../factory-assets/connectors/flow/engine/flow-kind-provider.ts","../factory-assets/connectors/flow/engine/loader.ts","../factory-assets/connectors/flow/engine/locate.ts"],"names":["process","path","parseYaml","fs"],"mappings":";;;;;;;;;;;;AAWO,SAAS,0BAAA,CACd,MACA,SAAA,EACuB;AACvB,EAAA,MAAM,QAAwC,EAAC;AAC/C,EAAA,KAAA,MAAW,IAAA,IAAQ,KAAK,KAAA,EAAO;AAC7B,IAAA,MAAM,QAAA,GAAW,SAAA,CAAU,GAAA,CAAI,IAAA,CAAK,EAAE,CAAA;AACtC,IAAA,MAAM,MAAA,GACJ,QAAA,EAAU,MAAA,KAAW,UAAA,IAAc,QAAA,CAAS,MAAA,EAAQ,MAAA,GAChD,EAAE,MAAA,EAAQ,QAAA,CAAS,MAAA,CAAO,MAAA,EAAO,GACjC,MAAA;AACN,IAAA,KAAA,CAAM,IAAA,CAAK,EAA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N,MAAA,EAAQ,aAAA;AAAA,YACR,OAAO,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG;AAAA,WACvD,CAAA;AACD,UAAA;AAAA,QACF;AACA,QAAA,IAAI,UAAA,KAAe,QAAQ,OAAO,SAAA;AAClC,QAAA,IAAA,CAAK,SAAS,EAAE,IAAA,EAAM,WAAW,MAAA,EAAQ,aAAA,EAAe,YAAY,CAAA;AAAA,MACtE;AAAA,IACF;AACA,IAAA,MAAM,KAAA,GAAQ,kBAAA,CAAmB,IAAA,EAAM,EAAE,QAAQ,MAAM;AAAA,IAAC,CAAA,EAAG,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,CAAK,EAAA,KAAO,MAAM,CAAA;AAC7F,IAAA,IAAI,KAAA,SAAc,KAAA,CAAM,IAAA;AAAA,EAC1B;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-X44XKBZX.js","sourcesContent":["import {\n resolveFlowBindings,\n stableFlowJson,\n type BindingOrigin,\n type FlowExpressionContext,\n type ResolvedNodeBindings,\n} from \"../contract/expression.js\";\nimport { isAgentNode, isSubFlowNode, isSubpromptNode, nodeBindings } from \"./node-shape.js\";\nimport type { FlowDefinition, FlowNode, NodeExecutionSnapshot } from \"./types.js\";\n\n/** Build the bounded expression context from immutable definition and snapshot state. */\nexport function buildFlowExpressionContext(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): FlowExpressionContext {\n const nodes: FlowExpressionContext[\"nodes\"] = {};\n for (const node of flow.nodes) {\n const snapshot = snapshots.get(node.id);\n const output =\n snapshot?.status === \"complete\" && snapshot.output?.fields\n ? { fields: snapshot.output.fields }\n : undefined;\n nodes[node.id] = { status: snapshot?.status ?? \"not_started\", output };\n }\n return {\n flow: { input: flow.defaults?.run_input ?? {} },\n defaults: flow.defaults,\n nodes,\n };\n}\n\n/**\n * Classify what one producer node's output counts as for a downstream binding.\n *\n * Transitive by induction, in a single lookup: a producer's persisted\n * `inputOrigins` were themselves classified under this rule when it ran, so\n * they already carry any taint from its own ancestors — no graph walk. Absent\n * origins read as `\"agent\"` (fail-closed): a snapshot persisted before the\n * field existed cannot prove the node's inputs were clean, and this label is\n * one a human approver acts on. `{}` — a node that bound nothing — is\n * `\"runtime\"`.\n */\nexport function producerOutputObtainedBy(\n producer: FlowNode,\n snapshot: NodeExecutionSnapshot | undefined,\n): \"agent\" | \"runtime\" {\n // A subprompt's output is model-generated the same as an agent's, even though\n // the runtime (not the session agent) makes the call — so a downstream check\n // must derive \"asserted\", never \"verified\", over it. See engine/check-provenance.ts.\n // A sub-flow returns what any node inside the child produced, agents included;\n // its inputOrigins cover only what the parent passed in, so they cannot clear it.\n if (isAgentNode(producer) || isSubpromptNode(producer) || isSubFlowNode(producer)) {\n return \"agent\";\n }\n const inputOrigins = snapshot?.inputOrigins;\n if (!inputOrigins) return \"agent\";\n const tainted = Object.values(inputOrigins).some((origins) =>\n // A hydrated snapshot is host-supplied and only shape-checked as JSON, so a\n // malformed entry is unreadable rather than clean — fail closed, never throw.\n Array.isArray(origins) ? origins.some((origin) => origin?.obtainedBy === \"agent\") : true,\n );\n return tainted ? \"agent\" : \"runtime\";\n}\n\n/** Resolve one node's named inputs and derive their runtime/agent origins. */\nexport function resolveNodeBindings(\n flow: FlowDefinition,\n node: FlowNode,\n snapshots: Map<string, NodeExecutionSnapshot>,\n flowInputOrigins: Record<string, BindingOrigin[]> = {},\n): ResolvedNodeBindings {\n const origins = Object.fromEntries(\n flow.nodes.map((producer) => [\n producer.id,\n producerOutputObtainedBy(producer, snapshots.get(producer.id)),\n ]),\n ) as Record<string, \"agent\" | \"runtime\">;\n return resolveFlowBindings(\n nodeBindings(node),\n buildFlowExpressionContext(flow, snapshots),\n origins,\n flowInputOrigins,\n );\n}\n\n/** Interpolate named, already-resolved binding values into an agent instruction. */\nexport function interpolateNodeInstruction(\n instruction: string,\n values: Record<string, unknown>,\n): string {\n return instruction.replace(/\\$\\{([A-Za-z_][A-Za-z0-9_-]*)\\}/g, (_placeholder, name: string) => {\n if (!Object.hasOwn(values, name)) {\n throw new Error(`Node instruction binding ${name} is missing`);\n }\n const value = values[name];\n return typeof value === \"string\" ? value : stableFlowJson(value);\n });\n}\n","import type { NodeOutput } from \"@skaile/workspaces/types\";\nimport { evaluateFlowExpression, FlowExpressionError } from \"../contract/expression.js\";\nimport { buildFlowExpressionContext } from \"./bindings.js\";\nimport { isRouterNode } from \"./node-shape.js\";\nimport type { FlowDefinition, FlowNode, NodeExecutionSnapshot } from \"./types.js\";\n\nconst ROUTER_SELECTION_MARKER = \"\\n\\n[skaile:flow-router-selection:\";\n\n/** One deterministic router choice being settled in the current atomic batch. */\nexport interface RouterSettlement {\n routerNodeId: string;\n selectedTarget: string | null;\n}\n\n/**\n * Internal result of evaluating one already-admitted router. `failed` carries a\n * route expression error that no later stimulus can clear (a missing field on a\n * terminal producer, non-comparable operands): the router is decided, and what\n * it decided is to fail.\n */\nexport type RouterSelection =\n | { selectedTarget: string | null }\n | { unresolved: \"not-ready\" | \"no-match\" }\n | { failed: FlowExpressionError };\n\nfunction pendingProducerOutput(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n missingPath: string | undefined,\n): boolean {\n if (!missingPath) return false;\n const segments = missingPath.split(\".\");\n if (\n segments.length < 5 ||\n segments[0] !== \"nodes\" ||\n segments[2] !== \"output\" ||\n segments[3] !== \"fields\"\n ) {\n return false;\n }\n const producer = flow.nodes.find(({ id }) => id === segments[1]);\n if (!producer?.contract?.output?.fields) return false;\n // Only a producer that can still produce is worth waiting for — a terminal\n // one never will, and calling it \"pending\" parks the router forever.\n return ![\"complete\", \"skipped\", \"failed\"].includes(\n snapshots.get(producer.id)?.status ?? \"not_started\",\n );\n}\n\n/** Evaluate ordered routes for a router whose availability was already established. */\nexport function evaluateRouterSelection(\n flow: FlowDefinition,\n router: FlowNode,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): RouterSelection {\n if (!isRouterNode(router)) return { unresolved: \"no-match\" };\n const context = buildFlowExpressionContext(flow, snapshots);\n for (const route of router.run.routes) {\n try {\n if (evaluateFlowExpression(route.when, context)) {\n return { selectedTarget: route.target };\n }\n } catch (error) {\n if (\n error instanceof FlowExpressionError &&\n pendingProducerOutput(flow, snapshots, error.missingPath)\n ) {\n return { unresolved: \"not-ready\" };\n }\n // Rethrowing here escaped the whole drain and wedged the run: the router\n // stayed available and threw again on every later stimulus.\n if (error instanceof FlowExpressionError) return { failed: error };\n throw error;\n }\n }\n return { unresolved: \"no-match\" };\n}\n\n/** Encode a router choice in the existing durable node-output envelope. */\nexport function routerSelectionOutput(selectedTarget: string | null): NodeOutput {\n const summary =\n selectedTarget === null\n ? \"Router completed without selecting a target.\"\n : `Router selected ${selectedTarget}.`;\n return {\n summary: `${summary}${ROUTER_SELECTION_MARKER}${JSON.stringify(selectedTarget)}]`,\n artifacts: [],\n };\n}\n\nfunction routeTargets(router: FlowNode): string[] {\n if (!isRouterNode(router)) return [];\n return [...new Set(router.run.routes.flatMap(({ target }) => (target === null ? [] : [target])))];\n}\n\ninterface RouterOwnershipIndex {\n routers: FlowNode[];\n outgoing: Map<string, string[]>;\n}\n\n/** Index router-to-router ownership through route targets and hard-flow descendants. */\nfunction routerOwnershipIndex(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): RouterOwnershipIndex {\n const routers = flow.nodes.filter(\n (node) =>\n isRouterNode(node) &&\n ![\"complete\", \"failed\", \"skipped\"].includes(snapshots.get(node.id)?.status ?? \"not_started\"),\n );\n const routerIds = new Set(routers.map(({ id }) => id));\n const hardOutgoing = new Map<string, string[]>();\n for (const edge of flow.edges) {\n if (edge.type !== \"flow\") continue;\n const targets = hardOutgoing.get(edge.source) ?? [];\n targets.push(edge.target);\n hardOutgoing.set(edge.source, targets);\n }\n\n const outgoing = new Map<string, string[]>();\n for (const router of routers) {\n const owned = new Set<string>();\n const visited = new Set<string>();\n const queue = routeTargets(router);\n for (let index = 0; index < queue.length; index++) {\n const nodeId = queue[index];\n if (visited.has(nodeId)) continue;\n visited.add(nodeId);\n if (routerIds.has(nodeId)) owned.add(nodeId);\n queue.push(...(hardOutgoing.get(nodeId) ?? []));\n }\n outgoing.set(router.id, [...owned]);\n }\n return { routers, outgoing };\n}\n\n/**\n * Return every member of each source router-ownership SCC.\n *\n * Route ownership is deliberately not a dependency arc and may cycle even though hard flow is\n * acyclic. Source SCC members are ungated so normal hard-edge/precondition admission and ordered\n * decidability select the settlement frontier. Ordinary parent components remain ahead of nested\n * children, while self-targeting and mutually targeting routers cannot deadlock admission. The\n * graph is preindexed and both SCC passes are iterative.\n */\nfunction routerOwnershipSourceComponents(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): string[][] {\n const { routers, outgoing } = routerOwnershipIndex(flow, snapshots);\n const reverse = new Map<string, string[]>();\n for (const router of routers) reverse.set(router.id, []);\n for (const [source, targets] of outgoing) {\n for (const target of targets) reverse.get(target)?.push(source);\n }\n\n const visited = new Set<string>();\n const finished: string[] = [];\n for (const router of routers) {\n if (visited.has(router.id)) continue;\n const stack: Array<{ nodeId: string; exiting: boolean }> = [\n { nodeId: router.id, exiting: false },\n ];\n while (stack.length > 0) {\n const frame = stack.pop();\n if (!frame) break;\n if (frame.exiting) {\n finished.push(frame.nodeId);\n continue;\n }\n if (visited.has(frame.nodeId)) continue;\n visited.add(frame.nodeId);\n stack.push({ nodeId: frame.nodeId, exiting: true });\n const targets = outgoing.get(frame.nodeId) ?? [];\n for (let index = targets.length - 1; index >= 0; index--) {\n if (!visited.has(targets[index])) {\n stack.push({ nodeId: targets[index], exiting: false });\n }\n }\n }\n }\n\n const componentByRouter = new Map<string, number>();\n const components: string[][] = [];\n for (let index = finished.length - 1; index >= 0; index--) {\n const start = finished[index];\n if (componentByRouter.has(start)) continue;\n const componentId = components.length;\n const component: string[] = [];\n const stack = [start];\n componentByRouter.set(start, componentId);\n while (stack.length > 0) {\n const nodeId = stack.pop();\n if (!nodeId) break;\n component.push(nodeId);\n for (const source of reverse.get(nodeId) ?? []) {\n if (componentByRouter.has(source)) continue;\n componentByRouter.set(source, componentId);\n stack.push(source);\n }\n }\n components.push(component);\n }\n\n const incomingComponents = new Set<number>();\n for (const [source, targets] of outgoing) {\n const sourceComponent = componentByRouter.get(source);\n for (const target of targets) {\n const targetComponent = componentByRouter.get(target);\n if (\n sourceComponent !== undefined &&\n targetComponent !== undefined &&\n sourceComponent !== targetComponent\n ) {\n incomingComponents.add(targetComponent);\n }\n }\n }\n\n const definitionOrder = new Map(flow.nodes.map((node, index) => [node.id, index]));\n const sourceComponents = components.filter(\n (_, componentId) => !incomingComponents.has(componentId),\n );\n for (const component of sourceComponents) {\n component.sort(\n (left, right) =>\n (definitionOrder.get(left) ?? Number.MAX_SAFE_INTEGER) -\n (definitionOrder.get(right) ?? Number.MAX_SAFE_INTEGER),\n );\n }\n return sourceComponents.sort(\n (left, right) =>\n (definitionOrder.get(left[0]) ?? Number.MAX_SAFE_INTEGER) -\n (definitionOrder.get(right[0]) ?? Number.MAX_SAFE_INTEGER),\n );\n}\n\n/** Decode and validate a completed router's engine-owned selection summary. */\nexport function persistedRouterSelection(\n router: FlowNode,\n snapshot: NodeExecutionSnapshot | undefined,\n): { selectedTarget: string | null } | undefined {\n if (!isRouterNode(router) || snapshot?.status !== \"complete\") return undefined;\n const summary = snapshot.output?.summary;\n const markerIndex = summary?.lastIndexOf(ROUTER_SELECTION_MARKER) ?? -1;\n if (!summary || markerIndex < 0 || !summary.endsWith(\"]\")) return undefined;\n let selectedTarget: unknown;\n try {\n selectedTarget = JSON.parse(summary.slice(markerIndex + ROUTER_SELECTION_MARKER.length, -1));\n } catch {\n return undefined;\n }\n if (\n selectedTarget !== null &&\n (typeof selectedTarget !== \"string\" || !routeTargets(router).includes(selectedTarget))\n ) {\n return undefined;\n }\n if (selectedTarget === null && !router.run.routes.some(({ target }) => target === null)) {\n return undefined;\n }\n return summary === routerSelectionOutput(selectedTarget).summary ? { selectedTarget } : undefined;\n}\n\nfunction edgeKey(source: string, target: string): string {\n return `${source}\\u0000${target}`;\n}\n\n/**\n * Plan exclusive branch skips for all known router choices as one coordinated settlement.\n *\n * Only hard `flow` edges participate. The graph is indexed once, then each distinct losing\n * target performs a linear adjacency walk; optional and parallel edges can neither spread nor\n * preserve exclusivity. A selected route, a still-live unsettled router, shared convergence, or\n * an incoming hard predecessor outside the losing region protects that node and its descendants.\n */\nexport function planRouterSkips(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n settlements: readonly RouterSettlement[],\n): string[] {\n const routers = flow.nodes.filter(isRouterNode);\n const currentSelections = new Map(\n settlements.map(({ routerNodeId, selectedTarget }) => [routerNodeId, selectedTarget]),\n );\n const knownSelections = new Map<string, string | null>();\n for (const router of routers) {\n if (currentSelections.has(router.id)) {\n knownSelections.set(router.id, currentSelections.get(router.id) ?? null);\n continue;\n }\n const persisted = persistedRouterSelection(router, snapshots.get(router.id));\n if (persisted) knownSelections.set(router.id, persisted.selectedTarget);\n }\n\n const outgoing = new Map<string, string[]>();\n const incoming = new Map<string, string[]>();\n for (const edge of flow.edges) {\n if (edge.type !== \"flow\") continue;\n const targets = outgoing.get(edge.source) ?? [];\n targets.push(edge.target);\n outgoing.set(edge.source, targets);\n const sources = incoming.get(edge.target) ?? [];\n sources.push(edge.source);\n incoming.set(edge.target, sources);\n }\n\n const losingRoots = new Set<string>();\n const selectedRoots = new Set<string>();\n const losingRouteEdges = new Set<string>();\n for (const router of routers) {\n if (!knownSelections.has(router.id)) continue;\n const selectedTarget = knownSelections.get(router.id) ?? null;\n if (selectedTarget !== null) selectedRoots.add(selectedTarget);\n for (const target of routeTargets(router)) {\n if (target === selectedTarget) continue;\n losingRoots.add(target);\n losingRouteEdges.add(edgeKey(router.id, target));\n }\n }\n\n const candidateOrigins = new Map<string, Set<string>>();\n for (const root of losingRoots) {\n const visited = new Set<string>();\n const queue = [root];\n for (let index = 0; index < queue.length; index++) {\n const nodeId = queue[index];\n if (visited.has(nodeId)) continue;\n visited.add(nodeId);\n const origins = candidateOrigins.get(nodeId) ?? new Set<string>();\n origins.add(root);\n candidateOrigins.set(nodeId, origins);\n for (const target of outgoing.get(nodeId) ?? []) queue.push(target);\n }\n }\n const candidates = new Set(candidateOrigins.keys());\n\n const protectionQueue = [...selectedRoots];\n for (const [nodeId, origins] of candidateOrigins) {\n if (origins.size >= 2) protectionQueue.push(nodeId);\n for (const source of incoming.get(nodeId) ?? []) {\n if (candidates.has(source)) continue;\n if (losingRouteEdges.has(edgeKey(source, nodeId))) continue;\n if ([\"failed\", \"skipped\"].includes(snapshots.get(source)?.status ?? \"not_started\")) continue;\n protectionQueue.push(nodeId);\n break;\n }\n }\n\n const unknownSelections = new Map<string, string[]>();\n for (const router of routers) {\n if (knownSelections.has(router.id)) continue;\n const status = snapshots.get(router.id)?.status ?? \"not_started\";\n if (status === \"failed\" || status === \"skipped\") continue;\n const targets = routeTargets(router);\n unknownSelections.set(router.id, targets);\n if (!candidates.has(router.id)) protectionQueue.push(...targets);\n }\n\n const protectedNodes = new Set<string>();\n for (let index = 0; index < protectionQueue.length; index++) {\n const nodeId = protectionQueue[index];\n if (protectedNodes.has(nodeId)) continue;\n protectedNodes.add(nodeId);\n protectionQueue.push(...(outgoing.get(nodeId) ?? []));\n protectionQueue.push(...(unknownSelections.get(nodeId) ?? []));\n }\n\n return flow.nodes.flatMap((node) =>\n candidates.has(node.id) && !protectedNodes.has(node.id) ? [node.id] : [],\n );\n}\n\n/**\n * Return every possible target branch gated by an unsettled router.\n *\n * Gating follows hard `flow` descendants only. A selected route, shared convergence, or another\n * live hard predecessor protects a node, matching settlement pruning without mutating snapshots.\n */\nexport function unsettledRouterBranchIds(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): Set<string> {\n const unsettled = flow.nodes.filter(\n (node) =>\n isRouterNode(node) &&\n ![\"complete\", \"failed\", \"skipped\"].includes(snapshots.get(node.id)?.status ?? \"not_started\"),\n );\n const branches = new Set(\n planRouterSkips(\n flow,\n snapshots,\n unsettled.map(({ id }) => ({ routerNodeId: id, selectedTarget: null })),\n ),\n );\n for (const component of routerOwnershipSourceComponents(flow, snapshots)) {\n for (const routerId of component) branches.delete(routerId);\n }\n return branches;\n}\n\n/**\n * Return one actually available, decidable router per source ownership component.\n *\n * Every source-component member remains ungated for normal admission. Within a settlement wave,\n * definition order chooses the first member that is both available and decidable; unresolved or\n * blocked peers cannot starve it. Limiting each component to one choice prevents a router from\n * completing atomically after that same wave makes its branch losing. Independent source\n * components can still settle together.\n */\nexport function availableRouterFrontier(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): FlowNode[] {\n const nodesById = new Map(flow.nodes.map((node) => [node.id, node]));\n return routerOwnershipSourceComponents(flow, snapshots).flatMap((component) => {\n for (const routerId of component) {\n const node = nodesById.get(routerId);\n if (!node || snapshots.get(routerId)?.status !== \"available\") continue;\n if (\"unresolved\" in evaluateRouterSelection(flow, node, snapshots)) continue;\n return [node];\n }\n return [];\n });\n}\n","import type {\n FlowDefinition,\n FlowEdge,\n FlowNode,\n FlowState,\n NodeExecutionSnapshot,\n NodePreconditionFailure,\n NodeState,\n NodeStatus,\n} from \"./types.js\";\nimport { evaluateFlowExpression, type FlowExpressionContext } from \"../contract/expression.js\";\nimport { buildFlowExpressionContext } from \"./bindings.js\";\nimport {\n isActiveRuntimeNode,\n isRouterNode,\n nodeIsOptional,\n nodeLabel,\n nodeSkillId,\n} from \"./node-shape.js\";\nimport {\n evaluateRouterSelection,\n planRouterSkips,\n unsettledRouterBranchIds,\n} from \"./router-settlement.js\";\n\n// ---------------------------------------------------------------------------\n// Core engine — stateless, pure functions\n// ---------------------------------------------------------------------------\n\n/** Return nodes with state owned by the current runtime. */\nfunction activeRuntimeNodes(flow: FlowDefinition): FlowNode[] {\n return flow.nodes.filter(isActiveRuntimeNode);\n}\n\n/** Evaluate every authored admission condition without mutating runtime state. */\nfunction failedPreconditions(\n node: FlowNode,\n context: FlowExpressionContext,\n): NodePreconditionFailure[] {\n const failures: NodePreconditionFailure[] = [];\n for (const requirement of node.contract?.requires ?? []) {\n const message = requirement.message ?? `Precondition failed: ${requirement.expr}`;\n try {\n if (!evaluateFlowExpression(requirement.expr, context)) {\n failures.push({ expression: requirement.expr, message, reason: \"false\" });\n }\n } catch (error) {\n failures.push({\n expression: requirement.expr,\n message,\n reason: \"error\",\n detail: error instanceof Error ? error.message : \"Flow expression evaluation failed\",\n });\n }\n }\n return failures;\n}\n\n/** Build adjacency: target → sources[] (incoming edges per node) */\nfunction buildIncoming(edges: FlowEdge[]): Map<string, FlowEdge[]> {\n const map = new Map<string, FlowEdge[]>();\n for (const edge of edges) {\n if (!map.has(edge.target)) map.set(edge.target, []);\n map.get(edge.target)!.push(edge);\n }\n return map;\n}\n\n/** Build adjacency: source → targets[] (outgoing edges per node) */\nfunction buildOutgoing(edges: FlowEdge[]): Map<string, FlowEdge[]> {\n const map = new Map<string, FlowEdge[]>();\n for (const edge of edges) {\n if (!map.has(edge.source)) map.set(edge.source, []);\n map.get(edge.source)!.push(edge);\n }\n return map;\n}\n\n/** Result of resolving one available router against the current expression context. */\nexport interface RouterResolution {\n /** First matching route target. `null` means every branch loses. */\n selectedTarget: string | null;\n /** Exclusive nodes belonging only to unselected route targets, in definition order. */\n skippedNodeIds: string[];\n}\n\n/** Available router that cannot make a deterministic choice from the current snapshot. */\nexport interface UnresolvedRouterResolution {\n /** Why the router remains available for a later drain pass. */\n unresolved: \"not-ready\" | \"no-match\";\n}\n\n/**\n * Resolve the first matching route for a router that is currently available.\n *\n * Route conditions use the same bounded context as node preconditions and bindings. Resolution\n * is deliberately separate from state computation: unavailable routers return `undefined`\n * without evaluating any route. Losing route targets and their exclusive downstream paths are\n * returned for the caller to mark skipped. Exclusivity follows hard `flow` edges only and keeps\n * selected routes, unsettled-router targets, shared convergence, and externally reachable nodes\n * live. A declared producer output that is not complete yet returns a retryable unresolved result;\n * malformed expressions still throw their path-bearing evaluator error.\n *\n * @param flow - Parsed flow containing the router and branch graph.\n * @param routerNodeId - Router execution identity.\n * @param snapshots - Current node snapshots used for admission and expression values.\n * @returns The selected target and losing nodes, an unresolved reason while available but not\n * decidable, or `undefined` while the router is unavailable.\n */\nexport function resolveAvailableRouter(\n flow: FlowDefinition,\n routerNodeId: string,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): RouterResolution | UnresolvedRouterResolution | undefined {\n const router = flow.nodes.find((node) => node.id === routerNodeId);\n if (!router || !isRouterNode(router)) return undefined;\n const state = computeFlowStateFromSnapshots(flow, snapshots);\n if (!state.available.includes(routerNodeId)) return undefined;\n\n const selected = evaluateRouterSelection(flow, router, snapshots);\n if (\"unresolved\" in selected) return selected;\n if (\"failed\" in selected) throw selected.failed;\n\n return {\n selectedTarget: selected.selectedTarget,\n skippedNodeIds: planRouterSkips(flow, snapshots, [\n { routerNodeId, selectedTarget: selected.selectedTarget },\n ]),\n };\n}\n\n/**\n * Compute the full {@link FlowState} from a flow definition and caller-supplied node ID sets.\n *\n * This is the primary engine function. It is stateless and side-effect-free — calling it\n * twice with the same arguments always returns an equivalent result.\n *\n * Edge semantics applied during computation:\n * - `'flow'` — hard dependency: target cannot start until source is `complete` or `skipped`.\n * - `'parallel'` — soft dependency: target may run while source is still running.\n * - `'optional'` — advisory: target can start regardless of source state.\n *\n * A node is `available` when every incoming `'flow'`-type edge has a complete or skipped source\n * and every authored precondition evaluates true.\n * A node is `not_started` when at least one hard predecessor is still pending.\n * The flow is `done` when every non-optional node is `complete` or `skipped`.\n *\n * This set-based overload has statuses but no completed output fields. Use\n * {@link computeFlowStateFromSnapshots} when a precondition reads node output.\n *\n * Prefer {@link computeFlowStateFromSnapshots} for callers that track full `NodeExecution`\n * state (interaction statuses such as `awaiting_approval`, `awaiting_input`, `failed`).\n *\n * @param flow - The parsed flow definition.\n * @param completedIds - Set of node IDs that have finished successfully.\n * @param runningIds - Set of node IDs currently executing. Defaults to an empty set.\n * @param skippedIds - Set of node IDs that were explicitly skipped. Skipped nodes count\n * as satisfied for downstream dependency checks. Defaults to an empty set.\n * @returns A {@link FlowState} describing every active runtime node.\n * @docLink packages/flow-engine/concepts#compute-flow-state\n */\nexport function computeFlowState(\n flow: FlowDefinition,\n completedIds: Set<string>,\n runningIds: Set<string> = new Set(),\n skippedIds: Set<string> = new Set(),\n): FlowState {\n const nodes = activeRuntimeNodes(flow);\n const incoming = buildIncoming(flow.edges);\n const snapshots = new Map<string, NodeExecutionSnapshot>();\n for (const node of nodes) {\n const status: NodeStatus = completedIds.has(node.id)\n ? \"complete\"\n : runningIds.has(node.id)\n ? \"running\"\n : skippedIds.has(node.id)\n ? \"skipped\"\n : \"not_started\";\n snapshots.set(node.id, { status });\n }\n const gatedBranches = unsettledRouterBranchIds(flow, snapshots);\n const context = buildFlowExpressionContext(flow, snapshots);\n\n const nodeStates: NodeState[] = nodes.map((node) => {\n const optional = nodeIsOptional(node);\n const skillId = nodeSkillId(node);\n const label = nodeLabel(node);\n\n if (completedIds.has(node.id)) {\n return {\n nodeId: node.id,\n skillId,\n label,\n status: \"complete\",\n optional,\n canRun: false,\n blockers: [],\n failedPreconditions: [],\n };\n }\n if (runningIds.has(node.id)) {\n return {\n nodeId: node.id,\n skillId,\n label,\n status: \"running\",\n optional,\n canRun: false,\n blockers: [],\n failedPreconditions: [],\n };\n }\n if (skippedIds.has(node.id)) {\n return {\n nodeId: node.id,\n skillId,\n label,\n status: \"skipped\",\n optional,\n canRun: false,\n blockers: [],\n failedPreconditions: [],\n };\n }\n\n if (gatedBranches.has(node.id)) {\n return {\n nodeId: node.id,\n skillId,\n label,\n status: \"not_started\",\n optional,\n canRun: false,\n blockers: [],\n failedPreconditions: [],\n };\n }\n\n const edges = incoming.get(node.id) ?? [];\n\n // Hard blockers: flow-type edges whose source is neither complete nor skipped\n const hardBlockers = edges\n .filter((e) => e.type === \"flow\")\n .filter((e) => !completedIds.has(e.source) && !skippedIds.has(e.source))\n .map((e) => e.source);\n\n const preconditionFailures = failedPreconditions(node, context);\n const canRun = hardBlockers.length === 0 && preconditionFailures.length === 0;\n\n let status: NodeStatus;\n if (!canRun) {\n status = \"not_started\";\n } else {\n status = \"available\";\n }\n\n return {\n nodeId: node.id,\n skillId,\n label,\n status,\n optional,\n canRun,\n blockers: hardBlockers,\n failedPreconditions: preconditionFailures,\n };\n });\n\n const _stateMap = new Map(nodeStates.map((s) => [s.nodeId, s]));\n\n const available = nodeStates.filter((s) => s.status === \"available\").map((s) => s.nodeId);\n const completed = nodeStates.filter((s) => s.status === \"complete\").map((s) => s.nodeId);\n const focus = nodeStates\n .filter(\n (s) =>\n s.status === \"running\" || s.status === \"awaiting_approval\" || s.status === \"awaiting_input\",\n )\n .map((s) => s.nodeId);\n\n // Flow is done when all required nodes are complete or skipped\n const requiredNodes = nodes.filter((n) => !nodeIsOptional(n));\n const done = requiredNodes.every((n) => completedIds.has(n.id) || skippedIds.has(n.id));\n\n return { flowId: flow.id, nodes: nodeStates, available, completed, focus, done };\n}\n\n/**\n * Snapshot-based variant of {@link computeFlowState}.\n *\n * Accepts a map of `NodeExecutionSnapshot` values carrying the current status and\n * interaction metadata for every node the caller knows about. Nodes absent from the\n * map are treated as `not_started`.\n *\n * This is the preferred API for the turn-based runner, which has a full `FlowExecution`\n * and needs to convey richer statuses (`awaiting_approval`, `awaiting_input`, `failed`)\n * back to the engine so downstream availability is computed correctly.\n *\n * Engine semantics:\n * - A node is `available` when all its incoming `'flow'`-type predecessors are `complete`\n * or `skipped`. Any other upstream status — including `awaiting_approval`,\n * `awaiting_input`, and `failed` — is treated as blocking. Every authored precondition\n * must also evaluate true against the snapshot expression context.\n * - Optionality is **not** a term here: `failed` blocks whether or not the node is optional.\n * An optional node's dependents proceed because an optional node never reaches a terminal\n * `failed` in the first place — its exhausted failure resolves to `skipped`\n * (`resolveTerminalFailureStatus`), which passes. The one exception is a router, which\n * stays `failed` even when optional.\n * - The flow is `done` when every non-optional node is `complete` or `skipped`. A single\n * required node stuck in `failed` keeps `done` false.\n *\n * @param flow - The parsed flow definition.\n * @param snapshots - Map from node ID to its current {@link NodeExecutionSnapshot}.\n * Missing entries default to `not_started` with no interaction metadata.\n * @returns A {@link FlowState} describing every active runtime node,\n * including interaction fields (`approval`, `input`, `output`, `error`) copied\n * from the matching snapshot.\n * @docLink packages/flow-engine/concepts#compute-flow-state-from-snapshots\n */\nexport function computeFlowStateFromSnapshots(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): FlowState {\n const nodes = activeRuntimeNodes(flow);\n const incoming = buildIncoming(flow.edges);\n const gatedBranches = unsettledRouterBranchIds(flow, snapshots);\n const context = buildFlowExpressionContext(flow, snapshots);\n\n /** Resolve the effective status for a node — defaulting to `not_started`. */\n const statusFor = (nodeId: string): NodeStatus => snapshots.get(nodeId)?.status ?? \"not_started\";\n\n /** A predecessor \"passes\" when it is complete or skipped. */\n const passed = (nodeId: string): boolean => {\n const s = statusFor(nodeId);\n return s === \"complete\" || s === \"skipped\";\n };\n\n const nodeStates: NodeState[] = nodes.map((node) => {\n const snapshot = snapshots.get(node.id);\n const optional = nodeIsOptional(node);\n const skillId = nodeSkillId(node);\n const label = nodeLabel(node);\n const status = snapshot?.status ?? \"not_started\";\n\n const edges = incoming.get(node.id) ?? [];\n const flowPreds = edges.filter((e) => e.type === \"flow\");\n const hardBlockers = flowPreds.filter((e) => !passed(e.source)).map((e) => e.source);\n\n const isAdmissionState = status === \"not_started\" || status === \"available\";\n const preconditionFailures = isAdmissionState ? failedPreconditions(node, context) : [];\n\n // Recompute admission in both directions after fresh start or hydrate.\n let effectiveStatus: NodeStatus = status;\n if (isAdmissionState && gatedBranches.has(node.id)) {\n effectiveStatus = \"not_started\";\n } else if (isAdmissionState) {\n effectiveStatus =\n hardBlockers.length === 0 && preconditionFailures.length === 0\n ? \"available\"\n : \"not_started\";\n }\n\n return {\n nodeId: node.id,\n skillId,\n label,\n status: effectiveStatus,\n optional,\n canRun:\n hardBlockers.length === 0 &&\n preconditionFailures.length === 0 &&\n effectiveStatus === \"available\",\n blockers: hardBlockers,\n failedPreconditions: preconditionFailures,\n approval: snapshot?.approval,\n input: snapshot?.input,\n output: snapshot?.output,\n error: snapshot?.error,\n };\n });\n\n const available = nodeStates.filter((s) => s.status === \"available\").map((s) => s.nodeId);\n const completed = nodeStates.filter((s) => s.status === \"complete\").map((s) => s.nodeId);\n const focus = nodeStates\n .filter(\n (s) =>\n s.status === \"running\" || s.status === \"awaiting_approval\" || s.status === \"awaiting_input\",\n )\n .map((s) => s.nodeId);\n\n const requiredNodes = nodes.filter((n) => !nodeIsOptional(n));\n const done = requiredNodes.every((n) => {\n const s = statusFor(n.id);\n return s === \"complete\" || s === \"skipped\";\n });\n\n return { flowId: flow.id, nodes: nodeStates, available, completed, focus, done };\n}\n\n/**\n * Returns `true` when the given status prevents downstream nodes from starting.\n *\n * Only `'complete'` and `'skipped'` satisfy a hard (`'flow'`-type) edge dependency.\n * All other statuses — including `'awaiting_approval'`, `'awaiting_input'`, and\n * `'failed'` — are considered blocking.\n *\n * Use this helper in the FlowAdapter and the turn-based orchestrator instead of\n * hard-coding the two-value whitelist inline.\n *\n * @param status - The {@link NodeStatus} to evaluate.\n * @returns `true` if the status prevents dependents from becoming `available`.\n * @docLink packages/flow-engine/concepts#is-blocking\n */\nexport function isBlocking(status: NodeStatus): boolean {\n return status !== \"complete\" && status !== \"skipped\";\n}\n\n/**\n * Returns the IDs of nodes that become newly `available` after a specific node completes.\n *\n * More efficient than recomputing the full {@link FlowState} when only the downstream\n * impact of a single completion is needed. Only the direct successors of `justCompleted`\n * are evaluated — the rest of the graph is untouched.\n *\n * @param flow - The parsed flow definition.\n * @param justCompleted - ID of the node that just finished (will be added to the\n * effective completed set before evaluating successors).\n * @param completedIds - Set of node IDs already known to be complete before this call.\n * @param skippedIds - Set of node IDs that were explicitly skipped. Defaults to an empty set.\n * @returns Array of node IDs whose hard dependencies are now fully satisfied and that\n * were not already available before `justCompleted` finished. Unlike executable-node-filtered\n * helpers, this walks raw edge targets and does not filter by node type — if a `group`,\n * `sub-flow`, or `router` node is a direct successor, its ID can appear here. Callers that\n * dispatch these IDs are responsible for filtering inert nodes.\n * @docLink packages/flow-engine/concepts#resolve-next-nodes\n */\nexport function resolveNextNodes(\n flow: FlowDefinition,\n justCompleted: string,\n completedIds: Set<string>,\n skippedIds: Set<string> = new Set(),\n): string[] {\n const outgoing = buildOutgoing(flow.edges);\n const incoming = buildIncoming(flow.edges);\n const candidates = (outgoing.get(justCompleted) ?? []).map((e) => e.target);\n\n const nextCompleted = new Set([...completedIds, justCompleted]);\n const result: string[] = [];\n\n for (const candidateId of candidates) {\n const edges = incoming.get(candidateId) ?? [];\n const hardBlockers = edges\n .filter((e) => e.type === \"flow\")\n .filter((e) => !nextCompleted.has(e.source) && !skippedIds.has(e.source));\n if (hardBlockers.length === 0) {\n result.push(candidateId);\n }\n }\n\n return result;\n}\n\n/**\n * Returns the IDs of optional nodes that have not yet started and can be safely skipped.\n *\n * A node is skippable when it is:\n * 1. Not yet complete (absent from `completedIds`).\n * 2. Marked `optional` (`FlowNode.data.optional === true`).\n * 3. Not connected via a `'flow'`-type edge to any non-optional downstream node\n * (i.e. skipping it cannot starve a required node of a hard dependency).\n *\n * The runner may call this to present the user with a list of nodes they can bypass\n * without breaking the flow's required path.\n *\n * @param flow - The parsed flow definition.\n * @param completedIds - Set of node IDs that have already completed (excluded from results).\n * @returns Array of node IDs that are safe to skip at this point in the execution.\n * @docLink packages/flow-engine/concepts#compute-skippable\n */\nexport function computeSkippable(flow: FlowDefinition, completedIds: Set<string>): string[] {\n const nodes = activeRuntimeNodes(flow);\n const outgoing = buildOutgoing(flow.edges);\n\n return nodes\n .filter((n) => !completedIds.has(n.id))\n .filter(nodeIsOptional)\n .filter((n) => {\n // A node is skippable if none of its outgoing flow-type edges go to a required node\n const deps = (outgoing.get(n.id) ?? []).filter((e) => e.type === \"flow\");\n return deps.every((e) => {\n const target = flow.nodes.find((t) => t.id === e.target);\n return target ? nodeIsOptional(target) : false;\n });\n })\n .map((n) => n.id);\n}\n","import { compileOutputFieldsSchema, getConsumedOutputSchema } from \"../contract/output-fields.js\";\nimport type { FlowDefinition } from \"./types.js\";\n\nexport { getConsumedOutputSchema };\n\n/** Result of validating fields at a producer's consumed-output boundary. */\nexport interface NodeOutputValidationResult {\n /** Whether the fields may be exposed to downstream consumers. */\n valid: boolean;\n /** Stable, path-bearing failures. Empty when validation is not required. */\n issues: string[];\n}\n\n/**\n * Validate proposed fields only when a downstream deterministic consumer requires them.\n *\n * `parseFlowDefinition` already refuses a consumed `output.fields` schema that does not\n * compile, so compiling it here cannot fail for a parsed flow.\n */\nexport function validateConsumedNodeOutput(\n flow: FlowDefinition,\n producerId: string,\n fields: Record<string, unknown> | undefined,\n): NodeOutputValidationResult {\n const schema = getConsumedOutputSchema(flow, producerId);\n if (!schema) return { valid: true, issues: [] };\n\n const parsed = compileOutputFieldsSchema(schema).safeParse(fields ?? {});\n if (parsed.success) return { valid: true, issues: [] };\n return {\n valid: false,\n issues: parsed.error.issues\n .map((issue) => {\n const suffix = issue.path.map(String).join(\".\");\n return `fields${suffix ? `.${suffix}` : \"\"}: ${issue.message}`;\n })\n .sort(),\n };\n}\n","import { FlowExpressionError, resolveFlowBindings } from \"../contract/expression.js\";\nimport { compileOutputFieldsSchema } from \"../contract/output-fields.js\";\nimport { buildFlowExpressionContext, producerOutputObtainedBy } from \"./bindings.js\";\nimport type { FlowDefinition, NodeExecutionSnapshot } from \"./types.js\";\n\n/**\n * Resolve what a completed flow returns to a parent sub-flow node.\n *\n * `undefined` when the flow declares no `output.bindings`: it returns nothing.\n * Otherwise each binding resolves like a node input binding, and the result is\n * validated against `output.schema`, which `parseFlowDefinition` already refused to\n * accept uncompiled. Throws an error naming the field and the source node when a\n * binding source did not produce its value, or naming the flow when the values do\n * not match the schema.\n */\nexport function resolveFlowOutputFields(\n flow: FlowDefinition,\n snapshots: Map<string, NodeExecutionSnapshot>,\n): Record<string, unknown> | undefined {\n const output = flow.output;\n if (output?.bindings === undefined) return undefined;\n\n const context = buildFlowExpressionContext(flow, snapshots);\n // Origins are required by the resolver but discarded: the parent classifies\n // every returned field as agent-obtained, whatever produced it in here.\n const origins = Object.fromEntries(\n flow.nodes.map((node) => [node.id, producerOutputObtainedBy(node, snapshots.get(node.id))]),\n );\n const fields: Record<string, unknown> = {};\n for (const [name, binding] of Object.entries(output.bindings)) {\n try {\n fields[name] = resolveFlowBindings({ [name]: binding }, context, origins).values[name];\n } catch (error) {\n if (!(error instanceof FlowExpressionError) || error.missingPath === undefined) throw error;\n const producer = error.missingPath.startsWith(\"nodes.\")\n ? error.missingPath.split(\".\")[1]\n : undefined;\n const source = producer\n ? `node ${producer} did not produce ${error.missingPath}`\n : `${error.missingPath} is missing`;\n throw new Error(`Flow ${flow.id} output field ${name} has no value: ${source}`);\n }\n }\n\n const parsed = compileOutputFieldsSchema(output.schema).safeParse(fields);\n if (!parsed.success) {\n const issues = parsed.error.issues\n .map((issue) => `${issue.path.map(String).join(\".\") || \"fields\"}: ${issue.message}`)\n .sort();\n throw new Error(`Flow ${flow.id} output does not match output.schema: ${issues.join(\"; \")}`);\n }\n return fields;\n}\n","/**\n * Pure derived-deadline arithmetic for `control.timeoutSec`.\n *\n * \"Active execution only\" is the scope every node-timeout ruling shares: the\n * clock runs from `startedAt` but stops counting while the node was parked\n * for a human decision. Rather than persist a separate \"paused\" duration,\n * this module recomputes the deadline on demand from `startedAt` plus the\n * already-durable `approvalHistory` / `inputHistory` — so it is correct\n * immediately after `hydrate()` or a reconnect with no extra wiring, and a\n * live timer is never the source of truth.\n *\n * @docLink packages/flow-engine/concepts#node-deadline\n */\n\nimport type { NodeExecution } from \"@skaile/workspaces/types\";\n\n/** Milliseconds spent parked in a resolved approval/input wait since `sinceMs`. */\nfunction pausedIntervalMs(execution: NodeExecution, sinceMs: number): number {\n let total = 0;\n for (const approval of execution.approvalHistory) {\n const startMs = Date.parse(approval.requestedAt);\n if (!Number.isFinite(startMs) || startMs < sinceMs) continue;\n if (!approval.decidedAt) continue; // still open — status wouldn't be \"running\" here\n const endMs = Date.parse(approval.decidedAt);\n if (Number.isFinite(endMs) && endMs > startMs) total += endMs - startMs;\n }\n for (const input of execution.inputHistory) {\n const startMs = Date.parse(input.requestedAt);\n if (!Number.isFinite(startMs) || startMs < sinceMs) continue;\n if (!input.providedAt) continue;\n const endMs = Date.parse(input.providedAt);\n if (Number.isFinite(endMs) && endMs > startMs) total += endMs - startMs;\n }\n return total;\n}\n\n/**\n * Milliseconds remaining before `execution`'s active-execution deadline, given\n * `timeoutSec`. Negative once the deadline has passed. `undefined` when no\n * timeout applies — `timeoutSec` is unset, or the node has no `startedAt` to\n * measure from (e.g. it hasn't actually started).\n *\n * Active time is wall-clock since `startedAt` minus every *resolved*\n * approval/input interval recorded at or after that `startedAt` (an\n * interval opened before a retry's fresh `startedAt` never counts against\n * the new attempt; a still-open interval never counts because the node\n * would not be `running` while parked).\n *\n * @param execution - Current node snapshot. Only `startedAt`, `approvalHistory`,\n * and `inputHistory` are read.\n * @param timeoutSec - Authored `control.timeoutSec`, or `undefined` for no timeout.\n * @param nowMs - Caller-supplied wall clock (`Date.now()` in production, injectable\n * for tests).\n * @docLink packages/flow-engine/concepts#remaining-active-execution-ms\n */\nexport function remainingActiveExecutionMs(\n execution: NodeExecution,\n timeoutSec: number | undefined,\n nowMs: number,\n): number | undefined {\n if (timeoutSec === undefined || !execution.startedAt) return undefined;\n const startedAtMs = Date.parse(execution.startedAt);\n if (!Number.isFinite(startedAtMs)) return undefined;\n const pausedMs = pausedIntervalMs(execution, startedAtMs);\n const deadlineMs = startedAtMs + timeoutSec * 1000 + pausedMs;\n return deadlineMs - nowMs;\n}\n\n/**\n * Whether `execution` has exceeded its derived active-execution deadline.\n * `false` when no timeout applies. Convenience wrapper over\n * {@link remainingActiveExecutionMs} for call sites that only need the\n * boolean.\n *\n * @docLink packages/flow-engine/concepts#is-active-execution-expired\n */\nexport function isActiveExecutionExpired(\n execution: NodeExecution,\n timeoutSec: number | undefined,\n nowMs: number,\n): boolean {\n const remaining = remainingActiveExecutionMs(execution, timeoutSec, nowMs);\n return remaining !== undefined && remaining <= 0;\n}\n","/**\n * Pure bookkeeping for `NodeExecution.outputHistory` and the bounded\n * automatic-retry budget derived from `control.retries`.\n *\n * `retries: N` means the first attempt plus N automatic retries — so an\n * automatic retry remains available while fewer than N attempts have\n * already failed. The budget is derived from `outputHistory` itself (a\n * count of prior `'failed'` entries) rather than a separate durable\n * counter, so it composes for free with hydration and needs no new field.\n *\n * The manual `retryNode` operator override never pushes an entry here (it\n * only flips `status` back to `available`). The agent's own\n * `doFailNode(recoverable: true)` self-retry DOES push an entry — every\n * actual start closes out an attempt — but marks it `selfRetry` so\n * `countFailedAttempts` excludes it: neither self-retry nor the manual\n * override consumes the automatic budget this module tracks.\n *\n * @docLink packages/flow-engine/concepts#node-attempts\n */\n\nimport type {\n CheckEvidence,\n NodeError,\n NodeExecutionAttempt,\n NodeOutput,\n} from \"@skaile/workspaces/types\";\n\n/** Next 1-based attempt number given the attempts already recorded. */\nexport function nextAttemptNumber(history: NodeExecutionAttempt[] | undefined): number {\n if (!history || history.length === 0) return 1;\n return Math.max(...history.map((entry) => entry.attempt)) + 1;\n}\n\n/** Rarely-set trailing facts about one appended attempt. */\nexport interface AppendAttemptOptions {\n /** True for the agent's own `doFailNode(recoverable: true)` self-retry: the\n * entry still records a genuine start-to-failure attempt, but is excluded\n * from {@link countFailedAttempts} so it never consumes the automatic\n * `control.retries` budget. */\n selfRetry?: boolean;\n /** Derived check evidence, when this attempt belongs to a `check` node that\n * actually produced a verdict (pass or fail). Omit for every other node\n * kind and for a check's infrastructure failure, which produced no verdict\n * to attach. */\n check?: CheckEvidence;\n}\n\n/**\n * Appends one terminal attempt to `history`, numbered `max(attempt) + 1`.\n * Never mutates `history` — returns a fresh array so callers can assign it\n * straight onto a cloned `NodeExecution`.\n *\n * @param history - Existing attempt history, oldest first (or `undefined`).\n * @param result - True outcome of this attempt — independent of any\n * compatibility status degrade the caller applies separately (e.g. an\n * optional node's failed execution still records `'failed'` here even\n * though its `NodeExecution.status` becomes `'skipped'`).\n * @param startedAtIso - This attempt's actual start time.\n * @param completedAtIso - This attempt's terminal outcome time.\n * @param options - See {@link AppendAttemptOptions}. Both fields default to absent.\n * @docLink packages/flow-engine/concepts#append-attempt\n */\nexport function appendAttempt(\n history: NodeExecutionAttempt[] | undefined,\n result: NodeExecutionAttempt[\"result\"],\n startedAtIso: string,\n completedAtIso: string,\n output: NodeOutput | undefined,\n error: NodeError | undefined,\n options: AppendAttemptOptions = {},\n): NodeExecutionAttempt[] {\n const attempt: NodeExecutionAttempt = {\n attempt: nextAttemptNumber(history),\n result,\n startedAt: startedAtIso,\n completedAt: completedAtIso,\n ...(output !== undefined ? { output } : {}),\n ...(error !== undefined ? { error } : {}),\n ...(options.selfRetry ? { selfRetry: true } : {}),\n ...(options.check !== undefined ? { check: options.check } : {}),\n };\n return [...(history ?? []), attempt];\n}\n\n/**\n * Count of attempts in `history` whose true outcome was `'failed'`,\n * excluding self-retry entries (see {@link appendAttempt}) — this feeds only\n * the automatic-retry budget, which self-retry sits outside of.\n */\nexport function countFailedAttempts(history: NodeExecutionAttempt[] | undefined): number {\n if (!history) return 0;\n return history.filter((entry) => entry.result === \"failed\" && !entry.selfRetry).length;\n}\n\n/**\n * Whether an automatic retry remains, given how many attempts have already\n * failed and the authored `control.retries` budget. `retries: N` allows the\n * first attempt plus N automatic retries — so a retry remains available\n * while `priorFailedAttempts < N`. No `retries` (or `0`) means no automatic\n * retry ever.\n *\n * @docLink packages/flow-engine/concepts#has-automatic-retry-budget\n */\nexport function hasAutomaticRetryBudget(\n priorFailedAttempts: number,\n retries: number | undefined,\n): boolean {\n if (!retries) return false;\n return priorFailedAttempts < retries;\n}\n","/**\n * The single statement of the rule that decides an exhausted failure's\n * terminal status.\n *\n * Previously each terminal-failure write site restated the rule and only two\n * of them implemented it, so `control.optional` meant different things per\n * node kind. Every such site now routes through here.\n *\n * @docLink packages/flow-engine/concepts#optional-failure\n */\n\nimport { isRouterNode, nodeIsOptional } from \"./node-shape.js\";\nimport type { FlowNode } from \"./types.js\";\n\n/**\n * Terminal status for a node whose execution failed with no retry budget left.\n *\n * Invariant: an optional node never ends terminally `failed`. Only `complete`\n * and `skipped` satisfy a hard `flow` edge (see `isBlocking`), so leaving one\n * `failed` stalls every dependent at the node the author called expendable.\n *\n * A router is the deliberate exception: a `skipped` router leaves the gated\n * set (`unsettledRouterBranchIds`) while satisfying every outgoing hard edge,\n * so skipping it admits *all* of its branches instead of selecting one.\n */\nexport function resolveTerminalFailureStatus(node: FlowNode): \"failed\" | \"skipped\" {\n return nodeIsOptional(node) && !isRouterNode(node) ? \"skipped\" : \"failed\";\n}\n","/**\n * Pure derivation of a `check` node's evidence payload — what was compared,\n * where each value came from, and whether that makes the verdict\n * runtime-`\"verified\"` or agent-`\"asserted\"`.\n *\n * Ruling: re-running a check is not required to reproduce the same answer,\n * so there is no snapshot materialization, no hashing, and no reproducibility\n * guarantee here — this module records integrity of *what was observed*, not\n * a promise that observing it again would agree. Provenance is derived\n * exclusively from {@link BindingOrigin.obtainedBy}, the flow engine's\n * existing (and only) provenance mechanism, so it can never be influenced by\n * how a flow author names a binding. That label is transitive before it\n * arrives here — a deterministic node that carries an agent's value forward\n * stays agent-obtained — so this module compares origins as given and makes\n * no one-hop caveat.\n *\n * The claim is that provenance cannot be asserted by flow *configuration*.\n * It is not a claim against a caller holding the read-write connector handle:\n * taint now derives from persisted `NodeExecution.inputOrigins`, which the\n * `hydrate` op writes verbatim. Such a caller could already forge `output`\n * itself, so this widens no existing trust boundary.\n *\n * No I/O and no clock: `observedAt` is supplied by the caller so this stays\n * trivially testable and replayable.\n *\n * @docLink packages/flow-engine/concepts#check-provenance\n */\n\nimport type {\n BindingOrigin,\n CheckComparedValue,\n CheckEvidence,\n CheckInputCurrency,\n CheckProvenance,\n} from \"@skaile/workspaces/types\";\nimport type { ResolvedNodeBindings } from \"../contract/expression.js\";\n\n/** The check's process facts, captured alongside its verdict so a persisted attempt is self-describing. */\nexport interface CheckProcessRecord {\n runtime: \"shell\" | \"node\" | \"python\";\n command: string;\n cwd?: string;\n successExit: number[];\n exitStatus: number;\n passed: boolean;\n}\n\nconst FLOW_LOCAL_SOURCES = new Set<BindingOrigin[\"source\"]>([\"literal\", \"default\", \"flow-input\"]);\n\n/**\n * Derive one check's evidence from its already-resolved bindings and its\n * process outcome. `provenance` and `inputs` are computed only from\n * `bindings.origins` — never from `bindings.values` or their names — so\n * authoring a binding literally named `provenance` or `verified` cannot\n * influence the verdict.\n *\n * `provenance` is `\"verified\"` iff every origin of every compared value has\n * `obtainedBy: \"runtime\"`, `\"asserted\"` if any does not, and **absent** when\n * there are no compared values — neither label is honest about an empty set.\n * `obtainedBy` is already transitive when it reaches here (see\n * `producerOutputObtainedBy`), so `\"verified\"` means no agent-produced value\n * contributed anywhere in the ancestry, not merely one hop back.\n * `inputs` is `\"live\"` — the floor for any check that runs a process —\n * unless there is at least one compared value and every one of them has\n * origins that are all `literal`/`default`/`flow-input`, in which case it is\n * `\"flow-local\"`.\n */\nexport function deriveCheckEvidence(\n bindings: ResolvedNodeBindings,\n process: CheckProcessRecord,\n observedAt: string,\n): CheckEvidence {\n const values: CheckComparedValue[] = Object.entries(bindings.values).map(([name, value]) => {\n const origins = bindings.origins[name] ?? [];\n const obtainedBy = origins.some((origin) => origin.obtainedBy === \"agent\")\n ? \"agent\"\n : \"runtime\";\n return { name, value, origins, obtainedBy };\n });\n const provenance: CheckProvenance | undefined =\n values.length === 0\n ? undefined\n : values.every((compared) => compared.obtainedBy === \"runtime\")\n ? \"verified\"\n : \"asserted\";\n const inputs: CheckInputCurrency =\n values.length > 0 &&\n values.every((compared) =>\n compared.origins.every((origin) => FLOW_LOCAL_SOURCES.has(origin.source)),\n )\n ? \"flow-local\"\n : \"live\";\n return {\n values,\n ...(provenance !== undefined ? { provenance } : {}),\n inputs,\n observedAt,\n ...process,\n };\n}\n","/**\n * Flow manifest schema and validation.\n *\n * Moved from @skaile/workspaces/types/manifests/flow.ts in Phase 1.7.3.\n * This is now the canonical location for flow manifest validation.\n */\n\nimport * as z from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Validation result (inline — avoids importing from types/manifests/_shared)\n// ---------------------------------------------------------------------------\n\nexport interface ManifestValidationSuccess<T> {\n ok: true;\n data: T;\n}\n\nexport interface ManifestValidationFailure {\n ok: false;\n errors: Array<{ path: string; message: string }>;\n}\n\nexport type ManifestValidationResult<T> = ManifestValidationSuccess<T> | ManifestValidationFailure;\n\n// ---------------------------------------------------------------------------\n// Schema\n// ---------------------------------------------------------------------------\n\nconst FlowNodeSchema = z.looseObject({\n id: z.string().min(1),\n skill: z.string().optional(),\n type: z.string().optional(),\n label: z.string().optional(),\n description: z.string().optional(),\n data: z\n .looseObject({\n optional: z.boolean().optional(),\n // Mandatory approval gate — autonomous mode cannot skip it.\n approval: z.looseObject({ mandatory: z.boolean().optional() }).optional(),\n })\n .refine((d) => !(d.optional === true && d.approval?.mandatory === true), {\n // A mandatory gate can never be skipped, so optional+mandatory is a\n // contradiction — reject it rather than silently letting mandatory win.\n message: \"a node cannot be both optional and a mandatory approval gate\",\n })\n .optional(),\n});\n\nconst FlowEdgeSchema = z.looseObject({\n id: z.string().optional(),\n source: z.string().min(1),\n target: z.string().min(1),\n condition: z.string().optional(),\n});\n\nexport const FlowManifestSchema = z.looseObject({\n id: z.string().min(1),\n version: z.string().optional(),\n name: z.string().min(1),\n description: z.string().optional(),\n metadata: z\n .looseObject({\n tags: z.array(z.string()).optional(),\n stage: z.string().optional(),\n icon: z.string().optional(),\n category: z.string().optional(),\n onboarding: z.record(z.string(), z.unknown()).optional(),\n })\n .optional(),\n globals: z.record(z.string(), z.unknown()).optional(),\n modes: z.record(z.string(), z.unknown()).optional(),\n tier_presets: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n artifact_handoff: z.unknown().optional(),\n entry: z.string().optional(),\n nodes: z.array(FlowNodeSchema).optional(),\n edges: z.array(FlowEdgeSchema).optional(),\n});\n\nexport type FlowManifest = z.infer<typeof FlowManifestSchema>;\n\n// ---------------------------------------------------------------------------\n// Validation\n// ---------------------------------------------------------------------------\n\nexport function validateFlow(data: unknown): ManifestValidationResult<FlowManifest> {\n const result = FlowManifestSchema.safeParse(data);\n if (result.success) {\n return { ok: true, data: result.data };\n }\n return {\n ok: false,\n errors: result.error.issues.map((issue) => ({\n path: issue.path.join(\".\"),\n message: issue.message,\n })),\n };\n}\n","/**\n * Flow asset kind provider.\n *\n * Exported from @skaile/workspaces/factory-assets/connectors/flow/engine for explicit registration\n * by the CLI at bootstrap. Discovery does NOT auto-include this provider\n * (discovery must stay a leaf — no flow-engine imports).\n *\n * Implements IAssetKindProvider with flow-specific:\n * - Discovery patterns: *.flow.yaml, *.flow.json\n * - Manifest validation via FlowManifestSchema\n * - Requires extraction: nodes[].run.assets plus legacy skill/sub-flow references\n * - File filter: just the manifest file (flows are single-file)\n */\n\nimport * as path from \"node:path\";\nimport type {\n AssetKindFileFilter,\n AssetKindRequiresEdge,\n IAssetKindProvider,\n} from \"@skaile/workspaces/plugins\";\nimport { validateFlow } from \"./flow-manifest.js\";\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport const flowKindProvider: IAssetKindProvider = {\n kind: \"flow\",\n displayName: \"Flow\",\n providerVersion: \"1.1.0\",\n installTarget: \"flow\",\n discoveryPatterns: [\"**/*.flow.yaml\", \"**/*.flow.json\"],\n\n matchesPath(relativePath: string): boolean {\n return relativePath.endsWith(\".flow.yaml\") || relativePath.endsWith(\".flow.json\");\n },\n\n validateManifest(data: unknown) {\n return validateFlow(data);\n },\n\n defaultFileFilter(manifestPath: string): AssetKindFileFilter {\n return {\n assetRoot: path.dirname(manifestPath),\n files: [path.basename(manifestPath)],\n };\n },\n\n extractRequires(assetRef: string, manifest: Record<string, unknown>): AssetKindRequiresEdge[] {\n const edges: AssetKindRequiresEdge[] = [];\n const seen = new Set<string>();\n const add = (to: string, field: string): void => {\n if (seen.has(to)) return;\n seen.add(to);\n edges.push({ from: assetRef, to, field });\n };\n\n const nodes = manifest.nodes;\n if (Array.isArray(nodes)) {\n for (const node of nodes) {\n if (typeof node !== \"object\" || node === null) continue;\n const n = node as Record<string, unknown>;\n const data = (\n typeof n.data === \"object\" && n.data !== null ? (n.data as Record<string, unknown>) : {}\n ) as Record<string, unknown>;\n const run =\n typeof n.run === \"object\" && n.run !== null ? (n.run as Record<string, unknown>) : {};\n\n if (Array.isArray(run.assets)) {\n for (const asset of run.assets) {\n if (typeof asset === \"string\") add(asset, \"nodes[].run.assets\");\n }\n }\n\n if (run.kind === \"sub-flow\" && typeof run.flow === \"string\") {\n const flowRef = run.flow.startsWith(\"flow:\") ? run.flow : `flow:${run.flow}`;\n add(flowRef, \"nodes[].run.flow\");\n }\n\n const skill = typeof data.skill === \"string\" ? data.skill : n.skill;\n if (typeof skill === \"string\") {\n add(skill, \"nodes[].data.skill\");\n }\n\n const subFlow = typeof data.flow === \"string\" ? data.flow : n.flow;\n if (typeof subFlow === \"string\") {\n add(subFlow.startsWith(\"flow:\") ? subFlow : `flow:${subFlow}`, \"nodes[].data.flow\");\n }\n }\n }\n\n return edges;\n },\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { findKindDirs } from \"@skaile/workspaces/core\";\nimport { parse as parseYaml } from \"yaml\";\nimport { parseFlowDefinition } from \"../contract/normalize.js\";\nimport type { FlowDefinition } from \"./types.js\";\n\n/**\n * The filename suffixes a flow file may carry, in probe order. `.json` is the\n * legacy bare form and stays last so an explicit `.flow.json` wins a tie.\n *\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport const FLOW_FILE_EXTENSIONS = [\".flow.yaml\", \".flow.yml\", \".flow.json\", \".json\"] as const;\n\n/** A discovered flow paired with the file it was loaded from. */\nexport interface FlowFileEntry {\n flow: FlowDefinition;\n path: string;\n}\n\n/**\n * The conventional on-disk locations of flow `flowId` inside one `flows/` search\n * dir: the flat `<dir>/<id><ext>` and the per-flow-directory\n * `<dir>/<id>/<id><ext>`, for every {@link FLOW_FILE_EXTENSIONS}. Existence is\n * NOT checked. Shared with `findFlowFileInRoots` so the naming convention has\n * exactly one definition.\n *\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function flowFileCandidates(dirPath: string, flowId: string): string[] {\n return [\n ...FLOW_FILE_EXTENSIONS.map((ext) => path.join(dirPath, `${flowId}${ext}`)),\n ...FLOW_FILE_EXTENSIONS.map((ext) => path.join(dirPath, flowId, `${flowId}${ext}`)),\n ];\n}\n\n/** Matches `flow.yaml` as well as `<anything>.flow.yaml` (and `.yml` / `.json`). */\nconst FLOW_SHAPED_FILE = /(^|\\.)flow\\.(ya?ml|json)$/i;\n\n/** How far below a per-flow directory a stray flow file is still reported. */\nconst STRAY_SCAN_DEPTH = 3;\n\nfunction isDirectory(entry: fs.Dirent, fullPath: string): boolean {\n if (entry.isDirectory()) return true;\n if (!entry.isSymbolicLink()) return false;\n try {\n return fs.statSync(fullPath).isDirectory();\n } catch {\n return false;\n }\n}\n\n/**\n * First flow-shaped file at or below `dirPath`, used only to decide whether a\n * subdirectory that yielded no conventional flow deserves a warning. Deliberately\n * ignores bare `.json` so sibling assets (`package.json`, fixtures) stay silent.\n */\nfunction findStrayFlowFile(dirPath: string, depth: number = STRAY_SCAN_DEPTH): string | undefined {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dirPath, { withFileTypes: true });\n } catch {\n return undefined;\n }\n for (const entry of entries) {\n if (!isDirectory(entry, path.join(dirPath, entry.name)) && FLOW_SHAPED_FILE.test(entry.name)) {\n return path.join(dirPath, entry.name);\n }\n }\n if (depth <= 1) return undefined;\n for (const entry of entries) {\n const full = path.join(dirPath, entry.name);\n if (!isDirectory(entry, full)) continue;\n if (entry.name.startsWith(\"_\") || entry.name.startsWith(\".\") || entry.name === \"node_modules\") {\n continue;\n }\n const stray = findStrayFlowFile(full, depth - 1);\n if (stray) return stray;\n }\n return undefined;\n}\n\n/**\n * Load a single {@link FlowDefinition} from a YAML or JSON file on disk.\n *\n * Format detection is based on file extension:\n * - `.yaml` / `.yml` — parsed with the `yaml` library.\n * - Everything else — parsed as JSON.\n *\n * @param filePath - Absolute path to the flow file.\n * @returns The parsed {@link FlowDefinition}.\n * @throws {Error} If the file does not exist, cannot be read, or fails to parse.\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function loadFlow(filePath: string): FlowDefinition {\n const raw = fs.readFileSync(filePath, \"utf-8\");\n const ext = path.extname(filePath).toLowerCase();\n const authored = ext === \".yaml\" || ext === \".yml\" ? parseYaml(raw) : JSON.parse(raw);\n const parsed = parseFlowDefinition(authored);\n if (!parsed.ok) {\n const details = parsed.errors\n .map((issue) => ` ${issue.path || \"<root>\"}: ${issue.message}`)\n .join(\"\\n\");\n throw new Error(`Invalid flow definition:\\n${details}`);\n }\n return parsed.data;\n}\n\n/**\n * Load every flow in a `flows/` directory, in both supported shapes, keeping the\n * file each one came from.\n *\n * Two tiers, and nothing else:\n * 1. **Flat** — a file directly in `dirPath` ending in one of {@link FLOW_FILE_EXTENSIONS}.\n * 2. **Per-flow directory** — `<dir>/<sub>/<sub><ext>`; the file MUST be named after\n * its directory, which is what lets a flow keep sibling assets (README, fixtures,\n * prompts) without them being parsed as flows.\n *\n * A subdirectory that holds something flow-shaped but no conventional file is\n * **reported** through `onWarn` rather than dropped silently — silence is the\n * defect this contract exists to remove. Files/dirs prefixed with `_` are the\n * explicit opt-out and stay silent. Parse failures are warned about and skipped,\n * never thrown.\n *\n * @param dirPath - Absolute path to the directory to scan.\n * @param opts.onWarn - Sink for warnings; defaults to `stderr`. Pass a no-op on\n * hot paths where a probe miss is normal (e.g. resolving an arbitrary CLI arg).\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function loadFlowEntriesFromDir(\n dirPath: string,\n opts: { onWarn?: (message: string) => void } = {},\n): FlowFileEntry[] {\n const warn = opts.onWarn ?? ((message: string) => void process.stderr.write(`${message}\\n`));\n\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dirPath, { withFileTypes: true });\n } catch {\n return [];\n }\n\n const found: FlowFileEntry[] = [];\n const load = (filePath: string, label: string) => {\n try {\n const def = loadFlow(filePath);\n if (def.id && def.nodes && def.edges) found.push({ flow: def, path: filePath });\n } catch (err) {\n warn(`[agent-flow-engine] skipping ${label}: ${(err as Error).message}`);\n }\n };\n\n for (const entry of entries) {\n if (entry.name.startsWith(\"_\")) continue;\n const full = path.join(dirPath, entry.name);\n\n if (!isDirectory(entry, full)) {\n if (FLOW_FILE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))) load(full, entry.name);\n continue;\n }\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\n const conventional = FLOW_FILE_EXTENSIONS.map((ext) =>\n path.join(full, `${entry.name}${ext}`),\n ).find((candidate) => fs.existsSync(candidate));\n if (conventional) {\n load(conventional, path.join(entry.name, path.basename(conventional)));\n continue;\n }\n\n const stray = findStrayFlowFile(full);\n if (stray) {\n warn(\n `[agent-flow-engine] ignoring ${stray}: a flow directory must hold ` +\n `${entry.name}.flow.yaml (or .flow.yml / .flow.json / .json)`,\n );\n }\n }\n\n return found;\n}\n\n/**\n * Load all flows from a directory — {@link loadFlowEntriesFromDir} without the\n * originating file paths. See it for the two supported layouts, the warning\n * contract, and the `_`-prefix opt-out.\n *\n * @param dirPath - Absolute path to the directory to scan.\n * @returns Array of successfully parsed {@link FlowDefinition} objects. Empty if the\n * directory does not exist or contains no valid flow files.\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function loadFlowsFromDir(dirPath: string): FlowDefinition[] {\n return loadFlowEntriesFromDir(dirPath).map((entry) => entry.flow);\n}\n\n/**\n * Discover every flow under a content root, keeping the file each came from.\n *\n * Covers every `flows/` directory at any depth under the root via\n * `findKindDirs`, and within each of those both flow layouts via\n * {@link loadFlowEntriesFromDir}. De-duped by **declared id**, first search dir\n * wins — the same identity every other flow surface resolves by.\n *\n * @param aiResourcesRoot - Absolute path to a content root (`ai-assets/` or equivalent).\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function loadAllFlowEntries(\n aiResourcesRoot: string,\n opts: { onWarn?: (message: string) => void } = {},\n): FlowFileEntry[] {\n if (!fs.existsSync(aiResourcesRoot)) return [];\n\n const byId = new Map<string, FlowFileEntry>();\n for (const dir of findKindDirs(aiResourcesRoot, \"flows\")) {\n for (const entry of loadFlowEntriesFromDir(dir, opts)) {\n if (!byId.has(entry.flow.id)) byId.set(entry.flow.id, entry);\n }\n }\n return [...byId.values()];\n}\n\n/**\n * Discover and load all flow definitions under a content root —\n * {@link loadAllFlowEntries} without the originating file paths.\n *\n * @param aiResourcesRoot - Absolute path to the `ai-assets/` directory (or equivalent\n * resource root). Typically the `ai-assets/` folder at the monorepo root.\n * @returns Flat array of all successfully parsed {@link FlowDefinition} objects across\n * all `flows/` directories. Empty if the root directory does not exist.\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function loadAllFlows(aiResourcesRoot: string): FlowDefinition[] {\n return loadAllFlowEntries(aiResourcesRoot).map((entry) => entry.flow);\n}\n","/**\n * locate.ts — the one place that answers \"where do flows live, and what are\n * they called\".\n *\n * It sits in the engine, next to `flowFileCandidates` / `loadAllFlowEntries`,\n * because both sides of the question have to agree: the CLI's *listing*\n * surfaces (`flow list`, completions) and the *resolution* surfaces that live\n * in this tree (`resume`, sub-flow `run.flow` targets, `serve`). They used to\n * hold two hand-maintained candidate lists, and only one of them ever grew.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { findKindDirs, projectAssetRoots } from \"@skaile/workspaces/core\";\nimport { flowFileCandidates, loadAllFlowEntries, loadFlow } from \"./loader.js\";\n\n/** How far up from the project the `ai-assets/` walk looks before giving up. */\nconst AI_ASSETS_WALK_LEVELS = 6;\n\n/**\n * Walk upward from `startDir` (checking at most `AI_ASSETS_WALK_LEVELS`\n * directories, never the filesystem root itself) for an `ai-assets/`\n * subdirectory. Returns its absolute path, or `null` when none is found.\n */\nfunction findAiAssetsDir(startDir: string): string | null {\n let dir = path.resolve(startDir);\n const fsRoot = path.parse(dir).root;\n\n for (let i = 0; i < AI_ASSETS_WALK_LEVELS; i++) {\n const candidate = path.join(dir, \"ai-assets\");\n if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir || parent === fsRoot) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Roots that only the *resolution* surfaces prepend: the project's own\n * `ai-assets/` tree, so a workspace can shadow a built-in flow.\n *\n * Returns at most one root — the nearest `ai-assets/` at or above `projectDir`.\n * Listing deliberately does **not** include it; see `cli/src/flow-discovery.ts`.\n *\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function projectAiAssetsRoots(projectDir: string): string[] {\n const found = findAiAssetsDir(projectDir);\n return found ? [found] : [];\n}\n\n/**\n * Every root a flow lookup walks, in priority order: the project's own\n * `ai-assets/` tree first, then the project's roots ({@link projectAssetRoots}: its\n * `.skaile/` install root and the first-party factory-assets layers).\n *\n * This is the **project** scope (p1353): `skaile run <id>`, `flow list`, `resume`,\n * sub-flow `run.flow` targets and `serve` all resolve over it, so a flow that runs\n * for you runs for a teammate with the same `skaile.yaml`. The registered\n * libraries, the source clones in `~/.skaile/cache/` and the global `~/.skaile/`\n * root are not part of it; a flow that lives only there needs `skaile add` first.\n *\n * The authored `ai-assets/` tree leading is deliberate and is what `skaile run`\n * has always done: a workspace must be able to shadow a built-in flow. It is the\n * opposite of the `.skaile/`-first ordering of `aiResourceRoots`, where the deployed\n * `.skaile/` copy leads because `deployAll` applies `patches:` to it — so for a\n * flow id present in *both*, resolution takes the authored source. Resume must\n * execute the bytes `run` executed; that agreement is the point of this module.\n *\n * @param projectDir - Project whose `.skaile/` and `ai-assets/` roots to\n * include (default: `process.cwd()`).\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function flowLookupRoots(projectDir?: string): string[] {\n const dir = path.resolve(projectDir ?? process.cwd());\n return [...new Set([...projectAiAssetsRoots(dir), ...projectAssetRoots(dir)])];\n}\n\n/**\n * Why a conventional candidate that exists on disk was still not accepted —\n * the difference between \"no such flow\" and \"that file is right there but\n * declares something else\", which a bare \"not found\" used to hide.\n *\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport interface FlowLookupMiss {\n path: string;\n reason: \"unparseable\" | \"id-mismatch\";\n declaredId?: string;\n error?: string;\n}\n\n/** `candidate` resolves inside `dir` rather than escaping it via `..`. */\nfunction contained(dir: string, candidate: string): boolean {\n const relative = path.relative(path.resolve(dir), path.resolve(candidate));\n return !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n\n/**\n * Locate the file of the flow whose **declared id** is `flowId`, across `roots`.\n *\n * Per root: the conventional paths first (every `flows/` directory at any depth\n * via `findKindDirs`, both flow layouts and all four extensions via\n * `flowFileCandidates`), then the full enumeration `loadAllFlowEntries` — the\n * same one `discoverFlows` lists from, which is what keeps listing and\n * resolution agreeing by construction. The fallback stays *inside* the loop so\n * an earlier root always wins over a later one.\n *\n * A candidate that resolves outside the search dir it was built from is\n * **skipped, not thrown**: this is on the `skaile run \"<free-text prompt>\"`\n * path, where a miss is normal and must fall through to single-shot mode.\n *\n * @param opts.onMiss - Called for a conventional candidate that exists but was\n * rejected. Discovery warnings are suppressed regardless.\n * @docLink packages/flow-engine/concepts#flow-loading\n */\nexport function findFlowFileInRoots(\n flowId: string,\n roots: string[],\n opts: { onMiss?: (miss: FlowLookupMiss) => void } = {},\n): string | undefined {\n for (const root of roots) {\n for (const dir of findKindDirs(root, \"flows\")) {\n for (const candidate of flowFileCandidates(dir, flowId)) {\n if (!contained(dir, candidate) || !fs.existsSync(candidate)) continue;\n let declaredId: string;\n try {\n declaredId = loadFlow(candidate).id;\n } catch (err) {\n opts.onMiss?.({\n path: candidate,\n reason: \"unparseable\",\n error: err instanceof Error ? err.message : String(err),\n });\n continue;\n }\n if (declaredId === flowId) return candidate;\n opts.onMiss?.({ path: candidate, reason: \"id-mismatch\", declaredId });\n }\n }\n const entry = loadAllFlowEntries(root, { onWarn: () => {} }).find((e) => e.flow.id === flowId);\n if (entry) return entry.path;\n }\n return undefined;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../cli/src/ensure-sources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,iBAAA,EAAkB,EAAG,GAAG,CAAA;AAC3C;AASA,SAAS,kBAAA,CAAmB,UAAkB,KAAA,EAAsC;AAClF,EAAA,IAAI;AACF,IAAA,OAAO,mBAAA,CAAoB,IAAA,CAAK,QAAQ,CAAA,CAAE,UAAA,EAAW;AAAA,EACvD,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAA,CAAO,CAAA,eAAA,EAAkB,QAAQ,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,IAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,IAC1F;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAMA,SAAS,kBAAA,CAAmB,KAAA,EAAoB,KAAA,EAAgB,MAAA,EAA4B;AAC1F,EAAA,MAAM,GAAA,GAAM,cAAA,CAAe,KAAA,CAAM,GAAG,CAAA;AACpC,EAAA,MAAM,IAAA,GAAO,eAAA,CAAgB,KAAA,CAAM,GAAG,CAAA;AACtC,EAAA,MAAM,IAAA,GAAO,gBAAgB,GAAG,CAAA;AAEhC,EAAA,IAAI,cAAA,CAAe,IAAI,CAAA,EAAG;AACxB,IAAA,MAAA,CAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AACvB,IAAA;AAAA,EACF;AACA,EAAA,wBAA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AgB,IAAA,CAAA,IAAA,CAAK,UAAA,EAAY,aAAa,CAAA;AACpD,EAAA,IAAI,CAAC,UAAA,CAAW,QAAQ,CAAA,EAAG,OAAO,MAAA;AAElC,EAAA,MAAM,KAAA,GAAQ,KAAK,KAAA,IAAS,KAAA;AAC5B,EAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,QAAA,EAAU,KAAK,CAAA;AAClD,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,MAAA;AAC7B,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAEjC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,kBAAA,CAAmB,KAAA,EAAO,OAAO,MAAM,CAAA;AAAA,EACzC;AAEA,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,iBAAA,CAAkB,MAAM,CAAA;AAAA,EAC1B;AAEA,EAAA,OAAO,MAAA;AACT","file":"ensure-sources-6O54DUQB.js","sourcesContent":["/**\n * ensure-sources.ts — hydrate the `~/.skaile/cache/sources/` clone cache from a\n * project's `skaile.yaml` `sources:` entries.\n *\n * Called by `skaile init` (idempotent: no-op when no sources declared) and\n * `skaile install` so checking out a project pulls its source clones onto\n * the local machine.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n discardUnclonedSourceDir,\n getGlobalCacheDir,\n isSourceCloned,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n} from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk } from \"./helpers.ts\";\n\nfunction sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nexport interface EnsureResult {\n cloned: string[];\n cached: string[];\n failed: string[];\n}\n\n/** Load `sources:` from a project's `skaile.yaml`, or `null` when unavailable. */\nfunction loadProjectSources(yamlPath: string, quiet: boolean): SourceEntry[] | null {\n try {\n return WorkspaceYamlEditor.load(yamlPath).getSources();\n } catch (err) {\n if (!quiet) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n }\n return null;\n }\n}\n\n/**\n * Hydrate a single source entry into `result`: skip when already cached,\n * otherwise clone and record success/failure. Mutates `result` in place.\n */\nfunction hydrateSourceEntry(entry: SourceEntry, quiet: boolean, result: EnsureResult): void {\n const key = sourceCacheKey(entry.url);\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(key);\n // A folder without a git checkout (a failed first clone left it) is not a cached clone.\n if (isSourceCloned(dest)) {\n result.cached.push(slug);\n return;\n }\n discardUnclonedSourceDir(dest);\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: quiet ? \"pipe\" : \"inherit\" });\n if (clone.status !== 0) {\n discardUnclonedSourceDir(dest);\n if (quiet) {\n logErr(`git clone failed for ${entry.url}`);\n }\n return;\n }\n result.cloned.push(slug);\n}\n\n/** Log a full-hydrate summary of cloned + reused-cached entries. */\nfunction logHydrateSummary(result: EnsureResult): void {\n for (const n of result.cloned) logOk(`Cloned source \"${n}\".`);\n if (result.cached.length > 0) {\n logInfo(`Reused cached clones: ${result.cached.join(\", \")}`);\n }\n}\n\n/**\n * Walk `projectDir/skaile.yaml` `sources:` and clone any entries whose\n * clone directory does not yet exist under `~/.skaile/cache/sources/`. Existing\n * clones are left untouched — this is hydration, not sync.\n *\n * Quiet by default: when `quiet: true` the helper only prints failures.\n * On full hydrate (`quiet: false`) it logs each cloned/cached entry.\n */\nexport function ensureSourcesCloned(\n projectDir: string,\n opts: { quiet?: boolean } = {},\n): EnsureResult {\n const result: EnsureResult = { cloned: [], cached: [], failed: [] };\n const yamlPath = path.join(projectDir, \"skaile.yaml\");\n if (!existsSync(yamlPath)) return result;\n\n const quiet = opts.quiet ?? false;\n const sources = loadProjectSources(yamlPath, quiet);\n if (sources === null) return result;\n if (sources.length === 0) return result;\n\n for (const entry of sources) {\n hydrateSourceEntry(entry, quiet, result);\n }\n\n if (!quiet) {\n logHydrateSummary(result);\n }\n\n return result;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../cli/src/commands/library-publish.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,IAAM,iBAAA,GAAoB,sBAAA;AAG1B,SAAS,YAAY,GAAA,EAAkC;AACrD,EAAA,IAAI,GAAA,CAAI,OAAA,KAAY,KAAA,EAAO,OAAO,MAAA;AAClC,EAAA,OAAQ,IAAI,aAAA,CAAmC,GAAA;AACjD;AAGA,SAAS,SAAS,GAAA,EAAsB;AACtC,EAAA,IAAI,GAAA,CAAI,OAAA,KAAY,KAAA,EAAO,OAAO,MAAA;AAClC,EAAA,OAAQ,GAAA,CAAI,cAAmC,MAAA,IAAU,MAAA;AAC3D;AAMA,SAAS,aAAa,OAAA,EAAoC;AACxD,EAAA,IAAI,IAAA;AACJ,EAAA,IAAI;AACF,IAAA,IAAA,GAAO,YAAA,CAAa,IAAA,CAAK,OAAA,EAAS,iBAAiB,GAAG,OAAO,CAAA;AAAA,EAC/D,CAAA,CAAA,MAAQ;AACN,IAAA,MAAA;AAAA,MACE,CAAA,GAAA,EAAM,CAAA,CAAE,GAAA,CAAI,iBAAiB,CAAC,CAAA,+GAAA;AAAA,KAEhC;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACA,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAY,GAAI,qBAAqB,IAAI,CAAA;AAC3D,EAAA,MAAM,SAAS,WAAA,CAAY,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,OAAO,CAAA;AAC/D,EAAA,IAAI,MAAA,CAAO,SAAS,CAAA,E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A,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAAA,EAC1C,CAAA,SAAE;AACA,IAAA,KAAA,EAAM;AAAA,EACR;AACF","file":"library-publish-MUGUST43.js","sourcesContent":["/**\n * `skaile library publish / register / yank` — the first-party publish flow.\n * A git-backed library you own carries an in-repo `skaile.manifest.yaml`; this\n * commits + pushes the library repo (publish), or takes the current remote HEAD\n * as-is (register), then registers + syncs it as a store source and publishes\n * the manifest's assets, each under its own namespace — `assets[].publisher`,\n * else the manifest's top-level `publisher` (no namespace remap — first-party\n * authors intend their declared namespace). Every distinct namespace is\n * preflighted before the push. The plan phase (dry-run and real) also requires the\n * remote to be a GitHub url and warns about a missing LICENSE and, for `publish`,\n * untracked files that `git add -A` would make public.\n *\n * - `publish` = commit (if dirty) + push + register + sync + publish.\n * - `register` = same, but skip the commit/push (bytes already on GitHub).\n * - `yank` = unpublish the library's published assets (all, or one).\n *\n * The store REST surface is reached through the injectable {@link PublisherClient}\n * (default HTTP); git side-effects go through an injectable `spawn`. Both seams\n * keep the flow unit/integration-testable without a live store or a real remote.\n *\n * @docLink cli/commands/library\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { basename, dirname, join, relative, sep } from \"node:path\";\nimport {\n type AssetEntry,\n decodeSkaileManifest,\n loadSkPublishManifest,\n matchPin,\n type SkPublishManifest,\n readAssetBody,\n} from \"@skaile/workspaces/core\";\nimport { isSecretFileName } from \"@skaile/workspaces/core/publish-manifest\";\nimport { type ParseManifestResult, parseManifestFile } from \"@skaile/workspaces/discovery\";\nimport {\n type GitBackendConfig,\n type Library,\n missingRootAssets,\n scanUnlistedAssets,\n UNLISTED_SCAN_SKIP_DIRS,\n upsertManifestAsset,\n} from \"@skaile/workspaces/library\";\nimport { type ComposeRefContext, composeRefContext } from \"../agent-checks.ts\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport { openCatalogSource, openLibraryManager } from \"../open-library.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport {\n type AssetCheckResult,\n checkAsset,\n checkAssetFile,\n declaredVersion,\n duplicateAssetMessage,\n findEntryManifestFile,\n invalidSemverText,\n manifestParseErrorText,\n} from \"../skill-checks.ts\";\nimport { isStoreAuthenticated } from \"../store-client.ts\";\nimport { makeHttpPublisherClient, type PublisherClient } from \"../store-publisher.ts\";\nimport {\n exitOnLibrarySymlinks,\n exitOnManifestPublisherProblems,\n exitOnManifestPathProblems,\n type ManifestDependencyProblem,\n manifestDependencyProblems,\n manifestRequiresProblems,\n registeredAssetKeys,\n} from \"./library-index.ts\";\nimport { scanIdentities } from \"./validate.ts\";\nimport {\n assetEntryRef,\n assetNamespace,\n bareName,\n exitOnEmptyAsset,\n formatNamespaceAvailability,\n manifestNamespaces,\n plannedRefs,\n preflightNamespace,\n publishToStore,\n refFor,\n} from \"./publish-core.ts\";\n\n/** Injectable spawn contract — the subset of `spawnSync` these helpers use. */\ntype SpawnLike = typeof spawnSync;\n\n/** The fixed filename a library carries at its root for publication. */\nconst MANIFEST_FILENAME = \"skaile.manifest.yaml\";\n\n/** The remote url of a git-backed library, or `undefined` for a local one. */\nfunction remoteUrlOf(lib: Library): string | undefined {\n if (lib.backend !== \"git\") return undefined;\n return (lib.backendConfig as GitBackendConfig).url;\n}\n\n/** The publish branch of a git-backed library (defaults to `main`). */\nfunction branchOf(lib: Library): string {\n if (lib.backend !== \"git\") return \"main\";\n return (lib.backendConfig as GitBackendConfig).branch ?? \"main\";\n}\n\n/**\n * Read + decode the in-repo `skaile.manifest.yaml`. Prints each error\n * diagnostic and exits (1) — mirroring the sidecar flow's validation gate.\n */\nfunction loadManifest(libPath: string): SkPublishManifest {\n let text: string;\n try {\n text = readFileSync(join(libPath, MANIFEST_FILENAME), \"utf-8\");\n } catch {\n logErr(\n `No ${S.dim(MANIFEST_FILENAME)} in the library — author it (see \\`skaile library create\\`) ` +\n \"and run `skaile validate` before publishing.\",\n );\n process.exit(1);\n }\n const { manifest, diagnostics } = decodeSkaileManifest(text);\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n if (errors.length > 0) {\n for (const d of errors) logErr(`${d.code}: ${d.message}`);\n logErr(\"The manifest has errors — fix them with `skaile validate` before publishing.\");\n process.exit(1);\n }\n return manifest;\n}\n\n/** Run a git command in `cwd` via the injected spawn; returns the result. */\nfunction runGit(spawn: SpawnLike, cwd: string, args: string[]) {\n return spawn(\"git\", [\"-C\", cwd, ...args], { encoding: \"utf-8\" });\n}\n\n/**\n * Refuse (exit 1) a `--ref` that is not a valid git ref name, or that names no branch, tag\n * or commit of the library repo (local, or fetched from `origin`). A library directory that\n * is not a git repo yet has nothing to check against and passes: `publish` creates the repo.\n *\n * The ref is sent to the store as a plain string and the store ingests the GitHub repo at that\n * name, so only what GitHub resolves by name is accepted: a branch, a tag or a commit id. A\n * revision expression (`HEAD~1`, `v1.0^{}`) resolves locally but not in the store, so it is\n * refused here rather than published under a ref the store cannot read.\n */\nfunction exitOnUnknownRef(libPath: string, libName: string, ref: string, spawn: SpawnLike): void {\n const wellFormed =\n !ref.startsWith(\"-\") &&\n spawn(\"git\", [\"check-ref-format\", \"--allow-onelevel\", ref], { encoding: \"utf-8\" }).status === 0;\n if (!wellFormed) {\n logErr(\n `--ref \"${ref}\" is not a valid git ref name; pass a branch or tag name or a commit id ` +\n \"(revision expressions like HEAD~1 are not accepted).\",\n );\n process.exit(1);\n }\n if (runGit(spawn, libPath, [\"rev-parse\", \"--git-dir\"]).status !== 0) return;\n const exists = [ref, `refs/remotes/origin/${ref}`].some(\n (candidate) =>\n runGit(spawn, libPath, [\"rev-parse\", \"--verify\", \"--quiet\", `${candidate}^{commit}`])\n .status === 0,\n );\n if (!exists) {\n logErr(\n `--ref \"${ref}\" is not a branch, tag or commit of library \"${libName}\"; ` +\n `fetch it first (\\`skaile library pull ${libName}\\`) if it only exists on the remote.`,\n );\n process.exit(1);\n }\n}\n\n/**\n * Ensure `libPath` is a git repo whose `origin` points at `remoteUrl`, then\n * commit any changes and push to `branch`. Idempotent re-publish: an unchanged\n * tree makes `git commit` fail with \"nothing to commit\" — swallowed. Push (or\n * any other git) failures surface as thrown Errors carrying git's stderr.\n */\nfunction commitAndPush(opts: {\n libPath: string;\n remoteUrl: string;\n branch: string;\n spawn: SpawnLike;\n}): void {\n const { libPath, remoteUrl, branch, spawn } = opts;\n\n const gitDir = runGit(spawn, libPath, [\"rev-parse\", \"--git-dir\"]);\n if (gitDir.status !== 0) {\n const init = runGit(spawn, libPath, [\"init\"]);\n if (init.status !== 0) {\n throw new Error(\n `git init failed: ${(init.stderr ?? \"\").toString().trim() || `exit ${init.status}`}`,\n );\n }\n }\n\n // Point origin at the resolved remote (add if absent, else set-url).\n const getUrl = runGit(spawn, libPath, [\"remote\", \"get-url\", \"origin\"]);\n const originArgs =\n getUrl.status === 0\n ? [\"remote\", \"set-url\", \"origin\", remoteUrl]\n : [\"remote\", \"add\", \"origin\", remoteUrl];\n const setOrigin = runGit(spawn, libPath, originArgs);\n if (setOrigin.status !== 0) {\n throw new Error(\n `git remote failed: ${(setOrigin.stderr ?? \"\").toString().trim() || `exit ${setOrigin.status}`}`,\n );\n }\n\n const add = runGit(spawn, libPath, [\"add\", \"-A\"]);\n if (add.status !== 0) {\n throw new Error(\n `git add failed: ${(add.stderr ?? \"\").toString().trim() || `exit ${add.status}`}`,\n );\n }\n\n // Fixed bot identity via -c so the commit succeeds regardless of the author's\n // git config (the publish commit is a machine action).\n const commit = spawn(\n \"git\",\n [\n \"-C\",\n libPath,\n \"-c\",\n \"user.email=publish@skaile.store\",\n \"-c\",\n \"user.name=skaile\",\n \"commit\",\n \"-m\",\n \"chore: publish\",\n ],\n { encoding: \"utf-8\" },\n );\n if (commit.status !== 0) {\n const out = `${commit.stdout ?? \"\"}${commit.stderr ?? \"\"}`;\n if (!/nothing to commit/i.test(out)) {\n throw new Error(`git commit failed: ${out.trim() || `exit ${commit.status}`}`);\n }\n }\n\n const push = runGit(spawn, libPath, [\"push\", \"origin\", `HEAD:${branch}`]);\n if (push.status !== 0) {\n throw new Error(\n `git push failed: ${(push.stderr ?? \"\").toString().trim() || `exit ${push.status}`}`,\n );\n }\n}\n\n/**\n * `true` when `url` is a GitHub repo remote the store can fetch: `https://github.com/<o>/<r>[.git]`,\n * `git@github.com:<o>/<r>[.git]` or `ssh://git@github.com/<o>/<r>[.git]`. The store is\n * pointer-only and fetches bytes from GitHub, so any other remote (a local path, a `file://`\n * url, another host) can be pushed to but never published.\n */\nexport function isGithubRemote(url: string): boolean {\n return /^(?:https:\\/\\/github\\.com\\/|git@github\\.com:|ssh:\\/\\/git@github\\.com\\/)[^/\\s]+\\/[^/\\s]+?(?:\\.git)?\\/?$/i.test(\n url.trim(),\n );\n}\n\n/** The advisory for a remote `library publish` cannot use (see {@link isGithubRemote}). */\nexport function notGithubRemoteMessage(name: string, url: string): string {\n return (\n `The remote of library \"${name}\" is not a GitHub url: ${url}. ` +\n \"The store fetches published assets from GitHub — repoint it with \" +\n `\\`skaile library set ${name} backendConfig.url=https://github.com/<owner>/<repo>\\`.`\n );\n}\n\n/** How many untracked paths the publish plan lists before collapsing to \"and N more\". */\nconst MAX_LISTED_UNTRACKED = 10;\n\n/** A first-party manifest asset resolved to its on-disk manifest file, read and parsed. */\ninterface PlanAsset {\n entry: AssetEntry;\n /** Path relative to the library root, for messages. */\n rel: string;\n parsed: ParseManifestResult;\n /** The shared per-asset checks ({@link checkAsset}); `undefined` when the file did not parse. */\n checked: AssetCheckResult | undefined;\n}\n\n/**\n * The first-party assets the plan covers (a `root:` entry or a `files:` list), each with its\n * manifest file read. Curated entries (`source`) carry no library directory and a root with no\n * manifest file is `missingRootAssets`' concern, so both are left out.\n */\nfunction planAssets(\n libPath: string,\n manifest: SkPublishManifest,\n targetName: string | undefined,\n composeRefs: ComposeRefContext,\n): PlanAsset[] {\n const out: PlanAsset[] = [];\n const registry = getKindRegistry();\n for (const entry of manifest.assets ?? []) {\n if (targetName && entry.name !== targetName) continue;\n if (entry.source || manifest.source) continue;\n const file = findEntryManifestFile(libPath, entry);\n if (!file) continue;\n const text = readFileSync(file, \"utf-8\");\n const parsed = parseManifestFile(file, text);\n let checked: AssetCheckResult | undefined;\n if (parsed.ok) {\n checked = checkAsset(\n entry.kind,\n parsed.data,\n readAssetBody(file, text),\n basename(dirname(file)),\n registry,\n text,\n basename(file),\n { dir: dirname(file), libraryRoot: libPath, composeRefs },\n );\n }\n out.push({ entry, rel: relative(libPath, file), parsed, checked });\n }\n return out;\n}\n\n/**\n * The manifest with every entry's `version` replaced by the one in its asset\n * file — the version a publish ships (the file is the source of truth; the\n * entry only mirrors it after `skaile library index`).\n */\nfunction manifestWithFileVersions(\n manifest: SkPublishManifest,\n assets: PlanAsset[],\n): SkPublishManifest {\n return {\n ...manifest,\n assets: manifest.assets?.map((entry) => {\n const planned = assets.find((a) => a.entry === entry);\n const fileVersion = planned?.parsed.ok ? declaredVersion(planned.parsed.data) : undefined;\n return fileVersion === undefined ? entry : { ...entry, version: fileVersion };\n }),\n };\n}\n\n/** A manifest entry whose version differs from the one in its asset file. */\ninterface VersionDrift {\n asset: PlanAsset;\n ref: string;\n /** The version the manifest records (`assets[].version ?? version`), `undefined` when none. */\n entryVersion: string | undefined;\n fileVersion: string;\n}\n\n/**\n * The planned assets whose manifest entry does not carry the version of their asset\n * file. The store reads the manifest it finds in the pushed repo, so a publish\n * records the entry's version — {@link manifestWithFileVersions} is what the plan\n * shows, and these are the entries a real publish has to rewrite to match it.\n */\nfunction versionDrift(assets: PlanAsset[], manifest: SkPublishManifest): VersionDrift[] {\n const out: VersionDrift[] = [];\n for (const asset of assets) {\n if (!asset.parsed.ok) continue;\n const fileVersion = declaredVersion(asset.parsed.data);\n const entryVersion = asset.entry.version ?? manifest.version;\n if (fileVersion !== undefined && fileVersion !== entryVersion) {\n out.push({ asset, ref: assetEntryRef(asset.entry, manifest), entryVersion, fileVersion });\n }\n }\n return out;\n}\n\nconst describeDrift = (d: VersionDrift): string =>\n `${d.ref}: manifest version ${d.entryVersion ?? \"(none)\"} → ${d.fileVersion} (${d.asset.rel.split(sep).join(\"/\")})`;\n\n/**\n * Reasons the plan cannot publish an asset: its manifest file cannot be parsed (an\n * empty `SKILL.md`), or it fails the errors of the shared per-asset check list\n * ({@link checkAsset}: version not semver, the kind's manifest schema — the skill\n * schema refuses the scaffold `TODO:` description — and the flow definition parser),\n * or its manifest entry carries a version that is not semver. These are the cases\n * `skaile validate` fails on and `skaile library index` keeps out of the manifest;\n * a hand-edited manifest can still list one, so the plan stops rather than ships it.\n */\nfunction assetRefusals(assets: PlanAsset[], manifest: SkPublishManifest): string[] {\n const refusals: string[] = [];\n for (const { entry, rel, parsed, checked } of assets) {\n const ref = assetEntryRef(entry, manifest);\n if (!parsed.ok || !checked) {\n const reason = parsed.ok ? \"the manifest file could not be read\" : parsed.reason;\n refusals.push(`${ref} (${rel}) [${entry.kind}] — ${manifestParseErrorText(reason)}`);\n continue;\n }\n for (const f of checked.errors) refusals.push(`${ref} (${rel}) [${f.tag}] — ${f.text}`);\n // An untouched scaffold body is an error in `validate` too: a publish would ship an empty asset.\n // (A `requires:` ref no registered library holds is judged against the store: see `storeHolderVerdicts`.)\n for (const f of checked.advisories.filter((a) => a.scaffoldBody)) {\n refusals.push(`${ref} (${rel}) [${f.tag}] — ${f.text}`);\n }\n // The asset file renamed in place: the entry is a ref `add` cannot resolve (p700).\n const fileName = entry.kind === \"flow\" ? parsed.data.id : parsed.data.name;\n if (typeof fileName === \"string\" && fileName !== \"\" && fileName !== entry.name) {\n refusals.push(\n `${ref} (${rel}) — the asset file now names \"${fileName}\": run \\`skaile library index\\` to rename the entry, or restore the name.`,\n );\n }\n // The file's own version is checked above; the entry's can differ from it.\n const entryInvalid = entry.version === undefined ? undefined : invalidSemverText(entry.version);\n if (entryInvalid && entry.version !== declaredVersion(parsed.data)) {\n refusals.push(`${ref} (${rel}) — ${entryInvalid}`);\n }\n }\n return refusals;\n}\n\n/**\n * Per-asset advisories for the assets the plan would publish — the advisories of the\n * shared check list `skaile validate` runs (agentskills.io conformance for skills, the\n * untouched `library create` scaffold for skill, agent, prompt, contract, flow and\n * preset), one line per asset/finding. An unparsable manifest is {@link assetRefusals}'\n * to report.\n */\nfunction assetWarnings(assets: PlanAsset[], manifest: SkPublishManifest): string[] {\n const warnings: string[] = [];\n for (const { entry, rel, parsed, checked } of assets) {\n if (!parsed.ok || !checked || Object.keys(parsed.data).length === 0) continue;\n for (const f of checked.advisories.filter((a) => !a.scaffoldBody && !a.unheldRef)) {\n warnings.push(`${assetEntryRef(entry, manifest)} (${rel}) [${f.tag}] — ${f.text}`);\n }\n }\n return warnings;\n}\n\n/** Asks the store whether it lists `ref` (`kind:@publisher/name`); rejects when it cannot be asked. */\ntype StoreHolds = (ref: string) => Promise<boolean>;\n\nasync function storeListsRef(ref: string): Promise<boolean> {\n const remote = await openCatalogSource({ projectDir: process.cwd() });\n return (await remote.resolve(ref)) !== null;\n}\n\ntype HolderAnswer = { listed: true } | { listed: false } | { error: string };\n\nasync function holdsAnswer(holds: StoreHolds, ref: string): Promise<HolderAnswer> {\n try {\n return { listed: await holds(ref) };\n } catch (err) {\n return { error: err instanceof Error ? err.message : String(err) };\n }\n}\n\n/**\n * What the publish plan says about every `requires:` (asset file) and `dependencies:` (manifest)\n * ref that no registered library holds (p1200). `validate` and `library index` warn from what is\n * registered on this machine alone; the plan also asks the store. A store that lists the ref\n * says nothing; one that does not refuses the plan, since `add` would fail on the consumer's\n * side; one that cannot be asked only warns.\n */\nasync function storeHolderVerdicts(\n assets: PlanAsset[],\n manifest: SkPublishManifest,\n dependencies: ManifestDependencyProblem[],\n holds: StoreHolds,\n): Promise<{ refusals: string[]; warnings: string[] }> {\n const wanted: Array<{ where: string; what: string; ref: string }> = [];\n for (const { entry, rel, checked } of assets) {\n for (const f of checked?.advisories ?? []) {\n if (!f.unheldRef) continue;\n wanted.push({\n where: `${assetEntryRef(entry, manifest)} (${rel}) [${f.tag}]`,\n what: \"requires\",\n ref: f.unheldRef,\n });\n }\n }\n for (const p of dependencies) {\n if (!p.unheldRef) continue;\n wanted.push({\n where: `${MANIFEST_FILENAME} [assets] — ${p.asset}`,\n what: \"dependency\",\n ref: p.unheldRef,\n });\n }\n const answers = new Map<string, HolderAnswer>();\n const out = { refusals: [] as string[], warnings: [] as string[] };\n for (const { where, what, ref } of wanted) {\n let answer = answers.get(ref);\n if (answer === undefined) {\n answer = await holdsAnswer(holds, ref);\n answers.set(ref, answer);\n }\n if (\"listed\" in answer && answer.listed) continue;\n const base = `${where} — ${what} \"${ref}\" is not held by any registered library`;\n if (\"error\" in answer) {\n out.warnings.push(\n `${base} and the store could not be asked (${answer.error.split(\"\\n\")[0]}). \\`skaile add\\` fails for a consumer unless the store or a registered library holds it`,\n );\n } else {\n out.refusals.push(\n `${base} and the store does not list it, so \\`skaile add\\` would fail with \"${what} … not found\". Publish that asset first, register the library that holds it, or drop the ${what}.`,\n );\n }\n }\n return out;\n}\n\n/**\n * Advisory publish-plan warnings: a missing LICENSE (a public repo without one grants\n * consumers no rights), per-asset skill warnings ({@link assetWarnings}) and — for `publish`,\n * which runs `git add -A` — untracked files that would become public. Never throws; a\n * non-git directory simply yields no untracked warning.\n */\nfunction publishWarnings(\n libPath: string,\n spawn: SpawnLike,\n skipPush: boolean,\n manifest: SkPublishManifest,\n assets: PlanAsset[],\n): string[] {\n const warnings: string[] = [];\n if (!existsSync(join(libPath, \"LICENSE\")) && !existsSync(join(libPath, \"LICENSE.md\"))) {\n warnings.push(\n \"No LICENSE or LICENSE.md in the library root — a public repo without a license grants consumers no rights to use it.\",\n );\n }\n warnings.push(...assetWarnings(assets, manifest));\n if (!skipPush) {\n const status = runGit(spawn, libPath, [\"status\", \"--porcelain\", \"--untracked-files=all\"]);\n if (status.status === 0) {\n const lines = (status.stdout ?? \"\").toString().split(\"\\n\");\n const untracked = lines.filter((l) => l.startsWith(\"?? \")).map((l) => l.slice(3));\n if (untracked.length > 0) {\n const shown = untracked.slice(0, MAX_LISTED_UNTRACKED).join(\", \");\n const more =\n untracked.length > MAX_LISTED_UNTRACKED\n ? ` and ${untracked.length - MAX_LISTED_UNTRACKED} more`\n : \"\";\n warnings.push(\n `${untracked.length} untracked file(s) will be committed by \\`git add -A\\` and published: ${shown}${more}.`,\n );\n }\n // `git add -A` also stages every change of a tracked file: name them too.\n const changed = lines\n .filter((l) => l.length > 3 && !l.startsWith(\"?? \") && !l.startsWith(\"!! \"))\n .map((l) => {\n const code = l.slice(0, 2);\n const label = code.includes(\"D\")\n ? \"deleted\"\n : code.includes(\"R\")\n ? \"renamed\"\n : code.includes(\"A\")\n ? \"added\"\n : \"modified\";\n return `${label} ${l.slice(3)}`;\n });\n if (changed.length > 0) {\n const shown = changed.slice(0, MAX_LISTED_UNTRACKED).join(\", \");\n const more =\n changed.length > MAX_LISTED_UNTRACKED\n ? ` and ${changed.length - MAX_LISTED_UNTRACKED} more`\n : \"\";\n warnings.push(\n `${changed.length} changed tracked file(s) will be committed by \\`git add -A\\` and published: ${shown}${more}.`,\n );\n }\n // A secret the commit would publish: a `.env`, a private key (p704).\n const secrets = lines\n .filter((l) => l.length > 3 && !l.startsWith(\"!! \") && !l.slice(0, 2).includes(\"D\"))\n .map((l) => l.slice(3).split(\" -> \").pop() ?? \"\")\n .filter((file) => isSecretFileName(basename(file.replace(/^\"|\"$/g, \"\"))));\n if (secrets.length > 0) {\n warnings.push(\n `${secrets.length} file(s) look like secrets and will be committed by \\`git add -A\\` and published: ${secrets.join(\", \")}. Delete them or add them to .gitignore.`,\n );\n }\n }\n }\n return warnings;\n}\n\n/**\n * The store only registers PUBLIC repos (the backend rejects a private one with \"must be\n * public\"), so a repo provisioned with `--private` can be created and linked but not published.\n */\nconst PRIVATE_REPO_WARNING =\n \"--private: the store only accepts PUBLIC repos — registering a private repo is rejected. \" +\n \"The repo will be created private, but publishing it will fail; share it directly \" +\n \"(`skaile source add <url>` with the consumer's own git credentials) instead.\";\n\n/**\n * Provision a GitHub repo `github.com/<you>/<name>` via `gh` (public unless `isPrivate`) and\n * return its https url. Parses the url `gh` prints on success. Throws on failure.\n */\nfunction createRepoViaGh(name: string, spawn: SpawnLike, isPrivate: boolean): string {\n const res = spawn(\"gh\", [\"repo\", \"create\", name, isPrivate ? \"--private\" : \"--public\"], {\n encoding: \"utf-8\",\n });\n if (res.status !== 0) {\n const stderr = (res.stderr ?? \"\").toString().trim();\n throw new Error(`gh repo create ${name} failed: ${stderr || `exit ${res.status}`}`);\n }\n // `gh repo create` prints the repo url (e.g. `https://github.com/<owner>/<name>`);\n // scan combined output for the first github.com url so we capture whatever\n // owner gh resolved (the authed user).\n const out = `${res.stdout ?? \"\"}\\n${res.stderr ?? \"\"}`;\n const match = out.match(/https:\\/\\/github\\.com\\/[^\\s]+/);\n if (!match) {\n throw new Error(`gh repo create ${name} succeeded but printed no repo url:\\n${out.trim()}`);\n }\n return match[0].replace(/\\.git$/, \"\").trim();\n}\n\n/** `--asset <ref>` split into its parts: `[kind:][@publisher/]name[#pin]`. */\ninterface AssetSelection {\n kind?: string;\n publisher?: string;\n name: string;\n pin?: string;\n}\n\nfunction parseAssetSelection(ref: string): AssetSelection {\n const [head, ...pinParts] = ref.trim().split(\"#\");\n const pin = pinParts.join(\"#\") || undefined;\n const colon = head.indexOf(\":\");\n const kind = colon > 0 ? head.slice(0, colon) : undefined;\n const rest = colon > 0 ? head.slice(colon + 1) : head;\n const scoped = rest.startsWith(\"@\") ? rest.indexOf(\"/\") : -1;\n const publisher = scoped > 0 ? rest.slice(1, scoped) : undefined;\n const name = scoped > 0 ? rest.slice(scoped + 1) : rest;\n return { kind, publisher, name, pin };\n}\n\n/** The manifest entries `--asset` selects: same name, and kind / publisher when the ref names them. */\nfunction selectedEntries(manifest: SkPublishManifest, sel: AssetSelection): AssetEntry[] {\n return (manifest.assets ?? []).filter(\n (a) =>\n a.name === sel.name &&\n (!sel.kind || a.kind === sel.kind) &&\n (!sel.publisher || assetNamespace(a, manifest) === sel.publisher),\n );\n}\n\n/**\n * What the plan says about asset directories the manifest does not list - the ones\n * `skaile library index` would add or skip. A directory holding a kind + name the manifest\n * already names elsewhere is refused (index skips it and exits 1); a new asset the shared\n * checks reject is refused with the same finding text `validate` prints; a valid new asset is\n * refused as well, as `validate` does: the plan would not ship it, but `git add -A` would commit\n * its files (p1193).\n */\nasync function unlistedAssetProblems(\n libPath: string,\n manifest: SkPublishManifest,\n libName: string,\n targetName: string | undefined,\n composeRefs: ComposeRefContext,\n): Promise<string[]> {\n const refusals: string[] = [];\n const registry = getKindRegistry();\n const unlisted = await scanUnlistedAssets(\n libPath,\n manifest.publisher ?? libName,\n registry,\n UNLISTED_SCAN_SKIP_DIRS,\n );\n for (const u of unlisted) {\n if (targetName && u.entry.name !== targetName) continue;\n const rel = relative(libPath, u.entry.source);\n if (u.registeredAt) {\n refusals.push(\n duplicateAssetMessage(\n u.entry.kind,\n u.entry.name,\n u.root,\n `already registered at \"${u.registeredAt}\"`,\n libName,\n ),\n );\n continue;\n }\n if (u.parseFailure) {\n // `library index` rejects the file too: send the author to the file, not to the command.\n refusals.push(\n `${u.entry.kind}:${u.entry.name} (${rel}) [${u.entry.kind}] — ${manifestParseErrorText(u.parseFailure)}`,\n );\n continue;\n }\n const errors = checkAssetFile(u.entry.source, u.entry.kind, registry, libPath, composeRefs);\n for (const f of errors)\n refusals.push(`${u.entry.kind}:${u.entry.name} (${rel}) [${f.tag}] — ${f.text}`);\n if (errors.length === 0) {\n refusals.push(\n `${u.entry.kind}:${u.entry.name} (${rel}) is on disk but not in the manifest, so it is not published; run \\`skaile library index ${libName}\\`.`,\n );\n }\n }\n return refusals;\n}\n\n/** Shared publish body for `publish` (pushes) and `register` (skips the push). */\nasync function publishLibrary(\n name: string,\n opts: {\n asset?: string;\n createRepo?: boolean;\n private?: boolean;\n ref?: string;\n dryRun?: boolean;\n skipPush: boolean;\n /** Asks the store whether it lists a ref; injected by tests. */\n storeHolds?: StoreHolds;\n },\n client?: PublisherClient,\n spawn: SpawnLike = spawnSync,\n): Promise<void> {\n exitOnEmptyAsset(opts.asset);\n const injected = client !== undefined;\n const { manager, close } = await openLibraryManager();\n try {\n const lib = await manager.requireLibraryDir(name);\n const manifest = loadManifest(lib.path);\n\n // A publisher that is not a valid slug would publish refs `add` cannot parse: refuse\n // (dry-run included) with the text `library index` and `validate` print.\n exitOnManifestPublisherProblems(lib.path, name);\n // The same symlink refusal as `validate` and `library index`.\n exitOnLibrarySymlinks(lib.path, `skaile library publish ${name}`);\n // A `root:` or `files:` entry outside the library, through a symlink or naming a missing file is never found by `add` (p701, p1403, p1404).\n exitOnManifestPathProblems(lib.path, `skaile library publish ${name}`);\n\n // A manifest entry whose directory is gone would publish a catalog entry\n // that points at nothing — refuse (dry-run included) rather than plan it.\n const missing = missingRootAssets(lib.path, manifest);\n if (missing.length > 0) {\n for (const a of missing) {\n logErr(`${assetEntryRef(a, manifest)} — root \"${a.root}\" does not exist in the library.`);\n }\n logErr(\n \"The manifest lists assets that are no longer on disk. Run \" +\n `\\`skaile library index ${name}\\` to drop them from the manifest, then re-run.`,\n );\n process.exit(1);\n }\n\n // `--asset` must select something: a plan of 0 assets that exits 0 reads as a publish.\n const selection = opts.asset ? parseAssetSelection(opts.asset) : undefined;\n if (opts.asset && selection && selectedEntries(manifest, selection).length === 0) {\n const listed = (manifest.assets ?? []).map((a) => assetEntryRef(a, manifest));\n logErr(\n `No asset matches \"${opts.asset}\" in library \"${name}\"` +\n (listed.length > 0\n ? ` (the manifest lists: ${listed.join(\", \")}).`\n : \" (the manifest lists no assets).\"),\n );\n process.exit(1);\n }\n\n // `--ref` must name a ref the library repo has: a plan for `source ref: nosuchref` reads as a\n // publish of it.\n if (opts.ref !== undefined) exitOnUnknownRef(lib.path, name, opts.ref, spawn);\n\n // Resolve the remote: git-backed → its url; local + --create-repo → provision\n // and link; else stop with a hint.\n let remoteUrl = remoteUrlOf(lib);\n let wouldCreateRepo = false;\n if (opts.private && !opts.createRepo) {\n logErr(\n \"--private only applies together with --create-repo (it sets the new repo's visibility).\",\n );\n process.exit(1);\n }\n const visibility = opts.private ? \"private\" : \"public\";\n if (!remoteUrl) {\n if (opts.createRepo) {\n if (opts.private) logWarn(PRIVATE_REPO_WARNING);\n if (opts.dryRun) {\n // A dry-run must not provision anything — defer the real\n // `gh repo create` to the live run and just show the would-be remote.\n wouldCreateRepo = true;\n remoteUrl = `https://github.com/<your-account>/${lib.name}`;\n } else {\n remoteUrl = createRepoViaGh(lib.name, spawn, opts.private === true);\n await manager.updateLibrary(name, {\n backend: \"git\",\n backendConfig: { url: remoteUrl, branch: \"main\", authHint: \"ssh\" },\n });\n logOk(`Created + linked ${S.dim(remoteUrl)} (${visibility}).`);\n }\n } else {\n logErr(\n `Library \"${name}\" has no remote — run ${S.cmd(`skaile library link ${name} <url>`)} ` +\n \"first, or pass `--create-repo` to provision a public repo.\",\n );\n process.exit(1);\n }\n } else if (!isGithubRemote(remoteUrl)) {\n // Plan-phase gate (dry-run and real): the store fetches from GitHub, so a\n // local-path / other-host remote can never be published. A remote here means\n // the library is already git-backed, where `library link` refuses.\n logErr(notGithubRemoteMessage(name, remoteUrl));\n process.exit(1);\n }\n\n // Each asset publishes under `assets[].publisher ?? manifest.publisher`\n // (first-party — no remap), so one library can span several namespaces.\n const targetName = opts.asset ? bareName(opts.asset) : undefined;\n const namespaces = manifestNamespaces(manifest, targetName);\n\n // An asset whose manifest file cannot be parsed or carries a non-semver version\n // must not be planned (dry-run included): it would publish as a broken entry.\n // An agent's `composes:` refs resolve as in `validate` and `library index` (p415).\n const composeRefs = composeRefContext(\n scanIdentities(lib.path),\n await registeredAssetKeys(lib.path),\n manifest.publisher,\n );\n const assets = planAssets(lib.path, manifest, targetName, composeRefs);\n const wouldBeRefs = plannedRefs(manifestWithFileVersions(manifest, assets), targetName);\n const unlisted = await unlistedAssetProblems(lib.path, manifest, name, targetName, composeRefs);\n // A manifest `dependencies:` entry `validate` and `index` reject would ship as an unresolvable ref.\n const requiresRefusals = manifestRequiresProblems(lib.path)\n .filter((p) => !targetName || p.asset.endsWith(`:${targetName}`))\n .map(\n (p) =>\n `${MANIFEST_FILENAME} [assets] — ${p.asset}: ${p.message}. ` +\n \"Use the `kind:@<publisher>/name[#version]` form.\",\n );\n // A `requires:` / `dependencies:` ref no registered library holds: the store has the last word.\n const unheldDependencies = (await manifestDependencyProblems(lib.path)).filter(\n (p) => p.unheldRef && (!targetName || p.asset.endsWith(`:${targetName}`)),\n );\n const storeVerdicts = await storeHolderVerdicts(\n assets,\n manifest,\n unheldDependencies,\n opts.storeHolds ?? storeListsRef,\n );\n const refusals = [\n ...assetRefusals(assets, manifest),\n ...requiresRefusals,\n ...unlisted,\n ...storeVerdicts.refusals,\n ];\n if (selection?.pin !== undefined) {\n const held = selectedEntries(manifest, selection).map((e) => {\n const planned = assets.find((a) => a.entry === e);\n const fileVersion = planned?.parsed.ok ? declaredVersion(planned.parsed.data) : undefined;\n return fileVersion ?? e.version ?? manifest.version;\n });\n if (!held.some((v) => v !== undefined && matchPin(selection.pin, v))) {\n logErr(\n `${opts.asset}: the library holds ${held.filter((v) => v).join(\", \") || \"no version\"} of this asset, not #${selection.pin}. ` +\n \"A publish ships the version in the asset file; drop the pin or change the file version.\",\n );\n process.exit(1);\n }\n }\n if (refusals.length > 0) {\n for (const r of refusals) logErr(r);\n logErr(\n \"These assets cannot be published. Fix them (see `skaile validate`), then run \" +\n `\\`skaile library index ${name}\\` and re-run.`,\n );\n process.exit(1);\n }\n\n // The store records the version of the manifest it finds in the pushed repo, so\n // the plan (file versions) and the publish only agree when the entries match the\n // files. `publish` rewrites them before it commits; `register` pushes nothing,\n // so it cannot, and stops instead.\n const drift = versionDrift(assets, manifest);\n if (drift.length > 0 && opts.skipPush) {\n for (const d of drift) logErr(describeDrift(d));\n logErr(\n \"register publishes the remote HEAD as-is, so these manifest versions would be recorded \" +\n `instead of the file versions. Run \\`skaile library index ${name}\\`, commit and push, then re-run.`,\n );\n process.exit(1);\n }\n\n const sourceRef = opts.ref ?? branchOf(lib);\n const warnings = [\n ...publishWarnings(lib.path, spawn, opts.skipPush, manifest, assets),\n ...storeVerdicts.warnings,\n ];\n\n if (opts.dryRun) {\n logInfo(`Publish plan for ${S.bold(name)}:`);\n logInfo(\n ` remote: ${remoteUrl}${wouldCreateRepo ? ` (would be created ${visibility} via \\`gh repo create --${visibility}\\`)` : \"\"}`,\n );\n logInfo(\n ` publisher: ${namespaces.length > 0 ? namespaces.join(\", \") : \"<manifest publisher>\"}`,\n );\n // Best-effort namespace-availability probe — a read-only GET, only when\n // signed in (or a client is injected). A failure keeps dry-run offline-safe.\n const canCheck = injected || isStoreAuthenticated();\n if (!canCheck) {\n // The real run stops at \"Not signed in\" before any namespace check.\n logWarn(\"namespace check skipped: not signed in (run `skaile store login`)\");\n } else if (namespaces.length > 0) {\n for (const ns of namespaces) {\n try {\n const avail = await (client ?? makeHttpPublisherClient()).namespaceAvailability(ns);\n const prefix = namespaces.length > 1 ? `@${ns} — ` : \"\";\n logInfo(` namespace: ${prefix}${formatNamespaceAvailability(avail)}`);\n } catch {\n // Store unreachable / not signed in — skip the advisory, never fail.\n }\n }\n }\n logInfo(` source ref: ${sourceRef}`);\n logInfo(` would publish ${wouldBeRefs.length} asset(s):`);\n for (const r of wouldBeRefs) logInfo(` ${r}`);\n for (const d of drift) logInfo(` would update the manifest: ${describeDrift(d)}`);\n for (const w of warnings) logWarn(w);\n return;\n }\n\n // Real run: surface the same advisories before anything is pushed.\n for (const w of warnings) logWarn(w);\n\n // A real publish makes store calls, so it needs a token (injected fakes bypass).\n if (!injected && !isStoreAuthenticated()) {\n logErr(\"Not signed in — run `skaile store login` first.\");\n process.exit(1);\n }\n\n const pub = client ?? makeHttpPublisherClient();\n\n // Preflight EVERY distinct namespace BEFORE the public git push, so a\n // reserved/unclaimed one fails fast with guidance instead of after publishing bytes.\n for (const ns of namespaces) {\n const gate = await preflightNamespace(pub, ns);\n if (!gate.ok) {\n logErr(gate.message ?? `Cannot publish under @${ns}.`);\n process.exit(1);\n }\n }\n\n // Bring the entries to the file versions the plan showed, before they are committed.\n for (const d of drift) {\n upsertManifestAsset(lib.path, {\n kind: d.asset.entry.kind,\n name: d.asset.entry.name,\n root: d.asset.entry.root ?? \"\",\n version: d.fileVersion,\n });\n logInfo(`Updated the manifest: ${describeDrift(d)}`);\n }\n\n // publish commits + pushes the library repo; register takes the remote HEAD as-is.\n if (!opts.skipPush) {\n // `git add -A` stages every non-ignored file → a PUBLIC push. Surface it so\n // an unexpected file in the working tree is not silently published.\n logInfo(\n `Committing the library and pushing to the PUBLIC remote ${S.dim(remoteUrl)} ` +\n \"(.gitignore honored; anything else in the working tree becomes public).\",\n );\n commitAndPush({ libPath: lib.path, remoteUrl, branch: branchOf(lib), spawn });\n logOk(`Pushed ${S.dim(name)} to ${S.dim(remoteUrl)}.`);\n }\n\n const { published } = await publishToStore({\n sourceUrl: remoteUrl,\n ref: sourceRef,\n manifest: manifestWithFileVersions(manifest, assets),\n assetName: targetName,\n client: pub,\n });\n\n if (published.length > 0) {\n logInfo(`Consumers can now \\`skaile add ${published[0]}\\`.`);\n }\n } finally {\n close();\n }\n}\n\n/**\n * `skaile library publish <lib>` — commit + push the library repo, register +\n * sync it as a store source, and publish its manifest's assets under the\n * manifest publisher. See the module header for the full flow.\n */\nexport async function runLibraryPublish(\n name: string,\n opts: {\n asset?: string;\n createRepo?: boolean;\n private?: boolean;\n ref?: string;\n dryRun?: boolean;\n storeHolds?: StoreHolds;\n },\n client?: PublisherClient,\n spawn: SpawnLike = spawnSync,\n): Promise<void> {\n await publishLibrary(name, { ...opts, skipPush: false }, client, spawn);\n}\n\n/**\n * `skaile library register <lib>` — same as publish but skips the commit/push\n * (the bytes are already on GitHub at the current remote HEAD). Still requires a\n * git-backed remote.\n */\nexport async function runLibraryRegister(\n name: string,\n opts: { asset?: string; ref?: string; dryRun?: boolean },\n client?: PublisherClient,\n spawn: SpawnLike = spawnSync,\n): Promise<void> {\n await publishLibrary(name, { ...opts, skipPush: true }, client, spawn);\n}\n\n/**\n * `skaile library yank <lib>` — unpublish the library's published assets from\n * the store (all, or the single asset matching `opts.asset`'s name).\n * Auth-gated like publish.\n */\nexport async function runLibraryYank(\n name: string,\n opts: { asset?: string },\n client?: PublisherClient,\n): Promise<void> {\n exitOnEmptyAsset(opts.asset);\n const injected = client !== undefined;\n const { manager, close } = await openLibraryManager();\n try {\n const lib = await manager.requireLibrary(name);\n const remoteUrl = remoteUrlOf(lib);\n if (!remoteUrl) {\n logErr(`Library \"${name}\" has no remote — nothing published to yank.`);\n process.exit(1);\n }\n\n if (!injected && !isStoreAuthenticated()) {\n logErr(\"Not signed in — run `skaile store login` first.\");\n process.exit(1);\n }\n\n const pub = client ?? makeHttpPublisherClient();\n const rows = await pub.sourcesList();\n const source = rows.find((r) => r.url === remoteUrl);\n if (!source) {\n logErr(`Library \"${name}\" is not registered in the store — nothing to yank.`);\n process.exit(1);\n }\n\n const targetName = opts.asset ? bareName(opts.asset) : undefined;\n const candidates = (await pub.sourceCandidates(source.id)).filter(\n (c) => c.published && (!targetName || c.name === targetName),\n );\n if (candidates.length === 0) {\n logInfo(\"No published assets matched — nothing to yank.\");\n return;\n }\n\n // Report each yanked asset under its own namespace\n // (`assets[].publisher ?? manifest.publisher`); fall back to `kind:name`\n // when the manifest is absent or declares no namespace for it.\n const manifest = loadSkPublishManifest(lib.path);\n const yanked: string[] = [];\n for (const c of candidates) {\n try {\n await pub.assetUnpublish(c.id);\n const entry = manifest?.assets?.find((a) => a.kind === c.kind && a.name === c.name);\n const ns = manifest && entry ? assetNamespace(entry, manifest) : undefined;\n yanked.push(ns ? refFor(c.kind, ns, c.name, c.version) : `${c.kind}:${c.name}`);\n } catch (err) {\n logErr(\n `Failed to yank ${c.kind}:${c.name}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n logOk(`Yanked ${yanked.length} asset(s):`);\n for (const r of yanked) logInfo(` ${r}`);\n } finally {\n close();\n }\n}\n"]}
@@ -1,57 +0,0 @@
1
- export { LocalCatalogDisabledError, openCatalogSource, openLibrary, openLibraryManager, resolveCatalogSource } from './chunk-YRC2EFOU.js';
2
- import './chunk-WFLQMAR5.js';
3
- import './chunk-Z2X7UZEZ.js';
4
- import './chunk-B436SG5P.js';
5
- import './chunk-S7DVT2BV.js';
6
- import './chunk-EN5REMWV.js';
7
- import './chunk-OLHHN3NO.js';
8
- import './chunk-LOO5CB5M.js';
9
- import './chunk-KSUT5KAE.js';
10
- import './chunk-ZUU2PLA3.js';
11
- import './chunk-5DE3DGVR.js';
12
- import './chunk-7DN6JKP2.js';
13
- import './chunk-E6UWI3TP.js';
14
- import './chunk-EO7KGX6P.js';
15
- import './chunk-SZTHSPRC.js';
16
- import './chunk-NSIOBKDX.js';
17
- import './chunk-G5SUWZEU.js';
18
- import './chunk-X44XKBZX.js';
19
- import './chunk-7RGTAEG6.js';
20
- import './chunk-G5SYFFMD.js';
21
- import './chunk-IS3NIZBX.js';
22
- import './chunk-TGUMN5G7.js';
23
- import './chunk-22ZX33H6.js';
24
- import './chunk-U6KRTCNA.js';
25
- import './chunk-F3D25RGM.js';
26
- import './chunk-3TXEJN4W.js';
27
- import './chunk-ISHJITXJ.js';
28
- import './chunk-LNFKL23K.js';
29
- import './chunk-JRN5QF4C.js';
30
- import './chunk-NUELZWCF.js';
31
- import './chunk-2HS357RA.js';
32
- import './chunk-PKE3PXOK.js';
33
- import './chunk-KTBKW2FI.js';
34
- import './chunk-UQ6LFBPZ.js';
35
- import './chunk-T7HGEMNB.js';
36
- import './chunk-VT6G5AJV.js';
37
- import './chunk-UMLCKKIA.js';
38
- import './chunk-4GY63JU6.js';
39
- import './chunk-G4NCSYWR.js';
40
- import './chunk-5KRMNUL4.js';
41
- import './chunk-C5HFK34M.js';
42
- import './chunk-MWXYN6NY.js';
43
- import './chunk-IWKKTCXY.js';
44
- import './chunk-L5VSIPQD.js';
45
- import './chunk-VTETQCR6.js';
46
- import './chunk-23SG4JRV.js';
47
- import './chunk-AVFRFGM2.js';
48
- import './chunk-RVRB27AN.js';
49
- import './chunk-V5KG6CCV.js';
50
- import './chunk-VSX2G7LA.js';
51
- import './chunk-RXGPFAMN.js';
52
- import './chunk-DKXNKFKP.js';
53
- import './chunk-C3CAXQMA.js';
54
- import './chunk-BOFL7GIF.js';
55
- import './chunk-NSBPE2FW.js';
56
- //# sourceMappingURL=open-library-BVQCB37E.js.map
57
- //# sourceMappingURL=open-library-BVQCB37E.js.map