@skaile/workspaces 5.19.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (757) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +8 -8
  3. package/dist/app-sdk/index.js +1 -1
  4. package/dist/{asset-feeds-QGLI3AXI.js → asset-feeds-HJFV7UPW.js} +32 -24
  5. package/dist/asset-feeds-HJFV7UPW.js.map +1 -0
  6. package/dist/asset-manager/catalog-deployer.js +12 -12
  7. package/dist/asset-manager/index.js +19 -19
  8. package/dist/asset-manager/installer.js +14 -14
  9. package/dist/asset-manager/renderers.js +13 -13
  10. package/dist/asset-manager/src/index.d.ts +214 -27
  11. package/dist/asset-manager/src/index.d.ts.map +1 -1
  12. package/dist/asset-manager/src/install-agent.d.ts +2 -2
  13. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  14. package/dist/asset-manager/src/install-instances.d.ts +8 -8
  15. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  16. package/dist/asset-manager/src/installer.d.ts +34 -3
  17. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  18. package/dist/asset-manager/src/mcp-config.d.ts +35 -14
  19. package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
  20. package/dist/asset-manager/src/renderers.d.ts +12 -12
  21. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  22. package/dist/bridge/codex-app-server.js +2 -2
  23. package/dist/bridge/harnesses/claude-sdk.d.ts +2 -0
  24. package/dist/bridge/{drivers → harnesses}/claude-sdk.js +69 -73
  25. package/dist/bridge/harnesses/claude-sdk.js.map +1 -0
  26. package/dist/bridge/{drivers/gemini.d.ts → harnesses/codex.d.ts} +1 -1
  27. package/dist/bridge/{drivers → harnesses}/codex.js +53 -53
  28. package/dist/bridge/harnesses/codex.js.map +1 -0
  29. package/dist/bridge/{drivers/claude-sdk.d.ts → harnesses/continue.d.ts} +1 -1
  30. package/dist/bridge/{drivers → harnesses}/continue.js +30 -30
  31. package/dist/bridge/harnesses/continue.js.map +1 -0
  32. package/dist/bridge/{drivers → harnesses}/echo.d.ts +1 -1
  33. package/dist/bridge/{drivers → harnesses}/echo.js +27 -27
  34. package/dist/bridge/harnesses/echo.js.map +1 -0
  35. package/dist/bridge/{drivers/continue.d.ts → harnesses/gemini.d.ts} +1 -1
  36. package/dist/bridge/harnesses/gemini.js +18 -0
  37. package/dist/bridge/{drivers → harnesses}/goose.d.ts +1 -1
  38. package/dist/bridge/{drivers → harnesses}/goose.js +30 -30
  39. package/dist/bridge/harnesses/goose.js.map +1 -0
  40. package/dist/bridge/{drivers → harnesses}/omp.d.ts +1 -1
  41. package/dist/bridge/{drivers → harnesses}/omp.js +31 -31
  42. package/dist/bridge/harnesses/omp.js.map +1 -0
  43. package/dist/bridge/{drivers → harnesses}/opencode.d.ts +1 -1
  44. package/dist/bridge/{drivers → harnesses}/opencode.js +31 -31
  45. package/dist/bridge/harnesses/opencode.js.map +1 -0
  46. package/dist/bridge/{drivers → harnesses}/qwen.d.ts +1 -1
  47. package/dist/bridge/{drivers → harnesses}/qwen.js +20 -20
  48. package/dist/bridge/harnesses/qwen.js.map +1 -0
  49. package/dist/bridge/index.js +25 -25
  50. package/dist/bridge/src/agent-exec.d.ts +2 -2
  51. package/dist/bridge/src/agent-transcript.d.ts +1 -1
  52. package/dist/bridge/src/agent-transcript.d.ts.map +1 -1
  53. package/dist/bridge/src/approval-card.d.ts +3 -3
  54. package/dist/bridge/src/capability-dispatch.d.ts +5 -5
  55. package/dist/bridge/src/claude-sdk-surface.d.ts +17 -0
  56. package/dist/bridge/src/claude-sdk-surface.d.ts.map +1 -0
  57. package/dist/bridge/src/cloud.d.ts +4 -4
  58. package/dist/bridge/src/codex/config-toml.d.ts +3 -3
  59. package/dist/bridge/src/codex/friendly-error.d.ts +1 -1
  60. package/dist/bridge/src/codex/friendly-error.d.ts.map +1 -1
  61. package/dist/bridge/src/codex/{managed-driver.d.ts → managed-harness.d.ts} +5 -5
  62. package/dist/bridge/src/codex/managed-harness.d.ts.map +1 -0
  63. package/dist/bridge/src/codex/native-approvals.d.ts +1 -1
  64. package/dist/bridge/src/codex/native-approvals.d.ts.map +1 -1
  65. package/dist/bridge/src/error-classifier.d.ts +7 -7
  66. package/dist/bridge/src/{driver-capabilities.d.ts → harness-capabilities.d.ts} +18 -18
  67. package/dist/bridge/src/harness-capabilities.d.ts.map +1 -0
  68. package/dist/bridge/src/harness-model-check.d.ts +40 -0
  69. package/dist/bridge/src/harness-model-check.d.ts.map +1 -0
  70. package/dist/bridge/src/{drivers → harnesses}/_subprocess-cli.d.ts +8 -8
  71. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -0
  72. package/dist/bridge/src/{drivers → harnesses}/claude-context-usage.d.ts +5 -5
  73. package/dist/bridge/src/harnesses/claude-context-usage.d.ts.map +1 -0
  74. package/dist/bridge/src/{drivers → harnesses}/claude-sdk.d.ts +27 -27
  75. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -0
  76. package/dist/bridge/src/{drivers → harnesses}/claude-self-turns.d.ts +5 -5
  77. package/dist/bridge/src/harnesses/claude-self-turns.d.ts.map +1 -0
  78. package/dist/bridge/src/{drivers → harnesses}/claude-tool-allowlist.d.ts +4 -4
  79. package/dist/bridge/src/harnesses/claude-tool-allowlist.d.ts.map +1 -0
  80. package/dist/bridge/src/{drivers → harnesses}/codex.d.ts +14 -14
  81. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -0
  82. package/dist/bridge/src/{drivers → harnesses}/continue.d.ts +12 -12
  83. package/dist/bridge/src/harnesses/continue.d.ts.map +1 -0
  84. package/dist/bridge/src/{drivers → harnesses}/echo.d.ts +16 -16
  85. package/dist/bridge/src/harnesses/echo.d.ts.map +1 -0
  86. package/dist/bridge/src/{drivers → harnesses}/flow-script.d.ts +9 -9
  87. package/dist/bridge/src/harnesses/flow-script.d.ts.map +1 -0
  88. package/dist/bridge/src/{drivers → harnesses}/gemini.d.ts +15 -15
  89. package/dist/bridge/src/harnesses/gemini.d.ts.map +1 -0
  90. package/dist/bridge/src/{drivers → harnesses}/goose.d.ts +10 -10
  91. package/dist/bridge/src/harnesses/goose.d.ts.map +1 -0
  92. package/dist/bridge/src/{drivers → harnesses}/omp-models-yml.d.ts +12 -12
  93. package/dist/bridge/src/harnesses/omp-models-yml.d.ts.map +1 -0
  94. package/dist/bridge/src/{drivers → harnesses}/omp.d.ts +23 -23
  95. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -0
  96. package/dist/bridge/src/{drivers → harnesses}/opencode.d.ts +11 -11
  97. package/dist/bridge/src/harnesses/opencode.d.ts.map +1 -0
  98. package/dist/bridge/src/{drivers → harnesses}/qwen.d.ts +12 -12
  99. package/dist/bridge/src/harnesses/qwen.d.ts.map +1 -0
  100. package/dist/bridge/src/{drivers → harnesses}/recovery-policy.d.ts +4 -4
  101. package/dist/bridge/src/harnesses/recovery-policy.d.ts.map +1 -0
  102. package/dist/bridge/src/{drivers → harnesses}/resume-probe.d.ts +3 -3
  103. package/dist/bridge/src/harnesses/resume-probe.d.ts.map +1 -0
  104. package/dist/bridge/src/{drivers → harnesses}/sanitize-assistant-text.d.ts +1 -1
  105. package/dist/bridge/src/harnesses/sanitize-assistant-text.d.ts.map +1 -0
  106. package/dist/bridge/src/{drivers → harnesses}/scrub-transcript.d.ts +1 -1
  107. package/dist/bridge/src/harnesses/scrub-transcript.d.ts.map +1 -0
  108. package/dist/bridge/src/index.d.ts +5 -4
  109. package/dist/bridge/src/index.d.ts.map +1 -1
  110. package/dist/bridge/src/logger.d.ts +4 -4
  111. package/dist/bridge/src/models.d.ts +1 -1
  112. package/dist/bridge/src/normalizer.d.ts +5 -3
  113. package/dist/bridge/src/normalizer.d.ts.map +1 -1
  114. package/dist/bridge/src/provider-materialize/continue-config-yaml.d.ts +5 -5
  115. package/dist/bridge/src/provider-materialize/continue-config-yaml.d.ts.map +1 -1
  116. package/dist/bridge/src/provider-materialize/credential-env.d.ts +3 -3
  117. package/dist/bridge/src/provider-materialize/{env-drivers.d.ts → env-harnesses.d.ts} +19 -19
  118. package/dist/bridge/src/provider-materialize/env-harnesses.d.ts.map +1 -0
  119. package/dist/bridge/src/provider-materialize/goose-custom-providers.d.ts +5 -5
  120. package/dist/bridge/src/provider-materialize/goose-custom-providers.d.ts.map +1 -1
  121. package/dist/bridge/src/provider-materialize/opencode-config.d.ts +7 -7
  122. package/dist/bridge/src/provider-materialize/opencode-config.d.ts.map +1 -1
  123. package/dist/bridge/src/provider-materialize/session-config-home.d.ts +5 -5
  124. package/dist/bridge/src/provider-materialize/session-config-home.d.ts.map +1 -1
  125. package/dist/bridge/src/provider-registry-derive.d.ts +4 -4
  126. package/dist/bridge/src/provider-registry-derive.d.ts.map +1 -1
  127. package/dist/bridge/src/reconfigure-ledger.d.ts +8 -8
  128. package/dist/bridge/src/reconfigure-ledger.d.ts.map +1 -1
  129. package/dist/bridge/src/registry.d.ts +34 -41
  130. package/dist/bridge/src/registry.d.ts.map +1 -1
  131. package/dist/bridge/src/runner-private-env.d.ts +2 -2
  132. package/dist/bridge/src/runtime.d.ts +11 -11
  133. package/dist/bridge/src/runtime.d.ts.map +1 -1
  134. package/dist/bridge/src/types.d.ts +158 -158
  135. package/dist/bridge/src/types.d.ts.map +1 -1
  136. package/dist/{chunk-7NT4F6SR.js → chunk-2LAPHLDH.js} +587 -521
  137. package/dist/chunk-2LAPHLDH.js.map +1 -0
  138. package/dist/{chunk-25ZVWL2R.js → chunk-3GMOPFWH.js} +4 -4
  139. package/dist/{chunk-25ZVWL2R.js.map → chunk-3GMOPFWH.js.map} +1 -1
  140. package/dist/{chunk-X5YPJV4N.js → chunk-3MWQKQUB.js} +2 -2
  141. package/dist/{chunk-X5YPJV4N.js.map → chunk-3MWQKQUB.js.map} +1 -1
  142. package/dist/{chunk-EPBKISS5.js → chunk-3TG2NV2F.js} +2 -2
  143. package/dist/chunk-3TG2NV2F.js.map +1 -0
  144. package/dist/{chunk-L2AMXONH.js → chunk-3X7VTCPG.js} +2 -2
  145. package/dist/chunk-3X7VTCPG.js.map +1 -0
  146. package/dist/{chunk-VIM3PWZM.js → chunk-4FVIT5DI.js} +3 -3
  147. package/dist/{chunk-VIM3PWZM.js.map → chunk-4FVIT5DI.js.map} +1 -1
  148. package/dist/{chunk-IF6IA3PZ.js → chunk-4MUDQCBP.js} +4 -4
  149. package/dist/{chunk-IF6IA3PZ.js.map → chunk-4MUDQCBP.js.map} +1 -1
  150. package/dist/{chunk-MKRWN7XP.js → chunk-5J4NPGFM.js} +5 -5
  151. package/dist/chunk-5J4NPGFM.js.map +1 -0
  152. package/dist/{chunk-5TBFN46Z.js → chunk-5KRMNUL4.js} +4 -4
  153. package/dist/chunk-5KRMNUL4.js.map +1 -0
  154. package/dist/{chunk-7SCS64BG.js → chunk-5Y2KGB4H.js} +109 -74
  155. package/dist/chunk-5Y2KGB4H.js.map +1 -0
  156. package/dist/{chunk-YIF2IJUA.js → chunk-6GWSDPBP.js} +3 -3
  157. package/dist/{chunk-YIF2IJUA.js.map → chunk-6GWSDPBP.js.map} +1 -1
  158. package/dist/{chunk-WST6UITC.js → chunk-6YR4ALVX.js} +17 -17
  159. package/dist/chunk-6YR4ALVX.js.map +1 -0
  160. package/dist/{chunk-YROR332M.js → chunk-7DN6JKP2.js} +2 -2
  161. package/dist/chunk-7DN6JKP2.js.map +1 -0
  162. package/dist/{chunk-IZCR27MU.js → chunk-7EKQDY2T.js} +3 -3
  163. package/dist/chunk-7EKQDY2T.js.map +1 -0
  164. package/dist/chunk-7HX6FNKL.js +317 -0
  165. package/dist/chunk-7HX6FNKL.js.map +1 -0
  166. package/dist/{chunk-COJIL7G4.js → chunk-7LP7RCZI.js} +7 -7
  167. package/dist/chunk-7LP7RCZI.js.map +1 -0
  168. package/dist/{chunk-2PBSAH3Z.js → chunk-AATHJRKL.js} +4 -4
  169. package/dist/{chunk-2PBSAH3Z.js.map → chunk-AATHJRKL.js.map} +1 -1
  170. package/dist/{chunk-C7WBGSBV.js → chunk-ABFPSVIS.js} +10 -10
  171. package/dist/chunk-ABFPSVIS.js.map +1 -0
  172. package/dist/{chunk-ICSCSM5D.js → chunk-ADPM6AYF.js} +3 -3
  173. package/dist/{chunk-ICSCSM5D.js.map → chunk-ADPM6AYF.js.map} +1 -1
  174. package/dist/{chunk-WOIRYY5L.js → chunk-AITJ7ELM.js} +141 -27
  175. package/dist/chunk-AITJ7ELM.js.map +1 -0
  176. package/dist/{chunk-HU5HVKY7.js → chunk-ASWTQQ7E.js} +4 -4
  177. package/dist/{chunk-HU5HVKY7.js.map → chunk-ASWTQQ7E.js.map} +1 -1
  178. package/dist/{chunk-RO6VOM6Z.js → chunk-AZ2H6R5I.js} +51 -25
  179. package/dist/chunk-AZ2H6R5I.js.map +1 -0
  180. package/dist/{chunk-I7TWVK6N.js → chunk-BBBCJSSU.js} +4 -4
  181. package/dist/{chunk-I7TWVK6N.js.map → chunk-BBBCJSSU.js.map} +1 -1
  182. package/dist/{chunk-AJ7EGIFR.js → chunk-BIRW3HOG.js} +3 -3
  183. package/dist/chunk-BIRW3HOG.js.map +1 -0
  184. package/dist/{chunk-FPHNJE4M.js → chunk-CEKW3KXP.js} +91 -30
  185. package/dist/chunk-CEKW3KXP.js.map +1 -0
  186. package/dist/{chunk-F6AA42GW.js → chunk-COYF6IG2.js} +5 -5
  187. package/dist/{chunk-F6AA42GW.js.map → chunk-COYF6IG2.js.map} +1 -1
  188. package/dist/{chunk-HT35SQZD.js → chunk-DGTI65OC.js} +30 -30
  189. package/dist/chunk-DGTI65OC.js.map +1 -0
  190. package/dist/{chunk-W4Q6CKJ5.js → chunk-DIGFA7Z5.js} +11 -11
  191. package/dist/chunk-DIGFA7Z5.js.map +1 -0
  192. package/dist/{chunk-335ENCCS.js → chunk-E572OHGY.js} +2 -2
  193. package/dist/{chunk-335ENCCS.js.map → chunk-E572OHGY.js.map} +1 -1
  194. package/dist/{chunk-Y5MBW5EU.js → chunk-EJPMNDTP.js} +3 -3
  195. package/dist/{chunk-Y5MBW5EU.js.map → chunk-EJPMNDTP.js.map} +1 -1
  196. package/dist/chunk-EX3GLAL6.js +31 -0
  197. package/dist/chunk-EX3GLAL6.js.map +1 -0
  198. package/dist/{chunk-XWOPZW26.js → chunk-FKQNBCDW.js} +38 -38
  199. package/dist/chunk-FKQNBCDW.js.map +1 -0
  200. package/dist/{chunk-6E6PKKAD.js → chunk-G5SUWZEU.js} +18 -8
  201. package/dist/chunk-G5SUWZEU.js.map +1 -0
  202. package/dist/{chunk-2GXSSZAM.js → chunk-GNZBFSRB.js} +12 -12
  203. package/dist/chunk-GNZBFSRB.js.map +1 -0
  204. package/dist/{chunk-PYJS5K7V.js → chunk-HMISULVD.js} +5 -5
  205. package/dist/{chunk-PYJS5K7V.js.map → chunk-HMISULVD.js.map} +1 -1
  206. package/dist/{chunk-IP2IPMEH.js → chunk-HPMQRAIF.js} +18 -18
  207. package/dist/chunk-HPMQRAIF.js.map +1 -0
  208. package/dist/{chunk-MRHVPQNO.js → chunk-HWNK3F3X.js} +1015 -189
  209. package/dist/chunk-HWNK3F3X.js.map +1 -0
  210. package/dist/{chunk-ZQSOJH6I.js → chunk-IHFGPHCT.js} +141 -341
  211. package/dist/chunk-IHFGPHCT.js.map +1 -0
  212. package/dist/{chunk-CQJH4G2K.js → chunk-ILLTBKDJ.js} +101 -102
  213. package/dist/chunk-ILLTBKDJ.js.map +1 -0
  214. package/dist/{chunk-FKU57Q5Q.js → chunk-IRYKRKVQ.js} +3 -3
  215. package/dist/{chunk-FKU57Q5Q.js.map → chunk-IRYKRKVQ.js.map} +1 -1
  216. package/dist/{chunk-J24CY3PF.js → chunk-J72MO2WA.js} +39 -39
  217. package/dist/chunk-J72MO2WA.js.map +1 -0
  218. package/dist/{chunk-Y56YIT6J.js → chunk-JCPD4QRM.js} +4 -4
  219. package/dist/chunk-JCPD4QRM.js.map +1 -0
  220. package/dist/{chunk-X3RMRJNR.js → chunk-JRN5QF4C.js} +8 -3
  221. package/dist/chunk-JRN5QF4C.js.map +1 -0
  222. package/dist/{chunk-K4O6L3WH.js → chunk-KNY356I3.js} +3 -3
  223. package/dist/{chunk-K4O6L3WH.js.map → chunk-KNY356I3.js.map} +1 -1
  224. package/dist/{chunk-XJVBUDDJ.js → chunk-KUQAJVYT.js} +8 -8
  225. package/dist/chunk-KUQAJVYT.js.map +1 -0
  226. package/dist/{chunk-4ZTPYIBE.js → chunk-KW37WNXY.js} +12 -12
  227. package/dist/chunk-KW37WNXY.js.map +1 -0
  228. package/dist/{chunk-MJHSLODD.js → chunk-LSI2IVFT.js} +2 -2
  229. package/dist/chunk-LSI2IVFT.js.map +1 -0
  230. package/dist/{chunk-WDXZA7QW.js → chunk-LSSYC5IC.js} +2 -2
  231. package/dist/{chunk-WDXZA7QW.js.map → chunk-LSSYC5IC.js.map} +1 -1
  232. package/dist/{chunk-WG6V4ISA.js → chunk-NB7SYQYP.js} +7 -7
  233. package/dist/{chunk-WG6V4ISA.js.map → chunk-NB7SYQYP.js.map} +1 -1
  234. package/dist/{chunk-EAZECHPM.js → chunk-NBAGV6L2.js} +5 -5
  235. package/dist/chunk-NBAGV6L2.js.map +1 -0
  236. package/dist/{chunk-JTOWA6RS.js → chunk-NUA33BYO.js} +181 -64
  237. package/dist/chunk-NUA33BYO.js.map +1 -0
  238. package/dist/{chunk-A6SMCEEE.js → chunk-QAKUD6QN.js} +11 -11
  239. package/dist/{chunk-A6SMCEEE.js.map → chunk-QAKUD6QN.js.map} +1 -1
  240. package/dist/{chunk-QG6GHTRM.js → chunk-QEULL4Q3.js} +8 -8
  241. package/dist/chunk-QEULL4Q3.js.map +1 -0
  242. package/dist/{chunk-ZX4KRWRB.js → chunk-QSYQOTWN.js} +4 -4
  243. package/dist/{chunk-ZX4KRWRB.js.map → chunk-QSYQOTWN.js.map} +1 -1
  244. package/dist/{chunk-X4ZZTHU3.js → chunk-RDTLPOPD.js} +4 -4
  245. package/dist/{chunk-X4ZZTHU3.js.map → chunk-RDTLPOPD.js.map} +1 -1
  246. package/dist/{chunk-GOCWM7FN.js → chunk-RHN5MRQO.js} +21 -4
  247. package/dist/chunk-RHN5MRQO.js.map +1 -0
  248. package/dist/{chunk-XM6T2AZ2.js → chunk-S2XHGWQC.js} +162 -124
  249. package/dist/chunk-S2XHGWQC.js.map +1 -0
  250. package/dist/{chunk-VJ7NU7GD.js → chunk-SVTMNSPI.js} +23 -6
  251. package/dist/chunk-SVTMNSPI.js.map +1 -0
  252. package/dist/{chunk-I37INEWE.js → chunk-UI745XC3.js} +10 -23
  253. package/dist/chunk-UI745XC3.js.map +1 -0
  254. package/dist/{chunk-N46LQR46.js → chunk-VMVDAZLA.js} +53 -30
  255. package/dist/chunk-VMVDAZLA.js.map +1 -0
  256. package/dist/{chunk-IG5LZ3WU.js → chunk-VTETQCR6.js} +10 -10
  257. package/dist/chunk-VTETQCR6.js.map +1 -0
  258. package/dist/{chunk-EFLKSMCO.js → chunk-VUJXZDCY.js} +5 -5
  259. package/dist/{chunk-EFLKSMCO.js.map → chunk-VUJXZDCY.js.map} +1 -1
  260. package/dist/{chunk-H6UVIKQ2.js → chunk-VYVTEMAW.js} +3 -3
  261. package/dist/{chunk-H6UVIKQ2.js.map → chunk-VYVTEMAW.js.map} +1 -1
  262. package/dist/{chunk-M3WPBTGJ.js → chunk-WD3L5QSU.js} +2 -2
  263. package/dist/{chunk-M3WPBTGJ.js.map → chunk-WD3L5QSU.js.map} +1 -1
  264. package/dist/{chunk-R6O6YWU7.js → chunk-WYZXSJBK.js} +3 -3
  265. package/dist/{chunk-R6O6YWU7.js.map → chunk-WYZXSJBK.js.map} +1 -1
  266. package/dist/{chunk-R4I3VBSS.js → chunk-X3YGUKCG.js} +5 -5
  267. package/dist/{chunk-R4I3VBSS.js.map → chunk-X3YGUKCG.js.map} +1 -1
  268. package/dist/{chunk-RPZVHXQ3.js → chunk-XFIEVEU7.js} +4 -4
  269. package/dist/chunk-XFIEVEU7.js.map +1 -0
  270. package/dist/{chunk-VSZWNUZC.js → chunk-XGULGQA3.js} +4 -4
  271. package/dist/chunk-XGULGQA3.js.map +1 -0
  272. package/dist/{chunk-Q6E6FM7P.js → chunk-XKNXPLKR.js} +6 -6
  273. package/dist/{chunk-Q6E6FM7P.js.map → chunk-XKNXPLKR.js.map} +1 -1
  274. package/dist/{chunk-7XSAW5OC.js → chunk-YLLVSR2U.js} +4 -4
  275. package/dist/{chunk-7XSAW5OC.js.map → chunk-YLLVSR2U.js.map} +1 -1
  276. package/dist/{chunk-6Z5KTFJT.js → chunk-Z3VKUWAX.js} +3 -3
  277. package/dist/{chunk-6Z5KTFJT.js.map → chunk-Z3VKUWAX.js.map} +1 -1
  278. package/dist/{chunk-5BEFNLOR.js → chunk-Z7ZEZZB6.js} +8 -8
  279. package/dist/chunk-Z7ZEZZB6.js.map +1 -0
  280. package/dist/{chunk-2LSDMJI2.js → chunk-ZAELRYKS.js} +4 -4
  281. package/dist/{chunk-2LSDMJI2.js.map → chunk-ZAELRYKS.js.map} +1 -1
  282. package/dist/{chunk-UQ33Y4DM.js → chunk-ZBHZLWV3.js} +4 -4
  283. package/dist/{chunk-UQ33Y4DM.js.map → chunk-ZBHZLWV3.js.map} +1 -1
  284. package/dist/{chunk-TIIXG3PN.js → chunk-ZDLUQLI6.js} +4 -4
  285. package/dist/{chunk-TIIXG3PN.js.map → chunk-ZDLUQLI6.js.map} +1 -1
  286. package/dist/{chunk-PHRNUTSG.js → chunk-ZFUZ5AKM.js} +4 -4
  287. package/dist/{chunk-PHRNUTSG.js.map → chunk-ZFUZ5AKM.js.map} +1 -1
  288. package/dist/{chunk-V257LUBM.js → chunk-ZHGKAZJ7.js} +251 -26
  289. package/dist/chunk-ZHGKAZJ7.js.map +1 -0
  290. package/dist/claude-code-RE46FJXI.js +10 -0
  291. package/dist/{claude-code-2PU7TITZ.js.map → claude-code-RE46FJXI.js.map} +1 -1
  292. package/dist/cli/index.js +1066 -647
  293. package/dist/cli/index.js.map +1 -1
  294. package/dist/cli/src/agent-pins.d.ts +11 -0
  295. package/dist/cli/src/agent-pins.d.ts.map +1 -1
  296. package/dist/cli/src/commands/catalog.d.ts +4 -4
  297. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  298. package/dist/cli/src/commands/complete-resolvers.d.ts.map +1 -1
  299. package/dist/cli/src/commands/config.d.ts +2 -2
  300. package/dist/cli/src/commands/config.d.ts.map +1 -1
  301. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  302. package/dist/cli/src/commands/harness.d.ts +24 -0
  303. package/dist/cli/src/commands/harness.d.ts.map +1 -0
  304. package/dist/cli/src/commands/integration.d.ts +1 -1
  305. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  306. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  307. package/dist/cli/src/commands/library-index.d.ts +20 -2
  308. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  309. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  310. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  311. package/dist/cli/src/commands/migrate-files.d.ts +14 -0
  312. package/dist/cli/src/commands/migrate-files.d.ts.map +1 -1
  313. package/dist/cli/src/commands/migrate-harness.d.ts +49 -0
  314. package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -0
  315. package/dist/cli/src/commands/migrate.d.ts +4 -2
  316. package/dist/cli/src/commands/migrate.d.ts.map +1 -1
  317. package/dist/cli/src/commands/plugin/types.d.ts +1 -6
  318. package/dist/cli/src/commands/plugin/types.d.ts.map +1 -1
  319. package/dist/cli/src/commands/plugin-registry-cmd.d.ts +1 -1
  320. package/dist/cli/src/commands/preset-export.d.ts +1 -1
  321. package/dist/cli/src/commands/project.d.ts +20 -2
  322. package/dist/cli/src/commands/project.d.ts.map +1 -1
  323. package/dist/cli/src/commands/run.d.ts +2 -2
  324. package/dist/cli/src/commands/run.d.ts.map +1 -1
  325. package/dist/cli/src/commands/serve-preflight.d.ts +11 -11
  326. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  327. package/dist/cli/src/commands/serve.d.ts +1 -1
  328. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  329. package/dist/cli/src/commands/session-logs/local-query.d.ts +2 -0
  330. package/dist/cli/src/commands/session-logs/local-query.d.ts.map +1 -1
  331. package/dist/cli/src/commands/source.d.ts +9 -2
  332. package/dist/cli/src/commands/source.d.ts.map +1 -1
  333. package/dist/cli/src/commands/store.d.ts.map +1 -1
  334. package/dist/cli/src/commands/update.d.ts.map +1 -1
  335. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  336. package/dist/cli/src/config-checks.d.ts +37 -0
  337. package/dist/cli/src/config-checks.d.ts.map +1 -0
  338. package/dist/cli/src/harness-error.d.ts +47 -0
  339. package/dist/cli/src/harness-error.d.ts.map +1 -0
  340. package/dist/cli/src/helpers.d.ts +5 -5
  341. package/dist/cli/src/helpers.d.ts.map +1 -1
  342. package/dist/cli/src/plugin-store/index.d.ts +2 -2
  343. package/dist/cli/src/setup.d.ts +3 -3
  344. package/dist/cli/src/setup.d.ts.map +1 -1
  345. package/dist/cli/src/skill-checks.d.ts +27 -0
  346. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  347. package/dist/cli/src/store-addable.d.ts +11 -0
  348. package/dist/cli/src/store-addable.d.ts.map +1 -1
  349. package/dist/connectors/config.js +6 -6
  350. package/dist/connectors/index.js +31 -31
  351. package/dist/connectors/src/connector-prompt.d.ts +5 -5
  352. package/dist/connectors/src/connector-registry.d.ts +1 -1
  353. package/dist/connectors-7THEF7YA.js +48 -0
  354. package/dist/{connectors-RBGZ3M7G.js.map → connectors-7THEF7YA.js.map} +1 -1
  355. package/dist/connectors-shared/index.js +2 -2
  356. package/dist/core/framework.js +1 -1
  357. package/dist/{bridge/drivers/codex.d.ts → core/harness-targets.d.ts} +1 -1
  358. package/dist/core/harness-targets.js +4 -0
  359. package/dist/core/harness-targets.js.map +1 -0
  360. package/dist/core/index.js +11 -11
  361. package/dist/core/manifest.js +2 -2
  362. package/dist/core/models.js +1 -1
  363. package/dist/core/provider-registry-credentials.js +2 -2
  364. package/dist/core/provider-registry.js +1 -1
  365. package/dist/core/publish-manifest.js +3 -3
  366. package/dist/core/ref.js +1 -1
  367. package/dist/core/runtime-assets.js +6 -6
  368. package/dist/core/src/agent-instances.d.ts.map +1 -1
  369. package/dist/core/src/asset-roots.d.ts +2 -2
  370. package/dist/core/src/config-key-diagnostics.d.ts +9 -0
  371. package/dist/core/src/config-key-diagnostics.d.ts.map +1 -0
  372. package/dist/core/src/framework.d.ts +21 -21
  373. package/dist/core/src/framework.d.ts.map +1 -1
  374. package/dist/core/src/{driver-sdk.d.ts → harness-sdk.d.ts} +9 -9
  375. package/dist/core/src/harness-sdk.d.ts.map +1 -0
  376. package/dist/core/src/harness-targets.d.ts +71 -0
  377. package/dist/core/src/harness-targets.d.ts.map +1 -0
  378. package/dist/core/src/index.d.ts +8 -8
  379. package/dist/core/src/index.d.ts.map +1 -1
  380. package/dist/core/src/manifest.d.ts +10 -0
  381. package/dist/core/src/manifest.d.ts.map +1 -1
  382. package/dist/core/src/models.d.ts +8 -0
  383. package/dist/core/src/models.d.ts.map +1 -1
  384. package/dist/core/src/provider-registry.d.ts +2 -2
  385. package/dist/core/src/settings.d.ts +17 -16
  386. package/dist/core/src/settings.d.ts.map +1 -1
  387. package/dist/core/src/store.d.ts +12 -12
  388. package/dist/core/src/store.d.ts.map +1 -1
  389. package/dist/core/src/workspace-config.d.ts +39 -21
  390. package/dist/core/src/workspace-config.d.ts.map +1 -1
  391. package/dist/core/src/workspace-yaml-editor.d.ts +10 -3
  392. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  393. package/dist/core/store.js +2 -2
  394. package/dist/core/workspace-config.js +5 -5
  395. package/dist/deploy/index.js +12 -12
  396. package/dist/discovery/index.js +5 -5
  397. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  398. package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
  399. package/dist/{ensure-sources-GKVLE6L5.js → ensure-sources-IH7CHSJF.js} +22 -22
  400. package/dist/{ensure-sources-GKVLE6L5.js.map → ensure-sources-IH7CHSJF.js.map} +1 -1
  401. package/dist/factory-assets/connectors/box.js +31 -31
  402. package/dist/factory-assets/connectors/deploy.js +31 -31
  403. package/dist/factory-assets/connectors/devserver.js +31 -31
  404. package/dist/factory-assets/connectors/flow/CONNECTOR.md +5 -5
  405. package/dist/factory-assets/connectors/flow/adapter.d.ts +3 -3
  406. package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
  407. package/dist/factory-assets/connectors/flow/adapter.js +31 -31
  408. package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
  409. package/dist/factory-assets/connectors/flow/contract.js +1 -1
  410. package/dist/factory-assets/connectors/flow/engine/types.d.ts +1 -1
  411. package/dist/factory-assets/connectors/flow/engine.js +13 -13
  412. package/dist/factory-assets/connectors/flow/inline-sub-flow-host.d.ts +2 -2
  413. package/dist/factory-assets/connectors/flow/inline-sub-flow-host.d.ts.map +1 -1
  414. package/dist/factory-assets/connectors/flow/orchestrator-turn.d.ts +4 -4
  415. package/dist/factory-assets/connectors/flow/orchestrator-turn.d.ts.map +1 -1
  416. package/dist/factory-assets/connectors/flow/prompt-fragments.d.ts +1 -1
  417. package/dist/factory-assets/connectors/flow/prompt-fragments.js +1 -1
  418. package/dist/factory-assets/connectors/flow/run-flow.d.ts +12 -12
  419. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  420. package/dist/factory-assets/connectors/flow/run-flow.js +33 -33
  421. package/dist/factory-assets/connectors/flow/sub-flow-runner.d.ts +1 -1
  422. package/dist/factory-assets/connectors/flow/sub-flow-runner.d.ts.map +1 -1
  423. package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts +22 -22
  424. package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts.map +1 -1
  425. package/dist/factory-assets/connectors/flow.js +31 -31
  426. package/dist/factory-assets/connectors/git.js +31 -31
  427. package/dist/factory-assets/connectors/gmail.js +31 -31
  428. package/dist/factory-assets/connectors/googledrive.js +31 -31
  429. package/dist/factory-assets/connectors/local.js +31 -31
  430. package/dist/factory-assets/connectors/mattermost.js +31 -31
  431. package/dist/factory-assets/connectors/memory.js +31 -31
  432. package/dist/factory-assets/connectors/minio.js +31 -31
  433. package/dist/factory-assets/connectors/postgres.js +31 -31
  434. package/dist/factory-assets/connectors/s3.js +31 -31
  435. package/dist/factory-assets/connectors/sharepoint.js +31 -31
  436. package/dist/factory-assets/connectors/sqlite.js +31 -31
  437. package/dist/factory-assets/connectors/static-server.js +31 -31
  438. package/dist/factory-assets/connectors/tunnel.js +31 -31
  439. package/dist/factory-assets/connectors/webdav.js +31 -31
  440. package/dist/factory-assets/connectors/xstate-store.js +31 -31
  441. package/dist/factory-assets/connectors/xstate.js +31 -31
  442. package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +1 -1
  443. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +2 -2
  444. package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +3 -3
  445. package/dist/factory-assets/skills/skaile-manage-workspace/SKILL.md +1 -1
  446. package/dist/flows-4JZQ3XFK.js +26 -0
  447. package/dist/{flows-W2FB7WIM.js.map → flows-4JZQ3XFK.js.map} +1 -1
  448. package/dist/{helpers-34QNVIGB.js → helpers-JNMK3FC2.js} +22 -22
  449. package/dist/{helpers-34QNVIGB.js.map → helpers-JNMK3FC2.js.map} +1 -1
  450. package/dist/library/index.js +15 -15
  451. package/dist/library/install.js +4 -4
  452. package/dist/library/src/index.d.ts +1 -1
  453. package/dist/library/src/index.d.ts.map +1 -1
  454. package/dist/library/src/local/library-dir.d.ts +22 -5
  455. package/dist/library/src/local/library-dir.d.ts.map +1 -1
  456. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  457. package/dist/library/src/remote/remote-catalog-source.d.ts +6 -0
  458. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  459. package/dist/{library-publish-RUQTKTJU.js → library-publish-I3UWXAHI.js} +69 -67
  460. package/dist/library-publish-I3UWXAHI.js.map +1 -0
  461. package/dist/model-endpoint/index.js +15 -15
  462. package/dist/model-endpoint/src/resolve.d.ts +1 -1
  463. package/dist/open-library-NKKUJLWA.js +42 -0
  464. package/dist/{open-library-PVTIUQUF.js.map → open-library-NKKUJLWA.js.map} +1 -1
  465. package/dist/open-registry-BYAXSHUI.js +32 -0
  466. package/dist/{open-registry-SOIS3TA2.js.map → open-registry-BYAXSHUI.js.map} +1 -1
  467. package/dist/paths-UKWE35XS.js +22 -0
  468. package/dist/{paths-JLNX7Y4X.js.map → paths-UKWE35XS.js.map} +1 -1
  469. package/dist/plugin-registry/index.js +1 -1
  470. package/dist/plugin-registry/src/context.d.ts +3 -3
  471. package/dist/plugin-registry/src/context.d.ts.map +1 -1
  472. package/dist/plugin-registry/src/deploy-handle.d.ts +1 -1
  473. package/dist/plugin-registry/src/index.d.ts +2 -2
  474. package/dist/plugin-registry/src/index.d.ts.map +1 -1
  475. package/dist/plugin-registry/src/internal.d.ts.map +1 -1
  476. package/dist/plugin-registry/src/registry.d.ts +3 -3
  477. package/dist/plugin-registry/src/registry.d.ts.map +1 -1
  478. package/dist/plugin-registry/src/targets.d.ts +9 -9
  479. package/dist/plugin-registry/src/targets.d.ts.map +1 -1
  480. package/dist/plugin-store-ABE35NRX.js +23 -0
  481. package/dist/{plugin-store-G2GWAHSD.js.map → plugin-store-ABE35NRX.js.map} +1 -1
  482. package/dist/plugins/src/asset-kind-provider.d.ts +1 -1
  483. package/dist/project-BIPK47JK.js +86 -0
  484. package/dist/{project-EX47PUBN.js.map → project-BIPK47JK.js.map} +1 -1
  485. package/dist/resolver/index.js +12 -12
  486. package/dist/runner/index.js +50 -50
  487. package/dist/runner/src/agent.d.ts +3 -3
  488. package/dist/runner/src/agent.d.ts.map +1 -1
  489. package/dist/runner/src/agents/in-process-host.d.ts +1 -1
  490. package/dist/runner/src/agents/instances.d.ts +1 -1
  491. package/dist/runner/src/agents/instances.d.ts.map +1 -1
  492. package/dist/runner/src/agents/run-controller.d.ts +7 -7
  493. package/dist/runner/src/agents/run-controller.d.ts.map +1 -1
  494. package/dist/runner/src/agents/standalone-surface.d.ts +2 -2
  495. package/dist/runner/src/agents/standalone-surface.d.ts.map +1 -1
  496. package/dist/runner/src/ai-provider-switch.d.ts +7 -7
  497. package/dist/runner/src/assistant-home.d.ts +1 -1
  498. package/dist/runner/src/capability-registry.d.ts +2 -2
  499. package/dist/runner/src/coalesced-restart.d.ts +2 -2
  500. package/dist/runner/src/compaction/context-window.d.ts +8 -8
  501. package/dist/runner/src/compaction/context-window.d.ts.map +1 -1
  502. package/dist/runner/src/compaction/orchestrator.d.ts +24 -24
  503. package/dist/runner/src/compaction/orchestrator.d.ts.map +1 -1
  504. package/dist/runner/src/compaction-gate.d.ts +30 -30
  505. package/dist/runner/src/compaction-gate.d.ts.map +1 -1
  506. package/dist/runner/src/composition/content-source.d.ts.map +1 -1
  507. package/dist/runner/src/composition/dry-run.d.ts +2 -2
  508. package/dist/runner/src/composition/dry-run.d.ts.map +1 -1
  509. package/dist/runner/src/composition/errors.d.ts +16 -1
  510. package/dist/runner/src/composition/errors.d.ts.map +1 -1
  511. package/dist/runner/src/composition/resolve-instance.d.ts +2 -2
  512. package/dist/runner/src/composition/resolve.d.ts +1 -1
  513. package/dist/runner/src/config.d.ts +3 -3
  514. package/dist/runner/src/config.d.ts.map +1 -1
  515. package/dist/runner/src/context-usage/collector.d.ts +15 -15
  516. package/dist/runner/src/context-usage/collector.d.ts.map +1 -1
  517. package/dist/runner/src/context-usage/compose.d.ts +6 -6
  518. package/dist/runner/src/context-usage/compose.d.ts.map +1 -1
  519. package/dist/runner/src/context-usage/estimator.d.ts +1 -1
  520. package/dist/runner/src/context-usage/index.d.ts +1 -1
  521. package/dist/runner/src/context-usage/index.d.ts.map +1 -1
  522. package/dist/runner/src/context-usage/transcript-tracker.d.ts +2 -2
  523. package/dist/runner/src/context-usage/transcript-tracker.d.ts.map +1 -1
  524. package/dist/runner/src/credential-notice.d.ts +4 -4
  525. package/dist/runner/src/credential-notice.d.ts.map +1 -1
  526. package/dist/runner/src/credential-rotated.d.ts +1 -1
  527. package/dist/runner/src/final-text.d.ts +1 -1
  528. package/dist/runner/src/{driver-swap-gate.d.ts → harness-swap-gate.d.ts} +21 -21
  529. package/dist/runner/src/harness-swap-gate.d.ts.map +1 -0
  530. package/dist/runner/src/late-mcp-rebuild.d.ts +6 -6
  531. package/dist/runner/src/late-mcp-rebuild.d.ts.map +1 -1
  532. package/dist/runner/src/lifecycle-handler.d.ts +1 -1
  533. package/dist/runner/src/lifecycle-handler.d.ts.map +1 -1
  534. package/dist/runner/src/manifest.d.ts +1 -1
  535. package/dist/runner/src/mcp-runtime-handlers.d.ts +6 -6
  536. package/dist/runner/src/mcp-runtime-handlers.d.ts.map +1 -1
  537. package/dist/runner/src/model-endpoint-discovery.d.ts +1 -1
  538. package/dist/runner/src/pending-turns.d.ts +3 -3
  539. package/dist/runner/src/platform-blocks.d.ts +5 -5
  540. package/dist/runner/src/platform-blocks.d.ts.map +1 -1
  541. package/dist/runner/src/prompt-turn-queue.d.ts +1 -1
  542. package/dist/runner/src/provider-quota-forwarder.d.ts +1 -1
  543. package/dist/runner/src/provider-quota-forwarder.d.ts.map +1 -1
  544. package/dist/runner/src/reconfigure-handler.d.ts +14 -14
  545. package/dist/runner/src/reconfigure-handler.d.ts.map +1 -1
  546. package/dist/runner/src/resource-handler.d.ts +1 -1
  547. package/dist/runner/src/resources.d.ts +5 -5
  548. package/dist/runner/src/resources.d.ts.map +1 -1
  549. package/dist/runner/src/runner-capabilities.d.ts +7 -7
  550. package/dist/runner/src/runtime-session-emit.d.ts +5 -5
  551. package/dist/runner/src/runtime-session-emit.d.ts.map +1 -1
  552. package/dist/runner/src/s3-presign-client.d.ts +1 -1
  553. package/dist/runner/src/serve-credentials.d.ts +7 -7
  554. package/dist/runner/src/serve-credentials.d.ts.map +1 -1
  555. package/dist/runner/src/serve.d.ts +46 -34
  556. package/dist/runner/src/serve.d.ts.map +1 -1
  557. package/dist/runner/src/session-builder.d.ts +41 -41
  558. package/dist/runner/src/session-builder.d.ts.map +1 -1
  559. package/dist/runner/src/session-capability-wiring.d.ts +9 -9
  560. package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
  561. package/dist/runner/src/session-stimulus.d.ts +1 -1
  562. package/dist/runner/src/session.d.ts +5 -5
  563. package/dist/runner/src/session.d.ts.map +1 -1
  564. package/dist/runner/src/skill-staging.d.ts +16 -16
  565. package/dist/runner/src/skill-staging.d.ts.map +1 -1
  566. package/dist/runner/src/turn-end-contract.d.ts +5 -5
  567. package/dist/runner/src/turn-end-contract.d.ts.map +1 -1
  568. package/dist/runner/src/turn-scheduler.d.ts +22 -22
  569. package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
  570. package/dist/runner/src/turn-status-replay.d.ts +1 -1
  571. package/dist/runner/src/usage-limit-turn-hold.d.ts +1 -1
  572. package/dist/sdk/asset-manager.js +19 -19
  573. package/dist/sdk/bridge.js +25 -25
  574. package/dist/sdk/core.js +11 -11
  575. package/dist/sdk/flow.js +13 -13
  576. package/dist/sdk/index.js +54 -54
  577. package/dist/sdk/index.js.map +1 -1
  578. package/dist/sdk/resolver.js +12 -12
  579. package/dist/sdk/runner.js +50 -50
  580. package/dist/sdk/session.js +2 -2
  581. package/dist/sdk/src/agent-session.d.ts +1 -1
  582. package/dist/sdk/src/local-runtime.d.ts +1 -1
  583. package/dist/sdk/src/local-runtime.d.ts.map +1 -1
  584. package/dist/sdk/src/types.d.ts +1 -1
  585. package/dist/sdk/src/types.d.ts.map +1 -1
  586. package/dist/sdk/store.js +2 -2
  587. package/dist/sdk/transport/ws/server.js +12 -12
  588. package/dist/sdk/transport/ws.js +12 -12
  589. package/dist/sdk/transport.js +12 -12
  590. package/dist/sdk/types.js +1 -1
  591. package/dist/serve-preflight-FLTIBTEX.js +107 -0
  592. package/dist/serve-preflight-FLTIBTEX.js.map +1 -0
  593. package/dist/session/index.js +2 -2
  594. package/dist/session/src/dispatcher.d.ts +2 -2
  595. package/dist/sessions-2Q7SSYPT.js +5 -0
  596. package/dist/{sessions-DICDEONJ.js.map → sessions-2Q7SSYPT.js.map} +1 -1
  597. package/dist/{setup-AFZQNGKA.js → setup-AG6NFHSN.js} +52 -52
  598. package/dist/setup-AG6NFHSN.js.map +1 -0
  599. package/dist/skills-UQYUHVKO.js +26 -0
  600. package/dist/{skills-YYYC6D5X.js.map → skills-UQYUHVKO.js.map} +1 -1
  601. package/dist/source-ASEHI2XS.js +85 -0
  602. package/dist/{source-DGPCT5IC.js.map → source-ASEHI2XS.js.map} +1 -1
  603. package/dist/{source-manifest-publish-AGJ63JF2.js → source-manifest-publish-IEVV3W6J.js} +62 -62
  604. package/dist/{source-manifest-publish-AGJ63JF2.js.map → source-manifest-publish-IEVV3W6J.js.map} +1 -1
  605. package/dist/store/index.js +2 -2
  606. package/dist/store/src/store.d.ts +3 -3
  607. package/dist/store/src/store.d.ts.map +1 -1
  608. package/dist/transport/index.js +12 -12
  609. package/dist/transport/ws/server.js +12 -12
  610. package/dist/transport/ws.js +12 -12
  611. package/dist/tui/index.js +70 -70
  612. package/dist/tui/index.js.map +1 -1
  613. package/dist/tui/src/repl-session.d.ts +5 -5
  614. package/dist/tui/src/repl.d.ts +5 -5
  615. package/dist/tui/src/repl.d.ts.map +1 -1
  616. package/dist/types/index.js +1 -1
  617. package/dist/types/manifests.js +1 -1
  618. package/dist/types/src/agent-lifecycle.d.ts +1 -1
  619. package/dist/types/src/agent-lifecycle.d.ts.map +1 -1
  620. package/dist/types/src/ask-slots.d.ts +1 -1
  621. package/dist/types/src/capabilities.d.ts +1 -1
  622. package/dist/types/src/context-usage.d.ts +22 -22
  623. package/dist/types/src/context-usage.d.ts.map +1 -1
  624. package/dist/types/src/events.d.ts +49 -49
  625. package/dist/types/src/events.d.ts.map +1 -1
  626. package/dist/types/src/index.d.ts +2 -2
  627. package/dist/types/src/index.d.ts.map +1 -1
  628. package/dist/types/src/install-manifest.d.ts +1 -1
  629. package/dist/types/src/install-manifest.d.ts.map +1 -1
  630. package/dist/types/src/lifecycle.d.ts +6 -6
  631. package/dist/types/src/lifecycle.d.ts.map +1 -1
  632. package/dist/types/src/logging.d.ts +1 -1
  633. package/dist/types/src/manifests/agent.d.ts +3 -3
  634. package/dist/types/src/protocol.d.ts +4 -4
  635. package/dist/types/src/runtime.d.ts +38 -38
  636. package/dist/types/src/runtime.d.ts.map +1 -1
  637. package/dist/types/src/version.d.ts +22 -11
  638. package/dist/types/src/version.d.ts.map +1 -1
  639. package/dist/validator-DRHMJ457.js +5 -0
  640. package/dist/{validator-FA2PFW6N.js.map → validator-DRHMJ457.js.map} +1 -1
  641. package/dist/workspace-plugin/adapters/mcp.js +41 -41
  642. package/dist/workspace-plugin/adapters/omp.js +26 -26
  643. package/dist/workspace-plugin/adapters/omp.js.map +1 -1
  644. package/dist/workspace-plugin/index.js +3 -3
  645. package/dist/workspace-plugin/src/plugin.d.ts +5 -5
  646. package/dist/workspace-plugin/src/plugin.d.ts.map +1 -1
  647. package/dist/workspace-plugin/src/tools/flows.d.ts +1 -1
  648. package/dist/workspace-plugin/src/tools/validator.d.ts +6 -6
  649. package/dist/workspace-plugin/src/tools/validator.d.ts.map +1 -1
  650. package/dist/workspace-plugin/src/types.d.ts +2 -2
  651. package/dist/workspace-plugin/src/types.d.ts.map +1 -1
  652. package/package.json +59 -59
  653. package/dist/asset-feeds-QGLI3AXI.js.map +0 -1
  654. package/dist/bridge/drivers/claude-sdk.js.map +0 -1
  655. package/dist/bridge/drivers/codex.js.map +0 -1
  656. package/dist/bridge/drivers/continue.js.map +0 -1
  657. package/dist/bridge/drivers/echo.js.map +0 -1
  658. package/dist/bridge/drivers/gemini.js +0 -18
  659. package/dist/bridge/drivers/goose.js.map +0 -1
  660. package/dist/bridge/drivers/omp.js.map +0 -1
  661. package/dist/bridge/drivers/opencode.js.map +0 -1
  662. package/dist/bridge/drivers/qwen.js.map +0 -1
  663. package/dist/bridge/src/codex/managed-driver.d.ts.map +0 -1
  664. package/dist/bridge/src/driver-capabilities.d.ts.map +0 -1
  665. package/dist/bridge/src/driver-model-check.d.ts +0 -25
  666. package/dist/bridge/src/driver-model-check.d.ts.map +0 -1
  667. package/dist/bridge/src/drivers/_subprocess-cli.d.ts.map +0 -1
  668. package/dist/bridge/src/drivers/claude-context-usage.d.ts.map +0 -1
  669. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +0 -1
  670. package/dist/bridge/src/drivers/claude-self-turns.d.ts.map +0 -1
  671. package/dist/bridge/src/drivers/claude-tool-allowlist.d.ts.map +0 -1
  672. package/dist/bridge/src/drivers/codex.d.ts.map +0 -1
  673. package/dist/bridge/src/drivers/continue.d.ts.map +0 -1
  674. package/dist/bridge/src/drivers/echo.d.ts.map +0 -1
  675. package/dist/bridge/src/drivers/flow-script.d.ts.map +0 -1
  676. package/dist/bridge/src/drivers/gemini.d.ts.map +0 -1
  677. package/dist/bridge/src/drivers/goose.d.ts.map +0 -1
  678. package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +0 -1
  679. package/dist/bridge/src/drivers/omp.d.ts.map +0 -1
  680. package/dist/bridge/src/drivers/opencode.d.ts.map +0 -1
  681. package/dist/bridge/src/drivers/qwen.d.ts.map +0 -1
  682. package/dist/bridge/src/drivers/recovery-policy.d.ts.map +0 -1
  683. package/dist/bridge/src/drivers/resume-probe.d.ts.map +0 -1
  684. package/dist/bridge/src/drivers/sanitize-assistant-text.d.ts.map +0 -1
  685. package/dist/bridge/src/drivers/scrub-transcript.d.ts.map +0 -1
  686. package/dist/bridge/src/provider-materialize/env-drivers.d.ts.map +0 -1
  687. package/dist/chunk-2GXSSZAM.js.map +0 -1
  688. package/dist/chunk-4ZTPYIBE.js.map +0 -1
  689. package/dist/chunk-5BEFNLOR.js.map +0 -1
  690. package/dist/chunk-5TBFN46Z.js.map +0 -1
  691. package/dist/chunk-6E6PKKAD.js.map +0 -1
  692. package/dist/chunk-7NT4F6SR.js.map +0 -1
  693. package/dist/chunk-7SCS64BG.js.map +0 -1
  694. package/dist/chunk-AJ7EGIFR.js.map +0 -1
  695. package/dist/chunk-C7WBGSBV.js.map +0 -1
  696. package/dist/chunk-COJIL7G4.js.map +0 -1
  697. package/dist/chunk-CQJH4G2K.js.map +0 -1
  698. package/dist/chunk-EAZECHPM.js.map +0 -1
  699. package/dist/chunk-EPBKISS5.js.map +0 -1
  700. package/dist/chunk-FPHNJE4M.js.map +0 -1
  701. package/dist/chunk-GOCWM7FN.js.map +0 -1
  702. package/dist/chunk-HT35SQZD.js.map +0 -1
  703. package/dist/chunk-I37INEWE.js.map +0 -1
  704. package/dist/chunk-IG5LZ3WU.js.map +0 -1
  705. package/dist/chunk-IP2IPMEH.js.map +0 -1
  706. package/dist/chunk-IZCR27MU.js.map +0 -1
  707. package/dist/chunk-J24CY3PF.js.map +0 -1
  708. package/dist/chunk-JTOWA6RS.js.map +0 -1
  709. package/dist/chunk-L2AMXONH.js.map +0 -1
  710. package/dist/chunk-MJHSLODD.js.map +0 -1
  711. package/dist/chunk-MKRWN7XP.js.map +0 -1
  712. package/dist/chunk-MRHVPQNO.js.map +0 -1
  713. package/dist/chunk-N46LQR46.js.map +0 -1
  714. package/dist/chunk-PUK7TQT4.js +0 -13
  715. package/dist/chunk-PUK7TQT4.js.map +0 -1
  716. package/dist/chunk-QG6GHTRM.js.map +0 -1
  717. package/dist/chunk-RO6VOM6Z.js.map +0 -1
  718. package/dist/chunk-RPZVHXQ3.js.map +0 -1
  719. package/dist/chunk-V257LUBM.js.map +0 -1
  720. package/dist/chunk-VJ7NU7GD.js.map +0 -1
  721. package/dist/chunk-VSZWNUZC.js.map +0 -1
  722. package/dist/chunk-W4Q6CKJ5.js.map +0 -1
  723. package/dist/chunk-WOIRYY5L.js.map +0 -1
  724. package/dist/chunk-WST6UITC.js.map +0 -1
  725. package/dist/chunk-X3RMRJNR.js.map +0 -1
  726. package/dist/chunk-XJVBUDDJ.js.map +0 -1
  727. package/dist/chunk-XM6T2AZ2.js.map +0 -1
  728. package/dist/chunk-XWOPZW26.js.map +0 -1
  729. package/dist/chunk-Y56YIT6J.js.map +0 -1
  730. package/dist/chunk-YROR332M.js.map +0 -1
  731. package/dist/chunk-ZQSOJH6I.js.map +0 -1
  732. package/dist/claude-code-2PU7TITZ.js +0 -10
  733. package/dist/cli/src/driver-error.d.ts +0 -28
  734. package/dist/cli/src/driver-error.d.ts.map +0 -1
  735. package/dist/connectors-RBGZ3M7G.js +0 -48
  736. package/dist/core/driver-targets.d.ts +0 -2
  737. package/dist/core/driver-targets.js +0 -4
  738. package/dist/core/driver-targets.js.map +0 -1
  739. package/dist/core/src/driver-sdk.d.ts.map +0 -1
  740. package/dist/core/src/driver-targets.d.ts +0 -71
  741. package/dist/core/src/driver-targets.d.ts.map +0 -1
  742. package/dist/flows-W2FB7WIM.js +0 -26
  743. package/dist/library-publish-RUQTKTJU.js.map +0 -1
  744. package/dist/open-library-PVTIUQUF.js +0 -42
  745. package/dist/open-registry-SOIS3TA2.js +0 -32
  746. package/dist/paths-JLNX7Y4X.js +0 -22
  747. package/dist/plugin-store-G2GWAHSD.js +0 -23
  748. package/dist/project-EX47PUBN.js +0 -84
  749. package/dist/runner/src/driver-swap-gate.d.ts.map +0 -1
  750. package/dist/serve-preflight-QXRKGOI5.js +0 -108
  751. package/dist/serve-preflight-QXRKGOI5.js.map +0 -1
  752. package/dist/sessions-DICDEONJ.js +0 -5
  753. package/dist/setup-AFZQNGKA.js.map +0 -1
  754. package/dist/skills-YYYC6D5X.js +0 -26
  755. package/dist/source-DGPCT5IC.js +0 -85
  756. package/dist/validator-FA2PFW6N.js +0 -5
  757. /package/dist/bridge/{drivers → harnesses}/gemini.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../asset-manager/src/catalog-deployer.ts"],"names":[],"mappings":";;;;;AAyGA,IAAM,uBAAA,GAA0B,CAAA;AAGhC,IAAM,qBAAA,GAAwB,CAAA;AAE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AAA;AACnC,IAAA,IAAI,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,EAEhC;AAEA,EAAA,OAAO,EAAE,QAAA,EAAU,QAAA,EAAU,OAAA,EAAQ;AACvC","file":"chunk-H6UVIKQ2.js","sourcesContent":["/**\n * Platform-triggered asset deployment.\n *\n * Takes catalog entries (with source_path relative to ai-assets/) and deploys\n * them to a session's .claude/skills/ directory. Handles skill context injection\n * and catalog priority-based name resolution.\n */\n\nimport { cp, mkdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { join, resolve, sep } from \"node:path\";\nimport { fsDeadlineMs, tryWithFsDeadline, withFsDeadline } from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\n\n// ---------------------------------------------------------------------------\n// Types (formerly in catalog-compiler.ts, inlined after tear-out in Task 1.5)\n// ---------------------------------------------------------------------------\n\n/**\n * A single user-facing input parameter declared in a SKILL.md.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface InputSpec {\n /** Input parameter key used in skill invocation. */\n key: string;\n /** Whether the input must be provided before running the skill. */\n required?: boolean;\n /** Question string shown to the user when collecting this input. */\n prompt?: string;\n /** Short display label for UI forms. */\n label?: string;\n /** Input data type hint (e.g. `\"string\"`, `\"number\"`, `\"file\"`). */\n type?: string;\n /** Additional guidance text shown alongside the input field. */\n hint?: string;\n}\n\n/**\n * A compiled catalog entry (skill or flow).\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface CatalogEntryCompiled {\n /** Unique ID in `publisher/name` form (e.g. `skaileup/cf_overview`). */\n id: string;\n /** Asset kind. */\n kind: \"skill\" | \"flow\";\n /** Human-readable asset name. */\n name: string;\n /** One-line description. */\n description: string;\n /** Semantic version string. */\n version: string;\n /** Maturity stage. */\n stage: \"alpha\" | \"beta\" | \"stable\";\n /** Searchable keywords. */\n keywords: string[];\n /** User-facing input specifications. */\n inputs: InputSpec[];\n /** Asset path relative to assetsRoot. */\n source_path: string;\n /** Optional icon identifier. */\n icon?: string;\n /** Flow-only: required skill names. */\n required_skills?: string[];\n /** Flow-only: optional skill names. */\n optional_skills?: string[];\n}\n\n/**\n * Options controlling how platform-triggered skill deployment is performed.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface DeployFromCatalogOptions {\n /** Root directory of ai-assets (where `source_path` in catalog entries is relative to). */\n assetsRoot: string;\n /** Target directory for deployed skills (e.g. `/workspace/.claude/skills/`). */\n skillsDir: string;\n /** Optional context markdown appended to the deployed skill directory as `CONTEXT.md`. */\n context?: string;\n}\n\n/**\n * Result of a platform-triggered batch skill deployment.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface DeployResult {\n /** IDs of catalog entries successfully deployed. */\n deployed: string[];\n /** IDs of catalog entries skipped (non-skill kinds). */\n skipped: string[];\n /** Error messages for entries that could not be deployed. */\n errors: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Workspace-mount awareness\n// ---------------------------------------------------------------------------\n\n/**\n * Multiplier applied to the base filesystem deadline for whole-tree operations\n * (recursive copy / remove), which legitimately outlast a single `stat`.\n */\nconst TREE_OP_DEADLINE_FACTOR = 4;\n\n/** Default number of parent levels {@link findAiAssetsRoot} inspects. */\nconst AI_ASSETS_WALK_LEVELS = 6;\n\nlet deployerLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n deployerLogger ??= createLogger({ kind: \"runner\", subkind: \"catalog-deployer\" });\n return deployerLogger;\n}\n\n/**\n * Where the agent container binds its rclone FUSE mount. Nothing under this\n * path is a safe place to read an asset tree from: the mount is remote\n * (SharePoint / OneDrive / WebDAV) and can wedge indefinitely.\n */\nconst DEFAULT_WORKSPACE_MOUNT_DIR = \"/skaile/workspace\";\n\n/**\n * Env override for the workspace-mount path(s), comma-separated.\n *\n * Set it when the runner binds the mount somewhere other than\n * {@link DEFAULT_WORKSPACE_MOUNT_DIR}; set it to the empty string to disable\n * the guard entirely (single-machine dev, where nothing is a network mount).\n */\nexport const WORKSPACE_MOUNT_ENV_VAR = \"SKAILE_WORKSPACE_MOUNT_DIR\";\n\n/**\n * Resolve the directories treated as network mounts.\n *\n * Read per call rather than cached: the runner mutates `process.env` while\n * wiring a session, so a module-load snapshot would pin a pre-configuration\n * value.\n *\n * @returns Absolute mount paths; empty when the guard is disabled.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function workspaceMountDirs(): string[] {\n const raw = process.env[WORKSPACE_MOUNT_ENV_VAR];\n if (raw === undefined) return [DEFAULT_WORKSPACE_MOUNT_DIR];\n return raw\n .split(\",\")\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0)\n .map((segment) => resolve(segment));\n}\n\n/**\n * Is `candidate` at, or inside, one of the known workspace mount paths?\n *\n * Pure path arithmetic — deliberately no filesystem access, because the whole\n * point is to decide *before* touching a path that might be unresponsive.\n *\n * @param candidate - Path to test.\n * @param mountDirs - Mount roots; defaults to {@link workspaceMountDirs}.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function isUnderWorkspaceMount(\n candidate: string,\n mountDirs: string[] = workspaceMountDirs(),\n): boolean {\n const target = resolve(candidate);\n return mountDirs.some((dir) => {\n const root = resolve(dir);\n return target === root || target.startsWith(root + sep);\n });\n}\n\n/**\n * Walk upward from `startDir` looking for an `ai-assets/` directory.\n *\n * Two properties matter beyond \"find the folder\":\n *\n * 1. **Never synchronous.** The walk probes up to six directories; any one of\n * them can be on a FUSE mount, and the former `existsSync` chain blocked the\n * event loop on the first unresponsive probe. Each probe is now awaited and\n * deadline-bounded, so a wedged mount costs one skipped candidate.\n * 2. **Never resolves onto a mount.** A hit under the workspace mount is\n * skipped with a warning rather than returned: accepting it would wire every\n * later skill deploy — a recursive copy — to a remote filesystem. The walk\n * continues upward, so a legitimate `ai-assets/` in a parent still wins.\n *\n * Only a **directory** counts. An `ai-assets` file would otherwise be returned\n * as a root and every later `join(root, source_path)` would fail with ENOTDIR.\n *\n * @param startDir - Directory to start from (typically the project dir).\n * @param opts - `levels` caps the upward walk; `mountDirs` overrides the mount\n * roots (defaults to {@link workspaceMountDirs}).\n * @returns Absolute path to the `ai-assets/` directory, or `null` if none is\n * reachable within `levels`.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function findAiAssetsRoot(\n startDir: string,\n opts?: { levels?: number; mountDirs?: string[] },\n): Promise<string | null> {\n const mountDirs = opts?.mountDirs ?? workspaceMountDirs();\n const levels = opts?.levels ?? AI_ASSETS_WALK_LEVELS;\n let dir = resolve(startDir);\n // Every level of a `/skaile/workspace/...` start dir is under the mount, so\n // an unconditional warn would fire once per level for one lookup. Collect and\n // report once — the operator needs the fact, not six copies of it.\n const refused: string[] = [];\n\n for (let i = 0; i < levels; i++) {\n const candidate = join(dir, \"ai-assets\");\n if (isUnderWorkspaceMount(candidate, mountDirs)) {\n refused.push(candidate);\n } else {\n const isDir = await tryWithFsDeadline(\n `stat ${candidate}`,\n async () => (await stat(candidate)).isDirectory(),\n false,\n );\n if (isDir) {\n if (refused.length > 0) warnRefused(refused, mountDirs);\n return candidate;\n }\n }\n const parent = resolve(dir, \"..\");\n if (parent === dir) break; // filesystem root — nothing further up\n dir = parent;\n }\n if (refused.length > 0) warnRefused(refused, mountDirs);\n return null;\n}\n\n/** Single warning for every `ai-assets` candidate skipped for sitting on a mount. */\nfunction warnRefused(refused: string[], mountDirs: string[]): void {\n log().warn(\n \"findAiAssetsRoot refused candidates under a workspace mount — deploying skills from a network mount can stall the session\",\n { refused, mountDirs },\n );\n}\n\n/**\n * Deploy a single catalog entry to the session skills directory.\n *\n * Copies the entire skill source directory into `skillsDir/<entry.name>/`.\n * If `context` is provided, a separate `CONTEXT.md` is written alongside\n * `SKILL.md` so the source file is never modified.\n *\n * Only `skill` entries are deployable; other kinds return an error.\n *\n * **Async by necessity.** This runs from the `session_init` command handler\n * with the WebSocket live, and both `assetsRoot` and `skillsDir` can sit on a\n * network mount. The former `cpSync`/`rmSync` pair parked the event loop for\n * the whole copy; every call is now awaited and deadline-bounded, so an\n * unresponsive mount fails one deployment instead of the session.\n *\n * @param entry - Compiled catalog entry to deploy.\n * @param options - Deployment target and optional context.\n * @returns `{ success: true }` on success, `{ success: false, error }` on failure.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function deployCatalogEntry(\n entry: CatalogEntryCompiled,\n options: DeployFromCatalogOptions,\n): Promise<{ success: boolean; error?: string }> {\n const { assetsRoot, skillsDir, context } = options;\n\n if (entry.kind !== \"skill\") {\n return { success: false, error: `Cannot deploy ${entry.kind} directly — only skills` };\n }\n\n const sourcePath = join(assetsRoot, entry.source_path);\n const skillMdPath = join(sourcePath, \"SKILL.md\");\n\n const hasSkillMd = await tryWithFsDeadline(\n `stat ${skillMdPath}`,\n async () => {\n await stat(skillMdPath);\n return true;\n },\n false,\n );\n if (!hasSkillMd) {\n return { success: false, error: `SKILL.md not found at ${skillMdPath}` };\n }\n\n const destDir = join(skillsDir, entry.name);\n\n try {\n await withFsDeadline(`mkdir ${destDir}`, () => mkdir(destDir, { recursive: true }));\n\n // Copy the entire skill directory\n await withFsDeadline(\n `cp ${sourcePath} -> ${destDir}`,\n () => cp(sourcePath, destDir, { recursive: true }),\n fsDeadlineMs() * TREE_OP_DEADLINE_FACTOR,\n );\n\n // Write context to a separate CONTEXT.md — never modify the original SKILL.md.\n // The agent discovers both files in the skill directory.\n const contextPath = join(destDir, \"CONTEXT.md\");\n if (context) {\n await withFsDeadline(`write ${contextPath}`, () =>\n writeFile(contextPath, `# Additional Context\\n\\n${context}\\n`, \"utf8\"),\n );\n } else {\n // `force: true` makes this a single call: a stale CONTEXT.md is removed,\n // an absent one is a no-op. The former existsSync probe only added a\n // second trip to the same possibly-wedged mount.\n await withFsDeadline(`rm ${contextPath}`, () => rm(contextPath, { force: true }));\n }\n } catch (err) {\n return { success: false, error: err instanceof Error ? err.message : String(err) };\n }\n\n return { success: true };\n}\n\n/**\n * Remove a deployed skill directory from the session skills directory.\n *\n * @param name - Skill name (directory basename under `skillsDir`).\n * @param skillsDir - Absolute path to the session skills directory.\n * @returns `true` if the skill was found and removed; `false` if it was not\n * deployed, or if the directory could not be reached within the deadline.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function undeployCatalogEntry(name: string, skillsDir: string): Promise<boolean> {\n const destDir = join(skillsDir, name);\n const exists = await tryWithFsDeadline(\n `stat ${destDir}`,\n async () => {\n await stat(destDir);\n return true;\n },\n false,\n );\n if (!exists) return false;\n await withFsDeadline(\n `rm -r ${destDir}`,\n () => rm(destDir, { recursive: true, force: true }),\n fsDeadlineMs() * TREE_OP_DEADLINE_FACTOR,\n );\n return true;\n}\n\n/**\n * Deploy multiple catalog entries in a single batch operation.\n *\n * Non-skill entries (flows, agents, etc.) are automatically skipped and\n * recorded in `result.skipped`. Deployment failures are collected in\n * `result.errors` without aborting the rest of the batch.\n *\n * @param entries - Compiled catalog entries to deploy.\n * @param options - Deployment target and optional context.\n * @returns Aggregated {@link DeployResult} with deployed, skipped, and error lists.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function deployAll(\n entries: CatalogEntryCompiled[],\n options: DeployFromCatalogOptions,\n): Promise<DeployResult> {\n const result: DeployResult = { deployed: [], skipped: [], errors: [] };\n\n for (const entry of entries) {\n if (entry.kind !== \"skill\") {\n result.skipped.push(entry.id);\n continue;\n }\n\n // Serial on purpose: concurrent recursive copies onto one mount multiply\n // the queue depth on the exact resource that is already the bottleneck.\n const r = await deployCatalogEntry(entry, options);\n if (r.success) {\n result.deployed.push(entry.id);\n } else {\n result.errors.push(`${entry.id}: ${r.error}`);\n }\n }\n\n return result;\n}\n\n/**\n * Resolve a flow's skill dependencies from the full catalog entry list.\n *\n * Partitions `flow.required_skills` and `flow.optional_skills` into resolved\n * entries and a list of names that could not be found. Missing optional skills\n * are silently ignored (they do not appear in `missing`).\n *\n * @param flow - Compiled flow entry whose skill dependencies should be resolved.\n * @param allEntries - Full set of compiled catalog entries to search.\n * @returns Object containing resolved `required` entries, resolved `optional` entries,\n * and `missing` skill names that were listed as required but not found.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function resolveFlowSkills(\n flow: CatalogEntryCompiled,\n allEntries: CatalogEntryCompiled[],\n): { required: CatalogEntryCompiled[]; optional: CatalogEntryCompiled[]; missing: string[] } {\n const skillsByName = new Map<string, CatalogEntryCompiled>();\n for (const e of allEntries) {\n if (e.kind === \"skill\") skillsByName.set(e.name, e);\n }\n\n const required: CatalogEntryCompiled[] = [];\n const optional: CatalogEntryCompiled[] = [];\n const missing: string[] = [];\n\n for (const name of flow.required_skills ?? []) {\n const entry = skillsByName.get(name);\n if (entry) required.push(entry);\n else missing.push(name);\n }\n\n for (const name of flow.optional_skills ?? []) {\n const entry = skillsByName.get(name);\n if (entry) optional.push(entry);\n // Optional skills don't count as missing\n }\n\n return { required, optional, missing };\n}\n"]}
