@skaile/workspaces 6.15.0 → 6.16.1

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 (428) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/agent-file-refresh-VRD2SNJW.js +89 -0
  3. package/dist/agent-file-refresh-VRD2SNJW.js.map +1 -0
  4. package/dist/ai-sdk.js +8 -7
  5. package/dist/ai-sdk.js.map +1 -1
  6. package/dist/{asset-feeds-PM7FKHJP.js → asset-feeds-ON7FYHHF.js} +25 -23
  7. package/dist/asset-feeds-ON7FYHHF.js.map +1 -0
  8. package/dist/asset-manager/catalog-deployer.js +8 -7
  9. package/dist/asset-manager/history.js +7 -6
  10. package/dist/asset-manager/index.js +17 -15
  11. package/dist/asset-manager/installer.js +16 -9
  12. package/dist/asset-manager/renderers.js +8 -8
  13. package/dist/asset-manager/src/add-remove/add.d.ts +134 -0
  14. package/dist/asset-manager/src/add-remove/add.d.ts.map +1 -0
  15. package/dist/asset-manager/src/add-remove/remove.d.ts +329 -0
  16. package/dist/asset-manager/src/add-remove/remove.d.ts.map +1 -0
  17. package/dist/asset-manager/src/agent-render.d.ts +116 -0
  18. package/dist/asset-manager/src/agent-render.d.ts.map +1 -0
  19. package/dist/asset-manager/src/composed-blocks.d.ts +40 -0
  20. package/dist/asset-manager/src/composed-blocks.d.ts.map +1 -0
  21. package/dist/asset-manager/src/config/core.d.ts +297 -0
  22. package/dist/asset-manager/src/config/core.d.ts.map +1 -0
  23. package/dist/asset-manager/src/config/edit.d.ts +161 -0
  24. package/dist/asset-manager/src/config/edit.d.ts.map +1 -0
  25. package/dist/asset-manager/src/index.d.ts +31 -2961
  26. package/dist/asset-manager/src/index.d.ts.map +1 -1
  27. package/dist/asset-manager/src/install/clone-commit-fetcher.d.ts +11 -0
  28. package/dist/asset-manager/src/install/clone-commit-fetcher.d.ts.map +1 -0
  29. package/dist/asset-manager/src/install/install.d.ts +151 -0
  30. package/dist/asset-manager/src/install/install.d.ts.map +1 -0
  31. package/dist/asset-manager/src/install/restore.d.ts +76 -0
  32. package/dist/asset-manager/src/install/restore.d.ts.map +1 -0
  33. package/dist/asset-manager/src/install-agent.d.ts +52 -4
  34. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  35. package/dist/asset-manager/src/install-instances.d.ts +70 -2
  36. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  37. package/dist/asset-manager/src/installer.d.ts +54 -4
  38. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  39. package/dist/asset-manager/src/lock/copies.d.ts +156 -0
  40. package/dist/asset-manager/src/lock/copies.d.ts.map +1 -0
  41. package/dist/asset-manager/src/lock/library.d.ts +261 -0
  42. package/dist/asset-manager/src/lock/library.d.ts.map +1 -0
  43. package/dist/asset-manager/src/mcp-render.d.ts +86 -0
  44. package/dist/asset-manager/src/mcp-render.d.ts.map +1 -0
  45. package/dist/asset-manager/src/omp-sweep.d.ts +25 -0
  46. package/dist/asset-manager/src/omp-sweep.d.ts.map +1 -0
  47. package/dist/asset-manager/src/read/diff.d.ts +109 -0
  48. package/dist/asset-manager/src/read/diff.d.ts.map +1 -0
  49. package/dist/asset-manager/src/read/doctor.d.ts +116 -0
  50. package/dist/asset-manager/src/read/doctor.d.ts.map +1 -0
  51. package/dist/asset-manager/src/read/gaps.d.ts +120 -0
  52. package/dist/asset-manager/src/read/gaps.d.ts.map +1 -0
  53. package/dist/asset-manager/src/read/graph.d.ts +69 -0
  54. package/dist/asset-manager/src/read/graph.d.ts.map +1 -0
  55. package/dist/asset-manager/src/read/outdated.d.ts +152 -0
  56. package/dist/asset-manager/src/read/outdated.d.ts.map +1 -0
  57. package/dist/asset-manager/src/read/state.d.ts +265 -0
  58. package/dist/asset-manager/src/read/state.d.ts.map +1 -0
  59. package/dist/asset-manager/src/renderers.d.ts +11 -1
  60. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  61. package/dist/asset-manager/src/resolve/guards.d.ts +167 -0
  62. package/dist/asset-manager/src/resolve/guards.d.ts.map +1 -0
  63. package/dist/asset-manager/src/resolve/scan.d.ts +222 -0
  64. package/dist/asset-manager/src/resolve/scan.d.ts.map +1 -0
  65. package/dist/asset-manager/src/resolve/stores.d.ts +176 -0
  66. package/dist/asset-manager/src/resolve/stores.d.ts.map +1 -0
  67. package/dist/asset-manager/src/shared/files.d.ts +42 -0
  68. package/dist/asset-manager/src/shared/files.d.ts.map +1 -0
  69. package/dist/asset-manager/src/shared/library-hooks.d.ts +16 -0
  70. package/dist/asset-manager/src/shared/library-hooks.d.ts.map +1 -0
  71. package/dist/asset-manager/src/shared/library.d.ts +96 -0
  72. package/dist/asset-manager/src/shared/library.d.ts.map +1 -0
  73. package/dist/asset-manager/src/shared/refs.d.ts +101 -0
  74. package/dist/asset-manager/src/shared/refs.d.ts.map +1 -0
  75. package/dist/asset-manager/src/shared/types.d.ts +399 -0
  76. package/dist/asset-manager/src/shared/types.d.ts.map +1 -0
  77. package/dist/bridge/harnesses/claude-sdk.js +11 -17
  78. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  79. package/dist/bridge/harnesses/codex.js +10 -10
  80. package/dist/bridge/harnesses/continue.js +12 -16
  81. package/dist/bridge/harnesses/continue.js.map +1 -1
  82. package/dist/bridge/harnesses/echo.js +3 -8
  83. package/dist/bridge/harnesses/echo.js.map +1 -1
  84. package/dist/bridge/harnesses/gemini.js +5 -5
  85. package/dist/bridge/harnesses/goose.js +13 -17
  86. package/dist/bridge/harnesses/goose.js.map +1 -1
  87. package/dist/bridge/harnesses/omp.js +5 -11
  88. package/dist/bridge/harnesses/omp.js.map +1 -1
  89. package/dist/bridge/harnesses/opencode.js +13 -17
  90. package/dist/bridge/harnesses/opencode.js.map +1 -1
  91. package/dist/bridge/harnesses/qwen.js +6 -11
  92. package/dist/bridge/harnesses/qwen.js.map +1 -1
  93. package/dist/bridge/index.js +16 -16
  94. package/dist/bridge/src/codex/managed-harness.d.ts.map +1 -1
  95. package/dist/bridge/src/driver-contract.d.ts +72 -0
  96. package/dist/bridge/src/driver-contract.d.ts.map +1 -0
  97. package/dist/bridge/src/harness-model-check.d.ts +1 -1
  98. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  99. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts +8 -0
  100. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -1
  101. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  102. package/dist/bridge/src/harnesses/codex.d.ts +2 -0
  103. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  104. package/dist/bridge/src/harnesses/continue.d.ts.map +1 -1
  105. package/dist/bridge/src/harnesses/echo.d.ts.map +1 -1
  106. package/dist/bridge/src/harnesses/gemini.d.ts.map +1 -1
  107. package/dist/bridge/src/harnesses/goose.d.ts.map +1 -1
  108. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  109. package/dist/bridge/src/harnesses/opencode.d.ts.map +1 -1
  110. package/dist/bridge/src/harnesses/qwen.d.ts.map +1 -1
  111. package/dist/bridge/src/index.d.ts +2 -0
  112. package/dist/bridge/src/index.d.ts.map +1 -1
  113. package/dist/bridge/src/preflight.d.ts +114 -0
  114. package/dist/bridge/src/preflight.d.ts.map +1 -0
  115. package/dist/bridge/src/registry.d.ts +12 -0
  116. package/dist/bridge/src/registry.d.ts.map +1 -1
  117. package/dist/{chunk-MUQBP2BK.js → chunk-2JUCWMIS.js} +8808 -8337
  118. package/dist/chunk-2JUCWMIS.js.map +1 -0
  119. package/dist/{chunk-VS6XC5JE.js → chunk-2MTRRK37.js} +3 -3
  120. package/dist/{chunk-VS6XC5JE.js.map → chunk-2MTRRK37.js.map} +1 -1
  121. package/dist/chunk-2PJYJPDE.js +3 -0
  122. package/dist/chunk-2PJYJPDE.js.map +1 -0
  123. package/dist/{chunk-J7FEWDRQ.js → chunk-2SSG5B24.js} +4 -4
  124. package/dist/{chunk-J7FEWDRQ.js.map → chunk-2SSG5B24.js.map} +1 -1
  125. package/dist/{chunk-WDG5IVEA.js → chunk-2ZDZJ7XQ.js} +3 -3
  126. package/dist/{chunk-WDG5IVEA.js.map → chunk-2ZDZJ7XQ.js.map} +1 -1
  127. package/dist/{chunk-V2VDTQ7A.js → chunk-3A7JUOY2.js} +3 -3
  128. package/dist/{chunk-V2VDTQ7A.js.map → chunk-3A7JUOY2.js.map} +1 -1
  129. package/dist/{chunk-R7422XD4.js → chunk-3CRZJR7E.js} +20 -14
  130. package/dist/chunk-3CRZJR7E.js.map +1 -0
  131. package/dist/chunk-3LAJJURV.js +26 -0
  132. package/dist/chunk-3LAJJURV.js.map +1 -0
  133. package/dist/{chunk-FJJEC6O2.js → chunk-3UYKT62L.js} +5 -5
  134. package/dist/{chunk-FJJEC6O2.js.map → chunk-3UYKT62L.js.map} +1 -1
  135. package/dist/{chunk-HCIXCCUH.js → chunk-4X5WXQV7.js} +4 -4
  136. package/dist/{chunk-HCIXCCUH.js.map → chunk-4X5WXQV7.js.map} +1 -1
  137. package/dist/chunk-4ZNKEDYH.js +887 -0
  138. package/dist/chunk-4ZNKEDYH.js.map +1 -0
  139. package/dist/{chunk-OIWFXUZB.js → chunk-6M44OQKH.js} +40 -44
  140. package/dist/chunk-6M44OQKH.js.map +1 -0
  141. package/dist/{chunk-SXRN27TU.js → chunk-72DYHOO2.js} +24 -25
  142. package/dist/chunk-72DYHOO2.js.map +1 -0
  143. package/dist/{chunk-BNLXZXZN.js → chunk-BRAOB37W.js} +97 -47
  144. package/dist/chunk-BRAOB37W.js.map +1 -0
  145. package/dist/{chunk-ZLDAPZIX.js → chunk-BTMSHGN3.js} +4 -4
  146. package/dist/{chunk-ZLDAPZIX.js.map → chunk-BTMSHGN3.js.map} +1 -1
  147. package/dist/{chunk-7K73MCI6.js → chunk-CU5WY6HN.js} +3 -3
  148. package/dist/{chunk-7K73MCI6.js.map → chunk-CU5WY6HN.js.map} +1 -1
  149. package/dist/{chunk-CG63XGVV.js → chunk-EGKCKWWE.js} +3 -3
  150. package/dist/{chunk-CG63XGVV.js.map → chunk-EGKCKWWE.js.map} +1 -1
  151. package/dist/{chunk-CJO3XKO7.js → chunk-ETGC2MEM.js} +4 -4
  152. package/dist/{chunk-CJO3XKO7.js.map → chunk-ETGC2MEM.js.map} +1 -1
  153. package/dist/{chunk-PFBPESW7.js → chunk-FPG36VC4.js} +8 -13
  154. package/dist/chunk-FPG36VC4.js.map +1 -0
  155. package/dist/{chunk-SBAUZ7XH.js → chunk-H3PY5DFL.js} +4 -4
  156. package/dist/{chunk-SBAUZ7XH.js.map → chunk-H3PY5DFL.js.map} +1 -1
  157. package/dist/{chunk-7HRZACI4.js → chunk-HW4BDJPC.js} +17 -6
  158. package/dist/chunk-HW4BDJPC.js.map +1 -0
  159. package/dist/{chunk-7VBD5XUM.js → chunk-IG4YQ7ER.js} +32 -90
  160. package/dist/chunk-IG4YQ7ER.js.map +1 -0
  161. package/dist/{chunk-YDMZWVZN.js → chunk-K4763755.js} +8 -8
  162. package/dist/{chunk-YDMZWVZN.js.map → chunk-K4763755.js.map} +1 -1
  163. package/dist/{chunk-6WIZC6GM.js → chunk-KDRA6FYE.js} +120 -211
  164. package/dist/chunk-KDRA6FYE.js.map +1 -0
  165. package/dist/{chunk-KOI7QFDH.js → chunk-M7XIYHWB.js} +3 -3
  166. package/dist/{chunk-KOI7QFDH.js.map → chunk-M7XIYHWB.js.map} +1 -1
  167. package/dist/{chunk-7LJUK5JK.js → chunk-MG6QD7GE.js} +201 -43
  168. package/dist/chunk-MG6QD7GE.js.map +1 -0
  169. package/dist/{chunk-CWUHUL6W.js → chunk-NAQXDTF3.js} +3 -3
  170. package/dist/{chunk-CWUHUL6W.js.map → chunk-NAQXDTF3.js.map} +1 -1
  171. package/dist/{chunk-JIZ35OOU.js → chunk-NJ6UCY2B.js} +3 -3
  172. package/dist/{chunk-JIZ35OOU.js.map → chunk-NJ6UCY2B.js.map} +1 -1
  173. package/dist/{chunk-A3G3FHGB.js → chunk-NNJQQYHY.js} +2 -2
  174. package/dist/{chunk-A3G3FHGB.js.map → chunk-NNJQQYHY.js.map} +1 -1
  175. package/dist/{chunk-TYRAEMWE.js → chunk-OD4N5O7V.js} +4 -4
  176. package/dist/{chunk-TYRAEMWE.js.map → chunk-OD4N5O7V.js.map} +1 -1
  177. package/dist/{chunk-LBJCOEXH.js → chunk-P6FJDT35.js} +27 -7
  178. package/dist/chunk-P6FJDT35.js.map +1 -0
  179. package/dist/{chunk-IOXFT5D7.js → chunk-PD42JZWI.js} +3 -3
  180. package/dist/{chunk-IOXFT5D7.js.map → chunk-PD42JZWI.js.map} +1 -1
  181. package/dist/{chunk-MS2IXLTC.js → chunk-PMXTBWFD.js} +27 -7
  182. package/dist/chunk-PMXTBWFD.js.map +1 -0
  183. package/dist/{chunk-O74SRQ3W.js → chunk-PPSSDUN6.js} +3 -3
  184. package/dist/{chunk-O74SRQ3W.js.map → chunk-PPSSDUN6.js.map} +1 -1
  185. package/dist/{chunk-IYXOSBQ4.js → chunk-PRB67LCK.js} +126 -17
  186. package/dist/chunk-PRB67LCK.js.map +1 -0
  187. package/dist/{chunk-6VQW2X2F.js → chunk-QUIK7L3Z.js} +9 -9
  188. package/dist/{chunk-6VQW2X2F.js.map → chunk-QUIK7L3Z.js.map} +1 -1
  189. package/dist/{chunk-DRUAQ7IY.js → chunk-QUPZKTF3.js} +9 -8
  190. package/dist/chunk-QUPZKTF3.js.map +1 -0
  191. package/dist/{chunk-7FXOOUOC.js → chunk-RPRMD7XV.js} +27 -11
  192. package/dist/chunk-RPRMD7XV.js.map +1 -0
  193. package/dist/{chunk-U7EJB6LY.js → chunk-S3UOZBGE.js} +20 -3
  194. package/dist/chunk-S3UOZBGE.js.map +1 -0
  195. package/dist/{chunk-LQWOU7S2.js → chunk-SFBLZOV5.js} +3 -3
  196. package/dist/{chunk-LQWOU7S2.js.map → chunk-SFBLZOV5.js.map} +1 -1
  197. package/dist/{chunk-XPSZIBPU.js → chunk-SMCG4PMP.js} +43 -48
  198. package/dist/chunk-SMCG4PMP.js.map +1 -0
  199. package/dist/{chunk-EB2LKPI6.js → chunk-SMFZ5YGN.js} +4 -4
  200. package/dist/{chunk-EB2LKPI6.js.map → chunk-SMFZ5YGN.js.map} +1 -1
  201. package/dist/{chunk-IRIWNKQS.js → chunk-SX54OQQT.js} +4 -4
  202. package/dist/{chunk-IRIWNKQS.js.map → chunk-SX54OQQT.js.map} +1 -1
  203. package/dist/{chunk-2PVYDAFN.js → chunk-T65N4CIZ.js} +3 -3
  204. package/dist/{chunk-2PVYDAFN.js.map → chunk-T65N4CIZ.js.map} +1 -1
  205. package/dist/{chunk-C5ZCREBI.js → chunk-TVRL3IPZ.js} +3 -3
  206. package/dist/{chunk-C5ZCREBI.js.map → chunk-TVRL3IPZ.js.map} +1 -1
  207. package/dist/{chunk-RKTEHX2S.js → chunk-TW5AP6IF.js} +5 -5
  208. package/dist/{chunk-RKTEHX2S.js.map → chunk-TW5AP6IF.js.map} +1 -1
  209. package/dist/{chunk-EMIOFJQJ.js → chunk-TYK752MU.js} +3 -3
  210. package/dist/{chunk-EMIOFJQJ.js.map → chunk-TYK752MU.js.map} +1 -1
  211. package/dist/{chunk-HPQ2WDYC.js → chunk-U2WPJHRA.js} +5 -5
  212. package/dist/{chunk-HPQ2WDYC.js.map → chunk-U2WPJHRA.js.map} +1 -1
  213. package/dist/{chunk-YLKOCMU7.js → chunk-U6UFPOEK.js} +326 -1058
  214. package/dist/chunk-U6UFPOEK.js.map +1 -0
  215. package/dist/{chunk-MEU2HHGV.js → chunk-U7P22GEB.js} +386 -46
  216. package/dist/chunk-U7P22GEB.js.map +1 -0
  217. package/dist/{chunk-AEFDFCS2.js → chunk-VFEZUSB6.js} +4 -4
  218. package/dist/{chunk-AEFDFCS2.js.map → chunk-VFEZUSB6.js.map} +1 -1
  219. package/dist/{chunk-A4VKIVGB.js → chunk-WW22FS74.js} +75 -67
  220. package/dist/chunk-WW22FS74.js.map +1 -0
  221. package/dist/{chunk-72PPC4SC.js → chunk-Z23I2JA6.js} +6 -6
  222. package/dist/{chunk-72PPC4SC.js.map → chunk-Z23I2JA6.js.map} +1 -1
  223. package/dist/{chunk-KIFAU62K.js → chunk-Z7HLX4V2.js} +4 -4
  224. package/dist/{chunk-KIFAU62K.js.map → chunk-Z7HLX4V2.js.map} +1 -1
  225. package/dist/{chunk-CVUMZTNO.js → chunk-ZQPBYLCS.js} +4 -4
  226. package/dist/{chunk-CVUMZTNO.js.map → chunk-ZQPBYLCS.js.map} +1 -1
  227. package/dist/{claude-code-5QYXWC5H.js → claude-code-VL6UM7BZ.js} +4 -4
  228. package/dist/{claude-code-5QYXWC5H.js.map → claude-code-VL6UM7BZ.js.map} +1 -1
  229. package/dist/cli/index.js +491 -298
  230. package/dist/cli/index.js.map +1 -1
  231. package/dist/cli/src/agent-file-refresh.d.ts +25 -0
  232. package/dist/cli/src/agent-file-refresh.d.ts.map +1 -0
  233. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  234. package/dist/cli/src/commands/catalog.d.ts +9 -2
  235. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  236. package/dist/cli/src/commands/config.d.ts.map +1 -1
  237. package/dist/cli/src/commands/harness.d.ts +1 -1
  238. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  239. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  240. package/dist/cli/src/commands/library-index.d.ts +5 -7
  241. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  242. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  243. package/dist/cli/src/commands/preset-export.d.ts.map +1 -1
  244. package/dist/cli/src/commands/project.d.ts.map +1 -1
  245. package/dist/cli/src/commands/run.d.ts.map +1 -1
  246. package/dist/cli/src/commands/serve-preflight.d.ts +27 -48
  247. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  248. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  249. package/dist/cli/src/commands/source.d.ts +6 -9
  250. package/dist/cli/src/commands/source.d.ts.map +1 -1
  251. package/dist/cli/src/commands/validate.d.ts +6 -0
  252. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  253. package/dist/cli/src/config-checks.d.ts.map +1 -1
  254. package/dist/cli/src/harness-error.d.ts +11 -9
  255. package/dist/cli/src/harness-error.d.ts.map +1 -1
  256. package/dist/cli/src/skill-checks.d.ts +48 -74
  257. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  258. package/dist/connectors/config.js +5 -5
  259. package/dist/connectors/index.js +19 -19
  260. package/dist/{connectors-DLXW27NQ.js → connectors-7EPJRVLJ.js} +22 -22
  261. package/dist/{connectors-DLXW27NQ.js.map → connectors-7EPJRVLJ.js.map} +1 -1
  262. package/dist/core/index.js +7 -6
  263. package/dist/core/manifest.js +2 -2
  264. package/dist/core/models.js +1 -1
  265. package/dist/core/publish-manifest.js +3 -3
  266. package/dist/core/ref.js +1 -1
  267. package/dist/core/runtime-assets.js +5 -5
  268. package/dist/core/src/agent-prompt-sections.d.ts +96 -4
  269. package/dist/core/src/agent-prompt-sections.d.ts.map +1 -1
  270. package/dist/core/src/check-asset.d.ts +115 -0
  271. package/dist/core/src/check-asset.d.ts.map +1 -0
  272. package/dist/core/src/harness-model.d.ts +20 -0
  273. package/dist/core/src/harness-model.d.ts.map +1 -0
  274. package/dist/core/src/index.d.ts +10 -6
  275. package/dist/core/src/index.d.ts.map +1 -1
  276. package/dist/core/src/lock.d.ts +12 -10
  277. package/dist/core/src/lock.d.ts.map +1 -1
  278. package/dist/core/src/models.d.ts +42 -11
  279. package/dist/core/src/models.d.ts.map +1 -1
  280. package/dist/core/src/publish-manifest.d.ts +17 -0
  281. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  282. package/dist/core/src/repo-identity.d.ts +41 -0
  283. package/dist/core/src/repo-identity.d.ts.map +1 -0
  284. package/dist/core/src/repo-manager.d.ts +3 -9
  285. package/dist/core/src/repo-manager.d.ts.map +1 -1
  286. package/dist/core/src/walker.d.ts.map +1 -1
  287. package/dist/core/src/workspace-config.d.ts.map +1 -1
  288. package/dist/core/workspace-config.js +4 -4
  289. package/dist/deploy/index.js +7 -6
  290. package/dist/deploy/index.js.map +1 -1
  291. package/dist/discovery/index.js +5 -5
  292. package/dist/discovery/src/source-config.d.ts.map +1 -1
  293. package/dist/{ensure-sources-I7GCXPXK.js → ensure-sources-CI3JQJST.js} +30 -28
  294. package/dist/ensure-sources-CI3JQJST.js.map +1 -0
  295. package/dist/factory-assets/connectors/box.js +19 -19
  296. package/dist/factory-assets/connectors/deploy.js +19 -19
  297. package/dist/factory-assets/connectors/devserver.js +19 -19
  298. package/dist/factory-assets/connectors/flow/adapter.js +19 -19
  299. package/dist/factory-assets/connectors/flow/engine.js +8 -7
  300. package/dist/factory-assets/connectors/flow/run-flow.js +21 -21
  301. package/dist/factory-assets/connectors/flow.js +19 -19
  302. package/dist/factory-assets/connectors/git.js +19 -19
  303. package/dist/factory-assets/connectors/gmail.js +19 -19
  304. package/dist/factory-assets/connectors/googledrive.js +19 -19
  305. package/dist/factory-assets/connectors/local.js +19 -19
  306. package/dist/factory-assets/connectors/mattermost.js +19 -19
  307. package/dist/factory-assets/connectors/memory.js +19 -19
  308. package/dist/factory-assets/connectors/minio.js +19 -19
  309. package/dist/factory-assets/connectors/postgres.js +19 -19
  310. package/dist/factory-assets/connectors/s3.js +19 -19
  311. package/dist/factory-assets/connectors/sharepoint.js +19 -19
  312. package/dist/factory-assets/connectors/sqlite.js +19 -19
  313. package/dist/factory-assets/connectors/static-server.js +19 -19
  314. package/dist/factory-assets/connectors/tunnel.js +19 -19
  315. package/dist/factory-assets/connectors/webdav.js +19 -19
  316. package/dist/factory-assets/connectors/xstate-store.js +19 -19
  317. package/dist/factory-assets/connectors/xstate.js +19 -19
  318. package/dist/{flows-J64L5MGJ.js → flows-6XQAYQS4.js} +12 -11
  319. package/dist/{flows-J64L5MGJ.js.map → flows-6XQAYQS4.js.map} +1 -1
  320. package/dist/{helpers-U75UGGH5.js → helpers-26MR5QPO.js} +30 -28
  321. package/dist/{helpers-U75UGGH5.js.map → helpers-26MR5QPO.js.map} +1 -1
  322. package/dist/library/index.js +10 -10
  323. package/dist/library/install.js +4 -4
  324. package/dist/library/src/index.d.ts +1 -1
  325. package/dist/library/src/index.d.ts.map +1 -1
  326. package/dist/library/src/local/db.d.ts.map +1 -1
  327. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  328. package/dist/library/src/local/library.d.ts.map +1 -1
  329. package/dist/library/src/local/schema.d.ts +19 -0
  330. package/dist/library/src/local/schema.d.ts.map +1 -1
  331. package/dist/library/src/user-library.d.ts +18 -0
  332. package/dist/library/src/user-library.d.ts.map +1 -1
  333. package/dist/{library-publish-57422ULT.js → library-publish-YHYGA6G5.js} +71 -65
  334. package/dist/library-publish-YHYGA6G5.js.map +1 -0
  335. package/dist/model-endpoint/index.js +10 -9
  336. package/dist/{open-library-EVUKLOV7.js → open-library-FVV6GG4I.js} +33 -31
  337. package/dist/{open-library-EVUKLOV7.js.map → open-library-FVV6GG4I.js.map} +1 -1
  338. package/dist/{open-registry-4HNCWOCN.js → open-registry-VX2BVMS5.js} +16 -16
  339. package/dist/{open-registry-4HNCWOCN.js.map → open-registry-VX2BVMS5.js.map} +1 -1
  340. package/dist/{paths-PXBWY532.js → paths-PIWSSUUG.js} +10 -9
  341. package/dist/{paths-PXBWY532.js.map → paths-PIWSSUUG.js.map} +1 -1
  342. package/dist/{plugin-store-ZC3EGZ3D.js → plugin-store-MVTW6G7J.js} +10 -9
  343. package/dist/{plugin-store-ZC3EGZ3D.js.map → plugin-store-MVTW6G7J.js.map} +1 -1
  344. package/dist/{project-HB7OYPEF.js → project-BOAHGBMI.js} +47 -45
  345. package/dist/{project-HB7OYPEF.js.map → project-BOAHGBMI.js.map} +1 -1
  346. package/dist/resolver/index.js +8 -7
  347. package/dist/runner/composition-content.d.ts +2 -0
  348. package/dist/runner/composition-content.js +29 -0
  349. package/dist/runner/composition-content.js.map +1 -0
  350. package/dist/runner/index.js +37 -36
  351. package/dist/runner/src/composition/content-entry.d.ts +15 -0
  352. package/dist/runner/src/composition/content-entry.d.ts.map +1 -0
  353. package/dist/runner/src/composition/content-source.d.ts +7 -0
  354. package/dist/runner/src/composition/content-source.d.ts.map +1 -1
  355. package/dist/runner/src/composition/dry-run.d.ts +5 -1
  356. package/dist/runner/src/composition/dry-run.d.ts.map +1 -1
  357. package/dist/runner/src/composition/index.d.ts +1 -1
  358. package/dist/runner/src/composition/index.d.ts.map +1 -1
  359. package/dist/runner/src/composition/prompt-sections.d.ts +47 -20
  360. package/dist/runner/src/composition/prompt-sections.d.ts.map +1 -1
  361. package/dist/runner/src/external-mcp.d.ts +32 -7
  362. package/dist/runner/src/external-mcp.d.ts.map +1 -1
  363. package/dist/runner/src/session-builder.d.ts +3 -8
  364. package/dist/runner/src/session-builder.d.ts.map +1 -1
  365. package/dist/sdk/asset-manager.js +17 -15
  366. package/dist/sdk/bridge.js +16 -16
  367. package/dist/sdk/core.js +7 -6
  368. package/dist/sdk/flow.js +8 -7
  369. package/dist/sdk/index.js +37 -36
  370. package/dist/sdk/index.js.map +1 -1
  371. package/dist/sdk/resolver.js +8 -7
  372. package/dist/sdk/runner.js +37 -36
  373. package/dist/sdk/transport/ws/server.js +8 -7
  374. package/dist/sdk/transport/ws.js +8 -7
  375. package/dist/sdk/transport.js +8 -7
  376. package/dist/serve-preflight-XJS5OZML.js +138 -0
  377. package/dist/serve-preflight-XJS5OZML.js.map +1 -0
  378. package/dist/{setup-2XV6T53V.js → setup-BFEBJLYF.js} +31 -29
  379. package/dist/setup-BFEBJLYF.js.map +1 -0
  380. package/dist/{skills-5D4KDVPJ.js → skills-OCG7B5CL.js} +13 -12
  381. package/dist/{skills-5D4KDVPJ.js.map → skills-OCG7B5CL.js.map} +1 -1
  382. package/dist/source-J2MJIHDS.js +93 -0
  383. package/dist/{source-VXE3RSSA.js.map → source-J2MJIHDS.js.map} +1 -1
  384. package/dist/{source-manifest-publish-IIVQLM67.js → source-manifest-publish-6MYDXCKZ.js} +51 -49
  385. package/dist/source-manifest-publish-6MYDXCKZ.js.map +1 -0
  386. package/dist/transport/index.js +8 -7
  387. package/dist/transport/ws/server.js +8 -7
  388. package/dist/transport/ws.js +8 -7
  389. package/dist/tui/index.js +37 -36
  390. package/dist/tui/index.js.map +1 -1
  391. package/dist/types/src/runtime.d.ts +6 -0
  392. package/dist/types/src/runtime.d.ts.map +1 -1
  393. package/dist/workspace-plugin/adapters/mcp.js +26 -26
  394. package/dist/workspace-plugin/adapters/omp.js +14 -14
  395. package/dist/workspace-plugin/index.js +1 -1
  396. package/package.json +7 -1
  397. package/dist/asset-feeds-PM7FKHJP.js.map +0 -1
  398. package/dist/chunk-2RVEYDQK.js +0 -110
  399. package/dist/chunk-2RVEYDQK.js.map +0 -1
  400. package/dist/chunk-6WIZC6GM.js.map +0 -1
  401. package/dist/chunk-7FXOOUOC.js.map +0 -1
  402. package/dist/chunk-7HRZACI4.js.map +0 -1
  403. package/dist/chunk-7LJUK5JK.js.map +0 -1
  404. package/dist/chunk-7VBD5XUM.js.map +0 -1
  405. package/dist/chunk-A4VKIVGB.js.map +0 -1
  406. package/dist/chunk-BNLXZXZN.js.map +0 -1
  407. package/dist/chunk-DRUAQ7IY.js.map +0 -1
  408. package/dist/chunk-IYXOSBQ4.js.map +0 -1
  409. package/dist/chunk-LBJCOEXH.js.map +0 -1
  410. package/dist/chunk-MEU2HHGV.js.map +0 -1
  411. package/dist/chunk-MS2IXLTC.js.map +0 -1
  412. package/dist/chunk-MUQBP2BK.js.map +0 -1
  413. package/dist/chunk-OIWFXUZB.js.map +0 -1
  414. package/dist/chunk-PFBPESW7.js.map +0 -1
  415. package/dist/chunk-R7422XD4.js.map +0 -1
  416. package/dist/chunk-SXRN27TU.js.map +0 -1
  417. package/dist/chunk-U7EJB6LY.js.map +0 -1
  418. package/dist/chunk-XPSZIBPU.js.map +0 -1
  419. package/dist/chunk-YLKOCMU7.js.map +0 -1
  420. package/dist/cli/src/commands/harness-preflight.d.ts +0 -40
  421. package/dist/cli/src/commands/harness-preflight.d.ts.map +0 -1
  422. package/dist/ensure-sources-I7GCXPXK.js.map +0 -1
  423. package/dist/library-publish-57422ULT.js.map +0 -1
  424. package/dist/serve-preflight-YY3YC6GH.js +0 -61
  425. package/dist/serve-preflight-YY3YC6GH.js.map +0 -1
  426. package/dist/setup-2XV6T53V.js.map +0 -1
  427. package/dist/source-VXE3RSSA.js +0 -91
  428. package/dist/source-manifest-publish-IIVQLM67.js.map +0 -1
