@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":["../transport/src/ws/server.ts"],"names":[],"mappings":";;;;;AAiDA,IAAM,oBAAA,GAAuB,GAAA;AAC7B,IAAM,wBAAA,GAA2B,CAAA;AAkBjC,SA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AA,IAAA,CAAK,eAAA,CAAgB,OAAO,OAAO,CAAA;AAAA,IACrC,CAAA;AAAA,EACF;AAAA,EAEA,UAAU,OAAA,EAAiC;AACzC,IAAA,IAAA,CAAK,eAAA,CAAgB,IAAI,OAAO,CAAA;AAChC,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,eAAA,CAAgB,OAAO,OAAO,CAAA;AAAA,IACrC,CAAA;AAAA,EACF;AAAA,EAEA,aAAa,OAAA,EAAiC;AAC5C,IAAA,IAAA,CAAK,kBAAA,CAAmB,IAAI,OAAO,CAAA;AACnC,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,kBAAA,CAAmB,OAAO,OAAO,CAAA;AAAA,IACxC,CAAA;AAAA,EACF;AAAA,EAEA,IAAI,SAAA,GAAqB;AACvB,IAAA,OAAO,KAAK,YAAA,KAAiB,IAAA;AAAA,EAC/B;AAAA;AAAA,EAGA,IAAI,SAAA,GAAgC;AAClC,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,EAAY,OAAA,EAAQ;AACtC,IAAA,OAAO,OAAO,IAAA,KAAS,QAAA,IAAY,IAAA,GAAO,KAAK,IAAA,GAAO,MAAA;AAAA,EACxD;AAAA,EAEQ,QAAQ,IAAA,EAAqB;AACnC,IAAA,IAAI;AACF,MAAA,MAAM,SAAS,IAAA,CAAK,YAAA;AACpB,MAAA,IAAI,MAAA,IAAU,MAAA,CAAO,UAAA,KAAe,CAAA,EAAG;AACrC,QAAA,MAAA,CAAO,IAAA,CAAK,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,MAClC;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-Y5MBW5EU.js","sourcesContent":["/**\n * WebSocketServerTransport — `ws`-based WebSocket server.\n *\n * Accepts one client at a time. Implements ServerTransport from @skaile/workspaces/types.\n * Built on the `ws` package + `node:http`, both of which run under Node and Bun.\n */\n\nimport { createServer, type Server as HttpServer } from \"node:http\";\nimport { listenWithProbe } from \"@skaile/workspaces/core\";\nimport type { AgentCommand, AgentEvent, ServerTransport } from \"@skaile/workspaces/types\";\nimport { type WebSocket, WebSocketServer } from \"ws\";\nimport { decodeBearerFromHeader, tokensEqual } from \"./auth.js\";\n\n/** @deprecated Moved to `@skaile/workspaces/core`, where `portIsHeld` replaces it. */\nexport { needsWildcardProbe } from \"@skaile/workspaces/core\";\n\n/**\n * Options for {@link WebSocketServerTransport}.\n *\n * @param port - TCP port to bind to; `0` picks a free port (read it back via `boundPort`).\n * @param onLog - Optional callback for internal log lines (client connect/disconnect events).\n * @param host - Address to bind. Default: every interface (Node's unspecified address).\n * `127.0.0.1` accepts local clients only.\n * @param authToken - When set, every upgrade must present this token via the\n * `skaile-bearer.<base64url>` subprotocol or the handshake is rejected with\n * HTTP 401. When unset, no auth is enforced (back-compatible default).\n * @param onListening - Called once the socket is bound, with the address a client\n * connects to (`url`) and whether it needs a token. For a plain-text ready line\n * (the `onLog` record carries the port only inside a log sentence).\n * @param heartbeatMs - Interval in milliseconds between pings to the active\n * client. Default: 30 000.\n * @param maxMissedPongs - Heartbeat ticks the client may go without a pong (or\n * any inbound frame) before its socket is terminated, so a client lost behind a\n * dead path (no FIN) fires `onDisconnect` instead of swallowing every event\n * sent to it. Default: 2, i.e. detection within 3 x `heartbeatMs`. `0` turns\n * the heartbeat off. Every WebSocket client answers pings on its own.\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport interface WebSocketServerOptions {\n port: number;\n host?: string;\n onLog?: (line: string) => void;\n authToken?: string;\n onListening?: (info: { url: string; port: number; tokenRequired: boolean }) => void;\n heartbeatMs?: number;\n maxMissedPongs?: number;\n}\n\nconst DEFAULT_HEARTBEAT_MS = 30_000;\nconst DEFAULT_MAX_MISSED_PONGS = 2;\n\n/**\n * Shape-validate a `session_init` frame at ingress before forwarding to the\n * runner. Protocol v3 requires the deterministic bootstrap envelope to carry\n * an identity tuple, a semver-shaped `protocolVersion`, a resolved config\n * object, and a `credentials` map keyed by `mounts` / `connectors`. Frames\n * that fail the guard are rejected on the wire so the runner never sees a\n * malformed boot envelope.\n *\n * Returns `null` when the frame is well-formed, or a human-readable reason\n * when it should be rejected.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"SessionInitCommand schema\".\n *\n * @internal\n */\nfunction validateSessionInitShape(cmd: Record<string, unknown>): string | null {\n if (cmd.type !== \"session_init\") return \"type must be 'session_init'\";\n\n const identity = cmd.identity as Record<string, unknown> | undefined;\n if (!identity || typeof identity !== \"object\" || Array.isArray(identity)) {\n return \"identity must be an object\";\n }\n if (typeof identity.containerId !== \"string\") return \"identity.containerId must be a string\";\n if (typeof identity.sessionId !== \"string\") return \"identity.sessionId must be a string\";\n if (typeof identity.projectId !== \"string\") return \"identity.projectId must be a string\";\n\n const protocolVersion = cmd.protocolVersion as Record<string, unknown> | undefined;\n if (!protocolVersion || typeof protocolVersion !== \"object\" || Array.isArray(protocolVersion)) {\n return \"protocolVersion must be an object\";\n }\n if (typeof protocolVersion.major !== \"number\") return \"protocolVersion.major must be a number\";\n if (typeof protocolVersion.minor !== \"number\") return \"protocolVersion.minor must be a number\";\n if (typeof protocolVersion.patch !== \"number\") return \"protocolVersion.patch must be a number\";\n\n if (\n !cmd.resolvedConfig ||\n typeof cmd.resolvedConfig !== \"object\" ||\n Array.isArray(cmd.resolvedConfig)\n ) {\n return \"resolvedConfig must be an object\";\n }\n\n if (!cmd.credentials || typeof cmd.credentials !== \"object\" || Array.isArray(cmd.credentials)) {\n return \"credentials must be an object\";\n }\n\n return null;\n}\n\n/**\n * `ServerTransport` implementation backed by the `ws` package on top of a\n * `node:http` server.\n *\n * Enforces a single-client policy: if a new connection arrives while a client is\n * already connected, the stale connection is closed with code 4001 and replaced.\n * Incoming frames are parsed as JSON `AgentCommand` messages and fanned out to\n * registered `onCommand` handlers; outgoing `AgentEvent` objects are JSON-serialised\n * before sending. Call `listen()` to start accepting connections and `close()` to\n * shut down cleanly — `close()` terminates the active socket immediately rather\n * than keeping the event loop alive.\n *\n * @example\n * ```ts\n * const server = new WebSocketServerTransport({ port: 8080 });\n * await server.listen();\n * server.onCommand((cmd) => console.log(cmd));\n * server.send({ type: 'agent_end' });\n * await server.close();\n * ```\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport class WebSocketServerTransport implements ServerTransport {\n private httpServer: HttpServer | null = null;\n private wss: WebSocketServer | null = null;\n private activeClient: WebSocket | null = null;\n private readonly port: number;\n private readonly log: (line: string) => void;\n private readonly host?: string;\n private readonly authToken?: string;\n private readonly heartbeatMs: number;\n private readonly maxMissedPongs: number;\n\n private readonly onListening: WebSocketServerOptions[\"onListening\"];\n private readonly commandHandlers = new Set<(command: AgentCommand) => void>();\n private readonly connectHandlers = new Set<() => void>();\n private readonly disconnectHandlers = new Set<() => void>();\n\n constructor(options: WebSocketServerOptions) {\n this.port = options.port;\n this.log = options.onLog ?? console.log;\n this.host = options.host;\n this.authToken = options.authToken;\n this.onListening = options.onListening;\n this.heartbeatMs = options.heartbeatMs ?? DEFAULT_HEARTBEAT_MS;\n this.maxMissedPongs = options.maxMissedPongs ?? DEFAULT_MAX_MISSED_PONGS;\n }\n\n /** Start the server and accept connections. */\n async listen(): Promise<void> {\n const httpServer = createServer((_req, res) => {\n res.writeHead(200, { \"content-type\": \"text/plain\" });\n res.end(\"skaile agent server\");\n });\n // When an auth token is configured, reject the upgrade at handshake time\n // (HTTP 401) unless the client presents the matching bearer subprotocol.\n // Rejecting here — before `connection` — keeps unauthenticated sockets from\n // ever reaching the command handlers.\n const expected = this.authToken;\n const wss = new WebSocketServer({\n server: httpServer,\n verifyClient: expected\n ? (info, cb) => {\n const presented = decodeBearerFromHeader(info.req.headers[\"sec-websocket-protocol\"]);\n if (presented !== null && tokensEqual(presented, expected)) {\n cb(true);\n } else {\n this.log(\"[ws-server] rejecting unauthenticated upgrade\");\n cb(false, 401, \"Unauthorized\");\n }\n }\n : undefined,\n });\n wss.on(\"connection\", (ws) => this.handleConnection(ws));\n // `ws` re-emits the http server's errors on `wss`; unhandled during the bind,\n // that throws before the reject below runs and `listen()` hangs. Scoped to the\n // bind so a post-startup server error still surfaces loudly.\n const swallowBindError = () => {};\n wss.on(\"error\", swallowBindError);\n this.httpServer = httpServer;\n this.wss = wss;\n\n try {\n await listenWithProbe(httpServer, this.port, this.host);\n } catch (err) {\n wss.close();\n this.wss = null;\n this.httpServer = null;\n if (err instanceof Error && \"code\" in err && err.code === \"EADDRINUSE\") {\n const where = this.host ? `${this.host}:${this.port}` : `port ${this.port}`;\n throw Object.assign(\n new Error(\n `${where} is already in use: another process listens there. Pick another port.`,\n ),\n { code: \"EADDRINUSE\" },\n );\n }\n throw err;\n } finally {\n wss.off(\"error\", swallowBindError);\n }\n\n const addr = httpServer.address();\n const boundPort = typeof addr === \"object\" && addr ? addr.port : this.port;\n const bind = this.host ?? \"all interfaces\";\n this.log(\n `[ws-server] listening on port ${boundPort} (${bind}; ${this.authToken ? \"token required\" : \"no authentication\"})`,\n );\n // A wildcard bind is reachable on loopback; that is the URL worth printing.\n const urlHost =\n !this.host || this.host === \"0.0.0.0\" || this.host === \"::\"\n ? \"127.0.0.1\"\n : this.host.includes(\":\") && !this.host.startsWith(\"[\")\n ? `[${this.host}]`\n : this.host;\n this.onListening?.({\n url: `ws://${urlHost}:${boundPort}`,\n port: boundPort,\n tokenRequired: this.authToken !== undefined,\n });\n }\n\n private handleConnection(ws: WebSocket): void {\n if (this.activeClient) {\n // Close the stale connection instead of rejecting the new one.\n // This handles the race where waitForWsReady's probe hasn't\n // fully disconnected before the real gateway client connects.\n this.log(\"[ws-server] replacing previous connection\");\n try {\n this.activeClient.close(4001, \"Replaced by new connection\");\n } catch {\n // already closed\n }\n }\n this.log(\"[ws-server] client connected\");\n this.activeClient = ws;\n for (const handler of this.connectHandlers) {\n handler();\n }\n\n const stopHeartbeat = this.startHeartbeat(ws);\n\n ws.on(\"message\", (data) => {\n try {\n const parsed = JSON.parse(String(data)) as Record<string, unknown>;\n // Protocol v3: shape-validate `session_init` at ingress so the\n // runner never receives a malformed boot envelope. Other command\n // shapes pass through unchanged — invalid `AgentCommand`s surface\n // through the existing per-command handlers in serve.ts.\n if (parsed && typeof parsed === \"object\" && parsed.type === \"session_init\") {\n const reason = validateSessionInitShape(parsed);\n if (reason !== null) {\n this.log(`[ws-server] rejecting invalid session_init: ${reason}`);\n this.sendRaw({\n type: \"error\",\n message: `Invalid session_init: ${reason}`,\n fatal: false,\n });\n return;\n }\n }\n const cmd = parsed as unknown as AgentCommand;\n for (const handler of this.commandHandlers) {\n handler(cmd);\n }\n } catch (err) {\n this.sendRaw({\n type: \"error\",\n message: `Invalid message: ${err instanceof Error ? err.message : String(err)}`,\n fatal: false,\n });\n }\n });\n\n ws.on(\"close\", () => {\n stopHeartbeat();\n this.log(\"[ws-server] client disconnected\");\n if (this.activeClient === ws) {\n this.activeClient = null;\n for (const handler of this.disconnectHandlers) {\n handler();\n }\n }\n });\n }\n\n /**\n * Ping `ws` every {@link heartbeatMs}; terminate it after\n * {@link maxMissedPongs} unanswered ticks. `terminate()` makes `ws` emit\n * `close`, which runs the normal disconnect path. Returns the stop function.\n */\n private startHeartbeat(ws: WebSocket): () => void {\n if (this.maxMissedPongs <= 0) return () => {};\n let missed = 0;\n const markAlive = () => {\n missed = 0;\n };\n ws.on(\"pong\", markAlive);\n ws.on(\"message\", markAlive);\n const timer = setInterval(() => {\n if (ws.readyState !== ws.OPEN) return;\n if (missed >= this.maxMissedPongs) {\n this.log(\n `[ws-server] no pong for ${missed} heartbeats of ${this.heartbeatMs}ms; terminating client`,\n );\n clearInterval(timer);\n ws.terminate();\n return;\n }\n missed++;\n try {\n ws.ping();\n } catch {\n // socket closing underneath us; the close event cleans up\n }\n }, this.heartbeatMs);\n timer.unref?.();\n return () => clearInterval(timer);\n }\n\n /**\n * Stop the server.\n *\n * Terminates the active socket immediately — otherwise a still-connected\n * client would keep the event loop alive and block process shutdown.\n */\n async close(): Promise<void> {\n try {\n this.activeClient?.terminate();\n } catch {\n // already closed\n }\n this.activeClient = null;\n this.wss?.close();\n this.wss = null;\n const httpServer = this.httpServer;\n this.httpServer = null;\n if (httpServer) {\n httpServer.closeAllConnections();\n await new Promise<void>((resolve) => httpServer.close(() => resolve()));\n }\n }\n\n send(event: AgentEvent): void {\n this.sendRaw(event);\n }\n\n onCommand(handler: (command: AgentCommand) => void): () => void {\n this.commandHandlers.add(handler);\n return () => {\n this.commandHandlers.delete(handler);\n };\n }\n\n onConnect(handler: () => void): () => void {\n this.connectHandlers.add(handler);\n return () => {\n this.connectHandlers.delete(handler);\n };\n }\n\n onDisconnect(handler: () => void): () => void {\n this.disconnectHandlers.add(handler);\n return () => {\n this.disconnectHandlers.delete(handler);\n };\n }\n\n get connected(): boolean {\n return this.activeClient !== null;\n }\n\n /** The port actually bound by `listen()` (resolves `port: 0`); `undefined` when not listening. */\n get boundPort(): number | undefined {\n const addr = this.httpServer?.address();\n return typeof addr === \"object\" && addr ? addr.port : undefined;\n }\n\n private sendRaw(data: unknown): void {\n try {\n const client = this.activeClient;\n if (client && client.readyState === 1) {\n client.send(JSON.stringify(data));\n }\n } catch {\n // Silently ignore send failures\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../transport/src/ws/server.ts"],"names":[],"mappings":";;;;;AAiDA,IAAM,oBAAA,GAAuB,GAAA;AAC7B,IAAM,wBAAA,GAA2B,CAAA;AAkBjC,SAAS,yBAAyB,GAAA,EAA6C;AAC7E,EAAA,IAAI,GAAA,CAAI,IAAA,KAAS,cAAA,EAAgB,OAAO,6BAAA;AAExC,EAAA,MAAM,WAAW,GAAA,CAAI,QAAA;AACrB,EAAA,IAAI,CAAC,YAAY,OAAO,QAAA,KAAa,YAAY,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACxE,IAAA,OAAO,4BAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,QAAA,CAAS,WAAA,KAAgB,QAAA,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kBAAA,CAAmB,IAAI,OAAO,CAAA;AACnC,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,kBAAA,CAAmB,OAAO,OAAO,CAAA;AAAA,IACxC,CAAA;AAAA,EACF;AAAA,EAEA,IAAI,SAAA,GAAqB;AACvB,IAAA,OAAO,KAAK,YAAA,KAAiB,IAAA;AAAA,EAC/B;AAAA;AAAA,EAGA,IAAI,SAAA,GAAgC;AAClC,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,EAAY,OAAA,EAAQ;AACtC,IAAA,OAAO,OAAO,IAAA,KAAS,QAAA,IAAY,IAAA,GAAO,KAAK,IAAA,GAAO,MAAA;AAAA,EACxD;AAAA,EAEQ,QAAQ,IAAA,EAAqB;AACnC,IAAA,IAAI;AACF,MAAA,MAAM,SAAS,IAAA,CAAK,YAAA;AACpB,MAAA,IAAI,MAAA,IAAU,MAAA,CAAO,UAAA,KAAe,CAAA,EAAG;AACrC,QAAA,MAAA,CAAO,IAAA,CAAK,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,MAClC;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-EJPMNDTP.js","sourcesContent":["/**\n * WebSocketServerTransport — `ws`-based WebSocket server.\n *\n * Accepts one client at a time. Implements ServerTransport from @skaile/workspaces/types.\n * Built on the `ws` package + `node:http`, both of which run under Node and Bun.\n */\n\nimport { createServer, type Server as HttpServer } from \"node:http\";\nimport { listenWithProbe } from \"@skaile/workspaces/core\";\nimport type { AgentCommand, AgentEvent, ServerTransport } from \"@skaile/workspaces/types\";\nimport { type WebSocket, WebSocketServer } from \"ws\";\nimport { decodeBearerFromHeader, tokensEqual } from \"./auth.js\";\n\n/** @deprecated Moved to `@skaile/workspaces/core`, where `portIsHeld` replaces it. */\nexport { needsWildcardProbe } from \"@skaile/workspaces/core\";\n\n/**\n * Options for {@link WebSocketServerTransport}.\n *\n * @param port - TCP port to bind to; `0` picks a free port (read it back via `boundPort`).\n * @param onLog - Optional callback for internal log lines (client connect/disconnect events).\n * @param host - Address to bind. Default: every interface (Node's unspecified address).\n * `127.0.0.1` accepts local clients only.\n * @param authToken - When set, every upgrade must present this token via the\n * `skaile-bearer.<base64url>` subprotocol or the handshake is rejected with\n * HTTP 401. When unset, no auth is enforced (back-compatible default).\n * @param onListening - Called once the socket is bound, with the address a client\n * connects to (`url`) and whether it needs a token. For a plain-text ready line\n * (the `onLog` record carries the port only inside a log sentence).\n * @param heartbeatMs - Interval in milliseconds between pings to the active\n * client. Default: 30 000.\n * @param maxMissedPongs - Heartbeat ticks the client may go without a pong (or\n * any inbound frame) before its socket is terminated, so a client lost behind a\n * dead path (no FIN) fires `onDisconnect` instead of swallowing every event\n * sent to it. Default: 2, i.e. detection within 3 x `heartbeatMs`. `0` turns\n * the heartbeat off. Every WebSocket client answers pings on its own.\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport interface WebSocketServerOptions {\n port: number;\n host?: string;\n onLog?: (line: string) => void;\n authToken?: string;\n onListening?: (info: { url: string; port: number; tokenRequired: boolean }) => void;\n heartbeatMs?: number;\n maxMissedPongs?: number;\n}\n\nconst DEFAULT_HEARTBEAT_MS = 30_000;\nconst DEFAULT_MAX_MISSED_PONGS = 2;\n\n/**\n * Shape-validate a `session_init` frame at ingress before forwarding to the\n * runner. Protocol v3 requires the deterministic bootstrap envelope to carry\n * an identity tuple, a semver-shaped `protocolVersion`, a resolved config\n * object, and a `credentials` map keyed by `mounts` / `connectors`. Frames\n * that fail the guard are rejected on the wire so the runner never sees a\n * malformed boot envelope.\n *\n * Returns `null` when the frame is well-formed, or a human-readable reason\n * when it should be rejected.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"SessionInitCommand schema\".\n *\n * @internal\n */\nfunction validateSessionInitShape(cmd: Record<string, unknown>): string | null {\n if (cmd.type !== \"session_init\") return \"type must be 'session_init'\";\n\n const identity = cmd.identity as Record<string, unknown> | undefined;\n if (!identity || typeof identity !== \"object\" || Array.isArray(identity)) {\n return \"identity must be an object\";\n }\n if (typeof identity.containerId !== \"string\") return \"identity.containerId must be a string\";\n if (typeof identity.sessionId !== \"string\") return \"identity.sessionId must be a string\";\n if (typeof identity.projectId !== \"string\") return \"identity.projectId must be a string\";\n\n const protocolVersion = cmd.protocolVersion as Record<string, unknown> | undefined;\n if (!protocolVersion || typeof protocolVersion !== \"object\" || Array.isArray(protocolVersion)) {\n return \"protocolVersion must be an object\";\n }\n if (typeof protocolVersion.major !== \"number\") return \"protocolVersion.major must be a number\";\n if (typeof protocolVersion.minor !== \"number\") return \"protocolVersion.minor must be a number\";\n if (typeof protocolVersion.patch !== \"number\") return \"protocolVersion.patch must be a number\";\n\n if (\n !cmd.resolvedConfig ||\n typeof cmd.resolvedConfig !== \"object\" ||\n Array.isArray(cmd.resolvedConfig)\n ) {\n return \"resolvedConfig must be an object\";\n }\n\n if (!cmd.credentials || typeof cmd.credentials !== \"object\" || Array.isArray(cmd.credentials)) {\n return \"credentials must be an object\";\n }\n\n return null;\n}\n\n/**\n * `ServerTransport` implementation backed by the `ws` package on top of a\n * `node:http` server.\n *\n * Enforces a single-client policy: if a new connection arrives while a client is\n * already connected, the stale connection is closed with code 4001 and replaced.\n * Incoming frames are parsed as JSON `AgentCommand` messages and fanned out to\n * registered `onCommand` handlers; outgoing `AgentEvent` objects are JSON-serialised\n * before sending. Call `listen()` to start accepting connections and `close()` to\n * shut down cleanly — `close()` terminates the active socket immediately rather\n * than keeping the event loop alive.\n *\n * @example\n * ```ts\n * const server = new WebSocketServerTransport({ port: 8080 });\n * await server.listen();\n * server.onCommand((cmd) => console.log(cmd));\n * server.send({ type: 'agent_end' });\n * await server.close();\n * ```\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport class WebSocketServerTransport implements ServerTransport {\n private httpServer: HttpServer | null = null;\n private wss: WebSocketServer | null = null;\n private activeClient: WebSocket | null = null;\n private readonly port: number;\n private readonly log: (line: string) => void;\n private readonly host?: string;\n private readonly authToken?: string;\n private readonly heartbeatMs: number;\n private readonly maxMissedPongs: number;\n\n private readonly onListening: WebSocketServerOptions[\"onListening\"];\n private readonly commandHandlers = new Set<(command: AgentCommand) => void>();\n private readonly connectHandlers = new Set<() => void>();\n private readonly disconnectHandlers = new Set<() => void>();\n\n constructor(options: WebSocketServerOptions) {\n this.port = options.port;\n this.log = options.onLog ?? console.log;\n this.host = options.host;\n this.authToken = options.authToken;\n this.onListening = options.onListening;\n this.heartbeatMs = options.heartbeatMs ?? DEFAULT_HEARTBEAT_MS;\n this.maxMissedPongs = options.maxMissedPongs ?? DEFAULT_MAX_MISSED_PONGS;\n }\n\n /** Start the server and accept connections. */\n async listen(): Promise<void> {\n const httpServer = createServer((_req, res) => {\n res.writeHead(200, { \"content-type\": \"text/plain\" });\n res.end(\"skaile agent server\");\n });\n // When an auth token is configured, reject the upgrade at handshake time\n // (HTTP 401) unless the client presents the matching bearer subprotocol.\n // Rejecting here — before `connection` — keeps unauthenticated sockets from\n // ever reaching the command handlers.\n const expected = this.authToken;\n const wss = new WebSocketServer({\n server: httpServer,\n verifyClient: expected\n ? (info, cb) => {\n const presented = decodeBearerFromHeader(info.req.headers[\"sec-websocket-protocol\"]);\n if (presented !== null && tokensEqual(presented, expected)) {\n cb(true);\n } else {\n this.log(\"[ws-server] rejecting unauthenticated upgrade\");\n cb(false, 401, \"Unauthorized\");\n }\n }\n : undefined,\n });\n wss.on(\"connection\", (ws) => this.handleConnection(ws));\n // `ws` re-emits the http server's errors on `wss`; unhandled during the bind,\n // that throws before the reject below runs and `listen()` hangs. Scoped to the\n // bind so a post-startup server error still surfaces loudly.\n const swallowBindError = () => {};\n wss.on(\"error\", swallowBindError);\n this.httpServer = httpServer;\n this.wss = wss;\n\n try {\n await listenWithProbe(httpServer, this.port, this.host);\n } catch (err) {\n wss.close();\n this.wss = null;\n this.httpServer = null;\n if (err instanceof Error && \"code\" in err && err.code === \"EADDRINUSE\") {\n const where = this.host ? `${this.host}:${this.port}` : `port ${this.port}`;\n throw Object.assign(\n new Error(\n `${where} is already in use: another process listens there. Pick another port.`,\n ),\n { code: \"EADDRINUSE\" },\n );\n }\n throw err;\n } finally {\n wss.off(\"error\", swallowBindError);\n }\n\n const addr = httpServer.address();\n const boundPort = typeof addr === \"object\" && addr ? addr.port : this.port;\n const bind = this.host ?? \"all interfaces\";\n this.log(\n `[ws-server] listening on port ${boundPort} (${bind}; ${this.authToken ? \"token required\" : \"no authentication\"})`,\n );\n // A wildcard bind is reachable on loopback; that is the URL worth printing.\n const urlHost =\n !this.host || this.host === \"0.0.0.0\" || this.host === \"::\"\n ? \"127.0.0.1\"\n : this.host.includes(\":\") && !this.host.startsWith(\"[\")\n ? `[${this.host}]`\n : this.host;\n this.onListening?.({\n url: `ws://${urlHost}:${boundPort}`,\n port: boundPort,\n tokenRequired: this.authToken !== undefined,\n });\n }\n\n private handleConnection(ws: WebSocket): void {\n if (this.activeClient) {\n // Close the stale connection instead of rejecting the new one.\n // This handles the race where waitForWsReady's probe hasn't\n // fully disconnected before the real gateway client connects.\n this.log(\"[ws-server] replacing previous connection\");\n try {\n this.activeClient.close(4001, \"Replaced by new connection\");\n } catch {\n // already closed\n }\n }\n this.log(\"[ws-server] client connected\");\n this.activeClient = ws;\n for (const handler of this.connectHandlers) {\n handler();\n }\n\n const stopHeartbeat = this.startHeartbeat(ws);\n\n ws.on(\"message\", (data) => {\n try {\n const parsed = JSON.parse(String(data)) as Record<string, unknown>;\n // Protocol v3: shape-validate `session_init` at ingress so the\n // runner never receives a malformed boot envelope. Other command\n // shapes pass through unchanged — invalid `AgentCommand`s surface\n // through the existing per-command handlers in serve.ts.\n if (parsed && typeof parsed === \"object\" && parsed.type === \"session_init\") {\n const reason = validateSessionInitShape(parsed);\n if (reason !== null) {\n this.log(`[ws-server] rejecting invalid session_init: ${reason}`);\n this.sendRaw({\n type: \"error\",\n message: `Invalid session_init: ${reason}`,\n fatal: false,\n });\n return;\n }\n }\n const cmd = parsed as unknown as AgentCommand;\n for (const handler of this.commandHandlers) {\n handler(cmd);\n }\n } catch (err) {\n this.sendRaw({\n type: \"error\",\n message: `Invalid message: ${err instanceof Error ? err.message : String(err)}`,\n fatal: false,\n });\n }\n });\n\n ws.on(\"close\", () => {\n stopHeartbeat();\n this.log(\"[ws-server] client disconnected\");\n if (this.activeClient === ws) {\n this.activeClient = null;\n for (const handler of this.disconnectHandlers) {\n handler();\n }\n }\n });\n }\n\n /**\n * Ping `ws` every {@link heartbeatMs}; terminate it after\n * {@link maxMissedPongs} unanswered ticks. `terminate()` makes `ws` emit\n * `close`, which runs the normal disconnect path. Returns the stop function.\n */\n private startHeartbeat(ws: WebSocket): () => void {\n if (this.maxMissedPongs <= 0) return () => {};\n let missed = 0;\n const markAlive = () => {\n missed = 0;\n };\n ws.on(\"pong\", markAlive);\n ws.on(\"message\", markAlive);\n const timer = setInterval(() => {\n if (ws.readyState !== ws.OPEN) return;\n if (missed >= this.maxMissedPongs) {\n this.log(\n `[ws-server] no pong for ${missed} heartbeats of ${this.heartbeatMs}ms; terminating client`,\n );\n clearInterval(timer);\n ws.terminate();\n return;\n }\n missed++;\n try {\n ws.ping();\n } catch {\n // socket closing underneath us; the close event cleans up\n }\n }, this.heartbeatMs);\n timer.unref?.();\n return () => clearInterval(timer);\n }\n\n /**\n * Stop the server.\n *\n * Terminates the active socket immediately — otherwise a still-connected\n * client would keep the event loop alive and block process shutdown.\n */\n async close(): Promise<void> {\n try {\n this.activeClient?.terminate();\n } catch {\n // already closed\n }\n this.activeClient = null;\n this.wss?.close();\n this.wss = null;\n const httpServer = this.httpServer;\n this.httpServer = null;\n if (httpServer) {\n httpServer.closeAllConnections();\n await new Promise<void>((resolve) => httpServer.close(() => resolve()));\n }\n }\n\n send(event: AgentEvent): void {\n this.sendRaw(event);\n }\n\n onCommand(handler: (command: AgentCommand) => void): () => void {\n this.commandHandlers.add(handler);\n return () => {\n this.commandHandlers.delete(handler);\n };\n }\n\n onConnect(handler: () => void): () => void {\n this.connectHandlers.add(handler);\n return () => {\n this.connectHandlers.delete(handler);\n };\n }\n\n onDisconnect(handler: () => void): () => void {\n this.disconnectHandlers.add(handler);\n return () => {\n this.disconnectHandlers.delete(handler);\n };\n }\n\n get connected(): boolean {\n return this.activeClient !== null;\n }\n\n /** The port actually bound by `listen()` (resolves `port: 0`); `undefined` when not listening. */\n get boundPort(): number | undefined {\n const addr = this.httpServer?.address();\n return typeof addr === \"object\" && addr ? addr.port : undefined;\n }\n\n private sendRaw(data: unknown): void {\n try {\n const client = this.activeClient;\n if (client && client.readyState === 1) {\n client.send(JSON.stringify(data));\n }\n } catch {\n // Silently ignore send failures\n }\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { mcpNotRunnableReason } from './chunk-HWNK3F3X.js';
2
+ import { fetchAssetFilesFromGitHub } from './chunk-BFMYYNDT.js';
3
+ import { isValidAssetName } from './chunk-LSSYC5IC.js';
4
+ import { createHash } from 'crypto';
5
+
6
+ function storeNotInstallableReason(a) {
7
+ if (!isValidAssetName(a.name)) {
8
+ return `the name "${a.name}" is not a canonical asset name, so no ref names it`;
9
+ }
10
+ return void 0;
11
+ }
12
+ async function mcpNotRunnableHere(manifest, name, fetcher = fetchAssetFilesFromGitHub) {
13
+ const file = manifest.files.find((f) => f.path === "MCP.md" || f.path.endsWith("/MCP.md"));
14
+ if (!file) return void 0;
15
+ try {
16
+ const bytes = await fetcher({
17
+ url: manifest.source.url,
18
+ commitSha: manifest.source.commitSha,
19
+ paths: [file.path]
20
+ });
21
+ const buf = bytes[file.path];
22
+ if (!buf || createHash("sha256").update(buf).digest("hex") !== file.sha256) return void 0;
23
+ return mcpNotRunnableReason(buf.toString("utf8"), name);
24
+ } catch {
25
+ return void 0;
26
+ }
27
+ }
28
+
29
+ export { mcpNotRunnableHere, storeNotInstallableReason };
30
+ //# sourceMappingURL=chunk-EX3GLAL6.js.map
31
+ //# sourceMappingURL=chunk-EX3GLAL6.js.map
@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add` can take. The store lists only what `add` can install\n * (owner decision, RCV p385): one rule for `search`, `store search`, `store show` and the\n * `manage` store feed, so a listing never offers a ref that then fails.\n *\n * Every store kind is installable (owner decision, RCW p610): `add` stages the pointer's files\n * into the store cache and deploys them (skills, agents, contracts) or composes them at session\n * start (mcp-server). Only a name that is no canonical asset name cannot be added.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { mcpNotRunnableReason } from \"@skaile/workspaces/asset-manager\";\nimport { isValidAssetName } from \"@skaile/workspaces/core\";\nimport { type AssetFetcher, fetchAssetFilesFromGitHub } from \"@skaile/workspaces/library\";\nimport type { CatalogAsset } from \"@skaile/workspaces/plugins\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\n\n/**\n * Why `skaile add` cannot take a store row as printed, or `undefined` when it can: a name that\n * is not a canonical asset name (`UI Rendering` copied from a listing is two shell arguments\n * and no ref).\n */\nexport function storeNotInstallableReason(\n a: Pick<CatalogAsset, \"kind\" | \"name\">,\n): string | undefined {\n if (!isValidAssetName(a.name)) {\n return `the name \"${a.name}\" is not a canonical asset name, so no ref names it`;\n }\n return undefined;\n}\n\n/**\n * Why the `mcp-server` of `manifest` gets no `.mcp.json` entry from this CLI (a Nix-recipe\n * server, a placeholder url), read from its pinned `MCP.md`: the catalog row carries no manifest\n * fields. `undefined` when it would get one, or when the file cannot be fetched or does not match\n * the recorded sha256: nothing is claimed then (p1491).\n *\n * @param fetcher - Fetches the file at the pinned commit; GitHub's raw host by default.\n */\nexport async function mcpNotRunnableHere(\n manifest: Pick<InstallManifest, \"files\" | \"source\">,\n name: string,\n fetcher: AssetFetcher = fetchAssetFilesFromGitHub,\n): Promise<string | undefined> {\n const file = manifest.files.find((f) => f.path === \"MCP.md\" || f.path.endsWith(\"/MCP.md\"));\n if (!file) return undefined;\n try {\n const bytes = await fetcher({\n url: manifest.source.url,\n commitSha: manifest.source.commitSha,\n paths: [file.path],\n });\n const buf = bytes[file.path];\n if (!buf || createHash(\"sha256\").update(buf).digest(\"hex\") !== file.sha256) return undefined;\n return mcpNotRunnableReason(buf.toString(\"utf8\"), name);\n } catch {\n return undefined;\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { registryCredentialEnv } from './chunk-CQJH4G2K.js';
2
- import { mergeRegistries } from './chunk-MJHSLODD.js';
1
+ import { registryCredentialEnv } from './chunk-ILLTBKDJ.js';
2
+ import { mergeRegistries } from './chunk-LSI2IVFT.js';
3
3
  import { createLogger } from './chunk-BOFL7GIF.js';
4
4
  import { EventEmitter } from 'events';
5
5
 
@@ -15,7 +15,7 @@ function toMergedRegistry(registry, layer = "session") {
15
15
  }
16
16
  return mergeRegistries([{ layer, providers: registry }]);
17
17
  }