1
+ {"version":3,"sources":["../asset-manager/src/catalog-deployer.ts"],"names":[],"mappings":";;;;;AAyGA,IAAM,uBAAA,GAA0B,CAAA;AAGhC,IAAM,qBAAA,GAAwB,CAAA;AAE9B,IAAI,cAAA;AAEJ,SAAS,GAAA,GAAuC;AAC9C,EAAA,cAAA,KAAmB,aAAa,EAAE,IAAA,EAAM,QAAA,EAAU,OAAA,EAAS,oBAAoB,CAAA;AAC/E,EAAA,OAAO,cAAA;AACT;AAOA,IAAM,2BAAA,GAA8B,mBAAA;AAS7B,IAAM,uBAAA,GAA0B;AAYhC,SAAS,kBAAA,GAA+B;AAC7C,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,uBAAuB,CAAA;AAC/C,EAAA,IAAI,GAAA,KAAQ,MAAA,EAAW,OAAO,CAAC,2BAA2B,CAAA;AAC1D,EAAA,OAAO,GAAA,CACJ,MAAM,GAAG,CAAA,CACT,IAAI,CAAC,OAAA,KAAY,OAAA,CAAQ,IAAA,EAAM,CAAA,CAC/B,OAAO,CAAC,OAAA,KAAY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C2F;AAC3F,EAAA,MAAM,YAAA,uBAAmB,GAAA,EAAkC;AAC3D,EAAA,KAAA,MAAW,KAAK,UAAA,EAAY;AAC1B,IAAA,IAAI,EAAE,IAAA,KAAS,OAAA,eAAsB,GAAA,CAAI,CAAA,CAAE,MAAM,CAAC,CAAA;AAAA,EACpD;AAEA,EAAA,MAAM,WAAmC,EAAC;AAC1C,EAAA,MAAM,WAAmC,EAAC;AAC1C,EAAA,MAAM,UAAoB,EAAC;AAE3B,EAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,eAAA,IAAmB,EAAC,EAAG;AAC7C,IAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA;AACnC,IAAA,IAAI,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,SACzB,OAAA,CAAQ,KAAK,IAAI,CAAA;AAAA,EACxB;AAEA,EAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,eAAA,IAAmB,EAAC,EAAG;AAC7C,IAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA;AACnC,IAAA,IAAI,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,EAEhC;AAEA,EAAA,OAAO,EAAE,QAAA,EAAU,QAAA,EAAU,OAAA,EAAQ;AACvC","file":"chunk-VYVTEMAW.js","sourcesContent":["/**\n * Platform-triggered asset deployment.\n *\n * Takes catalog entries (with source_path relative to ai-assets/) and deploys\n * them to a session's .claude/skills/ directory. Handles skill context injection\n * and catalog priority-based name resolution.\n */\n\nimport { cp, mkdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { join, resolve, sep } from \"node:path\";\nimport { fsDeadlineMs, tryWithFsDeadline, withFsDeadline } from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\n\n// ---------------------------------------------------------------------------\n// Types (formerly in catalog-compiler.ts, inlined after tear-out in Task 1.5)\n// ---------------------------------------------------------------------------\n\n/**\n * A single user-facing input parameter declared in a SKILL.md.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface InputSpec {\n /** Input parameter key used in skill invocation. */\n key: string;\n /** Whether the input must be provided before running the skill. */\n required?: boolean;\n /** Question string shown to the user when collecting this input. */\n prompt?: string;\n /** Short display label for UI forms. */\n label?: string;\n /** Input data type hint (e.g. `\"string\"`, `\"number\"`, `\"file\"`). */\n type?: string;\n /** Additional guidance text shown alongside the input field. */\n hint?: string;\n}\n\n/**\n * A compiled catalog entry (skill or flow).\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface CatalogEntryCompiled {\n /** Unique ID in `publisher/name` form (e.g. `skaileup/cf_overview`). */\n id: string;\n /** Asset kind. */\n kind: \"skill\" | \"flow\";\n /** Human-readable asset name. */\n name: string;\n /** One-line description. */\n description: string;\n /** Semantic version string. */\n version: string;\n /** Maturity stage. */\n stage: \"alpha\" | \"beta\" | \"stable\";\n /** Searchable keywords. */\n keywords: string[];\n /** User-facing input specifications. */\n inputs: InputSpec[];\n /** Asset path relative to assetsRoot. */\n source_path: string;\n /** Optional icon identifier. */\n icon?: string;\n /** Flow-only: required skill names. */\n required_skills?: string[];\n /** Flow-only: optional skill names. */\n optional_skills?: string[];\n}\n\n/**\n * Options controlling how platform-triggered skill deployment is performed.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface DeployFromCatalogOptions {\n /** Root directory of ai-assets (where `source_path` in catalog entries is relative to). */\n assetsRoot: string;\n /** Target directory for deployed skills (e.g. `/workspace/.claude/skills/`). */\n skillsDir: string;\n /** Optional context markdown appended to the deployed skill directory as `CONTEXT.md`. */\n context?: string;\n}\n\n/**\n * Result of a platform-triggered batch skill deployment.\n *\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport interface DeployResult {\n /** IDs of catalog entries successfully deployed. */\n deployed: string[];\n /** IDs of catalog entries skipped (non-skill kinds). */\n skipped: string[];\n /** Error messages for entries that could not be deployed. */\n errors: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Workspace-mount awareness\n// ---------------------------------------------------------------------------\n\n/**\n * Multiplier applied to the base filesystem deadline for whole-tree operations\n * (recursive copy / remove), which legitimately outlast a single `stat`.\n */\nconst TREE_OP_DEADLINE_FACTOR = 4;\n\n/** Default number of parent levels {@link findAiAssetsRoot} inspects. */\nconst AI_ASSETS_WALK_LEVELS = 6;\n\nlet deployerLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n deployerLogger ??= createLogger({ kind: \"runner\", subkind: \"catalog-deployer\" });\n return deployerLogger;\n}\n\n/**\n * Where the agent container binds its rclone FUSE mount. Nothing under this\n * path is a safe place to read an asset tree from: the mount is remote\n * (SharePoint / OneDrive / WebDAV) and can wedge indefinitely.\n */\nconst DEFAULT_WORKSPACE_MOUNT_DIR = \"/skaile/workspace\";\n\n/**\n * Env override for the workspace-mount path(s), comma-separated.\n *\n * Set it when the runner binds the mount somewhere other than\n * {@link DEFAULT_WORKSPACE_MOUNT_DIR}; set it to the empty string to disable\n * the guard entirely (single-machine dev, where nothing is a network mount).\n */\nexport const WORKSPACE_MOUNT_ENV_VAR = \"SKAILE_WORKSPACE_MOUNT_DIR\";\n\n/**\n * Resolve the directories treated as network mounts.\n *\n * Read per call rather than cached: the runner mutates `process.env` while\n * wiring a session, so a module-load snapshot would pin a pre-configuration\n * value.\n *\n * @returns Absolute mount paths; empty when the guard is disabled.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function workspaceMountDirs(): string[] {\n const raw = process.env[WORKSPACE_MOUNT_ENV_VAR];\n if (raw === undefined) return [DEFAULT_WORKSPACE_MOUNT_DIR];\n return raw\n .split(\",\")\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0)\n .map((segment) => resolve(segment));\n}\n\n/**\n * Is `candidate` at, or inside, one of the known workspace mount paths?\n *\n * Pure path arithmetic — deliberately no filesystem access, because the whole\n * point is to decide *before* touching a path that might be unresponsive.\n *\n * @param candidate - Path to test.\n * @param mountDirs - Mount roots; defaults to {@link workspaceMountDirs}.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function isUnderWorkspaceMount(\n candidate: string,\n mountDirs: string[] = workspaceMountDirs(),\n): boolean {\n const target = resolve(candidate);\n return mountDirs.some((dir) => {\n const root = resolve(dir);\n return target === root || target.startsWith(root + sep);\n });\n}\n\n/**\n * Walk upward from `startDir` looking for an `ai-assets/` directory.\n *\n * Two properties matter beyond \"find the folder\":\n *\n * 1. **Never synchronous.** The walk probes up to six directories; any one of\n * them can be on a FUSE mount, and the former `existsSync` chain blocked the\n * event loop on the first unresponsive probe. Each probe is now awaited and\n * deadline-bounded, so a wedged mount costs one skipped candidate.\n * 2. **Never resolves onto a mount.** A hit under the workspace mount is\n * skipped with a warning rather than returned: accepting it would wire every\n * later skill deploy — a recursive copy — to a remote filesystem. The walk\n * continues upward, so a legitimate `ai-assets/` in a parent still wins.\n *\n * Only a **directory** counts. An `ai-assets` file would otherwise be returned\n * as a root and every later `join(root, source_path)` would fail with ENOTDIR.\n *\n * @param startDir - Directory to start from (typically the project dir).\n * @param opts - `levels` caps the upward walk; `mountDirs` overrides the mount\n * roots (defaults to {@link workspaceMountDirs}).\n * @returns Absolute path to the `ai-assets/` directory, or `null` if none is\n * reachable within `levels`.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function findAiAssetsRoot(\n startDir: string,\n opts?: { levels?: number; mountDirs?: string[] },\n): Promise<string | null> {\n const mountDirs = opts?.mountDirs ?? workspaceMountDirs();\n const levels = opts?.levels ?? AI_ASSETS_WALK_LEVELS;\n let dir = resolve(startDir);\n // Every level of a `/skaile/workspace/...` start dir is under the mount, so\n // an unconditional warn would fire once per level for one lookup. Collect and\n // report once — the operator needs the fact, not six copies of it.\n const refused: string[] = [];\n\n for (let i = 0; i < levels; i++) {\n const candidate = join(dir, \"ai-assets\");\n if (isUnderWorkspaceMount(candidate, mountDirs)) {\n refused.push(candidate);\n } else {\n const isDir = await tryWithFsDeadline(\n `stat ${candidate}`,\n async () => (await stat(candidate)).isDirectory(),\n false,\n );\n if (isDir) {\n if (refused.length > 0) warnRefused(refused, mountDirs);\n return candidate;\n }\n }\n const parent = resolve(dir, \"..\");\n if (parent === dir) break; // filesystem root — nothing further up\n dir = parent;\n }\n if (refused.length > 0) warnRefused(refused, mountDirs);\n return null;\n}\n\n/** Single warning for every `ai-assets` candidate skipped for sitting on a mount. */\nfunction warnRefused(refused: string[], mountDirs: string[]): void {\n log().warn(\n \"findAiAssetsRoot refused candidates under a workspace mount — deploying skills from a network mount can stall the session\",\n { refused, mountDirs },\n );\n}\n\n/**\n * Deploy a single catalog entry to the session skills directory.\n *\n * Copies the entire skill source directory into `skillsDir/<entry.name>/`.\n * If `context` is provided, a separate `CONTEXT.md` is written alongside\n * `SKILL.md` so the source file is never modified.\n *\n * Only `skill` entries are deployable; other kinds return an error.\n *\n * **Async by necessity.** This runs from the `session_init` command handler\n * with the WebSocket live, and both `assetsRoot` and `skillsDir` can sit on a\n * network mount. The former `cpSync`/`rmSync` pair parked the event loop for\n * the whole copy; every call is now awaited and deadline-bounded, so an\n * unresponsive mount fails one deployment instead of the session.\n *\n * @param entry - Compiled catalog entry to deploy.\n * @param options - Deployment target and optional context.\n * @returns `{ success: true }` on success, `{ success: false, error }` on failure.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function deployCatalogEntry(\n entry: CatalogEntryCompiled,\n options: DeployFromCatalogOptions,\n): Promise<{ success: boolean; error?: string }> {\n const { assetsRoot, skillsDir, context } = options;\n\n if (entry.kind !== \"skill\") {\n return { success: false, error: `Cannot deploy ${entry.kind} directly — only skills` };\n }\n\n const sourcePath = join(assetsRoot, entry.source_path);\n const skillMdPath = join(sourcePath, \"SKILL.md\");\n\n const hasSkillMd = await tryWithFsDeadline(\n `stat ${skillMdPath}`,\n async () => {\n await stat(skillMdPath);\n return true;\n },\n false,\n );\n if (!hasSkillMd) {\n return { success: false, error: `SKILL.md not found at ${skillMdPath}` };\n }\n\n const destDir = join(skillsDir, entry.name);\n\n try {\n await withFsDeadline(`mkdir ${destDir}`, () => mkdir(destDir, { recursive: true }));\n\n // Copy the entire skill directory\n await withFsDeadline(\n `cp ${sourcePath} -> ${destDir}`,\n () => cp(sourcePath, destDir, { recursive: true }),\n fsDeadlineMs() * TREE_OP_DEADLINE_FACTOR,\n );\n\n // Write context to a separate CONTEXT.md — never modify the original SKILL.md.\n // The agent discovers both files in the skill directory.\n const contextPath = join(destDir, \"CONTEXT.md\");\n if (context) {\n await withFsDeadline(`write ${contextPath}`, () =>\n writeFile(contextPath, `# Additional Context\\n\\n${context}\\n`, \"utf8\"),\n );\n } else {\n // `force: true` makes this a single call: a stale CONTEXT.md is removed,\n // an absent one is a no-op. The former existsSync probe only added a\n // second trip to the same possibly-wedged mount.\n await withFsDeadline(`rm ${contextPath}`, () => rm(contextPath, { force: true }));\n }\n } catch (err) {\n return { success: false, error: err instanceof Error ? err.message : String(err) };\n }\n\n return { success: true };\n}\n\n/**\n * Remove a deployed skill directory from the session skills directory.\n *\n * @param name - Skill name (directory basename under `skillsDir`).\n * @param skillsDir - Absolute path to the session skills directory.\n * @returns `true` if the skill was found and removed; `false` if it was not\n * deployed, or if the directory could not be reached within the deadline.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function undeployCatalogEntry(name: string, skillsDir: string): Promise<boolean> {\n const destDir = join(skillsDir, name);\n const exists = await tryWithFsDeadline(\n `stat ${destDir}`,\n async () => {\n await stat(destDir);\n return true;\n },\n false,\n );\n if (!exists) return false;\n await withFsDeadline(\n `rm -r ${destDir}`,\n () => rm(destDir, { recursive: true, force: true }),\n fsDeadlineMs() * TREE_OP_DEADLINE_FACTOR,\n );\n return true;\n}\n\n/**\n * Deploy multiple catalog entries in a single batch operation.\n *\n * Non-skill entries (flows, agents, etc.) are automatically skipped and\n * recorded in `result.skipped`. Deployment failures are collected in\n * `result.errors` without aborting the rest of the batch.\n *\n * @param entries - Compiled catalog entries to deploy.\n * @param options - Deployment target and optional context.\n * @returns Aggregated {@link DeployResult} with deployed, skipped, and error lists.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport async function deployAll(\n entries: CatalogEntryCompiled[],\n options: DeployFromCatalogOptions,\n): Promise<DeployResult> {\n const result: DeployResult = { deployed: [], skipped: [], errors: [] };\n\n for (const entry of entries) {\n if (entry.kind !== \"skill\") {\n result.skipped.push(entry.id);\n continue;\n }\n\n // Serial on purpose: concurrent recursive copies onto one mount multiply\n // the queue depth on the exact resource that is already the bottleneck.\n const r = await deployCatalogEntry(entry, options);\n if (r.success) {\n result.deployed.push(entry.id);\n } else {\n result.errors.push(`${entry.id}: ${r.error}`);\n }\n }\n\n return result;\n}\n\n/**\n * Resolve a flow's skill dependencies from the full catalog entry list.\n *\n * Partitions `flow.required_skills` and `flow.optional_skills` into resolved\n * entries and a list of names that could not be found. Missing optional skills\n * are silently ignored (they do not appear in `missing`).\n *\n * @param flow - Compiled flow entry whose skill dependencies should be resolved.\n * @param allEntries - Full set of compiled catalog entries to search.\n * @returns Object containing resolved `required` entries, resolved `optional` entries,\n * and `missing` skill names that were listed as required but not found.\n * @docLink packages/asset-manager/concepts#catalog-deployer\n */\nexport function resolveFlowSkills(\n flow: CatalogEntryCompiled,\n allEntries: CatalogEntryCompiled[],\n): { required: CatalogEntryCompiled[]; optional: CatalogEntryCompiled[]; missing: string[] } {\n const skillsByName = new Map<string, CatalogEntryCompiled>();\n for (const e of allEntries) {\n if (e.kind === \"skill\") skillsByName.set(e.name, e);\n }\n\n const required: CatalogEntryCompiled[] = [];\n const optional: CatalogEntryCompiled[] = [];\n const missing: string[] = [];\n\n for (const name of flow.required_skills ?? []) {\n const entry = skillsByName.get(name);\n if (entry) required.push(entry);\n else missing.push(name);\n }\n\n for (const name of flow.optional_skills ?? []) {\n const entry = skillsByName.get(name);\n if (entry) optional.push(entry);\n // Optional skills don't count as missing\n }\n\n return { required, optional, missing };\n}\n"]}
@@ -219,5 +219,5 @@ function describeStimulus(stimulus) {
219
219
  }
