@skaile/workspaces 5.13.0 → 5.14.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 (237) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-ALMTHLPV.js → asset-feeds-PAOX3FUT.js} +11 -11
  4. package/dist/{asset-feeds-ALMTHLPV.js.map → asset-feeds-PAOX3FUT.js.map} +1 -1
  5. package/dist/asset-manager/catalog-deployer.js +3 -3
  6. package/dist/asset-manager/index.js +7 -7
  7. package/dist/asset-manager/installer.js +5 -5
  8. package/dist/asset-manager/renderers.js +4 -4
  9. package/dist/bridge/drivers/claude-sdk.js +145 -10
  10. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  11. package/dist/bridge/drivers/codex.js +6 -5
  12. package/dist/bridge/drivers/codex.js.map +1 -1
  13. package/dist/bridge/drivers/continue.js +7 -6
  14. package/dist/bridge/drivers/continue.js.map +1 -1
  15. package/dist/bridge/drivers/echo.js +4 -3
  16. package/dist/bridge/drivers/echo.js.map +1 -1
  17. package/dist/bridge/drivers/gemini.js +6 -5
  18. package/dist/bridge/drivers/goose.js +7 -6
  19. package/dist/bridge/drivers/goose.js.map +1 -1
  20. package/dist/bridge/drivers/omp.js +5 -4
  21. package/dist/bridge/drivers/omp.js.map +1 -1
  22. package/dist/bridge/drivers/opencode.js +7 -6
  23. package/dist/bridge/drivers/opencode.js.map +1 -1
  24. package/dist/bridge/drivers/qwen.js +6 -5
  25. package/dist/bridge/drivers/qwen.js.map +1 -1
  26. package/dist/bridge/index.js +9 -8
  27. package/dist/bridge/src/drivers/claude-sdk.d.ts +2 -0
  28. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  29. package/dist/bridge/src/drivers/claude-self-turns.d.ts +72 -0
  30. package/dist/bridge/src/drivers/claude-self-turns.d.ts.map +1 -0
  31. package/dist/bridge/src/normalizer.d.ts.map +1 -1
  32. package/dist/bridge/src/types.d.ts +12 -0
  33. package/dist/bridge/src/types.d.ts.map +1 -1
  34. package/dist/{chunk-6GICC4RJ.js → chunk-3NNL334S.js} +10 -10
  35. package/dist/{chunk-6GICC4RJ.js.map → chunk-3NNL334S.js.map} +1 -1
  36. package/dist/{chunk-4NJ3QQHZ.js → chunk-5IMGZAKH.js} +4 -4
  37. package/dist/{chunk-4NJ3QQHZ.js.map → chunk-5IMGZAKH.js.map} +1 -1
  38. package/dist/{chunk-6NQDDCIL.js → chunk-5NVDOEWX.js} +15 -7
  39. package/dist/chunk-5NVDOEWX.js.map +1 -0
  40. package/dist/{chunk-BVJU2GKE.js → chunk-6VIVUBNN.js} +4 -271
  41. package/dist/chunk-6VIVUBNN.js.map +1 -0
  42. package/dist/{chunk-GMDSRSGI.js → chunk-7LGNJJ76.js} +6 -6
  43. package/dist/{chunk-GMDSRSGI.js.map → chunk-7LGNJJ76.js.map} +1 -1
  44. package/dist/{chunk-FB3NREF7.js → chunk-BASMWKPM.js} +7 -7
  45. package/dist/{chunk-FB3NREF7.js.map → chunk-BASMWKPM.js.map} +1 -1
  46. package/dist/{chunk-L3ZGYSWY.js → chunk-CAPKENNF.js} +9 -4
  47. package/dist/chunk-CAPKENNF.js.map +1 -0
  48. package/dist/{chunk-4L4R5LV3.js → chunk-CNZI37HV.js} +3 -3
  49. package/dist/{chunk-4L4R5LV3.js.map → chunk-CNZI37HV.js.map} +1 -1
  50. package/dist/{chunk-F4NJDSR7.js → chunk-D5WTOVLG.js} +7 -4
  51. package/dist/chunk-D5WTOVLG.js.map +1 -0
  52. package/dist/{chunk-XJYBCDY2.js → chunk-DHUJRIQQ.js} +3 -3
  53. package/dist/{chunk-XJYBCDY2.js.map → chunk-DHUJRIQQ.js.map} +1 -1
  54. package/dist/chunk-DWRYUWOK.js +273 -0
  55. package/dist/chunk-DWRYUWOK.js.map +1 -0
  56. package/dist/{chunk-5FYOM4RF.js → chunk-FD2IPIE2.js} +5 -5
  57. package/dist/{chunk-5FYOM4RF.js.map → chunk-FD2IPIE2.js.map} +1 -1
  58. package/dist/{chunk-PYTTF754.js → chunk-GJGEDWRT.js} +4 -4
  59. package/dist/{chunk-PYTTF754.js.map → chunk-GJGEDWRT.js.map} +1 -1
  60. package/dist/{chunk-FHDK3BFD.js → chunk-IPN7N2AZ.js} +3 -3
  61. package/dist/{chunk-FHDK3BFD.js.map → chunk-IPN7N2AZ.js.map} +1 -1
  62. package/dist/{chunk-4DLQESIY.js → chunk-IQVZIVSA.js} +3 -3
  63. package/dist/{chunk-4DLQESIY.js.map → chunk-IQVZIVSA.js.map} +1 -1
  64. package/dist/{chunk-NDUYFYJB.js → chunk-MCLT3BJG.js} +5 -5
  65. package/dist/{chunk-NDUYFYJB.js.map → chunk-MCLT3BJG.js.map} +1 -1
  66. package/dist/{chunk-PZOO7L26.js → chunk-O3Q3MOAV.js} +4 -4
  67. package/dist/{chunk-PZOO7L26.js.map → chunk-O3Q3MOAV.js.map} +1 -1
  68. package/dist/{chunk-DKGEV6SQ.js → chunk-ODQGLELI.js} +4 -4
  69. package/dist/{chunk-DKGEV6SQ.js.map → chunk-ODQGLELI.js.map} +1 -1
  70. package/dist/chunk-OKQXY6FS.js +1336 -0
  71. package/dist/chunk-OKQXY6FS.js.map +1 -0
  72. package/dist/{chunk-BF422IDP.js → chunk-OX2W5YF3.js} +4 -4
  73. package/dist/{chunk-BF422IDP.js.map → chunk-OX2W5YF3.js.map} +1 -1
  74. package/dist/{chunk-HBZD3MIW.js → chunk-PAUM35HD.js} +169 -33
  75. package/dist/chunk-PAUM35HD.js.map +1 -0
  76. package/dist/{chunk-J4DB5G36.js → chunk-PGVSOHWE.js} +2 -2
  77. package/dist/{chunk-J4DB5G36.js.map → chunk-PGVSOHWE.js.map} +1 -1
  78. package/dist/{chunk-ZSMMX3JD.js → chunk-PUG7IWFF.js} +11 -11
  79. package/dist/{chunk-ZSMMX3JD.js.map → chunk-PUG7IWFF.js.map} +1 -1
  80. package/dist/{chunk-2H73V6XR.js → chunk-PW3TYWOI.js} +3 -3
  81. package/dist/{chunk-2H73V6XR.js.map → chunk-PW3TYWOI.js.map} +1 -1
  82. package/dist/{chunk-Y7WKXPWS.js → chunk-QAYL3PYY.js} +8 -8
  83. package/dist/{chunk-Y7WKXPWS.js.map → chunk-QAYL3PYY.js.map} +1 -1
  84. package/dist/{chunk-XBYSURMK.js → chunk-QELQDY5K.js} +3 -3
  85. package/dist/{chunk-XBYSURMK.js.map → chunk-QELQDY5K.js.map} +1 -1
  86. package/dist/{chunk-7SMP4GNW.js → chunk-S6FZUR5H.js} +7 -6
  87. package/dist/chunk-S6FZUR5H.js.map +1 -0
  88. package/dist/{chunk-QO7CR3KB.js → chunk-TYUJPQNX.js} +3 -3
  89. package/dist/{chunk-QO7CR3KB.js.map → chunk-TYUJPQNX.js.map} +1 -1
  90. package/dist/{chunk-5SKVCMRC.js → chunk-UK3LRPJ5.js} +3 -3
  91. package/dist/{chunk-5SKVCMRC.js.map → chunk-UK3LRPJ5.js.map} +1 -1
  92. package/dist/{chunk-R6QHJEHE.js → chunk-UQ4SQOR6.js} +5 -5
  93. package/dist/{chunk-R6QHJEHE.js.map → chunk-UQ4SQOR6.js.map} +1 -1
  94. package/dist/{chunk-V5JHD4I2.js → chunk-V7AWO5FL.js} +2 -2
  95. package/dist/{chunk-V5JHD4I2.js.map → chunk-V7AWO5FL.js.map} +1 -1
  96. package/dist/{chunk-PN44DOGP.js → chunk-VTG5Z3KD.js} +3 -3
  97. package/dist/{chunk-PN44DOGP.js.map → chunk-VTG5Z3KD.js.map} +1 -1
  98. package/dist/{chunk-Y4Z7LGSH.js → chunk-VTXXBYB3.js} +9 -9
  99. package/dist/{chunk-Y4Z7LGSH.js.map → chunk-VTXXBYB3.js.map} +1 -1
  100. package/dist/{chunk-AHCI4V5L.js → chunk-WTEYDNTR.js} +3 -3
  101. package/dist/{chunk-AHCI4V5L.js.map → chunk-WTEYDNTR.js.map} +1 -1
  102. package/dist/{chunk-B7CZYFB2.js → chunk-YFIHFJEB.js} +3 -3
  103. package/dist/{chunk-B7CZYFB2.js.map → chunk-YFIHFJEB.js.map} +1 -1
  104. package/dist/{chunk-VMKMFS2Q.js → chunk-YIDZJHY6.js} +3 -3
  105. package/dist/{chunk-VMKMFS2Q.js.map → chunk-YIDZJHY6.js.map} +1 -1
  106. package/dist/{chunk-HWGYJMME.js → chunk-ZBD6EITA.js} +4 -4
  107. package/dist/{chunk-HWGYJMME.js.map → chunk-ZBD6EITA.js.map} +1 -1
  108. package/dist/{chunk-VLBIME5L.js → chunk-ZDTZGEJG.js} +4 -4
  109. package/dist/{chunk-VLBIME5L.js.map → chunk-ZDTZGEJG.js.map} +1 -1
  110. package/dist/{chunk-X4BAYGMT.js → chunk-ZIW34FGO.js} +3 -3
  111. package/dist/{chunk-X4BAYGMT.js.map → chunk-ZIW34FGO.js.map} +1 -1
  112. package/dist/cli/index.js +86 -67
  113. package/dist/cli/index.js.map +1 -1
  114. package/dist/cli/src/commands/serve.d.ts +7 -0
  115. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  116. package/dist/connectors/config.js +2 -2
  117. package/dist/connectors/index.js +13 -12
  118. package/dist/{connectors-GFKMKAXV.js → connectors-2TEGRRYC.js} +16 -15
  119. package/dist/{connectors-GFKMKAXV.js.map → connectors-2TEGRRYC.js.map} +1 -1
  120. package/dist/connectors-shared/index.js +2 -2
  121. package/dist/core/index.js +3 -3
  122. package/dist/core/runtime-assets.js +2 -2
  123. package/dist/core/src/index.d.ts +1 -1
  124. package/dist/core/src/index.d.ts.map +1 -1
  125. package/dist/core/src/workspace-config.d.ts +16 -0
  126. package/dist/core/src/workspace-config.d.ts.map +1 -1
  127. package/dist/core/workspace-config.js +1 -1
  128. package/dist/deploy/index.js +3 -3
  129. package/dist/{ensure-sources-VUKHL65L.js → ensure-sources-EG7YKKZL.js} +10 -10
  130. package/dist/{ensure-sources-VUKHL65L.js.map → ensure-sources-EG7YKKZL.js.map} +1 -1
  131. package/dist/factory-assets/connectors/box.js +13 -12
  132. package/dist/factory-assets/connectors/deploy.js +13 -12
  133. package/dist/factory-assets/connectors/devserver.js +13 -12
  134. package/dist/factory-assets/connectors/flow/adapter.js +13 -12
  135. package/dist/factory-assets/connectors/flow/engine.js +4 -4
  136. package/dist/factory-assets/connectors/flow/run-flow.js +14 -13
  137. package/dist/factory-assets/connectors/flow.js +13 -12
  138. package/dist/factory-assets/connectors/git.js +13 -12
  139. package/dist/factory-assets/connectors/gmail.js +13 -12
  140. package/dist/factory-assets/connectors/googledrive.js +13 -12
  141. package/dist/factory-assets/connectors/local.js +13 -12
  142. package/dist/factory-assets/connectors/mattermost.js +13 -12
  143. package/dist/factory-assets/connectors/memory.js +13 -12
  144. package/dist/factory-assets/connectors/minio.js +13 -12
  145. package/dist/factory-assets/connectors/postgres.js +13 -12
  146. package/dist/factory-assets/connectors/s3.js +13 -12
  147. package/dist/factory-assets/connectors/sharepoint.js +13 -12
  148. package/dist/factory-assets/connectors/sqlite.js +13 -12
  149. package/dist/factory-assets/connectors/static-server.js +13 -12
  150. package/dist/factory-assets/connectors/tunnel.js +13 -12
  151. package/dist/factory-assets/connectors/webdav.js +13 -12
  152. package/dist/factory-assets/connectors/xstate-store.js +13 -12
  153. package/dist/factory-assets/connectors/xstate.js +13 -12
  154. package/dist/{flows-A4YALSZY.js → flows-5TW3XFMH.js} +6 -6
  155. package/dist/{flows-A4YALSZY.js.map → flows-5TW3XFMH.js.map} +1 -1
  156. package/dist/{helpers-53XZW7KF.js → helpers-BQGXEKRP.js} +10 -10
  157. package/dist/{helpers-53XZW7KF.js.map → helpers-BQGXEKRP.js.map} +1 -1
  158. package/dist/library/index.js +4 -4
  159. package/dist/{library-publish-FFIPWIRM.js → library-publish-EUP524PE.js} +17 -17
  160. package/dist/{library-publish-FFIPWIRM.js.map → library-publish-EUP524PE.js.map} +1 -1
  161. package/dist/model-endpoint/index.d.ts +2 -0
  162. package/dist/model-endpoint/index.js +9 -0
  163. package/dist/model-endpoint/index.js.map +1 -0
  164. package/dist/model-endpoint/src/index.d.ts +4 -0
  165. package/dist/model-endpoint/src/index.d.ts.map +1 -0
  166. package/dist/model-endpoint/src/openai-chat.d.ts +105 -0
  167. package/dist/model-endpoint/src/openai-chat.d.ts.map +1 -0
  168. package/dist/model-endpoint/src/openai-responses.d.ts +106 -0
  169. package/dist/model-endpoint/src/openai-responses.d.ts.map +1 -0
  170. package/dist/model-endpoint/src/openai-shared.d.ts +77 -0
  171. package/dist/model-endpoint/src/openai-shared.d.ts.map +1 -0
  172. package/dist/model-endpoint/src/resolve.d.ts +36 -0
  173. package/dist/model-endpoint/src/resolve.d.ts.map +1 -0
  174. package/dist/model-endpoint/src/server.d.ts +16 -0
  175. package/dist/model-endpoint/src/server.d.ts.map +1 -0
  176. package/dist/model-endpoint/src/types.d.ts +78 -0
  177. package/dist/model-endpoint/src/types.d.ts.map +1 -0
  178. package/dist/{open-library-PZAT3TJA.js → open-library-QNMIMZYS.js} +13 -13
  179. package/dist/{open-library-PZAT3TJA.js.map → open-library-QNMIMZYS.js.map} +1 -1
  180. package/dist/{open-registry-W46UXZ3I.js → open-registry-BOUCBDLF.js} +8 -8
  181. package/dist/{open-registry-W46UXZ3I.js.map → open-registry-BOUCBDLF.js.map} +1 -1
  182. package/dist/{paths-KKY3NSBZ.js → paths-B6SX6J6T.js} +6 -6
  183. package/dist/{paths-KKY3NSBZ.js.map → paths-B6SX6J6T.js.map} +1 -1
  184. package/dist/{plugin-store-CK7YWRIC.js → plugin-store-MLFP3WJ7.js} +5 -5
  185. package/dist/{plugin-store-CK7YWRIC.js.map → plugin-store-MLFP3WJ7.js.map} +1 -1
  186. package/dist/{project-EZUH7PUJ.js → project-GXCIEJGM.js} +30 -27
  187. package/dist/{project-EZUH7PUJ.js.map → project-GXCIEJGM.js.map} +1 -1
  188. package/dist/resolver/index.js +3 -3
  189. package/dist/runner/index.js +22 -19
  190. package/dist/runner/src/model-endpoint-discovery.d.ts +64 -0
  191. package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -0
  192. package/dist/runner/src/serve.d.ts +6 -0
  193. package/dist/runner/src/serve.d.ts.map +1 -1
  194. package/dist/runner/src/session-builder.d.ts +8 -0
  195. package/dist/runner/src/session-builder.d.ts.map +1 -1
  196. package/dist/sdk/asset-manager.js +7 -7
  197. package/dist/sdk/bridge.js +9 -8
  198. package/dist/sdk/core.js +3 -3
  199. package/dist/sdk/flow.js +4 -4
  200. package/dist/sdk/index.js +22 -19
  201. package/dist/sdk/index.js.map +1 -1
  202. package/dist/sdk/resolver.js +3 -3
  203. package/dist/sdk/runner.js +22 -19
  204. package/dist/sdk/session.js +2 -2
  205. package/dist/sdk/types.js +1 -1
  206. package/dist/{serve-preflight-F7MYF747.js → serve-preflight-GNBW3O4U.js} +5 -5
  207. package/dist/{serve-preflight-F7MYF747.js.map → serve-preflight-GNBW3O4U.js.map} +1 -1
  208. package/dist/session/index.js +2 -2
  209. package/dist/{setup-L632QIHV.js → setup-HJEYEXLS.js} +17 -16
  210. package/dist/setup-HJEYEXLS.js.map +1 -0
  211. package/dist/{skills-OY3Y5GKA.js → skills-4WMYGJDL.js} +5 -5
  212. package/dist/{skills-OY3Y5GKA.js.map → skills-4WMYGJDL.js.map} +1 -1
  213. package/dist/{source-36FHMN5V.js → source-5VL6PHER.js} +15 -15
  214. package/dist/{source-36FHMN5V.js.map → source-5VL6PHER.js.map} +1 -1
  215. package/dist/{source-manifest-publish-NIXJSJ22.js → source-manifest-publish-Q66H7EJI.js} +17 -17
  216. package/dist/{source-manifest-publish-NIXJSJ22.js.map → source-manifest-publish-Q66H7EJI.js.map} +1 -1
  217. package/dist/tui/index.js +22 -19
  218. package/dist/tui/index.js.map +1 -1
  219. package/dist/types/index.js +1 -1
  220. package/dist/types/src/delivery.d.ts.map +1 -1
  221. package/dist/types/src/events.d.ts +55 -1
  222. package/dist/types/src/events.d.ts.map +1 -1
  223. package/dist/types/src/index.d.ts +1 -1
  224. package/dist/types/src/index.d.ts.map +1 -1
  225. package/dist/types/src/version.d.ts +11 -1
  226. package/dist/types/src/version.d.ts.map +1 -1
  227. package/dist/workspace-plugin/adapters/mcp.js +16 -15
  228. package/dist/workspace-plugin/adapters/omp.js +14 -14
  229. package/dist/workspace-plugin/index.js +1 -1
  230. package/package.json +12 -1
  231. package/dist/chunk-6NQDDCIL.js.map +0 -1
  232. package/dist/chunk-7SMP4GNW.js.map +0 -1
  233. package/dist/chunk-BVJU2GKE.js.map +0 -1
  234. package/dist/chunk-F4NJDSR7.js.map +0 -1
  235. package/dist/chunk-HBZD3MIW.js.map +0 -1
  236. package/dist/chunk-L3ZGYSWY.js.map +0 -1
  237. package/dist/setup-L632QIHV.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1063](https://github.com/skaile-ai/workspaces/pull/1063) [`4a10dc1`](https://github.com/skaile-ai/workspaces/commit/4a10dc1046a287abf91941fbe24b7d6a1d46365c) Thanks [@mortegro](https://github.com/mortegro)! - `skaile serve` can serve an OpenAI-compatible model endpoint on loopback, so an app next to the session makes plain model calls without a vendor key. Turn it on with `skaile serve --model-endpoint [port]` or `skaile.yaml` `model_endpoint: {enabled, port, host}`. It serves `/v1/models`, `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings` behind a bearer token, resolved against the session's AI provider registry, and is found through `SKAILE_MODEL_ENDPOINT_URL` / `_TOKEN` in the harness env, `.skaile/model-endpoint.json` (mode 0600, gitignored by `skaile init`) and the `skaile-endpoint` registry entry.
8
+
9
+ Provider translation comes from `@earendil-works/pi-ai`, a new optional peer (`npm i @earendil-works/pi-ai`, Node ≥22.19) loaded only when a request arrives. The endpoint is off by default and not started on a managed Codex host.
10
+
11
+ - [#1066](https://github.com/skaile-ai/workspaces/pull/1066) [`d38e089`](https://github.com/skaile-ai/workspaces/commit/d38e08940490fe0a23942cb8f178a37a81b9d37a) Thanks [@peteralbert](https://github.com/peteralbert)! - The runner now says which turns the agent started by itself, and which earlier work they continue (protocol 4.19.0).
12
+
13
+ A Claude Code agent kept alive between turns wakes on its own when a background task it launched settles (a backgrounded shell command, a background subagent, a monitor). The host saw that turn's output with no prompt behind it, so it could not tell who the turn acts for. The claude-sdk driver now sends:
14
+
15
+ - `background_task_started` (`taskId`) while a turn runs, when a task starts in the background in it (or a foreground task moves there);
16
+ - `self_turn_started` (`taskIds`) before any output of a turn the runner did not dispatch, naming the tasks whose completion it reads (empty when it cannot tell);
17
+ - `selfStarted: true` on that turn's `finished` or `error`.
18
+
19
+ All three are additive and transient. A host keeps working without reading them.
20
+
3
21
  ## 5.13.0
4
22
 
5
23
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { PROTOCOL_VERSION_STRING } from '../chunk-F4NJDSR7.js';
1
+ import { PROTOCOL_VERSION_STRING } from '../chunk-D5WTOVLG.js';
2
2
  import '../chunk-NSBPE2FW.js';
3
3
  import * as z from 'zod';
4
4
 
@@ -1,22 +1,22 @@
1
1
  import { storeNotInstallableReason } from './chunk-U27JRO5L.js';
2
- import { getKnownKinds } from './chunk-4NJ3QQHZ.js';
3
- import './chunk-XBYSURMK.js';
2
+ import { getKnownKinds } from './chunk-5IMGZAKH.js';
3
+ import './chunk-QELQDY5K.js';
4
4
  import './chunk-X3RMRJNR.js';
5
5
  import './chunk-7RGTAEG6.js';
6
6
  import './chunk-NUELZWCF.js';
7
- import './chunk-DKGEV6SQ.js';
7
+ import './chunk-ODQGLELI.js';
8
8
  import './chunk-NVO6WECE.js';
9
9
  import './chunk-PXDWTJ3P.js';
10
10
  import './chunk-H5U7LNTJ.js';
11
11
  import './chunk-3TXEJN4W.js';
12
12
  import './chunk-57SF6W6E.js';
13
- import './chunk-BF422IDP.js';
13
+ import './chunk-OX2W5YF3.js';
14
14
  import './chunk-4GY63JU6.js';
15
- import { factoryAssetRoots } from './chunk-QO7CR3KB.js';
15
+ import { factoryAssetRoots } from './chunk-TYUJPQNX.js';
16
16
  import './chunk-D54T2F54.js';
17
17
  import './chunk-5BEFNLOR.js';
18
18
  import './chunk-A2ULN3KX.js';
19
- import { scanRepo } from './chunk-L3ZGYSWY.js';
19
+ import { scanRepo } from './chunk-CAPKENNF.js';
20
20
  import './chunk-L5VSIPQD.js';
21
21
  import './chunk-IG5LZ3WU.js';
22
22
  import './chunk-IY5E7Y5W.js';
@@ -52,8 +52,8 @@ function libraryEntryOf(asset) {
52
52
  async function libraryAssets() {
53
53
  const notes = [];
54
54
  try {
55
- const { openLibraryManager } = await import('./open-library-PZAT3TJA.js');
56
- const { getKindRegistry } = await import('./open-registry-W46UXZ3I.js');
55
+ const { openLibraryManager } = await import('./open-library-QNMIMZYS.js');
56
+ const { getKindRegistry } = await import('./open-registry-BOUCBDLF.js');
57
57
  const { scanAuthoringLibraries } = await import('./library/index.js');
58
58
  const { library: index, close } = await openLibraryManager();
59
59
  try {
@@ -86,7 +86,7 @@ async function libraryAssets() {
86
86
  async function storeAssets(projectDir) {
87
87
  const notes = [];
88
88
  try {
89
- const { resolveCatalogSource } = await import('./open-library-PZAT3TJA.js');
89
+ const { resolveCatalogSource } = await import('./open-library-QNMIMZYS.js');
90
90
  const { source, close } = await resolveCatalogSource({ projectDir });
91
91
  try {
92
92
  const assets = (await source.listAssets()).filter(
@@ -167,5 +167,5 @@ async function gatherAssetFeeds(am, projectDir) {
167
167
  }
168
168
 
169
169
  export { gatherAssetFeeds };
170
- //# sourceMappingURL=asset-feeds-ALMTHLPV.js.map
171
- //# sourceMappingURL=asset-feeds-ALMTHLPV.js.map
170
+ //# sourceMappingURL=asset-feeds-PAOX3FUT.js.map
171
+ //# sourceMappingURL=asset-feeds-PAOX3FUT.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAAS,eAAe,KAAA,EAAsC;AAC5D,EAAA,MAAM,EAAE,UAAS,GAAI,KAAA;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,OAAO;AAAA,IACL,OAAA,EAAS;AAAA,MACP,GAAG,GAAA;AAAA,MACH,GAAG,IAAA,CAAK,OAAA;AAAA,MACR,GAAG,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA,IACA,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF","file":"asset-feeds-ALMTHLPV.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex`, read through\n * `scanAuthoringLibraries` (`@skaile/workspaces/library`): the same scan\n * `library index` / `search --local` use, so publishers and refs match them\n * (per-asset `publisher_overrides` honoured), `dev_paths` assets are left out,\n * and a library that fails to scan becomes one note while the rest stay listed.\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogEntry,\n factoryAssetRoots,\n parseRequires,\n scanRepo,\n} from \"@skaile/workspaces/core\";\nimport { getKnownKinds } from \"./open-registry.ts\";\nimport { storeNotInstallableReason } from \"./store-addable.ts\";\nimport type { DiscoveredAsset } from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n notes: FeedNote[];\n}\n\n/**\n * Map one discovered library asset to the `CatalogEntry` the manage rows read.\n * `publisher` is the bare per-asset publisher (what `search --local` prints),\n * `source` the manifest path. `repo` is left unset: it only feeds the Sources-tree\n * org grouping. `requires` / `dependencies` come from the manifest the way the\n * scanner fills them — string `requires:` refs parsed to `{kind, name}`, a bundle's\n * string `dependencies:` list verbatim.\n */\nfunction libraryEntryOf(asset: DiscoveredAsset): CatalogEntry {\n const { manifest } = asset;\n const nested = (manifest.metadata as Record<string, unknown> | undefined)?.requires;\n const rawRequires = manifest.requires ?? nested;\n const requireRefs =\n typeof rawRequires === \"string\"\n ? rawRequires\n : Array.isArray(rawRequires)\n ? rawRequires.filter((r): r is string => typeof r === \"string\")\n : undefined;\n const deps = manifest.dependencies;\n return {\n name: asset.name,\n kind: asset.kind as AssetKind,\n description: typeof manifest.description === \"string\" ? manifest.description : \"\",\n source: asset.manifestPath,\n publisher: asset.publisher,\n ...(asset.plugin ? { plugin: asset.plugin } : {}),\n version: asset.version,\n requires: requireRefs === undefined ? [] : parseRequires({ requires: requireRefs }),\n dependencies:\n asset.kind === \"bundle\" && Array.isArray(deps)\n ? deps.filter((d): d is string => typeof d === \"string\" && d.length > 0)\n : [],\n };\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache) through\n * `scanAuthoringLibraries`, grouped under the bare library name\n * (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix (mirrors the source feed). Plugin grouping (`entry.plugin`)\n * comes from `DiscoveredAsset.plugin`. A library whose scan fails becomes one\n * `FeedNote`; the outer `catch` covers only opening the index.\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n // Lazy: the library subpath pulls in SQLite, which the other feeds never need.\n const { openLibraryManager } = await import(\"./open-library.ts\");\n const { getKindRegistry } = await import(\"./open-registry.ts\");\n const { scanAuthoringLibraries } = await import(\"@skaile/workspaces/library\");\n const { library: index, close } = await openLibraryManager();\n try {\n const entries: OriginEntry[] = [];\n for (const scan of await scanAuthoringLibraries(index, getKindRegistry())) {\n if (scan.error !== undefined) {\n notes.push({ feed: \"libraries\", message: `${scan.library.name}: ${scan.error}` });\n continue;\n }\n for (const asset of scan.assets) {\n entries.push({\n origin: \"library\",\n entry: libraryEntryOf(asset),\n group: scan.library.name,\n });\n }\n }\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n // The store lists only what `skaile add` can install (see store-addable.ts).\n const assets = (await source.listAssets()).filter(\n (a) => storeNotInstallableReason(a) === undefined,\n );\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n plugin: a.plugin,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], notes };\n }\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => Promise<CatalogEntry[]>;\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which merges\n * `skaile.yaml`'s `sources:` field into the repositories map. Plugin grouping\n * (`entry.plugin`) is stamped by the scanner, so entries pass through as-is.\n */\nasync function sourceAssets(am: AssetManagerLike): Promise<OriginEntry[]> {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = (await am.search()).filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return entries;\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Local disk only, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nasync function factoryAssets(): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n entries.push(...(await scanRepo(root, \"skaile-factory\", { knownKinds: getKnownKinds() })));\n }\n return { entries, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local disk only, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = await factoryAssets();\n const src = await sourceAssets(am);\n return {\n entries: [\n ...src,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n"]}
1
+ {"version":3,"sources":["../cli/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UAAU,CAAC,CAAC,CAAA;AAClF,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,EAAc;AACpC,EAAA,MAAM,GAAA,GAAM,MAAM,YAAA,CAAa,EAAE,CAAA;AACjC,EAAA,OAAO;AAAA,IACL,OAAA,EAAS;AAAA,MACP,GAAG,GAAA;AAAA,MACH,GAAG,IAAA,CAAK,OAAA;AAAA,MACR,GAAG,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA,IACA,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF","file":"asset-feeds-PAOX3FUT.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex`, read through\n * `scanAuthoringLibraries` (`@skaile/workspaces/library`): the same scan\n * `library index` / `search --local` use, so publishers and refs match them\n * (per-asset `publisher_overrides` honoured), `dev_paths` assets are left out,\n * and a library that fails to scan becomes one note while the rest stay listed.\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogEntry,\n factoryAssetRoots,\n parseRequires,\n scanRepo,\n} from \"@skaile/workspaces/core\";\nimport { getKnownKinds } from \"./open-registry.ts\";\nimport { storeNotInstallableReason } from \"./store-addable.ts\";\nimport type { DiscoveredAsset } from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n notes: FeedNote[];\n}\n\n/**\n * Map one discovered library asset to the `CatalogEntry` the manage rows read.\n * `publisher` is the bare per-asset publisher (what `search --local` prints),\n * `source` the manifest path. `repo` is left unset: it only feeds the Sources-tree\n * org grouping. `requires` / `dependencies` come from the manifest the way the\n * scanner fills them — string `requires:` refs parsed to `{kind, name}`, a bundle's\n * string `dependencies:` list verbatim.\n */\nfunction libraryEntryOf(asset: DiscoveredAsset): CatalogEntry {\n const { manifest } = asset;\n const nested = (manifest.metadata as Record<string, unknown> | undefined)?.requires;\n const rawRequires = manifest.requires ?? nested;\n const requireRefs =\n typeof rawRequires === \"string\"\n ? rawRequires\n : Array.isArray(rawRequires)\n ? rawRequires.filter((r): r is string => typeof r === \"string\")\n : undefined;\n const deps = manifest.dependencies;\n return {\n name: asset.name,\n kind: asset.kind as AssetKind,\n description: typeof manifest.description === \"string\" ? manifest.description : \"\",\n source: asset.manifestPath,\n publisher: asset.publisher,\n ...(asset.plugin ? { plugin: asset.plugin } : {}),\n version: asset.version,\n requires: requireRefs === undefined ? [] : parseRequires({ requires: requireRefs }),\n dependencies:\n asset.kind === \"bundle\" && Array.isArray(deps)\n ? deps.filter((d): d is string => typeof d === \"string\" && d.length > 0)\n : [],\n };\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache) through\n * `scanAuthoringLibraries`, grouped under the bare library name\n * (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix (mirrors the source feed). Plugin grouping (`entry.plugin`)\n * comes from `DiscoveredAsset.plugin`. A library whose scan fails becomes one\n * `FeedNote`; the outer `catch` covers only opening the index.\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n // Lazy: the library subpath pulls in SQLite, which the other feeds never need.\n const { openLibraryManager } = await import(\"./open-library.ts\");\n const { getKindRegistry } = await import(\"./open-registry.ts\");\n const { scanAuthoringLibraries } = await import(\"@skaile/workspaces/library\");\n const { library: index, close } = await openLibraryManager();\n try {\n const entries: OriginEntry[] = [];\n for (const scan of await scanAuthoringLibraries(index, getKindRegistry())) {\n if (scan.error !== undefined) {\n notes.push({ feed: \"libraries\", message: `${scan.library.name}: ${scan.error}` });\n continue;\n }\n for (const asset of scan.assets) {\n entries.push({\n origin: \"library\",\n entry: libraryEntryOf(asset),\n group: scan.library.name,\n });\n }\n }\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n // The store lists only what `skaile add` can install (see store-addable.ts).\n const assets = (await source.listAssets()).filter(\n (a) => storeNotInstallableReason(a) === undefined,\n );\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n plugin: a.plugin,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], notes };\n }\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => Promise<CatalogEntry[]>;\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which merges\n * `skaile.yaml`'s `sources:` field into the repositories map. Plugin grouping\n * (`entry.plugin`) is stamped by the scanner, so entries pass through as-is.\n */\nasync function sourceAssets(am: AssetManagerLike): Promise<OriginEntry[]> {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = (await am.search()).filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return entries;\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Local disk only, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nasync function factoryAssets(): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n entries.push(...(await scanRepo(root, \"skaile-factory\", { knownKinds: getKnownKinds() })));\n }\n return { entries, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local disk only, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = await factoryAssets();\n const src = await sourceAssets(am);\n return {\n entries: [\n ...src,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  export { WORKSPACE_MOUNT_ENV_VAR, deployAll, deployCatalogEntry, findAiAssetsRoot, isUnderWorkspaceMount, resolveFlowSkills, undeployCatalogEntry, workspaceMountDirs } from '../chunk-ZU24LWBI.js';
2
- import '../chunk-BF422IDP.js';
2
+ import '../chunk-OX2W5YF3.js';
3
3
  import '../chunk-4GY63JU6.js';
4
- import '../chunk-QO7CR3KB.js';
4
+ import '../chunk-TYUJPQNX.js';
5
5
  import '../chunk-D54T2F54.js';
6
6
  import '../chunk-5BEFNLOR.js';
7
7
  import '../chunk-A2ULN3KX.js';
8
- import '../chunk-L3ZGYSWY.js';
8
+ import '../chunk-CAPKENNF.js';
9
9
  import '../chunk-L5VSIPQD.js';
10
10
  import '../chunk-IG5LZ3WU.js';
11
11
  import '../chunk-IY5E7Y5W.js';
@@ -1,22 +1,22 @@
1
- export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, installAgentInstances, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName } from '../chunk-Y7WKXPWS.js';
2
- import '../chunk-DKGEV6SQ.js';
1
+ export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, installAgentInstances, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName } from '../chunk-QAYL3PYY.js';
2
+ import '../chunk-ODQGLELI.js';
3
3
  import '../chunk-NVO6WECE.js';
4
4
  import '../chunk-PXDWTJ3P.js';
5
5
  import '../chunk-H5U7LNTJ.js';
6
6
  import '../chunk-3TXEJN4W.js';
7
- export { SCAFFOLD_KINDS, createScaffold, deployAll, installAgent, installTargetOf, removeAsset } from '../chunk-5FYOM4RF.js';
7
+ export { SCAFFOLD_KINDS, createScaffold, deployAll, installAgent, installTargetOf, removeAsset } from '../chunk-FD2IPIE2.js';
8
8
  export { BUILT_IN_FRAGMENTS, loadPromptExtensions, resolveFragments } from '../chunk-NOA6EJXE.js';
9
9
  export { appendHistory, clearHistory, getRecentHistory, loadHistory } from '../chunk-KTBKW2FI.js';
10
10
  import '../chunk-UQ6LFBPZ.js';
11
- export { AGENT_RENDERERS, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework } from '../chunk-4L4R5LV3.js';
11
+ export { AGENT_RENDERERS, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework } from '../chunk-CNZI37HV.js';
12
12
  import '../chunk-57SF6W6E.js';
13
- import '../chunk-BF422IDP.js';
13
+ import '../chunk-OX2W5YF3.js';
14
14
  import '../chunk-4GY63JU6.js';
15
- import '../chunk-QO7CR3KB.js';
15
+ import '../chunk-TYUJPQNX.js';
16
16
  import '../chunk-D54T2F54.js';
17
17
  import '../chunk-5BEFNLOR.js';
18
18
  import '../chunk-A2ULN3KX.js';
19
- import '../chunk-L3ZGYSWY.js';
19
+ import '../chunk-CAPKENNF.js';
20
20
  import '../chunk-L5VSIPQD.js';
21
21
  import '../chunk-IG5LZ3WU.js';
22
22
  import '../chunk-IY5E7Y5W.js';
@@ -1,14 +1,14 @@
1
- export { SCAFFOLD_KINDS, canonicalEntryRef, createScaffold, deployAll, deployAsset, deployedAssetDrift, diffDeployedAgent, installTargetOf, removeAsset } from '../chunk-5FYOM4RF.js';
1
+ export { SCAFFOLD_KINDS, canonicalEntryRef, createScaffold, deployAll, deployAsset, deployedAssetDrift, diffDeployedAgent, installTargetOf, removeAsset } from '../chunk-FD2IPIE2.js';
2
2
  import '../chunk-NOA6EJXE.js';
3
- import '../chunk-4L4R5LV3.js';
3
+ import '../chunk-CNZI37HV.js';
4
4
  import '../chunk-57SF6W6E.js';
5
- import '../chunk-BF422IDP.js';
5
+ import '../chunk-OX2W5YF3.js';
6
6
  import '../chunk-4GY63JU6.js';
7
- import '../chunk-QO7CR3KB.js';
7
+ import '../chunk-TYUJPQNX.js';
8
8
  import '../chunk-D54T2F54.js';
9
9
  import '../chunk-5BEFNLOR.js';
10
10
  import '../chunk-A2ULN3KX.js';
11
- import '../chunk-L3ZGYSWY.js';
11
+ import '../chunk-CAPKENNF.js';
12
12
  import '../chunk-L5VSIPQD.js';
13
13
  import '../chunk-IG5LZ3WU.js';
14
14
  import '../chunk-IY5E7Y5W.js';
@@ -1,12 +1,12 @@
1
- export { AGENT_RENDERERS, CODEX_IDENTITY_DIR, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework } from '../chunk-4L4R5LV3.js';
1
+ export { AGENT_RENDERERS, CODEX_IDENTITY_DIR, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework } from '../chunk-CNZI37HV.js';
2
2
  import '../chunk-57SF6W6E.js';
3
- import '../chunk-BF422IDP.js';
3
+ import '../chunk-OX2W5YF3.js';
4
4
  import '../chunk-4GY63JU6.js';
5
- import '../chunk-QO7CR3KB.js';
5
+ import '../chunk-TYUJPQNX.js';
6
6
  import '../chunk-D54T2F54.js';
7
7
  import '../chunk-5BEFNLOR.js';
8
8
  import '../chunk-A2ULN3KX.js';
9
- import '../chunk-L3ZGYSWY.js';
9
+ import '../chunk-CAPKENNF.js';
10
10
  import '../chunk-L5VSIPQD.js';
11
11
  import '../chunk-IG5LZ3WU.js';
12
12
  import '../chunk-IY5E7Y5W.js';
@@ -2,21 +2,22 @@ import { formatDroppedToolsNotice, filterInProcessMcpServerTools, checkToolPrope
2
2
  import { freshBudget, isFirstAttempt, spend, isSpent, decide, isAvailable } from '../../chunk-IZCR27MU.js';
3
3
  import { AskSlots } from '../../chunk-EPBKISS5.js';
4
4
  import { scrubPoisonedTranscript, transcriptStoreForRuntime, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv } from '../../chunk-YTZFSKWL.js';
5
- import { dispatchCapability } from '../../chunk-2H73V6XR.js';
6
- import { fetchProviderModels } from '../../chunk-B7CZYFB2.js';
5
+ import { dispatchCapability } from '../../chunk-PW3TYWOI.js';
6
+ import { fetchProviderModels } from '../../chunk-YFIHFJEB.js';
7
7
  import { ReconfigureLedger, AuthError, stripRunnerPrivateEnv, classifyClaudeSdkError, reclassifyAuthAsAccountUnavailable, AccountUnavailableError, isLongContextEntitlementRejection, LONG_CONTEXT_CREDITS_API_ERROR } from '../../chunk-B4X2N7JQ.js';
8
8
  import { agentExecRequested, wrapAgentCommand, resolveAgentExec } from '../../chunk-YROR332M.js';
9
- import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger, entryCredentialValue, registryDriverConfig } from '../../chunk-BVJU2GKE.js';
9
+ import { AgentDriver, getBridgeLogger, registryDriverConfig } from '../../chunk-DWRYUWOK.js';
10
+ import { BUILTIN_DRIVER_CATALOG, entryCredentialValue } from '../../chunk-6VIVUBNN.js';
10
11
  import '../../chunk-6E6PKKAD.js';
11
- import { withActivityLabelShape } from '../../chunk-F4NJDSR7.js';
12
+ import { withActivityLabelShape } from '../../chunk-D5WTOVLG.js';
12
13
  import '../../chunk-57SF6W6E.js';
13
- import { installCommandFor } from '../../chunk-BF422IDP.js';
14
+ import { installCommandFor } from '../../chunk-OX2W5YF3.js';
14
15
  import '../../chunk-4GY63JU6.js';
15
- import '../../chunk-QO7CR3KB.js';
16
+ import '../../chunk-TYUJPQNX.js';
16
17
  import '../../chunk-D54T2F54.js';
17
18
  import '../../chunk-5BEFNLOR.js';
18
19
  import '../../chunk-A2ULN3KX.js';
19
- import '../../chunk-L3ZGYSWY.js';
20
+ import '../../chunk-CAPKENNF.js';
20
21
  import '../../chunk-L5VSIPQD.js';
21
22
  import '../../chunk-IG5LZ3WU.js';
22
23
  import '../../chunk-IY5E7Y5W.js';
@@ -164,6 +165,120 @@ function sumBucket(items) {
164
165
  return { tokens: sumTokens(items), items };
165
166
  }
166
167
 
168
+ // bridge/src/drivers/claude-self-turns.ts
169
+ var MAX_TRACKED_TASKS = 64;
170
+ var SelfTurnTracker = class {
171
+ constructor(emit) {
172
+ this.emit = emit;
173
+ }
174
+ emit;
175
+ active = false;
176
+ /** A prompt was pushed while the self-started turn ran; the CLI answers it inside that turn. */
177
+ joined = false;
178
+ /** Tasks the CLI reported settled since the last turn ended, oldest first. */
179
+ settled = /* @__PURE__ */ new Set();
180
+ /** Tasks registered in the foreground: reported only if they move to the background. */
181
+ foreground = /* @__PURE__ */ new Set();
182
+ /** Whether the turn running now is one the driver did not prompt. */
183
+ get selfTurnActive() {
184
+ return this.active;
185
+ }
186
+ /**
187
+ * Feed every SDK message before the driver handles it, so a self-started
188
+ * turn is announced ahead of its first output. `promptedTurnInFlight` is true
189
+ * while a turn the driver dispatched holds the CLI.
190
+ */
191
+ observe(msg, promptedTurnInFlight) {
192
+ const inTurn = promptedTurnInFlight || this.active;
193
+ if (msg.type === "system") {
194
+ this.observeTask(msg, inTurn);
195
+ return;
196
+ }
197
+ if (msg.type !== "assistant" && msg.type !== "stream_event" && msg.type !== "user") return;
198
+ if (msg.parent_tool_use_id) return;
199
+ if (inTurn) return;
200
+ this.active = true;
201
+ const taskIds = [...this.settled];
202
+ this.settled.clear();
203
+ this.emit({ type: "self_turn_started", taskIds });
204
+ }
205
+ /**
206
+ * Whether the running turn's terminal events should carry `selfStarted`. Not
207
+ * once a prompt joined it: that turn's result then answers the prompt too.
208
+ */
209
+ get stampsTerminal() {
210
+ return this.active && !this.joined;
211
+ }
212
+ /**
213
+ * The driver pushed a prompt into the live CLI. During a self-started turn the
214
+ * CLI folds it into that turn, whose result then ends the prompted turn too.
215
+ */
216
+ onPromptPushed() {
217
+ if (this.active) this.joined = true;
218
+ }
219
+ /** The running turn's `result` was handled. */
220
+ onResult() {
221
+ if (!this.active) return;
222
+ this.active = false;
223
+ this.joined = false;
224
+ this.settled.clear();
225
+ }
226
+ /**
227
+ * A prompted turn ended. A task that settled while it ran was handed to that
228
+ * turn, or wakes a later one that cannot be tied to it: forget it either way.
229
+ */
230
+ onPromptedTurnEnd() {
231
+ this.settled.clear();
232
+ }
233
+ /** The CLI process is gone: its tasks will never report again. */
234
+ reset() {
235
+ this.active = false;
236
+ this.joined = false;
237
+ this.settled.clear();
238
+ this.foreground.clear();
239
+ }
240
+ observeTask(msg, inTurn) {
241
+ const taskId = msg.task_id;
242
+ if (typeof taskId !== "string" || taskId.length === 0) return;
243
+ const ambient = msg.ambient === true || msg.skip_transcript === true;
244
+ if (msg.subtype === "task_started") {
245
+ if (ambient) return;
246
+ if (msg.is_backgrounded === false) {
247
+ remember(this.foreground, taskId);
248
+ return;
249
+ }
250
+ this.reportStarted(taskId, inTurn);
251
+ return;
252
+ }
253
+ if (msg.subtype === "task_updated") {
254
+ if (!this.foreground.has(taskId)) return;
255
+ if (msg.patch?.is_backgrounded === true) {
256
+ this.foreground.delete(taskId);
257
+ this.reportStarted(taskId, inTurn);
258
+ } else if (msg.patch?.status && msg.patch.status !== "running" && msg.patch.status !== "pending") {
259
+ this.foreground.delete(taskId);
260
+ }
261
+ return;
262
+ }
263
+ if (msg.subtype === "task_notification") {
264
+ this.foreground.delete(taskId);
265
+ if (!ambient) remember(this.settled, taskId);
266
+ }
267
+ }
268
+ reportStarted(taskId, inTurn) {
269
+ if (!inTurn) return;
270
+ this.emit({ type: "background_task_started", taskId });
271
+ }
272
+ };
273
+ function remember(set, taskId) {
274
+ set.delete(taskId);
275
+ set.add(taskId);
276
+ if (set.size > MAX_TRACKED_TASKS) {
277
+ const oldest = set.values().next().value;
278
+ if (oldest !== void 0) set.delete(oldest);
279
+ }
280
+ }
281
+
167
282
  // bridge/src/drivers/claude-tool-allowlist.ts
168
283
  var CAPABILITY_MCP_SERVER = "skaile-capabilities";
169
284
  var CLAUDE_CODE_BUILTIN_TOOLS = /* @__PURE__ */ new Set([
@@ -659,6 +774,16 @@ var ClaudeSdkDriver = class extends AgentDriver {
659
774
  subagentToolAllowlists = /* @__PURE__ */ new Map();
660
775
  /** Guards against duplicate agent_end emissions per turn. */
661
776
  turnCompleted = false;
777
+ /** Announces the turns the CLI starts by itself and the background tasks they continue. */
778
+ selfTurns = new SelfTurnTracker((event) => {
779
+ try {
780
+ this.emit("agent-event", event);
781
+ } catch (emitErr) {
782
+ this.log.warn("agent-event listener threw on a turn-origin event; suppressing", {
783
+ error: emitErr instanceof Error ? emitErr.message : String(emitErr)
784
+ });
785
+ }
786
+ });
662
787
  /** Set by {@link kill}: no turn may start or replay on this driver again. */
663
788
  killed = false;
664
789
  /** `Date.now()` of the most recent SDK message — the watchdog's liveness signal. */
@@ -1037,6 +1162,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
1037
1162
  try {
1038
1163
  if (this.query && this.inputStream) {
1039
1164
  this.inputStream.push(this.buildUserMessage(message));
1165
+ this.selfTurns.onPromptPushed();
1040
1166
  } else {
1041
1167
  await this.startQuery(message);
1042
1168
  }
@@ -1320,6 +1446,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
1320
1446
  }
1321
1447
  this.query = null;
1322
1448
  }
1449
+ this.selfTurns.reset();
1323
1450
  this.abortController?.abort();
1324
1451
  }
1325
1452
  /**
@@ -2169,6 +2296,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
2169
2296
  this.log.debug("query generator ended");
2170
2297
  if (this.query === servedQuery) {
2171
2298
  this.query = null;
2299
+ this.selfTurns.reset();
2172
2300
  this.endInputStream();
2173
2301
  const neverDispatched = !this.turnCompleted && this.turnReject != null && !this.firstSdkMessageSeen && !this.abortController?.signal.aborted;
2174
2302
  if (neverDispatched) {
@@ -2242,6 +2370,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
2242
2370
  completeTurn() {
2243
2371
  if (this.turnCompleted) return;
2244
2372
  this.turnCompleted = true;
2373
+ this.selfTurns.onPromptedTurnEnd();
2245
2374
  this.disarmTurnStallWatchdog();
2246
2375
  this.disarmErrorResultGrace();
2247
2376
  if (this.turnResolve) {
@@ -2321,6 +2450,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
2321
2450
  this.disarmTurnStallWatchdog();
2322
2451
  this.disarmErrorResultGrace();
2323
2452
  const hadPendingTurn = this.turnReject != null;
2453
+ if (hadPendingTurn) this.selfTurns.onPromptedTurnEnd();
2324
2454
  if (this.turnReject) {
2325
2455
  this.turnReject(err);
2326
2456
  this.turnResolve = null;
@@ -2330,7 +2460,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
2330
2460
  const event = {
2331
2461
  type: "error",
2332
2462
  error: err.message,
2333
- ...detail ? { detail } : {}
2463
+ ...detail ? { detail } : {},
2464
+ ...!hadPendingTurn && this.selfTurns.stampsTerminal ? { selfStarted: true } : {}
2334
2465
  };
2335
2466
  if (hadPendingTurn) {
2336
2467
  const decision = decided ?? this.decideRecovery(err);
@@ -2415,6 +2546,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
2415
2546
  // Message handling
2416
2547
  // ---------------------------------------------------------------------------
2417
2548
  handleSdkMessage(msg) {
2549
+ this.selfTurns.observe(msg, this.turnReject != null);
2418
2550
  if (this.handleRateLimitEvent(msg)) return;
2419
2551
  if (msg.type === "assistant") {
2420
2552
  this.handleAssistantMessage(msg);
@@ -2711,6 +2843,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
2711
2843
  } else {
2712
2844
  this.handleErrorResult(msg);
2713
2845
  }
2846
+ this.selfTurns.onResult();
2714
2847
  }
2715
2848
  /**
2716
2849
  * Capture the per-call context size from an assistant message. Its `usage`
@@ -2794,7 +2927,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
2794
2927
  summary: result ?? "Task completed",
2795
2928
  costUsd: this._lastTurnCostUsd,
2796
2929
  ...this._lastTokens ? { tokens: this._lastTokens } : {},
2797
- ...this.turnUsageFields()
2930
+ ...this.turnUsageFields(),
2931
+ ...this.selfTurns.stampsTerminal ? { selfStarted: true } : {}
2798
2932
  })
2799
2933
  );
2800
2934
  }
@@ -2814,7 +2948,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
2814
2948
  errors,
2815
2949
  ...this._lastCostReported ? { costUsd: this._lastTurnCostUsd } : {},
2816
2950
  ...this._lastTokens ? { tokens: this._lastTokens } : {},
2817
- ...this.turnUsageFields()
2951
+ ...this.turnUsageFields(),
2952
+ ...this.selfTurns.stampsTerminal ? { selfStarted: true } : {}
2818
2953
  };
2819
2954
  if (this.limitTurnRejectedForFailover) {
2820
2955
  this.heldFailoverResult = resultEvent;