18
- function registryDriverConfig(registry, options = {}) {
18
+ function registryHarnessConfig(registry, options = {}) {
19
19
  const merged = toMergedRegistry(registry, "runtime");
20
20
  return {
21
21
  registry: merged,
@@ -31,10 +31,10 @@ function isAgentEffort(value) {
31
31
  return AGENT_EFFORT_LEVELS.includes(value);
32
32
  }
33
33
  var TOOL_ALLOWLIST_UNSUPPORTED = "This agent harness cannot enforce a tool allowlist";
34
- var AgentDriver = class extends EventEmitter {
34
+ var AgentHarness = class extends EventEmitter {
35
35
  /**
36
- * Preserve text-only callers; drivers must explicitly support attachments.
37
- * A `toolAllowlist` is refused here: only a driver that overrides
36
+ * Preserve text-only callers; harnesses must explicitly support attachments.
37
+ * A `toolAllowlist` is refused here: only a harness that overrides
38
38
  * {@link enforcesToolAllowlist} may run a restricted turn.
39
39
  */
40
40
  promptInput(input) {
@@ -45,17 +45,17 @@ var AgentDriver = class extends EventEmitter {
45
45
  }
46
46
  /**
47
47
  * Whether {@link promptInput} enforces `AgentPromptInput.toolAllowlist` for
48
- * the whole turn, subagents included. A driver that answers `false` must
48
+ * the whole turn, subagents included. A harness that answers `false` must
49
49
  * reject an input carrying one; the runner refuses such a prompt before it
50
- * reaches the driver.
50
+ * reaches the harness.
51
51
  */
52
52
  get enforcesToolAllowlist() {
53
53
  return false;
54
54
  }
55
55
  /**
56
- * The names in `allowlist` this driver does not recognize as a tool it could
56
+ * The names in `allowlist` this harness does not recognize as a tool it could
57
57
  * offer. The runner refuses a prompt whose allowlist names any, rather than
58
- * guess. A driver that does not enforce allowlists recognizes none.
58
+ * guess. A harness that does not enforce allowlists recognizes none.
59
59
  */
60
60
  unknownAllowlistedTools(allowlist) {
61
61
  return [...allowlist];
@@ -64,7 +64,7 @@ var AgentDriver = class extends EventEmitter {
64
64
  get acceptsReplyAsPrompt() {
65
65
  return true;
66
66
  }
67
- /** Stop the driver and await owned process/state cleanup when the harness supports it. */
67
+ /** Stop the harness and await owned process/state cleanup when the harness supports it. */
68
68
  async dispose() {
69
69
  this.kill();
70
70
  }
@@ -72,25 +72,25 @@ var AgentDriver = class extends EventEmitter {
72
72
  get runtimeSessionId() {
73
73
  return void 0;
74
74
  }
75
- /** Slash commands discovered from the agent runtime. Override in drivers that support introspection. */
75
+ /** Slash commands discovered from the agent runtime. Override in harnesses that support introspection. */
76
76
  getSlashCommands() {
77
77
  return [];
78
78
  }
79
79
  // ── Interactive questions (AskUserQuestion) ──────────────────────────────
80
80
  /**
81
- * `true` while the driver is paused on an interactive question and waiting
81
+ * `true` while the harness is paused on an interactive question and waiting
82
82
  * for the user's answer rather than a new prompt. The runner routes a
83
83
  * `reply` command to {@link answerQuestion} instead of {@link prompt} when
84
- * this returns `true`. Drivers without interactive-question support return
84
+ * this returns `true`. Harnesses without interactive-question support return
85
85
  * `false` (the default), so a `reply` falls back to `prompt`.
86
86
  */
87
87
  hasPendingQuestion() {
88
88
  return false;
89
89
  }
90
90
  /**
91
- * Deliver the user's answer to the question the driver is currently paused
91
+ * Deliver the user's answer to the question the harness is currently paused
92
92
  * on. This resumes the in-flight turn — it does NOT start a new one. When a
93
- * single tool call asks several questions, the driver resolves the underlying
93
+ * single tool call asks several questions, the harness resolves the underlying
94
94
  * call only once every sub-question has an answer.
95
95
  *
96
96
  * @param answer - The user's reply text (an option label, free text, or for
@@ -106,22 +106,22 @@ var AgentDriver = class extends EventEmitter {
106
106
  return false;
107
107
  }
108
108
  /**
109
- * Apply this driver's rule for a new prompt that meets a pending question,
109
+ * Apply this harness's rule for a new prompt that meets a pending question,
110
110
  * ahead of the prompt itself. The runner queues a prompt behind the turn in
111
111
  * flight, so a turn paused on a question would otherwise hold that prompt
112
- * until the user answered. Drivers whose `prompt()` cancels the question
112
+ * until the user answered. Harnesses whose `prompt()` cancels the question
113
113
  * (claude-sdk, omp) do the same here; the default keeps the question.
114
114
  */
115
115
  supersedePendingQuestion() {
116
116
  }
117
117
  // ── Live reconfiguration ────────────────────────────────────────────────
118
118
  /**
119
- * Live-update driver configuration. `ok: true` means effective from the next
119
+ * Live-update harness configuration. `ok: true` means effective from the next
120
120
  * turn: the next turn runs on the new settings, by live switch, query recycle
121
121
  * or respawn, and the host needs no restart. A turn in progress finishes on
122
122
  * the old settings. Only model/thinking/effort are reconfigurable mid-session.
123
123
  *
124
- * Drivers that can honour that promise build a `ReconfigureLedger` and
124
+ * Harnesses that can honour that promise build a `ReconfigureLedger` and
125
125
  * delegate to it; it owns the model scope rule, ordering, drift and rollback.
126
126
  * The base implementation answers `not_supported`.
127
127
  */
@@ -130,11 +130,11 @@ var AgentDriver = class extends EventEmitter {
130
130
  return Promise.resolve({
131
131
  ok: false,
132
132
  code: "not_supported",
133
- message: `The ${this.driverInfo.id} driver cannot change ${fields} live; the change applies when the session next starts.`
133
+ message: `The ${this.harnessInfo.id} harness cannot change ${fields} live; the change applies when the session next starts.`
134
134
  });
135
135
  }
136
136
  /**
137
- * Returns the model identifier currently configured on this driver.
137
+ * Returns the model identifier currently configured on this harness.
138
138
  * Subclasses that store config locally should override this.
139
139
  */
140
140
  getModel() {
@@ -145,18 +145,18 @@ var AgentDriver = class extends EventEmitter {
145
145
  * `Date.now()` of the harness's most recent sign of life, counting messages
146
146
  * that emit no `agent-event` (thinking deltas, rate-limit telemetry, API
147
147
  * retries). A stall check reads it alongside the events it sees. `null` when
148
- * the driver does not track it.
148
+ * the harness does not track it.
149
149
  */
150
150
  lastActivityAt() {
151
151
  return null;
152
152
  }
153
153
  /**
154
154
  * Returns the token usage from the most recent completed turn.
155
- * Returns `null` if usage data is unavailable (e.g. driver doesn't track it).
155
+ * Returns `null` if usage data is unavailable (e.g. harness doesn't track it).
156
156
  *
157
157
  * Widened in 3.1.0 to return the full `TokenUsage` shape (input / output /
158
158
  * cache-read / cache-creation / reasoning). All fields are optional so
159
- * drivers can populate just what their provider reports. Existing callers
159
+ * harnesses can populate just what their provider reports. Existing callers
160
160
  * that read only `inputTokens` / `outputTokens` keep working — those fields
161
161
  * are still present and carry the same semantics as before.
162
162
  */
@@ -173,11 +173,11 @@ var AgentDriver = class extends EventEmitter {
173
173
  * (compaction thresholds) must prefer this; callers billing a turn
174
174
  * (usage ledgers, the `finished` event) must keep using `getTokenUsage()`.
175
175
  *
176
- * Returns `null` both when the driver cannot report a per-call figure at all
176
+ * Returns `null` both when the harness cannot report a per-call figure at all
177
177
  * and when it can but has no reading yet. Falling back to `getTokenUsage()`
178
- * is safe in either case only because a driver clears the two in lockstep: no
178
+ * is safe in either case only because a harness clears the two in lockstep: no
179
179
  * reading means no API call landed, so there is no cumulative usage to
180
- * overstate. A driver implementing this must preserve that invariant.
180
+ * overstate. A harness implementing this must preserve that invariant.
181
181
  */
182
182
  getContextTokens() {
183
183
  return null;
@@ -190,8 +190,8 @@ var AgentDriver = class extends EventEmitter {
190
190
  return null;
191
191
  }
192
192
  /**
193
- * What the driver can measure natively about its context window, in the
194
- * neutral {@link DriverContextReport} shape, or `null` when it measures
193
+ * What the harness can measure natively about its context window, in the
194
+ * neutral {@link HarnessContextReport} shape, or `null` when it measures
195
195
  * nothing beyond {@link getContextTokens} / {@link getContextWindow}.
196
196
  *
197
197
  * `detail: "full"` (the default) may be expensive — claude-sdk issues
@@ -205,8 +205,8 @@ var AgentDriver = class extends EventEmitter {
205
205
  return null;
206
206
  }
207
207
  /**
208
- * Returns the list of models available to this driver without starting a session.
209
- * Drivers that can enumerate their own models override this method.
208
+ * Returns the list of models available to this harness without starting a session.
209
+ * Harnesses that can enumerate their own models override this method.
210
210
  * Returns an empty array by default.
211
211
  */
212
212
  async listModels() {
@@ -218,8 +218,8 @@ var AgentDriver = class extends EventEmitter {
218
218
  _activeTurnSpan;
219
219
  _turnStartTime;
220
220
  /**
221
- * Attach a telemetry provider and active trace to this driver.
222
- * Called by the runner after creating the driver but before start().
221
+ * Attach a telemetry provider and active trace to this harness.
222
+ * Called by the runner after creating the harness but before start().
223
223
  */
224
224
  setTelemetry(provider, trace) {
225
225
  this._telemetry = provider;
@@ -243,7 +243,7 @@ var AgentDriver = class extends EventEmitter {
243
243
  /**
244
244
  * End the current turn span with generation data.
245
245
  * Called by the runner after agent_end. Model and provider are passed
246
- * explicitly — the driver base class does not access config directly.
246
+ * explicitly — the harness base class does not access config directly.
247
247
  */
248
248
  endTurnSpan(result) {
249
249
  if (!this._telemetry || !this._activeTurnSpan) return;
@@ -268,6 +268,6 @@ var AgentDriver = class extends EventEmitter {
268
268
  }
269
269
  };
270
270
 
271
- export { AGENT_EFFORT_LEVELS, AgentDriver, TOOL_ALLOWLIST_UNSUPPORTED, getBridgeLogger, registryDriverConfig, toAgentEffort, toMergedRegistry };
272
- //# sourceMappingURL=chunk-XWOPZW26.js.map
273
- //# sourceMappingURL=chunk-XWOPZW26.js.map
271
+ export { AGENT_EFFORT_LEVELS, AgentHarness, TOOL_ALLOWLIST_UNSUPPORTED, getBridgeLogger, registryHarnessConfig, toAgentEffort, toMergedRegistry };
272
+ //# sourceMappingURL=chunk-FKQNBCDW.js.map
273
+ //# sourceMappingURL=chunk-FKQNBCDW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../bridge/src/logger.ts","../bridge/src/provider-registry-derive.ts","../bridge/src/types.ts"],"names":[],"mappings":";;;;;;AAuBO,SAAS,gBAAgB,OAAA,EAAyB;AACvD,EAAA,OAAO,YAAA,CAAa,EAAE,IAAA,EAAM,QAAA,EA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GAAU,IAAA;AAAA,MAClC,OAAO,MAAA,EAAQ,KAAA;AAAA,MACf,UAAA,EAAY,EAAE,yBAAA,EAA2B,UAAA;AAAW,KACrD,CAAA;AAED,IAAA,IAAA,CAAK,eAAA,GAAkB,MAAA;AACvB,IAAA,IAAA,CAAK,cAAA,GAAiB,MAAA;AAAA,EACxB;AACF","file":"chunk-FKQNBCDW.js","sourcesContent":["/**\n * Bridge-layer logger factory.\n *\n * Each harness creates its own Logger via `getBridgeLogger(subkind)` at\n * construction time. Falls back to an off-mode Logger (stdout only) when\n * no LogStore is registered — see @skaile/workspaces/core/logging for details.\n */\n\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\n\n/**\n * Construct a bridge-scoped Logger for a given harness subkind.\n *\n * Creates a `Logger` with `kind: \"bridge\"` and the specified `subkind`. Falls back to\n * an off-mode Logger (stdout only) when no `LogStore` is registered — see\n * `@skaile/workspaces/core/logging` for details. Each harness calls this once at construction\n * time; never re-construct per call.\n *\n * @param subkind - Harness id, e.g. `\"claude-sdk\"`, `\"omp\"`, `\"echo\"`, `\"codex\"`.\n * @returns A `Logger` scoped to `bridge:<subkind>`.\n * @docLink packages/bridge/api-reference#logger\n */\nexport function getBridgeLogger(subkind: string): Logger {\n return createLogger({ kind: \"bridge\", subkind });\n}\n","/**\n * The two shaping helpers every registry consumer needs.\n *\n * The legacy provider axis — `provider` / `cloud` / `cloud_config` /\n * `cloudSecrets` — is gone from the runtime, and so is the user-local\n * `settings.json` `apiKeys{}` map: a session carries an AI provider registry\n * and a model selector, nothing else. Credentials are named by a\n * `credential.ref` and resolved into the child environment; no literal secret\n * ever enters an entry.\n */\n\nimport {\n type AIProviderLayerId,\n type AIProviderRegistry,\n type MergedAIProviderRegistry,\n mergeRegistries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport {\n type RegistryCredentialOptions,\n registryCredentialEnv,\n} from \"./provider-materialize/credential-env.js\";\n\n/** Turn any registry shape into the merged view, without re-merging one. */\nexport function toMergedRegistry(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n layer: AIProviderLayerId = \"session\",\n): MergedAIProviderRegistry {\n if (Array.isArray((registry as MergedAIProviderRegistry).order)) {\n return registry as MergedAIProviderRegistry;\n }\n return mergeRegistries([{ layer, providers: registry as AIProviderRegistry }]);\n}\n\n/**\n * The `AgentConfig` slice a `HarnessTarget.listModels` closure builds its\n * throwaway harness from: the registry, the selector when the caller named one\n * entry, and the credentials as a child-environment fragment.\n *\n * The credentials have to ride `env`, not a side channel: a `platform:` or\n * `cmd:` reference resolves where the *caller* stands, and this process's own\n * environment cannot see it. `registryCredentialEnv` writes each one under\n * `SKAILE_AIP_<ID>_KEY`, which is the carrier every harness already consults.\n */\nexport function registryHarnessConfig(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialOptions = {},\n): { registry: MergedAIProviderRegistry; env: Record<string, string>; modelRef?: string } {\n const merged = toMergedRegistry(registry, \"runtime\");\n return {\n registry: merged,\n env: registryCredentialEnv(merged, options),\n ...(options.providerId ? { modelRef: options.providerId } : {}),\n };\n}\n","import { EventEmitter } from \"node:events\";\nimport type { Span, TelemetryProvider, Trace } from \"@skaile/workspaces/telemetry\";\nimport type {\n AgentPromptInput,\n Capability,\n CredentialMint,\n CodexCredentialDelivery,\n ContextUsageDetail,\n HarnessContextReport,\n HarnessInfo,\n ErrorRetryReason,\n CodexSubscriptionRefreshInput,\n CodexSubscriptionRefreshResult,\n FlowExecution,\n ModelTokenUsage,\n RenderInvokedEvent,\n TokenUsage,\n} from \"@skaile/workspaces/types\";\nimport type { CodexServerRequestHandlers } from \"./codex-app-server.js\";\nexport type { AgentPromptInput } from \"@skaile/workspaces/types\";\nimport type { MergedAIProviderRegistry } from \"@skaile/workspaces/core/provider-registry\";\nimport type { ModelEntry } from \"./models.js\";\n\n/**\n * Test-only hook injected by the runner so a no-LLM harness (the echo harness's\n * scripted-flow mode) can read flow state and drive flow-adapter mutations\n * without an SDK/MCP round-trip. The runner wires this in `createActiveFlow`\n * from the active FlowAdapter + handle.\n *\n * This is an internal runner↔harness interface — NOT part of any wire\n * protocol or flow contract. Production harnesses ignore it.\n *\n * @see packages/bridge/harnesses/echo — scripted-flow mode\n * @since 3.6.0\n */\nexport interface FlowTestHarnessHook {\n /** Current flow execution snapshot, or `null` when no flow is active. */\n getState(): FlowExecution | null;\n /**\n * Execute a flow-adapter operation (`start_node`, `request_approval`,\n * `complete_node`, `request_input`, `skip_node`, `fail_node`, …). Returns\n * the adapter's JSON string result (or rejects on an illegal transition).\n */\n execute(op: string, args: Record<string, unknown>): Promise<string>;\n /**\n * Node IDs marked as mandatory approval gates. The scripted policy resolves\n * `auto` to `request_approval` for these even in autonomous mode, so hosts\n * can drive a mandatory gate deterministically. Optional — absent hooks\n * behave as if no node is mandatory.\n */\n mandatoryGates?(): string[];\n}\n\n/**\n * Minimal LLM tool descriptor used by the capability dispatch path. Mirrors\n * the runner's `LLMTool` shape so harnesses can consume registry output without\n * importing `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-tool\n */\nexport interface BridgeCapabilityTool {\n /** Capability name; used as the LLM-visible tool name. */\n name: string;\n /** Human/LLM-readable description. */\n description: string;\n /** JSON Schema for the tool's input parameters. */\n parameters: Record<string, unknown>;\n}\n\n/**\n * Render-cap event emission callback used by the bridge when the LLM invokes\n * a capability that carries a `render` spec. The runner provides the actual\n * sink (transport.send / sendEvent); the bridge only emits.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-render-emit\n */\nexport type BridgeRenderEmit = (event: RenderInvokedEvent) => void;\n\n/**\n * Text-event emission callback for render-capability fallbacks. When a\n * `RenderCapability` carries `render.fallback` and the LLM invokes it, the\n * bridge substitutes `{{prop}}` placeholders (top-level keys of `props`,\n * optional dotted-path traversal `{{user.name}}`) and pushes the rendered\n * string through this callback so clients without a render layer still see\n * a textual representation. No-op when `fallback` is absent.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-text-emit\n */\nexport type BridgeTextEmit = (text: string) => void;\n\n/**\n * Bundle of capability dispatch hooks. Registered into the harness via\n * `AgentConfig.capabilities`; the harness routes registered LLM tool calls\n * back into `invoke()` instead of using its native dispatch path.\n *\n * The runner constructs this from a `CapabilityRegistry` instance and threads\n * it through `createAgentSession()`. Harnesses that don't yet implement\n * capability dispatch ignore the field — legacy v1 paths stay intact.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-hooks\n */\nexport interface BridgeCapabilityHooks {\n /** Build the LLM tool descriptor list from the registry. Called per turn so registration changes take effect. */\n composeTools(): BridgeCapabilityTool[];\n /** Resolve a wire-format Capability descriptor by name. Used by the bridge to inspect `fireAndForget` / `render`. */\n resolve(name: string): Capability | null;\n /**\n * Validate input + dispatch through the registry. Logging is wired by the\n * registry.\n *\n * `callId` is the per-dispatch id minted by `dispatchCapability`. It MUST be\n * unique per process (never a harness/provider tool-call id, which only the\n * model backend keeps unique): it is the `render_invoked.callId`, the\n * registry's log correlation id, the handler's `ctx.callId` and — for client\n * capabilities — the `capability_invoked.callId` keying the runner's pending\n * map, so a reused id would let a late `capability_result` for a timed-out\n * call resolve a later call. Callers without one omit it and the registry\n * generates a fresh id.\n */\n invoke(name: string, input: unknown, signal?: AbortSignal, callId?: string): Promise<unknown>;\n /** Subscribe to registry changes; callback carries no credentials or tool payloads. */\n onToolsChanged?(listener: () => void): () => void;\n /** Emit a render-invoked event. The runner forwards via the WebSocket transport. */\n emitRender?: BridgeRenderEmit;\n /** Emit a text fallback for render capabilities with `render.fallback`. */\n emitText?: BridgeTextEmit;\n /** Session id passed through to the runner's per-handler logger. */\n sessionId: string;\n}\n\n/**\n * Static metadata for a registered agent harness (the coding-agent product it drives).\n *\n * Declared once in `@skaile/workspaces/types` — it is protocol surface (the\n * platform reads `surfaces` to decide which AI provider registry entries a\n * harness can serve) and was previously duplicated here field-for-field.\n *\n * Returned by {@link listHarnesses} and exposed on every {@link AgentHarness}\n * instance via `harnessInfo`.\n *\n * @docLink packages/bridge/concepts#harness-info\n */\nexport type { HarnessInfo };\n\n/** Closed, passive managed-MCP observations. Counts saturate at 512. */\nexport interface CodexNativeMcpDiagnostics {\n startupBeforeTurn: \"unknown\" | \"starting\" | \"ready\" | \"failed\" | \"cancelled\";\n startupAtEnd: CodexNativeMcpDiagnostics[\"startupBeforeTurn\"];\n toolsListBeforeTurn: number;\n toolsListTotal: number;\n toolsCallTotal: number;\n nativeMcpToolItemCount: number;\n}\n\n/** Trusted session-local tool transport; fulfilled only after required tools are ready. */\nexport interface CodexToolTransport {\n mcpServers: Record<string, Record<string, unknown>>;\n /** Trusted runner server eligible for human native consent; must name its configured entry. */\n approvalServerName?: string;\n onServerRequest?: CodexServerRequestHandlers;\n /** Revalidate the required live inventory before starting each turn. */\n validate?(): Promise<void>;\n /** Rebuild the native generation at idle when its advertised inventory is stale. */\n needsReload?(): boolean;\n instructions?: string;\n /** Restrict model calls to the active turn and abort outstanding calls when it ends. */\n beginTurn?(signal: AbortSignal): void;\n /** Trusted private server binding and passive request-handler counters; never performs I/O. */\n diagnostics?: {\n serverName: string;\n requestCounts(): { toolsListTotal: number; toolsCallTotal: number };\n };\n dispose(): Promise<void>;\n}\n\n/** Explicit managed instance inputs; none are inferred from ambient developer state. */\nexport interface CodexManagedRuntimeOptions {\n executable: string;\n /** Optional launcher arguments, for the caller-owned executable wrapper. */\n executableArgs?: string[];\n /** Private local filesystem state; the host must fence old native processes before reuse. */\n privateDirectory: string;\n /** Host-owned private mount containing every parent/child instance; denied to native tools. */\n privateRoot: string;\n environment: Record<string, string>;\n credential: CodexCredentialDelivery;\n instructionFiles?: string[];\n skillsDirectory?: string;\n prepareTools(signal: AbortSignal): Promise<CodexToolTransport>;\n /**\n * Passive snapshots before/after turns, plus final local counts after successful transport closure.\n * No final snapshot is emitted on uncertain cleanup or a failed final counter read. Earlier snapshots\n * are not proof of completed cleanup. Sink failures never affect native execution or cleanup.\n */\n onNativeMcpDiagnostics?(value: Readonly<CodexNativeMcpDiagnostics>): void | Promise<void>;\n refreshCredential?: (\n input: CodexSubscriptionRefreshInput,\n signal: AbortSignal,\n ) => Promise<CodexSubscriptionRefreshResult>;\n requestTimeoutMs?: number;\n turnTimeoutMs?: number;\n /** Maximum native turns admitted by this instance; reserved for disposable one-turn children. */\n nativeTurnBudget?: 1;\n /** Human interaction deadline, bounded separately from ordinary RPCs. */\n interactionTimeoutMs?: number;\n}\n\n/**\n * Codex-specific tuning options passed through `HarnessOptions.codex`.\n *\n * @remarks These are forwarded verbatim to the Codex harness and have no effect on other harnesses.\n * @docLink packages/bridge/concepts#codex-harness-options\n */\nexport interface CodexHarnessOptions {\n /** Omission retains the standalone SDK path; managed mode always requires App Server inputs. */\n authSource?: \"local\" | \"managed\";\n managedRuntime?: CodexManagedRuntimeOptions;\n /** Controls whether Codex may auto-apply edits without user approval. */\n approvalPolicy?: \"never\" | \"on-request\" | \"on-failure\" | \"untrusted\";\n /** Filesystem sandbox level for the Codex process. */\n sandboxMode?: \"read-only\" | \"workspace-write\" | \"danger-full-access\";\n /** Reasoning budget passed to the model. */\n reasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n /** When `true`, the Codex sandbox is allowed to make outbound network requests. */\n networkAccessEnabled?: boolean;\n /** Extra directories made accessible to the Codex sandbox in addition to `cwd`. */\n additionalDirectories?: string[];\n}\n\n/**\n * omp-specific options passed through `HarnessOptions.omp`.\n *\n * They govern the session-private agent directory the omp adapter renders the\n * provider registry into (`omp-models-yml.ts`); every one of them has a\n * working default, so a caller that sets none still gets a correct session.\n *\n * @remarks Forwarded verbatim to the omp harness; no effect on other harnesses.\n * @see PROVIDER-CONFIG-PLAN.md §2.3\n */\nexport interface OmpHarnessOptions {\n /**\n * Explicit session-private agent directory for `PI_CODING_AGENT_DIR`.\n * Defaults to `<cwd>/.omp/agent-home/<sessionId>`.\n */\n agentHome?: string;\n /**\n * Inherit the developer's own omp state (auth store, blobs, extensions) by\n * symlinking {@link OmpHarnessOptions.userAgentDir} into the session\n * directory. Defaults to *on when that directory exists*, which is exactly\n * the standalone case: a platform container has none, so its session starts\n * empty. Set `false` to force an empty session directory regardless.\n */\n seedUserAgentDir?: boolean;\n /** Seed source. Defaults to `~/.omp/agent`. */\n userAgentDir?: string;\n}\n\n/**\n * Harness-specific configuration bag.\n *\n * Fields are keyed by harness ID so that callers can pass harness-specific options\n * through the common {@link AgentConfig} without breaking other harnesses.\n *\n * @docLink packages/bridge/concepts#harness-options\n */\nexport interface HarnessOptions {\n /** Codex-specific options. Ignored by all other harnesses. */\n codex?: CodexHarnessOptions;\n /** omp-specific options. Ignored by all other harnesses. */\n omp?: OmpHarnessOptions;\n}\n\n/**\n * What the harness tells the host about a turn blocked by an upstream usage\n * limit. Everything but `configId` is best-effort: the SDK reports the limit\n * window only on its structured telemetry, not on the error result text.\n *\n * @see AgentConfig.onLimitBlocked\n * @category Configuration\n * @since 3.9.0\n */\nexport interface LimitBlockedContext {\n /** The AI provider config the blocked turn ran on (`\"\"` when unmediated). */\n configId: string;\n /** Upstream limit window (`five_hour`, `seven_day`, …) when reported. */\n limitType?: string;\n /** Epoch seconds at which the limit window resets, when reported. */\n resetsAt?: number;\n /** Fraction of the limit window consumed (0–1) when reported. */\n utilization?: number;\n}\n\n/**\n * The host's verdict on a limit-blocked turn. `switched: true` is a promise\n * that a different seat's credential is already on disk — the harness acts on it\n * by respawning the CLI and replaying the prompt, so returning it without\n * having rewritten the credential file would just replay onto the dead seat.\n *\n * @see AgentConfig.onLimitBlocked\n * @category Configuration\n * @since 3.9.0\n */\nexport interface LimitFailoverResult {\n /** Whether the session was repointed at a different AI provider config. */\n switched: boolean;\n /** The config id now in effect. Informational — used for logs. */\n configId?: string;\n /**\n * Why no switch happened: `same-config`, `standalone`,\n * `platform-omitted-config-id` (the mint succeeded but named no seat, so a\n * re-resolution is indistinguishable from none), or a `CredentialMint`\n * failure code. Diagnostic only — the harness branches on `switched`.\n */\n reason?: string;\n}\n\n/**\n * One observed AI-provider rejection, reported to the host for per-seat health\n * attribution. Fire-and-forget — see {@link AgentConfig.onProviderResponse}.\n *\n * @category Configuration\n * @since 3.9.0\n */\nexport interface ProviderResponseObservation {\n /** 401 — the credential was rejected. 429 — an upstream rate/session limit. */\n status: 401 | 429;\n /** The AI provider config the observation is attributed to, when known. */\n configId?: string;\n /** Upstream limit window (`five_hour`, `seven_day`, …) when reported. */\n limitType?: string;\n /** Fraction of the limit window consumed (0–1) when reported. */\n utilization?: number;\n /** Epoch seconds at which the limit window resets, when reported. */\n resetsAt?: number;\n /**\n * What the 429 was, when the harness recognised something narrower than a\n * usage limit. `long-context-entitlement`: the account may not use a long\n * (1M) context window; the seat is not out of quota. Diagnostic only — the\n * harness still treats the rejection as before.\n */\n cause?: ProviderResponseCause;\n}\n\n/**\n * Why a 429 {@link ProviderResponseObservation} was rejected, when the harness\n * recognised it. Consumers must tolerate values they do not know.\n *\n * @category Configuration\n * @since 4.11.0\n */\nexport type ProviderResponseCause = \"long-context-entitlement\";\n\n/**\n * One upstream quota-window reading, reported to the host for every SDK\n * `rate_limit_event` — allowed, warning or rejected alike. Fire-and-forget —\n * see {@link AgentConfig.onProviderQuota}.\n *\n * @category Configuration\n * @since 4.1.0\n */\nexport interface ProviderQuotaObservation {\n /** The AI provider config the reading is attributed to, when known. */\n configId?: string;\n /** Upstream window, verbatim (`five_hour`, `seven_day`, or a future value). */\n window: string;\n /** Upstream status, verbatim (`allowed`, `allowed_warning`, `rejected`, …). */\n status: string;\n /** Fraction of the window consumed (0–1); the SDK reports it on warnings and rejections only. */\n utilization?: number;\n /** Epoch seconds at which the window resets, when reported. */\n resetsAt?: number;\n}\n\n/**\n * Reasoning effort levels a host may set. The platform sends all five, the\n * Agent SDK accepts all five, omp has a same-named thinking level for each, and\n * managed codex passes the value to its app server.\n *\n * @since 4.22.0\n */\nexport const AGENT_EFFORT_LEVELS = [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const;\nexport type AgentEffort = (typeof AGENT_EFFORT_LEVELS)[number];\n\n/**\n * Narrow a free-form effort (the wire `agentConfig.effort`, a `skaile.yaml`\n * default) to an {@link AgentEffort}; anything else gives `undefined`, so an\n * unknown value never reaches a harness.\n */\nexport function toAgentEffort(value: unknown): AgentEffort | undefined {\n return isAgentEffort(value) ? value : undefined;\n}\n\nfunction isAgentEffort(value: unknown): value is AgentEffort {\n return (AGENT_EFFORT_LEVELS as readonly unknown[]).includes(value);\n}\n\n/**\n * Configuration passed to a harness when it is created via {@link createHarness}.\n *\n * All fields are shared across harnesses; harness-specific behaviour is documented\n * per field. Fields that are silently ignored by a harness are marked accordingly.\n *\n * @docLink packages/bridge/concepts#agent-config\n */\nexport interface AgentConfig {\n /** Absolute path to the working directory the agent operates in. */\n cwd: string;\n /**\n * LLM model identifier (e.g. `\"claude-sonnet-4-5\"`, `\"gpt-4o\"`).\n *\n * The unscoped fallback: {@link AgentConfig.modelRef} is what a session\n * normally carries, and this is what a harness falls back to when no\n * registry entry resolved one.\n */\n model?: string;\n /**\n * The AI provider registry for this session — every endpoint the harness may\n * address, already merged across the catalog / user / workspace / runtime /\n * control-plane layers and in registry order.\n *\n * This is the *only* provider surface a harness reads. Entries reference\n * their credential (`credential.ref`) and never carry the secret itself;\n * the value reaches the child under `SKAILE_AIP_<ID>_KEY`\n * (`provider-materialize/credential-env.ts`), which the session boundary\n * puts in {@link AgentConfig.env}.\n *\n * Absent (or empty) means no endpoint was configured at all — the harness\n * then falls back to whatever native auth it can discover on its own (a\n * `claude` OAuth login, `codex login`, an ambient vendor key).\n */\n registry?: MergedAIProviderRegistry;\n /**\n * Model selector resolved against {@link AgentConfig.registry}:\n * `\"<providerId>/<modelId>\"`, a bare `\"<modelId>\"` (first registry entry\n * that maps it wins), or `\"@role\"`. Absent when no model was configured at\n * all — the harness then applies its own default, exactly as it does for an\n * absent `model`.\n */\n modelRef?: string;\n /**\n * The `skaile.yaml` `roles` table — role name → model selector\n * (`{default: \"anthropic/opus\", smol: \"groq/llama-3.1-8b\"}`, §9.8). It is\n * what `\"@role\"` in {@link AgentConfig.modelRef} expands through, and what\n * a harness that supports per-role models materializes natively: omp renders\n * it as `modelRoles` in its session-private `config.yml`, so `@smol` inside\n * the session reaches a different provider than `@default`.\n *\n * Resolution is lenient: a role naming an entry this registry does not have\n * is a warning, never a failure.\n */\n roles?: Record<string, string>;\n /**\n * Additional environment variables merged into the child process\n * environment. The session boundary delivers resolved registry credentials\n * here as `SKAILE_AIP_<ID>_KEY` entries; anything else the caller sets is\n * merged over the harness's own allowlist, never instead of it.\n */\n env?: Record<string, string>;\n /** Inline system prompt — written to .omp/system.md and passed via --append-system-prompt (omp harness) */\n systemPrompt?: string;\n /** Path to project .omp/ directory (PI_CODING_AGENT_DIR for omp harness) */\n agentDir?: string;\n /** SSH key path — injected as GIT_SSH_COMMAND */\n sshKeyPath?: string;\n /** Pre-assign a UUID as the session ID for a new session (claude-sdk: passed as sessionId option) */\n sessionId?: string;\n /** Resume this specific past session by UUID instead of starting fresh (claude-sdk: passed as resume option) */\n resumeSessionId?: string;\n /** Maximum agentic turns per query (claude-sdk: passed as maxTurns option) */\n maxTurns?: number;\n /**\n * Whether the agent may act on its own (`auto`, the default) or has to be approved per tool\n * call (`interactive`); the `agents.<id>.permissions.permission_mode` of the instance.\n *\n * - claude-sdk: `auto` runs under the SDK's `bypassPermissions`; `interactive` runs under\n * `default`, and a call the SDK does not auto-allow (a shell command, a file edit, an MCP\n * tool) pauses the turn on a `question` event with an `approval` card (`Approve once` /\n * `Deny`) answered through `answerQuestion`. With {@link AgentConfig.unattended} the call is\n * refused instead.\n * - codex (standalone SDK path): `interactive` sets `approvalPolicy: \"on-request\"` instead of\n * `never`, unless `harnessOptions.codex.approvalPolicy` is set. The standalone SDK path has no\n * way to show an approval card, so codex refuses a command that needs to leave its sandbox\n * instead of asking; nothing is ever approved. A managed codex session keeps the host's own\n * policy.\n * - omp, echo and the subprocess CLI harnesses (gemini, qwen, opencode, goose, continue): ignored.\n */\n permissionMode?: \"auto\" | \"interactive\";\n /**\n * The session has no one to answer a question (a nested `agent.run` role session, a\n * single-shot `skaile run` without a terminal). With `permissionMode: \"interactive\"` a tool\n * call that needs approval is then refused (claude-sdk) instead of waiting for a reply.\n */\n unattended?: boolean;\n /** Agent name — selects a deployed sub-agent definition as the main agent identity.\n * claude-sdk: passed as `agent` option to query() → reads .claude/agents/<name>.md natively.\n * omp: ignored (omp uses agentDir/PI_CODING_AGENT_DIR instead). */\n agentName?: string;\n /** In-process SDK MCP servers for custom tool injection (Claude SDK only, ignored by other harnesses) */\n mcpServers?: Record<string, unknown>;\n /** Tool restrictions from agent.yaml — applied to the main agent session */\n tools?: {\n /** Tool names that the agent is allowed to invoke. An empty array means no restriction. */\n allowed?: string[];\n /** Tool names that the agent is explicitly forbidden from invoking. */\n denied?: string[];\n };\n /** Thinking mode for Claude models: adaptive (Claude decides), enabled (always think), disabled (no thinking). */\n thinking?: \"adaptive\" | \"enabled\" | \"disabled\";\n /** Reasoning effort level; each harness maps it to its own scale (see {@link AgentEffort}). */\n effort?: AgentEffort;\n /** Harness-specific configuration bag. */\n harnessOptions?: HarnessOptions;\n /**\n * Protocol v2 capability dispatch hooks. When present, the harness uses the\n * registry as the source of LLM tool definitions and routes invocations\n * through `capabilities.invoke()`. Absent → legacy v1 path (existing\n * mcpServers / native dispatch).\n *\n * @since 2.0.0\n */\n capabilities?: BridgeCapabilityHooks;\n /**\n * The platform's `AIProviderConfig.id` for the AI credential currently\n * provisioned into this harness. The runner reads this off `AgentConfig`\n * during 401 mediation and passes it as `configId` in\n * `request_access_token { kind: 'ai-credentials' }`. The harness itself\n * does not consume this field — only the runner uses it.\n *\n * Set by the platform agent-gateway in `ConfigureCommandV2` for mediated\n * sessions. Standalone runners (CLI / forge / Claude plugin) leave it\n * undefined; the runner falls back to surfacing the auth error to the\n * user without mediating.\n *\n * Spec: `_devlog/specs/2026-05-07-unified-credential-mediation.md`\n * § \"Wire `aiProviderConfigId` end-to-end\".\n *\n * @since 3.3.0\n */\n aiProviderConfigId?: string;\n /**\n * Optional callback invoked by the harness when the underlying agent\n * surfaces an `authentication_error`. In Protocol v3 the runner mediates\n * the refresh via the `host.refresh_credential` capability and returns a\n * typed {@link CredentialMint}. The harness inspects the discriminator:\n *\n * - `mint.ok === true`: a fresh credential is now provisioned. The\n * harness re-attempts the in-flight prompt once.\n * - `mint.ok === false`: refresh failed (`code` carries a stable reason\n * such as `revoked`, `not-configured`, `provider-error`,\n * `backend-error`). The harness surfaces the original `AuthError` to\n * the caller.\n *\n * `args.configId` carries the platform `AIProviderConfig.id` the harness\n * was provisioned with (mirrors {@link AgentConfig.aiProviderConfigId}).\n * The runner uses it to scope the refresh to the correct AI credential.\n *\n * When omitted, the harness throws `AuthError` immediately as before\n * (standalone CLI / forge mode — there is no platform mediator to ask).\n *\n * Centralising auth-retry inside the harness means every consumer of\n * `harness.prompt(...)` (serve handler, compaction orchestrator, flow\n * orchestrator, …) gets self-healing for free — there is no per-call-site\n * wrapping.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"host.refresh_credential capability\".\n *\n * @since 3.4.0\n */\n onAuthError?: (args: { configId: string }) => Promise<CredentialMint>;\n /**\n * Optional callback invoked by the harness when a turn is blocked by an\n * upstream **usage limit** rather than a bad credential — the subscription\n * five-hour / seven-day ceiling, or any `rate_limit` the classifier\n * recognises. Called at most once per logical turn, and only after the\n * blocked attempt has already failed, so it never runs mid-turn.\n *\n * The runner implements it by asking the platform to re-resolve the seat:\n *\n * - `switched: true` — the session was repointed at a DIFFERENT AI\n * provider config and `.credentials.json` was rewritten. The harness\n * drops its query (forcing a fresh CLI spawn, which is what clears a\n * resident CLI's cached \"blocked until <reset>\" state — a hot file\n * rewrite alone does not) and replays the prompt once.\n * - `switched: false` — no alternative seat was available. The harness\n * surfaces the original limit error unchanged.\n *\n * Left unset by standalone runners (CLI / forge / Claude plugin): there is\n * no platform mediator to re-resolve a seat, so the limit error surfaces\n * exactly as it does today.\n *\n * Companion to {@link onAuthError}: that one covers 401s, this one covers\n * the rejection path, which previously reached no failover at all\n * (skaile-ai/workspaces#567, skaile-ai/platform#2976).\n *\n * @since 3.9.0\n */\n onLimitBlocked?: (ctx: LimitBlockedContext) => Promise<LimitFailoverResult>;\n /**\n * Optional fire-and-forget hook invoked when the harness observes a 401 or a\n * 429 / subscription-limit rejection from the AI provider. The runner\n * forwards it to the platform as a `provider_response_seen` event so the\n * owning `AIProviderConfig`'s live health counters can be bumped — the cron\n * health probe only samples auth, never capacity\n * (skaile-ai/workspaces#368, skaile-ai/platform#3539).\n *\n * Never awaited and never retried; the harness swallows a throwing\n * implementation so telemetry can never fail a turn.\n *\n * @since 3.9.0\n */\n onProviderResponse?: (observation: ProviderResponseObservation) => void;\n /**\n * Optional fire-and-forget hook invoked for every upstream quota-window\n * reading (claude-sdk `rate_limit_event`), not only rejections. The runner\n * forwards it as `provider_quota_observed`, which is the only quota signal\n * the platform has for a seat whose token cannot read the OAuth usage\n * endpoint (a `claude setup-token` seat).\n *\n * Never awaited and never retried; the harness swallows a throwing\n * implementation so telemetry can never fail a turn. Unlike\n * {@link onProviderResponse} it fires on every event, so dedupe at the host.\n *\n * @since 4.1.0\n */\n onProviderQuota?: (observation: ProviderQuotaObservation) => void;\n /**\n * Test-only flow harness hook. When present, the echo harness's scripted-flow\n * mode uses it to advance flow nodes deterministically (no LLM). The runner\n * injects it in `createActiveFlow`; every other harness ignores it.\n *\n * @see FlowTestHarnessHook\n * @since 3.6.0\n */\n flowTestHarness?: FlowTestHarnessHook;\n}\n\n/**\n * A single message in an agent conversation.\n *\n * Emitted as part of {@link AgentEvent} variants (`message_start`, `message_update`, `message_end`).\n *\n * @docLink packages/bridge/concepts#agent-message\n */\nexport interface AgentMessage {\n /** Originator of the message. */\n role: \"user\" | \"assistant\" | \"tool\";\n /** Message body — either a plain string or a list of typed content blocks. */\n content: string | ContentBlock[];\n /** Tool invocations made by the assistant in this message. */\n toolCalls?: ToolCall[];\n /** For `role === \"tool\"`: the name of the tool whose result this message carries. */\n toolName?: string;\n /** For `role === \"tool\"`: `true` when the tool returned an error. */\n isError?: boolean;\n /** Optional structured payload for tool results. */\n data?: unknown;\n /**\n * Set when a subagent produced this message: the id of the tool use that\n * runs the subagent. Absent on main-thread messages.\n */\n parentToolUseId?: string;\n}\n\n/**\n * A typed block within an {@link AgentMessage}'s content array.\n *\n * Mirrors the Anthropic content block schema but is harness-agnostic.\n *\n * @docLink packages/bridge/concepts#content-block\n */\nexport interface ContentBlock {\n /** Block discriminant. */\n type: \"text\" | \"tool_use\" | \"tool_result\" | \"thinking\";\n /** Present for `text` and `thinking` blocks. */\n text?: string;\n /** Tool use / tool result correlation ID. */\n id?: string;\n /** Tool name (present on `tool_use` blocks). */\n name?: string;\n /** Tool input arguments (present on `tool_use` blocks). */\n input?: any;\n /** Serialised tool result content (present on `tool_result` blocks). */\n content?: string;\n}\n\n/**\n * A single tool invocation made by the agent within a message.\n *\n * @docLink packages/bridge/concepts#tool-call\n */\nexport interface ToolCall {\n /** Correlation ID used to match the call with its result. */\n id: string;\n /** Name of the tool being invoked. */\n name: string;\n /** Arguments passed to the tool. */\n input: any;\n}\n\n/**\n * Error classification for agent failures.\n *\n * Used to determine whether a failure is retryable and to surface actionable\n * hints to the user. See `bridge/CLAUDE.md` for the full category-to-behaviour matrix.\n *\n * @see AgentError\n * @docLink packages/bridge/concepts#error-category\n */\nexport type ErrorCategory =\n | \"auth\"\n | \"account\"\n | \"rate_limit\"\n | \"model\"\n | \"network\"\n | \"config\"\n | \"process\"\n | \"validation\"\n | \"unknown\";\n\n/**\n * Structured error payload emitted inside the `error` {@link AgentEvent}.\n *\n * Consumers should inspect `retryable` before deciding to surface a retry button,\n * and `hint` to provide an actionable message to the user.\n *\n * @docLink packages/bridge/concepts#agent-error\n */\nexport interface AgentError {\n /** Human-readable error description. */\n message: string;\n /** Coarse failure classification used for retry logic and telemetry. */\n category: ErrorCategory;\n /** HTTP status code if the error originated from an API response. */\n statusCode?: number;\n /** `true` when the caller may safely retry the same operation. */\n retryable: boolean;\n /** Short actionable advice suitable for display in the UI. */\n hint?: string;\n}\n\n/**\n * Metadata for a slash command exposed by the active agent runtime.\n *\n * @docLink packages/bridge/concepts#slash-command-info\n */\nexport interface SlashCommandInfo {\n /** Command name without the leading slash (e.g. `\"compact\"`). */\n name: string;\n /** One-line description shown in command pickers. */\n description: string;\n /** Placeholder text describing what argument the command expects. */\n argumentHint?: string;\n}\n\n/**\n * Discriminated union of all events emitted by a harness on the `'agent-event'` channel.\n *\n * @remarks\n * Consumers listen via `harness.on('agent-event', (event: AgentEvent) => ...)`.\n * The `[k: string]: any` index signature on most variants allows harnesses to attach\n * harness-specific fields (e.g. `_textDelta`) without breaking the union.\n *\n * @docLink packages/bridge/concepts#agent-event\n */\nexport type AgentEvent =\n | { type: \"message_start\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_update\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_end\"; message: AgentMessage; [k: string]: any }\n /**\n * Takes back `text`, the unfinished tail of streamed `_textDelta`s, before the\n * harness replays an abandoned attempt. Always a suffix of what was streamed\n * since the last completed assistant message; see `TextRetractEvent` in the types package.\n */\n | { type: \"message_retract\"; text: string; [k: string]: any }\n | { type: \"turn_end\"; toolResults?: AgentMessage[]; [k: string]: any }\n | { type: \"agent_end\"; [k: string]: any }\n /** A background task started in the running turn; see `BackgroundTaskStartedEvent`. */\n | { type: \"background_task_started\"; taskId: string; [k: string]: any }\n /** A turn the harness was not prompted for began; see `SelfTurnStartedEvent`. */\n | { type: \"self_turn_started\"; taskIds: string[]; [k: string]: any }\n | {\n type: \"result\";\n subtype: string;\n summary?: string;\n costUsd?: number;\n /** Per-turn token usage when the harness tracks it. Added in 3.1.0. */\n tokens?: TokenUsage;\n /** Per-turn usage keyed by model, subagent calls included. Added in 3.11.0. */\n modelUsage?: Record<string, ModelTokenUsage>;\n /** Prompt size of the turn's last main-thread API call. Added in 3.11.0. */\n contextTokens?: number;\n /** Context window of the main model, in tokens. Added in 3.11.0. */\n contextWindow?: number;\n errors?: string[];\n [k: string]: any;\n }\n | {\n type: \"error\";\n error: string;\n detail?: AgentError;\n fatal?: boolean;\n /** Set (with `fatal: false`) when the harness replays the prompt in place; see `ErrorEvent.retrying`. */\n retrying?: boolean;\n retryReason?: ErrorRetryReason;\n /** Usage of a failed provider turn, when reported. */\n tokens?: TokenUsage;\n /** Failed-turn usage keyed by the actual model. */\n modelUsage?: Record<string, ModelTokenUsage>;\n contextTokens?: number;\n contextWindow?: number;\n [k: string]: any;\n }\n | {\n type: \"tool_call\";\n name?: string;\n tool?: { name: string };\n /** Set when a subagent made the call. */\n parentToolUseId?: string;\n [k: string]: any;\n }\n | { type: \"tool_execution_end\"; toolName?: string; parentToolUseId?: string; [k: string]: any }\n | { type: \"commands_available\"; commands: SlashCommandInfo[] }\n | { type: \"session_info\"; harnessSessionId: string; sessionFile?: string }\n | { type: \"ui_render\"; [k: string]: any }\n | { type: \"ui_render_update\"; [k: string]: any }\n | { type: \"ui_clear\"; [k: string]: any }\n // Phase 3 (resume cascade) — harness-emitted resume outcome.\n | {\n type: \"resume_failed\";\n resumeSessionId: string;\n reason:\n | \"signature_mismatch\"\n | \"model_mismatch\"\n | \"jsonl_lost\"\n | \"jsonl_poisoned\"\n | \"native_state_unavailable\";\n [k: string]: any;\n };\n\n/** The settings a live reconfigure may change. */\nexport type ReconfigurePatch = Partial<Pick<AgentConfig, \"model\" | \"thinking\" | \"effort\">>;\n\n/**\n * What a harness now holds for the fields of an accepted reconfigure. `modelRef`\n * is the registry selector the model was scoped to; it is absent when the\n * session has none. A host remembers exactly this, never the raw patch.\n */\nexport interface ReconfigureApplied {\n model?: string;\n modelRef?: string;\n thinking?: AgentConfig[\"thinking\"];\n effort?: AgentConfig[\"effort\"];\n}\n\n/**\n * Result of `AgentHarness.reconfigure()`. `ok: true` means effective from the\n * next turn (live switch, query recycle or respawn); a harness that cannot\n * promise that answers `ok: false` instead.\n *\n * - `not_supported`: the harness cannot change settings live.\n * - `model_not_on_provider`: the session's AI provider entry does not list the\n * model (`providerId` names the entry).\n * - `rejected`: the running process refused the change; the harness config is\n * unchanged.\n *\n * @category Bridge\n */\nexport type ReconfigureOutcome =\n | { ok: true; applied: ReconfigureApplied }\n | {\n ok: false;\n code: \"not_supported\" | \"model_not_on_provider\" | \"rejected\";\n message: string;\n providerId?: string;\n };\n\n/**\n * A reconfigure the harness answered `ok` (it landed mid-turn) and then refused\n * at the next turn boundary. The harness already rolled its config back;\n * `requested` is what was asked, `restored` what it holds again. Emitted as the\n * harness event `'reconfigure-rollback'`.\n */\nexport interface ReconfigureRollback {\n message: string;\n requested: ReconfigureApplied;\n restored: ReconfigureApplied;\n}\n\n/** Rejection message of a harness asked to run a turn under a tool allowlist it cannot enforce. */\nexport const TOOL_ALLOWLIST_UNSUPPORTED = \"This agent harness cannot enforce a tool allowlist\";\n\n/**\n * Abstract base class for agent harnesses.\n *\n * Wraps an LLM coding agent behind a single `prompt()` interface.\n * All harnesses emit `'agent-event'` with {@link AgentEvent} payloads.\n *\n * @remarks\n * Subclasses must implement `start`, `prompt`, `abort`, `kill`, and `isRunning`.\n * Implementations should never emit an event name other than `'agent-event'` as\n * the public streaming channel — internal events (`'ready'`, `'exit'`, etc.) are\n * harness-private. The one other public event is `'reconfigure-rollback'` (a\n * {@link ReconfigureRollback}): a live reconfigure the harness had accepted and\n * then refused at the turn boundary, already rolled back in the harness.\n *\n * @example\n * ```ts\n * const harness = createHarness('omp', config);\n * harness.on('agent-event', (event) => console.log(event.type));\n * await harness.start();\n * await harness.prompt('Refactor the auth module');\n * harness.kill();\n * ```\n *\n * @docLink packages/bridge/concepts#agent-harness\n */\nexport abstract class AgentHarness extends EventEmitter {\n /** Static metadata describing this harness's capabilities. */\n abstract readonly harnessInfo: HarnessInfo;\n\n /**\n * Initialises the harness — spawns the child process (omp) or loads\n * the SDK module (claude-sdk). Resolves when the harness is ready to accept\n * prompts. Idempotent: calling `start()` on an already-running harness is a no-op.\n *\n * @throws {Error} When the harness binary is missing or the SDK cannot be loaded.\n */\n abstract start(): Promise<void>;\n\n /**\n * Sends a user message to the agent and resolves when the agent's turn completes\n * (i.e. after the `agent_end` event has been emitted).\n *\n * @param message - Plain-text user prompt to send to the agent.\n * @throws {Error} When the harness is not running or the underlying coding agent reports a fatal error.\n */\n abstract prompt(message: string): Promise<void>;\n\n /**\n * Preserve text-only callers; harnesses must explicitly support attachments.\n * A `toolAllowlist` is refused here: only a harness that overrides\n * {@link enforcesToolAllowlist} may run a restricted turn.\n */\n promptInput(input: AgentPromptInput): Promise<void> {\n if (input.toolAllowlist !== undefined)\n return Promise.reject(new Error(TOOL_ALLOWLIST_UNSUPPORTED));\n if (input.attachments?.length) return Promise.reject(new Error(\"Structured input unsupported\"));\n return this.prompt(input.text);\n }\n\n /**\n * Whether {@link promptInput} enforces `AgentPromptInput.toolAllowlist` for\n * the whole turn, subagents included. A harness that answers `false` must\n * reject an input carrying one; the runner refuses such a prompt before it\n * reaches the harness.\n */\n get enforcesToolAllowlist(): boolean {\n return false;\n }\n\n /**\n * The names in `allowlist` this harness does not recognize as a tool it could\n * offer. The runner refuses a prompt whose allowlist names any, rather than\n * guess. A harness that does not enforce allowlists recognizes none.\n */\n unknownAllowlistedTools(allowlist: readonly string[]): string[] {\n return [...allowlist];\n }\n\n /** Managed replies never fall back to a new prompt after a request has settled. */\n get acceptsReplyAsPrompt(): boolean {\n return true;\n }\n\n /**\n * Sends an in-band abort signal to the agent, requesting it to stop the current\n * turn without terminating the process. The harness remains usable after `abort()`.\n *\n * @remarks Only meaningful when `harnessInfo.supportsInBandAbort` is `true`.\n * For other harnesses, prefer `kill()` followed by creating a new harness instance.\n */\n abstract abort(): Promise<void>;\n\n /**\n * Terminates the agent harness immediately (SIGTERM for subprocess harnesses,\n * `close()` for in-process harnesses). The harness instance must not be reused\n * after `kill()`.\n */\n abstract kill(): void;\n\n /** Stop the harness and await owned process/state cleanup when the harness supports it. */\n async dispose(): Promise<void> {\n this.kill();\n }\n\n /** `true` when the harness is alive and able to accept new prompts. */\n abstract get isRunning(): boolean;\n\n /** Optional provider-native session/thread identifier for resume support. */\n get runtimeSessionId(): string | undefined {\n return undefined;\n }\n\n /** Slash commands discovered from the agent runtime. Override in harnesses that support introspection. */\n getSlashCommands(): SlashCommandInfo[] {\n return [];\n }\n\n // ── Interactive questions (AskUserQuestion) ──────────────────────────────\n\n /**\n * `true` while the harness is paused on an interactive question and waiting\n * for the user's answer rather than a new prompt. The runner routes a\n * `reply` command to {@link answerQuestion} instead of {@link prompt} when\n * this returns `true`. Harnesses without interactive-question support return\n * `false` (the default), so a `reply` falls back to `prompt`.\n */\n hasPendingQuestion(): boolean {\n return false;\n }\n\n /**\n * Deliver the user's answer to the question the harness is currently paused\n * on. This resumes the in-flight turn — it does NOT start a new one. When a\n * single tool call asks several questions, the harness resolves the underlying\n * call only once every sub-question has an answer.\n *\n * @param answer - The user's reply text (an option label, free text, or for\n * multi-select a comma-joined list).\n * @param question - The sub-question this answers, verbatim from the\n * `question` event that asked it. Supply it whenever the host lets the user\n * answer out of order — without it the answer fills the next unanswered\n * slot in order, which silently mismatches a non-sequential reply.\n * @returns `true` when the answer was consumed by a pending question; `false`\n * when no question was pending (caller should treat the reply as a prompt).\n */\n answerQuestion(answer: string, question?: string, requestId?: string): boolean {\n void requestId;\n void answer;\n void question;\n return false;\n }\n\n /**\n * Apply this harness's rule for a new prompt that meets a pending question,\n * ahead of the prompt itself. The runner queues a prompt behind the turn in\n * flight, so a turn paused on a question would otherwise hold that prompt\n * until the user answered. Harnesses whose `prompt()` cancels the question\n * (claude-sdk, omp) do the same here; the default keeps the question.\n */\n supersedePendingQuestion(): void {\n // No-op: a harness without this rule keeps the question pending.\n }\n\n // ── Live reconfiguration ────────────────────────────────────────────────\n\n /**\n * Live-update harness configuration. `ok: true` means effective from the next\n * turn: the next turn runs on the new settings, by live switch, query recycle\n * or respawn, and the host needs no restart. A turn in progress finishes on\n * the old settings. Only model/thinking/effort are reconfigurable mid-session.\n *\n * Harnesses that can honour that promise build a `ReconfigureLedger` and\n * delegate to it; it owns the model scope rule, ordering, drift and rollback.\n * The base implementation answers `not_supported`.\n */\n reconfigure(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n const fields = Object.keys(patch).join(\", \");\n return Promise.resolve({\n ok: false,\n code: \"not_supported\",\n message: `The ${this.harnessInfo.id} harness cannot change ${fields} live; the change applies when the session next starts.`,\n });\n }\n\n /**\n * Returns the model identifier currently configured on this harness.\n * Subclasses that store config locally should override this.\n */\n getModel(): string | undefined {\n return undefined;\n }\n\n // ── Compaction support ──────────────────────────────────────────────────\n\n /**\n * `Date.now()` of the harness's most recent sign of life, counting messages\n * that emit no `agent-event` (thinking deltas, rate-limit telemetry, API\n * retries). A stall check reads it alongside the events it sees. `null` when\n * the harness does not track it.\n */\n lastActivityAt(): number | null {\n return null;\n }\n\n /**\n * Returns the token usage from the most recent completed turn.\n * Returns `null` if usage data is unavailable (e.g. harness doesn't track it).\n *\n * Widened in 3.1.0 to return the full `TokenUsage` shape (input / output /\n * cache-read / cache-creation / reasoning). All fields are optional so\n * harnesses can populate just what their provider reports. Existing callers\n * that read only `inputTokens` / `outputTokens` keep working — those fields\n * are still present and carry the same semantics as before.\n */\n getTokenUsage(): TokenUsage | null {\n return null;\n }\n\n /**\n * Prompt tokens occupying the context window as of the most recent API\n * request — i.e. how full the context actually is right now.\n *\n * Deliberately NOT the same number as {@link getTokenUsage}, whose usage is\n * cumulative over every API call in the turn and therefore overstates the\n * context by 10-40x on any multi-tool turn. Callers measuring context fill\n * (compaction thresholds) must prefer this; callers billing a turn\n * (usage ledgers, the `finished` event) must keep using `getTokenUsage()`.\n *\n * Returns `null` both when the harness cannot report a per-call figure at all\n * and when it can but has no reading yet. Falling back to `getTokenUsage()`\n * is safe in either case only because a harness clears the two in lockstep: no\n * reading means no API call landed, so there is no cumulative usage to\n * overstate. A harness implementing this must preserve that invariant.\n */\n getContextTokens(): number | null {\n return null;\n }\n\n /**\n * Returns the model's context window size in tokens.\n * Returns `null` if unknown.\n */\n getContextWindow(): number | null {\n return null;\n }\n\n /**\n * What the harness can measure natively about its context window, in the\n * neutral {@link HarnessContextReport} shape, or `null` when it measures\n * nothing beyond {@link getContextTokens} / {@link getContextWindow}.\n *\n * `detail: \"full\"` (the default) may be expensive — claude-sdk issues\n * `count_tokens` requests — so the runner asks for it only when a host\n * requests a measured breakdown; `\"summary\"` must make no provider call and\n * is what the per-turn snapshot uses. Implementations must not throw for\n * \"unsupported\"; a rejection means the measurement itself failed and the\n * runner falls back to estimates.\n */\n async getContextUsageReport(_opts?: {\n detail?: ContextUsageDetail;\n }): Promise<HarnessContextReport | null> {\n return null;\n }\n\n /**\n * Returns the list of models available to this harness without starting a session.\n * Harnesses that can enumerate their own models override this method.\n * Returns an empty array by default.\n */\n async listModels(): Promise<ModelEntry[]> {\n return [];\n }\n\n /**\n * Closes the current conversation session and prepares for a fresh start.\n * The next `prompt()` call will begin a new session without prior history.\n * The harness remains usable after `resetSession()`.\n */\n abstract resetSession(): Promise<void>;\n\n // ── Telemetry ─────────────────────────────────────────────────────────────\n\n protected _telemetry?: TelemetryProvider;\n protected _activeTrace?: Trace;\n protected _activeTurnSpan?: Span;\n private _turnStartTime?: number;\n\n /**\n * Attach a telemetry provider and active trace to this harness.\n * Called by the runner after creating the harness but before start().\n */\n setTelemetry(provider: TelemetryProvider, trace: Trace): void {\n this._telemetry = provider;\n this._activeTrace = trace;\n }\n\n /**\n * Begin a turn span. Called by the runner before prompt().\n * Pass a parent span (e.g. the turn span from the orchestrator) for nesting.\n * Returns the span so the runner can annotate it further.\n */\n beginTurnSpan(\n parent?: Trace | Span,\n attrs?: Record<string, string | number | boolean>,\n ): Span | undefined {\n if (!this._telemetry || !this._activeTrace) return undefined;\n this._turnStartTime = Date.now();\n this._activeTurnSpan = this._telemetry.startSpan(parent ?? this._activeTrace, {\n name: \"llm_generation\",\n kind: \"llm_generation\",\n attributes: attrs,\n });\n return this._activeTurnSpan;\n }\n\n /**\n * End the current turn span with generation data.\n * Called by the runner after agent_end. Model and provider are passed\n * explicitly — the harness base class does not access config directly.\n */\n endTurnSpan(result?: {\n model?: string;\n provider?: string;\n inputTokens?: number;\n outputTokens?: number;\n stopReason?: string;\n error?: string;\n }): void {\n if (!this._telemetry || !this._activeTurnSpan) return;\n const durationMs = this._turnStartTime ? Date.now() - this._turnStartTime : 0;\n\n if (result?.inputTokens !== undefined || result?.outputTokens !== undefined) {\n this._telemetry.logGeneration(this._activeTurnSpan, {\n model: result?.model ?? \"unknown\",\n provider: result?.provider ?? \"unknown\",\n inputTokens: result.inputTokens,\n outputTokens: result.outputTokens,\n durationMs,\n stopReason: result.stopReason,\n });\n }\n\n this._telemetry.endSpan(this._activeTurnSpan, {\n status: result?.error ? \"error\" : \"ok\",\n error: result?.error,\n attributes: { \"skaile.turn.duration_ms\": durationMs },\n });\n\n this._activeTurnSpan = undefined;\n this._turnStartTime = undefined;\n }\n}\n\n/**\n * Factory function signature registered in the harness registry.\n *\n * @param config - Configuration for the new harness instance.\n * @returns A freshly constructed (not yet started) {@link AgentHarness}.\n * @docLink packages/bridge/concepts#harness-factory\n */\nexport type HarnessFactory = (config: AgentConfig) => AgentHarness;\n"]}
@@ -31,32 +31,42 @@ var DeployTargetNotFoundError = class extends Error {
31
31
  // plugin-registry/src/internal.ts
32
32
  var MapPluginRegistry = class {
33
33
  apiVersion = 1;
34
- // One Map per kind keeps lookups kind-scoped — a driver and a connector may
34
+ // One Map per kind keeps lookups kind-scoped — a harness and a connector may
35
35
  // share an id without colliding.
36
36
  stores = {
37
- driver: /* @__PURE__ */ new Map(),
37
+ harness: /* @__PURE__ */ new Map(),
38
38
  connector: /* @__PURE__ */ new Map(),
39
39
  deployTarget: /* @__PURE__ */ new Map()
40
40
  };
41
+ /** The store of `kind`; a retired or unknown kind is a loud error, not a silent no-op. */
42
+ storeFor(kind) {
43
+ if (Object.hasOwn(this.stores, kind)) return this.stores[kind];
44
+ if (kind === "driver") {
45
+ throw new Error(
46
+ 'plugin kind "driver" was renamed to "harness" in @skaile/workspaces 6.0.0; register("harness", \u2026)'
47
+ );
48
+ }
49
+ throw new Error(`unknown plugin kind "${kind}"`);
50
+ }
41
51
  register(kind, target) {
52
+ const store = this.storeFor(kind);
42
53
  const t = target;
43
54
  if (t.apiVersion !== 1) {
44
55
  throw new ApiVersionMismatchError(kind, t.id, t.apiVersion);
45
56
  }
46
- const store = this.stores[kind];
47
57
  if (store.has(t.id)) {
48
58
  throw new RegistrationError(kind, t.id);
49
59
  }
50
60
  store.set(t.id, t);
51
61
  }
52
62
  unregister(kind, id) {
53
- return this.stores[kind].delete(id);
63
+ return this.storeFor(kind).delete(id);
54
64
  }
55
65
  get(kind, id) {
56
- return this.stores[kind].get(id);
66
+ return this.storeFor(kind).get(id);
57
67
  }
58
68
  list(kind) {
59
- return [...this.stores[kind].values()].map((t) => ({
69
+ return [...this.storeFor(kind).values()].map((t) => ({
60
70
  id: t.id,
61
71
  displayName: t.displayName
62
72
  }));
@@ -157,5 +167,5 @@ function makeDeployHandle(opts) {
157
167
  }
158
168
 
159
169
  export { ApiVersionMismatchError, DeployTargetNotFoundError, MissingTargetError, RegistrationError, buildStrategySchema, createPluginRegistry, getDeployTarget, listDeployTargets, makeDeployHandle, pluginRegistry, pollUntil, resolveDeployTarget, sleep };
160
- //# sourceMappingURL=chunk-6E6PKKAD.js.map
161
- //# sourceMappingURL=chunk-6E6PKKAD.js.map
170
+ //# sourceMappingURL=chunk-G5SUWZEU.js.map
171
+ //# sourceMappingURL=chunk-G5SUWZEU.js.map