220
220
 
221
221
  export { buildOrchestratorPrompt, describeStimulus, renderStimulusPrompt, renderSubpromptPrompt };
222
- //# sourceMappingURL=chunk-M3WPBTGJ.js.map
223
- //# sourceMappingURL=chunk-M3WPBTGJ.js.map
222
+ //# sourceMappingURL=chunk-WD3L5QSU.js.map
223
+ //# sourceMappingURL=chunk-WD3L5QSU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../factory-assets/connectors/flow/prompt-fragments.ts"],"names":[],"mappings":";;;AA2DO,SAAS,qBAAqB,QAAA,EAAgC;AACnE,EAAA,QAAQ,SAAS,IAAA;AAAM,IACrB,KAAK,cAAA;AACH,MAAA,OAAO,iKAAA;AAAA,IACT,KAAK,mBAAA,EAAqB;AACxB,MAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,SAAA,EAAW,UAAS,GAAI,QAAA;AAClD,MAAA,IAAI,aAAa,UAAA,EAAY;AAC3B,QAAA,OAAO,CAAA,OAAA,EAAU,MAAM,CAAA,uBAAA,EAA0B,SAAS,CAAA,yGAAA,CAAA;AAAA,MAC5D;AACA,MAAA,MAAM,EAAA,GAAK,QAAA,GAAW,CAAA,YAAA,EAAe,QAAQ,CAAA,EAAA,CAAA,GAAO,EAAA;AACpD,MAAA,OAAO,CAAA,OAAA,EAAU,MAAM,CAAA,uBAAA,EAA0B,SAAS,IAAI,EAAE,CAAA,kNAAA,CAAA;AAAA,IAClE;AAAA,IACA,KAAK,gBAAA;AACH,MAAA,OAAO,CAAA,wCAAA,EAA2C,QAAA,CAAS,MAAM,CAAA,gBAAA,EAAmB,SAAS,UAAU,CAAA,0FAAA,CAAA;AAAA,IACzG,KAAK,iBAAA;AACH,MAAA,OAAO,CAAA,mCAAA,EAAsC,QAAA,CAAS,MAAM,CAAA,iBAAA,EAAoB,SAAS,WAAW,CAAA,yLAAA,CAAA;AAAA,IACtG,KAA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ions that translate a {@link TurnStimulus} into the strings the\n * runner's flow orchestrator splices into the per-turn agent prompt.\n * Extracted from `runner/src/flow-orchestrator.ts` in Phase 3 of the\n * flow-connector extraction (2026-05-08) so the connector owns its\n * prompt-rendering surface without a runtime dep on the orchestrator.\n *\n * The contract is byte-identical to the previous inline implementation —\n * any divergence is a regression.\n *\n * @docLink packages/factory-assets/flow#prompt-fragments\n */\n\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport type { FlowDefinition } from \"./engine/types.js\";\nimport {\n flowDefaults,\n isAgentNode,\n isCheckNode,\n isGateNode,\n nodeIsOptional,\n nodeLabel,\n nodeRequiresApproval,\n} from \"./engine/node-shape.js\";\n\n/**\n * Reasons why a new turn is starting. The flow orchestrator's prompt template\n * renders a stimulus-specific paragraph (via {@link renderStimulusPrompt}) so\n * the agent knows exactly why it has been invoked.\n *\n * @docLink packages/factory-assets/flow#turn-stimulus\n */\nexport type TurnStimulus =\n | { kind: \"flow_started\" }\n | {\n kind: \"approval_received\";\n nodeId: string;\n decision: \"approved\" | \"rejected\";\n feedback?: string;\n decidedBy: string;\n }\n | { kind: \"input_received\"; nodeId: string; response: unknown; providedBy: string }\n | { kind: \"retry_requested\"; nodeId: string; requestedBy: string }\n | { kind: \"user_message\"; text: string; senderId: string }\n | { kind: \"resumed_after_hibernation\" }\n | { kind: \"cancelled\" }\n | { kind: \"state_changed\" };\n\n/**\n * Render the stimulus paragraph the agent sees at turn start.\n *\n * The output is a single paragraph (one or more sentences, no surrounding\n * whitespace) describing why the runner has woken the agent. Spliced into\n * the orchestrator prompt under the `## Why this turn is happening` heading.\n *\n * @docLink packages/factory-assets/flow#render-stimulus-prompt\n */\nexport function renderStimulusPrompt(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"The user just started this flow. Begin with the first available node — call `get_available`, then `build_handoff` for your chosen node, then `start_node`.\";\n case \"approval_received\": {\n const { nodeId, decision, decidedBy, feedback } = stimulus;\n if (decision === \"approved\") {\n return `Node \\`${nodeId}\\` was **approved** by ${decidedBy}. Call \\`complete_node\\` for this node with the approved output, then advance to the next available node.`;\n }\n const fb = feedback ? ` Feedback: \"${feedback}\".` : \"\";\n return `Node \\`${nodeId}\\` was **rejected** by ${decidedBy}.${fb} Decide how to proceed: retry the node (the engine returned it to \\`available\\`), ask clarifying questions via \\`request_input\\`, or call \\`fail_node(..., recoverable: false)\\` if the issue cannot be addressed.`;\n }\n case \"input_received\":\n return `The user just provided input for node \\`${stimulus.nodeId}\\` (provided by ${stimulus.providedBy}). The node has returned to its prior status. Continue executing the node with this input.`;\n case \"retry_requested\":\n return `A user requested a retry of node \\`${stimulus.nodeId}\\` (requested by ${stimulus.requestedBy}). The node has been returned to \\`available\\` with its prior error preserved in history. Start a fresh attempt — review the error context if relevant and try a different approach.`;\n case \"user_message\":\n return `A user sent a message: \"${stimulus.text}\" (from ${stimulus.senderId}). You can respond directly without touching the flow, continue flow work, or both. If the message is a question about the flow, answer it; if it signals a new direction, consider whether to pause.`;\n case \"resumed_after_hibernation\":\n return \"This session was hibernated and has just resumed. Review the current state above and continue where you left off. No state was lost.\";\n case \"cancelled\":\n return \"The user has cancelled this flow. Wrap up cleanly: do not start any new nodes. You may record a short summary if relevant, then stop.\";\n case \"state_changed\":\n return \"The flow state changed. Review the current state above and continue work accordingly.\";\n }\n}\n\n/**\n * Build the full agent-orchestrator prompt for a flow turn.\n *\n * Reassembles the five-section prompt from the current FlowExecution snapshot\n * and the supplied stimulus:\n *\n * 1. Flow definition (markdown table of nodes)\n * 2. Current state (progress, available/blocked, interaction pointers)\n * 3. Why this turn is happening (stimulus-specific paragraph)\n * 4. Flow tools available (static documentation)\n * 5. Rules\n *\n * Originally a byte-identical lift of the (since-deleted)\n * `FlowOrchestrator.buildOrchestratorPrompt`; the contract now is simply\n * this function's own output. When strict v2 defaults or legacy globals are\n * non-empty, a `## Flow globals` section exposes those run-scoped values. The\n * flow-wide active-node table stays bounded to selection metadata; `build_handoff`\n * supplies a selected agent node's execution payload. First-class gates appear\n * as runtime-owned state but never as agent-executable work.\n * Pure — depends only on its inputs.\n *\n * @docLink packages/factory-assets/flow#build-orchestrator-prompt\n * @since 2.2.0\n */\nexport function buildOrchestratorPrompt(\n flowDef: FlowDefinition,\n state: FlowExecution,\n stimulus: TurnStimulus,\n): string {\n const agentNodes = flowDef.nodes.filter(isAgentNode);\n const gateNodes = flowDef.nodes.filter(isGateNode);\n const checkNodes = flowDef.nodes.filter(isCheckNode);\n const promptNodes = flowDef.nodes.filter((node) => isAgentNode(node) || isGateNode(node));\n const agentNodeIds = new Set(agentNodes.map((node) => node.id));\n const promptNodeIds = new Set(promptNodes.map((node) => node.id));\n\n // ── Section 1: definition table ──\n const nodeRows = promptNodes\n .map((n) => {\n const deps =\n flowDef.edges\n .filter((e) => e.target === n.id && e.type === \"flow\")\n .map((e) => e.source)\n .join(\", \") || \"—\";\n const required = nodeIsOptional(n) ? \"optional\" : \"required\";\n const gate = isGateNode(n) ? \"first-class\" : nodeRequiresApproval(n) ? \"mandatory\" : \"—\";\n const nodeState = state.nodes[n.id];\n const status = nodeState?.status ?? \"not_started\";\n const description = (n.description ?? n.data?.description ?? \"—\")\n .replace(/\\s+/g, \" \")\n .replaceAll(\"|\", \"\\\\|\");\n return `| ${n.id} | ${nodeLabel(n)} | ${description} | ${required} | ${gate} | ${status} | ${deps} |`;\n })\n .join(\"\\n\");\n\n // ── Section 2: current state summary ──\n const nodesByStatus = (s: string) =>\n Object.values(state.nodes)\n .filter((n) => promptNodeIds.has(n.id) && n.status === s)\n .map((n) => n.id);\n // An approved agent node stays `awaiting_approval` until the agent calls\n // `complete_node`. Listed with the undecided ones, a resumed agent reads the\n // human decision as still pending and ends its turn, hanging the run.\n const approvedAwaitingCompletion = Object.values(state.nodes).filter(\n (n) =>\n agentNodeIds.has(n.id) &&\n n.status === \"awaiting_approval\" &&\n n.approval?.decision === \"approved\" &&\n n.approval.decidedAt != null,\n );\n const approvedIds = new Set(approvedAwaitingCompletion.map((n) => n.id));\n const available = nodesByStatus(\"available\");\n const awaitingApproval = nodesByStatus(\"awaiting_approval\").filter((id) => !approvedIds.has(id));\n const awaitingInput = nodesByStatus(\"awaiting_input\");\n const running = nodesByStatus(\"running\");\n const failed = nodesByStatus(\"failed\");\n const completed = nodesByStatus(\"complete\");\n const totalRequired = promptNodes.filter((n) => !nodeIsOptional(n)).length;\n\n const stateSummary = [\n `- Run ID: ${state.runId}`,\n `- Status: ${state.status}`,\n `- Autonomous mode: ${state.autonomousMode}`,\n `- Progress: ${completed.length} / ${totalRequired} required nodes complete`,\n `- Available now: ${available.join(\", \") || \"(none)\"}`,\n `- Currently running: ${running.join(\", \") || \"(none)\"}`,\n `- Awaiting approval: ${awaitingApproval.join(\", \") || \"(none)\"}`,\n ...(approvedIds.size > 0\n ? [`- Approved, awaiting \\`complete_node\\`: ${[...approvedIds].join(\", \")}`]\n : []),\n `- Awaiting input: ${awaitingInput.join(\", \") || \"(none)\"}`,\n `- Failed: ${failed.join(\", \") || \"(none)\"}`,\n ].join(\"\\n\");\n\n const approvedSection =\n approvedAwaitingCompletion.length > 0\n ? `## Approved nodes awaiting completion\n\n${approvedAwaitingCompletion\n .map(\n (node) =>\n `- \\`${node.id}\\` — approved by ${node.approval?.decidedBy ?? \"unknown reviewer\"} at ${node.approval?.decidedAt}`,\n )\n .join(\"\\n\")}\n\nA human has already approved these nodes. Do not wait for another decision and do not call \\`request_approval\\` again. Carry out whatever the approval authorised that is still outstanding, then call \\`complete_node\\` for each.\n\n`\n : \"\";\n\n const outputCorrections = Object.values(state.nodes)\n .filter(\n (node) =>\n agentNodeIds.has(node.id) &&\n node.outputCorrection &&\n node.status !== \"complete\" &&\n node.status !== \"failed\",\n )\n .map(\n (node) =>\n `- Node \\`${node.id}\\`: ${node.outputCorrection?.issues.join(\"; \") ?? \"unknown issue\"}`,\n );\n const correctionSection =\n outputCorrections.length > 0\n ? `## Output correction required\n\nThe following node has already used its single corrective reprompt. Submit one corrected \\`complete_node\\` call that fixes every issue; a second mismatch fails the node.\n\n${outputCorrections.join(\"\\n\")}\n\n`\n : \"\";\n\n const rejectedGates = gateNodes.flatMap((node) => {\n const approval = state.nodes[node.id]?.approval;\n if (approval?.decision !== \"rejected\") return [];\n return [\n `- \\`${node.id}\\` — rejected by ${approval.decidedBy ?? \"unknown reviewer\"}: ${\n approval.feedback ?? \"(no feedback provided)\"\n }`,\n ];\n });\n const rejectedGateSection =\n rejectedGates.length > 0\n ? `## Rejected first-class gates requiring revision\n\n${rejectedGates.join(\"\\n\")}\n\nRevise the surrounding work in conversation, then re-request each gate with \\`request_approval(nodeId, summary, artifacts)\\`. Every gate remains parked until its new human decision; do not start, complete, skip, or fail a first-class gate.\n\n`\n : \"\";\n\n // An override survives only in the approval record: the state table shows the\n // node as `complete` like any other, so without this section the failure is\n // invisible from the turn after the decision onward.\n const overriddenChecks = checkNodes.flatMap((node) => {\n const record = state.nodes[node.id];\n if (record?.status !== \"complete\" || record.approval?.decision !== \"approved\") return [];\n return [\n `- \\`${node.id}\\` — failed, overridden by ${record.approval.decidedBy ?? \"unknown reviewer\"}: ${\n record.approval.feedback ?? \"(no reason recorded)\"\n }`,\n ];\n });\n const overriddenCheckSection =\n overriddenChecks.length > 0\n ? `## Checks completed by human override\n\n${overriddenChecks.join(\"\\n\")}\n\nThese checks did **not** pass. A human decided the run may continue anyway, so they are \\`complete\\` and their dependents are unblocked. Their evidence still records the failure — do not report them as passing, and say so if downstream work depends on what they were meant to verify.\n\n`\n : \"\";\n\n // ── Section 2b: flow globals (additive — omitted entirely when empty so\n // flows without globals keep the byte-identical Phase 3 prompt) ──\n const globals = flowDefaults(flowDef);\n const globalsSection =\n Object.keys(globals).length > 0\n ? `## Flow globals\n\nRun-scoped parameters set by the flow author or by the host that started this run. When \\`run_input\\` is present it carries the payload this run was started with (e.g. a scheduled or webhook-triggered run) — treat it as the run's initial input instead of asking the user for it.\n\n\\`\\`\\`json\n${JSON.stringify(globals, null, 2)}\n\\`\\`\\`\n\n`\n : \"\";\n\n // ── Section 3: stimulus paragraph ──\n const stimulusNode =\n stimulus.kind === \"approval_received\"\n ? flowDef.nodes.find((node) => node.id === stimulus.nodeId)\n : undefined;\n let stimulusParagraph = renderStimulusPrompt(stimulus);\n if (stimulus.kind === \"approval_received\" && stimulusNode && isGateNode(stimulusNode)) {\n if (stimulus.decision === \"approved\") {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` is already \\`complete\\` after approval by ${stimulus.decidedBy}. Do not call \\`complete_node\\` for the gate. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`;\n } else {\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` was **rejected** by ${stimulus.decidedBy}.${\n stimulus.feedback ? ` Feedback: \"${stimulus.feedback}\".` : \"\"\n } Revise the work in conversation and follow the rejected-gate instructions above.`;\n }\n }\n // A check is host-decided the same way a gate is: the adapter already wrote the\n // terminal status, and `complete_node` rejects any non-agent node — so the\n // generic approved/rejected wording would send the agent into a guaranteed throw.\n if (stimulus.kind === \"approval_received\" && stimulusNode && isCheckNode(stimulusNode)) {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph =\n stimulus.decision === \"approved\"\n ? `Check node \\`${stimulus.nodeId}\\` failed, and ${stimulus.decidedBy} **overrode** the failure${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already \\`complete\\` and its evidence still records the failure. Do not call \\`complete_node\\` for it. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`\n : `Check node \\`${stimulus.nodeId}\\` failed and ${stimulus.decidedBy} **rejected** it${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already terminally \\`failed\\` — it did not return to \\`available\\`. Do not call \\`complete_node\\` or \\`fail_node\\` for it. Report the outcome and stop unless other nodes remain available.`;\n }\n\n // ── Section 4+5: static tool surface and rules ──\n return `# Flow Execution Context\n\nYou are orchestrating the flow **${flowDef.name}** (${flowDef.id} v${flowDef.version}). This is a governed flow execution: your job is to run nodes through the flow tools, summarize their outputs for human review, and yield control at approval gates.\n\n## Flow definition\n\n| ID | Label | Description | Required | Gate | Status | Depends on |\n|----|-------|-------------|----------|------|--------|------------|\n${nodeRows}\n\nNodes with **Gate = mandatory** are hard approval gates: they always require \\`request_approval\\` and a human decision, even when autonomous mode is on. They cannot be skipped — \\`request_approval\\` → approval is their only completion path.\nNodes with **Gate = first-class** are runtime-owned human decisions. The runtime parks them automatically and completes them directly on approval; the agent never executes them.\n\n## Current state\n\n${stateSummary}\n\n${globalsSection}${correctionSection}${rejectedGateSection}${overriddenCheckSection}${approvedSection}## Why this turn is happening\n\n${stimulusParagraph}\n\n## Flow tools available\n\nAll tools are exposed by the \\`flow\\` connector:\n\n- \\`get_available()\\` — list node IDs that are ready to start\n- \\`get_state()\\` — full current state including approvals, inputs, outputs\n- \\`get_globals()\\` — the flow's run-scoped globals (e.g. the \\`run_input\\` payload for scheduled/params-bound runs)\n- \\`build_handoff(nodeId)\\` — selected node instruction, supplied bindings, required assets, and upstream context\n- \\`start_node(nodeId)\\` — transition an agent node from \\`available\\` → \\`running\\`; call before executing it. Never start a first-class gate.\n- \\`request_approval(nodeId, summary, artifacts)\\` — transition a running agent node to \\`awaiting_approval\\`, or replace a rejected first-class gate's decision with a fresh pending request. **This ends your turn.**\n- \\`request_input(nodeId, prompt, schema)\\` — transition to \\`awaiting_input\\`. **This ends your turn.** Legal from \\`available\\`, \\`running\\`, or \\`awaiting_approval\\`.\n- \\`complete_node(nodeId, summary, fields?, artifacts?, concerns?)\\` — complete an agent node. When downstream nodes consume declared output fields, include a conforming JSON object. The first mismatch gets one corrective call; the second fails the node. Valid only if the agent node was approved, OR autonomousMode is true and it does not require mandatory approval. First-class gates are completed by the runtime on approval; never call this tool for them.\n- \\`fail_node(nodeId, message, recoverable)\\` — transition to \\`failed\\`, or to \\`skipped\\` if the node is optional. \\`recoverable=true\\` returns the node to \\`available\\` instead.\n- \\`skip_node(nodeId)\\` — transition to \\`skipped\\`. Only valid for optional nodes.\n\n## Rules\n\n1. Before executing an agent node, call \\`build_handoff(nodeId)\\` and follow its instruction with the supplied bindings, assets, and upstream context; then call \\`start_node(nodeId)\\`.\n2. After executing the node, call \\`request_approval\\` unless \\`autonomousMode\\` is true — in which case call \\`complete_node\\` directly. Exception: nodes marked **Gate = mandatory** always require \\`request_approval\\` and a human decision, even in autonomous mode.\n3. First-class nodes marked **Gate = first-class** are runtime-owned. Never start, complete, skip, fail, or request input for them. After rejection, revise in conversation and only call \\`request_approval\\` to create the next attempt.\n4. If you need information from the user before or during agent execution, call \\`request_input\\`. This ends your turn until the user responds.\n5. On unrecoverable agent failure, call \\`fail_node(..., recoverable: false)\\`; an optional node ends \\`skipped\\` rather than \\`failed\\`, so the run continues past it. On recoverable failure, call \\`fail_node(..., recoverable: true)\\` and the engine returns the node to \\`available\\`.\n6. When all required nodes are \\`complete\\` or \\`skipped\\`, stop. The runner marks the flow done automatically.\n7. Free-chat user messages do not require flow action. Respond directly, continue flow work, or both — your call.\n`;\n}\n\n/**\n * Render the full prompt sent to a subprompt node's isolated driver instance.\n *\n * `instruction` is already interpolated with the node's resolved bindings\n * (the same `interpolateNodeInstruction` step an agent handoff uses) — this\n * function only adds the typed-response directive when the node declares an\n * output contract. There is no corrective reprompt for a subprompt (it has no\n * conversation to reprompt in), so the directive is the runtime's only lever\n * for getting parseable JSON back; a malformed or non-conforming reply is an\n * ordinary node failure handled by the caller, never retried in-band here.\n *\n * The object-only constraint is therefore stated twice, before and after the\n * schema: the serialized schema is a large blob, so a directive placed only\n * ahead of it is not the last thing the model reads.\n *\n * @docLink packages/factory-assets/flow#render-subprompt-prompt\n */\nexport function renderSubpromptPrompt(\n instruction: string,\n outputSchema: Record<string, unknown> | undefined,\n): string {\n if (!outputSchema) return instruction;\n return `${instruction}\\n\\nRespond with a single JSON object matching this JSON Schema, and nothing else — no markdown code fences, no commentary before or after it:\\n\\n${JSON.stringify(outputSchema, null, 2)}\\n\\nReply with the object only. The first character of your reply must be \\`{\\` and the last must be \\`}\\` — no explanation, no restatement, no code fence.`;\n}\n\n/**\n * Single-line tag suitable for telemetry / logging. Derives a short, stable\n * summary of a stimulus that's safe to attach to spans, log entries, and\n * trace events. The kind is always included; node-specific stimuli also\n * include their `nodeId` so log queries can pivot on it.\n *\n * @docLink packages/factory-assets/flow#describe-stimulus\n */\nexport function describeStimulus(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"flow_started\";\n case \"approval_received\":\n return `approval_received:${stimulus.nodeId}:${stimulus.decision}`;\n case \"input_received\":\n return `input_received:${stimulus.nodeId}`;\n case \"retry_requested\":\n return `retry_requested:${stimulus.nodeId}`;\n case \"user_message\":\n return `user_message:${stimulus.senderId}`;\n case \"resumed_after_hibernation\":\n return \"resumed_after_hibernation\";\n case \"cancelled\":\n return \"cancelled\";\n case \"state_changed\":\n return \"state_changed\";\n }\n}\n"]}
1
+ {"version":3,"sources":["../factory-assets/connectors/flow/prompt-fragments.ts"],"names":[],"mappings":";;;AA2DO,SAAS,qBAAqB,QAAA,EAAgC;AACnE,EAAA,QAAQ,SAAS,IAAA;AAAM,IACrB,KAAK,cAAA;AACH,MAAA,OAAO,iKAAA;AAAA,IACT,KAAK,mBAAA,EAAqB;AACxB,MAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,SAAA,EAAW,UAAS,GAAI,QAAA;AAClD,MAAA,IAAI,aAAa,UAAA,EAAY;AAC3B,QAAA,OAAO,CAA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AO,CAAA,kBAAA,EAAqB,QAAA,CAAS,MAAM,CAAA,CAAA,EAAI,SAAS,QAAQ,CAAA,CAAA;AAAA,IAClE,KAAK,gBAAA;AACH,MAAA,OAAO,CAAA,eAAA,EAAkB,SAAS,MAAM,CAAA,CAAA;AAAA,IAC1C,KAAK,iBAAA;AACH,MAAA,OAAO,CAAA,gBAAA,EAAmB,SAAS,MAAM,CAAA,CAAA;AAAA,IAC3C,KAAK,cAAA;AACH,MAAA,OAAO,CAAA,aAAA,EAAgB,SAAS,QAAQ,CAAA,CAAA;AAAA,IAC1C,KAAK,2BAAA;AACH,MAAA,OAAO,2BAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,WAAA;AAAA,IACT,KAAK,eAAA;AACH,MAAA,OAAO,eAAA;AAAA;AAEb","file":"chunk-WD3L5QSU.js","sourcesContent":["/**\n * Prompt fragments for the flow connector.\n *\n * Pure functions that translate a {@link TurnStimulus} into the strings the\n * runner's flow orchestrator splices into the per-turn agent prompt.\n * Extracted from `runner/src/flow-orchestrator.ts` in Phase 3 of the\n * flow-connector extraction (2026-05-08) so the connector owns its\n * prompt-rendering surface without a runtime dep on the orchestrator.\n *\n * The contract is byte-identical to the previous inline implementation —\n * any divergence is a regression.\n *\n * @docLink packages/factory-assets/flow#prompt-fragments\n */\n\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport type { FlowDefinition } from \"./engine/types.js\";\nimport {\n flowDefaults,\n isAgentNode,\n isCheckNode,\n isGateNode,\n nodeIsOptional,\n nodeLabel,\n nodeRequiresApproval,\n} from \"./engine/node-shape.js\";\n\n/**\n * Reasons why a new turn is starting. The flow orchestrator's prompt template\n * renders a stimulus-specific paragraph (via {@link renderStimulusPrompt}) so\n * the agent knows exactly why it has been invoked.\n *\n * @docLink packages/factory-assets/flow#turn-stimulus\n */\nexport type TurnStimulus =\n | { kind: \"flow_started\" }\n | {\n kind: \"approval_received\";\n nodeId: string;\n decision: \"approved\" | \"rejected\";\n feedback?: string;\n decidedBy: string;\n }\n | { kind: \"input_received\"; nodeId: string; response: unknown; providedBy: string }\n | { kind: \"retry_requested\"; nodeId: string; requestedBy: string }\n | { kind: \"user_message\"; text: string; senderId: string }\n | { kind: \"resumed_after_hibernation\" }\n | { kind: \"cancelled\" }\n | { kind: \"state_changed\" };\n\n/**\n * Render the stimulus paragraph the agent sees at turn start.\n *\n * The output is a single paragraph (one or more sentences, no surrounding\n * whitespace) describing why the runner has woken the agent. Spliced into\n * the orchestrator prompt under the `## Why this turn is happening` heading.\n *\n * @docLink packages/factory-assets/flow#render-stimulus-prompt\n */\nexport function renderStimulusPrompt(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"The user just started this flow. Begin with the first available node — call `get_available`, then `build_handoff` for your chosen node, then `start_node`.\";\n case \"approval_received\": {\n const { nodeId, decision, decidedBy, feedback } = stimulus;\n if (decision === \"approved\") {\n return `Node \\`${nodeId}\\` was **approved** by ${decidedBy}. Call \\`complete_node\\` for this node with the approved output, then advance to the next available node.`;\n }\n const fb = feedback ? ` Feedback: \"${feedback}\".` : \"\";\n return `Node \\`${nodeId}\\` was **rejected** by ${decidedBy}.${fb} Decide how to proceed: retry the node (the engine returned it to \\`available\\`), ask clarifying questions via \\`request_input\\`, or call \\`fail_node(..., recoverable: false)\\` if the issue cannot be addressed.`;\n }\n case \"input_received\":\n return `The user just provided input for node \\`${stimulus.nodeId}\\` (provided by ${stimulus.providedBy}). The node has returned to its prior status. Continue executing the node with this input.`;\n case \"retry_requested\":\n return `A user requested a retry of node \\`${stimulus.nodeId}\\` (requested by ${stimulus.requestedBy}). The node has been returned to \\`available\\` with its prior error preserved in history. Start a fresh attempt — review the error context if relevant and try a different approach.`;\n case \"user_message\":\n return `A user sent a message: \"${stimulus.text}\" (from ${stimulus.senderId}). You can respond directly without touching the flow, continue flow work, or both. If the message is a question about the flow, answer it; if it signals a new direction, consider whether to pause.`;\n case \"resumed_after_hibernation\":\n return \"This session was hibernated and has just resumed. Review the current state above and continue where you left off. No state was lost.\";\n case \"cancelled\":\n return \"The user has cancelled this flow. Wrap up cleanly: do not start any new nodes. You may record a short summary if relevant, then stop.\";\n case \"state_changed\":\n return \"The flow state changed. Review the current state above and continue work accordingly.\";\n }\n}\n\n/**\n * Build the full agent-orchestrator prompt for a flow turn.\n *\n * Reassembles the five-section prompt from the current FlowExecution snapshot\n * and the supplied stimulus:\n *\n * 1. Flow definition (markdown table of nodes)\n * 2. Current state (progress, available/blocked, interaction pointers)\n * 3. Why this turn is happening (stimulus-specific paragraph)\n * 4. Flow tools available (static documentation)\n * 5. Rules\n *\n * Originally a byte-identical lift of the (since-deleted)\n * `FlowOrchestrator.buildOrchestratorPrompt`; the contract now is simply\n * this function's own output. When strict v2 defaults or legacy globals are\n * non-empty, a `## Flow globals` section exposes those run-scoped values. The\n * flow-wide active-node table stays bounded to selection metadata; `build_handoff`\n * supplies a selected agent node's execution payload. First-class gates appear\n * as runtime-owned state but never as agent-executable work.\n * Pure — depends only on its inputs.\n *\n * @docLink packages/factory-assets/flow#build-orchestrator-prompt\n * @since 2.2.0\n */\nexport function buildOrchestratorPrompt(\n flowDef: FlowDefinition,\n state: FlowExecution,\n stimulus: TurnStimulus,\n): string {\n const agentNodes = flowDef.nodes.filter(isAgentNode);\n const gateNodes = flowDef.nodes.filter(isGateNode);\n const checkNodes = flowDef.nodes.filter(isCheckNode);\n const promptNodes = flowDef.nodes.filter((node) => isAgentNode(node) || isGateNode(node));\n const agentNodeIds = new Set(agentNodes.map((node) => node.id));\n const promptNodeIds = new Set(promptNodes.map((node) => node.id));\n\n // ── Section 1: definition table ──\n const nodeRows = promptNodes\n .map((n) => {\n const deps =\n flowDef.edges\n .filter((e) => e.target === n.id && e.type === \"flow\")\n .map((e) => e.source)\n .join(\", \") || \"—\";\n const required = nodeIsOptional(n) ? \"optional\" : \"required\";\n const gate = isGateNode(n) ? \"first-class\" : nodeRequiresApproval(n) ? \"mandatory\" : \"—\";\n const nodeState = state.nodes[n.id];\n const status = nodeState?.status ?? \"not_started\";\n const description = (n.description ?? n.data?.description ?? \"—\")\n .replace(/\\s+/g, \" \")\n .replaceAll(\"|\", \"\\\\|\");\n return `| ${n.id} | ${nodeLabel(n)} | ${description} | ${required} | ${gate} | ${status} | ${deps} |`;\n })\n .join(\"\\n\");\n\n // ── Section 2: current state summary ──\n const nodesByStatus = (s: string) =>\n Object.values(state.nodes)\n .filter((n) => promptNodeIds.has(n.id) && n.status === s)\n .map((n) => n.id);\n // An approved agent node stays `awaiting_approval` until the agent calls\n // `complete_node`. Listed with the undecided ones, a resumed agent reads the\n // human decision as still pending and ends its turn, hanging the run.\n const approvedAwaitingCompletion = Object.values(state.nodes).filter(\n (n) =>\n agentNodeIds.has(n.id) &&\n n.status === \"awaiting_approval\" &&\n n.approval?.decision === \"approved\" &&\n n.approval.decidedAt != null,\n );\n const approvedIds = new Set(approvedAwaitingCompletion.map((n) => n.id));\n const available = nodesByStatus(\"available\");\n const awaitingApproval = nodesByStatus(\"awaiting_approval\").filter((id) => !approvedIds.has(id));\n const awaitingInput = nodesByStatus(\"awaiting_input\");\n const running = nodesByStatus(\"running\");\n const failed = nodesByStatus(\"failed\");\n const completed = nodesByStatus(\"complete\");\n const totalRequired = promptNodes.filter((n) => !nodeIsOptional(n)).length;\n\n const stateSummary = [\n `- Run ID: ${state.runId}`,\n `- Status: ${state.status}`,\n `- Autonomous mode: ${state.autonomousMode}`,\n `- Progress: ${completed.length} / ${totalRequired} required nodes complete`,\n `- Available now: ${available.join(\", \") || \"(none)\"}`,\n `- Currently running: ${running.join(\", \") || \"(none)\"}`,\n `- Awaiting approval: ${awaitingApproval.join(\", \") || \"(none)\"}`,\n ...(approvedIds.size > 0\n ? [`- Approved, awaiting \\`complete_node\\`: ${[...approvedIds].join(\", \")}`]\n : []),\n `- Awaiting input: ${awaitingInput.join(\", \") || \"(none)\"}`,\n `- Failed: ${failed.join(\", \") || \"(none)\"}`,\n ].join(\"\\n\");\n\n const approvedSection =\n approvedAwaitingCompletion.length > 0\n ? `## Approved nodes awaiting completion\n\n${approvedAwaitingCompletion\n .map(\n (node) =>\n `- \\`${node.id}\\` — approved by ${node.approval?.decidedBy ?? \"unknown reviewer\"} at ${node.approval?.decidedAt}`,\n )\n .join(\"\\n\")}\n\nA human has already approved these nodes. Do not wait for another decision and do not call \\`request_approval\\` again. Carry out whatever the approval authorised that is still outstanding, then call \\`complete_node\\` for each.\n\n`\n : \"\";\n\n const outputCorrections = Object.values(state.nodes)\n .filter(\n (node) =>\n agentNodeIds.has(node.id) &&\n node.outputCorrection &&\n node.status !== \"complete\" &&\n node.status !== \"failed\",\n )\n .map(\n (node) =>\n `- Node \\`${node.id}\\`: ${node.outputCorrection?.issues.join(\"; \") ?? \"unknown issue\"}`,\n );\n const correctionSection =\n outputCorrections.length > 0\n ? `## Output correction required\n\nThe following node has already used its single corrective reprompt. Submit one corrected \\`complete_node\\` call that fixes every issue; a second mismatch fails the node.\n\n${outputCorrections.join(\"\\n\")}\n\n`\n : \"\";\n\n const rejectedGates = gateNodes.flatMap((node) => {\n const approval = state.nodes[node.id]?.approval;\n if (approval?.decision !== \"rejected\") return [];\n return [\n `- \\`${node.id}\\` — rejected by ${approval.decidedBy ?? \"unknown reviewer\"}: ${\n approval.feedback ?? \"(no feedback provided)\"\n }`,\n ];\n });\n const rejectedGateSection =\n rejectedGates.length > 0\n ? `## Rejected first-class gates requiring revision\n\n${rejectedGates.join(\"\\n\")}\n\nRevise the surrounding work in conversation, then re-request each gate with \\`request_approval(nodeId, summary, artifacts)\\`. Every gate remains parked until its new human decision; do not start, complete, skip, or fail a first-class gate.\n\n`\n : \"\";\n\n // An override survives only in the approval record: the state table shows the\n // node as `complete` like any other, so without this section the failure is\n // invisible from the turn after the decision onward.\n const overriddenChecks = checkNodes.flatMap((node) => {\n const record = state.nodes[node.id];\n if (record?.status !== \"complete\" || record.approval?.decision !== \"approved\") return [];\n return [\n `- \\`${node.id}\\` — failed, overridden by ${record.approval.decidedBy ?? \"unknown reviewer\"}: ${\n record.approval.feedback ?? \"(no reason recorded)\"\n }`,\n ];\n });\n const overriddenCheckSection =\n overriddenChecks.length > 0\n ? `## Checks completed by human override\n\n${overriddenChecks.join(\"\\n\")}\n\nThese checks did **not** pass. A human decided the run may continue anyway, so they are \\`complete\\` and their dependents are unblocked. Their evidence still records the failure — do not report them as passing, and say so if downstream work depends on what they were meant to verify.\n\n`\n : \"\";\n\n // ── Section 2b: flow globals (additive — omitted entirely when empty so\n // flows without globals keep the byte-identical Phase 3 prompt) ──\n const globals = flowDefaults(flowDef);\n const globalsSection =\n Object.keys(globals).length > 0\n ? `## Flow globals\n\nRun-scoped parameters set by the flow author or by the host that started this run. When \\`run_input\\` is present it carries the payload this run was started with (e.g. a scheduled or webhook-triggered run) — treat it as the run's initial input instead of asking the user for it.\n\n\\`\\`\\`json\n${JSON.stringify(globals, null, 2)}\n\\`\\`\\`\n\n`\n : \"\";\n\n // ── Section 3: stimulus paragraph ──\n const stimulusNode =\n stimulus.kind === \"approval_received\"\n ? flowDef.nodes.find((node) => node.id === stimulus.nodeId)\n : undefined;\n let stimulusParagraph = renderStimulusPrompt(stimulus);\n if (stimulus.kind === \"approval_received\" && stimulusNode && isGateNode(stimulusNode)) {\n if (stimulus.decision === \"approved\") {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` is already \\`complete\\` after approval by ${stimulus.decidedBy}. Do not call \\`complete_node\\` for the gate. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`;\n } else {\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` was **rejected** by ${stimulus.decidedBy}.${\n stimulus.feedback ? ` Feedback: \"${stimulus.feedback}\".` : \"\"\n } Revise the work in conversation and follow the rejected-gate instructions above.`;\n }\n }\n // A check is host-decided the same way a gate is: the adapter already wrote the\n // terminal status, and `complete_node` rejects any non-agent node — so the\n // generic approved/rejected wording would send the agent into a guaranteed throw.\n if (stimulus.kind === \"approval_received\" && stimulusNode && isCheckNode(stimulusNode)) {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph =\n stimulus.decision === \"approved\"\n ? `Check node \\`${stimulus.nodeId}\\` failed, and ${stimulus.decidedBy} **overrode** the failure${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already \\`complete\\` and its evidence still records the failure. Do not call \\`complete_node\\` for it. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`\n : `Check node \\`${stimulus.nodeId}\\` failed and ${stimulus.decidedBy} **rejected** it${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already terminally \\`failed\\` — it did not return to \\`available\\`. Do not call \\`complete_node\\` or \\`fail_node\\` for it. Report the outcome and stop unless other nodes remain available.`;\n }\n\n // ── Section 4+5: static tool surface and rules ──\n return `# Flow Execution Context\n\nYou are orchestrating the flow **${flowDef.name}** (${flowDef.id} v${flowDef.version}). This is a governed flow execution: your job is to run nodes through the flow tools, summarize their outputs for human review, and yield control at approval gates.\n\n## Flow definition\n\n| ID | Label | Description | Required | Gate | Status | Depends on |\n|----|-------|-------------|----------|------|--------|------------|\n${nodeRows}\n\nNodes with **Gate = mandatory** are hard approval gates: they always require \\`request_approval\\` and a human decision, even when autonomous mode is on. They cannot be skipped — \\`request_approval\\` → approval is their only completion path.\nNodes with **Gate = first-class** are runtime-owned human decisions. The runtime parks them automatically and completes them directly on approval; the agent never executes them.\n\n## Current state\n\n${stateSummary}\n\n${globalsSection}${correctionSection}${rejectedGateSection}${overriddenCheckSection}${approvedSection}## Why this turn is happening\n\n${stimulusParagraph}\n\n## Flow tools available\n\nAll tools are exposed by the \\`flow\\` connector:\n\n- \\`get_available()\\` — list node IDs that are ready to start\n- \\`get_state()\\` — full current state including approvals, inputs, outputs\n- \\`get_globals()\\` — the flow's run-scoped globals (e.g. the \\`run_input\\` payload for scheduled/params-bound runs)\n- \\`build_handoff(nodeId)\\` — selected node instruction, supplied bindings, required assets, and upstream context\n- \\`start_node(nodeId)\\` — transition an agent node from \\`available\\` → \\`running\\`; call before executing it. Never start a first-class gate.\n- \\`request_approval(nodeId, summary, artifacts)\\` — transition a running agent node to \\`awaiting_approval\\`, or replace a rejected first-class gate's decision with a fresh pending request. **This ends your turn.**\n- \\`request_input(nodeId, prompt, schema)\\` — transition to \\`awaiting_input\\`. **This ends your turn.** Legal from \\`available\\`, \\`running\\`, or \\`awaiting_approval\\`.\n- \\`complete_node(nodeId, summary, fields?, artifacts?, concerns?)\\` — complete an agent node. When downstream nodes consume declared output fields, include a conforming JSON object. The first mismatch gets one corrective call; the second fails the node. Valid only if the agent node was approved, OR autonomousMode is true and it does not require mandatory approval. First-class gates are completed by the runtime on approval; never call this tool for them.\n- \\`fail_node(nodeId, message, recoverable)\\` — transition to \\`failed\\`, or to \\`skipped\\` if the node is optional. \\`recoverable=true\\` returns the node to \\`available\\` instead.\n- \\`skip_node(nodeId)\\` — transition to \\`skipped\\`. Only valid for optional nodes.\n\n## Rules\n\n1. Before executing an agent node, call \\`build_handoff(nodeId)\\` and follow its instruction with the supplied bindings, assets, and upstream context; then call \\`start_node(nodeId)\\`.\n2. After executing the node, call \\`request_approval\\` unless \\`autonomousMode\\` is true — in which case call \\`complete_node\\` directly. Exception: nodes marked **Gate = mandatory** always require \\`request_approval\\` and a human decision, even in autonomous mode.\n3. First-class nodes marked **Gate = first-class** are runtime-owned. Never start, complete, skip, fail, or request input for them. After rejection, revise in conversation and only call \\`request_approval\\` to create the next attempt.\n4. If you need information from the user before or during agent execution, call \\`request_input\\`. This ends your turn until the user responds.\n5. On unrecoverable agent failure, call \\`fail_node(..., recoverable: false)\\`; an optional node ends \\`skipped\\` rather than \\`failed\\`, so the run continues past it. On recoverable failure, call \\`fail_node(..., recoverable: true)\\` and the engine returns the node to \\`available\\`.\n6. When all required nodes are \\`complete\\` or \\`skipped\\`, stop. The runner marks the flow done automatically.\n7. Free-chat user messages do not require flow action. Respond directly, continue flow work, or both — your call.\n`;\n}\n\n/**\n * Render the full prompt sent to a subprompt node's isolated harness instance.\n *\n * `instruction` is already interpolated with the node's resolved bindings\n * (the same `interpolateNodeInstruction` step an agent handoff uses) — this\n * function only adds the typed-response directive when the node declares an\n * output contract. There is no corrective reprompt for a subprompt (it has no\n * conversation to reprompt in), so the directive is the runtime's only lever\n * for getting parseable JSON back; a malformed or non-conforming reply is an\n * ordinary node failure handled by the caller, never retried in-band here.\n *\n * The object-only constraint is therefore stated twice, before and after the\n * schema: the serialized schema is a large blob, so a directive placed only\n * ahead of it is not the last thing the model reads.\n *\n * @docLink packages/factory-assets/flow#render-subprompt-prompt\n */\nexport function renderSubpromptPrompt(\n instruction: string,\n outputSchema: Record<string, unknown> | undefined,\n): string {\n if (!outputSchema) return instruction;\n return `${instruction}\\n\\nRespond with a single JSON object matching this JSON Schema, and nothing else — no markdown code fences, no commentary before or after it:\\n\\n${JSON.stringify(outputSchema, null, 2)}\\n\\nReply with the object only. The first character of your reply must be \\`{\\` and the last must be \\`}\\` — no explanation, no restatement, no code fence.`;\n}\n\n/**\n * Single-line tag suitable for telemetry / logging. Derives a short, stable\n * summary of a stimulus that's safe to attach to spans, log entries, and\n * trace events. The kind is always included; node-specific stimuli also\n * include their `nodeId` so log queries can pivot on it.\n *\n * @docLink packages/factory-assets/flow#describe-stimulus\n */\nexport function describeStimulus(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"flow_started\";\n case \"approval_received\":\n return `approval_received:${stimulus.nodeId}:${stimulus.decision}`;\n case \"input_received\":\n return `input_received:${stimulus.nodeId}`;\n case \"retry_requested\":\n return `retry_requested:${stimulus.nodeId}`;\n case \"user_message\":\n return `user_message:${stimulus.senderId}`;\n case \"resumed_after_hibernation\":\n return \"resumed_after_hibernation\";\n case \"cancelled\":\n return \"cancelled\";\n case \"state_changed\":\n return \"state_changed\";\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { okJson, err } from './chunk-X5YPJV4N.js';
1
+ import { okJson, err } from './chunk-3MWQKQUB.js';
2
2
  import fs from 'fs/promises';
3
3
  import path from 'path';
4
4
 
@@ -40,5 +40,5 @@ async function sessionGet(projectDir, runId) {
40
40
  }
41
41
 
42
42
  export { readAllSessions, sessionGet, sessionList };
43
- //# sourceMappingURL=chunk-R6O6YWU7.js.map
44
- //# sourceMappingURL=chunk-R6O6YWU7.js.map
43
+ //# sourceMappingURL=chunk-WYZXSJBK.js.map
44
+ //# sourceMappingURL=chunk-WYZXSJBK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../workspace-plugin/src/tools/sessions.ts"],"names":[],"mappings":";;;;AAkBA,eAAsB,gBAAgB,UAAA,EAA6C;AACjF,EAAA,MAAM,GAAA,GAAM,IAAA,CAAK,IAAA,CAAK,UAAA,EAAY,WAAW,UAAU,CAAA;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,MAAM,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAClC,IAAA,MAAM,WAA2B,EAAC;AAClC,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,MAAA,IAAI,CAAC,IAAA,CAAK,QAAA,CAAS,OAAO,CAAA,EAAG;AAC7B,MAAA,IAAI;AACF,QAAA,MAAM,GAAA,GAAM,MAAM,EAAA,CAAG,QAAA,CAAS,KAAK,IAAA,CAAK,GAAA,EAAK,IAAI,CAAA,EAAG,OAAO,CAAA;AAC3D,QAAA,QAAA,CAAS,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,GAAG,CAAiB,CAAA;AAAA,MAC/C,CAAA,CAAA,MAAQ;AAAA,MAER;AAAA,IACF;AACA,IAAA,OAAO,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,EAAE,SAAA,CAAU,aAAA,CAAc,CAAA,CAAE,SAAS,CAAC,CAAA;AAAA,EACvE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAYA,eAAsB,YAAY,UAAA,EAAyC;AACzE,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MAAM,eAAA,CAAgB,UAAU,CAAA;AACjD,IAAA,OAAO,OAAO,QAAQ,CAAA;AAAA,EACxB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF;AAUA,eAAsB,UAAA,CAAW,YAAoB,KAAA,EAAoC;AACvF,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MAAM,eAAA,CAAgB,UAAU,CAAA;AACjD,IAAA,MAAM,UAAU,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,UAAU,KAAK,CAAA;AACtD,IAAA,IAAI,CAAC,SAAS,OAAO,GAAA,CAAI,YAAY,KAAK,CAAA,eAAA,EAAkB,UAAU,CAAA,kBAAA,CAAoB,CAAA;AAC1F,IAAA,OAAO,OAAO,OAAO,CAAA;AAAA,EACvB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-R6O6YWU7.js","sourcesContent":["// src/tools/sessions.ts\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { SessionState, ToolResult } from \"../types.js\";\nimport { err, okJson } from \"../types.js\";\n\n/**\n * Read all session state files from `.skaile/sessions/` and return them\n * sorted newest-first by `updatedAt`.\n *\n * Silently skips missing directories and corrupt JSON files. This function\n * is exported for internal use by `flows.ts` — prefer {@link sessionList} or\n * {@link sessionGet} for tool-level access.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function readAllSessions(projectDir: string): Promise<SessionState[]> {\n const dir = path.join(projectDir, \".skaile\", \"sessions\");\n try {\n const files = await fs.readdir(dir);\n const sessions: SessionState[] = [];\n for (const file of files) {\n if (!file.endsWith(\".json\")) continue;\n try {\n const raw = await fs.readFile(path.join(dir, file), \"utf-8\");\n sessions.push(JSON.parse(raw) as SessionState);\n } catch {\n /* skip corrupt */\n }\n }\n return sessions.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));\n } catch {\n return [];\n }\n}\n\n/**\n * List all past agent run sessions for the workspace, sorted newest-first.\n *\n * Returns a JSON array of {@link SessionState} objects read from\n * `.skaile/sessions/*.json`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function sessionList(projectDir: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n return okJson(sessions);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get full metadata for a specific agent run session.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID as returned by {@link sessionList}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function sessionGet(projectDir: string, runId: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session '${runId}' not found in ${projectDir}/.skaile/sessions/`);\n return okJson(session);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
1
+ {"version":3,"sources":["../workspace-plugin/src/tools/sessions.ts"],"names":[],"mappings":";;;;AAkBA,eAAsB,gBAAg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A,MAAM,UAAU,QAAA,CAAS,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,UAAU,KAAK,CAAA;AACtD,IAAA,IAAI,CAAC,SAAS,OAAO,GAAA,CAAI,YAAY,KAAK,CAAA,eAAA,EAAkB,UAAU,CAAA,kBAAA,CAAoB,CAAA;AAC1F,IAAA,OAAO,OAAO,OAAO,CAAA;AAAA,EACvB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-WYZXSJBK.js","sourcesContent":["// src/tools/sessions.ts\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { SessionState, ToolResult } from \"../types.js\";\nimport { err, okJson } from \"../types.js\";\n\n/**\n * Read all session state files from `.skaile/sessions/` and return them\n * sorted newest-first by `updatedAt`.\n *\n * Silently skips missing directories and corrupt JSON files. This function\n * is exported for internal use by `flows.ts` — prefer {@link sessionList} or\n * {@link sessionGet} for tool-level access.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function readAllSessions(projectDir: string): Promise<SessionState[]> {\n const dir = path.join(projectDir, \".skaile\", \"sessions\");\n try {\n const files = await fs.readdir(dir);\n const sessions: SessionState[] = [];\n for (const file of files) {\n if (!file.endsWith(\".json\")) continue;\n try {\n const raw = await fs.readFile(path.join(dir, file), \"utf-8\");\n sessions.push(JSON.parse(raw) as SessionState);\n } catch {\n /* skip corrupt */\n }\n }\n return sessions.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));\n } catch {\n return [];\n }\n}\n\n/**\n * List all past agent run sessions for the workspace, sorted newest-first.\n *\n * Returns a JSON array of {@link SessionState} objects read from\n * `.skaile/sessions/*.json`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function sessionList(projectDir: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n return okJson(sessions);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get full metadata for a specific agent run session.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID as returned by {@link sessionList}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function sessionGet(projectDir: string, runId: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session '${runId}' not found in ${projectDir}/.skaile/sessions/`);\n return okJson(session);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { readAllSessions } from './chunk-R6O6YWU7.js';
2
- import { findAiAssetsRoot } from './chunk-6Z5KTFJT.js';
3
- import { okJson, err } from './chunk-X5YPJV4N.js';
1
+ import { readAllSessions } from './chunk-WYZXSJBK.js';
2
+ import { findAiAssetsRoot } from './chunk-Z3VKUWAX.js';
3
+ import { okJson, err } from './chunk-3MWQKQUB.js';
4
4
 
5
5
  // workspace-plugin/src/tools/flows.ts
6
6
  async function flowList(projectDir) {
@@ -68,5 +68,5 @@ async function flowFindFlowForSession(projectDir, runId) {
68
68
  }
69
69
 
70
70
  export { flowFindFlowForSession, flowGetSession, flowList, flowListSessions, flowShow };
71
- //# sourceMappingURL=chunk-R4I3VBSS.js.map
72
- //# sourceMappingURL=chunk-R4I3VBSS.js.map
71
+ //# sourceMappingURL=chunk-X3YGUKCG.js.map
72
+ //# sourceMappingURL=chunk-X3YGUKCG.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../workspace-plugin/src/tools/flows.ts"],"names":[],"mappings":";;;;;AAmBA,eAAsB,SAAS,UAAA,EAAyC;AACtE,EAAA,IAAI;AACF,IAAA,MAAM,UAAA,GAAa,MAAM,gBAAA,CAAiB,UAAU,CAAA;AACpD,I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,GAAa,MAAM,gBAAA,CAAiB,UAAU,CAAA;AACpD,IAAA,IAAI,CAAC,UAAA,EAAY,OAAO,GAAA,CAAI,CAAA,4BAAA,EAA+B,KAAK,CAAA,oBAAA,CAAsB,CAAA;AAEtF,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,MAAM,OAC7B,4CACF,CAAA;AACA,IAAA,MAAM,KAAA,GAAQ,aAAa,UAAU,CAAA;AACrC,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,CAAC,MAAW,CAAA,CAAE,EAAA,KAAO,QAAQ,MAAM,CAAA;AAC3D,IAAA,IAAI,CAAC,IAAA,EAAM,OAAO,IAAI,CAAA,gBAAA,EAAmB,OAAA,CAAQ,MAAM,CAAA,CAAE,CAAA;AACzD,IAAA,OAAO,OAAO,IAAI,CAAA;AAAA,EACpB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-R4I3VBSS.js","sourcesContent":["// src/tools/flows.ts\n\nimport type { ToolResult } from \"../types.js\";\nimport { err, okJson } from \"../types.js\";\nimport { findAiAssetsRoot } from \"../utils/ai-assets.js\";\nimport { readAllSessions } from \"./sessions.js\";\n\n// ── Flow tools ────────────────────────────────────────────────────────────────\n\n/**\n * List all flow definitions available in the project's `ai-assets` directory.\n *\n * Returns a JSON array of summary objects `{ id, name, nodeCount }`.\n * Returns an empty array when no `ai-assets` root is found.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowList(projectDir: string): Promise<ToolResult> {\n try {\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return okJson([]);\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const summary = flows.map((f: any) => ({\n id: f.id,\n name: f.name ?? f.id,\n nodeCount: f.nodes?.length ?? 0,\n }));\n return okJson(summary);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Show the full flow definition (nodes, edges, metadata) for a specific flow.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param flowId - Flow ID as returned by {@link flowList}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowShow(projectDir: string, flowId: string): Promise<ToolResult> {\n try {\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return err(`Flow not found: ${flowId}`);\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const flow = flows.find((f: any) => f.id === flowId);\n if (!flow) return err(`Flow not found: ${flowId}`);\n return okJson(flow);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * List all past and active flow run sessions for the workspace.\n *\n * Delegates to {@link readAllSessions} (reads `.skaile/sessions/*.json`),\n * sorted newest-first by `updatedAt`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowListSessions(projectDir: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n return okJson(sessions);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get driver metadata for a specific flow run session.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID from {@link flowListSessions}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowGetSession(projectDir: string, runId: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session not found: ${runId}`);\n return okJson(session);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Resolve and return the flow definition that was used in a past session.\n *\n * Looks up the session by `runId`, reads its `flowId`, then returns the full\n * flow definition from `ai-assets`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID from {@link flowListSessions}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowFindFlowForSession(\n projectDir: string,\n runId: string,\n): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session not found: ${runId}`);\n\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return err(`Flow not found for session: ${runId} (no ai-assets root)`);\n\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const flow = flows.find((f: any) => f.id === session.flowId);\n if (!flow) return err(`Flow not found: ${session.flowId}`);\n return okJson(flow);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
1
+ {"version":3,"sources":["../workspace-plugin/src/tools/flows.ts"],"names":[],"mappings":";;;;;AAmBA,eAAsB,SAAS,UAAA,EAAyC;AACtE,EAAA,IAAI;AACF,IAAA,MAAM,UAAA,GAAa,MAAM,gBAAA,CAAiB,UAAU,CAAA;AACpD,IAAA,IAAI,CAAC,UAAA,EAAY,OAAO,MAAA,CAAO,EAAE,CAAA;AACjC,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,MAAM,OAC7B,4CACF,CAAA;AACA,IAAA,MAAM,KAAA,GAAQ,aAAa,UAAU,CAAA;AACrC,IAAA,MAAM,OAAA,GAAU,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,MAAY;AAAA,MACrC,IAAI,CAAA,CAAE,EAAA;AAAA,MACN,IAAA,EAAM,CAAA,CAAE,IAAA,IAAQ,CAAA,CAAE,EAAA;AAAA,MAClB,SAAA,EAAW,CAAA,CAAE,KAAA,EAAO,MAAA,IAAU;AAAA,KAChC,CAAE,CAAA;AACF,I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AA,CAAQ,MAAM,CAAA,CAAE,CAAA;AACzD,IAAA,OAAO,OAAO,IAAI,CAAA;AAAA,EACpB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-X3YGUKCG.js","sourcesContent":["// src/tools/flows.ts\n\nimport type { ToolResult } from \"../types.js\";\nimport { err, okJson } from \"../types.js\";\nimport { findAiAssetsRoot } from \"../utils/ai-assets.js\";\nimport { readAllSessions } from \"./sessions.js\";\n\n// ── Flow tools ────────────────────────────────────────────────────────────────\n\n/**\n * List all flow definitions available in the project's `ai-assets` directory.\n *\n * Returns a JSON array of summary objects `{ id, name, nodeCount }`.\n * Returns an empty array when no `ai-assets` root is found.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowList(projectDir: string): Promise<ToolResult> {\n try {\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return okJson([]);\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const summary = flows.map((f: any) => ({\n id: f.id,\n name: f.name ?? f.id,\n nodeCount: f.nodes?.length ?? 0,\n }));\n return okJson(summary);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Show the full flow definition (nodes, edges, metadata) for a specific flow.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param flowId - Flow ID as returned by {@link flowList}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowShow(projectDir: string, flowId: string): Promise<ToolResult> {\n try {\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return err(`Flow not found: ${flowId}`);\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const flow = flows.find((f: any) => f.id === flowId);\n if (!flow) return err(`Flow not found: ${flowId}`);\n return okJson(flow);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * List all past and active flow run sessions for the workspace.\n *\n * Delegates to {@link readAllSessions} (reads `.skaile/sessions/*.json`),\n * sorted newest-first by `updatedAt`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowListSessions(projectDir: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n return okJson(sessions);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get harness metadata for a specific flow run session.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID from {@link flowListSessions}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowGetSession(projectDir: string, runId: string): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session not found: ${runId}`);\n return okJson(session);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Resolve and return the flow definition that was used in a past session.\n *\n * Looks up the session by `runId`, reads its `flowId`, then returns the full\n * flow definition from `ai-assets`.\n *\n * @param projectDir - Absolute path to the skaile project root.\n * @param runId - Run ID from {@link flowListSessions}.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function flowFindFlowForSession(\n projectDir: string,\n runId: string,\n): Promise<ToolResult> {\n try {\n const sessions = await readAllSessions(projectDir);\n const session = sessions.find((s) => s.runId === runId);\n if (!session) return err(`Session not found: ${runId}`);\n\n const assetsRoot = await findAiAssetsRoot(projectDir);\n if (!assetsRoot) return err(`Flow not found for session: ${runId} (no ai-assets root)`);\n\n const { loadAllFlows } = await import(\n \"@skaile/workspaces/factory-assets/connectors/flow/engine\"\n );\n const flows = loadAllFlows(assetsRoot);\n const flow = flows.find((f: any) => f.id === session.flowId);\n if (!flow) return err(`Flow not found: ${session.flowId}`);\n return okJson(flow);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { registryEntries, isEntryEnabled, parseModelRef } from './chunk-MJHSLODD.js';
1
+ import { registryEntries, isEntryEnabled, parseModelRef } from './chunk-LSI2IVFT.js';
2
2
 
3
3
  // bridge/src/error-classifier.ts
4
4
  var AuthError = class extends Error {
@@ -379,7 +379,7 @@ var ReconfigureLedger = class {
379
379
  this.respawn = false;
380
380
  }
381
381
  /**
382
- * The process cannot take the desired config live and the driver must replace
382
+ * The process cannot take the desired config live and the harness must replace
383
383
  * it before the next turn. Cleared by the next {@link setSnapshot}.
384
384
  */
385
385
  get needsRespawn() {
@@ -516,5 +516,5 @@ function stripRunnerPrivateEnv(env) {
516
516
  }
517
517
 
518
518
  export { AccountUnavailableError, AuthError, LONG_CONTEXT_CREDITS_API_ERROR, RUNNER_PRIVATE_ENV_KEYS, ReconfigureLedger, classifyClaudeSdkError, classifyGenericErrorMessage, isLongContextEntitlementRejection, reclassifyAuthAsAccountUnavailable, scopeReconfigureModel, stripRunnerPrivateEnv };
519
- //# sourceMappingURL=chunk-RPZVHXQ3.js.map
520
- //# sourceMappingURL=chunk-RPZVHXQ3.js.map
519
+ //# sourceMappingURL=chunk-XFIEVEU7.js.map
520
+ //# sourceMappingURL=chunk-XFIEVEU7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../bridge/src/error-classifier.ts","../bridge/src/reconfigure-model-ref.ts","../bridge/src/reconfigure-ledger.ts","../bridge/src/runner-private-env.ts"],"names":[],"mappings":";;;AAkDO,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EAC1B,MAAA;AAAA,EACT,YAAY,MAAA,EAAoB;AAC9B,IAAA,KAAA,CAAM,OAAO,OAAO,CAAA;A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S,sBAAoE,GAAA,EAAW;AAC7F,EAAA,KAAA,MAAW,GAAA,IAAO,uBAAA,EAAyB,OAAO,GAAA,CAAI,GAAG,CAAA;AACzD,EAAA,OAAO,GAAA;AACT","file":"chunk-XFIEVEU7.js","sourcesContent":["/**\n * Error classification for the Claude Agent SDK harness.\n *\n * Wraps the Anthropic API error patterns surfaced through the bundled\n * `claude-cli.js`. The CLI flattens upstream HTTP errors into terse strings\n * like:\n *\n * `Claude Code returned an error result: Failed to authenticate. API Error:\n * 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\n * \"Invalid authentication credentials\"}}`\n *\n * Word-for-word that reads as an auth failure, but in practice it also\n * fires when a Claude Max OAuth subscription has exhausted its current\n * quota window — Anthropic returns a non-200 that the CLI relabels as\n * \"Failed to authenticate\" without preserving the original error type.\n *\n * The classifier here:\n * 1. Parses an embedded JSON body when the upstream included one\n * (e.g. `{\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",...}}`)\n * so we believe the structured `error.type` over the surrounding\n * free-text wrapper.\n * 2. Honours the SDK's `terminal_reason` when it explicitly indicates\n * a blocking-limit / rapid-refill / model-error condition — those\n * are authoritative even if the textual error reads as auth.\n * 3. Falls back to keyword heuristics on the message text.\n * 4. For OAuth-style credentials (Claude Code subscriptions), adds a\n * hint that bounces user attention to quota rather than credentials,\n * because that's overwhelmingly the cause when a CredentialsFile\n * provider that worked yesterday now returns \"Invalid authentication\n * credentials\" without anyone touching the file.\n */\n\nimport type { AgentError } from \"./types.js\";\n\n/**\n * Error thrown by harnesses when the upstream provider rejects the credential\n * with an authentication-shaped failure (HTTP 401 / `authentication_error`\n * structured body). Carries the structured {@link AgentError} produced by\n * {@link classifyClaudeSdkError} so the runner can mediate without\n * re-classifying string text.\n *\n * The runner's 401-mediation handler `instanceof`-discriminates on this\n * subclass so the auth-vs-rate_limit fork stays in one place.\n *\n * Spec: `_devlog/specs/2026-05-07-unified-credential-mediation.md`\n * § \"Runner-side handling on 401\".\n *\n * @category Errors\n * @since 3.3.0\n */\nexport class AuthError extends Error {\n readonly detail: AgentError;\n constructor(detail: AgentError) {\n super(detail.message);\n this.name = \"AuthError\";\n this.detail = detail;\n }\n}\n\n/**\n * Error thrown when an auth-shaped failure persists *after* a successful\n * credential self-heal — the refresh worked, yet the immediate retry still\n * returned 401. That combination rules out the credential and points at the\n * account itself: a hidden-tier rate limit, a billing block, or anti-abuse\n * throttling on OAuth tokens used at scale (Anthropic mislabels all three as\n * `authentication_error`). It deliberately does **not** extend {@link AuthError}\n * so the harness's auth self-heal does not fire again on it.\n *\n * @category Errors\n */\nexport class AccountUnavailableError extends Error {\n readonly detail: AgentError;\n constructor(detail: AgentError) {\n super(detail.message);\n this.name = \"AccountUnavailableError\";\n this.detail = detail;\n }\n}\n\n/**\n * Re-label an auth-shaped {@link AgentError} as an `account` failure. Called\n * when a 401 recurs after a successful credential refresh: the credential is\n * fine, so the user needs an account-state hint, not \"check your API key\".\n * Pure function.\n */\nexport function reclassifyAuthAsAccountUnavailable(detail: AgentError): AgentError {\n return {\n ...detail,\n category: \"account\",\n statusCode: detail.statusCode ?? 401,\n retryable: false,\n hint: \"The credential was refreshed successfully but Anthropic still rejected the request. This is an account-state issue, not an invalid credential — usually a rate limit at a hidden tier, a billing block, or anti-abuse throttling. Wait a few minutes and retry; if it persists, check the account's billing and usage limits at https://console.anthropic.com/.\",\n };\n}\n\n/**\n * `terminal_reason` values from the Claude Agent SDK that imply the failure\n * is a rate / quota / blocking condition rather than a credential problem.\n */\nconst RATE_LIMIT_TERMINAL_REASONS = new Set<string>([\"blocking_limit\", \"rapid_refill_breaker\"]);\n\n/**\n * `terminal_reason` values that indicate a generic, retryable model failure.\n * `prompt_too_long` is handled separately (not retryable, different hint).\n */\nconst MODEL_TERMINAL_REASONS = new Set<string>([\"model_error\", \"image_error\"]);\n\n/**\n * Input shape for {@link classifyClaudeSdkError} when decoding an `SDKResultError`.\n *\n * All fields are optional; `classifyClaudeSdkError` also accepts a plain `string`\n * (a thrown exception message) for the common non-SDK code paths.\n *\n * @docLink packages/bridge/api-reference#error-classifier\n */\nexport interface ClaudeSdkResultErrorInput {\n /** `errors` array from `SDKResultError`. Empty when not provided. */\n errors?: string[];\n /**\n * `terminal_reason` from `SDKResultError`. Authoritative when set to a\n * blocking/rapid-refill value, regardless of message text.\n */\n terminalReason?: string;\n /** `subtype` from `SDKResultError` — `error_max_turns` etc. */\n subtype?: string;\n /**\n * `true` when the configured Anthropic credential is a Claude Code\n * subscription (`CredentialsFile` provider) rather than a raw API key.\n * Changes the hint copy because `Invalid authentication credentials`\n * on an OAuth subscription almost always means quota.\n */\n oauthCredential?: boolean;\n}\n\n/**\n * The `apiError` tag the Claude Agent SDK (0.3.289) puts on the assistant\n * message it renders for a long-context entitlement 429.\n */\nexport const LONG_CONTEXT_CREDITS_API_ERROR = \"long_context_credits_required\";\n\n/**\n * Upstream and SDK-rendered wordings of the long-context entitlement 429:\n * \"Extra usage is required for long context\", \"Usage credits are required for\n * long context requests\", and the CLI's \"Usage credits required for 1M context\".\n */\nconst LONG_CONTEXT_ENTITLEMENT_PATTERN =\n /\\b(?:extra usage is|usage credits(?: are)?) required for (?:long|1m) context\\b/i;\n\n/**\n * Whether any of `texts` is the 429 Anthropic returns when the account may not\n * use a long (1M) context window: the seat is not out of quota, it cannot serve\n * a context over 200k. Matches only that wording, never a usage-limit 429.\n *\n * @docLink packages/bridge/api-reference#error-classifier\n */\nexport function isLongContextEntitlementRejection(\n texts: ReadonlyArray<string | null | undefined>,\n): boolean {\n return texts.some(\n (text) => typeof text === \"string\" && LONG_CONTEXT_ENTITLEMENT_PATTERN.test(text),\n );\n}\n\n/**\n * Classify a Claude SDK result-error or thrown error into a structured\n * {@link AgentError}. Pure function — safe to call from any layer.\n *\n * @param input - Either a free-text error message (from a thrown exception)\n * or a partially-decoded `SDKResultError` shape with `errors[]`,\n * `terminal_reason`, and `subtype`.\n * @returns A category, retryable flag, and human-readable hint.\n * @docLink packages/bridge/api-reference#error-classifier\n */\nexport function classifyClaudeSdkError(input: string | ClaudeSdkResultErrorInput): AgentError {\n const opts: ClaudeSdkResultErrorInput = typeof input === \"string\" ? { errors: [input] } : input;\n\n const message = (opts.errors ?? []).join(\"; \") || \"Unknown agent error\";\n\n // ── 1. Honour authoritative `terminal_reason` ──────────────────────────\n const byTerminalReason = classifyByTerminalReason(message, opts);\n if (byTerminalReason) {\n return byTerminalReason;\n }\n\n // ── 2. Inspect embedded JSON body for a structured error.type ──────────\n const structured = tryParseEmbeddedAnthropicError(message);\n if (structured) {\n const byStructured = classifyByStructuredError(message, structured, opts);\n if (byStructured) {\n return byStructured;\n }\n }\n\n // ── 3. Heuristic keyword classification on the wrapper text ────────────\n const lower = message.toLowerCase();\n\n const byKeyword = classifyByKeyword(message, lower, opts);\n if (byKeyword) {\n return byKeyword;\n }\n\n // ── 4. SDK result subtypes ─────────────────────────────────────────────\n const bySubtype = classifyBySubtype(message, opts);\n if (bySubtype) {\n return bySubtype;\n }\n\n return {\n message,\n category: \"unknown\",\n retryable: true,\n };\n}\n\n/**\n * Phase 1: classify on the SDK's authoritative `terminal_reason`. Returns\n * `null` when the reason is unset or not one of the recognised values.\n */\nfunction classifyByTerminalReason(\n message: string,\n opts: ClaudeSdkResultErrorInput,\n): AgentError | null {\n if (opts.terminalReason && RATE_LIMIT_TERMINAL_REASONS.has(opts.terminalReason)) {\n return {\n message,\n category: \"rate_limit\",\n retryable: true,\n hint: oauthQuotaHint(opts.oauthCredential),\n };\n }\n if (opts.terminalReason === \"prompt_too_long\") {\n return {\n message,\n category: \"model\",\n retryable: false,\n hint: \"The conversation is too long for the configured model. Start a new session or compact the existing one.\",\n };\n }\n if (opts.terminalReason && MODEL_TERMINAL_REASONS.has(opts.terminalReason)) {\n return {\n message,\n category: \"model\",\n retryable: true,\n hint: \"The model rejected this turn. Try again or switch models.\",\n };\n }\n return null;\n}\n\n/**\n * Phase 2: classify on the structured `error.type` parsed from an embedded\n * Anthropic JSON body. Returns `null` for an unrecognised `errorType`.\n */\nfunction classifyByStructuredError(\n message: string,\n structured: { errorType: string; statusCode?: number },\n opts: ClaudeSdkResultErrorInput,\n): AgentError | null {\n if (structured.errorType === \"rate_limit_error\") {\n return {\n message,\n category: \"rate_limit\",\n statusCode: structured.statusCode ?? 429,\n retryable: true,\n hint: oauthQuotaHint(opts.oauthCredential),\n };\n }\n if (structured.errorType === \"overloaded_error\") {\n return {\n message,\n category: \"rate_limit\",\n statusCode: structured.statusCode ?? 529,\n retryable: true,\n hint: \"Anthropic is overloaded. Try again in a moment.\",\n };\n }\n if (structured.errorType === \"authentication_error\") {\n // Anthropic genuinely says it's an auth failure. But for OAuth\n // credentials with the `oauth-2025-04-20` beta flow, this still\n // overwhelmingly correlates with quota. Surface both possibilities\n // in the hint so the user does not first re-upload a perfectly\n // good credentials file.\n return {\n message,\n category: \"auth\",\n statusCode: structured.statusCode ?? 401,\n retryable: false,\n hint: opts.oauthCredential\n ? \"Anthropic rejected the OAuth credential. With Claude Code subscriptions this is usually a quota or rate-limit issue rather than an invalid token — wait a few minutes before re-uploading the credentials file. If it persists, re-export `~/.claude/.credentials.json` from a working Claude Code install.\"\n : \"Anthropic rejected the API key. Check it in Settings -> AI Providers.\",\n };\n }\n if (structured.errorType === \"permission_error\") {\n return {\n message,\n category: \"auth\",\n statusCode: structured.statusCode ?? 403,\n retryable: false,\n hint: \"The configured credential does not have access to the requested model.\",\n };\n }\n if (structured.errorType === \"invalid_request_error\") {\n return {\n message,\n category: \"validation\",\n statusCode: structured.statusCode ?? 400,\n retryable: false,\n hint: \"Anthropic rejected the request shape. This is likely a bug — please report it.\",\n };\n }\n return null;\n}\n\n/**\n * Phase 3: heuristic keyword classification on the lowercased wrapper text.\n * `lower` is the pre-lowercased `message`. Returns `null` when no bucket hits.\n */\nfunction classifyByKeyword(\n message: string,\n lower: string,\n opts: ClaudeSdkResultErrorInput,\n): AgentError | null {\n if (\n lower.includes(\"rate limit\") ||\n lower.includes(\"rate_limit\") ||\n lower.includes(\"too many requests\") ||\n lower.includes(\"429\") ||\n lower.includes(\"quota\") ||\n lower.includes(\"blocking_limit\") ||\n lower.includes(\"rapid_refill\")\n ) {\n return {\n message,\n category: \"rate_limit\",\n retryable: true,\n hint: oauthQuotaHint(opts.oauthCredential),\n };\n }\n\n if (\n lower.includes(\"credit balance\") ||\n lower.includes(\"insufficient credit\") ||\n lower.includes(\"out of credits\")\n ) {\n return {\n message,\n category: \"rate_limit\",\n retryable: false,\n hint: \"The configured Anthropic account is out of credits. Top up at https://console.anthropic.com/ or switch providers.\",\n };\n }\n\n if (lower.includes(\"oauth authentication is currently not supported\")) {\n return {\n message,\n category: \"auth\",\n statusCode: 401,\n retryable: false,\n hint: \"The Claude Code CLI did not send the OAuth beta header. The bundled CLI in this image is too old — rebuild the agent image.\",\n };\n }\n\n // The Claude Code CLI emits this terse, JSON-less string when it finds no\n // usable credential — most commonly because the OAuth access token in\n // `~/.claude/.credentials.json` expired and the file carries no refresh token\n // (the platform provisions access-token-only files by design). It MUST be\n // classified as `auth` so the harness promotes it to `AuthError` and the\n // `onAuthError` self-heal re-mints the credential. Without this branch the\n // message falls through to `unknown`, the self-heal never fires, and every\n // subsequent turn dead-ends on \"please /login\". The check sits ahead of the\n // generic auth keywords because the string contains none of them.\n if (lower.includes(\"not logged in\") || lower.includes(\"please run /login\")) {\n return {\n message,\n category: \"auth\",\n statusCode: 401,\n retryable: false,\n hint: opts.oauthCredential\n ? \"The Claude Code OAuth credential expired and could not be auto-refreshed in-container. The runner will re-mint it — retry the prompt. If it persists, re-export `~/.claude/.credentials.json` from a working Claude Code install.\"\n : \"No Anthropic credential is configured for this provider. Add one in Settings -> AI Providers.\",\n };\n }\n\n if (\n lower.includes(\"api key\") ||\n lower.includes(\"authentication\") ||\n lower.includes(\"invalid authentication\") ||\n lower.includes(\"unauthorized\") ||\n lower.includes(\"401\") ||\n lower.includes(\"403\")\n ) {\n return {\n message,\n category: \"auth\",\n retryable: false,\n hint: opts.oauthCredential\n ? \"Anthropic rejected the OAuth credential. With Claude Code subscriptions this is usually a quota or rate-limit issue rather than an invalid token — wait a few minutes before re-uploading the credentials file.\"\n : \"Check the API key configured for this AI provider in Settings.\",\n };\n }\n\n if (\n lower.includes(\"model\") &&\n (lower.includes(\"not found\") ||\n lower.includes(\"not available\") ||\n lower.includes(\"does not exist\"))\n ) {\n return {\n message,\n category: \"model\",\n retryable: false,\n hint: \"The selected model is not available for this credential. Change the model in the AI provider config.\",\n };\n }\n\n if (\n lower.includes(\"context length\") ||\n lower.includes(\"token limit\") ||\n lower.includes(\"max_tokens\") ||\n lower.includes(\"prompt is too long\") ||\n lower.includes(\"prompt_too_long\")\n ) {\n return {\n message,\n category: \"model\",\n retryable: false,\n hint: \"The conversation is too long for the model. Start a new session or compact this one.\",\n };\n }\n\n if (\n lower.includes(\"timeout\") ||\n lower.includes(\"econnrefused\") ||\n lower.includes(\"enotfound\") ||\n lower.includes(\"fetch failed\") ||\n lower.includes(\"network\")\n ) {\n return {\n message,\n category: \"network\",\n retryable: true,\n hint: \"Network error reaching Anthropic. The runner will retry — try again if it persists.\",\n };\n }\n\n return null;\n}\n\n/**\n * Phase 4: classify on the SDK result `subtype` (`error_max_turns` etc).\n * Returns `null` when the subtype is unset or unrecognised.\n */\nfunction classifyBySubtype(message: string, opts: ClaudeSdkResultErrorInput): AgentError | null {\n if (opts.subtype === \"error_max_turns\") {\n return {\n message,\n category: \"unknown\",\n retryable: true,\n hint: \"The agent stopped after reaching `max_turns`. Resume the session or raise `max_turns` in the agent config.\",\n };\n }\n if (opts.subtype === \"error_max_budget_usd\") {\n return {\n message,\n category: \"rate_limit\",\n retryable: false,\n hint: \"The agent stopped because it hit the configured per-turn budget. Raise the budget or split the work.\",\n };\n }\n return null;\n}\n\n/**\n * The shared keyword buckets matched by {@link classifyGenericErrorMessage}.\n * Harnesses layer a provider-specific `hint` on top of the returned category.\n */\nexport type GenericErrorCategory = \"auth\" | \"rate_limit\" | \"model\" | \"network\";\n\n/**\n * Classify a free-text harness error against the keyword buckets common to the\n * subprocess/SDK harnesses (omp, codex). Returns the matched `category` +\n * `retryable` flag, or `null` when no shared bucket matches so the caller can\n * fall through to its own provider-specific buckets (e.g. codex sandbox) and\n * `unknown` default. The harness supplies the user-facing `hint` — only the\n * bucketing logic is shared, not the copy.\n */\nexport function classifyGenericErrorMessage(\n msg: string,\n): { category: GenericErrorCategory; retryable: boolean } | null {\n const lower = msg.toLowerCase();\n if (\n lower.includes(\"api key\") ||\n lower.includes(\"unauthorized\") ||\n lower.includes(\"authentication\") ||\n lower.includes(\"401\")\n ) {\n return { category: \"auth\", retryable: false };\n }\n if (\n lower.includes(\"rate limit\") ||\n lower.includes(\"429\") ||\n lower.includes(\"too many requests\") ||\n lower.includes(\"quota\")\n ) {\n return { category: \"rate_limit\", retryable: true };\n }\n if (\n lower.includes(\"model\") &&\n (lower.includes(\"not found\") ||\n lower.includes(\"not available\") ||\n lower.includes(\"does not exist\"))\n ) {\n return { category: \"model\", retryable: false };\n }\n if (\n lower.includes(\"context length\") ||\n lower.includes(\"too long\") ||\n lower.includes(\"token limit\") ||\n lower.includes(\"max_tokens\")\n ) {\n return { category: \"model\", retryable: false };\n }\n if (\n lower.includes(\"timeout\") ||\n lower.includes(\"econnrefused\") ||\n lower.includes(\"enotfound\") ||\n lower.includes(\"network\") ||\n lower.includes(\"fetch failed\") ||\n lower.includes(\"fetch\") ||\n lower.includes(\"connection\")\n ) {\n return { category: \"network\", retryable: true };\n }\n return null;\n}\n\n/**\n * Returns the rate-limit hint copy, branched on whether the active\n * credential is a Claude Code OAuth subscription.\n */\nfunction oauthQuotaHint(oauthCredential?: boolean): string {\n if (oauthCredential) {\n return \"Quota exhausted on this Claude Code subscription. Wait for the rate-limit window to reset (typically a few minutes for short windows, longer for daily/weekly limits) before retrying. The credential itself is fine.\";\n }\n return \"The Anthropic account hit a rate limit. Wait a moment and try again.\";\n}\n\n/**\n * Try to extract a structured Anthropic error body from a free-text wrapper.\n * The bundled `claude-cli.js` typically formats failures as\n * `... API Error: <status> {\"type\":\"error\",\"error\":{\"type\":\"<errorType>\",...}}`\n * with optional trailing garbage after the JSON.\n *\n * Strategy: find the first `{`, then forward-scan tracking brace depth (with\n * string-literal awareness so braces inside quoted values do not throw the\n * count). The substring from `braceStart` to the matching `}` is the JSON\n * candidate; one `JSON.parse` does the rest. O(n) in the input length.\n *\n * Returns `null` when nothing parseable is found.\n */\nfunction tryParseEmbeddedAnthropicError(\n text: string,\n): { errorType: string; statusCode?: number } | null {\n const braceStart = text.indexOf(\"{\");\n if (braceStart < 0) {\n return null;\n }\n\n const braceEnd = findMatchingCloseBrace(text, braceStart);\n if (braceEnd < 0) {\n return null;\n }\n\n let parsed: { type?: string; error?: { type?: string; message?: string } };\n try {\n parsed = JSON.parse(text.slice(braceStart, braceEnd));\n } catch {\n return null;\n }\n const errorType = parsed?.error?.type;\n if (typeof errorType !== \"string\") {\n return null;\n }\n const statusMatch = text.match(/API Error:\\s*(\\d{3})/i);\n const statusCode = statusMatch ? Number(statusMatch[1]) : undefined;\n return { errorType, statusCode };\n}\n\n/**\n * Forward-scan `text` from `braceStart` (a `{`) with brace counting, returning\n * the index just past the matching close brace, or `-1` if unbalanced.\n * String-literal awareness: skip braces between unescaped double quotes.\n */\nfunction findMatchingCloseBrace(text: string, braceStart: number): number {\n let depth = 0;\n let inString = false;\n let escaped = false;\n for (let i = braceStart; i < text.length; i++) {\n const ch = text.charCodeAt(i);\n if (inString) {\n if (escaped) {\n escaped = false;\n } else if (ch === 92 /* \\ */) {\n escaped = true;\n } else if (ch === 34 /* \" */) {\n inString = false;\n }\n continue;\n }\n if (ch === 34 /* \" */) {\n inString = true;\n } else if (ch === 123 /* { */) {\n depth++;\n } else if (ch === 125 /* } */) {\n depth--;\n if (depth === 0) {\n return i + 1;\n }\n }\n }\n return -1;\n}\n","// The registry selector a live model change (`reconfigure({ model })`) leaves a\n// session on. Shared by the runner's `runner.reconfigure` handler and every\n// harness whose `reconfigure()` rewrites `modelRef`, so both pick the same entry.\nimport {\n type AIProviderLlmEntry,\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n parseModelRef,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\n\n/** What a model-only reconfigure does to the session's registry selector. */\nexport type ReconfigureModelScope =\n | {\n ok: true;\n /** The selector to run from now on; `undefined` leaves `modelRef` unset. */\n modelRef: string | undefined;\n }\n | {\n ok: false;\n code: \"model_not_on_provider\";\n /** The entry the session runs on, or the one the patch named. */\n providerId: string;\n message: string;\n };\n\nexport interface ReconfigureModelScopeInput {\n /** The model the patch names: bare, `<providerId>/<modelId>` or `@role`. */\n model: string;\n /** The session's current selector (`AgentConfig.modelRef`). */\n modelRef: string | undefined;\n registry: AIProviderRegistry | MergedAIProviderRegistry | undefined;\n roles?: Record<string, string>;\n}\n\nfunction selectable(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n): Array<[string, AIProviderLlmEntry]> {\n return registryEntries(registry).filter(\n (pair): pair is [string, AIProviderLlmEntry] =>\n (pair[1].kind === \"llm\" || pair[1].kind === \"embed\") && isEntryEnabled(pair[1]),\n );\n}\n\n/**\n * Whether an entry serves a model id. An entry that declares no model at all\n * (no `model_map`, no `capabilities`) passes any id through, as the wake does.\n * Otherwise the id must be a declared logical id or a `model_map` target: the\n * platform sends the provider-side id the wake translated to.\n */\nfunction entryServes(entry: AIProviderLlmEntry, modelId: string): boolean {\n const map = entry.model_map ?? {};\n const caps = entry.capabilities ?? {};\n if (Object.keys(map).length === 0 && Object.keys(caps).length === 0) return true;\n return modelId in map || modelId in caps || Object.values(map).includes(modelId);\n}\n\n/** The entry a selector runs on, resolved the way the harnesses resolve it. */\nfunction currentProviderId(\n modelRef: string | undefined,\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n entries: Array<[string, AIProviderLlmEntry]>,\n roles: Record<string, string> | undefined,\n): string | undefined {\n const named = modelRef?.trim();\n if (!named) return entries[0]?.[0];\n // A selector that is exactly an entry id names the endpoint and no model.\n if (entries.some(([id]) => id === named)) return named;\n return parseModelRef(named, registry, roles)?.providerId;\n}\n\n/**\n * Decide the selector a live model change leaves the session on.\n *\n * A bare model id keeps the provider the session already runs on\n * (`<currentProvider>/<model>`): re-resolving it by id alone could move the\n * session to another entry that lists the same id, which changes billing and\n * data residency without a sign. Only a patch that names a provider\n * (`<providerId>/<model>` or `@role`) moves it. When the target entry declares\n * its models and this one is not among them, the patch is refused so the host\n * applies it at the next wake instead.\n *\n * A registry with at most one usable entry has nowhere to move to and keeps the\n * old behaviour: the selector becomes the patch's model when one was set.\n */\nexport function scopeReconfigureModel(input: ReconfigureModelScopeInput): ReconfigureModelScope {\n const { model, modelRef, registry, roles } = input;\n const legacy: ReconfigureModelScope = {\n ok: true,\n modelRef: modelRef === undefined ? undefined : model,\n };\n if (!registry) return legacy;\n const entries = selectable(registry);\n if (entries.length <= 1) return legacy;\n\n const selector = model.trim();\n if (selector.startsWith(\"@\")) return { ok: true, modelRef: selector };\n\n const slash = selector.indexOf(\"/\");\n if (slash > 0) {\n const head = selector.slice(0, slash);\n const tail = selector.slice(slash + 1);\n const named = entries.find(([id]) => id === head);\n if (named && tail !== \"\") {\n if (entryServes(named[1], tail)) return { ok: true, modelRef: selector };\n return refuse(head, tail);\n }\n }\n\n const providerId = currentProviderId(modelRef, registry, entries, roles);\n const current = entries.find(([id]) => id === providerId);\n if (!current) return legacy;\n if (!entryServes(current[1], selector)) return refuse(current[0], selector);\n return { ok: true, modelRef: `${current[0]}/${selector}` };\n}\n\nfunction refuse(providerId: string, modelId: string): ReconfigureModelScope {\n return {\n ok: false,\n code: \"model_not_on_provider\",\n providerId,\n message: `AI provider entry \"${providerId}\" does not list model \"${modelId}\"; the change applies when the session next starts.`,\n };\n}\n","// One owner for a live reconfigure (`AgentHarness.reconfigure()`): the desired\n// config, the snapshot the running process was last given, drift between them,\n// serial ordering of patches, the provider-entry scope rule, rollback on a\n// refusal and the typed outcome. A harness supplies one `applyLive` hook that\n// pushes a delta into its process; everything else lives here.\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { scopeReconfigureModel } from \"./reconfigure-model-ref.js\";\nimport type {\n AgentConfig,\n ReconfigureApplied,\n ReconfigureOutcome,\n ReconfigurePatch,\n ReconfigureRollback,\n} from \"./types.js\";\n\n/** The config fields a live reconfigure reads and writes (the harness's own config object). */\nexport type ReconfigureConfig = Pick<\n AgentConfig,\n \"model\" | \"modelRef\" | \"thinking\" | \"effort\" | \"registry\" | \"roles\"\n>;\n\n/** What the running process holds: the settings it spawned with or was last switched to. */\nexport interface ReconfigureSnapshot {\n model?: string;\n modelRef?: string;\n thinking?: AgentConfig[\"thinking\"];\n effort?: AgentConfig[\"effort\"];\n}\n\n/**\n * What an {@link ReconfigureLedgerOptions.applyLive} hook answers:\n *\n * - `\"applied\"`: the process now runs the delta.\n * - `\"respawn\"`: the process cannot take it live; the harness replaces it before\n * the next turn and the new process reads the desired config.\n * - `{ rejected }`: the process refuses it; the ledger rolls the config back to\n * the snapshot.\n */\nexport type ReconfigureApplyResult = \"applied\" | \"respawn\" | { rejected: string };\n\n/**\n * What an {@link ReconfigureLedgerOptions.applyLive} hook is told about a push.\n * `late` is true when the whole delta was answered `ok` earlier (it landed\n * mid-turn): a refusal then reaches the host only through\n * {@link ReconfigureLedgerOptions.onLateRejection}, so the hook must not also\n * report it on another channel (an `error` event).\n */\nexport interface ReconfigurePushContext {\n late: boolean;\n}\n\nconst FIELDS = [\"model\", \"modelRef\", \"thinking\", \"effort\"] as const;\n\nexport interface ReconfigureLedgerOptions<S extends ReconfigureSnapshot> {\n /**\n * The desired config. A getter, because a harness may replace its config object;\n * the ledger writes accepted patches into whatever it returns.\n */\n config: () => ReconfigureConfig;\n /**\n * Push a delta (the fields whose desired value differs from the snapshot) into\n * the running process. Called with the process up and idle, or at a turn\n * boundary through {@link ReconfigureLedger.flushBeforeTurn}. The hook receives\n * the live snapshot and may refine it (a harness that keeps extra fields on `S`\n * updates them here); on `\"applied\"` the ledger copies the delta into it.\n * A hook that throws counts as a rejection. Its `context.late` says whether a\n * refusal is reported elsewhere (see {@link ReconfigurePushContext}). Absent: the process reads the\n * desired config at its next spawn and there is nothing to push.\n */\n applyLive?: (\n delta: ReconfigureApplied,\n snapshot: S,\n context: ReconfigurePushContext,\n ) => ReconfigureApplyResult | Promise<ReconfigureApplyResult>;\n /** Whether the process is up and can take a push. Default: true. */\n isLive?: () => boolean;\n /** Whether no turn is in flight. Default: true. */\n isIdle?: () => boolean;\n /**\n * Called synchronously once a patch is written to the desired config, before\n * any live push. For harnesses that must refresh a derived cache on a change.\n */\n onDesired?: (applied: ReconfigureApplied) => void;\n /**\n * A refusal that arrives after the patch was already answered `ok` (it landed\n * mid-turn and flushed at the turn boundary). The config is already rolled back\n * when this runs, and an idle-time refusal never calls it (the capability call\n * answers that one). A harness emits the harness event `reconfigure-rollback`.\n */\n onLateRejection?: (rollback: ReconfigureRollback) => void;\n log?: Pick<Logger, \"warn\" | \"info\">;\n}\n\n/**\n * Serialised live reconfigure for one harness.\n *\n * `ok: true` means effective from the next turn: the next turn runs on the new\n * settings by live switch, query recycle or respawn. A patch that lands while a\n * turn is in flight (or before the process is ready) stays desired, is answered\n * `ok`, and is pushed by {@link flushBeforeTurn}.\n *\n * @category Bridge\n */\nexport class ReconfigureLedger<S extends ReconfigureSnapshot = ReconfigureSnapshot> {\n private snapshot: S | null = null;\n private respawn = false;\n private tail: Promise<unknown> | null = null;\n\n constructor(private readonly options: ReconfigureLedgerOptions<S>) {}\n\n /**\n * Record what a freshly spawned process runs. Call at every spawn: the\n * desired config is what that spawn read, so drift is computed against this.\n * `null` forgets the process (nothing left to push to).\n */\n setSnapshot(snapshot: S | null): void {\n this.snapshot = snapshot;\n this.respawn = false;\n }\n\n /**\n * The process cannot take the desired config live and the harness must replace\n * it before the next turn. Cleared by the next {@link setSnapshot}.\n */\n get needsRespawn(): boolean {\n return this.respawn;\n }\n\n /**\n * Apply a patch: scope the model to the session's provider entry, write it to\n * the desired config, and push it when the process is up and idle. Patches run\n * one at a time in arrival order.\n */\n reconfigure(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n return this.enqueue(() => this.runPatch(patch));\n }\n\n /**\n * Push any drift to the process at a turn boundary. Await it before the turn\n * is sent, so the turn runs on the desired settings. Never rejects.\n */\n flushBeforeTurn(): Promise<void> {\n return this.enqueue(async () => {\n const snapshot = this.snapshot;\n if (!snapshot || this.respawn || !(this.options.isLive?.() ?? true)) return;\n await this.flush(snapshot, new Set());\n });\n }\n\n private enqueue<T>(job: () => Promise<T>): Promise<T> {\n // With nothing in flight the job's synchronous prefix (scope + write) runs now.\n const run = this.tail ? this.tail.then(job) : job();\n const settled = run.then(\n () => undefined,\n () => undefined,\n );\n this.tail = settled;\n void settled.then(() => {\n if (this.tail === settled) this.tail = null;\n });\n return run;\n }\n\n private async runPatch(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n const config = this.options.config();\n const applied: ReconfigureApplied = {};\n if (patch.model !== undefined) {\n // In registry mode the spawned model derives from `modelRef`, so it moves\n // too: scoped to the current entry unless the patch names another one.\n const scope = scopeReconfigureModel({\n model: patch.model,\n modelRef: config.modelRef,\n registry: config.registry,\n roles: config.roles,\n });\n if (!scope.ok) {\n this.options.log?.warn(\"model change refused; keeping the current model\", {\n model: patch.model,\n providerId: scope.providerId,\n });\n return {\n ok: false,\n code: scope.code,\n message: scope.message,\n providerId: scope.providerId,\n };\n }\n config.model = applied.model = patch.model;\n if (scope.modelRef !== undefined) config.modelRef = applied.modelRef = scope.modelRef;\n }\n if (patch.thinking !== undefined) config.thinking = applied.thinking = patch.thinking;\n if (patch.effort !== undefined) config.effort = applied.effort = patch.effort;\n this.options.onDesired?.(applied);\n\n const snapshot = this.snapshot;\n // No process: the next spawn reads the desired config.\n if (!snapshot || this.respawn) return { ok: true, applied };\n const live = this.options.isLive?.() ?? true;\n const idle = this.options.isIdle?.() ?? true;\n // Mid-turn or before ready: stays desired, flushed at the turn boundary.\n if (!live || !idle) return { ok: true, applied };\n\n const own = new Set(Object.keys(applied) as Array<keyof ReconfigureApplied>);\n const rejected = await this.flush(snapshot, own);\n return rejected === null\n ? { ok: true, applied }\n : { ok: false, code: \"rejected\", message: rejected };\n }\n\n /**\n * Push the drift to the process. Returns the refusal message, or `null` when\n * the process took it (or will, by respawn). On a refusal the config rolls back\n * to the snapshot; fields outside `own` were answered `ok` earlier, so they are\n * reported through `onLateRejection`.\n */\n private async flush(\n snapshot: S,\n own: ReadonlySet<keyof ReconfigureApplied>,\n ): Promise<string | null> {\n const hook = this.options.applyLive;\n if (!hook) return null;\n const config = this.options.config();\n const delta: ReconfigureApplied = {};\n for (const key of FIELDS) {\n const value = config[key];\n if (value !== undefined && value !== snapshot[key]) Object.assign(delta, { [key]: value });\n }\n if (Object.keys(delta).length === 0) return null;\n\n // Nothing in the delta was answered to a caller of this push: it is all late.\n const context: ReconfigurePushContext = { late: own.size === 0 };\n let result: ReconfigureApplyResult;\n try {\n result = await hook(delta, snapshot, context);\n } catch (err) {\n result = { rejected: err instanceof Error ? err.message : String(err) };\n }\n // The process was replaced meanwhile; the new one read the desired config.\n if (this.snapshot !== snapshot) return null;\n\n if (result === \"applied\") {\n Object.assign(snapshot, delta);\n return null;\n }\n if (result === \"respawn\") {\n this.respawn = true;\n return null;\n }\n\n const requested: ReconfigureApplied = {};\n const restored: ReconfigureApplied = {};\n for (const key of Object.keys(delta) as (keyof ReconfigureApplied)[]) {\n // The hook may have applied part of the delta and refined the snapshot.\n Object.assign(config, { [key]: snapshot[key] });\n if (!own.has(key)) {\n Object.assign(requested, { [key]: delta[key] });\n Object.assign(restored, { [key]: snapshot[key] });\n }\n }\n this.options.log?.warn(\"live reconfigure refused; config rolled back\", {\n reason: result.rejected,\n fields: Object.keys(delta),\n });\n if (Object.keys(requested).length > 0) {\n this.options.onLateRejection?.({ message: result.rejected, requested, restored });\n }\n return result.rejected;\n }\n}\n","/**\n * Environment variables that belong to the runner process and must never reach\n * an agent child (the CLI, its tools, MCP servers, hooks).\n *\n * `SKAILE_WS_AUTH_TOKEN` authenticates the host on the runner's own WebSocket.\n * An agent that can read it can connect to the runner as the host and send host\n * commands (prompts, connector mutations such as flow-gate approvals). The\n * runner removes it from `process.env` at startup; every harness strips it again\n * from the env it hands its child, so a value that slips back in through\n * `AgentConfig.env` or an embedder that skipped the startup scrub still stops\n * at the harness.\n */\nexport const RUNNER_PRIVATE_ENV_KEYS: readonly string[] = [\n \"SKAILE_WS_AUTH_TOKEN\",\n \"SKAILE_WS_AUTH_TOKEN_FILE\",\n];\n\n/**\n * Remove every {@link RUNNER_PRIVATE_ENV_KEYS} entry from `env`, in place, and\n * return it. Call it on the final child env, after every merge.\n */\nexport function stripRunnerPrivateEnv<T extends Record<string, string | undefined>>(env: T): T {\n for (const key of RUNNER_PRIVATE_ENV_KEYS) delete env[key];\n return env;\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { getProviderPreset, providerCredentialEnvName } from './chunk-CQJH4G2K.js';
1
+ import { getProviderPreset, providerCredentialEnvName } from './chunk-ILLTBKDJ.js';
2
2
  import { globalSkaileDir } from './chunk-L5VSIPQD.js';
3
- import { registryEntries, parseModelRef, isEntryEnabled, resolveEntryBaseUrl } from './chunk-MJHSLODD.js';
3
+ import { registryEntries, parseModelRef, isEntryEnabled, resolveEntryBaseUrl } from './chunk-LSI2IVFT.js';
4
4
  import { createHash } from 'crypto';
5
5
  import { mkdirSync, rmSync, writeFileSync, renameSync } from 'fs';
6
6
  import { join } from 'path';
@@ -121,5 +121,5 @@ function writeCodexConfigToml(home, document) {
121
121
  }
122
122
 
123
123
  export { buildCodexConfigDocument, codexProviderTableId, codexSessionHome, writeCodexConfigToml };
124
- //# sourceMappingURL=chunk-VSZWNUZC.js.map
125
- //# sourceMappingURL=chunk-VSZWNUZC.js.map
124
+ //# sourceMappingURL=chunk-XGULGQA3.js.map
125
+ //# sourceMappingURL=chunk-XGULGQA3.js.map