@skaile/workspaces 5.10.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +12 -0
  3. package/dist/{asset-feeds-ELEBTNUS.js → asset-feeds-CXGQIDFR.js} +18 -18
  4. package/dist/{asset-feeds-ELEBTNUS.js.map → asset-feeds-CXGQIDFR.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +7 -7
  6. package/dist/asset-manager/index.js +13 -13
  7. package/dist/asset-manager/installer.js +9 -9
  8. package/dist/asset-manager/renderers.js +8 -8
  9. package/dist/asset-manager/src/index.d.ts +103 -2
  10. package/dist/asset-manager/src/index.d.ts.map +1 -1
  11. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  12. package/dist/asset-manager/src/installer.d.ts +23 -3
  13. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  14. package/dist/bridge/drivers/claude-sdk.js +10 -10
  15. package/dist/bridge/drivers/codex.js +9 -9
  16. package/dist/bridge/drivers/continue.js +9 -9
  17. package/dist/bridge/drivers/echo.js +1 -1
  18. package/dist/bridge/drivers/gemini.js +6 -6
  19. package/dist/bridge/drivers/goose.js +9 -9
  20. package/dist/bridge/drivers/omp.js +18 -2
  21. package/dist/bridge/drivers/omp.js.map +1 -1
  22. package/dist/bridge/drivers/opencode.js +9 -9
  23. package/dist/bridge/drivers/qwen.js +6 -6
  24. package/dist/bridge/index.js +11 -11
  25. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  26. package/dist/{chunk-3BEY4WK3.js → chunk-2F5AWQX5.js} +77 -11
  27. package/dist/chunk-2F5AWQX5.js.map +1 -0
  28. package/dist/{chunk-IJHH4DSW.js → chunk-3SM2DL2T.js} +8 -8
  29. package/dist/{chunk-IJHH4DSW.js.map → chunk-3SM2DL2T.js.map} +1 -1
  30. package/dist/{chunk-HJ5MCB3L.js → chunk-47U4GZ4M.js} +2 -2
  31. package/dist/{chunk-HJ5MCB3L.js.map → chunk-47U4GZ4M.js.map} +1 -1
  32. package/dist/{chunk-7CR6HT2X.js → chunk-4A4OD24G.js} +9 -9
  33. package/dist/{chunk-7CR6HT2X.js.map → chunk-4A4OD24G.js.map} +1 -1
  34. package/dist/{chunk-5QI2JYJC.js → chunk-6O2X3GPW.js} +2 -2
  35. package/dist/{chunk-5QI2JYJC.js.map → chunk-6O2X3GPW.js.map} +1 -1
  36. package/dist/{chunk-JZCSNEHK.js → chunk-ALEYHUC5.js} +42 -20
  37. package/dist/chunk-ALEYHUC5.js.map +1 -0
  38. package/dist/{chunk-4OV5DSBB.js → chunk-BNMZVPYA.js} +5 -5
  39. package/dist/chunk-BNMZVPYA.js.map +1 -0
  40. package/dist/{chunk-SBFW3CJH.js → chunk-CAHB6MHA.js} +5 -5
  41. package/dist/{chunk-SBFW3CJH.js.map → chunk-CAHB6MHA.js.map} +1 -1
  42. package/dist/{chunk-4P3KTUZH.js → chunk-CJERAGFY.js} +24 -13
  43. package/dist/chunk-CJERAGFY.js.map +1 -0
  44. package/dist/{chunk-MVQ3Q2HM.js → chunk-COH6FQAG.js} +4 -4
  45. package/dist/{chunk-MVQ3Q2HM.js.map → chunk-COH6FQAG.js.map} +1 -1
  46. package/dist/{chunk-ZGQTS3Y4.js → chunk-CPWLNZGJ.js} +3 -3
  47. package/dist/{chunk-ZGQTS3Y4.js.map → chunk-CPWLNZGJ.js.map} +1 -1
  48. package/dist/{chunk-MGGFBZWA.js → chunk-D3B36CYC.js} +4 -3
  49. package/dist/chunk-D3B36CYC.js.map +1 -0
  50. package/dist/{chunk-2JMLDZLP.js → chunk-DZMNFCWB.js} +416 -55
  51. package/dist/chunk-DZMNFCWB.js.map +1 -0
  52. package/dist/{chunk-GFCXNFTW.js → chunk-EDYHEMJA.js} +4 -4
  53. package/dist/{chunk-GFCXNFTW.js.map → chunk-EDYHEMJA.js.map} +1 -1
  54. package/dist/{chunk-PE36IF2D.js → chunk-FH7W6TJ4.js} +65 -31
  55. package/dist/chunk-FH7W6TJ4.js.map +1 -0
  56. package/dist/{chunk-G54USEUP.js → chunk-G4FFOV3N.js} +4 -4
  57. package/dist/{chunk-G54USEUP.js.map → chunk-G4FFOV3N.js.map} +1 -1
  58. package/dist/{chunk-HOHUEKES.js → chunk-GCHPUTA3.js} +3 -3
  59. package/dist/{chunk-HOHUEKES.js.map → chunk-GCHPUTA3.js.map} +1 -1
  60. package/dist/{chunk-TRSQP3JD.js → chunk-GV4DZ6MT.js} +20 -4
  61. package/dist/chunk-GV4DZ6MT.js.map +1 -0
  62. package/dist/{chunk-QG3HOJEK.js → chunk-HCEVNYSH.js} +3 -3
  63. package/dist/{chunk-QG3HOJEK.js.map → chunk-HCEVNYSH.js.map} +1 -1
  64. package/dist/{chunk-6HHE63CO.js → chunk-HZXUXHIV.js} +4 -4
  65. package/dist/{chunk-6HHE63CO.js.map → chunk-HZXUXHIV.js.map} +1 -1
  66. package/dist/{chunk-FRPBSUFH.js → chunk-IER3KIPH.js} +5 -5
  67. package/dist/{chunk-FRPBSUFH.js.map → chunk-IER3KIPH.js.map} +1 -1
  68. package/dist/{chunk-GEWAIQZ5.js → chunk-J4RBUFGM.js} +10 -12
  69. package/dist/chunk-J4RBUFGM.js.map +1 -0
  70. package/dist/{chunk-OOWHXOK6.js → chunk-M3B6EIJD.js} +4 -4
  71. package/dist/{chunk-OOWHXOK6.js.map → chunk-M3B6EIJD.js.map} +1 -1
  72. package/dist/{chunk-VLXDXRRX.js → chunk-MZG34MBZ.js} +3 -3
  73. package/dist/{chunk-VLXDXRRX.js.map → chunk-MZG34MBZ.js.map} +1 -1
  74. package/dist/{chunk-2FMEGSBN.js → chunk-PBBPZYVG.js} +31 -9
  75. package/dist/chunk-PBBPZYVG.js.map +1 -0
  76. package/dist/{chunk-CLTHEKHR.js → chunk-PQFHMQHQ.js} +4 -4
  77. package/dist/{chunk-CLTHEKHR.js.map → chunk-PQFHMQHQ.js.map} +1 -1
  78. package/dist/{chunk-SX5U422E.js → chunk-QVFAS5IO.js} +3 -3
  79. package/dist/{chunk-SX5U422E.js.map → chunk-QVFAS5IO.js.map} +1 -1
  80. package/dist/{chunk-JFXQEVLF.js → chunk-QZNJOHN6.js} +3 -3
  81. package/dist/{chunk-JFXQEVLF.js.map → chunk-QZNJOHN6.js.map} +1 -1
  82. package/dist/{chunk-V5TZH4GF.js → chunk-R7NHYEJF.js} +4 -4
  83. package/dist/{chunk-V5TZH4GF.js.map → chunk-R7NHYEJF.js.map} +1 -1
  84. package/dist/{chunk-V7PQZOBR.js → chunk-RYYLMBA2.js} +5 -5
  85. package/dist/{chunk-V7PQZOBR.js.map → chunk-RYYLMBA2.js.map} +1 -1
  86. package/dist/{chunk-WBYDAL6X.js → chunk-S3O3GKB7.js} +4 -4
  87. package/dist/{chunk-WBYDAL6X.js.map → chunk-S3O3GKB7.js.map} +1 -1
  88. package/dist/{chunk-Y34MSWEZ.js → chunk-SBSA3IQA.js} +3 -3
  89. package/dist/{chunk-Y34MSWEZ.js.map → chunk-SBSA3IQA.js.map} +1 -1
  90. package/dist/{chunk-Y63UQZ7P.js → chunk-T42WRQ4O.js} +3 -3
  91. package/dist/{chunk-Y63UQZ7P.js.map → chunk-T42WRQ4O.js.map} +1 -1
  92. package/dist/{chunk-OBVJ7RPW.js → chunk-T7CTHHG7.js} +3 -3
  93. package/dist/{chunk-OBVJ7RPW.js.map → chunk-T7CTHHG7.js.map} +1 -1
  94. package/dist/{chunk-7I5VRVDP.js → chunk-TCHRMVTO.js} +4 -4
  95. package/dist/{chunk-7I5VRVDP.js.map → chunk-TCHRMVTO.js.map} +1 -1
  96. package/dist/{chunk-NRDSGLCQ.js → chunk-VLTQGE2E.js} +65 -22
  97. package/dist/chunk-VLTQGE2E.js.map +1 -0
  98. package/dist/{chunk-Z2K6BGUR.js → chunk-WSBKB4CJ.js} +13 -13
  99. package/dist/{chunk-Z2K6BGUR.js.map → chunk-WSBKB4CJ.js.map} +1 -1
  100. package/dist/{chunk-3MKPZZRE.js → chunk-X77SUM4P.js} +3 -3
  101. package/dist/{chunk-3MKPZZRE.js.map → chunk-X77SUM4P.js.map} +1 -1
  102. package/dist/{chunk-XCNK4UE5.js → chunk-XDKH7XSA.js} +5 -5
  103. package/dist/{chunk-XCNK4UE5.js.map → chunk-XDKH7XSA.js.map} +1 -1
  104. package/dist/{chunk-TH4CTXHX.js → chunk-XUSALIEI.js} +6 -6
  105. package/dist/{chunk-TH4CTXHX.js.map → chunk-XUSALIEI.js.map} +1 -1
  106. package/dist/{chunk-3KHYGOEY.js → chunk-Y3HTGHJC.js} +3 -3
  107. package/dist/{chunk-3KHYGOEY.js.map → chunk-Y3HTGHJC.js.map} +1 -1
  108. package/dist/{chunk-YBQONMH2.js → chunk-YOH2L76X.js} +90 -50
  109. package/dist/chunk-YOH2L76X.js.map +1 -0
  110. package/dist/{chunk-32XKCNCL.js → chunk-ZCAJZ4B2.js} +3 -3
  111. package/dist/chunk-ZCAJZ4B2.js.map +1 -0
  112. package/dist/{chunk-IXWODEED.js → chunk-ZPWTOUTK.js} +43 -7
  113. package/dist/chunk-ZPWTOUTK.js.map +1 -0
  114. package/dist/cli/index.js +210 -163
  115. package/dist/cli/index.js.map +1 -1
  116. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  117. package/dist/cli/src/commands/diff.d.ts +1 -1
  118. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  119. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  120. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  121. package/dist/cli/src/commands/manage.d.ts +6 -0
  122. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  123. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  124. package/dist/cli/src/commands/project.d.ts +3 -1
  125. package/dist/cli/src/commands/project.d.ts.map +1 -1
  126. package/dist/cli/src/commands/run.d.ts.map +1 -1
  127. package/dist/cli/src/commands/update.d.ts.map +1 -1
  128. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  129. package/dist/cli/src/commands/why.d.ts +1 -0
  130. package/dist/cli/src/commands/why.d.ts.map +1 -1
  131. package/dist/cli/src/helpers.d.ts +12 -0
  132. package/dist/cli/src/helpers.d.ts.map +1 -1
  133. package/dist/cli/src/skill-checks.d.ts +14 -6
  134. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  135. package/dist/connectors/config.js +5 -5
  136. package/dist/connectors/index.js +15 -15
  137. package/dist/{connectors-OXP2JBGI.js → connectors-4QWAKPHB.js} +18 -18
  138. package/dist/{connectors-OXP2JBGI.js.map → connectors-4QWAKPHB.js.map} +1 -1
  139. package/dist/core/index.js +6 -6
  140. package/dist/core/manifest.js +2 -2
  141. package/dist/core/models.js +1 -1
  142. package/dist/core/publish-manifest.js +2 -2
  143. package/dist/core/ref.js +1 -1
  144. package/dist/core/runtime-assets.js +5 -5
  145. package/dist/core/src/lock.d.ts +4 -3
  146. package/dist/core/src/lock.d.ts.map +1 -1
  147. package/dist/core/src/models.d.ts +1 -1
  148. package/dist/core/src/models.d.ts.map +1 -1
  149. package/dist/core/src/publish-manifest.d.ts +11 -1
  150. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  151. package/dist/core/src/workspace-config.d.ts +4 -1
  152. package/dist/core/src/workspace-config.d.ts.map +1 -1
  153. package/dist/core/workspace-config.js +4 -4
  154. package/dist/deploy/index.js +6 -6
  155. package/dist/discovery/index.js +5 -5
  156. package/dist/discovery/src/source-config.d.ts.map +1 -1
  157. package/dist/{ensure-sources-5ISVIA4T.js → ensure-sources-2RONZKCU.js} +16 -16
  158. package/dist/{ensure-sources-5ISVIA4T.js.map → ensure-sources-2RONZKCU.js.map} +1 -1
  159. package/dist/factory-assets/connectors/box.js +15 -15
  160. package/dist/factory-assets/connectors/deploy.js +15 -15
  161. package/dist/factory-assets/connectors/devserver.js +15 -15
  162. package/dist/factory-assets/connectors/flow/adapter.js +15 -15
  163. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  164. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  165. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  166. package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
  167. package/dist/factory-assets/connectors/flow.js +15 -15
  168. package/dist/factory-assets/connectors/git.js +15 -15
  169. package/dist/factory-assets/connectors/gmail.js +15 -15
  170. package/dist/factory-assets/connectors/googledrive.js +15 -15
  171. package/dist/factory-assets/connectors/local.js +15 -15
  172. package/dist/factory-assets/connectors/mattermost.js +15 -15
  173. package/dist/factory-assets/connectors/memory.js +15 -15
  174. package/dist/factory-assets/connectors/minio.js +15 -15
  175. package/dist/factory-assets/connectors/postgres.js +15 -15
  176. package/dist/factory-assets/connectors/s3.js +15 -15
  177. package/dist/factory-assets/connectors/sharepoint.js +15 -15
  178. package/dist/factory-assets/connectors/sqlite.js +15 -15
  179. package/dist/factory-assets/connectors/static-server.js +15 -15
  180. package/dist/factory-assets/connectors/tunnel.js +15 -15
  181. package/dist/factory-assets/connectors/webdav.js +15 -15
  182. package/dist/factory-assets/connectors/xstate-store.js +15 -15
  183. package/dist/factory-assets/connectors/xstate.js +15 -15
  184. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +4 -2
  185. package/dist/{flows-HMSE76PO.js → flows-EQF2CH4U.js} +11 -11
  186. package/dist/{flows-HMSE76PO.js.map → flows-EQF2CH4U.js.map} +1 -1
  187. package/dist/{helpers-X6URBGSF.js → helpers-CFK6YP6R.js} +16 -16
  188. package/dist/{helpers-X6URBGSF.js.map → helpers-CFK6YP6R.js.map} +1 -1
  189. package/dist/library/index.js +10 -10
  190. package/dist/library/install.js +3 -3
  191. package/dist/library/src/index.d.ts +1 -1
  192. package/dist/library/src/index.d.ts.map +1 -1
  193. package/dist/library/src/local/library-dir.d.ts +26 -0
  194. package/dist/library/src/local/library-dir.d.ts.map +1 -1
  195. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  196. package/dist/library/src/sync/git-driver.d.ts +2 -0
  197. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  198. package/dist/{library-publish-OS3JDW4S.js → library-publish-53UTB3MB.js} +51 -24
  199. package/dist/library-publish-53UTB3MB.js.map +1 -0
  200. package/dist/open-library-BOSPJVID.js +40 -0
  201. package/dist/{open-library-4QSUORI6.js.map → open-library-BOSPJVID.js.map} +1 -1
  202. package/dist/open-registry-4FI7HKET.js +32 -0
  203. package/dist/{open-registry-VCKS3MP5.js.map → open-registry-4FI7HKET.js.map} +1 -1
  204. package/dist/{paths-BVO56A25.js → paths-SUS4S4YT.js} +9 -9
  205. package/dist/{paths-BVO56A25.js.map → paths-SUS4S4YT.js.map} +1 -1
  206. package/dist/{plugin-store-X7GPWGBG.js → plugin-store-AGQDMING.js} +8 -8
  207. package/dist/{plugin-store-X7GPWGBG.js.map → plugin-store-AGQDMING.js.map} +1 -1
  208. package/dist/{project-PAXP46RD.js → project-I55A4O2T.js} +20 -20
  209. package/dist/{project-PAXP46RD.js.map → project-I55A4O2T.js.map} +1 -1
  210. package/dist/resolver/index.js +7 -7
  211. package/dist/runner/index.js +28 -28
  212. package/dist/runner/src/serve.d.ts.map +1 -1
  213. package/dist/runner/src/usage-limit-turn-hold.d.ts +51 -0
  214. package/dist/runner/src/usage-limit-turn-hold.d.ts.map +1 -0
  215. package/dist/sdk/asset-manager.js +13 -13
  216. package/dist/sdk/bridge.js +11 -11
  217. package/dist/sdk/core.js +6 -6
  218. package/dist/sdk/flow.js +8 -8
  219. package/dist/sdk/index.js +28 -28
  220. package/dist/sdk/resolver.js +7 -7
  221. package/dist/sdk/runner.js +28 -28
  222. package/dist/{setup-BV55VHWC.js → setup-7DQJKHUI.js} +21 -21
  223. package/dist/{setup-BV55VHWC.js.map → setup-7DQJKHUI.js.map} +1 -1
  224. package/dist/{skills-EDFUCJPX.js → skills-NUEN5NDX.js} +12 -12
  225. package/dist/{skills-EDFUCJPX.js.map → skills-NUEN5NDX.js.map} +1 -1
  226. package/dist/{source-E4VAT5RZ.js → source-G2LV5LVD.js} +21 -21
  227. package/dist/{source-E4VAT5RZ.js.map → source-G2LV5LVD.js.map} +1 -1
  228. package/dist/{source-manifest-publish-CLEE6TNH.js → source-manifest-publish-6RM7SWLZ.js} +23 -23
  229. package/dist/{source-manifest-publish-CLEE6TNH.js.map → source-manifest-publish-6RM7SWLZ.js.map} +1 -1
  230. package/dist/tui/index.js +59 -39
  231. package/dist/tui/index.js.map +1 -1
  232. package/dist/tui/src/repl.d.ts.map +1 -1
  233. package/dist/types/manifests.js +1 -1
  234. package/dist/types/src/manifests/preset.d.ts +1 -1
  235. package/dist/workspace-plugin/adapters/mcp.js +22 -22
  236. package/dist/workspace-plugin/adapters/omp.js +14 -14
  237. package/dist/workspace-plugin/index.js +1 -1
  238. package/package.json +1 -1
  239. package/dist/chunk-2FMEGSBN.js.map +0 -1
  240. package/dist/chunk-2JMLDZLP.js.map +0 -1
  241. package/dist/chunk-32XKCNCL.js.map +0 -1
  242. package/dist/chunk-3BEY4WK3.js.map +0 -1
  243. package/dist/chunk-4OV5DSBB.js.map +0 -1
  244. package/dist/chunk-4P3KTUZH.js.map +0 -1
  245. package/dist/chunk-GEWAIQZ5.js.map +0 -1
  246. package/dist/chunk-IXWODEED.js.map +0 -1
  247. package/dist/chunk-JZCSNEHK.js.map +0 -1
  248. package/dist/chunk-MGGFBZWA.js.map +0 -1
  249. package/dist/chunk-NRDSGLCQ.js.map +0 -1
  250. package/dist/chunk-PE36IF2D.js.map +0 -1
  251. package/dist/chunk-TRSQP3JD.js.map +0 -1
  252. package/dist/chunk-YBQONMH2.js.map +0 -1
  253. package/dist/library-publish-OS3JDW4S.js.map +0 -1
  254. package/dist/open-library-4QSUORI6.js +0 -40
  255. package/dist/open-registry-VCKS3MP5.js +0 -32
@@ -1 +1 @@
1
- {"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;;;AAeO,SAAS,sBA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AA,GAAS,aAAA,CAAc,GAAA,CAAI,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AAClD,IAAA,MAAM,YAAY,IAAA,CAAK,gBAAA;AAGvB,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,SAAS,CAAA,KAAM,IAAA;AAC7C,IAAA,MAAM,WAAA,GAAc,MAAA,KAAW,EAAA,IAAM,KAAA,CAAM,MAAM,CAAA,KAAM,IAAA;AACvD,IAAA,MAAM,WAAA,GAAc,UAAA,IAAc,WAAA,IAAe,SAAA,CAAU,QAAQ,SAAS,CAAA;AAE5E,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-3MKPZZRE.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
1
+ {"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;;;AAeO,SAAS,sBAAsB,OAAA,EAAsC;AAC1E,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,uBAAuB,CAAA;AACnD,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,IAAI;AACF,IAAA,OAAOA,KAAA,CAAU,KAAA,CAAM,CAAC,CAAE,KAAK,EAAC;AAAA,EAClC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAmBO,SAAS,uBAAuB,OAAA,EAAoC;AACzE,EAAA,MAAM,EAAA,GAAK,sBAAsB,OAAO,CAAA;AACxC,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,QAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,aAAA,IAAiB,EAAC;AAE7C,EAAA,MAAM,KAAA,GAA2B;AAAA,IAC/B,OAAO,EAAC;AAAA,IACR,iBAAiB,EAAC;AAAA,IAClB,iBAAiB,EAAC;AAAA,IAClB,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AAAA,IACZ,YAA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,GAAQ,CAAA;AACZ,EAAA,IAAI,UAAA;AACJ,EAAA,WAAA,MAAiB,MAAA,IAAU,QAAQ,OAAA,EAAS;AAAA,IAC1C,UAAA,EAAY,CAAC,IAAA,KAAS;AACpB,MAAA,UAAA,KAAe,IAAA;AAAA,IACjB;AAAA,GACD,CAAA,EAAG;AACF,IAAA,KAAA,EAAA;AAGA,IAAA,IAAI,KAAA,IAAS,KAAA,EAAO,OAAO,EAAE,KAAA,EAAM;AAAA,EACrC;AACA,EAAA,OAAO,EAAE,OAAO,UAAA,EAAW;AAC7B;AChPO,SAAS,oBAAA,CACd,OACA,aAAA,EACgB;AAChB,EAAA,MAAM,SAAyB,EAAC;AAEhC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,CAAC,KAAK,gBAAA,EAAkB;AAE5B,IAAA,MAAM,MAAA,GAAS,aAAA,CAAc,GAAA,CAAI,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AAClD,IAAA,MAAM,YAAY,IAAA,CAAK,gBAAA;AAGvB,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,SAAS,CAAA,KAAM,IAAA;AAC7C,IAAA,MAAM,WAAA,GAAc,MAAA,KAAW,EAAA,IAAM,KAAA,CAAM,MAAM,CAAA,KAAM,IAAA;AACvD,IAAA,MAAM,WAAA,GAAc,UAAA,IAAc,WAAA,IAAe,SAAA,CAAU,QAAQ,SAAS,CAAA;AAE5E,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-X77SUM4P.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { logErr, logWarn, S, logOk, logInfo } from './chunk-TRSQP3JD.js';
2
- import { catalogLayer, getProviderPreset, expandPreset, listProviderPresets, presetBaseUrl, probeProviderEntry } from './chunk-HJ5MCB3L.js';
3
- import { loadProviderRegistry, saveProviderRegistryFile, workspaceProviderRegistryPath, userProviderRegistryPath } from './chunk-2FMEGSBN.js';
1
+ import { logErr, logWarn, S, logOk, logInfo } from './chunk-GV4DZ6MT.js';
2
+ import { catalogLayer, getProviderPreset, expandPreset, listProviderPresets, presetBaseUrl, probeProviderEntry } from './chunk-47U4GZ4M.js';
3
+ import { loadProviderRegistry, saveProviderRegistryFile, workspaceProviderRegistryPath, userProviderRegistryPath } from './chunk-PBBPZYVG.js';
4
4
  import { resolveCredential } from './chunk-ICSCSM5D.js';
5
5
  import { validateMergedRegistry, mergeRegistries, isSafeProviderId, parseCredentialRef, validateRegistry, resolveEntryBaseUrl, AI_PROVIDER_SURFACES, entryTransport, isEntryEnabled, AI_PROVIDER_LAYERS } from './chunk-MJHSLODD.js';
6
6
  import path from 'path';
@@ -496,5 +496,5 @@ function makeProvidersCommand() {
496
496
  }
497
497
 
498
498
  export { ProviderRegistryWriteError, addProviderEntry, credentialEnvVarName, loadRegistryView, makeProvidersCommand };
499
- //# sourceMappingURL=chunk-XCNK4UE5.js.map
500
- //# sourceMappingURL=chunk-XCNK4UE5.js.map
499
+ //# sourceMappingURL=chunk-XDKH7XSA.js.map
500
+ //# sourceMappingURL=chunk-XDKH7XSA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/commands/providers.ts"],"names":[],"mappings":";;;;;;;;;AAkDA,IAAM,aAAA,GAAgB,QAAA;AAStB,SAAS,WAAW,IAAA,EAAmE;AACrF,EAAA,IAAI,KAAK,SAAA,EAAW;AAClB,IAAA,OAAO,EAAE,OAAO,WAAA,EAAa,IAAA,EAAM,8BAA8B,iBAAA,CAAkB,IAAI,CAAC,CAAA,EAAE;AAAA,EAC5F;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,IAAA,EAAM,0BAAyB,EAAE;AAC3D;AAGA,SAAS,kBAAkB,IAAA,EAA4B;AACrD,EAAA,OAAO,IAAA,CAAK,aAAa,IAAA,CAAK,OAAA,CAAQ,KAAK,UAAU,CAAA,GAAI,QAAQ,GAAA,EAAI;AACvE;AAoBO,SAAS,iBAAiB,IAAA,EAAkC;AACjE,EAAA,MAAM,SAAS,oBA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AC,CAAA;AAExE,EAAA,GAAA,CACG,OAAA,CAAQ,wBAAwB,CAAA,CAChC,WAAA;AAAA,IACC;AAAA,GACF,CACC,OAAO,aAAA,EAAe,kEAAkE,EACxF,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,MAAA;AAAA,IAAO,CAAC,IAAY,GAAA,EAAa,KAAA,EAAe,SAC/C,MAAA,CAAO,EAAA,EAAI,GAAA,EAAK,KAAA,EAAO,IAAI;AAAA,GAC7B;AAEF,EAAA,GAAA,CACG,OAAA,CAAQ,SAAS,CAAA,CACjB,WAAA,CAAY,kCAAkC,CAAA,CAC9C,MAAA,CAAO,eAAe,iEAAiE,CAAA,CACvF,OAAO,sBAAA,EAAwB,mBAAmB,EAClD,MAAA,CAAO,CAAC,IAAY,IAAA,KAAuB,SAAA,CAAU,EAAA,EAAI,IAAI,CAAC,CAAA;AAEjE,EAAA,GAAA,CACG,QAAQ,WAAW,CAAA,CACnB,WAAA,CAAY,gEAAgE,EAC5E,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,OAAO,CAAC,EAAA,EAAY,SAAuB,OAAA,CAAQ,EAAA,EAAI,IAAI,CAAC,CAAA;AAE/D,EAAA,OAAO,GAAA;AACT","file":"chunk-XCNK4UE5.js","sourcesContent":["/**\n * `skaile providers` — manage the AI provider registry.\n *\n * Endpoints are defined once, in `~/.skaile/providers.yml`, optionally\n * overridden per project in `<workspace>/.skaile/providers.yml` (gitignored by\n * `skaile init`). Every subcommand writes exactly one of those two files and\n * validates the result before it lands — a literal secret never reaches disk.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1, §2.5\n */\n\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n catalogLayer,\n expandPreset,\n getProviderPreset,\n listProviderPresets,\n presetBaseUrl,\n probeProviderEntry,\n} from \"@skaile/workspaces/bridge\";\nimport {\n AI_PROVIDER_LAYERS,\n AI_PROVIDER_SURFACES,\n type AIProviderDiagnostic,\n type AIProviderEntry,\n type AIProviderLayerId,\n type AIProviderLlmEntry,\n type AIProviderRegistryDocument,\n type AIProviderSurface,\n entryTransport,\n isEntryEnabled,\n isSafeProviderId,\n loadProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n parseCredentialRef,\n type ProviderRegistryFile,\n resolveCredential,\n resolveEntryBaseUrl,\n saveProviderRegistryFile,\n userProviderRegistryPath,\n validateMergedRegistry,\n validateRegistry,\n workspaceProviderRegistryPath,\n} from \"@skaile/workspaces/core\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/** Preset id that means \"no preset — I will supply the three literals\". */\nconst CUSTOM_PRESET = \"custom\";\n\n/** Which of the two registry files a command reads or writes. */\nexport interface ScopeOptions {\n projectDir?: string;\n workspace?: boolean;\n}\n\n/** The file a mutating subcommand writes: the workspace layer or the user one. */\nfunction targetFile(opts: ScopeOptions): { layer: \"user\" | \"workspace\"; path: string } {\n if (opts.workspace) {\n return { layer: \"workspace\", path: workspaceProviderRegistryPath(resolveProjectDir(opts)) };\n }\n return { layer: \"user\", path: userProviderRegistryPath() };\n}\n\n/** Project directory a subcommand operates on — `--project-dir` or the cwd. */\nfunction resolveProjectDir(opts: ScopeOptions): string {\n return opts.projectDir ? path.resolve(opts.projectDir) : process.cwd();\n}\n\n/** Both file layers plus the catalog, merged — what every reader sees. */\nexport interface RegistryView {\n merged: MergedAIProviderRegistry;\n files: ProviderRegistryFile[];\n diagnostics: AIProviderDiagnostic[];\n}\n\n/**\n * Load both file layers and merge them with the catalog layer the configured\n * `preset:` keys pull in, then gate the result. Read once, merged twice — the\n * catalog layer can only be built after the configured entries are known,\n * and it is built from the **pre-gate** merge: an entry that leaves `kind` or\n * its transport `params` to the preset fails the first gate by design.\n *\n * The gate is on the merged view, not per file: a workspace entry that sets\n * one field of an entry the user file defines is an override (§1.5), so it is\n * only here that an entry can be judged complete.\n */\nexport function loadRegistryView(opts: ScopeOptions): RegistryView {\n const loaded = loadProviderRegistry({ projectDir: resolveProjectDir(opts) });\n const fileLayers = loaded.files.map((file) => ({\n layer: file.layer as AIProviderLayerId,\n providers: file.document.providers,\n }));\n const catalog = catalogLayer(loaded.patches);\n const { registry, diagnostics } = validateMergedRegistry(\n mergeRegistries([...fileLayers, catalog]),\n {\n sources: [\n ...loaded.files.map((file) => ({ label: file.path, providers: file.document.providers })),\n ],\n },\n );\n return {\n merged: registry,\n files: loaded.files,\n // `loaded.diagnostics` already carries the merge notes for the file layers\n // alone; this second merge adds the catalog, so its notes replace them.\n diagnostics: [...loaded.files.flatMap((file) => file.diagnostics), ...diagnostics],\n };\n}\n\n/** Print diagnostics; returns how many were errors. */\nfunction reportDiagnostics(diagnostics: AIProviderDiagnostic[]): number {\n let errors = 0;\n for (const diagnostic of diagnostics) {\n const where = diagnostic.path ? `${diagnostic.path}: ` : \"\";\n if (diagnostic.severity === \"error\") {\n errors++;\n logErr(`${where}${diagnostic.message}`);\n } else {\n logWarn(`${where}${diagnostic.message}`);\n }\n }\n return errors;\n}\n\n/** Highest layer that pins an entry with `locked: true`. */\nfunction lockOwner(id: string, files: ProviderRegistryFile[]): AIProviderLayerId | undefined {\n let owner: AIProviderLayerId | undefined;\n for (const file of files) {\n if (file.document.providers[id]?.locked) {\n const layer = file.layer as AIProviderLayerId;\n if (!owner || AI_PROVIDER_LAYERS.indexOf(layer) > AI_PROVIDER_LAYERS.indexOf(owner)) {\n owner = layer;\n }\n }\n }\n return owner;\n}\n\n/**\n * The message for an edit a lock forbids, or `undefined` when it is allowed.\n * The merge ignores a lower layer silently; the CLI must not, or the operator\n * would watch an accepted edit have no effect.\n *\n * `set <id> locked <value>` stays legal at the locking layer itself —\n * otherwise a lock could never be lifted without hand-editing the file.\n */\nfunction lockConflict(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): string | undefined {\n const owner = lockOwner(id, files);\n if (!owner) return undefined;\n const ownerRank = AI_PROVIDER_LAYERS.indexOf(owner);\n const targetRank = AI_PROVIDER_LAYERS.indexOf(target.layer);\n if (ownerRank === targetRank && key === \"locked\") return undefined;\n if (ownerRank < targetRank) return undefined;\n return (\n `'${id}' is locked by the ${owner} layer and cannot be changed from ${target.layer}.\\n` +\n (ownerRank === targetRank\n ? ` Unlock it first: skaile providers set ${id} locked false`\n : ` A higher layer owns this entry — change it there.`)\n );\n}\n\n/** Refuse loudly when a locked entry would be edited. */\nfunction exitIfLocked(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): void {\n const message = lockConflict(id, target, files, key);\n if (!message) return;\n logErr(message);\n process.exit(1);\n}\n\n/** Read the target file, or an empty document when it does not exist yet. */\nfunction readTargetDocument(\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n): AIProviderRegistryDocument {\n const file = files.find((f) => f.path === target.path);\n return file?.document ?? { version: 1, providers: {} };\n}\n\n/**\n * Validate the file that is about to be written; exits non-zero on errors.\n *\n * Validated as the layer it is, so `set` may leave a one-field override in the\n * workspace file (§1.5). Completeness is the merged registry's business, and\n * `loadRegistryView` reports it on the next read.\n */\nfunction validateOrExit(\n document: AIProviderRegistryDocument,\n target: { layer: \"user\" | \"workspace\"; path: string },\n): void {\n const { diagnostics } = validateRegistry(\n { version: 1, providers: document.providers },\n { source: target.path, layer: target.layer },\n );\n if (reportDiagnostics(diagnostics) > 0) process.exit(1);\n}\n\n// ── list ───────────────────────────────────────────────────────────────────\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length);\n}\n\nfunction credentialSummary(entry: AIProviderEntry): string {\n const credential = entry.credential;\n if (!credential || credential.kind === \"none\") return \"none\";\n return credential.ref ? `${credential.kind} ${credential.ref}` : credential.kind;\n}\n\nfunction printPresets(): void {\n const presets = listProviderPresets();\n console.log();\n console.log(` ${S.heading(\"Catalog presets\")}`);\n const idWidth = Math.max(...presets.map((x) => x.id.length)) + 2;\n const surfaceWidth = Math.max(...AI_PROVIDER_SURFACES.map((s) => s.length)) + 2;\n const header = `${pad(\"preset\", idWidth)}${pad(\"kind\", 7)}${pad(\"surface\", surfaceWidth)}${pad(\"transport\", 14)}default base URL`;\n console.log(` ${S.dim(header)}`);\n for (const preset of presets) {\n const row =\n pad(preset.id, idWidth) +\n pad(preset.kind, 7) +\n pad(preset.surface ?? \"—\", surfaceWidth) +\n pad(\n preset.kind === \"llm\" || preset.kind === \"embed\" ? (preset.transport ?? \"direct\") : \"—\",\n 14,\n ) +\n (presetBaseUrl(preset) ?? \"—\");\n console.log(` ${row}`);\n }\n}\n\nfunction printConfigured(view: RegistryView): void {\n const ids = view.merged.order;\n console.log();\n console.log(` ${S.heading(\"Configured providers\")}`);\n if (ids.length === 0) {\n console.log(\n ` ${S.dim(\"none — add one with\")} ${S.cmd(\"skaile providers add --preset <preset>\")}`,\n );\n console.log();\n return;\n }\n const idWidth = Math.max(...ids.map((id) => id.length)) + 2;\n const header = `${pad(\"id\", idWidth)}${pad(\"layer\", 11)}${pad(\"surface\", 26)}${pad(\"transport\", 14)}endpoint`;\n console.log(` ${S.dim(header)}`);\n for (const id of ids) {\n const entry = view.merged.providers[id];\n const surface = (entry as AIProviderLlmEntry).surface ?? \"—\";\n const transport = entryTransport(entry) ?? \"—\";\n const url = resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\");\n const flags = [\n isEntryEnabled(entry) ? \"\" : S.warn(\"disabled\"),\n entry.locked ? S.warn(\"locked\") : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n console.log(\n ` ${pad(id, idWidth)}${pad(view.merged.origin[id], 11)}${pad(surface, 26)}${pad(transport, 14)}${url} ${flags}`.trimEnd(),\n );\n console.log(` ${S.dim(`${pad(\"\", idWidth)}${credentialSummary(entry)}`)}`);\n }\n console.log();\n}\n\n// ── add ────────────────────────────────────────────────────────────────────\n\ninterface AddOptions extends ScopeOptions {\n preset?: string;\n credential?: string;\n baseUrl?: string;\n surface?: string;\n label?: string;\n kind?: string;\n param: string[];\n force?: boolean;\n}\n\nfunction parseParams(pairs: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const pair of pairs) {\n const eq = pair.indexOf(\"=\");\n if (eq <= 0) {\n logErr(`--param expects <key>=<value> (got '${pair}')`);\n process.exit(1);\n }\n out[pair.slice(0, eq)] = pair.slice(eq + 1);\n }\n return out;\n}\n\n/** Ask for the three literals a custom endpoint needs. Nothing else. */\nasync function promptCustomEntry(\n id: string,\n opts: AddOptions,\n): Promise<{ surface: AIProviderSurface; baseUrl: string; credentialRef: string }> {\n const interactive = process.stdin.isTTY === true;\n let surface = opts.surface as AIProviderSurface | undefined;\n let baseUrl = opts.baseUrl;\n let credentialRef = opts.credential;\n\n if (!interactive && (!surface || !baseUrl || !credentialRef)) {\n logErr(\n \"--preset custom needs --surface, --base-url and --credential when there is no terminal to prompt on\",\n );\n process.exit(1);\n }\n\n if (!surface) {\n const answer = await p.select({\n message: \"Wire surface:\",\n options: AI_PROVIDER_SURFACES.map((value) => ({ value, label: value })),\n initialValue: \"openai-completions\" as AIProviderSurface,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n surface = answer as AIProviderSurface;\n }\n if (!baseUrl) {\n const answer = await p.text({\n message: \"Base URL:\",\n placeholder: \"https://api.example.com/v1\",\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n baseUrl = answer as string;\n }\n if (!credentialRef) {\n const answer = await p.text({\n message: \"Credential reference (env:NAME, cmd:<shell>, platform:<id>, keyring:<svc>/<acct>):\",\n initialValue: `env:${id.toUpperCase().replace(/[^A-Z0-9]/g, \"_\")}_API_KEY`,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n credentialRef = answer as string;\n }\n return { surface, baseUrl, credentialRef };\n}\n\n/** A rejected registry write. The message is already CLI-ready. */\nexport class ProviderRegistryWriteError extends Error {}\n\n/** What {@link addProviderEntry} writes. */\nexport interface AddProviderEntryInput extends ScopeOptions {\n /** Registry entry id — `[a-z0-9][a-z0-9_-]*`. */\n id: string;\n /** Catalog preset to expand. Mutually exclusive with `entry`. */\n presetId?: string;\n /** A fully-built entry (the `--preset custom` path, which needs prompts). */\n entry?: AIProviderEntry;\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…` — never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n params?: Record<string, string>;\n /** Overwrite an entry that already exists in the target file. */\n force?: boolean;\n}\n\n/** Result of {@link addProviderEntry}. */\nexport interface AddedProviderEntry {\n id: string;\n layer: \"user\" | \"workspace\";\n path: string;\n entry: AIProviderEntry;\n /** True when an existing entry in the target file was overwritten. */\n replaced: boolean;\n}\n\n/**\n * Write one entry into a registry file — the single write path behind\n * `skaile providers add` and the `skaile setup` wizard.\n *\n * Throws {@link ProviderRegistryWriteError} instead of exiting, so a wizard\n * can report the failure in its own idiom. Every rejection a caller can\n * provoke (bad id, unknown preset, missing transport parameter, locked entry,\n * a literal secret) lands here, and the document is validated before it is\n * written — a secret cannot reach disk through this function.\n */\nexport function addProviderEntry(input: AddProviderEntryInput): AddedProviderEntry {\n const { id } = input;\n if (!isSafeProviderId(id)) {\n throw new ProviderRegistryWriteError(\n `'${id}' is not a valid entry id — use [a-z0-9][a-z0-9_-]*`,\n );\n }\n if (input.credentialRef && !parseCredentialRef(input.credentialRef)) {\n throw new ProviderRegistryWriteError(\n \"the credential must be a reference, not a secret: \" +\n \"env:NAME, cmd:<shell>, platform:<configId> or keyring:<service>/<account>\",\n );\n }\n\n const view = loadRegistryView(input);\n const target = targetFile(input);\n const locked = lockConflict(id, target, view.files);\n if (locked) throw new ProviderRegistryWriteError(locked);\n\n const document = readTargetDocument(target, view.files);\n const replaced = document.providers[id] !== undefined;\n if (replaced && !input.force) {\n throw new ProviderRegistryWriteError(\n `'${id}' already exists in ${target.path} — pass --force to overwrite it.`,\n );\n }\n\n let entry: AIProviderEntry;\n if (input.entry) {\n entry = input.entry;\n } else {\n const preset = input.presetId ? getProviderPreset(input.presetId) : undefined;\n if (!preset) {\n throw new ProviderRegistryWriteError(\n `Unknown preset '${input.presetId}'. Run \\`skaile providers list\\` to see the catalog, ` +\n \"or use `--preset custom`.\",\n );\n }\n entry = expandPreset(preset, {\n credentialRef: input.credentialRef,\n baseUrl: input.baseUrl,\n surface: input.surface,\n label: input.label,\n params: input.params,\n });\n const missing = (preset.required_params ?? []).filter(\n (key) => !(key in ((entry as AIProviderLlmEntry).params ?? {})),\n );\n if (missing.length > 0) {\n throw new ProviderRegistryWriteError(\n `Preset '${preset.id}' needs ${missing.map((m) => `--param ${m}=<value>`).join(\" \")}`,\n );\n }\n }\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: entry },\n };\n const { diagnostics } = validateRegistry(\n { version: 1, providers: next.providers },\n { source: target.path },\n );\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n if (errors.length > 0) {\n throw new ProviderRegistryWriteError(\n errors.map((d) => (d.path ? `${d.path}: ${d.message}` : d.message)).join(\"\\n\"),\n );\n }\n saveProviderRegistryFile(target.path, next);\n\n return { id, layer: target.layer, path: target.path, entry, replaced };\n}\n\n/** The env var an `env:` credential reference points at, if it is one. */\nexport function credentialEnvVarName(entry: AIProviderEntry): string | undefined {\n const ref = entry.credential?.ref;\n return ref?.startsWith(\"env:\") ? ref.slice(4) : undefined;\n}\n\n/** Build the `--preset custom` entry from the three literals the user gave. */\nfunction customEntry(\n answers: { surface: AIProviderSurface; baseUrl: string; credentialRef: string },\n opts: AddOptions,\n): AIProviderEntry {\n const kind = (opts.kind ?? \"llm\") as AIProviderEntry[\"kind\"];\n // Anthropic- and Google-shaped surfaces read a dedicated API-key header;\n // everything else is a bearer token. `set <id> credential.kind …` adjusts.\n const credentialKind =\n kind === \"stt\" ||\n kind === \"tts\" ||\n answers.surface === \"anthropic-messages\" ||\n answers.surface === \"google-generative-ai\" ||\n answers.surface === \"azure-openai-responses\"\n ? \"api_key_header\"\n : \"bearer\";\n if (kind === \"stt\" || kind === \"tts\") {\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n };\n }\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n surface: answers.surface,\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n } as AIProviderLlmEntry;\n}\n\nasync function runAdd(idArg: string | undefined, opts: AddOptions): Promise<void> {\n const presetId = opts.preset;\n if (!presetId) {\n logErr(\n `--preset is required. Run ${S.cmd(\"skaile providers list\")} for the catalog, ` +\n `or use ${S.cmd(\"--preset custom\")}.`,\n );\n process.exit(1);\n }\n const id = idArg ?? presetId;\n if (id === CUSTOM_PRESET && !idArg) {\n logErr(\"--preset custom needs an entry id: skaile providers add <id> --preset custom\");\n process.exit(1);\n }\n\n const entry =\n presetId === CUSTOM_PRESET ? customEntry(await promptCustomEntry(id, opts), opts) : undefined;\n\n let added: AddedProviderEntry;\n try {\n added = addProviderEntry({\n id,\n ...(entry ? { entry } : { presetId }),\n credentialRef: opts.credential,\n baseUrl: opts.baseUrl,\n surface: opts.surface as AIProviderSurface | undefined,\n label: opts.label,\n params: parseParams(opts.param),\n projectDir: opts.projectDir,\n workspace: opts.workspace,\n force: opts.force,\n });\n } catch (error) {\n logErr(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n logOk(`Added ${S.bold(id)} (${presetId}) to the ${added.layer} registry`);\n console.log(S.dim(` → ${added.path}`));\n const name = credentialEnvVarName(added.entry);\n if (name) {\n console.log(\n ` ${S.dim(\"The secret itself never goes in this file — export it:\")} ${S.cmd(`export ${name}=…`)}`,\n );\n }\n console.log(` ${S.dim(\"Verify with:\")} ${S.cmd(`skaile providers test ${id}`)}`);\n}\n\n// ── set / rm ───────────────────────────────────────────────────────────────\n\n/** Coerce a CLI string into the type the schema expects at `key`. */\nfunction coerceValue(key: string, value: string): unknown {\n const leaf = key.split(\".\").pop() ?? key;\n if (leaf === \"enabled\" || leaf === \"locked\" || leaf === \"tools\" || leaf === \"images\") {\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n logErr(`'${key}' takes true or false (got '${value}')`);\n process.exit(1);\n }\n if (leaf === \"context_window\" || leaf === \"thinking_max\") {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n logErr(`'${key}' takes a number (got '${value}')`);\n process.exit(1);\n }\n return parsed;\n }\n return value;\n}\n\n/** Write `value` at a dotted path, creating intermediate maps. */\nfunction setDotted(entry: Record<string, unknown>, key: string, value: unknown): void {\n const segments = key.split(\".\");\n let cursor = entry;\n for (const segment of segments.slice(0, -1)) {\n const next = cursor[segment];\n if (typeof next !== \"object\" || next === null || Array.isArray(next)) {\n cursor[segment] = {};\n }\n cursor = cursor[segment] as Record<string, unknown>;\n }\n cursor[segments[segments.length - 1]] = value;\n}\n\nfunction runSet(id: string, key: string, value: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files, key);\n\n const document = readTargetDocument(target, view.files);\n const existing = document.providers[id];\n const inherited = view.merged.providers[id];\n if (!existing && !inherited) {\n logErr(\n `No provider '${id}'. Add it with ${S.cmd(`skaile providers add ${id} --preset <preset>`)}`,\n );\n process.exit(1);\n }\n\n // Writing a field into a layer that has no entry yet leaves a one-field\n // override: the layers below keep supplying the rest (§1.5), so copying\n // their `kind` down here would pin a value this layer does not own.\n const base = (existing ? structuredClone(existing) : {}) as unknown as Record<string, unknown>;\n setDotted(base, key, coerceValue(key, value));\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: base as unknown as AIProviderEntry },\n };\n validateOrExit(next, target);\n saveProviderRegistryFile(target.path, next);\n\n logOk(`Set ${S.bold(`${id}.${key}`)} = ${value} in the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n}\n\nfunction runRemove(id: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files);\n\n const document = readTargetDocument(target, view.files);\n if (!document.providers[id]) {\n logErr(`No provider '${id}' in ${target.path}`);\n process.exit(1);\n }\n const providers = { ...document.providers };\n delete providers[id];\n saveProviderRegistryFile(target.path, { version: 1, providers });\n\n logOk(`Removed ${S.bold(id)} from the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n if (\n view.merged.providers[id] &&\n view.files.some((f) => f.path !== target.path && f.document.providers[id])\n ) {\n logInfo(`'${id}' is still defined in another layer — run 'skaile providers list' to see it.`);\n }\n}\n\n// ── test ───────────────────────────────────────────────────────────────────\n\nasync function runTest(id: string, opts: ScopeOptions): Promise<void> {\n const view = loadRegistryView(opts);\n const entry = view.merged.providers[id];\n if (!entry) {\n logErr(`No provider '${id}'. Run ${S.cmd(\"skaile providers list\")} to see what is configured.`);\n process.exit(1);\n }\n\n const credential = resolveCredential(entry);\n console.log();\n console.log(` ${S.heading(id)} ${S.dim(`(${view.merged.origin[id]} layer)`)}`);\n console.log(` ${S.label(\"endpoint \")} ${resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\")}`);\n console.log(\n ` ${S.label(\"credential\")} ${credentialSummary(entry)} ${\n credential.error\n ? S.err(`— ${credential.error}`)\n : S.dim(`— resolved from ${credential.source}`)\n }`,\n );\n\n if (credential.error) {\n console.log();\n logErr(`${id} is not usable yet: ${credential.error}`);\n process.exit(1);\n }\n\n const result = await probeProviderEntry(entry, { secret: credential.value });\n if (result.url) console.log(` ${S.label(\"probe \")} GET ${result.url}`);\n console.log();\n if (result.ok) {\n logOk(`${id}: ${result.detail}${result.status ? ` (HTTP ${result.status})` : \"\"}`);\n return;\n }\n if (!result.probed) {\n logWarn(`${id}: ${result.detail}`);\n return;\n }\n logErr(`${id}: ${result.detail}`);\n process.exit(1);\n}\n\n// ── command ────────────────────────────────────────────────────────────────\n\n/**\n * Create the `skaile providers` command group.\n *\n * `list` shows the catalog and what is configured; `add` writes an entry from\n * a preset (or from three literals with `--preset custom`); `set` and `rm`\n * edit one layer; `test` sends one read-only request and reports what came\n * back, never the credential.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n */\nexport function makeProvidersCommand(): Command {\n const cmd = new Command(\"providers\").description(\n \"Manage AI provider endpoints (~/.skaile/providers.yml)\",\n );\n\n cmd\n .command(\"list\")\n .description(\"List catalog presets and configured providers\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--json\", \"Machine-readable output\")\n .action((opts) => {\n const view = loadRegistryView(opts);\n if (opts.json) {\n console.log(\n JSON.stringify(\n {\n presets: listProviderPresets().map((preset) => ({\n id: preset.id,\n kind: preset.kind,\n surface: preset.surface,\n transport: preset.transport ?? (preset.surface ? \"direct\" : undefined),\n base_url: presetBaseUrl(preset),\n credential: preset.credential,\n required_params: preset.required_params,\n })),\n providers: view.merged.order.map((id) => ({\n id,\n layer: view.merged.origin[id],\n entry: view.merged.providers[id],\n base_url: resolveEntryBaseUrl(view.merged.providers[id]),\n })),\n },\n null,\n 2,\n ),\n );\n return;\n }\n reportDiagnostics(view.diagnostics);\n printPresets();\n printConfigured(view);\n });\n\n cmd\n .command(\"add [id]\")\n .description(\"Add a provider from a catalog preset (id defaults to the preset name)\")\n .requiredOption(\"--preset <preset>\", `Catalog preset, or '${CUSTOM_PRESET}'`)\n .option(\"--credential <ref>\", \"Credential reference (env:NAME, cmd:…, platform:…, keyring:…)\")\n .option(\"--base-url <url>\", \"Override the preset endpoint\")\n .option(\"--surface <surface>\", `Wire surface (${AI_PROVIDER_SURFACES.join(\", \")})`)\n .option(\"--kind <kind>\", \"Entry kind for --preset custom (llm, embed, stt, tts)\", \"llm\")\n .option(\"--label <text>\", \"Display label\")\n .option(\n \"--param <key=value>\",\n \"Transport parameter (repeatable): region, project, location, resource, deployment, api_version\",\n (value: string, previous: string[]) => [...previous, value],\n [] as string[],\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--force\", \"Overwrite an existing entry in the target file\")\n .action((id: string | undefined, opts: AddOptions) => runAdd(id, opts));\n\n cmd\n .command(\"set <id> <key> <value>\")\n .description(\n \"Set one field (base_url, enabled, credential.ref, headers.<name>, model_map.<id>…)\",\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, key: string, value: string, opts: ScopeOptions) =>\n runSet(id, key, value, opts),\n );\n\n cmd\n .command(\"rm <id>\")\n .description(\"Remove a provider from one layer\")\n .option(\"--workspace\", \"Edit <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runRemove(id, opts));\n\n cmd\n .command(\"test <id>\")\n .description(\"Send one read-only request to a provider and report the result\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runTest(id, opts));\n\n return cmd;\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/commands/providers.ts"],"names":[],"mappings":";;;;;;;;;AAkDA,IAAM,aAAA,GAAgB,QAAA;AAStB,SAAS,WAAW,IAAA,EAAmE;AACrF,EAAA,IAAI,KAAK,SAAA,EAAW;AAClB,IAAA,OAAO,EAAE,OAAO,WAAA,EAAa,IAAA,EAAM,8BAA8B,iBAAA,CAAkB,IAAI,CAAC,CAAA,EAAE;AAAA,EAC5F;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,IAAA,EAAM,0BAAyB,EAAE;AAC3D;AAGA,SAAS,kBAAkB,IAAA,EAA4B;AACrD,EAAA,OAAO,IAAA,CAAK,aAAa,IAAA,CAAK,OAAA,CAAQ,KAAK,UAAU,CAAA,GAAI,QAAQ,GAAA,EAAI;AACvE;AAoBO,SAAS,iBAAiB,IAAA,EAAkC;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,CAAO,EAAA,EAAI,IAAI,CAAC,CAAA;AAExE,EAAA,GAAA,CACG,OAAA,CAAQ,wBAAwB,CAAA,CAChC,WAAA;AAAA,IACC;AAAA,GACF,CACC,OAAO,aAAA,EAAe,kEAAkE,EACxF,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,MAAA;AAAA,IAAO,CAAC,IAAY,GAAA,EAAa,KAAA,EAAe,SAC/C,MAAA,CAAO,EAAA,EAAI,GAAA,EAAK,KAAA,EAAO,IAAI;AAAA,GAC7B;AAEF,EAAA,GAAA,CACG,OAAA,CAAQ,SAAS,CAAA,CACjB,WAAA,CAAY,kCAAkC,CAAA,CAC9C,MAAA,CAAO,eAAe,iEAAiE,CAAA,CACvF,OAAO,sBAAA,EAAwB,mBAAmB,EAClD,MAAA,CAAO,CAAC,IAAY,IAAA,KAAuB,SAAA,CAAU,EAAA,EAAI,IAAI,CAAC,CAAA;AAEjE,EAAA,GAAA,CACG,QAAQ,WAAW,CAAA,CACnB,WAAA,CAAY,gEAAgE,EAC5E,MAAA,CAAO,sBAAA,EAAwB,mBAAmB,CAAA,CAClD,OAAO,CAAC,EAAA,EAAY,SAAuB,OAAA,CAAQ,EAAA,EAAI,IAAI,CAAC,CAAA;AAE/D,EAAA,OAAO,GAAA;AACT","file":"chunk-XDKH7XSA.js","sourcesContent":["/**\n * `skaile providers` — manage the AI provider registry.\n *\n * Endpoints are defined once, in `~/.skaile/providers.yml`, optionally\n * overridden per project in `<workspace>/.skaile/providers.yml` (gitignored by\n * `skaile init`). Every subcommand writes exactly one of those two files and\n * validates the result before it lands — a literal secret never reaches disk.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1, §2.5\n */\n\nimport path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n catalogLayer,\n expandPreset,\n getProviderPreset,\n listProviderPresets,\n presetBaseUrl,\n probeProviderEntry,\n} from \"@skaile/workspaces/bridge\";\nimport {\n AI_PROVIDER_LAYERS,\n AI_PROVIDER_SURFACES,\n type AIProviderDiagnostic,\n type AIProviderEntry,\n type AIProviderLayerId,\n type AIProviderLlmEntry,\n type AIProviderRegistryDocument,\n type AIProviderSurface,\n entryTransport,\n isEntryEnabled,\n isSafeProviderId,\n loadProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n parseCredentialRef,\n type ProviderRegistryFile,\n resolveCredential,\n resolveEntryBaseUrl,\n saveProviderRegistryFile,\n userProviderRegistryPath,\n validateMergedRegistry,\n validateRegistry,\n workspaceProviderRegistryPath,\n} from \"@skaile/workspaces/core\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/** Preset id that means \"no preset — I will supply the three literals\". */\nconst CUSTOM_PRESET = \"custom\";\n\n/** Which of the two registry files a command reads or writes. */\nexport interface ScopeOptions {\n projectDir?: string;\n workspace?: boolean;\n}\n\n/** The file a mutating subcommand writes: the workspace layer or the user one. */\nfunction targetFile(opts: ScopeOptions): { layer: \"user\" | \"workspace\"; path: string } {\n if (opts.workspace) {\n return { layer: \"workspace\", path: workspaceProviderRegistryPath(resolveProjectDir(opts)) };\n }\n return { layer: \"user\", path: userProviderRegistryPath() };\n}\n\n/** Project directory a subcommand operates on — `--project-dir` or the cwd. */\nfunction resolveProjectDir(opts: ScopeOptions): string {\n return opts.projectDir ? path.resolve(opts.projectDir) : process.cwd();\n}\n\n/** Both file layers plus the catalog, merged — what every reader sees. */\nexport interface RegistryView {\n merged: MergedAIProviderRegistry;\n files: ProviderRegistryFile[];\n diagnostics: AIProviderDiagnostic[];\n}\n\n/**\n * Load both file layers and merge them with the catalog layer the configured\n * `preset:` keys pull in, then gate the result. Read once, merged twice — the\n * catalog layer can only be built after the configured entries are known,\n * and it is built from the **pre-gate** merge: an entry that leaves `kind` or\n * its transport `params` to the preset fails the first gate by design.\n *\n * The gate is on the merged view, not per file: a workspace entry that sets\n * one field of an entry the user file defines is an override (§1.5), so it is\n * only here that an entry can be judged complete.\n */\nexport function loadRegistryView(opts: ScopeOptions): RegistryView {\n const loaded = loadProviderRegistry({ projectDir: resolveProjectDir(opts) });\n const fileLayers = loaded.files.map((file) => ({\n layer: file.layer as AIProviderLayerId,\n providers: file.document.providers,\n }));\n const catalog = catalogLayer(loaded.patches);\n const { registry, diagnostics } = validateMergedRegistry(\n mergeRegistries([...fileLayers, catalog]),\n {\n sources: [\n ...loaded.files.map((file) => ({ label: file.path, providers: file.document.providers })),\n ],\n },\n );\n return {\n merged: registry,\n files: loaded.files,\n // `loaded.diagnostics` already carries the merge notes for the file layers\n // alone; this second merge adds the catalog, so its notes replace them.\n diagnostics: [...loaded.files.flatMap((file) => file.diagnostics), ...diagnostics],\n };\n}\n\n/** Print diagnostics; returns how many were errors. */\nfunction reportDiagnostics(diagnostics: AIProviderDiagnostic[]): number {\n let errors = 0;\n for (const diagnostic of diagnostics) {\n const where = diagnostic.path ? `${diagnostic.path}: ` : \"\";\n if (diagnostic.severity === \"error\") {\n errors++;\n logErr(`${where}${diagnostic.message}`);\n } else {\n logWarn(`${where}${diagnostic.message}`);\n }\n }\n return errors;\n}\n\n/** Highest layer that pins an entry with `locked: true`. */\nfunction lockOwner(id: string, files: ProviderRegistryFile[]): AIProviderLayerId | undefined {\n let owner: AIProviderLayerId | undefined;\n for (const file of files) {\n if (file.document.providers[id]?.locked) {\n const layer = file.layer as AIProviderLayerId;\n if (!owner || AI_PROVIDER_LAYERS.indexOf(layer) > AI_PROVIDER_LAYERS.indexOf(owner)) {\n owner = layer;\n }\n }\n }\n return owner;\n}\n\n/**\n * The message for an edit a lock forbids, or `undefined` when it is allowed.\n * The merge ignores a lower layer silently; the CLI must not, or the operator\n * would watch an accepted edit have no effect.\n *\n * `set <id> locked <value>` stays legal at the locking layer itself —\n * otherwise a lock could never be lifted without hand-editing the file.\n */\nfunction lockConflict(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): string | undefined {\n const owner = lockOwner(id, files);\n if (!owner) return undefined;\n const ownerRank = AI_PROVIDER_LAYERS.indexOf(owner);\n const targetRank = AI_PROVIDER_LAYERS.indexOf(target.layer);\n if (ownerRank === targetRank && key === \"locked\") return undefined;\n if (ownerRank < targetRank) return undefined;\n return (\n `'${id}' is locked by the ${owner} layer and cannot be changed from ${target.layer}.\\n` +\n (ownerRank === targetRank\n ? ` Unlock it first: skaile providers set ${id} locked false`\n : ` A higher layer owns this entry — change it there.`)\n );\n}\n\n/** Refuse loudly when a locked entry would be edited. */\nfunction exitIfLocked(\n id: string,\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n key?: string,\n): void {\n const message = lockConflict(id, target, files, key);\n if (!message) return;\n logErr(message);\n process.exit(1);\n}\n\n/** Read the target file, or an empty document when it does not exist yet. */\nfunction readTargetDocument(\n target: { layer: \"user\" | \"workspace\"; path: string },\n files: ProviderRegistryFile[],\n): AIProviderRegistryDocument {\n const file = files.find((f) => f.path === target.path);\n return file?.document ?? { version: 1, providers: {} };\n}\n\n/**\n * Validate the file that is about to be written; exits non-zero on errors.\n *\n * Validated as the layer it is, so `set` may leave a one-field override in the\n * workspace file (§1.5). Completeness is the merged registry's business, and\n * `loadRegistryView` reports it on the next read.\n */\nfunction validateOrExit(\n document: AIProviderRegistryDocument,\n target: { layer: \"user\" | \"workspace\"; path: string },\n): void {\n const { diagnostics } = validateRegistry(\n { version: 1, providers: document.providers },\n { source: target.path, layer: target.layer },\n );\n if (reportDiagnostics(diagnostics) > 0) process.exit(1);\n}\n\n// ── list ───────────────────────────────────────────────────────────────────\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length);\n}\n\nfunction credentialSummary(entry: AIProviderEntry): string {\n const credential = entry.credential;\n if (!credential || credential.kind === \"none\") return \"none\";\n return credential.ref ? `${credential.kind} ${credential.ref}` : credential.kind;\n}\n\nfunction printPresets(): void {\n const presets = listProviderPresets();\n console.log();\n console.log(` ${S.heading(\"Catalog presets\")}`);\n const idWidth = Math.max(...presets.map((x) => x.id.length)) + 2;\n const surfaceWidth = Math.max(...AI_PROVIDER_SURFACES.map((s) => s.length)) + 2;\n const header = `${pad(\"preset\", idWidth)}${pad(\"kind\", 7)}${pad(\"surface\", surfaceWidth)}${pad(\"transport\", 14)}default base URL`;\n console.log(` ${S.dim(header)}`);\n for (const preset of presets) {\n const row =\n pad(preset.id, idWidth) +\n pad(preset.kind, 7) +\n pad(preset.surface ?? \"—\", surfaceWidth) +\n pad(\n preset.kind === \"llm\" || preset.kind === \"embed\" ? (preset.transport ?? \"direct\") : \"—\",\n 14,\n ) +\n (presetBaseUrl(preset) ?? \"—\");\n console.log(` ${row}`);\n }\n}\n\nfunction printConfigured(view: RegistryView): void {\n const ids = view.merged.order;\n console.log();\n console.log(` ${S.heading(\"Configured providers\")}`);\n if (ids.length === 0) {\n console.log(\n ` ${S.dim(\"none — add one with\")} ${S.cmd(\"skaile providers add --preset <preset>\")}`,\n );\n console.log();\n return;\n }\n const idWidth = Math.max(...ids.map((id) => id.length)) + 2;\n const header = `${pad(\"id\", idWidth)}${pad(\"layer\", 11)}${pad(\"surface\", 26)}${pad(\"transport\", 14)}endpoint`;\n console.log(` ${S.dim(header)}`);\n for (const id of ids) {\n const entry = view.merged.providers[id];\n const surface = (entry as AIProviderLlmEntry).surface ?? \"—\";\n const transport = entryTransport(entry) ?? \"—\";\n const url = resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\");\n const flags = [\n isEntryEnabled(entry) ? \"\" : S.warn(\"disabled\"),\n entry.locked ? S.warn(\"locked\") : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n console.log(\n ` ${pad(id, idWidth)}${pad(view.merged.origin[id], 11)}${pad(surface, 26)}${pad(transport, 14)}${url} ${flags}`.trimEnd(),\n );\n console.log(` ${S.dim(`${pad(\"\", idWidth)}${credentialSummary(entry)}`)}`);\n }\n console.log();\n}\n\n// ── add ────────────────────────────────────────────────────────────────────\n\ninterface AddOptions extends ScopeOptions {\n preset?: string;\n credential?: string;\n baseUrl?: string;\n surface?: string;\n label?: string;\n kind?: string;\n param: string[];\n force?: boolean;\n}\n\nfunction parseParams(pairs: string[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const pair of pairs) {\n const eq = pair.indexOf(\"=\");\n if (eq <= 0) {\n logErr(`--param expects <key>=<value> (got '${pair}')`);\n process.exit(1);\n }\n out[pair.slice(0, eq)] = pair.slice(eq + 1);\n }\n return out;\n}\n\n/** Ask for the three literals a custom endpoint needs. Nothing else. */\nasync function promptCustomEntry(\n id: string,\n opts: AddOptions,\n): Promise<{ surface: AIProviderSurface; baseUrl: string; credentialRef: string }> {\n const interactive = process.stdin.isTTY === true;\n let surface = opts.surface as AIProviderSurface | undefined;\n let baseUrl = opts.baseUrl;\n let credentialRef = opts.credential;\n\n if (!interactive && (!surface || !baseUrl || !credentialRef)) {\n logErr(\n \"--preset custom needs --surface, --base-url and --credential when there is no terminal to prompt on\",\n );\n process.exit(1);\n }\n\n if (!surface) {\n const answer = await p.select({\n message: \"Wire surface:\",\n options: AI_PROVIDER_SURFACES.map((value) => ({ value, label: value })),\n initialValue: \"openai-completions\" as AIProviderSurface,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n surface = answer as AIProviderSurface;\n }\n if (!baseUrl) {\n const answer = await p.text({\n message: \"Base URL:\",\n placeholder: \"https://api.example.com/v1\",\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n baseUrl = answer as string;\n }\n if (!credentialRef) {\n const answer = await p.text({\n message: \"Credential reference (env:NAME, cmd:<shell>, platform:<id>, keyring:<svc>/<acct>):\",\n initialValue: `env:${id.toUpperCase().replace(/[^A-Z0-9]/g, \"_\")}_API_KEY`,\n });\n if (p.isCancel(answer)) {\n p.cancel(\"Cancelled.\");\n process.exit(1);\n }\n credentialRef = answer as string;\n }\n return { surface, baseUrl, credentialRef };\n}\n\n/** A rejected registry write. The message is already CLI-ready. */\nexport class ProviderRegistryWriteError extends Error {}\n\n/** What {@link addProviderEntry} writes. */\nexport interface AddProviderEntryInput extends ScopeOptions {\n /** Registry entry id — `[a-z0-9][a-z0-9_-]*`. */\n id: string;\n /** Catalog preset to expand. Mutually exclusive with `entry`. */\n presetId?: string;\n /** A fully-built entry (the `--preset custom` path, which needs prompts). */\n entry?: AIProviderEntry;\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…` — never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n params?: Record<string, string>;\n /** Overwrite an entry that already exists in the target file. */\n force?: boolean;\n}\n\n/** Result of {@link addProviderEntry}. */\nexport interface AddedProviderEntry {\n id: string;\n layer: \"user\" | \"workspace\";\n path: string;\n entry: AIProviderEntry;\n /** True when an existing entry in the target file was overwritten. */\n replaced: boolean;\n}\n\n/**\n * Write one entry into a registry file — the single write path behind\n * `skaile providers add` and the `skaile setup` wizard.\n *\n * Throws {@link ProviderRegistryWriteError} instead of exiting, so a wizard\n * can report the failure in its own idiom. Every rejection a caller can\n * provoke (bad id, unknown preset, missing transport parameter, locked entry,\n * a literal secret) lands here, and the document is validated before it is\n * written — a secret cannot reach disk through this function.\n */\nexport function addProviderEntry(input: AddProviderEntryInput): AddedProviderEntry {\n const { id } = input;\n if (!isSafeProviderId(id)) {\n throw new ProviderRegistryWriteError(\n `'${id}' is not a valid entry id — use [a-z0-9][a-z0-9_-]*`,\n );\n }\n if (input.credentialRef && !parseCredentialRef(input.credentialRef)) {\n throw new ProviderRegistryWriteError(\n \"the credential must be a reference, not a secret: \" +\n \"env:NAME, cmd:<shell>, platform:<configId> or keyring:<service>/<account>\",\n );\n }\n\n const view = loadRegistryView(input);\n const target = targetFile(input);\n const locked = lockConflict(id, target, view.files);\n if (locked) throw new ProviderRegistryWriteError(locked);\n\n const document = readTargetDocument(target, view.files);\n const replaced = document.providers[id] !== undefined;\n if (replaced && !input.force) {\n throw new ProviderRegistryWriteError(\n `'${id}' already exists in ${target.path} — pass --force to overwrite it.`,\n );\n }\n\n let entry: AIProviderEntry;\n if (input.entry) {\n entry = input.entry;\n } else {\n const preset = input.presetId ? getProviderPreset(input.presetId) : undefined;\n if (!preset) {\n throw new ProviderRegistryWriteError(\n `Unknown preset '${input.presetId}'. Run \\`skaile providers list\\` to see the catalog, ` +\n \"or use `--preset custom`.\",\n );\n }\n entry = expandPreset(preset, {\n credentialRef: input.credentialRef,\n baseUrl: input.baseUrl,\n surface: input.surface,\n label: input.label,\n params: input.params,\n });\n const missing = (preset.required_params ?? []).filter(\n (key) => !(key in ((entry as AIProviderLlmEntry).params ?? {})),\n );\n if (missing.length > 0) {\n throw new ProviderRegistryWriteError(\n `Preset '${preset.id}' needs ${missing.map((m) => `--param ${m}=<value>`).join(\" \")}`,\n );\n }\n }\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: entry },\n };\n const { diagnostics } = validateRegistry(\n { version: 1, providers: next.providers },\n { source: target.path },\n );\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n if (errors.length > 0) {\n throw new ProviderRegistryWriteError(\n errors.map((d) => (d.path ? `${d.path}: ${d.message}` : d.message)).join(\"\\n\"),\n );\n }\n saveProviderRegistryFile(target.path, next);\n\n return { id, layer: target.layer, path: target.path, entry, replaced };\n}\n\n/** The env var an `env:` credential reference points at, if it is one. */\nexport function credentialEnvVarName(entry: AIProviderEntry): string | undefined {\n const ref = entry.credential?.ref;\n return ref?.startsWith(\"env:\") ? ref.slice(4) : undefined;\n}\n\n/** Build the `--preset custom` entry from the three literals the user gave. */\nfunction customEntry(\n answers: { surface: AIProviderSurface; baseUrl: string; credentialRef: string },\n opts: AddOptions,\n): AIProviderEntry {\n const kind = (opts.kind ?? \"llm\") as AIProviderEntry[\"kind\"];\n // Anthropic- and Google-shaped surfaces read a dedicated API-key header;\n // everything else is a bearer token. `set <id> credential.kind …` adjusts.\n const credentialKind =\n kind === \"stt\" ||\n kind === \"tts\" ||\n answers.surface === \"anthropic-messages\" ||\n answers.surface === \"google-generative-ai\" ||\n answers.surface === \"azure-openai-responses\"\n ? \"api_key_header\"\n : \"bearer\";\n if (kind === \"stt\" || kind === \"tts\") {\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n };\n }\n return {\n kind,\n ...(opts.label ? { label: opts.label } : {}),\n surface: answers.surface,\n base_url: answers.baseUrl,\n credential: { kind: credentialKind, ref: answers.credentialRef },\n } as AIProviderLlmEntry;\n}\n\nasync function runAdd(idArg: string | undefined, opts: AddOptions): Promise<void> {\n const presetId = opts.preset;\n if (!presetId) {\n logErr(\n `--preset is required. Run ${S.cmd(\"skaile providers list\")} for the catalog, ` +\n `or use ${S.cmd(\"--preset custom\")}.`,\n );\n process.exit(1);\n }\n const id = idArg ?? presetId;\n if (id === CUSTOM_PRESET && !idArg) {\n logErr(\"--preset custom needs an entry id: skaile providers add <id> --preset custom\");\n process.exit(1);\n }\n\n const entry =\n presetId === CUSTOM_PRESET ? customEntry(await promptCustomEntry(id, opts), opts) : undefined;\n\n let added: AddedProviderEntry;\n try {\n added = addProviderEntry({\n id,\n ...(entry ? { entry } : { presetId }),\n credentialRef: opts.credential,\n baseUrl: opts.baseUrl,\n surface: opts.surface as AIProviderSurface | undefined,\n label: opts.label,\n params: parseParams(opts.param),\n projectDir: opts.projectDir,\n workspace: opts.workspace,\n force: opts.force,\n });\n } catch (error) {\n logErr(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n logOk(`Added ${S.bold(id)} (${presetId}) to the ${added.layer} registry`);\n console.log(S.dim(` → ${added.path}`));\n const name = credentialEnvVarName(added.entry);\n if (name) {\n console.log(\n ` ${S.dim(\"The secret itself never goes in this file — export it:\")} ${S.cmd(`export ${name}=…`)}`,\n );\n }\n console.log(` ${S.dim(\"Verify with:\")} ${S.cmd(`skaile providers test ${id}`)}`);\n}\n\n// ── set / rm ───────────────────────────────────────────────────────────────\n\n/** Coerce a CLI string into the type the schema expects at `key`. */\nfunction coerceValue(key: string, value: string): unknown {\n const leaf = key.split(\".\").pop() ?? key;\n if (leaf === \"enabled\" || leaf === \"locked\" || leaf === \"tools\" || leaf === \"images\") {\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n logErr(`'${key}' takes true or false (got '${value}')`);\n process.exit(1);\n }\n if (leaf === \"context_window\" || leaf === \"thinking_max\") {\n const parsed = Number(value);\n if (!Number.isFinite(parsed)) {\n logErr(`'${key}' takes a number (got '${value}')`);\n process.exit(1);\n }\n return parsed;\n }\n return value;\n}\n\n/** Write `value` at a dotted path, creating intermediate maps. */\nfunction setDotted(entry: Record<string, unknown>, key: string, value: unknown): void {\n const segments = key.split(\".\");\n let cursor = entry;\n for (const segment of segments.slice(0, -1)) {\n const next = cursor[segment];\n if (typeof next !== \"object\" || next === null || Array.isArray(next)) {\n cursor[segment] = {};\n }\n cursor = cursor[segment] as Record<string, unknown>;\n }\n cursor[segments[segments.length - 1]] = value;\n}\n\nfunction runSet(id: string, key: string, value: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files, key);\n\n const document = readTargetDocument(target, view.files);\n const existing = document.providers[id];\n const inherited = view.merged.providers[id];\n if (!existing && !inherited) {\n logErr(\n `No provider '${id}'. Add it with ${S.cmd(`skaile providers add ${id} --preset <preset>`)}`,\n );\n process.exit(1);\n }\n\n // Writing a field into a layer that has no entry yet leaves a one-field\n // override: the layers below keep supplying the rest (§1.5), so copying\n // their `kind` down here would pin a value this layer does not own.\n const base = (existing ? structuredClone(existing) : {}) as unknown as Record<string, unknown>;\n setDotted(base, key, coerceValue(key, value));\n\n const next: AIProviderRegistryDocument = {\n version: 1,\n providers: { ...document.providers, [id]: base as unknown as AIProviderEntry },\n };\n validateOrExit(next, target);\n saveProviderRegistryFile(target.path, next);\n\n logOk(`Set ${S.bold(`${id}.${key}`)} = ${value} in the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n}\n\nfunction runRemove(id: string, opts: ScopeOptions): void {\n const view = loadRegistryView(opts);\n const target = targetFile(opts);\n exitIfLocked(id, target, view.files);\n\n const document = readTargetDocument(target, view.files);\n if (!document.providers[id]) {\n logErr(`No provider '${id}' in ${target.path}`);\n process.exit(1);\n }\n const providers = { ...document.providers };\n delete providers[id];\n saveProviderRegistryFile(target.path, { version: 1, providers });\n\n logOk(`Removed ${S.bold(id)} from the ${target.layer} registry`);\n console.log(S.dim(` → ${target.path}`));\n if (\n view.merged.providers[id] &&\n view.files.some((f) => f.path !== target.path && f.document.providers[id])\n ) {\n logInfo(`'${id}' is still defined in another layer — run 'skaile providers list' to see it.`);\n }\n}\n\n// ── test ───────────────────────────────────────────────────────────────────\n\nasync function runTest(id: string, opts: ScopeOptions): Promise<void> {\n const view = loadRegistryView(opts);\n const entry = view.merged.providers[id];\n if (!entry) {\n logErr(`No provider '${id}'. Run ${S.cmd(\"skaile providers list\")} to see what is configured.`);\n process.exit(1);\n }\n\n const credential = resolveCredential(entry);\n console.log();\n console.log(` ${S.heading(id)} ${S.dim(`(${view.merged.origin[id]} layer)`)}`);\n console.log(` ${S.label(\"endpoint \")} ${resolveEntryBaseUrl(entry) ?? S.dim(\"(unresolved)\")}`);\n console.log(\n ` ${S.label(\"credential\")} ${credentialSummary(entry)} ${\n credential.error\n ? S.err(`— ${credential.error}`)\n : S.dim(`— resolved from ${credential.source}`)\n }`,\n );\n\n if (credential.error) {\n console.log();\n logErr(`${id} is not usable yet: ${credential.error}`);\n process.exit(1);\n }\n\n const result = await probeProviderEntry(entry, { secret: credential.value });\n if (result.url) console.log(` ${S.label(\"probe \")} GET ${result.url}`);\n console.log();\n if (result.ok) {\n logOk(`${id}: ${result.detail}${result.status ? ` (HTTP ${result.status})` : \"\"}`);\n return;\n }\n if (!result.probed) {\n logWarn(`${id}: ${result.detail}`);\n return;\n }\n logErr(`${id}: ${result.detail}`);\n process.exit(1);\n}\n\n// ── command ────────────────────────────────────────────────────────────────\n\n/**\n * Create the `skaile providers` command group.\n *\n * `list` shows the catalog and what is configured; `add` writes an entry from\n * a preset (or from three literals with `--preset custom`); `set` and `rm`\n * edit one layer; `test` sends one read-only request and reports what came\n * back, never the credential.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n */\nexport function makeProvidersCommand(): Command {\n const cmd = new Command(\"providers\").description(\n \"Manage AI provider endpoints (~/.skaile/providers.yml)\",\n );\n\n cmd\n .command(\"list\")\n .description(\"List catalog presets and configured providers\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--json\", \"Machine-readable output\")\n .action((opts) => {\n const view = loadRegistryView(opts);\n if (opts.json) {\n console.log(\n JSON.stringify(\n {\n presets: listProviderPresets().map((preset) => ({\n id: preset.id,\n kind: preset.kind,\n surface: preset.surface,\n transport: preset.transport ?? (preset.surface ? \"direct\" : undefined),\n base_url: presetBaseUrl(preset),\n credential: preset.credential,\n required_params: preset.required_params,\n })),\n providers: view.merged.order.map((id) => ({\n id,\n layer: view.merged.origin[id],\n entry: view.merged.providers[id],\n base_url: resolveEntryBaseUrl(view.merged.providers[id]),\n })),\n },\n null,\n 2,\n ),\n );\n return;\n }\n reportDiagnostics(view.diagnostics);\n printPresets();\n printConfigured(view);\n });\n\n cmd\n .command(\"add [id]\")\n .description(\"Add a provider from a catalog preset (id defaults to the preset name)\")\n .requiredOption(\"--preset <preset>\", `Catalog preset, or '${CUSTOM_PRESET}'`)\n .option(\"--credential <ref>\", \"Credential reference (env:NAME, cmd:…, platform:…, keyring:…)\")\n .option(\"--base-url <url>\", \"Override the preset endpoint\")\n .option(\"--surface <surface>\", `Wire surface (${AI_PROVIDER_SURFACES.join(\", \")})`)\n .option(\"--kind <kind>\", \"Entry kind for --preset custom (llm, embed, stt, tts)\", \"llm\")\n .option(\"--label <text>\", \"Display label\")\n .option(\n \"--param <key=value>\",\n \"Transport parameter (repeatable): region, project, location, resource, deployment, api_version\",\n (value: string, previous: string[]) => [...previous, value],\n [] as string[],\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .option(\"--force\", \"Overwrite an existing entry in the target file\")\n .action((id: string | undefined, opts: AddOptions) => runAdd(id, opts));\n\n cmd\n .command(\"set <id> <key> <value>\")\n .description(\n \"Set one field (base_url, enabled, credential.ref, headers.<name>, model_map.<id>…)\",\n )\n .option(\"--workspace\", \"Write <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, key: string, value: string, opts: ScopeOptions) =>\n runSet(id, key, value, opts),\n );\n\n cmd\n .command(\"rm <id>\")\n .description(\"Remove a provider from one layer\")\n .option(\"--workspace\", \"Edit <workspace>/.skaile/providers.yml instead of the user file\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runRemove(id, opts));\n\n cmd\n .command(\"test <id>\")\n .description(\"Send one read-only request to a provider and report the result\")\n .option(\"--project-dir <path>\", \"Project directory\")\n .action((id: string, opts: ScopeOptions) => runTest(id, opts));\n\n return cmd;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { SubprocessCliDriver, extractText, extractCost, extractTokens } from './chunk-3KHYGOEY.js';
2
- import { resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-ZGQTS3Y4.js';
3
- import { getStaticModels, fetchProviderModels } from './chunk-OOWHXOK6.js';
4
- import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-HJ5MCB3L.js';
1
+ import { SubprocessCliDriver, extractText, extractCost, extractTokens } from './chunk-Y3HTGHJC.js';
2
+ import { resolveEnvDriverSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-CPWLNZGJ.js';
3
+ import { getStaticModels, fetchProviderModels } from './chunk-M3B6EIJD.js';
4
+ import { getProviderPreset, BUILTIN_DRIVER_CATALOG, getBridgeLogger, entryCredentialValue, registryDriverConfig } from './chunk-47U4GZ4M.js';
5
5
  import * as z from 'zod';
6
6
 
7
7
  var GOOGLE_DEFAULT_BASE_URL = getProviderPreset("google")?.base_url;
@@ -183,5 +183,5 @@ var geminiDriverTarget = {
183
183
  };
184
184
 
185
185
  export { GeminiDriver, GeminiFamilyDriver, geminiDriverTarget };
186
- //# sourceMappingURL=chunk-TH4CTXHX.js.map
187
- //# sourceMappingURL=chunk-TH4CTXHX.js.map
186
+ //# sourceMappingURL=chunk-XUSALIEI.js.map
187
+ //# sourceMappingURL=chunk-XUSALIEI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../bridge/src/drivers/gemini.ts"],"names":[],"mappings":";;;;;;AAuBA,IAAM,uBAAA,GAA0B,iBAAA,CAAkB,QAAQ,CAAA,EAAG,QAAA;AAWtD,IAAe,kBAAA,GAAf,cAA0C,mBAAA,CAAoB;AAAA,EACzD,WAAW,IAAA,EAAiB;AACpC,IAAA,QAAQ,MAAM,IAAA;AAAM,MAClB,KAAK,MAAA;AAAA,MACL,KAAK,QAAA;AACH,QAAA,IAAA,CAAK,eAAe,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,UAAA,IAAc,KAAK,EAAE,CAAA;AAChE,QAAA;AAAA,MAEF,KAAK,SAAA;AAAA,MACL,KAAK,WAAA,EAAa;AAChB,QAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,IAAQ,IAAA,CAAK,SAAS,IAAA,IAAQ,WAAA;AAChD,QAAA,IAAI,SAAS,WAAA,EAAa;AAC1B,QAAA,MAAM,IAAA,GAAO,YAAY,IAAI,CAAA;AAC7B,QAAA,IAAI,IAAA,CAAK,SAAS,IAAA,IAAQ,IAAA,CAAK,UAAU,IAAA,IAAQ,IAAA,CAAK,aAAa,IAAA,EAAM;AACvE,UAAA,IAAA,CAAK,iBAAiB,IAAI,CAAA;AAAA,QAC5B,CAAA,MAAO;AACL,UAAA,IAAA,CAAK,mBAAmB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MAAA,CAAO,MAAA,GAAS,eAAA,CAAgB,QAAQ,CAAA;AAAA,EACzF;AACF;AAMO,IAAM,kBAAA,GAAgD;AAAA,EAC3D,EAAA,EAAI,QAAA;AAAA,EACJ,WAAA,EAAa,sBAAA,CAAuB,MAAA,EAAQ,IAAA,IAAQ,YAAA;AAAA,EACpD,UAAA,EAAY,CAAA;AAAA,EACZ,YAAA,EAAgB,CAAA,CAAA,MAAA,CAAoB,MAAM,IAAI,CAAA;AAAA,EAC9C,QAAQ,OAAO,MAAA,EAAQ,IAAA,KAAS,IAAI,aAAa,MAAM,CAAA;AAAA,EACvD,UAAA,EAAY,OAAO,QAAA,EAAU,OAAA,KAC3B,IAAI,YAAA,CAAa;AAAA,IACf,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,IACjB,SAAA,EAAW,YAAA;AAAA,IACX,GAAG,oBAAA,CAAqB,QAAA,EAAU,OAAO;AAAA,GAC1C,EAAE,UAAA;AACP","file":"chunk-TH4CTXHX.js","sourcesContent":["import type { DriverTarget } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { getBridgeLogger } from \"../logger.js\";\nimport { fetchProviderModels, getStaticModels, type ModelEntry } from \"../models.js\";\nimport { getProviderPreset } from \"../provider-catalog.js\";\nimport { entryCredentialValue } from \"../provider-materialize/credential-env.js\";\nimport {\n bindSingleProviderEntry,\n type EnvDriverSession,\n type RegistryModelBinding,\n resolveEnvDriverSession,\n resolveRegistryBinding,\n} from \"../provider-materialize/env-drivers.js\";\nimport { registryDriverConfig } from \"../provider-registry-derive.js\";\nimport { BUILTIN_DRIVER_CATALOG } from \"../registry.js\";\nimport type { AgentConfig, DriverInfo, ReconfigureApplied } from \"../types.js\";\nimport { extractCost, extractText, extractTokens, SubprocessCliDriver } from \"./_subprocess-cli.js\";\n\n/**\n * The Gemini API host the CLI talks to unless told otherwise — the catalog's\n * `google` preset, so the two can never drift apart.\n */\nconst GOOGLE_DEFAULT_BASE_URL = getProviderPreset(\"google\")?.base_url;\n\n/**\n * Shared base for the Gemini-CLI event family. Gemini CLI and Qwen Code (a fork\n * of Gemini CLI) emit the same `stream-json` event shape, so both dispatch the\n * same {@link handleJson}: `init`/`system` → session capture, `message`/\n * `assistant` → streamed assistant text, `tool_use` / `tool_result` → tool\n * events, `result` → tokens + cost.\n *\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport abstract class GeminiFamilyDriver extends SubprocessCliDriver {\n protected handleJson(json: any): void {\n switch (json?.type) {\n case \"init\":\n case \"system\":\n this.captureSession(json.sessionId ?? json.session_id ?? json.id);\n break;\n\n case \"message\":\n case \"assistant\": {\n const role = json.role ?? json.message?.role ?? \"assistant\";\n if (role !== \"assistant\") break;\n const text = extractText(json);\n if (json.done === true || json.final === true || json.finished === true) {\n this.pushAssistantEnd(text);\n } else {\n this.pushAssistantDelta(text);\n }\n break;\n }\n\n case \"tool_use\":\n case \"tool_call\":\n this.pushToolCall(json.name ?? json.tool ?? \"tool\", json.input ?? json.args ?? {});\n break;\n\n case \"tool_result\":\n this.pushToolResult(\n json.name ?? json.tool ?? \"tool\",\n json.result ?? json.output ?? json.content,\n Boolean(json.is_error ?? json.isError ?? json.error),\n );\n break;\n\n case \"error\":\n this.pushError(this.classifyMessage(String(json.message ?? json.error ?? \"error\")));\n break;\n\n case \"result\":\n this.captureSession(json.sessionId ?? json.session_id);\n this.pushResult({\n tokens: extractTokens(json),\n costUsd: extractCost(json),\n summary: extractText(json) || \"Task completed\",\n });\n break;\n }\n }\n\n // ── Registry binding ──────────────────────────────────────────────────────\n\n private providers?: EnvDriverSession;\n private boundEntry?: RegistryModelBinding;\n private bindingResolved = false;\n\n /** This session's AI providers, resolved once from the config. */\n protected providerSession(): EnvDriverSession {\n this.providers ??= resolveEnvDriverSession(this.config);\n return this.providers;\n }\n\n /**\n * The AI provider entry this session's model selector names, memoized until\n * the model changes.\n *\n * Gemini CLI and Qwen Code are `single`-plurality harnesses (§2.3): they\n * address one endpoint, so the bound entry supplies both the credential and\n * the base URL. Resolving through {@link bindSingleProviderEntry} is what\n * puts the surface check — which throws — on the start path.\n */\n protected registryBinding(): RegistryModelBinding | undefined {\n if (this.bindingResolved) return this.boundEntry;\n const binding = bindSingleProviderEntry(\n this.driverInfo.id,\n this.productName,\n this.providerSession(),\n );\n for (const warning of binding?.warnings ?? []) this.log.warn(warning);\n this.boundEntry = binding;\n this.bindingResolved = true;\n return binding;\n }\n\n /**\n * Fail before the first spawn when the bound entry speaks a surface this\n * harness cannot — the error names the surface.\n */\n override async start(): Promise<void> {\n this.registryBinding();\n await super.start();\n }\n\n protected override onReconfigured(applied: ReconfigureApplied): void {\n if (applied.model !== undefined) {\n this.providers = undefined;\n this.bindingResolved = false;\n }\n }\n\n /** The provider-side model id the harness is actually run with. */\n override getModel(): string | undefined {\n return resolveRegistryBinding(this.providerSession())?.providerModelId ?? this.config.model;\n }\n}\n\n/**\n * Agent driver for the Google **Gemini CLI** (`gemini`).\n *\n * Spawns `gemini -p \"<prompt>\" --output-format stream-json` per turn and maps\n * the stream-json events to the unified {@link AgentEvent} stream. Google\n * models only (`surface: google-generative-ai`): the AI provider entry the\n * session's model selector names supplies `GEMINI_API_KEY`, the `-m` model id\n * and — for a non-default endpoint — `GOOGLE_GEMINI_BASE_URL`.\n *\n * @remarks\n * - **Requires Gemini CLI ≥ v0.6.1** — earlier versions reject\n * `--output-format`. A too-old CLI surfaces as a `process`-category exit error.\n * - **Session resume is not available in headless (`-p`) mode** — the CLI errors\n * if asked to resume non-interactively, so this driver runs single-turn per\n * process and logs a warning when a resume id is present.\n * - Exit codes: `42` → input/validation error, `53` → turn-limit (treated as a\n * completed turn).\n *\n * @see https://github.com/google-gemini/gemini-cli\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport class GeminiDriver extends GeminiFamilyDriver {\n readonly driverInfo: DriverInfo = {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n };\n\n protected readonly log: Logger = getBridgeLogger(\"gemini\");\n protected readonly defaultBin = \"gemini\";\n protected readonly productName = \"Gemini CLI\";\n protected readonly envPrefix = \"GEMINI\";\n\n protected buildArgs(message: string, resumeId: string | undefined): string[] {\n if (resumeId) {\n this.log.warn(\"Gemini CLI cannot resume in headless mode; starting a fresh turn\", {\n resumeId,\n });\n }\n const args = [\"-p\", message, \"--output-format\", \"stream-json\"];\n const model = this.registryBinding()?.providerModelId ?? this.config.model;\n if (model) args.push(\"-m\", model);\n return args;\n }\n\n protected buildEnv(): Record<string, string> {\n const env = this.baseEnv([\"GEMINI_API_KEY\", \"GOOGLE_API_KEY\", \"GOOGLE_GEMINI_BASE_URL\"]);\n const binding = this.registryBinding();\n if (!binding) return env;\n\n // The entry is the authority: inherited Google carriers are dropped so an\n // ambient key cannot authenticate a session pointed somewhere else.\n delete env.GEMINI_API_KEY;\n delete env.GOOGLE_API_KEY;\n delete env.GOOGLE_GEMINI_BASE_URL;\n const key = entryCredentialValue(binding.providerId, binding.entry, {\n env: this.providerSession().lookupEnv,\n });\n if (key) env.GEMINI_API_KEY = key;\n // Only a non-default endpoint is worth naming: Gemini CLI reads\n // GOOGLE_GEMINI_BASE_URL as an override of its own default host.\n if (binding.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL) {\n env.GOOGLE_GEMINI_BASE_URL = binding.baseUrl;\n }\n return env;\n }\n\n protected installHint(): string {\n return \"Gemini CLI is not installed or not on your PATH. Install it with `npm i -g @google/gemini-cli` (≥ v0.6.1).\";\n }\n\n protected override classifyExit(code: number | null, signal: NodeJS.Signals | null) {\n if (code === 42) {\n return {\n message: \"Gemini CLI reported an input error (exit 42)\",\n category: \"validation\" as const,\n retryable: false,\n hint: \"The prompt or flags were rejected by Gemini CLI. Check the model name and arguments.\",\n };\n }\n if (code === 53) return null; // turn-limit — the result was already emitted.\n return super.classifyExit(code, signal);\n }\n\n /**\n * Discovery runs against the bound entry: its credential and, for a\n * non-default endpoint, its base URL. Without an entry the ambient\n * `GEMINI_API_KEY` is the last resort, and an unreachable API falls back to\n * the static Google catalog.\n */\n override async listModels(): Promise<ModelEntry[]> {\n const session = this.providerSession();\n const binding = resolveRegistryBinding(session);\n const key = binding\n ? entryCredentialValue(binding.providerId, binding.entry, { env: session.lookupEnv })\n : session.lookupEnv.GEMINI_API_KEY;\n if (!key) return getStaticModels(\"google\");\n const result = await fetchProviderModels(\n \"google\",\n key,\n binding?.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL\n ? { baseUrl: binding.baseUrl }\n : {},\n );\n return result.ok && result.models.length > 0 ? result.models : getStaticModels(\"google\");\n }\n}\n\n/**\n * `DriverTarget` wrapper for the gemini driver. Registered into the plugin\n * registry by `registerBuiltinDrivers()`.\n */\nexport const geminiDriverTarget: DriverTarget<AgentConfig> = {\n id: \"gemini\",\n displayName: BUILTIN_DRIVER_CATALOG.gemini?.name ?? \"Gemini CLI\",\n apiVersion: 1,\n configSchema: z.custom<AgentConfig>(() => true),\n create: async (config, _ctx) => new GeminiDriver(config),\n listModels: async (registry, options) =>\n new GeminiDriver({\n cwd: process.cwd(),\n sessionId: \"model-list\",\n ...registryDriverConfig(registry, options),\n }).listModels(),\n};\n"]}
1
+ {"version":3,"sources":["../bridge/src/drivers/gemini.ts"],"names":[],"mappings":";;;;;;AAuBA,IAAM,uBAAA,GAA0B,iBAAA,CAAkB,QAAQ,CAAA,EAAG,QAAA;AAWtD,IAAe,kBAAA,GAAf,cAA0C,mBAAA,CAAoB;AAAA,EACzD,WAAW,IAAA,EAAiB;AACpC,IAAA,QAAQ,MAAM,IAAA;AAAM,MAClB,KAAK,MAAA;AAAA,MACL,KAAK,QAAA;AACH,QAAA,IAAA,CAAK,eAAe,IAAA,CAAK,SAAA,IAAa,IAAA,CAAK,UAAA,IAAc,KAAK,EAAE,CAAA;AAChE,QAAA;AAAA,MAEF,KAAK,SAAA;AAAA,MACL,KAAK,WAAA,EAAa;AAChB,QAAA,MAAM,I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AAA,CAAU,cAAA;AACtB,IAAA,IAAI,CAAC,GAAA,EAAK,OAAO,eAAA,CAAgB,QAAQ,CAAA;AACzC,IAAA,MAAM,SAAS,MAAM,mBAAA;AAAA,MACnB,QAAA;AAAA,MACA,GAAA;AAAA,MACA,OAAA,EAAS,OAAA,IAAW,OAAA,CAAQ,OAAA,KAAY,uBAAA,GACpC,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ,GAC3B;AAAC,KACP;AACA,IAAA,OAAO,MAAA,CAAO,MAAM,MAAA,CAAO,MAAA,CAAO,SAAS,CAAA,GAAI,MAAA,CAAO,MAAA,GAAS,eAAA,CAAgB,QAAQ,CAAA;AAAA,EACzF;AACF;AAMO,IAAM,kBAAA,GAAgD;AAAA,EAC3D,EAAA,EAAI,QAAA;AAAA,EACJ,WAAA,EAAa,sBAAA,CAAuB,MAAA,EAAQ,IAAA,IAAQ,YAAA;AAAA,EACpD,UAAA,EAAY,CAAA;AAAA,EACZ,YAAA,EAAgB,CAAA,CAAA,MAAA,CAAoB,MAAM,IAAI,CAAA;AAAA,EAC9C,QAAQ,OAAO,MAAA,EAAQ,IAAA,KAAS,IAAI,aAAa,MAAM,CAAA;AAAA,EACvD,UAAA,EAAY,OAAO,QAAA,EAAU,OAAA,KAC3B,IAAI,YAAA,CAAa;AAAA,IACf,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,IACjB,SAAA,EAAW,YAAA;AAAA,IACX,GAAG,oBAAA,CAAqB,QAAA,EAAU,OAAO;AAAA,GAC1C,EAAE,UAAA;AACP","file":"chunk-XUSALIEI.js","sourcesContent":["import type { DriverTarget } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { getBridgeLogger } from \"../logger.js\";\nimport { fetchProviderModels, getStaticModels, type ModelEntry } from \"../models.js\";\nimport { getProviderPreset } from \"../provider-catalog.js\";\nimport { entryCredentialValue } from \"../provider-materialize/credential-env.js\";\nimport {\n bindSingleProviderEntry,\n type EnvDriverSession,\n type RegistryModelBinding,\n resolveEnvDriverSession,\n resolveRegistryBinding,\n} from \"../provider-materialize/env-drivers.js\";\nimport { registryDriverConfig } from \"../provider-registry-derive.js\";\nimport { BUILTIN_DRIVER_CATALOG } from \"../registry.js\";\nimport type { AgentConfig, DriverInfo, ReconfigureApplied } from \"../types.js\";\nimport { extractCost, extractText, extractTokens, SubprocessCliDriver } from \"./_subprocess-cli.js\";\n\n/**\n * The Gemini API host the CLI talks to unless told otherwise — the catalog's\n * `google` preset, so the two can never drift apart.\n */\nconst GOOGLE_DEFAULT_BASE_URL = getProviderPreset(\"google\")?.base_url;\n\n/**\n * Shared base for the Gemini-CLI event family. Gemini CLI and Qwen Code (a fork\n * of Gemini CLI) emit the same `stream-json` event shape, so both dispatch the\n * same {@link handleJson}: `init`/`system` → session capture, `message`/\n * `assistant` → streamed assistant text, `tool_use` / `tool_result` → tool\n * events, `result` → tokens + cost.\n *\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport abstract class GeminiFamilyDriver extends SubprocessCliDriver {\n protected handleJson(json: any): void {\n switch (json?.type) {\n case \"init\":\n case \"system\":\n this.captureSession(json.sessionId ?? json.session_id ?? json.id);\n break;\n\n case \"message\":\n case \"assistant\": {\n const role = json.role ?? json.message?.role ?? \"assistant\";\n if (role !== \"assistant\") break;\n const text = extractText(json);\n if (json.done === true || json.final === true || json.finished === true) {\n this.pushAssistantEnd(text);\n } else {\n this.pushAssistantDelta(text);\n }\n break;\n }\n\n case \"tool_use\":\n case \"tool_call\":\n this.pushToolCall(json.name ?? json.tool ?? \"tool\", json.input ?? json.args ?? {});\n break;\n\n case \"tool_result\":\n this.pushToolResult(\n json.name ?? json.tool ?? \"tool\",\n json.result ?? json.output ?? json.content,\n Boolean(json.is_error ?? json.isError ?? json.error),\n );\n break;\n\n case \"error\":\n this.pushError(this.classifyMessage(String(json.message ?? json.error ?? \"error\")));\n break;\n\n case \"result\":\n this.captureSession(json.sessionId ?? json.session_id);\n this.pushResult({\n tokens: extractTokens(json),\n costUsd: extractCost(json),\n summary: extractText(json) || \"Task completed\",\n });\n break;\n }\n }\n\n // ── Registry binding ──────────────────────────────────────────────────────\n\n private providers?: EnvDriverSession;\n private boundEntry?: RegistryModelBinding;\n private bindingResolved = false;\n\n /** This session's AI providers, resolved once from the config. */\n protected providerSession(): EnvDriverSession {\n this.providers ??= resolveEnvDriverSession(this.config);\n return this.providers;\n }\n\n /**\n * The AI provider entry this session's model selector names, memoized until\n * the model changes.\n *\n * Gemini CLI and Qwen Code are `single`-plurality harnesses (§2.3): they\n * address one endpoint, so the bound entry supplies both the credential and\n * the base URL. Resolving through {@link bindSingleProviderEntry} is what\n * puts the surface check — which throws — on the start path.\n */\n protected registryBinding(): RegistryModelBinding | undefined {\n if (this.bindingResolved) return this.boundEntry;\n const binding = bindSingleProviderEntry(\n this.driverInfo.id,\n this.productName,\n this.providerSession(),\n );\n for (const warning of binding?.warnings ?? []) this.log.warn(warning);\n this.boundEntry = binding;\n this.bindingResolved = true;\n return binding;\n }\n\n /**\n * Fail before the first spawn when the bound entry speaks a surface this\n * harness cannot — the error names the surface.\n */\n override async start(): Promise<void> {\n this.registryBinding();\n await super.start();\n }\n\n protected override onReconfigured(applied: ReconfigureApplied): void {\n if (applied.model !== undefined) {\n this.providers = undefined;\n this.bindingResolved = false;\n }\n }\n\n /** The provider-side model id the harness is actually run with. */\n override getModel(): string | undefined {\n return resolveRegistryBinding(this.providerSession())?.providerModelId ?? this.config.model;\n }\n}\n\n/**\n * Agent driver for the Google **Gemini CLI** (`gemini`).\n *\n * Spawns `gemini -p \"<prompt>\" --output-format stream-json` per turn and maps\n * the stream-json events to the unified {@link AgentEvent} stream. Google\n * models only (`surface: google-generative-ai`): the AI provider entry the\n * session's model selector names supplies `GEMINI_API_KEY`, the `-m` model id\n * and — for a non-default endpoint — `GOOGLE_GEMINI_BASE_URL`.\n *\n * @remarks\n * - **Requires Gemini CLI ≥ v0.6.1** — earlier versions reject\n * `--output-format`. A too-old CLI surfaces as a `process`-category exit error.\n * - **Session resume is not available in headless (`-p`) mode** — the CLI errors\n * if asked to resume non-interactively, so this driver runs single-turn per\n * process and logs a warning when a resume id is present.\n * - Exit codes: `42` → input/validation error, `53` → turn-limit (treated as a\n * completed turn).\n *\n * @see https://github.com/google-gemini/gemini-cli\n * @docLink packages/bridge/drivers#gemini-driver\n */\nexport class GeminiDriver extends GeminiFamilyDriver {\n readonly driverInfo: DriverInfo = {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n };\n\n protected readonly log: Logger = getBridgeLogger(\"gemini\");\n protected readonly defaultBin = \"gemini\";\n protected readonly productName = \"Gemini CLI\";\n protected readonly envPrefix = \"GEMINI\";\n\n protected buildArgs(message: string, resumeId: string | undefined): string[] {\n if (resumeId) {\n this.log.warn(\"Gemini CLI cannot resume in headless mode; starting a fresh turn\", {\n resumeId,\n });\n }\n const args = [\"-p\", message, \"--output-format\", \"stream-json\"];\n const model = this.registryBinding()?.providerModelId ?? this.config.model;\n if (model) args.push(\"-m\", model);\n return args;\n }\n\n protected buildEnv(): Record<string, string> {\n const env = this.baseEnv([\"GEMINI_API_KEY\", \"GOOGLE_API_KEY\", \"GOOGLE_GEMINI_BASE_URL\"]);\n const binding = this.registryBinding();\n if (!binding) return env;\n\n // The entry is the authority: inherited Google carriers are dropped so an\n // ambient key cannot authenticate a session pointed somewhere else.\n delete env.GEMINI_API_KEY;\n delete env.GOOGLE_API_KEY;\n delete env.GOOGLE_GEMINI_BASE_URL;\n const key = entryCredentialValue(binding.providerId, binding.entry, {\n env: this.providerSession().lookupEnv,\n });\n if (key) env.GEMINI_API_KEY = key;\n // Only a non-default endpoint is worth naming: Gemini CLI reads\n // GOOGLE_GEMINI_BASE_URL as an override of its own default host.\n if (binding.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL) {\n env.GOOGLE_GEMINI_BASE_URL = binding.baseUrl;\n }\n return env;\n }\n\n protected installHint(): string {\n return \"Gemini CLI is not installed or not on your PATH. Install it with `npm i -g @google/gemini-cli` (≥ v0.6.1).\";\n }\n\n protected override classifyExit(code: number | null, signal: NodeJS.Signals | null) {\n if (code === 42) {\n return {\n message: \"Gemini CLI reported an input error (exit 42)\",\n category: \"validation\" as const,\n retryable: false,\n hint: \"The prompt or flags were rejected by Gemini CLI. Check the model name and arguments.\",\n };\n }\n if (code === 53) return null; // turn-limit — the result was already emitted.\n return super.classifyExit(code, signal);\n }\n\n /**\n * Discovery runs against the bound entry: its credential and, for a\n * non-default endpoint, its base URL. Without an entry the ambient\n * `GEMINI_API_KEY` is the last resort, and an unreachable API falls back to\n * the static Google catalog.\n */\n override async listModels(): Promise<ModelEntry[]> {\n const session = this.providerSession();\n const binding = resolveRegistryBinding(session);\n const key = binding\n ? entryCredentialValue(binding.providerId, binding.entry, { env: session.lookupEnv })\n : session.lookupEnv.GEMINI_API_KEY;\n if (!key) return getStaticModels(\"google\");\n const result = await fetchProviderModels(\n \"google\",\n key,\n binding?.baseUrl && binding.baseUrl !== GOOGLE_DEFAULT_BASE_URL\n ? { baseUrl: binding.baseUrl }\n : {},\n );\n return result.ok && result.models.length > 0 ? result.models : getStaticModels(\"google\");\n }\n}\n\n/**\n * `DriverTarget` wrapper for the gemini driver. Registered into the plugin\n * registry by `registerBuiltinDrivers()`.\n */\nexport const geminiDriverTarget: DriverTarget<AgentConfig> = {\n id: \"gemini\",\n displayName: BUILTIN_DRIVER_CATALOG.gemini?.name ?? \"Gemini CLI\",\n apiVersion: 1,\n configSchema: z.custom<AgentConfig>(() => true),\n create: async (config, _ctx) => new GeminiDriver(config),\n listModels: async (registry, options) =>\n new GeminiDriver({\n cwd: process.cwd(),\n sessionId: \"model-list\",\n ...registryDriverConfig(registry, options),\n }).listModels(),\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { ReconfigureLedger, classifyGenericErrorMessage, stripRunnerPrivateEnv } from './chunk-B4X2N7JQ.js';
2
2
  import { wrapAgentCommand, resolveAgentExec } from './chunk-YROR332M.js';
3
- import { AgentDriver } from './chunk-HJ5MCB3L.js';
3
+ import { AgentDriver } from './chunk-47U4GZ4M.js';
4
4
  import { spawn } from 'child_process';
5
5
  import { createInterface } from 'readline';
6
6
 
@@ -442,5 +442,5 @@ function extractCost(json) {
442
442
  }
443
443
 
444
444
  export { SubprocessCliDriver, extractCost, extractText, extractTokens };
445
- //# sourceMappingURL=chunk-3KHYGOEY.js.map
446
- //# sourceMappingURL=chunk-3KHYGOEY.js.map
445
+ //# sourceMappingURL=chunk-Y3HTGHJC.js.map
446
+ //# sourceMappingURL=chunk-Y3HTGHJC.js.map