@@ -1,38 +1,37 @@
1
- import { WorkspacePlugin } from './chunk-A3G3FHGB.js';
2
- import { buildWorkspaceToolDefs } from './chunk-72PPC4SC.js';
3
- import { findAiAssetsRoot } from './chunk-V2VDTQ7A.js';
4
- import { startModelEndpoint, ModelEndpointError } from './chunk-FJJEC6O2.js';
5
- import { WebSocketServerTransport } from './chunk-7K73MCI6.js';
1
+ import { WorkspacePlugin } from './chunk-NNJQQYHY.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-Z23I2JA6.js';
3
+ import { findAiAssetsRoot } from './chunk-3A7JUOY2.js';
4
+ import { startModelEndpoint, ModelEndpointError } from './chunk-3UYKT62L.js';
5
+ import { WebSocketServerTransport } from './chunk-CU5WY6HN.js';
6
6
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
7
- import { resolveFlowPath } from './chunk-YDMZWVZN.js';
8
- import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-LQWOU7S2.js';
9
- import { ConnectFailureCarryOver, registerBuiltinConnectors, listConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, fleetMountConnectingMessage, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, TRUSTED_GIT_CA_ENV, writeUserGitconfigInclude, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-6VQW2X2F.js';
10
- import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-SBAUZ7XH.js';
11
- import { EventNormalizer } from './chunk-IYXOSBQ4.js';
12
- import { sessionSurfaceNotice, approvalCardOf, APPROVE_ONCE, DENY, probeResumeTranscript, transcriptStoreForRuntime } from './chunk-TYRAEMWE.js';
13
- import { codexLoginFallbackNotice, prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-SXRN27TU.js';
7
+ import { resolveFlowPath } from './chunk-K4763755.js';
8
+ import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-SFBLZOV5.js';
9
+ import { ConnectFailureCarryOver, registerBuiltinConnectors, listConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, fleetMountConnectingMessage, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, TRUSTED_GIT_CA_ENV, writeUserGitconfigInclude, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-QUIK7L3Z.js';
10
+ import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-H3PY5DFL.js';
11
+ import { EventNormalizer } from './chunk-PRB67LCK.js';
12
+ import { sessionSurfaceNotice, approvalCardOf, APPROVE_ONCE, DENY, probeResumeTranscript, transcriptStoreForRuntime } from './chunk-OD4N5O7V.js';
13
+ import { codexLoginFallbackNotice, prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-72DYHOO2.js';
14
14
  import { CodexNativeStateUnavailable } from './chunk-5KSGZP3E.js';
15
15
  import { dispatchCapability } from './chunk-HXST2IYJ.js';
16
16
  import { classifyClaudeSdkError } from './chunk-5DE3DGVR.js';
17
17
  import { agentExecRequested } from './chunk-7DN6JKP2.js';
18
- import { toAgentEffort, toMergedRegistry } from './chunk-CWUHUL6W.js';
19
- import { unresolvedProviderCredentials, harnessCapabilities, createHarness, providerCredentialEnvName, registryCredentialEnv, supportsLiveToolUpdates } from './chunk-U7EJB6LY.js';
18
+ import { toAgentEffort, toMergedRegistry } from './chunk-NAQXDTF3.js';
19
+ import { unresolvedProviderCredentials, harnessCapabilities, createHarness, providerCredentialEnvName, registryCredentialEnv, supportsLiveToolUpdates } from './chunk-S3UOZBGE.js';
20
20
  import { catalogLayer, AI_PROVIDER_PRESETS } from './chunk-6UP2EDFN.js';
21
- import { loadFlow } from './chunk-WDG5IVEA.js';
21
+ import { loadFlow } from './chunk-2ZDZJ7XQ.js';
22
22
  import { renderStimulusPrompt } from './chunk-WD3L5QSU.js';
23
23
  import { TURN_VISIBILITY_EVENT_TYPES, withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, TERMINAL_AGENT_RUN_STATUSES, SESSION_ROOT_CONNECTOR_ID, PLATFORM_BLOCKS_RUNTIME_FEATURE, TURN_VISIBILITY_RUNTIME_FEATURE, TURN_IDS_RUNTIME_FEATURE, PROTOCOL_VERSION, TURN_IDS_MAX_COUNT, TURN_ID_MAX_LENGTH, deliveryClassOf } from './chunk-JPV4WE5L.js';
24
- import { knowledgeKindProvider, scanLibraryRoot, LocalIndex } from './chunk-7FXOOUOC.js';
25
- import { createDefaultKindRegistry } from './chunk-DRUAQ7IY.js';
26
24
  import { parseFlowDefinition } from './chunk-JRN5QF4C.js';
27
- import { BindingSchema, effectiveComposes, AgentManifestSchema, AgentTriggerSchema, ANTHROPIC_MODEL_ALIASES } from './chunk-LCXQ4LVP.js';
28
- import { readLock, buildAgentPromptSections, resolveSettings, loadProviderRegistry, resolveLibraryDir } from './chunk-MEU2HHGV.js';
29
- import { resolveRuntimeAssets } from './chunk-CJO3XKO7.js';
25
+ import { CompileManifestEntrySchema, resolveBinding, CompositionError, isEmptyKnowledgeIndex, hashContent, loadCompileManifestFromDir, createCompositionContentSource, assembleRunnerAgent, readNativeAgentFile, nativeAgentFilePath, COMPILE_MANIFEST_FILENAME } from './chunk-4ZNKEDYH.js';
26
+ import { resolveSettings, loadProviderRegistry, modelForHarness, AGENT_PROMPT_CARRIER_LABELS, AGENT_PROMPT_CARRIERS, resolveLibraryDir } from './chunk-U7P22GEB.js';
27
+ import { resolveRuntimeAssets } from './chunk-ETGC2MEM.js';
30
28
  import { DEFAULT_HARNESS_ID, resolveHarnessPaths } from './chunk-C5HFK34M.js';
31
- import { matchPin, DEFAULT_AGENT_INSTANCE_ID, effectiveAgentInstances, resolveAgentDefinitionDir, AgentRefResolutionError, resolveSkWorkspaceConfig, resolveAgentDir, agentSourceCacheDir, loadMcpServerDeclarations, COMPACTION_DEFAULTS, resolveCompactionThresholdPercent, getGlobalCacheDir, sourceCacheKey, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration, stageMaterializedSkills, readSkillAllowList, isStagedSkillMarkerFor, unstageSkill, STAGED_SKILL_MARKER } from './chunk-BNLXZXZN.js';
29
+ import { DEFAULT_AGENT_INSTANCE_ID, effectiveAgentInstances, resolveAgentDefinitionDir, AgentRefResolutionError, resolveSkWorkspaceConfig, resolveAgentDir, agentSourceCacheDir, loadMcpServerDeclarations, COMPACTION_DEFAULTS, resolveCompactionThresholdPercent, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration, stageMaterializedSkills, readSkillAllowList, isStagedSkillMarkerFor, unstageSkill, STAGED_SKILL_MARKER } from './chunk-BRAOB37W.js';
32
30
  import { globalSkaileDir, globalCacheRoot } from './chunk-L5VSIPQD.js';
33
31
  import { harnessNameForHarnessId, SUPPORTED_HARNESSES, HARNESS_TARGETS } from './chunk-VTETQCR6.js';
34
- import { withFsDeadline, FsDeadlineError, fsDeadlineMs, parseFrontmatter, tryWithFsDeadline } from './chunk-VS6XC5JE.js';
35
- import { parseAssetRef } from './chunk-7HRZACI4.js';
32
+ import { withFsDeadline, FsDeadlineError, fsDeadlineMs, parseFrontmatter, tryWithFsDeadline } from './chunk-2MTRRK37.js';
33
+ import { parseAssetRef } from './chunk-HW4BDJPC.js';
34
+ import { effectiveComposes, AgentManifestSchema, AgentTriggerSchema } from './chunk-LCXQ4LVP.js';
36
35
  import { portableSpawnSync } from './chunk-VSX2G7LA.js';
37
36
  import { pickRegistryEntries, registryEntries, resolveEntryBaseUrl, parseModelRef, isEntryEnabled, parseCredentialRef } from './chunk-RXGPFAMN.js';
38
37
  import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink, resolveLogsRetention, enforceLogsRetention, ensureRunStateIgnored, scrubLogText } from './chunk-RZL4TOK3.js';
@@ -40,14 +39,14 @@ import { getLogStore, registerLogStore, createLogger, resetLogStore, isUnwritabl
40
39
  import { __require } from './chunk-NSBPE2FW.js';
41
40
  import { createInterface } from 'readline';
42
41
  import pc from 'picocolors';
43
- import path3, { resolve, basename, join, dirname, relative, sep, isAbsolute } from 'path';
42
+ import path4, { resolve, basename, join, dirname, relative, sep, isAbsolute } from 'path';
44
43
  import { Marked } from 'marked';
45
44
  import { markedTerminal } from 'marked-terminal';
46
45
  import { createHash, randomUUID, randomBytes, timingSafeEqual } from 'crypto';
47
- import * as z5 from 'zod';
46
+ import * as z4 from 'zod';
48
47
  import { z } from 'zod';
49
- import { constants, unlinkSync, readFileSync, readdirSync, statSync, existsSync, lstatSync, realpathSync, mkdirSync, writeFileSync, renameSync, rmSync, watch, chmodSync, accessSync } from 'fs';
50
- import fs8, { readFile, readdir, lstat, realpath, rm, unlink, stat, mkdir, writeFile, readlink, rename, open, mkdtemp } from 'fs/promises';
48
+ import { constants, unlinkSync, readFileSync, existsSync, lstatSync, realpathSync, mkdirSync, statSync, writeFileSync, renameSync, rmSync, watch, chmodSync, accessSync } from 'fs';
49
+ import fs5, { readFile, readdir, lstat, realpath, rm, unlink, stat, mkdir, writeFile, readlink, rename, open, mkdtemp } from 'fs/promises';
51
50
  import { parse } from 'yaml';
52
51
  import { Ajv2020 } from 'ajv/dist/2020.js';
53
52
  import { execFile } from 'child_process';
@@ -168,7 +167,7 @@ var currentSessionId = null;
168
167
  function bootstrapRunnerLogStore(opts) {
169
168
  const existing = getLogStore();
170
169
  if (existing && currentSessionId === opts.sessionId) {
171
- const reusedPath = opts.projectDir ? path3.join(opts.projectDir, ".skaile", "logs.db") : void 0;
170
+ const reusedPath = opts.projectDir ? path4.join(opts.projectDir, ".skaile", "logs.db") : void 0;
172
171
  return {
173
172
  store: existing,
174
173
  dispose: () => disposeStore(existing),
@@ -180,7 +179,7 @@ function bootstrapRunnerLogStore(opts) {
180
179
  workspacePath: opts.projectDir,
181
180
  yamlBlock: opts.yamlBlock
182
181
  });
183
- const logsDbPath = cfg.mode === "persistent" && cfg.workspacePath ? path3.join(cfg.workspacePath, ".skaile", "logs.db") : void 0;
182
+ const logsDbPath = cfg.mode === "persistent" && cfg.workspacePath ? path4.join(cfg.workspacePath, ".skaile", "logs.db") : void 0;
184
183
  const store = createLogStoreFromConfig(cfg, { stdout: opts.stdout });
185
184
  if (opts.onLog) {
186
185
  store.addSink(new OnLogBridgeSink(opts.onLog));
@@ -205,7 +204,7 @@ function bootstrapRunnerLogStore(opts) {
205
204
  };
206
205
  }
207
206
  function scheduleRetention(cfg) {
208
- const dbPath = path3.join(cfg.workspacePath, ".skaile", "logs.db");
207
+ const dbPath = path4.join(cfg.workspacePath, ".skaile", "logs.db");
209
208
  const policy = resolveLogsRetention(cfg.retention);
210
209
  const log = createLogger({ kind: "runner", subkind: "logging", instance: cfg.sessionId });
211
210
  return new Promise((resolve5) => setImmediate(resolve5)).then(() => enforceLogsRetention(dbPath, policy)).then(
@@ -297,11 +296,11 @@ var MarkdownStreamer = class {
297
296
  }
298
297
  };
299
298
  function defineCapability(args) {
300
- const inputSchema = z5.toJSONSchema(args.input, {
299
+ const inputSchema = z4.toJSONSchema(args.input, {
301
300
  target: "draft-07",
302
301
  io: "input"
303
302
  });
304
- const outputSchema = args.output ? z5.toJSONSchema(args.output, {
303
+ const outputSchema = args.output ? z4.toJSONSchema(args.output, {
305
304
  target: "draft-07",
306
305
  io: "output"
307
306
  }) : void 0;
@@ -340,7 +339,7 @@ function registerCompositionCapabilities(registry, entries) {
340
339
  scope: "session",
341
340
  kind: "query",
342
341
  userInvokable: false,
343
- input: z5.strictObject({}),
342
+ input: z4.strictObject({}),
344
343
  handler: async (_args, ctx) => {
345
344
  ctx.log.info("loading composed asset content", {
346
345
  ref: entry.ref,
@@ -382,777 +381,14 @@ async function openLocalIndexIfAvailable(log) {
382
381
  return STUB_LIBRARY;
383
382
  }
384
383
  try {
385
- const { LocalIndex: LocalIndex2 } = await import('./library/index.js');
386
- return new LocalIndex2();
384
+ const { LocalIndex } = await import('./library/index.js');
385
+ return new LocalIndex();
387
386
  } catch (err) {
388
387
  log?.debug(`Could not open LocalIndex at ${indexPath}: ${err.message}`);
389
388
  return STUB_LIBRARY;
390
389
  }
391
390
  }
392
391
 
393
- // runner/src/composition/errors.ts
394
- var CompositionError = class extends Error {
395
- constructor(code, reason, message, ref, moved) {
396
- super(message);
397
- this.code = code;
398
- this.reason = reason;
399
- this.ref = ref;
400
- this.moved = moved;
401
- this.name = "CompositionError";
402
- }
403
- code;
404
- reason;
405
- ref;
406
- moved;
407
- };
408
- function isCompositionError(err, code) {
409
- return err instanceof CompositionError && (code === void 0 || err.code === code);
410
- }
411
- async function resolveMixin(ref, defaultKind, agentDir, repos) {
412
- if (ref.startsWith(".") || ref.startsWith("/")) {
413
- const absPath = ref.startsWith("/") ? ref : path3.join(agentDir, ref);
414
- if (defaultKind === "knowledge") {
415
- return loadKnowledgeDir(absPath);
416
- }
417
- const content = await readFileSafe(absPath);
418
- if (!content) return null;
419
- return { content: stripFrontmatter(content).trim(), source: absPath };
420
- }
421
- const { kind, name, repoQualifier } = parseRef(ref, defaultKind);
422
- const entry = findInRepos(repos, kind, name, repoQualifier);
423
- if (!entry) return null;
424
- if (entry.kind === "knowledge") {
425
- return loadKnowledgeDir(path3.dirname(entry.source));
426
- }
427
- const raw = await readFileSafe(entry.source);
428
- if (!raw) return null;
429
- return { content: stripFrontmatter(raw).trim(), source: entry.source };
430
- }
431
- async function readFileSafe(filePath) {
432
- try {
433
- return await fs8.readFile(filePath, "utf-8");
434
- } catch {
435
- return "";
436
- }
437
- }
438
- function stripFrontmatter(text2) {
439
- return text2.replace(/^---\s*\n[\s\S]*?\n---\s*\n?/, "");
440
- }
441
- function parseRef(ref, defaultKind) {
442
- let rest = ref.trim();
443
- let kind = defaultKind;
444
- const colonIdx = rest.indexOf(":");
445
- if (colonIdx !== -1) {
446
- kind = rest.slice(0, colonIdx).trim();
447
- rest = rest.slice(colonIdx + 1).trim();
448
- }
449
- const hashIdx = rest.indexOf("#");
450
- if (hashIdx !== -1) rest = rest.slice(0, hashIdx).trim();
451
- let repoQualifier;
452
- const atIdx = rest.indexOf("@");
453
- if (atIdx !== -1) {
454
- repoQualifier = rest.slice(atIdx + 1).trim() || void 0;
455
- rest = rest.slice(0, atIdx).trim();
456
- }
457
- return { kind, name: rest, repoQualifier };
458
- }
459
- function findInRepos(repos, kind, name, repoQualifier) {
460
- const searchRepos = repoQualifier ? repos[repoQualifier] ? [repos[repoQualifier]] : [] : Object.values(repos);
461
- for (const entries of searchRepos) {
462
- const found = entries.find((e) => e.kind === kind && e.name === name);
463
- if (found) return found;
464
- }
465
- return void 0;
466
- }
467
- function isEmptyKnowledgeIndex(text2) {
468
- if (!text2) return false;
469
- let parsed;
470
- try {
471
- parsed = parse(text2);
472
- } catch {
473
- return false;
474
- }
475
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return false;
476
- const documents = parsed.documents;
477
- return Array.isArray(documents) && documents.length === 0;
478
- }
479
- async function loadKnowledgeDir(dir) {
480
- let entries;
481
- try {
482
- entries = (await fs8.readdir(dir)).filter((e) => e.endsWith(".md"));
483
- } catch {
484
- return null;
485
- }
486
- const priorityMap = {};
487
- const indexContent = await readFileSafe(path3.join(dir, "index.yaml"));
488
- if (indexContent) {
489
- const pathMatches = [...indexContent.matchAll(/path:\s*(\S+)/g)];
490
- const priorityMatches = [...indexContent.matchAll(/priority:\s*(\d+)/g)];
491
- pathMatches.forEach((m, i) => {
492
- const filename = m[1];
493
- if (!filename) return;
494
- const priority = priorityMatches[i] ? parseInt(priorityMatches[i][1] ?? "99", 10) : 99;
495
- priorityMap[filename] = priority;
496
- });
497
- }
498
- const docs = await Promise.all(
499
- entries.map(async (filename) => ({
500
- filename,
501
- priority: priorityMap[filename] ?? 99,
502
- content: (await readFileSafe(path3.join(dir, filename))).trim()
503
- }))
504
- );
505
- const sorted = docs.filter((d) => d.content).sort((a, b) => a.priority - b.priority || a.filename.localeCompare(b.filename));
506
- if (sorted.length === 0) {
507
- return isEmptyKnowledgeIndex(indexContent) ? { content: indexContent, source: dir } : null;
508
- }
509
- return {
510
- content: sorted.map((d) => d.content).join("\n\n---\n\n"),
511
- source: dir
512
- };
513
- }
514
-
515
- // runner/src/composition/content-source.ts
516
- function parseCatalogRef(ref) {
517
- let rest = ref.trim();
518
- const kindPrefix = /^([a-z][a-z0-9-]*):(?!\/\/)/.exec(rest);
519
- if (kindPrefix) rest = rest.slice(kindPrefix[0].length);
520
- let pin;
521
- const hash = rest.indexOf("#");
522
- if (hash !== -1) {
523
- pin = rest.slice(hash + 1).trim() || void 0;
524
- rest = rest.slice(0, hash);
525
- }
526
- const scoped = /^@([^/@]+)\/([^@]+)(?:@(.+))?$/.exec(rest);
527
- if (scoped) {
528
- return { publisher: scoped[1], name: scoped[2], pin: pin ?? scoped[3]?.trim() };
529
- }
530
- const at = rest.indexOf("@");
531
- if (at !== -1) {
532
- return { publisher: rest.slice(at + 1) || void 0, name: rest.slice(0, at), pin };
533
- }
534
- return { name: rest, pin };
535
- }
536
- var LOCK_KEY_RE = /^([a-z][a-z0-9-]*):@([^/]+)\/([^#]+)#(.+)$/;
537
- var barePublisher = (p) => p.startsWith("@") ? p.slice(1) : p;
538
- var sha256Of = (text2) => createHash("sha256").update(text2).digest("hex");
539
- var CatalogScanner = class {
540
- constructor(projectDir, registry, explicitRoots) {
541
- this.projectDir = projectDir;
542
- this.registry = registry;
543
- this.roots = explicitRoots;
544
- }
545
- projectDir;
546
- registry;
547
- scans = /* @__PURE__ */ new Map();
548
- roots;
549
- /** Every discovered asset of `kind` named `name` under one root (any root, declared or not). */
550
- findIn(root, kind, name) {
551
- return this.scan(root).filter((hit) => hit.asset.kind === kind && hit.asset.name === name);
552
- }
553
- /** Every discovered asset of `kind` named `name`, across all roots. */
554
- find(kind, name) {
555
- const out = [];
556
- for (const root of this.resolveRoots()) {
557
- for (const hit of this.scan(root)) {
558
- if (hit.asset.kind === kind && hit.asset.name === name) out.push(hit);
559
- }
560
- }
561
- return out;
562
- }
563
- scan(root) {
564
- let cached = this.scans.get(root);
565
- if (!cached) {
566
- try {
567
- cached = scanLibraryRoot(root, this.registry).assets.map((asset) => ({ asset, root }));
568
- } catch {
569
- cached = [];
570
- }
571
- this.scans.set(root, cached);
572
- }
573
- return cached;
574
- }
575
- resolveRoots() {
576
- if (!this.roots) this.roots = defaultCatalogRoots(this.projectDir);
577
- return this.roots;
578
- }
579
- };
580
- function defaultCatalogRoots(projectDir) {
581
- const roots = /* @__PURE__ */ new Set();
582
- const add = (dir2) => {
583
- if (!dir2 || !existsSync(dir2)) return;
584
- try {
585
- if (statSync(dir2).isDirectory()) roots.add(realpathSync(dir2));
586
- } catch {
587
- }
588
- };
589
- let dir = path3.resolve(projectDir);
590
- for (let i = 0; i < 8; i++) {
591
- const candidate = path3.join(dir, "ai-assets");
592
- if (existsSync(candidate)) {
593
- add(candidate);
594
- break;
595
- }
596
- const parent = path3.resolve(dir, "..");
597
- if (parent === dir) break;
598
- dir = parent;
599
- }
600
- try {
601
- for (const source of resolveSkWorkspaceConfig(projectDir).sources ?? []) {
602
- add(path3.join(getGlobalCacheDir(), sourceCacheKey(source.url)));
603
- }
604
- } catch {
605
- }
606
- const projectSources = path3.join(projectDir, ".skaile", "cache", "sources");
607
- try {
608
- for (const entry of readdirSync(projectSources)) add(path3.join(projectSources, entry));
609
- } catch {
610
- }
611
- return [...roots];
612
- }
613
- function normalizeRemote(url) {
614
- return url.trim().replace(/^git@([^:]+):/, "https://$1/").replace(/^[a-z]+:\/\//i, "").replace(/\/+$/, "").replace(/\.git$/i, "").replace(/\/+$/, "").toLowerCase();
615
- }
616
- async function registeredLibraryRoots(origin) {
617
- let index;
618
- try {
619
- index = new LocalIndex();
620
- const libraries = await index.listSources();
621
- const byName = libraries.filter((l) => l.name === origin.name);
622
- const byUrl = byName.length === 0 && origin.url ? libraries.filter((l) => {
623
- const url = l.backendConfig.url;
624
- return typeof url === "string" && normalizeRemote(url) === normalizeRemote(origin.url ?? "");
625
- }) : [];
626
- return [...byName, ...byUrl].map((l) => l.path).filter((dir) => existsSync(dir));
627
- } catch {
628
- return [];
629
- } finally {
630
- index?.close();
631
- }
632
- }
633
- function createCompositionContentSource(opts) {
634
- const registry = opts.registry ?? createDefaultKindRegistry([knowledgeKindProvider]);
635
- const scanner = new CatalogScanner(opts.projectDir, registry, opts.catalogRoots);
636
- return new DefaultCompositionContentSource(
637
- path3.resolve(opts.agentDir),
638
- path3.resolve(opts.projectDir),
639
- registry,
640
- scanner
641
- );
642
- }
643
- var DefaultCompositionContentSource = class _DefaultCompositionContentSource {
644
- constructor(agentDir, projectDir, registry, scanner) {
645
- this.agentDir = agentDir;
646
- this.projectDir = projectDir;
647
- this.registry = registry;
648
- this.scanner = scanner;
649
- }
650
- agentDir;
651
- projectDir;
652
- registry;
653
- scanner;
654
- lockLoaded = false;
655
- lockAssets = {};
656
- scoped(agentDir) {
657
- return new _DefaultCompositionContentSource(
658
- path3.resolve(agentDir),
659
- this.projectDir,
660
- this.registry,
661
- this.scanner
662
- );
663
- }
664
- async load(ref, kind) {
665
- if (ref.startsWith(".") || ref.startsWith("/")) return this.loadLocal(ref, kind);
666
- const parsed = parseCatalogRef(ref);
667
- if (!parsed.name) {
668
- throw new CompositionError(
669
- "composition_asset_missing",
670
- "missing",
671
- `"${ref}" (${kind}): not a resolvable ref`,
672
- ref
673
- );
674
- }
675
- const locked = this.lockCandidate(ref, kind, parsed);
676
- if (locked) return this.loadLocked(ref, kind, locked);
677
- return this.loadFromCatalog(ref, kind, parsed);
678
- }
679
- // ── local ────────────────────────────────────────────────────────────────
680
- async loadLocal(ref, kind) {
681
- const absPath = ref.startsWith("/") ? ref : path3.join(this.agentDir, ref);
682
- let target = absPath;
683
- let resolved = await resolveMixin(ref, kind, this.agentDir, {});
684
- if (!resolved && kind !== "knowledge" && isDirectory(absPath)) {
685
- const manifest = this.manifestInDir(kind, absPath);
686
- if (manifest) {
687
- target = manifest;
688
- resolved = await resolveMixin(manifest, kind, this.agentDir, {});
689
- }
690
- }
691
- if (!resolved) {
692
- throw new CompositionError(
693
- "composition_asset_missing",
694
- "missing",
695
- `"${ref}" (${kind}): no content at ${absPath}`,
696
- ref
697
- );
698
- }
699
- return {
700
- canonicalRef: `local:${this.relativeToProject(target)}`,
701
- kind,
702
- version: null,
703
- sha256: sha256Of(resolved.content),
704
- content: resolved.content,
705
- location: resolved.source
706
- };
707
- }
708
- manifestInDir(kind, dir) {
709
- const provider = this.registry.getProvider(kind);
710
- for (const name of readdirSync(dir).sort()) {
711
- const matches = provider ? provider.matchesPath(name) : name === `${kind.toUpperCase()}.md`;
712
- if (matches && statSync(path3.join(dir, name)).isFile()) return path3.join(dir, name);
713
- }
714
- return void 0;
715
- }
716
- relativeToProject(abs) {
717
- const rel = path3.relative(this.projectDir, abs).split(path3.sep).join("/");
718
- return rel.startsWith("..") ? abs : rel;
719
- }
720
- // ── lock pin ─────────────────────────────────────────────────────────────
721
- lockCandidate(ref, kind, parsed) {
722
- if (!this.lockLoaded) {
723
- this.lockLoaded = true;
724
- try {
725
- this.lockAssets = readLock(path3.join(this.projectDir, "skaile.lock.yaml"))?.assets ?? {};
726
- } catch (err) {
727
- throw new CompositionError(
728
- "composition_conflict",
729
- "stale_manifest",
730
- `skaile.lock.yaml is unreadable: ${err instanceof Error ? err.message : String(err)}`,
731
- ref
732
- );
733
- }
734
- }
735
- const matches = [];
736
- for (const [key, entry] of Object.entries(this.lockAssets)) {
737
- const m = LOCK_KEY_RE.exec(key);
738
- if (!m || m[1] !== kind || m[3] !== parsed.name) continue;
739
- if (parsed.publisher && barePublisher(parsed.publisher) !== m[2]) continue;
740
- if (parsed.pin && !matchPin(parsed.pin, m[4])) continue;
741
- matches.push({ key, publisher: m[2], name: m[3], version: m[4], entry });
742
- }
743
- if (matches.length > 1) {
744
- throw new CompositionError(
745
- "composition_conflict",
746
- "ambiguous",
747
- `"${ref}" (${kind}): skaile.lock.yaml pins ${matches.length} matching assets (${matches.map((x) => x.key).join(", ")}) \u2014 qualify the ref with a publisher and version`,
748
- ref
749
- );
750
- }
751
- return matches[0] ?? null;
752
- }
753
- async loadLocked(ref, kind, pin) {
754
- const { entry } = pin;
755
- const storeDir = path3.join(
756
- this.projectDir,
757
- ".skaile",
758
- "cache",
759
- "store",
760
- pin.publisher,
761
- kind,
762
- pin.name,
763
- pin.version
764
- );
765
- const prefix = commonDirPrefix(entry.files.map((f) => f.path));
766
- const strip = (p) => prefix && p.startsWith(`${prefix}/`) ? p.slice(prefix.length + 1) : p;
767
- if (isDirectory(storeDir) && entry.files.length > 0) {
768
- await this.verifyFiles(ref, pin.key, entry, (p) => path3.join(storeDir, strip(p)));
769
- const primary = this.primaryOf(
770
- kind,
771
- entry.files.map((f) => f.path)
772
- );
773
- return this.readAsset(
774
- kind,
775
- pin.key,
776
- pin.version,
777
- path3.join(storeDir, strip(primary)),
778
- storeDir
779
- );
780
- }
781
- const holdsPin = (h) => h.asset.version === pin.version && barePublisher(h.asset.publisher) === pin.publisher;
782
- let hit = this.scanner.find(kind, pin.name).find(holdsPin);
783
- if (!hit && entry.library) {
784
- for (const root of await registeredLibraryRoots(entry.library)) {
785
- hit = this.scanner.findIn(root, kind, pin.name).find(holdsPin);
786
- if (hit) break;
787
- }
788
- }
789
- if (!hit) {
790
- let moved;
791
- if (entry.library) {
792
- for (const root of await registeredLibraryRoots(entry.library)) {
793
- const other = this.scanner.findIn(root, kind, pin.name).find((h) => barePublisher(h.asset.publisher) === pin.publisher);
794
- if (other?.asset.version) {
795
- moved = {
796
- key: pin.key,
797
- library: entry.library.name,
798
- libraryVersion: other.asset.version,
799
- lockedVersion: pin.version
800
- };
801
- break;
802
- }
803
- }
804
- }
805
- throw new CompositionError(
806
- "composition_asset_missing",
807
- "missing",
808
- moved ? `"${ref}" (${kind}): skaile.lock.yaml pins ${pin.key} but library "${moved.library}" is at ${moved.libraryVersion} \u2014 run \`skaile update\` to move the lock to it` : `"${ref}" (${kind}): skaile.lock.yaml pins ${pin.key} but no bytes for it are on disk \u2014 run \`skaile install\``,
809
- ref,
810
- moved
811
- );
812
- }
813
- const assetRoot = hit.asset.fileFilter.assetRoot;
814
- if (entry.files.length > 0) {
815
- await this.verifyFiles(ref, pin.key, entry, (p) => path3.join(assetRoot, strip(p)));
816
- } else if (entry.library?.sha256 && entry.library.sha256 !== hit.asset.sha256) {
817
- throw new CompositionError(
818
- "composition_conflict",
819
- "hash_mismatch",
820
- `"${ref}" (${kind}): ${pin.key} was locked from a library at ${entry.library.sha256.slice(0, 12)}\u2026 but the catalog now holds ${hit.asset.sha256.slice(0, 12)}\u2026`,
821
- ref
822
- );
823
- }
824
- return this.readAsset(kind, pin.key, pin.version, hit.asset.manifestPath, assetRoot);
825
- }
826
- async verifyFiles(ref, key, entry, locate) {
827
- for (const file of entry.files) {
828
- const abs = locate(file.path);
829
- let bytes;
830
- try {
831
- bytes = await fs8.readFile(abs);
832
- } catch {
833
- throw new CompositionError(
834
- "composition_asset_missing",
835
- "missing",
836
- `"${ref}": ${key} lists ${file.path} but ${abs} is missing \u2014 run \`skaile install\``,
837
- ref
838
- );
839
- }
840
- const actual = sha256Of(bytes);
841
- if (actual !== file.sha256) {
842
- throw new CompositionError(
843
- "composition_conflict",
844
- "hash_mismatch",
845
- `"${ref}": ${file.path} of ${key} is ${actual.slice(0, 12)}\u2026 on disk but skaile.lock.yaml pins ${file.sha256.slice(0, 12)}\u2026 \u2014 run \`skaile install\` to restore it`,
846
- ref
847
- );
848
- }
849
- }
850
- }
851
- primaryOf(kind, paths) {
852
- const provider = this.registry.getProvider(kind);
853
- const hit = provider ? paths.find((p) => provider.matchesPath(p)) : void 0;
854
- return hit ?? paths[0] ?? "";
855
- }
856
- // ── catalog ──────────────────────────────────────────────────────────────
857
- async loadFromCatalog(ref, kind, parsed) {
858
- const wantPublisher = parsed.publisher ? barePublisher(parsed.publisher) : void 0;
859
- const candidates = this.scanner.find(kind, parsed.name).filter((h) => !wantPublisher || barePublisher(h.asset.publisher) === wantPublisher).filter((h) => matchPin(parsed.pin, h.asset.version));
860
- const distinct = /* @__PURE__ */ new Map();
861
- for (const c of candidates) {
862
- distinct.set(`${c.asset.publisher}/${c.asset.name}#${c.asset.version}:${c.asset.sha256}`, c);
863
- }
864
- if (distinct.size === 0) {
865
- throw new CompositionError(
866
- "composition_asset_missing",
867
- "missing",
868
- `"${ref}" (${kind}): not in skaile.lock.yaml and not found in the local catalog`,
869
- ref
870
- );
871
- }
872
- if (distinct.size > 1) {
873
- throw new CompositionError(
874
- "composition_conflict",
875
- "ambiguous",
876
- `"${ref}" (${kind}): ${distinct.size} catalog assets match (${[...distinct.values()].map((c) => `@${barePublisher(c.asset.publisher)}/${c.asset.name}#${c.asset.version}`).join(", ")}) \u2014 qualify the ref with a publisher and version`,
877
- ref
878
- );
879
- }
880
- const { asset } = [...distinct.values()][0];
881
- const canonical2 = `${kind}:@${barePublisher(asset.publisher)}/${asset.name}#${asset.version}`;
882
- return this.readAsset(
883
- kind,
884
- canonical2,
885
- asset.version,
886
- asset.manifestPath,
887
- asset.fileFilter.assetRoot
888
- );
889
- }
890
- // ── shared read ──────────────────────────────────────────────────────────
891
- async readAsset(kind, canonicalRef, version, primaryPath, assetRoot) {
892
- let content;
893
- let location = primaryPath;
894
- if (kind === "knowledge") {
895
- const dir = path3.basename(primaryPath) === "knowledge.yaml" ? path3.dirname(primaryPath) : assetRoot;
896
- const loaded = await loadKnowledgeDir(dir);
897
- if (!loaded) {
898
- throw new CompositionError(
899
- "composition_asset_missing",
900
- "missing",
901
- `"${canonicalRef}": knowledge directory ${dir} holds no documents`,
902
- canonicalRef
903
- );
904
- }
905
- content = loaded.content;
906
- location = dir;
907
- } else {
908
- let raw;
909
- try {
910
- raw = await fs8.readFile(primaryPath, "utf-8");
911
- } catch {
912
- throw new CompositionError(
913
- "composition_asset_missing",
914
- "missing",
915
- `"${canonicalRef}": ${primaryPath} is not readable`,
916
- canonicalRef
917
- );
918
- }
919
- content = stripFrontmatter(raw).trim();
920
- }
921
- return { canonicalRef, kind, version, sha256: sha256Of(content), content, location };
922
- }
923
- };
924
- function isDirectory(p) {
925
- try {
926
- return statSync(p).isDirectory();
927
- } catch {
928
- return false;
929
- }
930
- }
931
- function commonDirPrefix(paths) {
932
- if (paths.length === 0) return "";
933
- const split = paths.map((p) => p.split("/").slice(0, -1));
934
- const first = split[0];
935
- let n = first.length;
936
- for (const parts of split) {
937
- let i = 0;
938
- while (i < n && i < parts.length && parts[i] === first[i]) i++;
939
- n = i;
940
- }
941
- return first.slice(0, n).join("/");
942
- }
943
- function hashContent(content) {
944
- return sha256Of(content);
945
- }
946
-
947
- // runner/src/composition/types.ts
948
- var KIND_BINDING_DEFAULTS = {
949
- soul: "inline-snapshot",
950
- persona: "inline-snapshot",
951
- ruleset: "inline-live",
952
- skill: "discoverable",
953
- knowledge: "discoverable",
954
- connector: "discoverable",
955
- prompt: "inline-live",
956
- flow: "discoverable",
957
- "mcp-server": "discoverable",
958
- contract: "inline-live",
959
- agent: "delegate"
960
- };
961
- var UnknownCompositionKindError = class extends Error {
962
- constructor(kind, ref) {
963
- super(`composes item "${ref}" has unknown asset kind "${kind}" and no explicit binding`);
964
- this.kind = kind;
965
- this.ref = ref;
966
- this.name = "UnknownCompositionKindError";
967
- }
968
- kind;
969
- ref;
970
- code = "unknown_asset_kind";
971
- };
972
- function resolveBinding(item) {
973
- if (item.binding) return item.binding;
974
- if (!Object.hasOwn(KIND_BINDING_DEFAULTS, item.kind)) {
975
- throw new UnknownCompositionKindError(item.kind, item.ref);
976
- }
977
- return KIND_BINDING_DEFAULTS[item.kind];
978
- }
979
-
980
- // runner/src/composition/compile.ts
981
- var COMPILE_MANIFEST_FILENAME = "compile_manifest.json";
982
- var CompileManifestEntrySchema = z5.object({
983
- asset_ref: z5.string().min(1),
984
- kind: z5.string().min(1),
985
- resolved_ref: z5.string().min(1),
986
- version: z5.string().nullable(),
987
- hash: z5.string().regex(/^[0-9a-f]{64}$/),
988
- binding: BindingSchema,
989
- resolved_at: z5.string(),
990
- content: z5.string()
991
- });
992
- var CompileManifestSchema = z5.object({
993
- schema_version: z5.literal(2),
994
- prompt_version: z5.number().int().nonnegative(),
995
- compiled_at: z5.string(),
996
- entries: z5.array(CompileManifestEntrySchema)
997
- });
998
- var StaleSchemaMarker = z5.object({ schema_version: z5.literal(1) });
999
- var NestedAgentComposes = z5.object({ composes: z5.array(z5.unknown()) });
1000
- var NestedAgentItem = z5.object({ kind: z5.literal("agent"), ref: z5.string() });
1001
- async function compileComposition(opts) {
1002
- const { agentDir, items, source } = opts;
1003
- const manifestPath = path3.join(agentDir, COMPILE_MANIFEST_FILENAME);
1004
- const nextVersion = await readPromptVersion(manifestPath) + 1;
1005
- const loaded = /* @__PURE__ */ new Map();
1006
- const entries = [];
1007
- const resolvedAt = (/* @__PURE__ */ new Date()).toISOString();
1008
- for (const item of items) {
1009
- const binding = resolveBinding(item);
1010
- const cacheKey = `${item.kind}\0${item.ref}`;
1011
- let asset = loaded.get(cacheKey);
1012
- if (!asset) {
1013
- asset = await source.load(item.ref, item.kind);
1014
- loaded.set(cacheKey, asset);
1015
- }
1016
- entries.push({
1017
- asset_ref: item.ref,
1018
- kind: item.kind,
1019
- resolved_ref: asset.canonicalRef,
1020
- version: asset.version,
1021
- hash: asset.sha256,
1022
- binding,
1023
- resolved_at: resolvedAt,
1024
- content: asset.content
1025
- });
1026
- }
1027
- await assertAcyclicSubagents(agentDir, items, source);
1028
- const manifest = {
1029
- schema_version: 2,
1030
- prompt_version: nextVersion,
1031
- entries,
1032
- compiled_at: (/* @__PURE__ */ new Date()).toISOString()
1033
- };
1034
- const tmpPath = `${manifestPath}.tmp`;
1035
- await fs8.writeFile(tmpPath, `${JSON.stringify(manifest, null, 2)}
1036
- `, "utf-8");
1037
- await fs8.rename(tmpPath, manifestPath);
1038
- return { manifest, manifestPath, resolvedCount: entries.length };
1039
- }
1040
- async function isCompilePinCurrent(opts) {
1041
- let pinned;
1042
- try {
1043
- pinned = await loadCompileManifestFromDir(opts.agentDir);
1044
- } catch {
1045
- return false;
1046
- }
1047
- if (!pinned || pinned.entries.length !== opts.items.length) return false;
1048
- for (const [i, item] of opts.items.entries()) {
1049
- const entry = pinned.entries[i];
1050
- if (entry.asset_ref !== item.ref || entry.kind !== item.kind) return false;
1051
- if (entry.binding !== resolveBinding(item)) return false;
1052
- const asset = await opts.source.load(item.ref, item.kind);
1053
- if (asset.sha256 !== entry.hash) return false;
1054
- }
1055
- return true;
1056
- }
1057
- async function loadCompileManifest(manifestPath) {
1058
- let raw;
1059
- try {
1060
- raw = await fs8.readFile(manifestPath, "utf-8");
1061
- } catch {
1062
- return void 0;
1063
- }
1064
- let json;
1065
- try {
1066
- json = JSON.parse(raw);
1067
- } catch {
1068
- throw new CompositionError(
1069
- "composition_rebuild_required",
1070
- "stale_manifest",
1071
- `${manifestPath} is not valid JSON \u2014 run \`skaile rebuild\``
1072
- );
1073
- }
1074
- if (StaleSchemaMarker.safeParse(json).success) {
1075
- throw new CompositionError(
1076
- "composition_rebuild_required",
1077
- "stale_manifest",
1078
- `${manifestPath} is a schema-1 compile manifest (hashes only, no captured content) \u2014 run \`skaile rebuild\``
1079
- );
1080
- }
1081
- const parsed = CompileManifestSchema.safeParse(json);
1082
- if (!parsed.success) {
1083
- throw new CompositionError(
1084
- "composition_rebuild_required",
1085
- "stale_manifest",
1086
- `${manifestPath} is malformed (${parsed.error.issues[0]?.path.join(".") || "root"}: ${parsed.error.issues[0]?.message}) \u2014 run \`skaile rebuild\``
1087
- );
1088
- }
1089
- for (const entry of parsed.data.entries) {
1090
- const actual = hashContent(entry.content);
1091
- if (actual !== entry.hash) {
1092
- throw new CompositionError(
1093
- "composition_conflict",
1094
- "hash_mismatch",
1095
- `${manifestPath}: captured content of "${entry.asset_ref}" (${entry.kind}) hashes to ${actual.slice(0, 12)}\u2026 but the manifest records ${entry.hash.slice(0, 12)}\u2026 \u2014 the file was edited; run \`skaile rebuild\``,
1096
- entry.asset_ref
1097
- );
1098
- }
1099
- }
1100
- return parsed.data;
1101
- }
1102
- async function loadCompileManifestFromDir(agentDir) {
1103
- return loadCompileManifest(path3.join(agentDir, COMPILE_MANIFEST_FILENAME));
1104
- }
1105
- async function readPromptVersion(manifestPath) {
1106
- try {
1107
- const parsed = JSON.parse(await fs8.readFile(manifestPath, "utf-8"));
1108
- return typeof parsed?.prompt_version === "number" ? parsed.prompt_version : 0;
1109
- } catch {
1110
- return 0;
1111
- }
1112
- }
1113
- var identityOf = (file) => {
1114
- try {
1115
- return realpathSync(file);
1116
- } catch {
1117
- return file;
1118
- }
1119
- };
1120
- async function assertAcyclicSubagents(agentDir, items, source) {
1121
- const manifestFile = path3.join(agentDir, "agent.yaml");
1122
- const root = existsSync(manifestFile) ? identityOf(manifestFile) : identityOf(agentDir);
1123
- const visit = async (children, src, chain) => {
1124
- for (const item of children) {
1125
- if (item.kind !== "agent") continue;
1126
- const asset = await src.load(item.ref, "agent");
1127
- const identity = asset.location ? identityOf(asset.location) : asset.canonicalRef;
1128
- if (chain.includes(identity)) {
1129
- throw new CompositionError(
1130
- "composition_conflict",
1131
- "cycle",
1132
- `"${item.ref}" (agent): sub-agent composition loops (${[...chain, identity].map((p) => path3.basename(path3.dirname(p)) || p).join(" \u2192 ")})`,
1133
- item.ref
1134
- );
1135
- }
1136
- const nested = NestedAgentComposes.safeParse(parseYamlSafe(asset.content));
1137
- if (!nested.success || !asset.location) continue;
1138
- const subagents = nested.data.composes.flatMap((c) => {
1139
- const parsedItem = NestedAgentItem.safeParse(c);
1140
- return parsedItem.success ? [parsedItem.data] : [];
1141
- });
1142
- if (subagents.length === 0) continue;
1143
- await visit(subagents, src.scoped(path3.dirname(asset.location)), [...chain, identity]);
1144
- }
1145
- };
1146
- await visit(items, source, [root]);
1147
- }
1148
- function parseYamlSafe(text2) {
1149
- try {
1150
- return parse(text2);
1151
- } catch {
1152
- return null;
1153
- }
1154
- }
1155
-
1156
392
  // runner/src/composition/resolve.ts
1157
393
  async function resolveComposition(opts) {
1158
394
  const { items, library, source, compileManifest, runSnapshot, implicit, lockPinned } = opts;
@@ -1341,18 +577,18 @@ async function hashAgentFiles(agentDir) {
1341
577
  const walk = async (dir, prefix) => {
1342
578
  let entries;
1343
579
  try {
1344
- entries = await fs8.readdir(dir, { withFileTypes: true });
580
+ entries = await fs5.readdir(dir, { withFileTypes: true });
1345
581
  } catch {
1346
582
  return;
1347
583
  }
1348
584
  for (const entry of entries) {
1349
585
  if (entry.name.startsWith(".") || SKIPPED_NAMES.has(entry.name)) continue;
1350
586
  const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
1351
- const abs = path3.join(dir, entry.name);
587
+ const abs = path4.join(dir, entry.name);
1352
588
  if (entry.isDirectory()) {
1353
589
  await walk(abs, rel);
1354
590
  } else if (entry.isFile()) {
1355
- const bytes = await fs8.readFile(abs);
591
+ const bytes = await fs5.readFile(abs);
1356
592
  out.push({ path: rel, sha256: createHash("sha256").update(bytes).digest("hex") });
1357
593
  }
1358
594
  }
@@ -1360,23 +596,23 @@ async function hashAgentFiles(agentDir) {
1360
596
  await walk(agentDir, "");
1361
597
  return out.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
1362
598
  }
1363
- var RunSnapshotSchema = z5.object({
1364
- schema_version: z5.literal(1),
1365
- session_id: z5.string().min(1),
1366
- captured_at: z5.string(),
1367
- prompt_version: z5.number().int().nonnegative().nullable(),
1368
- items: z5.array(CompileManifestEntrySchema)
599
+ var RunSnapshotSchema = z4.object({
600
+ schema_version: z4.literal(1),
601
+ session_id: z4.string().min(1),
602
+ captured_at: z4.string(),
603
+ prompt_version: z4.number().int().nonnegative().nullable(),
604
+ items: z4.array(CompileManifestEntrySchema)
1369
605
  });
1370
- var RUN_SNAPSHOT_DIR = path3.join(".skaile", "composition-runs");
606
+ var RUN_SNAPSHOT_DIR = path4.join(".skaile", "composition-runs");
1371
607
  var safeFileName = (sessionId) => `${sessionId.replace(/[^\w.-]/g, "_")}.json`;
1372
608
  function compositionRunSnapshotPath(projectDir, sessionId) {
1373
- return path3.join(projectDir, RUN_SNAPSHOT_DIR, safeFileName(sessionId));
609
+ return path4.join(projectDir, RUN_SNAPSHOT_DIR, safeFileName(sessionId));
1374
610
  }
1375
611
  async function loadCompositionRunSnapshot(projectDir, sessionId) {
1376
612
  const file = compositionRunSnapshotPath(projectDir, sessionId);
1377
613
  let raw;
1378
614
  try {
1379
- raw = await fs8.readFile(file, "utf-8");
615
+ raw = await fs5.readFile(file, "utf-8");
1380
616
  } catch {
1381
617
  return void 0;
1382
618
  }
@@ -1432,27 +668,27 @@ function buildCompositionRunSnapshot(sessionId, items, promptVersion) {
1432
668
  }
1433
669
  var MAX_RUN_SNAPSHOTS = 20;
1434
670
  async function pruneRunSnapshots(projectDir, except, keep) {
1435
- const dir = path3.join(projectDir, RUN_SNAPSHOT_DIR);
671
+ const dir = path4.join(projectDir, RUN_SNAPSHOT_DIR);
1436
672
  try {
1437
- const names = (await fs8.readdir(dir)).filter((n) => n.endsWith(".json"));
673
+ const names = (await fs5.readdir(dir)).filter((n) => n.endsWith(".json"));
1438
674
  const dated = await Promise.all(
1439
675
  names.map(async (name) => ({
1440
- file: path3.join(dir, name),
1441
- mtime: (await fs8.stat(path3.join(dir, name))).mtimeMs
676
+ file: path4.join(dir, name),
677
+ mtime: (await fs5.stat(path4.join(dir, name))).mtimeMs
1442
678
  }))
1443
679
  );
1444
680
  const stale = dated.filter((d) => d.file !== except).sort((a, b) => b.mtime - a.mtime).slice(Math.max(keep - 1, 0));
1445
- await Promise.all(stale.map((d) => fs8.rm(d.file, { force: true })));
681
+ await Promise.all(stale.map((d) => fs5.rm(d.file, { force: true })));
1446
682
  } catch {
1447
683
  }
1448
684
  }
1449
685
  async function saveCompositionRunSnapshot(projectDir, snapshot) {
1450
686
  const file = compositionRunSnapshotPath(projectDir, snapshot.session_id);
1451
- await fs8.mkdir(path3.dirname(file), { recursive: true });
687
+ await fs5.mkdir(path4.dirname(file), { recursive: true });
1452
688
  const tmp = `${file}.tmp`;
1453
- await fs8.writeFile(tmp, `${JSON.stringify(snapshot, null, 2)}
689
+ await fs5.writeFile(tmp, `${JSON.stringify(snapshot, null, 2)}
1454
690
  `, "utf-8");
1455
- await fs8.rename(tmp, file);
691
+ await fs5.rename(tmp, file);
1456
692
  ensureRunStateIgnored(projectDir);
1457
693
  await pruneRunSnapshots(projectDir, file, MAX_RUN_SNAPSHOTS);
1458
694
  }
@@ -1463,11 +699,11 @@ function isLockPinnedAgentDir(projectDir, agentDir) {
1463
699
  try {
1464
700
  return realpathSync(p);
1465
701
  } catch {
1466
- return path3.resolve(p);
702
+ return path4.resolve(p);
1467
703
  }
1468
704
  };
1469
705
  const dir = real(agentDir);
1470
- return [agentSourceCacheDir(projectDir), path3.join(projectDir, ".skaile", "assets", "agent")].map(real).some((root) => dir === root || dir.startsWith(root + path3.sep));
706
+ return [agentSourceCacheDir(projectDir), path4.join(projectDir, ".skaile", "assets", "agent")].map(real).some((root) => dir === root || dir.startsWith(root + path4.sep));
1471
707
  }
1472
708
  function instanceForSession(config, instanceId, agentDir) {
1473
709
  const id = instanceId ?? DEFAULT_AGENT_INSTANCE_ID;
@@ -1498,8 +734,8 @@ function resolveInstanceAgentDir(projectDir, config, instanceId) {
1498
734
  if (!(error instanceof AgentRefResolutionError)) throw error;
1499
735
  throw new Error(`Agent instance "${instanceId}": ${error.message}`);
1500
736
  }
1501
- if (dir && path3.basename(dir) === "agent.yaml") dir = path3.dirname(dir);
1502
- if (!dir || !existsSync(path3.join(dir, "agent.yaml"))) {
737
+ if (dir && path4.basename(dir) === "agent.yaml") dir = path4.dirname(dir);
738
+ if (!dir || !existsSync(path4.join(dir, "agent.yaml"))) {
1503
739
  throw new Error(
1504
740
  `Agent instance "${instanceId}": "${instance.ref}" does not resolve to an agent directory with agent.yaml${dir ? ` (looked in ${dir})` : ""}`
1505
741
  );
@@ -1698,7 +934,7 @@ async function resolveMemoryBlocks(manifest, agentDir, scopeOverride, resolvedIt
1698
934
  seed = pinned.content;
1699
935
  } else {
1700
936
  try {
1701
- seed = (await fs8.readFile(path3.join(agentDir, block.source), "utf-8")).trim();
937
+ seed = (await fs5.readFile(path4.join(agentDir, block.source), "utf-8")).trim();
1702
938
  } catch {
1703
939
  warnings.push(`memory block "${block.name}": source "${block.source}" not found`);
1704
940
  }
@@ -1754,17 +990,17 @@ function checkCapabilities(manifest, items, slots, content, host, dryRun, warnin
1754
990
  }
1755
991
  async function agentDefinitionExists(agentDir) {
1756
992
  try {
1757
- await fs8.access(path3.join(agentDir, "agent.yaml"));
993
+ await fs5.access(path4.join(agentDir, "agent.yaml"));
1758
994
  return true;
1759
995
  } catch {
1760
996
  return false;
1761
997
  }
1762
998
  }
1763
999
  async function loadAgentManifest(agentDir) {
1764
- const agentYamlPath = path3.join(agentDir, "agent.yaml");
1000
+ const agentYamlPath = path4.join(agentDir, "agent.yaml");
1765
1001
  let content;
1766
1002
  try {
1767
- content = await fs8.readFile(agentYamlPath, "utf-8");
1003
+ content = await fs5.readFile(agentYamlPath, "utf-8");
1768
1004
  } catch {
1769
1005
  return void 0;
1770
1006
  }
@@ -1856,15 +1092,15 @@ async function loadAgentRunTargets(opts) {
1856
1092
  );
1857
1093
  continue;
1858
1094
  }
1859
- const isLocal = sub.ref.startsWith("./") || sub.ref.startsWith("../") || path3.isAbsolute(sub.ref);
1860
- const dir = isLocal ? path3.resolve(opts.current.agentDir, sub.ref) : workspaceDir(opts.projectDir, sub.ref);
1095
+ const isLocal = sub.ref.startsWith("./") || sub.ref.startsWith("../") || path4.isAbsolute(sub.ref);
1096
+ const dir = isLocal ? path4.resolve(opts.current.agentDir, sub.ref) : workspaceDir(opts.projectDir, sub.ref);
1861
1097
  targets.push(
1862
1098
  await resolveTarget(
1863
1099
  opts,
1864
1100
  sub.as,
1865
1101
  { ref: sub.ref, lifecycle: "role" },
1866
1102
  "composed",
1867
- dir && path3.basename(dir) === "agent.yaml" ? path3.dirname(dir) : dir,
1103
+ dir && path4.basename(dir) === "agent.yaml" ? path4.dirname(dir) : dir,
1868
1104
  sub.ref
1869
1105
  )
1870
1106
  );
@@ -1965,9 +1201,9 @@ function asReply(value, what) {
1965
1201
  }
1966
1202
  return failure("host_error", `the host answered ${what} with an unexpected payload`);
1967
1203
  }
1968
- var budgetSchema = z5.object({
1969
- max_turns: z5.number().int().positive().optional(),
1970
- max_tokens: z5.number().int().positive().optional()
1204
+ var budgetSchema = z4.object({
1205
+ max_turns: z4.number().int().positive().optional(),
1206
+ max_tokens: z4.number().int().positive().optional()
1971
1207
  }).describe("Optional limits for this run; the instance's own limits still apply.");
1972
1208
  function registerAgentSurface(deps) {
1973
1209
  const { registry, hosts, targets } = deps;
@@ -2032,7 +1268,7 @@ function registerAgentSurface(deps) {
2032
1268
  defineCapability({
2033
1269
  name: "agent.list",
2034
1270
  description: "List the agent instances of this workspace: id, lifecycle (standing identity or role), description, whether the instance takes typed input / returns typed output, and whether it can be started.",
2035
- input: z5.object({}),
1271
+ input: z4.object({}),
2036
1272
  side: "agent",
2037
1273
  origin: ORIGIN,
2038
1274
  scope: "session",
@@ -2042,12 +1278,12 @@ function registerAgentSurface(deps) {
2042
1278
  defineCapability({
2043
1279
  name: "agent.run",
2044
1280
  description: "Run an agent instance of this workspace with the given input. A role takes the input its `io.input` schema describes and returns output matching `io.output`. `mode: sync` (default) waits for the run; `mode: async` returns the runId at once - poll `agent.status` or fetch `agent.result`. A run of an instance that needs approval returns `waiting_approval` and an approvalId.",
2045
- input: z5.object({
2046
- instance: z5.string().min(1).describe("Instance id from `agent.list`."),
2047
- input: z5.unknown().optional().describe(
1281
+ input: z4.object({
1282
+ instance: z4.string().min(1).describe("Instance id from `agent.list`."),
1283
+ input: z4.unknown().optional().describe(
2048
1284
  "Input for the run; must match the role's `io.input`. Pass the value itself (e.g. an object), not its JSON text."
2049
1285
  ),
2050
- mode: z5.enum(["sync", "async"]).optional(),
1286
+ mode: z4.enum(["sync", "async"]).optional(),
2051
1287
  budget: budgetSchema.optional()
2052
1288
  }),
2053
1289
  side: "agent",
@@ -2127,7 +1363,7 @@ function registerAgentSurface(deps) {
2127
1363
  defineCapability({
2128
1364
  name: "agent.status",
2129
1365
  description: "Status of a run started with `agent.run`.",
2130
- input: z5.object({ runId: z5.string().min(1) }),
1366
+ input: z4.object({ runId: z4.string().min(1) }),
2131
1367
  side: "agent",
2132
1368
  origin: ORIGIN,
2133
1369
  scope: "session",
@@ -2137,7 +1373,7 @@ function registerAgentSurface(deps) {
2137
1373
  defineCapability({
2138
1374
  name: "agent.cancel",
2139
1375
  description: "Cancel a run started with `agent.run`; runs it started are cancelled too.",
2140
- input: z5.object({ runId: z5.string().min(1) }),
1376
+ input: z4.object({ runId: z4.string().min(1) }),
2141
1377
  side: "agent",
2142
1378
  origin: ORIGIN,
2143
1379
  scope: "session",
@@ -2147,7 +1383,7 @@ function registerAgentSurface(deps) {
2147
1383
  defineCapability({
2148
1384
  name: "agent.result",
2149
1385
  description: "The result of a run: its output once it succeeded (matching the role's `io.output`), or why it failed. `wait: true` waits for a running run to end.",
2150
- input: z5.object({ runId: z5.string().min(1), wait: z5.boolean().optional() }),
1386
+ input: z4.object({ runId: z4.string().min(1), wait: z4.boolean().optional() }),
2151
1387
  side: "agent",
2152
1388
  origin: ORIGIN,
2153
1389
  scope: "session",
@@ -2166,7 +1402,7 @@ function registerAgentSurface(deps) {
2166
1402
  name: "approval.decide",
2167
1403
  displayName: "Decide a run approval",
2168
1404
  description: "Approve or deny the one operation a run is waiting on (`waiting_approval`). Invoked by the user, never by the model.",
2169
- input: z5.object({ approvalId: z5.string().min(1), decision: z5.enum(["approve", "deny"]) }),
1405
+ input: z4.object({ approvalId: z4.string().min(1), decision: z4.enum(["approve", "deny"]) }),
2170
1406
  side: "agent",
2171
1407
  origin: ORIGIN,
2172
1408
  scope: "session",
@@ -2226,7 +1462,7 @@ function registerAgentSurface(deps) {
2226
1462
  defineCapability({
2227
1463
  name: "memory.read",
2228
1464
  description: "Read a memory block of this agent (its current stored content).",
2229
- input: z5.object({ block: z5.string().min(1) }),
1465
+ input: z4.object({ block: z4.string().min(1) }),
2230
1466
  side: "agent",
2231
1467
  origin: ORIGIN,
2232
1468
  scope: "session",
@@ -2240,7 +1476,7 @@ function registerAgentSurface(deps) {
2240
1476
  defineCapability({
2241
1477
  name: "memory.write",
2242
1478
  description: "Replace the content of a memory block. The host enforces the block's size cap.",
2243
- input: z5.object({ block: z5.string().min(1), content: z5.string() }),
1479
+ input: z4.object({ block: z4.string().min(1), content: z4.string() }),
2244
1480
  side: "agent",
2245
1481
  origin: ORIGIN,
2246
1482
  scope: "session",
@@ -2261,7 +1497,7 @@ function registerAgentSurface(deps) {
2261
1497
  defineCapability({
2262
1498
  name: "memory.append",
2263
1499
  description: "Append text to a memory block. The host enforces the block's size cap.",
2264
- input: z5.object({ block: z5.string().min(1), content: z5.string() }),
1500
+ input: z4.object({ block: z4.string().min(1), content: z4.string() }),
2265
1501
  side: "agent",
2266
1502
  origin: ORIGIN,
2267
1503
  scope: "session",
@@ -2282,7 +1518,7 @@ function registerAgentSurface(deps) {
2282
1518
  defineCapability({
2283
1519
  name: "memory.list",
2284
1520
  description: "List the memory blocks of this agent with scope, size cap and current size.",
2285
- input: z5.object({}),
1521
+ input: z4.object({}),
2286
1522
  side: "agent",
2287
1523
  origin: ORIGIN,
2288
1524
  scope: "session",
@@ -2318,12 +1554,12 @@ function registerAgentSurface(deps) {
2318
1554
  );
2319
1555
  return typeof reply === "object" && reply !== null ? reply : failure("host_error", "the host answered trigger with an unexpected payload");
2320
1556
  };
2321
- const triggerId = z5.string().regex(/^[a-z][a-z0-9_-]*$/, "trigger id must match [a-z][a-z0-9_-]*");
1557
+ const triggerId = z4.string().regex(/^[a-z][a-z0-9_-]*$/, "trigger id must match [a-z][a-z0-9_-]*");
2322
1558
  caps.push(
2323
1559
  defineCapability({
2324
1560
  name: "trigger.list",
2325
1561
  description: "List the triggers of this agent (schedules, webhooks, channel and event triggers) with their source (`asset`, `workspace` or `runtime`) and whether they are enabled.",
2326
- input: z5.object({}),
1562
+ input: z4.object({}),
2327
1563
  side: "agent",
2328
1564
  origin: ORIGIN,
2329
1565
  scope: "session",
@@ -2333,15 +1569,15 @@ function registerAgentSurface(deps) {
2333
1569
  defineCapability({
2334
1570
  name: "trigger.upsert",
2335
1571
  description: "Create or update a runtime trigger of this agent. A `schedule` needs `cron`; the trigger's `prompt` is what the agent is asked when it fires. The user approves the change.",
2336
- input: z5.object({
1572
+ input: z4.object({
2337
1573
  id: triggerId,
2338
- kind: z5.enum(["schedule", "webhook", "channel", "event"]),
2339
- cron: z5.string().min(1).optional(),
2340
- prompt: z5.string().min(1).optional(),
2341
- timezone: z5.string().min(1).optional(),
2342
- when: z5.string().min(1).optional(),
2343
- event: z5.string().min(1).optional(),
2344
- enabled: z5.boolean().optional()
1574
+ kind: z4.enum(["schedule", "webhook", "channel", "event"]),
1575
+ cron: z4.string().min(1).optional(),
1576
+ prompt: z4.string().min(1).optional(),
1577
+ timezone: z4.string().min(1).optional(),
1578
+ when: z4.string().min(1).optional(),
1579
+ event: z4.string().min(1).optional(),
1580
+ enabled: z4.boolean().optional()
2345
1581
  }),
2346
1582
  side: "agent",
2347
1583
  origin: ORIGIN,
@@ -2369,7 +1605,7 @@ function registerAgentSurface(deps) {
2369
1605
  defineCapability({
2370
1606
  name: "trigger.toggle",
2371
1607
  description: "Enable or disable a trigger of this agent. The user approves the change.",
2372
- input: z5.object({ id: triggerId, enabled: z5.boolean() }),
1608
+ input: z4.object({ id: triggerId, enabled: z4.boolean() }),
2373
1609
  side: "agent",
2374
1610
  origin: ORIGIN,
2375
1611
  scope: "session",
@@ -2410,10 +1646,10 @@ function keywordSearch(capabilities, query, limit) {
2410
1646
  return scored.slice(0, limit).map((x) => x.cap);
2411
1647
  }
2412
1648
  function builtinCapabilities(registry) {
2413
- const listFilterSchema = z5.strictObject({
2414
- side: z5.enum(["client", "agent"]).optional(),
2415
- originKind: z5.enum(["framework", "client", "agent", "flow", "skill", "mcp", "connector"]).optional(),
2416
- scope: z5.enum(["session", "turn"]).optional()
1649
+ const listFilterSchema = z4.strictObject({
1650
+ side: z4.enum(["client", "agent"]).optional(),
1651
+ originKind: z4.enum(["framework", "client", "agent", "flow", "skill", "mcp", "connector"]).optional(),
1652
+ scope: z4.enum(["session", "turn"]).optional()
2417
1653
  });
2418
1654
  return [
2419
1655
  defineCapability({
@@ -2439,9 +1675,9 @@ function builtinCapabilities(registry) {
2439
1675
  origin: { kind: "framework" },
2440
1676
  kind: "query",
2441
1677
  userInvokable: false,
2442
- input: z5.strictObject({
2443
- query: z5.string(),
2444
- limit: z5.number().int().positive().optional()
1678
+ input: z4.strictObject({
1679
+ query: z4.string(),
1680
+ limit: z4.number().int().positive().optional()
2445
1681
  }),
2446
1682
  handler: async ({ query, limit }) => keywordSearch(registry.list(), query, limit ?? 10)
2447
1683
  }),
@@ -2453,7 +1689,7 @@ function builtinCapabilities(registry) {
2453
1689
  origin: { kind: "framework" },
2454
1690
  kind: "query",
2455
1691
  userInvokable: false,
2456
- input: z5.strictObject({ name: z5.string() }),
1692
+ input: z4.strictObject({ name: z4.string() }),
2457
1693
  handler: async ({ name }) => {
2458
1694
  const cap = registry.resolve(name);
2459
1695
  if (!cap) return null;
@@ -2857,22 +2093,6 @@ var HYDRATED_REJECT_HANDLER = async () => {
2857
2093
  );
2858
2094
  };
2859
2095
 
2860
- // runner/src/composition/prompt-sections.ts
2861
- function buildRunnerAgentSections(resolved, promptExtensions, options = {}) {
2862
- const blocks = resolved?.inlineBlocks ?? [];
2863
- const memory = resolved?.memoryBlocks ?? [];
2864
- const seedsFromSoul = memory.some((m) => m.source?.replace(/^\.\//, "") === "SOUL.md");
2865
- const soul = options.includeSoul && !seedsFromSoul ? blocks.filter((block) => block.implicit && block.kind === "soul").map((block) => block.content.trim()).filter(Boolean).join("\n\n") : "";
2866
- const duties = blocks.filter((block) => block.implicit && block.kind === "prompt").map((block) => block.content.trim()).filter(Boolean).join("\n\n");
2867
- return buildAgentPromptSections({
2868
- soul,
2869
- memory,
2870
- duties,
2871
- composed: blocks.filter((block) => !block.implicit).map((block) => ({ text: block.content, source: block.ref })),
2872
- promptExtensions: promptExtensions.map((e) => ({ text: e.value, source: e.source }))
2873
- });
2874
- }
2875
-
2876
2096
  // runner/src/context.ts
2877
2097
  var PLATFORM_DESCRIPTIONS = {
2878
2098
  skaile: "You are an AI assistant operating within the Skaile platform, an enterprise AI workspace. Users interact with you through a chat interface in their browser."
@@ -3221,7 +2441,7 @@ function registerCodexToolDefinitions(registry, namespace, tools) {
3221
2441
  (tool) => defineCapability({
3222
2442
  name: `${namespace}.${tool.name}`,
3223
2443
  description: tool.description,
3224
- input: z5.object(tool.inputSchema),
2444
+ input: z4.object(tool.inputSchema),
3225
2445
  side: "agent",
3226
2446
  origin: { kind: "framework" },
3227
2447
  audience: ["llm"],
@@ -3238,20 +2458,20 @@ function registerCodexToolDefinitions(registry, namespace, tools) {
3238
2458
  };
3239
2459
  }
3240
2460
  function contains(root, target) {
3241
- const path11 = relative(root, target);
3242
- return path11 === "" || !path11.startsWith("..") && !isAbsolute(path11);
2461
+ const path8 = relative(root, target);
2462
+ return path8 === "" || !path8.startsWith("..") && !isAbsolute(path8);
3243
2463
  }
3244
- async function canonical(path11) {
2464
+ async function canonical(path8) {
3245
2465
  try {
3246
- return await realpath(path11);
2466
+ return await realpath(path8);
3247
2467
  } catch (error) {
3248
2468
  if (error.code !== "ENOENT") throw error;
3249
- const parent = dirname(path11);
3250
- if (parent === path11) throw error;
3251
- return resolve(await canonical(parent), relative(parent, path11));
2469
+ const parent = dirname(path8);
2470
+ if (parent === path8) throw error;
2471
+ return resolve(await canonical(parent), relative(parent, path8));
3252
2472
  }
3253
2473
  }
3254
- async function assertScopedTree(path11, root) {
2474
+ async function assertScopedTree(path8, root) {
3255
2475
  let remaining = 1e4;
3256
2476
  async function visit(entry) {
3257
2477
  if (--remaining < 0) throw new Error("CODEX_RESOURCE_SCOPE_INVALID");
@@ -3267,7 +2487,7 @@ async function assertScopedTree(path11, root) {
3267
2487
  if (stat4.isDirectory())
3268
2488
  for (const child of await readdir(entry)) await visit(join(entry, child));
3269
2489
  }
3270
- await visit(path11);
2490
+ await visit(path8);
3271
2491
  }
3272
2492
  async function registerCodexResourceTools(options) {
3273
2493
  const project = await realpath(options.projectDir);
@@ -3403,7 +2623,7 @@ function resolveHomeConfig(raw) {
3403
2623
  problems.push(`${at}: ${pathProblem}; ignored`);
3404
2624
  return;
3405
2625
  }
3406
- const path11 = entry.path;
2626
+ const path8 = entry.path;
3407
2627
  const maxChars = entry["max-chars"];
3408
2628
  if (typeof maxChars !== "number" || !Number.isInteger(maxChars) || maxChars < 1 || maxChars > HOME_MAX_CHARS) {
3409
2629
  problems.push(`${at}: max-chars must be an integer from 1 to ${HOME_MAX_CHARS}; ignored`);
@@ -3414,7 +2634,7 @@ function resolveHomeConfig(raw) {
3414
2634
  problems.push(`${at}: from must be 'head' or 'tail'; ignored`);
3415
2635
  return;
3416
2636
  }
3417
- let label = basename(path11).replace(/\.md$/, "");
2637
+ let label = basename(path8).replace(/\.md$/, "");
3418
2638
  if (entry.label !== void 0) {
3419
2639
  if (typeof entry.label !== "string" || entry.label.length === 0 || /[\r\n]/.test(entry.label)) {
3420
2640
  problems.push(`${at}: label must be a one-line string; ignored`);
@@ -3422,12 +2642,12 @@ function resolveHomeConfig(raw) {
3422
2642
  }
3423
2643
  label = entry.label;
3424
2644
  }
3425
- if (seen.has(path11)) {
3426
- problems.push(`${at}: duplicate path ${path11}; ignored`);
2645
+ if (seen.has(path8)) {
2646
+ problems.push(`${at}: duplicate path ${path8}; ignored`);
3427
2647
  return;
3428
2648
  }
3429
- seen.add(path11);
3430
- files.push({ path: path11, label, maxChars, from });
2649
+ seen.add(path8);
2650
+ files.push({ path: path8, label, maxChars, from });
3431
2651
  });
3432
2652
  return { tag, intro, files, problems };
3433
2653
  }
@@ -3679,9 +2899,9 @@ function toolAllowlistRefusal(allowlist, harness) {
3679
2899
  return "Prompt refused: toolAllowlist must be an array of tool names.";
3680
2900
  if (harness?.enforcesToolAllowlist !== true || typeof harness.unknownAllowlistedTools !== "function")
3681
2901
  return "Prompt refused: this agent harness cannot enforce a tool allowlist.";
3682
- const unknown4 = harness.unknownAllowlistedTools(allowlist);
3683
- if (unknown4.length > 0)
3684
- return `Prompt refused: unknown tool(s) in toolAllowlist: ${unknown4.join(", ")}.`;
2902
+ const unknown3 = harness.unknownAllowlistedTools(allowlist);
2903
+ if (unknown3.length > 0)
2904
+ return `Prompt refused: unknown tool(s) in toolAllowlist: ${unknown3.join(", ")}.`;
3685
2905
  return null;
3686
2906
  }
3687
2907
 
@@ -3713,8 +2933,8 @@ var DEFAULT_MAX_DIRS = 256;
3713
2933
  function isStructuralAction(action) {
3714
2934
  return action === "create" || action === "delete";
3715
2935
  }
3716
- function parentDirOf(path11) {
3717
- return path11.includes("/") ? path11.slice(0, path11.lastIndexOf("/")) : "";
2936
+ function parentDirOf(path8) {
2937
+ return path8.includes("/") ? path8.slice(0, path8.lastIndexOf("/")) : "";
3718
2938
  }
3719
2939
  var FileChangedCoalescer = class {
3720
2940
  windowMs;
@@ -3896,7 +3116,7 @@ async function readMcpToolsSnapshot(decl) {
3896
3116
  return file.tools;
3897
3117
  }
3898
3118
  async function writeMcpToolsSnapshot(decl, tools) {
3899
- const path11 = snapshotPath(decl);
3119
+ const path8 = snapshotPath(decl);
3900
3120
  const body = {
3901
3121
  format: SNAPSHOT_FORMAT,
3902
3122
  id: decl.id,
@@ -3907,11 +3127,11 @@ async function writeMcpToolsSnapshot(decl, tools) {
3907
3127
  ...t.inputSchema !== void 0 ? { inputSchema: t.inputSchema } : {}
3908
3128
  }))
3909
3129
  };
3910
- const tmp = `${path11}.${process.pid}.${Date.now()}.tmp`;
3130
+ const tmp = `${path8}.${process.pid}.${Date.now()}.tmp`;
3911
3131
  try {
3912
3132
  await mkdir(mcpToolsSnapshotDir(), { recursive: true });
3913
3133
  await writeFile(tmp, JSON.stringify(body), "utf8");
3914
- await rename(tmp, path11);
3134
+ await rename(tmp, path8);
3915
3135
  return true;
3916
3136
  } catch {
3917
3137
  return false;
@@ -3954,22 +3174,22 @@ function recipeMapPath() {
3954
3174
  var recipeMapMemo = null;
3955
3175
  var recipeMapInFlight = null;
3956
3176
  async function loadRecipeMap() {
3957
- const path11 = recipeMapPath();
3177
+ const path8 = recipeMapPath();
3958
3178
  const mtimeMs = await tryWithFsDeadline(
3959
- `stat ${path11}`,
3960
- async () => (await stat(path11)).mtimeMs,
3179
+ `stat ${path8}`,
3180
+ async () => (await stat(path8)).mtimeMs,
3961
3181
  null
3962
3182
  );
3963
3183
  if (mtimeMs === null) {
3964
- recipeMapMemo = { path: path11, mtimeMs: -1, map: null };
3184
+ recipeMapMemo = { path: path8, mtimeMs: -1, map: null };
3965
3185
  return null;
3966
3186
  }
3967
- if (recipeMapMemo && recipeMapMemo.path === path11 && recipeMapMemo.mtimeMs === mtimeMs) {
3187
+ if (recipeMapMemo && recipeMapMemo.path === path8 && recipeMapMemo.mtimeMs === mtimeMs) {
3968
3188
  return recipeMapMemo.map;
3969
3189
  }
3970
- const key = `${path11}:${mtimeMs}`;
3190
+ const key = `${path8}:${mtimeMs}`;
3971
3191
  if (recipeMapInFlight?.key === key) return recipeMapInFlight.promise;
3972
- const promise = readRecipeMap(path11, mtimeMs);
3192
+ const promise = readRecipeMap(path8, mtimeMs);
3973
3193
  recipeMapInFlight = { key, promise };
3974
3194
  try {
3975
3195
  return await promise;
@@ -3977,21 +3197,21 @@ async function loadRecipeMap() {
3977
3197
  if (recipeMapInFlight?.key === key) recipeMapInFlight = null;
3978
3198
  }
3979
3199
  }
3980
- async function readRecipeMap(path11, mtimeMs) {
3200
+ async function readRecipeMap(path8, mtimeMs) {
3981
3201
  let map = null;
3982
3202
  try {
3983
3203
  const parsed = JSON.parse(
3984
- await withFsDeadline(`readFile ${path11}`, () => readFile(path11, "utf8"))
3204
+ await withFsDeadline(`readFile ${path8}`, () => readFile(path8, "utf8"))
3985
3205
  );
3986
3206
  map = parsed && typeof parsed === "object" ? parsed : null;
3987
3207
  } catch (err) {
3988
3208
  createLogger({ kind: "mcp", subkind: "recipe-resolve" }).warn(
3989
3209
  "recipe map malformed \u2014 falling back to nix path-info",
3990
- { path: path11, error: err instanceof Error ? err.message : String(err) }
3210
+ { path: path8, error: err instanceof Error ? err.message : String(err) }
3991
3211
  );
3992
3212
  map = null;
3993
3213
  }
3994
- recipeMapMemo = { path: path11, mtimeMs, map };
3214
+ recipeMapMemo = { path: path8, mtimeMs, map };
3995
3215
  return map;
3996
3216
  }
3997
3217
  var MapRecipeProducer = class {
@@ -4278,6 +3498,8 @@ function warnUnresolvedRecipeMarkers(recipeLog, declId, resolvedCommand, resolve
4278
3498
  var PASSTHROUGH_INPUT_ZOD = {
4279
3499
  parse: (v) => v
4280
3500
  };
3501
+ var MCP_TOOL_CALL_TIMEOUT_MS = 15 * 6e4;
3502
+ var MCP_TOOL_CALL_MAX_TOTAL_MS = 2 * 60 * 6e4;
4281
3503
  function isMcpAuthError(err) {
4282
3504
  if (!err || typeof err !== "object") return false;
4283
3505
  const code = err.code ?? err.status;
@@ -4430,7 +3652,8 @@ var ExternalMcpManager = class {
4430
3652
  const snapshot = lazy ? await readMcpToolsSnapshot(decl) : void 0;
4431
3653
  if (snapshot) return this.registerFromSnapshot(decl, snapshot);
4432
3654
  const client = await this.connectWithReauth(decl);
4433
- const server = { id: decl.id, decl, client, tools: [], toolNames: [] };
3655
+ const server = { id: decl.id, decl, tools: [], toolNames: [] };
3656
+ this.adoptClient(server, client);
4434
3657
  const toolNames = [];
4435
3658
  try {
4436
3659
  const { tools } = await client.listTools();
@@ -4443,6 +3666,7 @@ var ExternalMcpManager = class {
4443
3666
  if (lazy) await writeMcpToolsSnapshot(decl, tools);
4444
3667
  } catch (err) {
4445
3668
  for (const name of toolNames) this.registry.deregister(name);
3669
+ server.removed = true;
4446
3670
  try {
4447
3671
  await client.close();
4448
3672
  } catch {
@@ -4484,25 +3708,27 @@ var ExternalMcpManager = class {
4484
3708
  return { id: decl.id, toolNames: [...server.toolNames] };
4485
3709
  }
4486
3710
  /**
4487
- * The server's live client, starting a lazy server on first use. Concurrent
4488
- * first calls share one connect; a failed connect is not cached, so the next
4489
- * call tries again.
3711
+ * The server's live client, starting it on first use (a lazy server) or after
3712
+ * its connection closed. Concurrent calls share one connect; a failed connect
3713
+ * is not cached, so the next call tries again.
4490
3714
  */
4491
3715
  ensureClient(server) {
4492
3716
  if (server.client) return Promise.resolve(server.client);
4493
3717
  if (server.removed) return Promise.reject(new Error(`MCP server '${server.id}' was removed`));
4494
- server.connectInFlight ??= this.startLazyServer(server).finally(() => {
3718
+ server.connectInFlight ??= this.startServer(server).finally(() => {
4495
3719
  server.connectInFlight = void 0;
4496
3720
  });
4497
3721
  return server.connectInFlight;
4498
3722
  }
4499
- async startLazyServer(server) {
3723
+ async startServer(server) {
3724
+ const restart = server.closedAt !== void 0;
3725
+ const what = restart ? "restart" : "lazy start";
4500
3726
  let client;
4501
3727
  let tools;
4502
3728
  try {
4503
3729
  client = await this.connectWithReauth(server.decl);
4504
3730
  } catch (err) {
4505
- this.log.error("MCP server lazy start failed", err, { id: server.id });
3731
+ this.log.error(`MCP server ${what} failed`, err, { id: server.id });
4506
3732
  throw new Error(`MCP server '${server.id}' failed to start: ${errMessage(err)}`);
4507
3733
  }
4508
3734
  try {
@@ -4510,28 +3736,54 @@ var ExternalMcpManager = class {
4510
3736
  } catch (err) {
4511
3737
  await client.close().catch(() => {
4512
3738
  });
4513
- this.log.error("MCP server lazy start failed", err, { id: server.id });
3739
+ this.log.error(`MCP server ${what} failed`, err, { id: server.id });
4514
3740
  throw new Error(`MCP server '${server.id}' failed to start: ${errMessage(err)}`);
4515
3741
  }
4516
- server.client = client;
3742
+ const downMs = restart ? Date.now() - server.closedAt : void 0;
3743
+ this.adoptClient(server, client);
4517
3744
  if (server.removed) throw new Error(`MCP server '${server.id}' was removed`);
4518
3745
  if (!sameToolList(server.tools, tools)) this.reregisterTools(server, tools);
4519
- this.log.info("MCP server registered (runner-managed)", {
4520
- id: server.id,
4521
- transport: "stdio",
4522
- toolCount: server.toolNames.length,
4523
- tools: server.toolNames,
4524
- lazy: true,
4525
- started: true
4526
- });
3746
+ this.log.info(
3747
+ restart ? "MCP server restarted (runner-managed)" : "MCP server registered (runner-managed)",
3748
+ {
3749
+ id: server.id,
3750
+ transport: server.decl.transport ?? "stdio",
3751
+ toolCount: server.toolNames.length,
3752
+ tools: server.toolNames,
3753
+ ...restart ? { downMs } : { lazy: true, started: true }
3754
+ }
3755
+ );
4527
3756
  return client;
4528
3757
  }
3758
+ /**
3759
+ * Make `client` the server's live client and watch it: when its transport
3760
+ * closes on its own (the stdio process exited), drop it so the next tool call
3761
+ * starts the server again instead of failing with `Not connected` for the
3762
+ * rest of the session. The client it replaces (401 reconnect, or a restart
3763
+ * racing one) is closed, and its close is ignored.
3764
+ */
3765
+ adoptClient(server, client) {
3766
+ const previous = server.client;
3767
+ server.client = client;
3768
+ server.closedAt = void 0;
3769
+ if (previous && previous !== client) void previous.close().catch(() => {
3770
+ });
3771
+ client.onclose = () => {
3772
+ if (server.client !== client || server.removed) return;
3773
+ server.client = void 0;
3774
+ server.closedAt = Date.now();
3775
+ this.log.warn("MCP server connection closed; the next tool call restarts it", {
3776
+ id: server.id,
3777
+ transport: server.decl.transport ?? "stdio"
3778
+ });
3779
+ };
3780
+ }
4529
3781
  /**
4530
3782
  * The snapshot disagreed with what the started server advertises: replace the
4531
3783
  * registered capabilities with the live list and rewrite the snapshot.
4532
3784
  */
4533
3785
  reregisterTools(server, tools) {
4534
- this.log.warn("MCP tools snapshot is stale; re-registering from the live server", {
3786
+ this.log.warn("MCP tool list changed; re-registering from the live server", {
4535
3787
  id: server.id,
4536
3788
  snapshotCount: server.tools.length,
4537
3789
  liveCount: tools.length
@@ -4544,7 +3796,7 @@ var ExternalMcpManager = class {
4544
3796
  this.registry.register(cap, "agent");
4545
3797
  server.toolNames.push(cap.name);
4546
3798
  }
4547
- void writeMcpToolsSnapshot(server.decl, tools);
3799
+ if (isLazyDeclaration(server.decl)) void writeMcpToolsSnapshot(server.decl, tools);
4548
3800
  }
4549
3801
  /**
4550
3802
  * Deregister a running MCP server's tools and close its client.
@@ -4628,12 +3880,7 @@ var ExternalMcpManager = class {
4628
3880
  this.log.warn("MCP reconnect after 401 failed", { id: server.id, error: errMessage(err) });
4629
3881
  return false;
4630
3882
  }
4631
- const old = server.client;
4632
- server.client = next;
4633
- try {
4634
- await old?.close();
4635
- } catch {
4636
- }
3883
+ this.adoptClient(server, next);
4637
3884
  this.log.info("MCP server reconnected after 401 re-mint", { id: server.id });
4638
3885
  return true;
4639
3886
  }
@@ -4664,7 +3911,14 @@ var ExternalMcpManager = class {
4664
3911
  const call = { name: tool.name, arguments: input ?? {} };
4665
3912
  const invoke = async () => {
4666
3913
  const client = await untilAborted(this.ensureClient(server), ctx.signal);
4667
- return ctx.signal ? client.callTool(call, void 0, { signal: ctx.signal }) : client.callTool(call);
3914
+ return client.callTool(call, void 0, {
3915
+ ...ctx.signal ? { signal: ctx.signal } : {},
3916
+ timeout: MCP_TOOL_CALL_TIMEOUT_MS,
3917
+ resetTimeoutOnProgress: true,
3918
+ maxTotalTimeout: MCP_TOOL_CALL_MAX_TOTAL_MS,
3919
+ onprogress: () => {
3920
+ }
3921
+ });
4668
3922
  };
4669
3923
  let result;
4670
3924
  try {
@@ -5424,9 +4678,17 @@ async function createAgentSession(config) {
5424
4678
  log: sessionLog
5425
4679
  }) : null;
5426
4680
  composition = await withHostMemory(composition, config.loadHostMemory, sessionLog);
5427
- const agentSections = buildRunnerAgentSections(composition, promptExtensions, {
5428
- includeSoul: harnessType === "omp"
4681
+ const nativeFileId = config.instanceId ?? DEFAULT_AGENT_INSTANCE_ID;
4682
+ const assembled = assembleRunnerAgent(composition, promptExtensions, {
4683
+ harness: harnessType,
4684
+ nativeFile: readNativeAgentFile(agentCwd, harnessType, nativeFileId)
5429
4685
  });
4686
+ const agentSections = assembled.runnerSections;
4687
+ for (const block of assembled.stale) {
4688
+ sessionLog.warn(
4689
+ `${nativeAgentFilePath(agentCwd, harnessType, nativeFileId)}: ${block.label} is out of date; run skaile install`
4690
+ );
4691
+ }
5430
4692
  const disposeManagedTools = managed ? await registerCodexResourceTools({
5431
4693
  registry: config.capabilityRegistry,
5432
4694
  manager: resourceManager,
@@ -5694,10 +4956,6 @@ function logAssembledSystemPrompt(systemPrompt, log) {
5694
4956
  log.debug("system prompt content", { content: systemPrompt ?? "(empty)" });
5695
4957
  }
5696
4958
  }
5697
- function modelForHarness(preferred, harnessType) {
5698
- if (!preferred || harnessType === "claude-sdk") return preferred;
5699
- return ANTHROPIC_MODEL_ALIASES.includes(preferred) ? void 0 : preferred;
5700
- }
5701
4959
  function manifestModelForHarness(manifest, harnessType) {
5702
4960
  return modelForHarness(manifest?.model?.preferred, harnessType);
5703
4961
  }
@@ -7308,6 +6566,7 @@ function describeComposition(resolved) {
7308
6566
  return (resolved.manifest.composes ?? []).map((item) => {
7309
6567
  const binding = item.kind === "agent" ? subagents.find((s) => s.ref === item.ref)?.binding ?? resolveBinding(item) : resolveBinding(item);
7310
6568
  const hit = byKey.get(`${item.kind}\0${item.ref}`);
6569
+ const implicit = resolved.inlineBlocks.find((b) => b.ref === item.ref && b.kind === item.kind)?.implicit === true;
7311
6570
  return {
7312
6571
  ref: item.ref,
7313
6572
  kind: item.kind,
@@ -7315,19 +6574,28 @@ function describeComposition(resolved) {
7315
6574
  version: hit?.version,
7316
6575
  hash: hit?.hash,
7317
6576
  resolvedRef: hit?.resolvedRef,
7318
- support: supportFor(item, binding)
6577
+ support: supportFor(item, binding, sectionOf(item, implicit))
7319
6578
  };
7320
6579
  });
7321
6580
  }
7322
- function supportFor(item, binding) {
6581
+ function sectionOf(item, implicit) {
6582
+ if (!implicit) return "composed";
6583
+ if (item.kind === "soul") return "soul";
6584
+ if (item.kind === "ruleset") return "constraints";
6585
+ if (item.kind === "prompt") return "duties";
6586
+ return "composed";
6587
+ }
6588
+ function supportFor(item, binding, section) {
7323
6589
  const out = {};
7324
6590
  for (const target of SUPPORTED_HARNESSES) {
7325
- out[target] = deliveryFor(item, binding, target);
6591
+ out[target] = deliveryFor(item, binding, target, section);
7326
6592
  }
7327
6593
  return out;
7328
6594
  }
7329
- function deliveryFor(item, binding, target) {
7330
- if (binding === "inline-snapshot" || binding === "inline-live") return "system prompt";
6595
+ function deliveryFor(item, binding, target, section) {
6596
+ if (binding === "inline-snapshot" || binding === "inline-live") {
6597
+ return AGENT_PROMPT_CARRIER_LABELS[AGENT_PROMPT_CARRIERS[target][section]];
6598
+ }
7331
6599
  if (binding === "discoverable") return "capability (loaded on demand)";
7332
6600
  if (binding === "run") return "agent.run capability (host-executed)";
7333
6601
  if (binding === "delegate" && item.kind === "agent") {
@@ -7392,31 +6660,31 @@ function errorResponse(command, resourceId, err) {
7392
6660
  };
7393
6661
  }
7394
6662
  async function handleResourceRequest(command, manager, emit) {
7395
- const { requestId, connectorId, operation, path: path11, options, content } = command;
6663
+ const { requestId, connectorId, operation, path: path8, options, content } = command;
7396
6664
  try {
7397
6665
  let data;
7398
6666
  switch (operation) {
7399
6667
  case "list":
7400
6668
  data = await manager.list(
7401
6669
  connectorId,
7402
- path11,
6670
+ path8,
7403
6671
  options
7404
6672
  );
7405
6673
  break;
7406
6674
  case "read":
7407
- data = await manager.read(connectorId, path11);
6675
+ data = await manager.read(connectorId, path8);
7408
6676
  break;
7409
6677
  case "write":
7410
- await manager.write(connectorId, path11, content);
6678
+ await manager.write(connectorId, path8, content);
7411
6679
  data = true;
7412
6680
  break;
7413
6681
  case "delete":
7414
- data = await manager.delete(connectorId, path11);
6682
+ data = await manager.delete(connectorId, path8);
7415
6683
  break;
7416
6684
  case "search":
7417
6685
  data = await manager.search(
7418
6686
  connectorId,
7419
- path11,
6687
+ path8,
7420
6688
  options
7421
6689
  );
7422
6690
  break;
@@ -8177,31 +7445,31 @@ function validateCodexInit(cmd, supported, previous) {
8177
7445
  if (cmd.secrets && Object.keys(cmd.secrets).some((key) => /openai|codex/i.test(key)))
8178
7446
  throw new Error("Conflicting managed AI credential delivery");
8179
7447
  }
8180
- var text = z5.string().min(1).max(4096);
8181
- var timeout = z5.number().int().positive().max(18e5).optional();
8182
- var zHost = z5.object({
8183
- schemaVersion: z5.literal(1),
8184
- sessionId: z5.string().min(1).max(128),
8185
- runtime: z5.object({
7448
+ var text = z4.string().min(1).max(4096);
7449
+ var timeout = z4.number().int().positive().max(18e5).optional();
7450
+ var zHost = z4.object({
7451
+ schemaVersion: z4.literal(1),
7452
+ sessionId: z4.string().min(1).max(128),
7453
+ runtime: z4.object({
8186
7454
  executable: text,
8187
- executableArgs: z5.array(text).max(64).optional(),
7455
+ executableArgs: z4.array(text).max(64).optional(),
8188
7456
  privateDirectory: text,
8189
7457
  privateRoot: text,
8190
- environment: z5.record(z5.string(), z5.string()),
8191
- instructionFiles: z5.array(text).max(64).optional(),
7458
+ environment: z4.record(z4.string(), z4.string()),
7459
+ instructionFiles: z4.array(text).max(64).optional(),
8192
7460
  skillsDirectory: text.optional(),
8193
7461
  requestTimeoutMs: timeout,
8194
7462
  turnTimeoutMs: timeout,
8195
7463
  interactionTimeoutMs: timeout
8196
7464
  }).strict(),
8197
- requiredTools: z5.array(z5.string().min(1).max(256)).min(1).max(1024),
8198
- approvalPolicy: z5.enum(["never", "on-request", "untrusted"]),
8199
- sandboxMode: z5.enum(["read-only", "workspace-write"]),
8200
- reasoningEffort: z5.enum(["minimal", "low", "medium", "high", "xhigh"]),
8201
- subpromptModels: z5.object({
7465
+ requiredTools: z4.array(z4.string().min(1).max(256)).min(1).max(1024),
7466
+ approvalPolicy: z4.enum(["never", "on-request", "untrusted"]),
7467
+ sandboxMode: z4.enum(["read-only", "workspace-write"]),
7468
+ reasoningEffort: z4.enum(["minimal", "low", "medium", "high", "xhigh"]),
7469
+ subpromptModels: z4.object({
8202
7470
  small: text,
8203
7471
  deep: text,
8204
- available: z5.array(text).min(1).max(1024)
7472
+ available: z4.array(text).min(1).max(1024)
8205
7473
  }).strict()
8206
7474
  }).strict();
8207
7475
  var refused = () => new Error("CODEX_MANAGED_BOOTSTRAP_INVALID");
@@ -8863,24 +8131,24 @@ function createCoalescedRestartScheduler(deps) {
8863
8131
  }
8864
8132
  async function recordStagedSkills(staged, projectDir, skillsDir, names, timeoutMs) {
8865
8133
  for (const name of names) {
8866
- const path11 = join(projectDir, skillsDir, name);
8867
- const st = await tryWithFsDeadline(`lstat ${path11}`, () => lstat(path11), null, timeoutMs);
8134
+ const path8 = join(projectDir, skillsDir, name);
8135
+ const st = await tryWithFsDeadline(`lstat ${path8}`, () => lstat(path8), null, timeoutMs);
8868
8136
  staged.set(
8869
8137
  name,
8870
- st?.isDirectory() && st.birthtimeMs > 0 ? { path: path11, dev: st.dev, ino: st.ino, birthtimeMs: st.birthtimeMs } : null
8138
+ st?.isDirectory() && st.birthtimeMs > 0 ? { path: path8, dev: st.dev, ino: st.ino, birthtimeMs: st.birthtimeMs } : null
8871
8139
  );
8872
8140
  }
8873
8141
  }
8874
- async function isStillOurs(record2, path11, timeoutMs) {
8875
- if (!record2 || record2.path !== path11) return false;
8876
- const st = await tryWithFsDeadline(`lstat ${path11}`, () => lstat(path11), null, timeoutMs);
8142
+ async function isStillOurs(record2, path8, timeoutMs) {
8143
+ if (!record2 || record2.path !== path8) return false;
8144
+ const st = await tryWithFsDeadline(`lstat ${path8}`, () => lstat(path8), null, timeoutMs);
8877
8145
  return st?.isDirectory() === true && st.dev === record2.dev && st.ino === record2.ino && st.birthtimeMs === record2.birthtimeMs;
8878
8146
  }
8879
8147
  async function recordLoadedSkillDigests(loaded, projectDir, skillsDir, names, opts) {
8880
8148
  for (const name of names) {
8881
8149
  if (opts.harnessUp && opts.previouslyStaged.has(name)) continue;
8882
- const path11 = join(projectDir, skillsDir, name);
8883
- loaded.set(name, { path: path11, digest: await stagedSkillDigest(path11) });
8150
+ const path8 = join(projectDir, skillsDir, name);
8151
+ loaded.set(name, { path: path8, digest: await stagedSkillDigest(path8) });
8884
8152
  }
8885
8153
  }
8886
8154
  var DIGEST_DEADLINE_FACTOR = 4;
@@ -8893,11 +8161,11 @@ async function stagedSkillDigest(dir, timeoutMs) {
8893
8161
  async () => {
8894
8162
  const hash = createHash("sha256");
8895
8163
  let budget = DIGEST_MAX_BYTES;
8896
- const hashFile = async (path11) => {
8897
- const fh = await open(path11, DIGEST_OPEN_FLAGS);
8164
+ const hashFile = async (path8) => {
8165
+ const fh = await open(path8, DIGEST_OPEN_FLAGS);
8898
8166
  try {
8899
8167
  const st = await fh.stat();
8900
- if (!st.isFile()) throw new Error(`not a regular file: ${path11}`);
8168
+ if (!st.isFile()) throw new Error(`not a regular file: ${path8}`);
8901
8169
  if (st.size > budget) throw new Error("skill too large to digest");
8902
8170
  const buf = Buffer.alloc(DIGEST_CHUNK_BYTES);
8903
8171
  let total = 0;
@@ -8921,17 +8189,17 @@ async function stagedSkillDigest(dir, timeoutMs) {
8921
8189
  entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
8922
8190
  for (const entry of entries) {
8923
8191
  if (!rel && entry.name === STAGED_SKILL_MARKER) continue;
8924
- const path11 = rel ? `${rel}/${entry.name}` : entry.name;
8192
+ const path8 = rel ? `${rel}/${entry.name}` : entry.name;
8925
8193
  if (entry.isDirectory()) {
8926
- hash.update(`d\0${path11}\0`);
8927
- await walk(path11);
8194
+ hash.update(`d\0${path8}\0`);
8195
+ await walk(path8);
8928
8196
  } else if (entry.isSymbolicLink()) {
8929
- hash.update(`l\0${path11}\0${await readlink(join(dir, path11))}\0`);
8197
+ hash.update(`l\0${path8}\0${await readlink(join(dir, path8))}\0`);
8930
8198
  } else if (entry.isFile()) {
8931
- hash.update(`f\0${path11}\0`);
8932
- await hashFile(join(dir, path11));
8199
+ hash.update(`f\0${path8}\0`);
8200
+ await hashFile(join(dir, path8));
8933
8201
  } else {
8934
- hash.update(`o\0${path11}\0`);
8202
+ hash.update(`o\0${path8}\0`);
8935
8203
  }
8936
8204
  }
8937
8205
  };
@@ -9019,9 +8287,9 @@ async function detachStagedSkill(deps, name) {
9019
8287
  };
9020
8288
  }
9021
8289
  }
9022
- async function pathState(path11) {
8290
+ async function pathState(path8) {
9023
8291
  try {
9024
- await withFsDeadline(`lstat ${path11}`, () => lstat(path11));
8292
+ await withFsDeadline(`lstat ${path8}`, () => lstat(path8));
9025
8293
  return "present";
9026
8294
  } catch (err) {
9027
8295
  return err?.code === "ENOENT" ? "absent" : "unknown";
@@ -12043,12 +11311,12 @@ async function readSkillListings(skillsDir) {
12043
11311
  }
12044
11312
  const listings = await Promise.all(
12045
11313
  entries.map(async (dir) => {
12046
- const path11 = join(skillsDir, dir, "SKILL.md");
11314
+ const path8 = join(skillsDir, dir, "SKILL.md");
12047
11315
  try {
12048
- const { data } = parseFrontmatter(await readFile(path11, "utf8"));
11316
+ const { data } = parseFrontmatter(await readFile(path8, "utf8"));
12049
11317
  const name = typeof data.name === "string" ? data.name : dir;
12050
11318
  const description = typeof data.description === "string" ? data.description : "";
12051
- return { name, frontmatter: `${name}: ${description}`, source: path11 };
11319
+ return { name, frontmatter: `${name}: ${description}`, source: path8 };
12052
11320
  } catch {
12053
11321
  return null;
12054
11322
  }
@@ -12415,64 +11683,64 @@ function notImplemented(name) {
12415
11683
  message: `${name} handler not configured`
12416
11684
  };
12417
11685
  }
12418
- var requiredUnknown = z5.unknown().refine(() => true);
12419
- var preMintedTokenSchema = z5.object({
12420
- token: z5.string(),
12421
- expiresAt: z5.string().nullable().optional()
11686
+ var requiredUnknown = z4.unknown().refine(() => true);
11687
+ var preMintedTokenSchema = z4.object({
11688
+ token: z4.string(),
11689
+ expiresAt: z4.string().nullable().optional()
12422
11690
  }).optional();
12423
- var mountDeclarationInput = z5.strictObject({
11691
+ var mountDeclarationInput = z4.strictObject({
12424
11692
  declaration: requiredUnknown,
12425
11693
  preMintedToken: preMintedTokenSchema,
12426
11694
  // The platform attaches a workspace-migration directive on add_mount; the
12427
11695
  // handler ignores it for now (replace-workspace hot-migration is a follow-up).
12428
11696
  // Accepted here so a real platform add_mount payload validates.
12429
- migration: z5.unknown().optional()
11697
+ migration: z4.unknown().optional()
12430
11698
  });
12431
- var connectorDeclarationInput = z5.strictObject({
11699
+ var connectorDeclarationInput = z4.strictObject({
12432
11700
  declaration: requiredUnknown,
12433
11701
  preMintedToken: preMintedTokenSchema
12434
11702
  });
12435
- var addMcpServerInputSchema = z5.strictObject({
11703
+ var addMcpServerInputSchema = z4.strictObject({
12436
11704
  declaration: requiredUnknown,
12437
11705
  preMintedToken: preMintedTokenSchema
12438
11706
  });
12439
- var attachInstanceInputSchema = z5.strictObject({
12440
- kind: z5.string(),
12441
- name: z5.string(),
11707
+ var attachInstanceInputSchema = z4.strictObject({
11708
+ kind: z4.string(),
11709
+ name: z4.string(),
12442
11710
  preMintedToken: preMintedTokenSchema
12443
11711
  });
12444
- var detachInstanceInputSchema = z5.strictObject({
12445
- kind: z5.string(),
12446
- name: z5.string()
11712
+ var detachInstanceInputSchema = z4.strictObject({
11713
+ kind: z4.string(),
11714
+ name: z4.string()
12447
11715
  });
12448
- var removeResourceInput = z5.strictObject({
12449
- id: z5.string()
11716
+ var removeResourceInput = z4.strictObject({
11717
+ id: z4.string()
12450
11718
  });
12451
- var updateCredentialInput = z5.strictObject({
12452
- kind: z5.enum(["mount", "connector"]),
12453
- id: z5.string(),
11719
+ var updateCredentialInput = z4.strictObject({
11720
+ kind: z4.enum(["mount", "connector"]),
11721
+ id: z4.string(),
12454
11722
  // `CredentialMint` is a discriminated union from `@skaile/workspaces/types`.
12455
11723
  // We accept it as `z.unknown()` here because Zod can't easily mirror
12456
11724
  // a discriminated TypeScript union without duplicating the schema —
12457
11725
  // the platform side has already validated the shape before sending.
12458
11726
  mint: requiredUnknown
12459
11727
  });
12460
- var setLogLevelInput = z5.strictObject({
12461
- level: z5.enum(["silent", "error", "warn", "info", "debug", "trace"])
11728
+ var setLogLevelInput = z4.strictObject({
11729
+ level: z4.enum(["silent", "error", "warn", "info", "debug", "trace"])
12462
11730
  });
12463
- var setStateInput = z5.strictObject({
12464
- store: z5.string(),
12465
- key: z5.string(),
11731
+ var setStateInput = z4.strictObject({
11732
+ store: z4.string(),
11733
+ key: z4.string(),
12466
11734
  value: requiredUnknown
12467
11735
  });
12468
- var lifecycleInput = z5.strictObject({
12469
- phase: z5.enum(["hibernate", "close", "compact"]),
12470
- trigger: z5.enum(["manual", "hibernate"]).optional()
11736
+ var lifecycleInput = z4.strictObject({
11737
+ phase: z4.enum(["hibernate", "close", "compact"]),
11738
+ trigger: z4.enum(["manual", "hibernate"]).optional()
12471
11739
  });
12472
- var reconfigureInputSchema = z5.strictObject({
12473
- model: z5.string().trim().min(1).optional(),
12474
- thinking: z5.enum(["adaptive", "enabled", "disabled"]).optional(),
12475
- effort: z5.enum(["low", "medium", "high", "xhigh", "max"]).optional()
11740
+ var reconfigureInputSchema = z4.strictObject({
11741
+ model: z4.string().trim().min(1).optional(),
11742
+ thinking: z4.enum(["adaptive", "enabled", "disabled"]).optional(),
11743
+ effort: z4.enum(["low", "medium", "high", "xhigh", "max"]).optional()
12476
11744
  }).refine((p) => p.model !== void 0 || p.thinking !== void 0 || p.effort !== void 0, {
12477
11745
  message: "a reconfigure names at least one of model, thinking, effort"
12478
11746
  });
@@ -13100,7 +12368,7 @@ var TurnStatusTracker = class {
13100
12368
  var WS_AUTH_TOKEN_ENV = "SKAILE_WS_AUTH_TOKEN";
13101
12369
  var WS_AUTH_TOKEN_FILE_ENV = "SKAILE_WS_AUTH_TOKEN_FILE";
13102
12370
  var nodeFs = { readFileSync: readFileSync, unlinkSync };
13103
- function takeRunnerWsAuthToken(env = process.env, fs9 = nodeFs) {
12371
+ function takeRunnerWsAuthToken(env = process.env, fs6 = nodeFs) {
13104
12372
  const filePath = env[WS_AUTH_TOKEN_FILE_ENV];
13105
12373
  const envToken = env[WS_AUTH_TOKEN_ENV];
13106
12374
  delete env[WS_AUTH_TOKEN_FILE_ENV];
@@ -13108,14 +12376,14 @@ function takeRunnerWsAuthToken(env = process.env, fs9 = nodeFs) {
13108
12376
  if (filePath) {
13109
12377
  let token;
13110
12378
  try {
13111
- token = fs9.readFileSync(filePath, "utf8").trim();
12379
+ token = fs6.readFileSync(filePath, "utf8").trim();
13112
12380
  } catch (err) {
13113
12381
  const code = err.code ?? "unknown";
13114
12382
  throw new Error(`${WS_AUTH_TOKEN_FILE_ENV} is set but the file cannot be read (${code})`);
13115
12383
  }
13116
12384
  if (!token) throw new Error(`${WS_AUTH_TOKEN_FILE_ENV} names an empty file`);
13117
12385
  try {
13118
- fs9.unlinkSync(filePath);
12386
+ fs6.unlinkSync(filePath);
13119
12387
  return { token, source: "file" };
13120
12388
  } catch (err) {
13121
12389
  return {
@@ -13337,8 +12605,8 @@ async function buildStoreSnapshotReplay(manager, activeFlows) {
13337
12605
  }
13338
12606
  async function guardClaudeAiConnectors(home, serverLog) {
13339
12607
  try {
13340
- const path11 = await ensureClaudeSettingsDisablesConnectors(home);
13341
- serverLog.info("claude.ai connectors disabled in user settings", { path: path11 });
12608
+ const path8 = await ensureClaudeSettingsDisablesConnectors(home);
12609
+ serverLog.info("claude.ai connectors disabled in user settings", { path: path8 });
13342
12610
  } catch (err) {
13343
12611
  serverLog.warn(
13344
12612
  "failed to disable claude.ai connectors in user settings \u2014 relying on env only",
@@ -17023,16 +16291,16 @@ var SESSIONS_SUBDIR = "sessions";
17023
16291
  var CURRENT_FILE = "current";
17024
16292
  var LEGACY_FILE = "session.json";
17025
16293
  function sessionsDir(projectDir) {
17026
- return path3.join(projectDir, SESSION_DIR, SESSIONS_SUBDIR);
16294
+ return path4.join(projectDir, SESSION_DIR, SESSIONS_SUBDIR);
17027
16295
  }
17028
16296
  function sessionFilePath(projectDir, runId) {
17029
- return path3.join(sessionsDir(projectDir), `${runId}.json`);
16297
+ return path4.join(sessionsDir(projectDir), `${runId}.json`);
17030
16298
  }
17031
16299
  function currentPointerPath(projectDir) {
17032
- return path3.join(projectDir, SESSION_DIR, CURRENT_FILE);
16300
+ return path4.join(projectDir, SESSION_DIR, CURRENT_FILE);
17033
16301
  }
17034
16302
  function legacySessionPath(projectDir) {
17035
- return path3.join(projectDir, SESSION_DIR, LEGACY_FILE);
16303
+ return path4.join(projectDir, SESSION_DIR, LEGACY_FILE);
17036
16304
  }
17037
16305
  function parseSessionFile(raw) {
17038
16306
  const { driver, driverSessionId, ...rest } = JSON.parse(raw);
@@ -17046,23 +16314,23 @@ function parseSessionFile(raw) {
17046
16314
  async function migrateLegacySession(projectDir) {
17047
16315
  const legacyPath = legacySessionPath(projectDir);
17048
16316
  try {
17049
- const raw = await fs8.readFile(legacyPath, "utf-8");
16317
+ const raw = await fs5.readFile(legacyPath, "utf-8");
17050
16318
  const state = parseSessionFile(raw);
17051
- await fs8.mkdir(sessionsDir(projectDir), { recursive: true });
17052
- await fs8.writeFile(
16319
+ await fs5.mkdir(sessionsDir(projectDir), { recursive: true });
16320
+ await fs5.writeFile(
17053
16321
  sessionFilePath(projectDir, state.runId),
17054
16322
  JSON.stringify(state, null, 2),
17055
16323
  "utf-8"
17056
16324
  );
17057
- await fs8.writeFile(currentPointerPath(projectDir), state.runId, "utf-8");
17058
- await fs8.rm(legacyPath);
16325
+ await fs5.writeFile(currentPointerPath(projectDir), state.runId, "utf-8");
16326
+ await fs5.rm(legacyPath);
17059
16327
  } catch {
17060
16328
  }
17061
16329
  }
17062
16330
  async function loadSession(projectDir) {
17063
16331
  await migrateLegacySession(projectDir);
17064
16332
  try {
17065
- const runId = (await fs8.readFile(currentPointerPath(projectDir), "utf-8")).trim();
16333
+ const runId = (await fs5.readFile(currentPointerPath(projectDir), "utf-8")).trim();
17066
16334
  if (!runId) return null;
17067
16335
  return await loadSessionById(projectDir, runId);
17068
16336
  } catch {
@@ -17071,7 +16339,7 @@ async function loadSession(projectDir) {
17071
16339
  }
17072
16340
  async function loadSessionById(projectDir, runId) {
17073
16341
  try {
17074
- const raw = await fs8.readFile(sessionFilePath(projectDir, runId), "utf-8");
16342
+ const raw = await fs5.readFile(sessionFilePath(projectDir, runId), "utf-8");
17075
16343
  return parseSessionFile(raw);
17076
16344
  } catch {
17077
16345
  return null;
@@ -17081,7 +16349,7 @@ async function resolveSessionId(projectDir, idOrPrefix) {
17081
16349
  if (!idOrPrefix || /[\\/]/.test(idOrPrefix) || idOrPrefix.includes("..")) return null;
17082
16350
  let files;
17083
16351
  try {
17084
- files = await fs8.readdir(sessionsDir(projectDir));
16352
+ files = await fs5.readdir(sessionsDir(projectDir));
17085
16353
  } catch {
17086
16354
  return null;
17087
16355
  }
@@ -17100,12 +16368,12 @@ async function listSessions(projectDir) {
17100
16368
  await migrateLegacySession(projectDir);
17101
16369
  const dir = sessionsDir(projectDir);
17102
16370
  try {
17103
- const files = await fs8.readdir(dir);
16371
+ const files = await fs5.readdir(dir);
17104
16372
  const sessions = [];
17105
16373
  for (const file of files) {
17106
16374
  if (!file.endsWith(".json")) continue;
17107
16375
  try {
17108
- const raw = await fs8.readFile(path3.join(dir, file), "utf-8");
16376
+ const raw = await fs5.readFile(path4.join(dir, file), "utf-8");
17109
16377
  sessions.push(parseSessionFile(raw));
17110
16378
  } catch {
17111
16379
  }
@@ -17116,38 +16384,38 @@ async function listSessions(projectDir) {
17116
16384
  }
17117
16385
  }
17118
16386
  async function saveSession(projectDir, state, setCurrent = true) {
17119
- await fs8.mkdir(sessionsDir(projectDir), { recursive: true });
17120
- await fs8.writeFile(
16387
+ await fs5.mkdir(sessionsDir(projectDir), { recursive: true });
16388
+ await fs5.writeFile(
17121
16389
  sessionFilePath(projectDir, state.runId),
17122
16390
  JSON.stringify(state, null, 2),
17123
16391
  "utf-8"
17124
16392
  );
17125
16393
  if (setCurrent) {
17126
- await fs8.writeFile(currentPointerPath(projectDir), state.runId, "utf-8");
16394
+ await fs5.writeFile(currentPointerPath(projectDir), state.runId, "utf-8");
17127
16395
  }
17128
16396
  }
17129
16397
  async function setCurrentSession(projectDir, runId) {
17130
16398
  const exists = await loadSessionById(projectDir, runId);
17131
16399
  if (!exists) throw new Error(`Session not found: ${runId}`);
17132
- await fs8.mkdir(path3.join(projectDir, SESSION_DIR), { recursive: true });
17133
- await fs8.writeFile(currentPointerPath(projectDir), runId, "utf-8");
16400
+ await fs5.mkdir(path4.join(projectDir, SESSION_DIR), { recursive: true });
16401
+ await fs5.writeFile(currentPointerPath(projectDir), runId, "utf-8");
17134
16402
  }
17135
16403
  async function deleteSession(projectDir, runId) {
17136
16404
  try {
17137
- await fs8.rm(sessionFilePath(projectDir, runId));
16405
+ await fs5.rm(sessionFilePath(projectDir, runId));
17138
16406
  } catch {
17139
16407
  }
17140
16408
  try {
17141
- const current = (await fs8.readFile(currentPointerPath(projectDir), "utf-8")).trim();
16409
+ const current = (await fs5.readFile(currentPointerPath(projectDir), "utf-8")).trim();
17142
16410
  if (current === runId) {
17143
- await fs8.rm(currentPointerPath(projectDir));
16411
+ await fs5.rm(currentPointerPath(projectDir));
17144
16412
  }
17145
16413
  } catch {
17146
16414
  }
17147
16415
  }
17148
16416
  async function clearSession(projectDir) {
17149
16417
  try {
17150
- await fs8.rm(currentPointerPath(projectDir));
16418
+ await fs5.rm(currentPointerPath(projectDir));
17151
16419
  } catch {
17152
16420
  }
17153
16421
  }
@@ -17159,6 +16427,6 @@ function touchSession(state) {
17159
16427
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
17160
16428
  }
17161
16429
 
17162
- export { AgentRunError, CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, CompileManifestEntrySchema, CompositionError, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, DEFAULT_MAX_FINISHED_TREES, DEFAULT_RUN_LIMITS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MOUNT_WRITE_MAX_CHUNK_BYTES, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, UnknownCompositionKindError, WRITE_RANGE_PARTIAL_TTL_MS, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildCompositionRunSnapshot, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildRunnerAgentSections, buildStoreSnapshotReplay, builtinCapabilities, canonicalJson, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compileComposition, compositionRunSnapshotPath, computeCapabilitySignature, computeDirectoryTotals, computeRevisionHash, connectorRefreshKind, createAgentSession, createCompositionContentSource, createFinalTextFallback, createFlowConnectorReadiness, createInMemoryRunStore, createManagedCodexSubpromptHarness, createRunController, createSessionStimulusBus, defineCapability, deleteSession, describeComposition, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsHarnessRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, harnessActiveAfterTurnEnd, hasNonTerminalFlow, hashAgentFiles, hashContent, hostOpResumeStimulus, installPreInitRingSink, instanceForSession, instanceSessionOverrides, isCompilePinCurrent, isCompositionError, isEmptyKnowledgeIndex, isSessionRootPathAllowed, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadCompositionRunSnapshot, loadKnowledgeDir, loadManagedCodexHostConfig, loadSession, loadSessionById, logConnectorReport, manifestModelForHarness, mcpAuthSecretKey, modelForHarness, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentInstance, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveInstanceAgentDir, resolveMixin, resolveSessionId, restoredRunHasWorkToResume, runAgentChat, saveCompositionRunSnapshot, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, stripFrontmatter, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, unresolvedCredentialNotices, validateInputResponse, verifyConventionItems, writeClaudeCodeCredentialsFile, writeRangeChunk, writeRangePartialPath };
17163
- //# sourceMappingURL=chunk-YLKOCMU7.js.map
17164
- //# sourceMappingURL=chunk-YLKOCMU7.js.map
16430
+ export { AgentRunError, CLAUDE_CODE_CREDENTIALS_KEY, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, DEFAULT_MAX_FINISHED_TREES, DEFAULT_RUN_LIMITS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MOUNT_WRITE_MAX_CHUNK_BYTES, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WRITE_RANGE_PARTIAL_TTL_MS, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildCompositionRunSnapshot, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, canonicalJson, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compositionRunSnapshotPath, computeCapabilitySignature, computeDirectoryTotals, computeRevisionHash, connectorRefreshKind, createAgentSession, createFinalTextFallback, createFlowConnectorReadiness, createInMemoryRunStore, createManagedCodexSubpromptHarness, createRunController, createSessionStimulusBus, defineCapability, deleteSession, describeComposition, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsHarnessRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, harnessActiveAfterTurnEnd, hasNonTerminalFlow, hashAgentFiles, hostOpResumeStimulus, installPreInitRingSink, instanceForSession, instanceSessionOverrides, isSessionRootPathAllowed, listSessions, loadAgentManifest, loadCompositionRunSnapshot, loadManagedCodexHostConfig, loadSession, loadSessionById, logConnectorReport, manifestModelForHarness, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentInstance, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveInstanceAgentDir, resolveSessionId, restoredRunHasWorkToResume, runAgentChat, saveCompositionRunSnapshot, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, unresolvedCredentialNotices, validateInputResponse, verifyConventionItems, writeClaudeCodeCredentialsFile, writeRangeChunk, writeRangePartialPath };
16431
+ //# sourceMappingURL=chunk-U6UFPOEK.js.map
16432
+ //# sourceMappingURL=chunk-U6UFPOEK.js.map