@skaile/workspaces 6.8.0 → 6.9.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 (335) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/ai-sdk.js +5 -5
  3. package/dist/{asset-feeds-NU5UOO5F.js → asset-feeds-JWRIWLVX.js} +19 -19
  4. package/dist/{asset-feeds-NU5UOO5F.js.map → asset-feeds-JWRIWLVX.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +4 -4
  6. package/dist/asset-manager/history.js +19 -1
  7. package/dist/asset-manager/index.js +11 -11
  8. package/dist/asset-manager/installer.js +7 -7
  9. package/dist/asset-manager/renderers.js +6 -6
  10. package/dist/asset-manager/src/history.d.ts.map +1 -1
  11. package/dist/asset-manager/src/index.d.ts +65 -3
  12. package/dist/asset-manager/src/index.d.ts.map +1 -1
  13. package/dist/bridge/harnesses/claude-sdk.js +9 -9
  14. package/dist/bridge/harnesses/codex.js +29 -12
  15. package/dist/bridge/harnesses/codex.js.map +1 -1
  16. package/dist/bridge/harnesses/continue.js +8 -8
  17. package/dist/bridge/harnesses/echo.js +3 -3
  18. package/dist/bridge/harnesses/gemini.js +8 -8
  19. package/dist/bridge/harnesses/goose.js +8 -8
  20. package/dist/bridge/harnesses/omp.js +156 -24
  21. package/dist/bridge/harnesses/omp.js.map +1 -1
  22. package/dist/bridge/harnesses/opencode.js +8 -8
  23. package/dist/bridge/harnesses/qwen.js +8 -8
  24. package/dist/bridge/index.js +14 -14
  25. package/dist/bridge/src/codex/friendly-error.d.ts +7 -1
  26. package/dist/bridge/src/codex/friendly-error.d.ts.map +1 -1
  27. package/dist/bridge/src/codex/login-fallback.d.ts +5 -0
  28. package/dist/bridge/src/codex/login-fallback.d.ts.map +1 -1
  29. package/dist/bridge/src/harnesses/codex.d.ts +2 -0
  30. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  31. package/dist/bridge/src/harnesses/omp.d.ts +17 -0
  32. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  33. package/dist/{chunk-757G6TTZ.js → chunk-23Q5LT4U.js} +331 -59
  34. package/dist/chunk-23Q5LT4U.js.map +1 -0
  35. package/dist/{chunk-SBNUXJ6E.js → chunk-3AIEJSQR.js} +3 -3
  36. package/dist/{chunk-SBNUXJ6E.js.map → chunk-3AIEJSQR.js.map} +1 -1
  37. package/dist/{chunk-KHWGUXSF.js → chunk-3EPRTMXY.js} +5 -5
  38. package/dist/{chunk-KHWGUXSF.js.map → chunk-3EPRTMXY.js.map} +1 -1
  39. package/dist/{chunk-TMJBEGS4.js → chunk-4KPQ6ILH.js} +5 -34
  40. package/dist/chunk-4KPQ6ILH.js.map +1 -0
  41. package/dist/{chunk-G7NMF5WQ.js → chunk-4ROXSQEG.js} +3 -3
  42. package/dist/{chunk-G7NMF5WQ.js.map → chunk-4ROXSQEG.js.map} +1 -1
  43. package/dist/{chunk-I6XH46Q6.js → chunk-4WB4KSSQ.js} +3 -3
  44. package/dist/{chunk-I6XH46Q6.js.map → chunk-4WB4KSSQ.js.map} +1 -1
  45. package/dist/{chunk-NW7Y5SNK.js → chunk-5AQLCRR7.js} +4 -4
  46. package/dist/{chunk-NW7Y5SNK.js.map → chunk-5AQLCRR7.js.map} +1 -1
  47. package/dist/{chunk-WFK4MUBL.js → chunk-5J6JWGY4.js} +3 -3
  48. package/dist/{chunk-WFK4MUBL.js.map → chunk-5J6JWGY4.js.map} +1 -1
  49. package/dist/{chunk-O5Y7VMVQ.js → chunk-5KWQMCH7.js} +3 -3
  50. package/dist/{chunk-O5Y7VMVQ.js.map → chunk-5KWQMCH7.js.map} +1 -1
  51. package/dist/{chunk-YHNPWSSH.js → chunk-5NTB64PW.js} +45 -13
  52. package/dist/chunk-5NTB64PW.js.map +1 -0
  53. package/dist/{chunk-QGA2OBUJ.js → chunk-72BDCGBB.js} +3 -3
  54. package/dist/{chunk-QGA2OBUJ.js.map → chunk-72BDCGBB.js.map} +1 -1
  55. package/dist/{chunk-KTBKW2FI.js → chunk-7QYBKUAS.js} +4 -3
  56. package/dist/chunk-7QYBKUAS.js.map +1 -0
  57. package/dist/{chunk-E3KABQS3.js → chunk-AERQFD6T.js} +4 -4
  58. package/dist/{chunk-E3KABQS3.js.map → chunk-AERQFD6T.js.map} +1 -1
  59. package/dist/{chunk-XIIIGLSL.js → chunk-AVRTZAH2.js} +9 -9
  60. package/dist/{chunk-XIIIGLSL.js.map → chunk-AVRTZAH2.js.map} +1 -1
  61. package/dist/{chunk-2I5HNM7K.js → chunk-B2DGCYVC.js} +18 -18
  62. package/dist/chunk-B2DGCYVC.js.map +1 -0
  63. package/dist/{chunk-3QX2X77G.js → chunk-C7L5MFUL.js} +3 -3
  64. package/dist/{chunk-3QX2X77G.js.map → chunk-C7L5MFUL.js.map} +1 -1
  65. package/dist/{chunk-ORXV3UB6.js → chunk-CFTTXUM2.js} +3 -3
  66. package/dist/{chunk-ORXV3UB6.js.map → chunk-CFTTXUM2.js.map} +1 -1
  67. package/dist/{chunk-DRHJRTAS.js → chunk-DZRN3SNG.js} +5 -5
  68. package/dist/{chunk-DRHJRTAS.js.map → chunk-DZRN3SNG.js.map} +1 -1
  69. package/dist/{chunk-QCR5AE5E.js → chunk-E675QKFG.js} +5 -5
  70. package/dist/{chunk-QCR5AE5E.js.map → chunk-E675QKFG.js.map} +1 -1
  71. package/dist/{chunk-O7ADRMCR.js → chunk-FZO64PLQ.js} +45 -16
  72. package/dist/chunk-FZO64PLQ.js.map +1 -0
  73. package/dist/{chunk-Y6LC5PEZ.js → chunk-GYBDWW6K.js} +14 -5
  74. package/dist/chunk-GYBDWW6K.js.map +1 -0
  75. package/dist/{chunk-CMXDFTA2.js → chunk-GYPPVANR.js} +3 -3
  76. package/dist/{chunk-CMXDFTA2.js.map → chunk-GYPPVANR.js.map} +1 -1
  77. package/dist/{chunk-G44FFUMA.js → chunk-GZL6RN4Z.js} +92 -14
  78. package/dist/chunk-GZL6RN4Z.js.map +1 -0
  79. package/dist/{chunk-DFP476EU.js → chunk-JY2JXCL6.js} +89 -4
  80. package/dist/chunk-JY2JXCL6.js.map +1 -0
  81. package/dist/{chunk-ZBA4P5TD.js → chunk-LMADWO4Q.js} +9 -6
  82. package/dist/chunk-LMADWO4Q.js.map +1 -0
  83. package/dist/{chunk-3HSLJAMJ.js → chunk-LYVLDGML.js} +3 -3
  84. package/dist/{chunk-3HSLJAMJ.js.map → chunk-LYVLDGML.js.map} +1 -1
  85. package/dist/{chunk-YZD7DUEF.js → chunk-M4G2SVXI.js} +3 -3
  86. package/dist/{chunk-YZD7DUEF.js.map → chunk-M4G2SVXI.js.map} +1 -1
  87. package/dist/{chunk-SGI5MRKP.js → chunk-MDCI4RSG.js} +40 -5
  88. package/dist/chunk-MDCI4RSG.js.map +1 -0
  89. package/dist/{chunk-LJ6PLEDU.js → chunk-MPRWVZXF.js} +316 -51
  90. package/dist/chunk-MPRWVZXF.js.map +1 -0
  91. package/dist/{chunk-KO3VSZQP.js → chunk-NDBHEOIA.js} +6 -6
  92. package/dist/{chunk-KO3VSZQP.js.map → chunk-NDBHEOIA.js.map} +1 -1
  93. package/dist/{chunk-HKRME377.js → chunk-NJVHGS7X.js} +4 -4
  94. package/dist/{chunk-HKRME377.js.map → chunk-NJVHGS7X.js.map} +1 -1
  95. package/dist/{chunk-Q6FKWPRO.js → chunk-O3FYOS64.js} +93 -14
  96. package/dist/chunk-O3FYOS64.js.map +1 -0
  97. package/dist/{chunk-RDIGVPXX.js → chunk-PTJZCOBH.js} +2 -2
  98. package/dist/{chunk-RDIGVPXX.js.map → chunk-PTJZCOBH.js.map} +1 -1
  99. package/dist/{chunk-4CD2R4MJ.js → chunk-QBUJTVMY.js} +4 -4
  100. package/dist/{chunk-4CD2R4MJ.js.map → chunk-QBUJTVMY.js.map} +1 -1
  101. package/dist/{chunk-LL5GMUQG.js → chunk-SE6OL7Y5.js} +7 -7
  102. package/dist/{chunk-LL5GMUQG.js.map → chunk-SE6OL7Y5.js.map} +1 -1
  103. package/dist/{chunk-SILFO5RY.js → chunk-SQMDFM4N.js} +2 -2
  104. package/dist/{chunk-SILFO5RY.js.map → chunk-SQMDFM4N.js.map} +1 -1
  105. package/dist/{chunk-REAF7ZFA.js → chunk-T5EIWWEJ.js} +398 -36
  106. package/dist/chunk-T5EIWWEJ.js.map +1 -0
  107. package/dist/{chunk-QW5B3TEO.js → chunk-TMQFOJ6F.js} +3 -3
  108. package/dist/{chunk-QW5B3TEO.js.map → chunk-TMQFOJ6F.js.map} +1 -1
  109. package/dist/{chunk-BB5EJLKZ.js → chunk-TUOHA6BM.js} +2 -2
  110. package/dist/{chunk-BB5EJLKZ.js.map → chunk-TUOHA6BM.js.map} +1 -1
  111. package/dist/{chunk-HLAEYFUN.js → chunk-U3FI4DVT.js} +3 -3
  112. package/dist/{chunk-HLAEYFUN.js.map → chunk-U3FI4DVT.js.map} +1 -1
  113. package/dist/{chunk-237BMOZW.js → chunk-UWD7YBDR.js} +4 -4
  114. package/dist/{chunk-237BMOZW.js.map → chunk-UWD7YBDR.js.map} +1 -1
  115. package/dist/{chunk-6ZM5X2XW.js → chunk-V2CONXKD.js} +3 -3
  116. package/dist/{chunk-6ZM5X2XW.js.map → chunk-V2CONXKD.js.map} +1 -1
  117. package/dist/{chunk-3NJFPGEB.js → chunk-V3EJYOP2.js} +6 -6
  118. package/dist/{chunk-3NJFPGEB.js.map → chunk-V3EJYOP2.js.map} +1 -1
  119. package/dist/{chunk-K7ZGY2BY.js → chunk-WPLZGT5Z.js} +4095 -3888
  120. package/dist/chunk-WPLZGT5Z.js.map +1 -0
  121. package/dist/{chunk-VT6G5AJV.js → chunk-WS3BOCAT.js} +4 -3
  122. package/dist/chunk-WS3BOCAT.js.map +1 -0
  123. package/dist/{chunk-7YOHUX2M.js → chunk-X2B5GMJO.js} +18 -9
  124. package/dist/chunk-X2B5GMJO.js.map +1 -0
  125. package/dist/{chunk-YGP6XEPA.js → chunk-XPKUFOS3.js} +6 -6
  126. package/dist/{chunk-YGP6XEPA.js.map → chunk-XPKUFOS3.js.map} +1 -1
  127. package/dist/{chunk-XCGDRLMH.js → chunk-Y242OE4B.js} +3 -3
  128. package/dist/{chunk-XCGDRLMH.js.map → chunk-Y242OE4B.js.map} +1 -1
  129. package/dist/{chunk-K6HCOTOZ.js → chunk-Y2BQWZXT.js} +41 -35
  130. package/dist/chunk-Y2BQWZXT.js.map +1 -0
  131. package/dist/{chunk-5TLMHB2U.js → chunk-YGT3CGPD.js} +6 -3
  132. package/dist/chunk-YGT3CGPD.js.map +1 -0
  133. package/dist/{claude-code-AESK7XO4.js → claude-code-YRJIGXTL.js} +5 -5
  134. package/dist/{claude-code-AESK7XO4.js.map → claude-code-YRJIGXTL.js.map} +1 -1
  135. package/dist/cli/index.js +277 -143
  136. package/dist/cli/index.js.map +1 -1
  137. package/dist/cli/src/agent-pins.d.ts +8 -0
  138. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  139. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  140. package/dist/cli/src/commands/catalog.d.ts +4 -4
  141. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  142. package/dist/cli/src/commands/connector.d.ts.map +1 -1
  143. package/dist/cli/src/commands/deploy.d.ts.map +1 -1
  144. package/dist/cli/src/commands/flow.d.ts.map +1 -1
  145. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  146. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  147. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  148. package/dist/cli/src/commands/library-index.d.ts +42 -0
  149. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  150. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  151. package/dist/cli/src/commands/npx.d.ts.map +1 -1
  152. package/dist/cli/src/commands/patch.d.ts.map +1 -1
  153. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  154. package/dist/cli/src/commands/project.d.ts.map +1 -1
  155. package/dist/cli/src/commands/run.d.ts.map +1 -1
  156. package/dist/cli/src/commands/serve-preflight.d.ts +10 -0
  157. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  158. package/dist/cli/src/commands/serve.d.ts +5 -3
  159. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  160. package/dist/cli/src/commands/session.d.ts.map +1 -1
  161. package/dist/cli/src/commands/source.d.ts.map +1 -1
  162. package/dist/cli/src/commands/store.d.ts.map +1 -1
  163. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  164. package/dist/cli/src/config-checks.d.ts +13 -0
  165. package/dist/cli/src/config-checks.d.ts.map +1 -1
  166. package/dist/cli/src/group-help.d.ts +11 -0
  167. package/dist/cli/src/group-help.d.ts.map +1 -0
  168. package/dist/connectors/config.js +2 -2
  169. package/dist/connectors/index.js +17 -17
  170. package/dist/connectors/src/config.d.ts.map +1 -1
  171. package/dist/connectors/src/connector-manager.d.ts +66 -2
  172. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  173. package/dist/connectors/src/connector-prompt.d.ts.map +1 -1
  174. package/dist/connectors/src/connector-types.d.ts +6 -0
  175. package/dist/connectors/src/connector-types.d.ts.map +1 -1
  176. package/dist/connectors/src/fleet-utils.d.ts +33 -0
  177. package/dist/connectors/src/fleet-utils.d.ts.map +1 -1
  178. package/dist/connectors/src/index.d.ts +2 -2
  179. package/dist/connectors/src/index.d.ts.map +1 -1
  180. package/dist/{connectors-5ZZRVAPD.js → connectors-JKT32HZT.js} +20 -20
  181. package/dist/{connectors-5ZZRVAPD.js.map → connectors-JKT32HZT.js.map} +1 -1
  182. package/dist/core/index.js +4 -4
  183. package/dist/core/logging.js +1 -1
  184. package/dist/core/runtime-assets.js +2 -2
  185. package/dist/core/src/index.d.ts +1 -1
  186. package/dist/core/src/index.d.ts.map +1 -1
  187. package/dist/core/src/logging/config.d.ts.map +1 -1
  188. package/dist/core/src/repo-manager.d.ts +6 -0
  189. package/dist/core/src/repo-manager.d.ts.map +1 -1
  190. package/dist/core/src/run-state-ignore.d.ts +6 -4
  191. package/dist/core/src/run-state-ignore.d.ts.map +1 -1
  192. package/dist/core/src/walker.d.ts.map +1 -1
  193. package/dist/core/src/workspace-config.d.ts +6 -0
  194. package/dist/core/src/workspace-config.d.ts.map +1 -1
  195. package/dist/core/workspace-config.js +1 -1
  196. package/dist/deploy/index.js +4 -4
  197. package/dist/discovery/index.js +2 -2
  198. package/dist/{ensure-sources-VLJ7AUUK.js → ensure-sources-GUJODKY5.js} +23 -23
  199. package/dist/{ensure-sources-VLJ7AUUK.js.map → ensure-sources-GUJODKY5.js.map} +1 -1
  200. package/dist/factory-assets/connectors/box.js +17 -17
  201. package/dist/factory-assets/connectors/deploy.js +17 -17
  202. package/dist/factory-assets/connectors/devserver.js +17 -17
  203. package/dist/factory-assets/connectors/flow/adapter.js +17 -17
  204. package/dist/factory-assets/connectors/flow/engine.js +5 -5
  205. package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
  206. package/dist/factory-assets/connectors/flow.js +17 -17
  207. package/dist/factory-assets/connectors/git.js +17 -17
  208. package/dist/factory-assets/connectors/gmail.js +17 -17
  209. package/dist/factory-assets/connectors/googledrive.js +17 -17
  210. package/dist/factory-assets/connectors/local.js +17 -17
  211. package/dist/factory-assets/connectors/mattermost.js +17 -17
  212. package/dist/factory-assets/connectors/memory.js +17 -17
  213. package/dist/factory-assets/connectors/minio.js +17 -17
  214. package/dist/factory-assets/connectors/postgres.js +17 -17
  215. package/dist/factory-assets/connectors/s3.js +17 -17
  216. package/dist/factory-assets/connectors/sharepoint.js +17 -17
  217. package/dist/factory-assets/connectors/sqlite.js +17 -17
  218. package/dist/factory-assets/connectors/static-server.js +17 -17
  219. package/dist/factory-assets/connectors/tunnel.js +17 -17
  220. package/dist/factory-assets/connectors/webdav.js +17 -17
  221. package/dist/factory-assets/connectors/xstate-store.js +17 -17
  222. package/dist/factory-assets/connectors/xstate.js +17 -17
  223. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +4 -4
  224. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +10 -10
  225. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +15 -15
  226. package/dist/factory-assets/skills/manifest-compliance/SKILL.md +1 -1
  227. package/dist/{flows-I6ODIPZZ.js → flows-UCP6ZUYS.js} +7 -7
  228. package/dist/{flows-I6ODIPZZ.js.map → flows-UCP6ZUYS.js.map} +1 -1
  229. package/dist/{helpers-APXGTZ5A.js → helpers-SO53MRHF.js} +23 -23
  230. package/dist/{helpers-APXGTZ5A.js.map → helpers-SO53MRHF.js.map} +1 -1
  231. package/dist/library/index.js +7 -7
  232. package/dist/library/src/index.d.ts +1 -1
  233. package/dist/library/src/index.d.ts.map +1 -1
  234. package/dist/library/src/remote/index.d.ts +1 -1
  235. package/dist/library/src/remote/index.d.ts.map +1 -1
  236. package/dist/library/src/remote/remote-catalog-source.d.ts +33 -2
  237. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  238. package/dist/{library-publish-B5HL4OBE.js → library-publish-Z5E3YZCZ.js} +61 -47
  239. package/dist/library-publish-Z5E3YZCZ.js.map +1 -0
  240. package/dist/model-endpoint/index.js +7 -7
  241. package/dist/model-endpoint/src/index.d.ts +1 -1
  242. package/dist/model-endpoint/src/index.d.ts.map +1 -1
  243. package/dist/model-endpoint/src/openai-agent.d.ts +60 -0
  244. package/dist/model-endpoint/src/openai-agent.d.ts.map +1 -0
  245. package/dist/model-endpoint/src/resolve.d.ts +12 -3
  246. package/dist/model-endpoint/src/resolve.d.ts.map +1 -1
  247. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  248. package/dist/model-endpoint/src/types.d.ts +33 -0
  249. package/dist/model-endpoint/src/types.d.ts.map +1 -1
  250. package/dist/model-endpoint/src/upstream-models.d.ts +20 -0
  251. package/dist/model-endpoint/src/upstream-models.d.ts.map +1 -0
  252. package/dist/{open-library-F56D46K7.js → open-library-A5OB72FD.js} +26 -26
  253. package/dist/{open-library-F56D46K7.js.map → open-library-A5OB72FD.js.map} +1 -1
  254. package/dist/{open-registry-RZW2AFD6.js → open-registry-BHBHQMBA.js} +11 -11
  255. package/dist/{open-registry-RZW2AFD6.js.map → open-registry-BHBHQMBA.js.map} +1 -1
  256. package/dist/{paths-RPK5PNZQ.js → paths-77PXOXZY.js} +7 -7
  257. package/dist/{paths-RPK5PNZQ.js.map → paths-77PXOXZY.js.map} +1 -1
  258. package/dist/{plugin-store-OJTERUEZ.js → plugin-store-XQP2CRYH.js} +7 -7
  259. package/dist/{plugin-store-OJTERUEZ.js.map → plugin-store-XQP2CRYH.js.map} +1 -1
  260. package/dist/{project-GLTP6VFV.js → project-KTEUN7KR.js} +39 -40
  261. package/dist/{project-GLTP6VFV.js.map → project-KTEUN7KR.js.map} +1 -1
  262. package/dist/resolver/index.js +4 -4
  263. package/dist/runner/index.js +28 -28
  264. package/dist/runner/src/agent-loop.d.ts +42 -0
  265. package/dist/runner/src/agent-loop.d.ts.map +1 -0
  266. package/dist/runner/src/agents/in-process-host.d.ts +9 -6
  267. package/dist/runner/src/agents/in-process-host.d.ts.map +1 -1
  268. package/dist/runner/src/model-endpoint-discovery.d.ts +3 -0
  269. package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -1
  270. package/dist/runner/src/resource-handler.d.ts +1 -1
  271. package/dist/runner/src/resource-handler.d.ts.map +1 -1
  272. package/dist/runner/src/resources.d.ts +1 -0
  273. package/dist/runner/src/resources.d.ts.map +1 -1
  274. package/dist/runner/src/serve.d.ts.map +1 -1
  275. package/dist/runner/src/session-builder.d.ts +6 -4
  276. package/dist/runner/src/session-builder.d.ts.map +1 -1
  277. package/dist/runner/src/session-resource-handlers.d.ts.map +1 -1
  278. package/dist/runner/src/turn-scheduler.d.ts +29 -2
  279. package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
  280. package/dist/sdk/asset-manager.js +11 -11
  281. package/dist/sdk/bridge.js +14 -14
  282. package/dist/sdk/core.js +4 -4
  283. package/dist/sdk/flow.js +5 -5
  284. package/dist/sdk/index.js +28 -28
  285. package/dist/sdk/resolver.js +4 -4
  286. package/dist/sdk/runner.js +28 -28
  287. package/dist/sdk/transport/ws/server.js +5 -5
  288. package/dist/sdk/transport/ws.js +5 -5
  289. package/dist/sdk/transport.js +5 -5
  290. package/dist/{serve-preflight-EHLBSNUE.js → serve-preflight-ODQGVUFL.js} +27 -26
  291. package/dist/{serve-preflight-EHLBSNUE.js.map → serve-preflight-ODQGVUFL.js.map} +1 -1
  292. package/dist/{setup-PMZLMFCD.js → setup-QJDI5YAW.js} +24 -24
  293. package/dist/{setup-PMZLMFCD.js.map → setup-QJDI5YAW.js.map} +1 -1
  294. package/dist/{skills-KHHW3RZ3.js → skills-DE2BDQ6G.js} +6 -6
  295. package/dist/{skills-KHHW3RZ3.js.map → skills-DE2BDQ6G.js.map} +1 -1
  296. package/dist/{source-QNSGAM3S.js → source-FKOUYMEM.js} +39 -39
  297. package/dist/{source-QNSGAM3S.js.map → source-FKOUYMEM.js.map} +1 -1
  298. package/dist/{source-manifest-publish-AI725AVE.js → source-manifest-publish-JA4TY4Z6.js} +41 -41
  299. package/dist/{source-manifest-publish-AI725AVE.js.map → source-manifest-publish-JA4TY4Z6.js.map} +1 -1
  300. package/dist/transport/index.js +5 -5
  301. package/dist/transport/ws/server.js +5 -5
  302. package/dist/transport/ws.js +5 -5
  303. package/dist/tui/index.js +29 -29
  304. package/dist/tui/index.js.map +1 -1
  305. package/dist/tui/src/repl.d.ts.map +1 -1
  306. package/dist/types/manifests.js +1 -1
  307. package/dist/types/src/manifests/scaffold-body.d.ts +1 -1
  308. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  309. package/dist/workspace-plugin/adapters/mcp.js +20 -20
  310. package/dist/workspace-plugin/adapters/omp.js +14 -14
  311. package/dist/workspace-plugin/index.js +2 -2
  312. package/dist/workspace-plugin/src/tools/connectors.d.ts.map +1 -1
  313. package/package.json +1 -1
  314. package/dist/chunk-2I5HNM7K.js.map +0 -1
  315. package/dist/chunk-5TLMHB2U.js.map +0 -1
  316. package/dist/chunk-757G6TTZ.js.map +0 -1
  317. package/dist/chunk-7YOHUX2M.js.map +0 -1
  318. package/dist/chunk-DFP476EU.js.map +0 -1
  319. package/dist/chunk-G44FFUMA.js.map +0 -1
  320. package/dist/chunk-K6HCOTOZ.js.map +0 -1
  321. package/dist/chunk-K7ZGY2BY.js.map +0 -1
  322. package/dist/chunk-KTBKW2FI.js.map +0 -1
  323. package/dist/chunk-LJ6PLEDU.js.map +0 -1
  324. package/dist/chunk-O7ADRMCR.js.map +0 -1
  325. package/dist/chunk-PMZMG3HC.js +0 -83
  326. package/dist/chunk-PMZMG3HC.js.map +0 -1
  327. package/dist/chunk-Q6FKWPRO.js.map +0 -1
  328. package/dist/chunk-REAF7ZFA.js.map +0 -1
  329. package/dist/chunk-SGI5MRKP.js.map +0 -1
  330. package/dist/chunk-TMJBEGS4.js.map +0 -1
  331. package/dist/chunk-VT6G5AJV.js.map +0 -1
  332. package/dist/chunk-Y6LC5PEZ.js.map +0 -1
  333. package/dist/chunk-YHNPWSSH.js.map +0 -1
  334. package/dist/chunk-ZBA4P5TD.js.map +0 -1
  335. package/dist/library-publish-B5HL4OBE.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../connectors/src/connector-types.ts","../connectors/src/materialized-connectors.ts","../connectors/src/secrets.ts","../connectors/src/config.ts"],"names":[],"mappings":";;;;;;;AAqHO,SAAS,sBAAsB,KAAA,EAA+C;AACnF,EAAA,IAAI,UAAU,MAAA,IAAa,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,OAAO,OAAO,MAAA;AACrE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,IAAA,OAAW,EAAA,EAAI,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAM;AAC7E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,EAAE,QAAQ,aAAA,EAAc;AAC9D,EAAA,MAAM,EAAE,MAAA,EAAQ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AAM,MAAA,CAAO,MAAM,CAAA,EAAG,GAAA,EAAK,IAAA,EAAK;AAAA,EACpE;AAIA,EAAA,MAAM,IAAI,sBAAA,CAAuB,IAAA,EAAM,OAAO,CAAA;AAChD","file":"chunk-ZBA4P5TD.js","sourcesContent":["/**\n * Connector adapter infrastructure types.\n *\n * Connectors are external backends (databases, KV stores, object stores,\n * in-process state, git repos, etc.). A connector exposes up to two faces: a\n * `ToolFace` (agents access it through injected tools) and/or a\n * `FilesystemFace` (the connector projects content into a mounted directory).\n *\n * @docLink packages/connectors/concepts#connector-types\n */\n\nimport type {\n ConnectorContent,\n ConnectorEntry,\n ListOptions,\n OperationDescriptor,\n SearchOptions,\n SearchResult,\n SyncOptions,\n SyncResult,\n WatchHandle,\n WatchOptions,\n} from \"./shared-types.js\";\n\nexport type { OperationDescriptor } from \"./shared-types.js\";\n\nimport type { ConnectorPushState, Logger } from \"@skaile/workspaces/types\";\nimport type { SecretProvider } from \"./secrets.js\";\n\n// ── Connector declaration (runtime config, resolved from skaile.yaml) ────────\n\n/**\n * Parsed connector configuration from `skaile.yaml`, passed to `ConnectorAdapter.connect()` and held by `ConnectorManager`.\n * @docLink packages/connectors/concepts#connector-declaration\n */\nexport interface ConnectorDeclaration {\n /** Unique identifier for this connector instance. */\n id: string;\n /** Driver type: \"postgres\", \"redis\", \"memory\", \"xstate\", \"yjs\", etc. */\n driver: string;\n /**\n * Human-readable connection name, projected from the materialized CONNECTOR.md\n * frontmatter `label`. The platform resource-explorer tab renders this over the\n * driver name when present; absent for connectors with no configured name.\n */\n label?: string;\n /** Access level enforced by the manager. */\n access: \"read-only\" | \"read-write\";\n /**\n * True when the source set no `access` and the parser filled in the\n * `read-only` default. The git driver's read-only mode (discard edits, never\n * push) runs only on an explicit `read-only`, so an undeclared mount keeps\n * its earlier behaviour.\n */\n accessDefaulted?: true;\n /** Credential reference: \"env:VAR_NAME\" or inline value. */\n auth?: string;\n /**\n * Backend provider link id for `auth: \"backend\"` connectors. The runner's\n * token-refresh mediator passes this as the `host.refresh_credential` `id` so\n * the platform resolves the credential against the right provider link.\n */\n providerLinkId?: string;\n /**\n * Operating mode for connectors that manage a working copy. Orthogonal to\n * faces. `agent` = the agent drives the source natively (e.g. native git) and\n * the connector only provisions short-lived credentials. `sync` = the\n * connector owns the working copy (clone + watch + auto-commit/pull). Absent =\n * the driver's legacy `options.{session,sync,lifecycle}` blocks decide.\n */\n mode?: \"agent\" | \"sync\";\n /** Driver-specific configuration. */\n options?: Record<string, unknown>;\n /**\n * Owner-authored instruction text projected from the materialized\n * CONNECTOR.md body (preset custom instructions). Injected eagerly into the\n * agent system prompt. Absent when the body is empty.\n */\n instructions?: string;\n /** Filesystem-face config — only meaningful for mountable connectors. */\n mount?: {\n /** Source URL or path (repo URL, bucket name, host path). */\n source: string;\n /** Override mount target directory (default: `.mounts/<id>/`). */\n target?: string;\n /** Watch flag: omitted → watch read-write, skip read-only. */\n watch?: boolean;\n /** Expert-only: expose the resolved credential to the agent CLI. */\n exposeAccessToken?: boolean;\n /** Optional access-token TTL override (seconds). */\n accessTokenTTL?: number;\n };\n /**\n * Set by the host when it has already decided this connector cannot be\n * attached (e.g. a cloud mount whose host-side build failed). The manager\n * never calls the driver for it and reports it as failed with this reason.\n */\n unavailable?: UnavailableMarker;\n}\n\n/**\n * Why the host declared a connector without making it available. `reason` is\n * a short machine-readable token chosen by the host; `detail` is its prose.\n * @docLink packages/connectors/concepts#connector-declaration\n */\nexport interface UnavailableMarker {\n reason: string;\n detail?: string;\n}\n\n/**\n * Read an `unavailable:` value from an untyped declaration. Absent, `null` and\n * `false` mean \"not marked\". Any other value marks the connector unavailable —\n * a host that wrote the key meant it. A plain string is taken as the reason;\n * anything else that is not a `{ reason, detail? }` object gets a generic one.\n * @docLink packages/connectors/concepts#connector-declaration\n */\nexport function readUnavailableMarker(value: unknown): UnavailableMarker | undefined {\n if (value === undefined || value === null || value === false) return undefined;\n if (typeof value === \"string\" && value.trim() !== \"\") return { reason: value };\n if (typeof value !== \"object\") return { reason: \"unavailable\" };\n const { reason, detail } = value as { reason?: unknown; detail?: unknown };\n const marker: UnavailableMarker = {\n reason: typeof reason === \"string\" && reason.trim() !== \"\" ? reason : \"unavailable\",\n };\n if (typeof detail === \"string\" && detail.trim() !== \"\") marker.detail = detail;\n return marker;\n}\n\n// ── Connector handle (returned by adapter.connect) ───────────────────────────\n\n/**\n * Live state of a connected backend, returned by `Connector.connect()` (or the\n * legacy `ConnectorAdapter.connect()`) and held by `ConnectorManager`.\n * @docLink packages/connectors/concepts#connector-handle\n */\nexport interface ConnectorHandle {\n /** Connector declaration ID. */\n readonly id: string;\n /** Driver name. */\n readonly driver: string;\n /** Effective access level. */\n readonly access: \"read-only\" | \"read-write\";\n /** Lifecycle status. Set by every `Connector`. */\n status: \"connecting\" | \"connected\" | \"error\" | \"disconnected\";\n /** Present iff the connector has a filesystem face and is mounted. */\n mountPath?: string;\n /** Adapter-specific state (connection pool, client, etc.). Opaque to callers. */\n state: unknown;\n}\n\n/** Optional capability a filesystem-face connector attaches to its handle state\n * when reads need an authoritative remote byte size rather than trusting local\n * filesystem metadata.\n */\nexport interface AuthoritativeSizeProvider {\n authoritativeSize(relPath: string): Promise<number | null>;\n}\n\n// ── Connector change event ────────────────────────────────────────────────────\n\n/**\n * Change event emitted by a connector adapter's `watch()` implementation.\n * @docLink packages/connectors/concepts#connector-change-event\n */\nexport interface ConnectorChangeEvent {\n /** Relative path, key, table name, node ID, etc. */\n path: string;\n /** What happened. */\n action: \"create\" | \"edit\" | \"delete\" | \"conflict\";\n /** What caused the change. */\n source: \"filesystem\" | \"operation\" | \"remote\" | \"sync\";\n}\n\n// ── ConnectorManager info ────────────────────────────────────────────────────\n\n/**\n * Summary of a connected connector returned by `ConnectorManager.listConnectors()`.\n * @docLink packages/connectors/concepts#connector-info\n */\nexport interface ConnectorInfo {\n id: string;\n driver: string;\n /** Human-readable connection name; the resource-explorer tab renders this over `id`/`driver` when present. */\n label?: string;\n access: \"read-only\" | \"read-write\";\n /** Operation names this connector exposes as agent tools (via describeOperations). */\n operations: string[];\n}\n\n/**\n * Bulk connect/disconnect result returned by `ConnectorManager.connectAll()` and `disconnectAll()`.\n * @docLink packages/connectors/concepts#connector-report\n */\nexport interface ConnectorReport {\n results: Array<{ id: string; connected: boolean; error?: string }>;\n}\n\n// ── Field spec (connector credential/config declarations) ────────────────────\n\n/**\n * Input types for `ConnectorFieldSpec`. Controls validation rules and the Forge UI affordance.\n * @docLink packages/connectors/concepts#field-type\n */\nexport type FieldType =\n | \"text\" // plain string\n | \"password\" // sensitive; always stored via SecretProvider\n | \"api-key\" // alias for password with specific UI affordance\n | \"url\" // validated URL string\n | \"oauth\" // triggers OAuth flow; oauthService required\n | \"select\" // enum; choices required and non-empty\n | \"boolean\" // default must be \"true\" or \"false\" if provided\n | \"number\"; // default must be a parseable numeric string if provided\n\n/**\n * Declares one credential or configuration field that a connector adapter requires.\n * Used by `ConnectorManager.resolveFields()` and the Forge settings UI.\n * @docLink packages/connectors/concepts#connector-field-spec\n */\nexport interface ConnectorFieldSpec {\n /** Machine name used as the options key in skaile.yaml. */\n key: string;\n /** Human-readable label for the forge settings UI. */\n label: string;\n /** Tooltip / help text. */\n description?: string;\n /** Input type. Controls validation rules and UI affordance in the forge settings panel. */\n type: FieldType;\n /** Whether the adapter refuses to connect when this field is missing. */\n required: boolean;\n /** String fallback used when not provided and not required. */\n default?: string;\n /** Forge UI masks the value; value is never logged. */\n sensitive: boolean;\n /** UI grouping: \"Authentication\", \"Connection\", \"Options\". */\n group?: string;\n /**\n * Required when type === \"select\"; must be non-empty.\n */\n choices?: string[];\n /**\n * Required when type === \"oauth\".\n * Identifies the OAuth service, e.g. \"google\".\n * Used to call OAuthSecretProvider.initiateFlow(oauthService, account).\n * oauth fields must be declared AFTER any field they reference (e.g., \"account\").\n */\n oauthService?: string;\n /** Example value shown as placeholder text in the forge settings UI. */\n example?: string;\n}\n\n/**\n * Thrown by `ConnectorManager.connectAll()` and `resolveFields()` when a required\n * adapter field cannot be resolved through the `SecretProviderChain`. Carries the\n * connector ID, the missing field spec, the ref that was tried, and the available\n * providers for actionable error messages.\n * @docLink packages/connectors/concepts#connector-field-missing-error\n */\nexport class ConnectorFieldMissingError extends Error {\n readonly connectorId: string;\n readonly field: ConnectorFieldSpec;\n readonly triedRef: string;\n readonly availableProviders: string[];\n\n constructor(opts: {\n connectorId: string;\n field: ConnectorFieldSpec;\n triedRef: string;\n availableProviders: string[];\n }) {\n super(\n `Connector \"${opts.connectorId}\" is missing required field \"${opts.field.key}\" ` +\n `(tried: ${opts.triedRef || \"(none)\"}). ` +\n `Available providers: ${opts.availableProviders.join(\", \") || \"(none)\"}`,\n );\n this.name = \"ConnectorFieldMissingError\";\n this.connectorId = opts.connectorId;\n this.field = opts.field;\n this.triedRef = opts.triedRef;\n this.availableProviders = opts.availableProviders;\n }\n}\n\n// ── Runtime skill descriptor ──────────────────────────────────────────────────\n\n/**\n * Instance-specific skill descriptor returned by `ConnectorAdapter.describeSkill()`.\n * Returned by `ConnectorManager.listSkills()` to surface connector capabilities to the agent.\n * @docLink packages/connectors/concepts#runtime-skill-descriptor\n */\nexport interface RuntimeSkillDescriptor {\n /** Connector instance id, e.g. \"gmail-work\". */\n id: string;\n /** Short label: \"Gmail — work@company.com\". */\n name: string;\n /** Instance-specific description: \"Read and write email for work@company.com\". */\n description: string;\n /** Category for grouping in the forge UI. */\n category: string;\n access: \"read-only\" | \"read-write\";\n /** Operation names (without loading full defs) for agent planning. */\n toolNames: string[];\n}\n\n// ── Token mediator (Tier-2 credential mediation) ─────────────────────────────\n\n/**\n * Result of a single `TokenMediator` call. Mirrors\n * `AccessTokenResponseEvent.result` from `@skaile/workspaces/types` so the runner\n * can pass it straight through.\n *\n * @docLink packages/connectors/api-reference#token-mediator\n */\nexport type TokenMediatorResult =\n | {\n ok: true;\n /** Access token to use for the next git operation. */\n token: string;\n /**\n * ISO-8601 expiry, or `null` for indefinite tokens (static PATs). Drives\n * whether the driver schedules a refresh tick.\n */\n expiresAt: string | null;\n /** Optional scope/permissions list, surfaced in audit logs. */\n scope?: string[];\n }\n | {\n ok: false;\n code: \"not-configured\" | \"revoked\" | \"provider-error\" | \"backend-error\" | \"timeout\";\n /** Human-readable detail, never carries secrets. */\n message: string;\n };\n\n/**\n * Function signature mountable connectors use to acquire a fresh access token\n * from the runner-owned backend mediator. Implemented by the runner: emits a\n * `request_access_token` command over the transport and resolves with the\n * matching `access_token_response` payload.\n *\n * Connectors MUST treat this as the only token source when the parsed\n * `MountAuthRef.kind === 'backend'`. Local minting (PAT, OAuth, GitHub App)\n * has been removed from the runner — provider dispatch lives on the platform.\n *\n * @docLink packages/connectors/api-reference#token-mediator\n */\nexport type TokenMediator = (input: {\n connectorId: string;\n reason: \"initial\" | \"refresh\" | \"retry-401\";\n /**\n * Connector driver, used by the runner mediator to pick the platform refresh\n * `kind`; absent on `initial` and for legacy callers.\n */\n driver?: string;\n /**\n * Backend provider link id — the `id` the platform `host.refresh_credential`\n * capability resolves the credential against. Absent on `initial` and for\n * legacy callers.\n */\n providerLinkId?: string;\n /**\n * The connector's declaration id, bound from the declaration like `driver`\n * and `providerLinkId`. The runner sends it next to the link id on a git\n * refresh, so a read-only reference sharing its link with a read-write\n * mount is refreshed read-only. Absent on `initial` and for legacy callers.\n */\n declarationId?: string;\n}) => Promise<TokenMediatorResult>;\n\n// ── S3 presigner (backend-signed S3 reads) ───────────────────────────────────\n\n/**\n * Request to the platform's runtime capability `host.s3_presign`. `mountId` is\n * the connector id of an `auth: backend` S3 mount in this session; bucket,\n * prefix and endpoint come from the platform's copy of that declaration.\n */\nexport type S3PresignRequest =\n | { mountId: string; op: \"list\"; continuationToken?: string }\n | { mountId: string; op: \"get\"; keys: string[] };\n\n/**\n * Answer from `host.s3_presign`. `list` carries one ListObjectsV2 URL, `get`\n * one GetObject URL per key; folder markers (keys ending in `/`) are listed in\n * `skipped` instead. Every URL expires at `expiresAt` (ten minutes today).\n */\nexport type S3PresignResult =\n | { ok: true; op: \"list\"; url: string; expiresAt: string }\n | {\n ok: true;\n op: \"get\";\n urls: { key: string; url: string }[];\n skipped: { key: string; reason: string }[];\n expiresAt: string;\n }\n | { ok: false; code: string; message: string };\n\n/**\n * Presign client for `auth: backend` S3 mounts, implemented by the runner over\n * the same remote-capability channel as {@link TokenMediator}. The S3 keys stay\n * in the backend; the container only ever sees short-lived read URLs.\n * Never throws: transport failures resolve as `{ ok: false, code: \"backend-error\" }`.\n */\nexport type S3Presigner = (request: S3PresignRequest) => Promise<S3PresignResult>;\n\n// ── Unified connector types ───────────────────────────────────────────────────\n\n/**\n * Context passed to `Connector.connect()` by `ConnectorManager`.\n * @docLink packages/connectors/concepts#connect-context\n */\nexport interface ConnectContext {\n /**\n * Absolute project directory the owning `ConnectorManager` runs for (always set by the manager). A connector that needs\n * an optional npm peer looks in this project's `node_modules` first.\n */\n projectDir?: string;\n /** Secret provider for resolving credential references. */\n secrets?: SecretProvider;\n /**\n * Backend token mediator — present for `auth: backend` connectors of either\n * face (filesystem or tool), so mount refresh and tool-face OAuth flows share\n * one path.\n */\n tokenMediator?: TokenMediator;\n /**\n * Backend S3 presigner — the read path for `auth: backend` S3 mounts. Absent\n * outside a platform-connected runner.\n */\n s3Presigner?: S3Presigner;\n /**\n * Absolute directory the manager allocated for the filesystem face.\n * Present iff `connector.filesystem != null`. The connector projects its\n * content here during `connect()` and sets `handle.mountPath`.\n */\n mountTarget?: string;\n /** Resolved credential/config fields (from `describeFields()`). */\n resolvedFields?: Record<string, string>;\n /**\n * Aborted when the owning `ConnectorManager` is disposed. Long-running\n * `connect()` implementations — notably background (deferred) filesystem\n * mounts — should observe this and bail out promptly so session cleanup\n * does not wait on a wedged remote.\n */\n abortSignal?: AbortSignal;\n}\n\n/**\n * Filesystem face — present ⇒ the connector is \"mountable\".\n * @docLink packages/connectors/concepts#filesystem-face\n */\nexport interface FilesystemFace {\n /** Pull latest remote state into the mounted directory. */\n sync(handle: ConnectorHandle, options?: SyncOptions): Promise<SyncResult>;\n}\n\n/**\n * Tool face — present ⇒ the connector exposes agent tools.\n * @docLink packages/connectors/concepts#tool-face\n */\nexport interface ToolFace {\n read?(handle: ConnectorHandle, path: string): Promise<ConnectorContent | null>;\n write?(handle: ConnectorHandle, path: string, content: ConnectorContent): Promise<void>;\n delete?(handle: ConnectorHandle, path: string): Promise<boolean>;\n list?(handle: ConnectorHandle, path?: string, options?: ListOptions): Promise<ConnectorEntry[]>;\n search?(handle: ConnectorHandle, query: string, options?: SearchOptions): Promise<SearchResult[]>;\n describeOperations(handle: ConnectorHandle): OperationDescriptor[];\n executeOp(\n handle: ConnectorHandle,\n operation: string,\n args: Record<string, unknown>,\n ): Promise<string>;\n describeSkill?(\n handle: ConnectorHandle,\n declaration: ConnectorDeclaration,\n ): RuntimeSkillDescriptor;\n}\n\n/**\n * The unified connector contract. A connector should expose at least one face\n * (`filesystem` and/or `tools`); `ConnectorManager` rejects a faceless\n * connector at connect time.\n * @docLink packages/connectors/concepts#connector\n */\nexport interface Connector {\n readonly name: string;\n /**\n * True when `connect()` for this declaration can only get its credential from\n * `ctx.tokenMediator`. A manager with neither a mediator nor a pre-mint then\n * fails the connect without calling the driver, whose failure path may write\n * shared state (the git driver's credential helper) the live session uses.\n */\n requiresTokenMediator?(declaration: ConnectorDeclaration): boolean;\n connect(declaration: ConnectorDeclaration, ctx: ConnectContext): Promise<ConnectorHandle>;\n disconnect(handle: ConnectorHandle): Promise<void>;\n readonly filesystem?: FilesystemFace;\n readonly tools?: ToolFace;\n describeFields?(): ConnectorFieldSpec[];\n setLogger?(logger: Logger): void;\n watch?(\n handle: ConnectorHandle,\n callback: (e: ConnectorChangeEvent) => void,\n options?: WatchOptions,\n ): WatchHandle;\n onHibernate?(handle: ConnectorHandle): Promise<ConnectorHookOutcome>;\n onSessionClose?(handle: ConnectorHandle): Promise<ConnectorHookOutcome>;\n}\n\n/**\n * Structured return of a lifecycle hook (`onHibernate` / `onSessionClose`).\n * `detail` is the same human-readable line a hook can return as a plain string;\n * `pushState` is what the connector can prove about its working copy, copied\n * onto the hook's `LifecycleResult`.\n */\nexport interface ConnectorHookReport {\n detail?: string;\n pushState?: ConnectorPushState;\n}\n\n/** What a lifecycle hook may return: a detail line, a structured report, or nothing. */\nexport type ConnectorHookOutcome = string | ConnectorHookReport | undefined;\n\n/**\n * Factory used by the connector registry.\n * @docLink packages/connectors/api-reference#connector-factory\n */\nexport type ConnectorFactory = () => Connector;\n\n/**\n * Per-connector bulk-connect result returned by `ConnectorManager.connectAll()`.\n * @docLink packages/connectors/concepts#connector-startup-report\n */\nexport interface ConnectorStartupReport {\n results: Array<{\n id: string;\n connected: boolean;\n mountPath?: string;\n error?: string;\n access?: \"read-only\" | \"read-write\";\n }>;\n}\n\n/**\n * A connector that failed to connect, as returned by\n * `ConnectorManager.listFailedConnectors()`.\n *\n * A failed connector never enters the manager's active map, so it is absent\n * from `listConnectors()` and `get()` by design — those describe what the agent\n * can actually use. This record is the second list that keeps the failure\n * itself visible.\n *\n * @docLink packages/connectors/concepts#connector-manager\n */\nexport interface FailedConnectorInfo {\n id: string;\n driver: string;\n access: \"read-only\" | \"read-write\";\n label?: string;\n /** `mount.source` when declared. */\n source?: string;\n /** Resolved absolute mount target, when the declaration has a mount. */\n mountPath?: string;\n /** True when the failure is fail-fast material: read-write AND mount-bearing. */\n required: boolean;\n /** The connect error message. */\n error: string;\n /** Present when the host declared the connector unavailable; no connect was attempted. */\n unavailable?: UnavailableMarker;\n}\n\n/**\n * Thrown by `connectAll` when a read-write mountable connector fails and\n * `failOnReadWriteError` was set.\n * @docLink packages/connectors/concepts#connector-startup-error\n */\nexport class ConnectorStartupError extends Error {\n readonly report: ConnectorStartupReport;\n readonly failedReadWrite: ReadonlyArray<{ id: string; error: string }>;\n constructor(\n message: string,\n report: ConnectorStartupReport,\n failedReadWrite: ReadonlyArray<{ id: string; error: string }>,\n ) {\n super(message);\n this.name = \"ConnectorStartupError\";\n this.report = report;\n this.failedReadWrite = failedReadWrite;\n }\n}\n","/**\n * Derive runtime connector declarations from the platform-materialized\n * `.skaile/assets/connector/<name>/CONNECTOR.md` projection.\n *\n * Connector mirror of MCP's `loadMaterializedMcpDeclarations` /\n * `deriveSingleMaterializedMcpDeclaration`. The generated `CONNECTOR.md` carries\n * a RUNTIME declaration (driver/access/auth/mode/options/mount) — distinct from\n * the catalog `CONNECTOR.md` parsed by `core/manifest.ts:fromConnectorMd`\n * (entry/fields). Driver is referenced by name (first-party; resolved via the\n * connector registry — no code-loading).\n */\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n// Narrow module, not the `core` barrel: the barrel's chunks carry `import.meta`,\n// which breaks consumers that transpile this entry to CommonJS.\nimport { parseFrontmatter } from \"../../core/src/manifest.js\";\nimport type { ConnectorDeclaration } from \"./connector-types.js\";\n\n/** Parse a generated CONNECTOR.md (runtime projection) into a ConnectorDeclaration. */\nexport function fromMaterializedConnectorMd(filePath: string, name: string): ConnectorDeclaration {\n const { data: meta, body } = parseFrontmatter(readFileSync(filePath, \"utf8\"));\n const id = String(meta.name ?? name);\n const decl: ConnectorDeclaration = {\n id,\n driver: String(meta.driver ?? \"\"),\n access: meta.access === \"read-write\" ? \"read-write\" : \"read-only\",\n };\n if (meta.access !== \"read-write\" && meta.access !== \"read-only\") decl.accessDefaulted = true;\n if (typeof meta.label === \"string\" && meta.label) decl.label = meta.label;\n if (typeof meta.auth === \"string\") decl.auth = meta.auth;\n if (typeof meta.providerLinkId === \"string\" && meta.providerLinkId) {\n decl.providerLinkId = meta.providerLinkId;\n }\n if (meta.mode === \"agent\" || meta.mode === \"sync\") decl.mode = meta.mode;\n if (meta.options && typeof meta.options === \"object\" && !Array.isArray(meta.options)) {\n decl.options = meta.options as Record<string, unknown>;\n }\n if (meta.mount && typeof meta.mount === \"object\" && !Array.isArray(meta.mount)) {\n const m = meta.mount as Record<string, unknown>;\n decl.mount = {\n source: String(m.source ?? \"\"),\n ...(m.target !== undefined ? { target: String(m.target) } : {}),\n ...(typeof m.watch === \"boolean\" ? { watch: m.watch } : {}),\n ...(typeof m.exposeAccessToken === \"boolean\"\n ? { exposeAccessToken: m.exposeAccessToken }\n : {}),\n ...(typeof m.accessTokenTTL === \"number\" ? { accessTokenTTL: m.accessTokenTTL } : {}),\n };\n }\n const trimmedBody = body.trim();\n if (trimmedBody.length > 0) decl.instructions = trimmedBody;\n return decl;\n}\n\n/** Provide `.instance.json` config entries as defaults under the declaration's options (the CONNECTOR.md declaration wins on key collision). */\nfunction foldInstanceConfig(decl: ConnectorDeclaration, instancePath: string): void {\n if (!existsSync(instancePath)) return;\n let parsed: { config?: Record<string, unknown> };\n try {\n parsed = JSON.parse(readFileSync(instancePath, \"utf8\"));\n } catch {\n return;\n }\n const config = parsed.config;\n if (!config || typeof config !== \"object\" || Array.isArray(config)) return;\n decl.options = { ...(config as Record<string, unknown>), ...(decl.options ?? {}) };\n}\n\n/** Derive a single materialized connector declaration; null when no CONNECTOR.md. */\nexport function deriveSingleMaterializedConnectorDeclaration(\n connectorAssetsDir: string,\n name: string,\n): ConnectorDeclaration | null {\n const sub = join(connectorAssetsDir, name);\n const md = join(sub, \"CONNECTOR.md\");\n if (!existsSync(md)) return null;\n const decl = fromMaterializedConnectorMd(md, name);\n foldInstanceConfig(decl, join(sub, \".instance.json\"));\n return decl;\n}\n\n/** Scan `<projectDir>/.skaile/assets/connector/*` for materialized connectors. */\nexport function loadMaterializedConnectorDeclarations(projectDir: string): ConnectorDeclaration[] {\n const root = join(projectDir, \".skaile/assets/connector\");\n if (!existsSync(root)) return [];\n const out: ConnectorDeclaration[] = [];\n for (const name of readdirSync(root)) {\n try {\n const sub = join(root, name);\n if (!statSync(sub).isDirectory()) continue;\n const decl = deriveSingleMaterializedConnectorDeclaration(root, name);\n if (decl) out.push(decl);\n } catch {\n // Per-directory failure is isolated — one bad asset never aborts the scan.\n }\n }\n return out;\n}\n","/**\n * Secret provider abstraction.\n *\n * Decouples credential resolution from process.env so secrets can be\n * provisioned over the transport bridge instead of living in the\n * container's environment.\n */\n\n// Narrow module, not the `core/logging` barrel: it re-exports the SQLite sink,\n// whose `import.meta` breaks consumers that transpile this entry to CommonJS.\nimport { createLogger } from \"../../core/src/logging/create-logger.js\";\n\nconst log = createLogger({ kind: \"connector\", subkind: \"secrets\" });\n\n// ── Interfaces ──────────────────────────────────────────────────────────────\n\n/**\n * Read-only secret resolution. Adapters receive this interface.\n * @docLink packages/connectors/api-reference#secret-provider\n */\nexport interface SecretProvider {\n /**\n * Resolve a credential reference.\n *\n * @param ref - Credential reference such as \"env:GIT_TOKEN\",\n * \"oauth:google:user@example.com\", or an inline literal.\n * @returns The resolved secret value or undefined if not found.\n */\n resolve(ref: string): string | undefined;\n /**\n * Check whether a reference can be resolved.\n *\n * @param ref - Reference to check.\n * @returns True if resolve(ref) would return a non-undefined value.\n */\n has(ref: string): boolean;\n /**\n * Return all ref strings this provider can currently resolve.\n *\n * @returns All resolvable refs (used by forge UI and ConnectorFieldMissingError).\n */\n capabilities(): string[];\n}\n\n/**\n * Extends `SecretProvider` with the ability to load secrets at runtime via `provision()`.\n * @docLink packages/connectors/api-reference#provisionable-secret-provider\n */\nexport interface ProvisionableSecretProvider extends SecretProvider {\n /** Store a batch of key-value secrets. Keys are bare names (no prefix). */\n provision(secrets: Record<string, string>): void;\n}\n\n// ── Implementations ─────────────────────────────────────────────────────────\n\n/**\n * In-memory secret store. Secrets are provisioned over the transport bridge\n * and stored in a private Map — never touching the filesystem or process.env.\n *\n * Supports ref prefixes:\n * `\"env:KEY\"` — looks up KEY in the store\n * `\"vault:KEY\"` — looks up KEY in the store (future vault compat)\n * (no prefix) — returned as an inline value (backwards compat for non-chain usages)\n * @docLink packages/connectors/api-reference#in-memory-secret-provider\n */\nexport class InMemorySecretProvider implements ProvisionableSecretProvider {\n private readonly store = new Map<string, string>();\n\n /**\n * Store a batch of key-value secrets.\n *\n * @param secrets - Key-value map of secret names to values. Keys are bare names (no prefix).\n */\n provision(secrets: Record<string, string>): void {\n for (const [key, value] of Object.entries(secrets)) {\n this.store.set(key, value);\n }\n }\n\n resolve(ref: string): string | undefined {\n if (!ref) return undefined;\n if (ref.startsWith(\"env:\")) return this.store.get(ref.slice(4));\n if (ref.startsWith(\"vault:\")) return this.store.get(ref.slice(6));\n // Bare key: check store first, then fall back to inline literal\n const stored = this.store.get(ref);\n if (stored !== undefined) return stored;\n return ref;\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n return [...this.store.keys()].map((k) => `env:${k}`);\n }\n}\n\n/**\n * Delegates to `process.env`. Used in CLI/standalone mode.\n * Does NOT pass through inline literals — returns `undefined` for any ref\n * that does not start with `\"env:\"`. Use `InMemorySecretProvider` for inline\n * literals in non-chain contexts.\n * @docLink packages/connectors/api-reference#env-secret-provider\n */\nexport class EnvSecretProvider implements SecretProvider {\n resolve(ref: string): string | undefined {\n if (!ref) return undefined;\n if (ref.startsWith(\"env:\")) return process.env[ref.slice(4)];\n return undefined; // no inline passthrough\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n return Object.keys(process.env).map((k) => `env:${k}`);\n }\n}\n\n/**\n * Pre-minted credential entry. Mirrors the discriminated `CredentialMint`\n * shape from `@skaile/workspaces/types` but redeclared here to keep this package\n * free of cross-package type dependencies.\n *\n * The failure branch carries the platform-side `code` + `message` so the\n * `ConnectorManager`'s wrapped mediator can surface the real reason instead of\n * a generic \"no pre-mint\" placeholder when a mint comes back as `ok: false`.\n */\nexport type PreMintedCredential =\n | { ok: true; token: string; expiresAt: string | null; mintedAt?: string }\n | {\n ok: false;\n code?: \"not-configured\" | \"revoked\" | \"provider-error\" | \"backend-error\";\n message?: string;\n };\n\n/**\n * Pre-minted credential store. Holds short-lived tokens delivered upfront in\n * the v3 `session_init` envelope so the runner never has to call back to the\n * platform during mount setup.\n *\n * Resolves refs of the form `mount:<id>`, `connector:<id>`, and `mcp:<id>`.\n * Returns `undefined` for any other ref so the chain falls through to the\n * next provider (`EnvSecretProvider` for `pat:env:NAME`, etc.).\n *\n * Tokens can be added/removed at runtime via {@link set} / {@link unset} so\n * `runner.add_mount` / `runner.add_connector` / `runner.add_mcp` capabilities\n * stay strictly in-process — no round trip to the platform to mint while\n * the resource is hot-attached.\n *\n * For callers that need the full mint metadata (expiry timestamp, mintedAt\n * audit fields), use {@link mintFor} instead of the bare `resolve`. The\n * `ConnectorManager` consults this for the `auth: backend` initial-mint path so\n * the driver retains the original expiry semantics.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`.\n *\n * @docLink packages/connectors/api-reference#pre-minted-secret-provider\n */\nexport class PreMintedSecretProvider implements SecretProvider {\n private readonly mints = new Map<string, PreMintedCredential>();\n\n /**\n * Seed pre-minted credentials from the v3 `session_init.credentials` map.\n *\n * Failed mints (`ok: false`) are stored too so callers can distinguish\n * \"not pre-minted\" from \"pre-minted but failed\"; {@link resolve} treats\n * both as `undefined`.\n *\n * @param credentials Optional initial `{ mounts, connectors, mcp }` map.\n */\n constructor(credentials?: {\n mounts?: Record<string, PreMintedCredential>;\n connectors?: Record<string, PreMintedCredential>;\n mcp?: Record<string, PreMintedCredential>;\n }) {\n if (!credentials) return;\n for (const [id, mint] of Object.entries(credentials.mounts ?? {})) {\n this.mints.set(`mount:${id}`, mint);\n }\n for (const [id, mint] of Object.entries(credentials.connectors ?? {})) {\n this.mints.set(`connector:${id}`, mint);\n }\n for (const [id, mint] of Object.entries(credentials.mcp ?? {})) {\n this.mints.set(`mcp:${id}`, mint);\n }\n }\n\n /**\n * Insert (or replace) a pre-minted credential. Used by\n * `runner.add_mount` / `runner.add_connector` / `runner.add_mcp` capability\n * handlers when the platform delivers new credentials mid-session.\n */\n set(kind: \"mount\" | \"connector\" | \"mcp\", id: string, mint: PreMintedCredential): void {\n this.mints.set(`${kind}:${id}`, mint);\n }\n\n /**\n * Remove a stored pre-minted credential. Used by the\n * `runner.remove_resource` capability handler.\n */\n unset(kind: \"mount\" | \"connector\" | \"mcp\", id: string): boolean {\n return this.mints.delete(`${kind}:${id}`);\n }\n\n /**\n * Look up the full {@link PreMintedCredential} for a `mount:` /\n * `connector:` / `mcp:` keyed entry. Callers that only need the token use\n * {@link resolve} via the chain; callers that need expiry / audit\n * metadata (e.g. ConnectorManager) use this entry point.\n */\n mintFor(kind: \"mount\" | \"connector\" | \"mcp\", id: string): PreMintedCredential | undefined {\n return this.mints.get(`${kind}:${id}`);\n }\n\n resolve(ref: string): string | undefined {\n if (!ref) return undefined;\n if (!(ref.startsWith(\"mount:\") || ref.startsWith(\"connector:\") || ref.startsWith(\"mcp:\")))\n return undefined;\n const mint = this.mints.get(ref);\n return mint?.ok ? mint.token : undefined;\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n return [...this.mints.entries()].filter(([, m]) => m.ok).map(([k]) => k);\n }\n}\n\n/**\n * Forge session secret provider. Secrets are provisioned from the Forge settings\n * panel over the transport bridge. Only handles `\"forge:\"` prefixed refs — returns\n * `undefined` for all others.\n * @docLink packages/connectors/api-reference#forge-secret-provider\n */\nexport class ForgeSecretProvider implements ProvisionableSecretProvider {\n private readonly store = new Map<string, string>();\n\n provision(secrets: Record<string, string>): void {\n for (const [key, value] of Object.entries(secrets)) {\n this.store.set(key, value);\n }\n }\n\n resolve(ref: string): string | undefined {\n if (!ref) return undefined;\n if (ref.startsWith(\"forge:\")) return this.store.get(ref.slice(6));\n return undefined;\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n return [...this.store.keys()].map((k) => `forge:${k}`);\n }\n}\n\n/**\n * Thrown when an OAuth-secured connector field requires user authorization before\n * it can be resolved. Contains the redirect URL to open in the user's browser.\n * @docLink packages/connectors/api-reference#o-auth-required-error\n */\nexport class OAuthRequiredError extends Error {\n readonly oauthRef: string;\n readonly authUrl: string;\n readonly state: string;\n\n /**\n * @param oauthRef - The 'oauth:<service>:<account>' ref that triggered the error\n * @param authUrl - Browser URL to open for OAuth authorization\n * @param state - OAuth state token for CSRF protection and callback correlation\n */\n constructor(oauthRef: string, authUrl: string, state: string) {\n super(`OAuth authorization required for ${oauthRef}`);\n this.name = \"OAuthRequiredError\";\n this.oauthRef = oauthRef;\n this.authUrl = authUrl;\n this.state = state;\n }\n}\n\n/**\n * Shape of an OAuth token bundle stored by `OAuthSecretProvider`.\n * @docLink packages/connectors/api-reference#o-auth-token-bundle\n */\nexport interface OAuthTokenBundle {\n accessToken: string;\n refreshToken?: string;\n /** Unix timestamp in ms */\n expiry?: number;\n}\n\n/**\n * Return value of `OAuthSecretProvider.initiateFlow()`. Contains the URL and CSRF state token.\n * @docLink packages/connectors/api-reference#o-auth-flow-request\n */\nexport interface OAuthFlowRequest {\n authUrl: string;\n state: string;\n}\n\n/**\n * OAuth token provider. Handles `\"oauth:<service>:<account>\"` refs.\n * Callers must call `chain.prepareRef()` before `chain.resolve()` for `oauth:` refs.\n * @docLink packages/connectors/api-reference#o-auth-secret-provider\n */\nexport interface OAuthSecretProvider extends SecretProvider {\n /**\n * Ensure the token for this ref is fresh.\n * Refreshes if expired.\n * Throws OAuthRequiredError if no token exists and user authorization is needed.\n */\n ensureFresh(ref: string): Promise<void>;\n\n /** Initiate the OAuth authorization flow. Returns URL to open in the user's browser. */\n initiateFlow(oauthService: string, account: string): Promise<OAuthFlowRequest>;\n\n /** Exchange authorization code for tokens and store the bundle. */\n completeFlow(state: string, code: string): Promise<void>;\n}\n\n/**\n * Abstract base for vault-backed secret providers (1Password, KeePass). Subclasses\n * implement `prefix` and `loadKeys()`. Locked until `unlock(credential)` is called.\n * @docLink packages/connectors/api-reference#locked-secret-provider\n */\nexport abstract class LockedSecretProvider implements SecretProvider {\n locked = true;\n protected readonly store = new Map<string, string>();\n abstract readonly prefix: string;\n\n async unlock(credential: string): Promise<void> {\n await this.loadKeys(credential);\n this.locked = false;\n }\n\n protected abstract loadKeys(credential: string): Promise<void>;\n\n resolve(ref: string): string | undefined {\n if (this.locked) return undefined;\n if (!ref.startsWith(this.prefix)) return undefined;\n return this.store.get(ref.slice(this.prefix.length));\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n if (this.locked) return [];\n return [...this.store.keys()].map((k) => `${this.prefix}${k}`);\n }\n}\n\n// ── Known provider prefixes ──────────────────────────────────────────────────\n\nconst KNOWN_PREFIXES = [\n \"env:\",\n \"vault:\",\n \"forge:\",\n \"op:\",\n \"kp:\",\n \"oauth:\",\n \"mount:\",\n \"connector:\",\n \"mcp:\",\n] as const;\n\nfunction getPrefix(ref: string): string | undefined {\n return KNOWN_PREFIXES.find((p) => ref.startsWith(p));\n}\n\n/**\n * True when `value` starts with a known secret-ref prefix (`env:`, `oauth:`,\n * `mcp:`, ...). Lets callers distinguish an intended-but-unresolved ref from a\n * plain literal — e.g. the runner refuses to forward an unresolved ref into\n * MCP transport headers/env, where the literal would otherwise leak onto the\n * wire and produce a misleading upstream error.\n */\nexport function isKnownSecretRef(value: string): boolean {\n return getPrefix(value) !== undefined;\n}\n\n/**\n * Chains multiple `SecretProvider` instances into a single resolver.\n * - Prefixed refs (`env:`, `forge:`, `op:`, `kp:`, `oauth:`) are routed to the first provider that can resolve them.\n * - Bare refs waterfall through all providers in order.\n * - Plain literals in `skaile.yaml` options are NOT passed to the chain; `ConnectorManager` handles them before calling `resolve()`.\n * @docLink packages/connectors/api-reference#secret-provider-chain\n */\nexport class SecretProviderChain implements SecretProvider {\n /**\n * @param providers - Ordered list of providers. For prefixed refs, the first\n * provider that can resolve wins. For bare refs, waterfall through all in order.\n */\n constructor(private readonly providers: SecretProvider[]) {}\n\n resolve(ref: string): string | undefined {\n if (!ref) return undefined;\n const prefix = getPrefix(ref);\n log.debug(\"resolve secret\", { ref, prefix: prefix ?? \"(bare)\" });\n if (prefix) {\n for (const p of this.providers) {\n const val = p.resolve(ref);\n if (val !== undefined) return val;\n }\n log.warn(\"secret not resolvable\", { ref });\n return undefined;\n }\n // Waterfall for bare refs\n for (const p of this.providers) {\n const val = p.resolve(ref);\n if (val !== undefined) return val;\n }\n log.warn(\"secret not resolvable\", { ref });\n return undefined;\n }\n\n has(ref: string): boolean {\n return this.resolve(ref) !== undefined;\n }\n\n capabilities(): string[] {\n const all = this.providers.flatMap((p) => p.capabilities());\n return [...new Set(all)];\n }\n\n /** Returns the first provider that can resolve this ref. */\n providerFor(ref: string): SecretProvider | undefined {\n for (const p of this.providers) {\n if (p.resolve(ref) !== undefined) return p;\n }\n return undefined;\n }\n\n /**\n * Calls ensureFresh(ref) on the owning provider if it implements OAuthSecretProvider.\n * No-op for providers that don't have ensureFresh().\n *\n * @param ref - Must be an \"oauth:\" prefixed ref for this to have any effect.\n * Calls ensureFresh() on the owning OAuthSecretProvider.\n */\n async prepareRef(ref: string): Promise<void> {\n const owner = this.providerFor(ref);\n if (\n owner &&\n \"ensureFresh\" in owner &&\n typeof (owner as OAuthSecretProvider).ensureFresh === \"function\"\n ) {\n try {\n await (owner as OAuthSecretProvider).ensureFresh(ref);\n } catch (err) {\n log.error(\"secret provider ensureFresh failed\", err, { ref });\n throw err;\n }\n }\n }\n}\n","/**\n * Load connector declarations from skaile.yaml.\n *\n * The top-level `mounts:` key is no longer accepted (hard cut as of Task 11).\n * Filesystem-projected backends must be declared under `connectors:` with a\n * `mount:` sub-block. See `docs/migration-mounts-to-connectors.md`.\n */\n\nimport type { ResolvedSkaileConfig } from \"@skaile/workspaces/types\";\n// Narrow modules, not the `core` barrels: their chunks carry `import.meta`,\n// which breaks consumers that transpile this entry to CommonJS.\nimport { createLogger } from \"../../core/src/logging/create-logger.js\";\nimport {\n localConnectorMountDir,\n resolveSkWorkspaceConfig,\n type ConnectorDeclaration as WorkspaceConnector,\n} from \"../../core/src/workspace-config.js\";\nimport type { ConnectorDeclaration } from \"./connector-types.js\";\nimport { readUnavailableMarker } from \"./connector-types.js\";\nimport { loadMaterializedConnectorDeclarations } from \"./materialized-connectors.js\";\n\nconst configLog = createLogger({ kind: \"connector\", subkind: \"config\" });\n\n/**\n * Read `skaile.yaml` in `projectDir` and return all declared connectors as `ConnectorDeclaration[]`.\n *\n * Throws a migration error when the legacy top-level `mounts:` key is present.\n *\n * @param projectDir - Root of the workspace (directory containing `skaile.yaml`).\n * @returns Merged array of connector declarations from `skaile.yaml` and the materialized\n * `.skaile/assets/connector/*` disk projection (Phase 2.5); empty array if neither source\n * contributes any entries. `skaile.yaml` wins on id collision.\n * @docLink packages/connectors/api-reference#load-connector-declarations\n */\nexport function loadConnectorDeclarations(projectDir: string): ConnectorDeclaration[] {\n return withMaterializedConnectorDeclarations(\n loadYamlConnectorDeclarations(projectDir),\n projectDir,\n );\n}\n\n/**\n * The `skaile.yaml` half of {@link loadConnectorDeclarations}: only the `connectors:` entries,\n * without the materialized projection. The runner needs it on its own because in broker mode the\n * session root keeps materialized connectors across wakes while its yaml declares nothing, and the\n * `session_init` wire set must then stand in for the yaml half, not for both.\n *\n * Throws a migration error when the legacy top-level `mounts:` key is present.\n */\nexport function loadYamlConnectorDeclarations(projectDir: string): ConnectorDeclaration[] {\n const config = resolveSkWorkspaceConfig(projectDir);\n\n // Hard cut: reject legacy top-level `mounts:` key with an actionable message.\n if (config.mounts && config.mounts.length > 0) {\n throw new Error(\n \"'mounts:' is no longer supported — move entries under 'connectors:' with a 'mount:' sub-block. See docs/migration-mounts-to-connectors.md\",\n );\n }\n\n return config.connectors && config.connectors.length > 0\n ? config.connectors.map((c) => workspaceConnectorToDeclaration(c, projectDir))\n : [];\n}\n\n/**\n * Add the materialized `.skaile/assets/connector/*` projection to `base`. Library-assigned\n * connectors reach the runner only through that projection. `base` is explicit config (the\n * skaile.yaml entries, or the `session_init` wire set standing in for them) and wins on id\n * collision; the shadowed materialized connector is logged, not silently dropped.\n */\nexport function withMaterializedConnectorDeclarations(\n base: ConnectorDeclaration[],\n projectDir: string,\n): ConnectorDeclaration[] {\n const byId = new Map<string, ConnectorDeclaration>();\n for (const d of base) byId.set(d.id, d);\n for (const d of loadMaterializedConnectorDeclarations(projectDir)) {\n if (byId.has(d.id)) {\n configLog.warn(`materialized connector '${d.id}' shadowed by an explicit connector`);\n continue;\n }\n byId.set(d.id, d);\n }\n return [...byId.values()];\n}\n\nfunction workspaceConnectorToDeclaration(\n c: WorkspaceConnector,\n projectDir: string,\n): ConnectorDeclaration {\n const decl: ConnectorDeclaration = {\n id: c.id,\n driver: c.driver,\n access: c.access ?? \"read-only\",\n auth: c.auth,\n options: c.options,\n };\n if (c.access == null) decl.accessDefaulted = true;\n\n // Backend-auth routing key for live token refresh; dropping it breaks git mount mint.\n if (c.providerLinkId) decl.providerLinkId = c.providerLinkId;\n\n const unavailable = readUnavailableMarker(c.unavailable);\n if (unavailable) decl.unavailable = unavailable;\n\n // Map the optional mount sub-block when present.\n if (c.mount) {\n decl.mount = {\n source: c.mount.source,\n target: c.mount.target,\n watch: c.mount.watch,\n exposeAccessToken: c.mount.exposeAccessToken,\n accessTokenTTL: c.mount.accessTokenTTL,\n };\n } else if (c.driver === \"local\") {\n // `mountPath:` names the host directory. An absolute source with no target makes the manager\n // bind the connector straight to it, so reads and writes land in that directory.\n const source = localConnectorMountDir(c, projectDir);\n if (source) decl.mount = { source };\n }\n\n return decl;\n}\n\n/**\n * Map a Protocol v3 `session_init` `resolvedConfig` to `ConnectorDeclaration[]`.\n *\n * Wire mounts are flat (`source` / `target` / `watch` top-level per\n * `ResolvedSkaileConfig`); declarations carry them in the `mount:` sub-block.\n * Wire `connectors` (tool-face) map without a mount block. Malformed entries\n * (missing `id`, `driver`, or — for mounts — `source`) are logged and dropped,\n * never thrown: one bad wire entry must not kill session boot. Duplicate ids\n * (within or across the two arrays) keep the FIRST occurrence — mounts precede\n * connectors — and the shadowed entry is logged and dropped the same way.\n *\n * Pure function, no I/O. Used by the runner in place of the `skaile.yaml`\n * entries when `skaile.yaml` declares no connectors (broker mode, where the\n * delivered yaml carries no declarations). Materialized connectors are added\n * on top either way.\n *\n * @param resolved - `mounts` / `connectors` arrays from the platform-resolved config.\n * @returns Declarations in wire order — mounts first, then connectors.\n * @docLink packages/connectors/api-reference#resolved-config-to-declarations\n */\nexport function resolvedConfigToDeclarations(\n resolved: Pick<ResolvedSkaileConfig, \"mounts\" | \"connectors\">,\n): ConnectorDeclaration[] {\n // Keyed by id: the wire carries no well-formedness guarantee, and a duplicate\n // id downstream would collide on mount paths / tool namespaces. First wins.\n const byId = new Map<string, ConnectorDeclaration>();\n const pushUnlessDuplicate = (kind: \"mount\" | \"connector\", decl: ConnectorDeclaration): void => {\n if (byId.has(decl.id)) {\n configLog.warn(`dropping duplicate resolvedConfig ${kind} (id already declared)`, {\n id: decl.id,\n });\n return;\n }\n byId.set(decl.id, decl);\n };\n\n for (const m of resolved.mounts ?? []) {\n // A mount without a source cannot connect — drop it with the malformed ones.\n if (\n typeof m?.id !== \"string\" ||\n typeof m?.driver !== \"string\" ||\n typeof m.source !== \"string\"\n ) {\n configLog.warn(\"dropping malformed resolvedConfig mount (missing id/driver/source)\", {\n id: (m as { id?: unknown } | undefined)?.id,\n });\n continue;\n }\n const decl: ConnectorDeclaration = {\n id: m.id,\n driver: m.driver,\n access: m.access ?? \"read-only\",\n ...(m.access == null ? { accessDefaulted: true as const } : {}),\n auth: m.auth,\n options: m.options,\n mount: {\n source: m.source,\n target: m.target,\n watch: m.watch,\n exposeAccessToken: m.exposeAccessToken,\n accessTokenTTL: m.accessTokenTTL,\n },\n };\n // Backend-auth routing key for live token refresh; dropping it breaks git mount mint.\n if (m.providerLinkId) decl.providerLinkId = m.providerLinkId;\n pushUnlessDuplicate(\"mount\", decl);\n }\n\n for (const c of resolved.connectors ?? []) {\n if (typeof c?.id !== \"string\" || typeof c?.driver !== \"string\") {\n configLog.warn(\"dropping malformed resolvedConfig connector (missing id/driver)\", {\n id: (c as { id?: unknown } | undefined)?.id,\n });\n continue;\n }\n const decl: ConnectorDeclaration = {\n id: c.id,\n driver: c.driver,\n access: c.access ?? \"read-only\",\n ...(c.access == null ? { accessDefaulted: true as const } : {}),\n auth: c.auth,\n options: c.options,\n };\n if (c.providerLinkId) decl.providerLinkId = c.providerLinkId;\n pushUnlessDuplicate(\"connector\", decl);\n }\n\n return [...byId.values()];\n}\n\nimport type { ForgeSecretProvider, SecretProvider } from \"./secrets.js\";\nimport { EnvSecretProvider, InMemorySecretProvider, SecretProviderChain } from \"./secrets.js\";\n\n/**\n * Build a `SecretProviderChain` for Forge session context.\n * `OAuthSecretProvider` is not wired here — it must be provided externally\n * (the Forge session manager constructs it and passes it in).\n * @param forgeProvider - The Forge-provisioned secret store.\n * @param extraProviders - Additional providers prepended to the chain (e.g. an OAuth provider).\n * @returns A chain that routes `forge:` refs to the Forge store and `env:` refs to process.env.\n * @docLink packages/connectors/api-reference#create-forge-secret-provider-chain\n */\nexport function createForgeSecretProviderChain(\n forgeProvider: ForgeSecretProvider,\n extraProviders: SecretProvider[] = [],\n): SecretProviderChain {\n return new SecretProviderChain([...extraProviders, forgeProvider, new EnvSecretProvider()]);\n}\n\n/**\n * Build a `SecretProviderChain` for CLI/standalone context.\n * `EnvSecretProvider` takes priority; `extraSecrets` are loaded into an `InMemorySecretProvider`.\n * @param extraSecrets - Inline secrets injected into memory (e.g. tokens passed via CLI flags).\n * @returns A chain that resolves `env:` refs from process.env plus any inline extras.\n * @docLink packages/connectors/api-reference#create-cli-secret-provider-chain\n */\nexport function createCliSecretProviderChain(\n extraSecrets: Record<string, string> = {},\n): SecretProviderChain {\n const mem = new InMemorySecretProvider();\n if (Object.keys(extraSecrets).length > 0) {\n mem.provision(extraSecrets);\n }\n return new SecretProviderChain([new EnvSecretProvider(), mem]);\n}\n\n// ── Auth grammar (mount-side, Tier 2 credential tiers) ───────────────────────\n\n/**\n * Provider kind for a mount auth ref.\n *\n * Two values are accepted:\n * - `pat` — static personal access token resolved via the secrets chain\n * (standalone CLI / non-platform contexts).\n * - `backend` — token minted by the platform's credential mediator over the\n * transport (`request_access_token` round-trip). Provider\n * dispatch (OAuth, GitHub App, ...) lives backend-side; the\n * runner stays provider-agnostic.\n *\n * @docLink packages/connectors/api-reference#mount-auth-kind\n */\nexport type MountAuthKind = \"pat\" | \"backend\";\n\n/**\n * Parsed mount `auth:` field.\n *\n * - `pat` → `value` is the inner secret ref (e.g. `env:NAME`).\n * - `backend` → `value` is empty (sentinel only); the runner asks the\n * backend for tokens via `request_access_token`.\n *\n * @docLink packages/connectors/api-reference#mount-auth-ref\n */\nexport interface MountAuthRef {\n kind: MountAuthKind;\n /** Prefix-stripped payload — see kind for shape. Empty for `backend`. */\n value: string;\n /** Original auth string from the declaration, kept for diagnostics. */\n raw: string;\n}\n\n/**\n * Thrown when a mount declaration's `auth:` field uses the legacy bare `env:NAME` grammar\n * or any other unrecognized form. Migrate to `pat:env:NAME` (standalone) or `backend`\n * (platform-mediated).\n * @docLink packages/connectors/api-reference#legacy-auth-grammar-error\n */\nexport class LegacyAuthGrammarError extends Error {\n readonly auth: string;\n constructor(auth: string, mountId?: string) {\n const where = mountId ? ` on mount '${mountId}'` : \"\";\n super(\n `Legacy or unrecognized auth grammar${where} ('${auth}'). ` +\n `Replace with one of:\\n` +\n ` - backend (platform-mediated, recommended)\\n` +\n ` - pat:env:NAME (standalone CLI / static token)\\n` +\n `See _devlog/specs/2026-05-06-tier-2-credential-mediation.md.`,\n );\n this.name = \"LegacyAuthGrammarError\";\n this.auth = auth;\n }\n}\n\n/**\n * Resolve the `auth: backend` initial mint for a given mount or connector id\n * by querying the secrets chain with a `${kind}:${id}` ref. Returns the\n * resolved bearer token or `undefined` if no pre-minted credential is\n * available.\n *\n * Used by the runner when wiring `ConnectorManager` to\n * answer initial-mint requests from `PreMintedSecretProvider` without\n * round-tripping to the platform. Drivers continue to receive a\n * `tokenMediator` for refresh + retry-401 paths.\n *\n * @param kind Resource family (`mount` or `connector`).\n * @param id Resource declaration id.\n * @param chain Secrets chain. Pass `undefined` to return `undefined`.\n * @returns The pre-minted token, or `undefined` if not stored on the chain.\n * @docLink packages/connectors/api-reference#resolve-backend-auth-for\n */\nexport function resolveBackendAuthFor(\n kind: \"mount\" | \"connector\",\n id: string,\n chain: import(\"./secrets.js\").SecretProvider | undefined,\n): string | undefined {\n if (!chain) return undefined;\n return chain.resolve(`${kind}:${id}`);\n}\n\n/**\n * Parse a mount-side auth ref into a typed `MountAuthRef`.\n *\n * Accepted forms:\n * - `backend` — platform-mediated mint via `request_access_token`.\n * - `pat:env:NAME` — static PAT resolved from the secrets chain.\n *\n * Rejects bare `env:NAME` (legacy) and provider-prefixed grammars (`oauth:`,\n * `github-app:`) — those moved backend-side as part of Tier-2 mediation.\n * Returns `undefined` when `auth` is absent or empty.\n *\n * @param auth - Raw `auth:` value from the mount declaration.\n * @param mountId - Optional mount id included in error messages.\n * @returns Parsed `MountAuthRef` or `undefined`.\n * @throws {LegacyAuthGrammarError} for any unrecognized grammar.\n * @docLink packages/connectors/api-reference#resolve-auth-ref\n */\nexport function resolveAuthRef(\n auth: string | undefined,\n mountId?: string,\n): MountAuthRef | undefined {\n if (!auth) return undefined;\n\n if (auth === \"backend\") {\n return { kind: \"backend\", value: \"\", raw: auth };\n }\n if (auth.startsWith(\"pat:\")) {\n return { kind: \"pat\", value: auth.slice(\"pat:\".length), raw: auth };\n }\n\n // Legacy bare `env:NAME` and the deprecated provider-prefixed grammars\n // (`oauth:`, `github-app:`) all land here.\n throw new LegacyAuthGrammarError(auth, mountId);\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;AA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I,CAAA;AAClF,QAAA,MAAM,KAAK,QAAA,IAAY,KAAA,GAAQ,cAAA,CAAe,KAAA,EAAO,QAAQ,CAAA,GAAI,KAAA,CAAA;AACjE,QAAA,MAAA,CAAO,KAAK,EAAA,GAAK,MAAA,CAAO,CAAA,CAAE,IAAA,EAAM,IAAI,CAAA,CAAE,IAAA,EAAM,CAAA,CAAE,OAAO,IAAI,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,CAAE,CAAA;AAAA,MAChF,SAAS,GAAA,EAAK;AACZ,QAAA,MAAA;AAAA,UACE,CAAA,eAAA,EAAkB,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,SACzF;AAAA,MACF;AAAA,IACF;AAEA,IAAA,KAAA,CAAM,CAAA,OAAA,EAAU,MAAA,CAAO,MAAM,CAAA,UAAA,CAAY,CAAA;AACzC,IAAA,KAAA,MAAW,CAAA,IAAK,MAAA,EAAQ,OAAA,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAAA,EAC1C,CAAA,SAAE;AACA,IAAA,KAAA,EAAM;AAAA,EACR;AACF","file":"library-publish-B5HL4OBE.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"]}