@the-open-engine/zeroshot 6.29.0 → 6.30.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 (347) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/cli/index.js +2 -4
  3. package/lib/agent-cli-provider/adapters/codex.d.ts.map +1 -1
  4. package/lib/agent-cli-provider/adapters/codex.js +0 -1
  5. package/lib/agent-cli-provider/adapters/codex.js.map +1 -1
  6. package/lib/agent-cli-provider/contract-actions.d.ts +1 -1
  7. package/lib/agent-cli-provider/contract-actions.d.ts.map +1 -1
  8. package/lib/agent-cli-provider/contract-actions.js +5 -5
  9. package/lib/agent-cli-provider/contract-actions.js.map +1 -1
  10. package/lib/agent-cli-provider/contract-invoke.d.ts +1 -1
  11. package/lib/agent-cli-provider/contract-invoke.d.ts.map +1 -1
  12. package/lib/agent-cli-provider/contract-invoke.js +2 -2
  13. package/lib/agent-cli-provider/contract-invoke.js.map +1 -1
  14. package/lib/agent-cli-provider/contract-support.d.ts +1 -1
  15. package/lib/agent-cli-provider/contract-support.d.ts.map +1 -1
  16. package/lib/agent-cli-provider/contract-support.js +2 -2
  17. package/lib/agent-cli-provider/contract-support.js.map +1 -1
  18. package/lib/agent-cli-provider/contract.d.ts +1 -0
  19. package/lib/agent-cli-provider/contract.d.ts.map +1 -1
  20. package/lib/agent-cli-provider/contract.js +1 -1
  21. package/lib/agent-cli-provider/contract.js.map +1 -1
  22. package/lib/agent-cli-provider/index.d.ts +1 -1
  23. package/lib/agent-cli-provider/index.d.ts.map +1 -1
  24. package/lib/agent-cli-provider/index.js +2 -1
  25. package/lib/agent-cli-provider/index.js.map +1 -1
  26. package/lib/agent-cli-provider/provider-registry.d.ts +1 -0
  27. package/lib/agent-cli-provider/provider-registry.d.ts.map +1 -1
  28. package/lib/agent-cli-provider/provider-registry.js +4 -0
  29. package/lib/agent-cli-provider/provider-registry.js.map +1 -1
  30. package/lib/agent-cli-provider/single-agent-runtime.d.ts +3 -3
  31. package/lib/agent-cli-provider/single-agent-runtime.d.ts.map +1 -1
  32. package/lib/agent-cli-provider/single-agent-runtime.js +22 -48
  33. package/lib/agent-cli-provider/single-agent-runtime.js.map +1 -1
  34. package/lib/cluster/client.cjs +30 -7
  35. package/lib/cluster/client.d.cts +52 -0
  36. package/lib/cluster/client.d.mts +52 -0
  37. package/lib/cluster/client.d.ts +4 -6
  38. package/lib/cluster/client.mjs +32 -9
  39. package/lib/cluster/connection-state.cjs +25 -0
  40. package/lib/cluster/connection-state.d.cts +13 -0
  41. package/lib/cluster/connection-state.d.mts +13 -0
  42. package/lib/cluster/connection-state.d.ts +13 -0
  43. package/lib/cluster/connection-state.mjs +21 -0
  44. package/lib/{target/hosted-run/contracts.js → cluster/connection-types.cjs} +0 -1
  45. package/lib/cluster/connection-types.d.cts +33 -0
  46. package/lib/cluster/connection-types.d.mts +33 -0
  47. package/lib/cluster/connection-types.d.ts +33 -0
  48. package/lib/cluster/connection-types.mjs +1 -0
  49. package/lib/cluster/connection.cjs +18 -46
  50. package/lib/cluster/connection.d.cts +26 -0
  51. package/lib/cluster/connection.d.mts +26 -0
  52. package/lib/cluster/connection.d.ts +7 -25
  53. package/lib/cluster/connection.mjs +12 -42
  54. package/lib/cluster/errors.cjs +9 -1
  55. package/lib/cluster/errors.d.cts +29 -0
  56. package/lib/cluster/errors.d.mts +29 -0
  57. package/lib/cluster/errors.d.ts +4 -0
  58. package/lib/cluster/errors.mjs +7 -0
  59. package/lib/cluster/frames.d.cts +12 -0
  60. package/lib/cluster/frames.d.mts +12 -0
  61. package/lib/cluster/generated/protocol-schema.d.cts +1 -0
  62. package/lib/cluster/generated/protocol-schema.d.mts +1 -0
  63. package/lib/cluster/generated/protocol.d.cts +781 -0
  64. package/lib/cluster/generated/protocol.d.mts +781 -0
  65. package/lib/cluster/index.cjs +2 -2
  66. package/lib/cluster/index.d.cts +13 -0
  67. package/lib/cluster/index.d.mts +13 -0
  68. package/lib/cluster/index.d.ts +3 -3
  69. package/lib/cluster/index.mjs +2 -2
  70. package/lib/cluster/json-source.cjs +1 -0
  71. package/lib/cluster/json-source.d.cts +5 -0
  72. package/lib/cluster/json-source.d.mts +5 -0
  73. package/lib/cluster/json-source.d.ts +1 -0
  74. package/lib/cluster/json-source.mjs +1 -0
  75. package/lib/cluster/payload-value.cjs +1 -0
  76. package/lib/cluster/payload-value.d.cts +8 -0
  77. package/lib/cluster/payload-value.d.mts +8 -0
  78. package/lib/cluster/payload-value.d.ts +1 -0
  79. package/lib/cluster/payload-value.mjs +1 -0
  80. package/lib/cluster/queue.d.cts +15 -0
  81. package/lib/cluster/queue.d.mts +15 -0
  82. package/lib/cluster/socket.cjs +8 -0
  83. package/lib/cluster/socket.d.cts +13 -0
  84. package/lib/cluster/socket.d.mts +13 -0
  85. package/lib/cluster/socket.d.ts +2 -0
  86. package/lib/cluster/socket.mjs +7 -0
  87. package/lib/cluster/subscriptions.d.cts +73 -0
  88. package/lib/cluster/subscriptions.d.mts +73 -0
  89. package/lib/cluster/subscriptions.d.ts +5 -1
  90. package/lib/cluster/validators.cjs +1 -0
  91. package/lib/cluster/validators.d.cts +7 -0
  92. package/lib/cluster/validators.d.mts +7 -0
  93. package/lib/cluster/validators.d.ts +1 -0
  94. package/lib/cluster/validators.mjs +1 -0
  95. package/lib/cluster-worker/engine-adapter-common.js +37 -0
  96. package/lib/cluster-worker/engine-adapter.js +24 -30
  97. package/lib/cluster-worker/engine-start.js +59 -0
  98. package/lib/cluster-worker/index.js +49 -67
  99. package/lib/cluster-worker/profiles.js +1 -42
  100. package/lib/cluster-worker/runtime-dependencies.js +49 -0
  101. package/lib/cluster-worker/runtime-support.js +2 -34
  102. package/lib/cluster-worker/terminal-normalizer.js +9 -10
  103. package/lib/hosted-session/authority.cjs +61 -0
  104. package/lib/hosted-session/authority.d.cts +3 -0
  105. package/lib/hosted-session/authority.d.mts +3 -0
  106. package/lib/hosted-session/authority.d.ts +3 -0
  107. package/lib/hosted-session/authority.mjs +57 -0
  108. package/lib/hosted-session/coordinator.cjs +78 -51
  109. package/lib/hosted-session/coordinator.d.cts +11 -0
  110. package/lib/hosted-session/coordinator.d.mts +11 -0
  111. package/lib/hosted-session/coordinator.d.ts +4 -2
  112. package/lib/hosted-session/coordinator.mjs +75 -51
  113. package/lib/hosted-session/errors.cjs +25 -0
  114. package/lib/hosted-session/errors.d.cts +10 -0
  115. package/lib/hosted-session/errors.d.mts +10 -0
  116. package/lib/hosted-session/errors.d.ts +10 -0
  117. package/lib/hosted-session/errors.mjs +19 -0
  118. package/lib/hosted-session/index.cjs +4 -1
  119. package/lib/hosted-session/index.d.cts +2 -0
  120. package/lib/hosted-session/index.d.mts +2 -0
  121. package/lib/hosted-session/index.d.ts +2 -2
  122. package/lib/hosted-session/index.mjs +1 -1
  123. package/lib/hosted-session/reconnecting-watch.cjs +131 -0
  124. package/lib/hosted-session/reconnecting-watch.d.cts +13 -0
  125. package/lib/hosted-session/reconnecting-watch.d.mts +13 -0
  126. package/lib/hosted-session/reconnecting-watch.d.ts +13 -0
  127. package/lib/hosted-session/reconnecting-watch.mjs +127 -0
  128. package/lib/hosted-session/types.d.cts +32 -0
  129. package/lib/hosted-session/types.d.mts +32 -0
  130. package/lib/hosted-session/types.d.ts +19 -7
  131. package/lib/hosted-target/access-url.cjs +44 -0
  132. package/lib/hosted-target/access-url.d.cts +2 -0
  133. package/lib/hosted-target/access-url.d.mts +2 -0
  134. package/lib/hosted-target/access-url.d.ts +2 -0
  135. package/lib/hosted-target/access-url.mjs +41 -0
  136. package/lib/hosted-target/adapter-request.cjs +12 -0
  137. package/lib/hosted-target/adapter-request.d.cts +17 -0
  138. package/lib/hosted-target/adapter-request.d.mts +17 -0
  139. package/lib/hosted-target/adapter-request.d.ts +17 -0
  140. package/lib/hosted-target/adapter-request.mjs +9 -0
  141. package/lib/hosted-target/adapter-types.cjs +2 -0
  142. package/lib/hosted-target/adapter-types.d.cts +27 -0
  143. package/lib/hosted-target/adapter-types.d.mts +27 -0
  144. package/lib/hosted-target/adapter-types.d.ts +27 -0
  145. package/lib/hosted-target/adapter-types.mjs +1 -0
  146. package/lib/hosted-target/bounds.cjs +10 -0
  147. package/lib/hosted-target/bounds.d.cts +7 -0
  148. package/lib/hosted-target/bounds.d.mts +7 -0
  149. package/lib/hosted-target/bounds.d.ts +7 -0
  150. package/lib/hosted-target/bounds.mjs +7 -0
  151. package/lib/hosted-target/capsule-error-response.cjs +76 -0
  152. package/lib/hosted-target/capsule-error-response.d.cts +2 -0
  153. package/lib/hosted-target/capsule-error-response.d.mts +2 -0
  154. package/lib/hosted-target/capsule-error-response.d.ts +2 -0
  155. package/lib/hosted-target/capsule-error-response.mjs +73 -0
  156. package/lib/hosted-target/errors.cjs +88 -0
  157. package/lib/hosted-target/errors.d.cts +36 -0
  158. package/lib/hosted-target/errors.d.mts +36 -0
  159. package/lib/hosted-target/errors.d.ts +36 -0
  160. package/lib/hosted-target/errors.mjs +75 -0
  161. package/lib/hosted-target/index.cjs +16 -0
  162. package/lib/hosted-target/index.d.cts +3 -0
  163. package/lib/hosted-target/index.d.mts +3 -0
  164. package/lib/hosted-target/index.d.ts +3 -0
  165. package/lib/hosted-target/index.mjs +2 -0
  166. package/lib/hosted-target/response-validation.cjs +169 -0
  167. package/lib/hosted-target/response-validation.d.cts +5 -0
  168. package/lib/hosted-target/response-validation.d.mts +5 -0
  169. package/lib/hosted-target/response-validation.d.ts +5 -0
  170. package/lib/hosted-target/response-validation.mjs +163 -0
  171. package/lib/hosted-target/retry-executor.cjs +51 -0
  172. package/lib/hosted-target/retry-executor.d.cts +8 -0
  173. package/lib/hosted-target/retry-executor.d.mts +8 -0
  174. package/lib/hosted-target/retry-executor.d.ts +8 -0
  175. package/lib/hosted-target/retry-executor.mjs +48 -0
  176. package/lib/hosted-target/retry.cjs +78 -0
  177. package/lib/hosted-target/retry.d.cts +9 -0
  178. package/lib/hosted-target/retry.d.mts +9 -0
  179. package/lib/hosted-target/retry.d.ts +9 -0
  180. package/lib/hosted-target/retry.mjs +73 -0
  181. package/lib/hosted-target/target-adapter.cjs +10 -0
  182. package/lib/hosted-target/target-adapter.d.cts +3 -0
  183. package/lib/hosted-target/target-adapter.d.mts +3 -0
  184. package/lib/hosted-target/target-adapter.d.ts +3 -0
  185. package/lib/hosted-target/target-adapter.mjs +7 -0
  186. package/lib/hosted-target/types.cjs +4 -0
  187. package/lib/hosted-target/types.d.cts +50 -0
  188. package/lib/hosted-target/types.d.mts +50 -0
  189. package/lib/hosted-target/types.d.ts +50 -0
  190. package/lib/hosted-target/types.mjs +1 -0
  191. package/lib/hosted-target/zero-cloud-v1-adapter.cjs +185 -0
  192. package/lib/hosted-target/zero-cloud-v1-adapter.d.cts +13 -0
  193. package/lib/hosted-target/zero-cloud-v1-adapter.d.mts +13 -0
  194. package/lib/hosted-target/zero-cloud-v1-adapter.d.ts +13 -0
  195. package/lib/hosted-target/zero-cloud-v1-adapter.mjs +181 -0
  196. package/lib/start-cluster.js +3 -3
  197. package/lib/target/bounded-response.cjs +51 -0
  198. package/lib/target/bounded-response.d.cts +1 -0
  199. package/lib/target/bounded-response.d.mts +1 -0
  200. package/lib/target/bounded-response.d.ts +1 -0
  201. package/lib/target/bounded-response.js +51 -0
  202. package/lib/target/bounded-response.mjs +48 -0
  203. package/lib/target/credential-lock.js +1 -3
  204. package/lib/target/credential-store.js +9 -4
  205. package/lib/target/device-flow.cjs +213 -0
  206. package/lib/target/device-flow.d.cts +54 -0
  207. package/lib/target/device-flow.d.mts +54 -0
  208. package/lib/target/device-flow.d.ts +26 -14
  209. package/lib/target/device-flow.js +162 -58
  210. package/lib/target/device-flow.mjs +203 -0
  211. package/lib/target/discovery-errors.cjs +10 -0
  212. package/lib/target/discovery-errors.d.cts +3 -0
  213. package/lib/target/discovery-errors.d.mts +3 -0
  214. package/lib/target/discovery-errors.d.ts +3 -0
  215. package/lib/target/discovery-errors.js +10 -0
  216. package/lib/target/discovery-errors.mjs +6 -0
  217. package/lib/target/discovery-sections.cjs +191 -0
  218. package/lib/target/discovery-sections.d.cts +52 -0
  219. package/lib/target/discovery-sections.d.mts +52 -0
  220. package/lib/target/discovery-sections.d.ts +52 -0
  221. package/lib/target/discovery-sections.js +191 -0
  222. package/lib/target/discovery-sections.mjs +179 -0
  223. package/lib/target/discovery-validation.cjs +109 -0
  224. package/lib/target/discovery-validation.d.cts +28 -0
  225. package/lib/target/discovery-validation.d.mts +28 -0
  226. package/lib/target/discovery-validation.d.ts +28 -0
  227. package/lib/target/discovery-validation.js +109 -0
  228. package/lib/target/discovery-validation.mjs +99 -0
  229. package/lib/target/discovery.cjs +112 -0
  230. package/lib/target/discovery.d.cts +74 -0
  231. package/lib/target/discovery.d.mts +74 -0
  232. package/lib/target/discovery.d.ts +67 -5
  233. package/lib/target/discovery.js +94 -79
  234. package/lib/target/discovery.mjs +105 -0
  235. package/lib/target/index.d.ts +6 -6
  236. package/lib/target/index.js +36 -36
  237. package/lib/target/oauth-http.d.ts +2 -0
  238. package/lib/target/oauth-http.js +25 -0
  239. package/lib/target/refresh-exchange.d.ts +11 -0
  240. package/lib/target/refresh-exchange.js +24 -0
  241. package/lib/target/refresh-revocation.d.ts +8 -0
  242. package/lib/target/refresh-revocation.js +19 -0
  243. package/lib/target/route-template.cjs +85 -0
  244. package/lib/target/route-template.d.cts +7 -0
  245. package/lib/target/route-template.d.mts +7 -0
  246. package/lib/target/route-template.d.ts +7 -0
  247. package/lib/target/route-template.js +85 -0
  248. package/lib/target/route-template.mjs +81 -0
  249. package/lib/target/session-errors.d.ts +4 -0
  250. package/lib/target/session-errors.js +12 -0
  251. package/lib/target/session-verification.d.ts +10 -0
  252. package/lib/target/session-verification.js +42 -0
  253. package/lib/target/target-registry.d.ts +7 -3
  254. package/lib/target/target-registry.js +41 -10
  255. package/lib/target/target-session-manager.d.ts +48 -0
  256. package/lib/target/target-session-manager.js +226 -0
  257. package/lib/target/target-session.d.ts +39 -32
  258. package/lib/target/target-session.js +63 -151
  259. package/lib/target/token-response.cjs +51 -0
  260. package/lib/target/token-response.d.cts +7 -0
  261. package/lib/target/token-response.d.mts +7 -0
  262. package/lib/target/token-response.d.ts +7 -0
  263. package/lib/target/token-response.js +51 -0
  264. package/lib/target/token-response.mjs +48 -0
  265. package/package.json +14 -7
  266. package/protocol/openengine-cluster/v1/worker.schema.json +171 -9
  267. package/scripts/build-cluster.js +23 -3
  268. package/scripts/opcore-introduced-check.js +0 -2
  269. package/src/agent-cli-provider/adapters/codex.ts +0 -1
  270. package/src/agent-cli-provider/contract-actions.ts +9 -5
  271. package/src/agent-cli-provider/contract-invoke.ts +3 -2
  272. package/src/agent-cli-provider/contract-support.ts +12 -6
  273. package/src/agent-cli-provider/contract.ts +6 -1
  274. package/src/agent-cli-provider/index.ts +1 -0
  275. package/src/agent-cli-provider/provider-registry.ts +4 -0
  276. package/src/agent-cli-provider/single-agent-runtime.ts +32 -45
  277. package/src/cluster/client.ts +42 -15
  278. package/src/cluster/connection-state.ts +33 -0
  279. package/src/cluster/connection-types.ts +28 -0
  280. package/src/cluster/connection.ts +37 -68
  281. package/src/cluster/errors.ts +5 -0
  282. package/src/cluster/index.ts +3 -1
  283. package/src/cluster/json-source.ts +1 -0
  284. package/src/cluster/payload-value.ts +1 -0
  285. package/src/cluster/socket.ts +13 -0
  286. package/src/cluster/subscriptions.ts +7 -2
  287. package/src/cluster/validators.ts +1 -0
  288. package/src/cluster/ws.d.ts +1 -1
  289. package/src/hosted-session/authority.ts +77 -0
  290. package/src/hosted-session/coordinator.ts +113 -56
  291. package/src/hosted-session/errors.ts +21 -0
  292. package/src/hosted-session/index.ts +14 -2
  293. package/src/hosted-session/reconnecting-watch.ts +148 -0
  294. package/src/hosted-session/types.ts +22 -8
  295. package/src/hosted-target/access-url.ts +46 -0
  296. package/src/hosted-target/adapter-request.ts +28 -0
  297. package/src/hosted-target/adapter-types.ts +39 -0
  298. package/src/hosted-target/bounds.ts +1 -0
  299. package/src/hosted-target/capsule-error-response.ts +107 -0
  300. package/src/hosted-target/errors.ts +36 -35
  301. package/src/hosted-target/index.ts +10 -23
  302. package/src/hosted-target/response-validation.ts +170 -62
  303. package/src/hosted-target/retry-executor.ts +62 -0
  304. package/src/hosted-target/retry.ts +47 -11
  305. package/src/hosted-target/target-adapter.ts +12 -8
  306. package/src/hosted-target/types.ts +19 -18
  307. package/src/hosted-target/zero-cloud-v1-adapter.ts +229 -316
  308. package/src/isolation-manager.js +1 -16
  309. package/src/target/bounded-response.ts +68 -0
  310. package/src/target/credential-lock.ts +1 -3
  311. package/src/target/credential-store.ts +14 -10
  312. package/src/target/device-flow.ts +209 -85
  313. package/src/target/discovery-errors.ts +6 -0
  314. package/src/target/discovery-sections.ts +251 -0
  315. package/src/target/discovery-validation.ts +144 -0
  316. package/src/target/discovery.ts +163 -97
  317. package/src/target/index.ts +15 -11
  318. package/src/target/oauth-http.ts +27 -0
  319. package/src/target/refresh-exchange.ts +36 -0
  320. package/src/target/refresh-revocation.ts +29 -0
  321. package/src/target/route-template.ts +105 -0
  322. package/src/target/session-errors.ts +9 -0
  323. package/src/target/session-verification.ts +51 -0
  324. package/src/target/target-registry.ts +60 -27
  325. package/src/target/target-session-manager.ts +285 -0
  326. package/src/target/target-session.ts +105 -226
  327. package/src/target/token-response.ts +62 -0
  328. package/docker/zeroshot-oecp/Cargo.toml +0 -12
  329. package/docker/zeroshot-oecp/Dockerfile +0 -65
  330. package/docker/zeroshot-oecp/src/main.rs +0 -32
  331. package/lib/target/bounded-json.d.ts +0 -6
  332. package/lib/target/bounded-json.js +0 -43
  333. package/lib/target/hosted-run/client.d.ts +0 -26
  334. package/lib/target/hosted-run/client.js +0 -158
  335. package/lib/target/hosted-run/commands.d.ts +0 -4
  336. package/lib/target/hosted-run/commands.js +0 -113
  337. package/lib/target/hosted-run/contracts.d.ts +0 -49
  338. package/lib/target/hosted-run/input.d.ts +0 -5
  339. package/lib/target/hosted-run/input.js +0 -200
  340. package/lib/target/hosted-run.d.ts +0 -4
  341. package/lib/target/hosted-run.js +0 -12
  342. package/src/target/bounded-json.ts +0 -48
  343. package/src/target/hosted-run/client.ts +0 -198
  344. package/src/target/hosted-run/commands.ts +0 -140
  345. package/src/target/hosted-run/contracts.ts +0 -53
  346. package/src/target/hosted-run/input.ts +0 -199
  347. package/src/target/hosted-run.ts +0 -8
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.connectInitialized = exports.connect = exports.ClusterClient = exports.WatchSubscriptionStream = exports.LogsSubscriptionStream = exports.AgentAttachSubscriptionStream = exports.Connection = exports.PROTOCOL_DIAGNOSTIC_CAPACITY = exports.CONNECTION_TRANSITIONS = exports.CLOSE_REASON_MAX_BYTES = exports.assertGraphSpec = exports.assertGraphProfileSupported = exports.assertGraphProfile = exports.ClusterTransportError = exports.ClusterTimeoutError = exports.ClusterStateError = exports.ClusterRpcError = exports.ClusterRequestError = exports.ClusterProtocolError = exports.ClusterInternalError = exports.ClusterError = exports.ClusterConfigError = exports.SUBSCRIPTION_QUEUE_MAX_BYTES = void 0;
17
+ exports.connectInitialized = exports.connect = exports.ClusterClient = exports.WatchSubscriptionStream = exports.LogsSubscriptionStream = exports.AgentAttachSubscriptionStream = exports.Connection = exports.PROTOCOL_DIAGNOSTIC_CAPACITY = exports.CONNECTION_TRANSITIONS = exports.assertGraphSpec = exports.assertGraphProfileSupported = exports.assertGraphProfile = exports.ClusterUpgradeError = exports.ClusterTransportError = exports.ClusterTimeoutError = exports.ClusterStateError = exports.ClusterRpcError = exports.ClusterRequestError = exports.ClusterProtocolError = exports.ClusterInternalError = exports.ClusterError = exports.ClusterConfigError = exports.SUBSCRIPTION_QUEUE_MAX_BYTES = void 0;
18
18
  __exportStar(require("./generated/protocol.cjs"), exports);
19
19
  var queue_js_1 = require("./queue.cjs");
20
20
  Object.defineProperty(exports, "SUBSCRIPTION_QUEUE_MAX_BYTES", { enumerable: true, get: function () { return queue_js_1.SUBSCRIPTION_QUEUE_MAX_BYTES; } });
@@ -28,6 +28,7 @@ Object.defineProperty(exports, "ClusterRpcError", { enumerable: true, get: funct
28
28
  Object.defineProperty(exports, "ClusterStateError", { enumerable: true, get: function () { return errors_js_1.ClusterStateError; } });
29
29
  Object.defineProperty(exports, "ClusterTimeoutError", { enumerable: true, get: function () { return errors_js_1.ClusterTimeoutError; } });
30
30
  Object.defineProperty(exports, "ClusterTransportError", { enumerable: true, get: function () { return errors_js_1.ClusterTransportError; } });
31
+ Object.defineProperty(exports, "ClusterUpgradeError", { enumerable: true, get: function () { return errors_js_1.ClusterUpgradeError; } });
31
32
  var validators_js_1 = require("./validators.cjs");
32
33
  Object.defineProperty(exports, "assertGraphProfile", { enumerable: true, get: function () { return validators_js_1.assertGraphProfile; } });
33
34
  Object.defineProperty(exports, "assertGraphProfileSupported", { enumerable: true, get: function () { return validators_js_1.assertGraphProfileSupported; } });
@@ -35,7 +36,6 @@ Object.defineProperty(exports, "assertGraphSpec", { enumerable: true, get: funct
35
36
  __exportStar(require("./payload-value.cjs"), exports);
36
37
  __exportStar(require("./json-source.cjs"), exports);
37
38
  var connection_js_1 = require("./connection.cjs");
38
- Object.defineProperty(exports, "CLOSE_REASON_MAX_BYTES", { enumerable: true, get: function () { return connection_js_1.CLOSE_REASON_MAX_BYTES; } });
39
39
  Object.defineProperty(exports, "CONNECTION_TRANSITIONS", { enumerable: true, get: function () { return connection_js_1.CONNECTION_TRANSITIONS; } });
40
40
  Object.defineProperty(exports, "PROTOCOL_DIAGNOSTIC_CAPACITY", { enumerable: true, get: function () { return connection_js_1.PROTOCOL_DIAGNOSTIC_CAPACITY; } });
41
41
  Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_js_1.Connection; } });
@@ -0,0 +1,13 @@
1
+ export * from './generated/protocol.js';
2
+ export { SUBSCRIPTION_QUEUE_MAX_BYTES } from './queue.js';
3
+ export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, ClusterUpgradeError, } from './errors.js';
4
+ export { assertGraphProfile, assertGraphProfileSupported, assertGraphSpec } from './validators.js';
5
+ export * from './payload-value.js';
6
+ export * from './json-source.js';
7
+ export { CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.js';
8
+ export type { CallOptions, ConnectionState, ConnectionCloseSnapshot, } from './connection.js';
9
+ export type { WebSocketLike } from './socket.js';
10
+ export { AgentAttachSubscriptionStream, LogsSubscriptionStream, WatchSubscriptionStream, } from './subscriptions.js';
11
+ export type { Subscription, SubscriptionClosedItem, SubscriptionItem, WatchSubscriptionItem, WatchSubscriptionClosedItem, } from './subscriptions.js';
12
+ export { ClusterClient, connect, connectInitialized } from './client.js';
13
+ export type { AgentAttachSubscription, CoherentWatchSubscription, ConnectInitializedResult, ConnectOptions, LogsSubscription, WatchSubscription, WebSocketFactoryOptions, } from './client.js';
@@ -0,0 +1,13 @@
1
+ export * from './generated/protocol.js';
2
+ export { SUBSCRIPTION_QUEUE_MAX_BYTES } from './queue.js';
3
+ export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, ClusterUpgradeError, } from './errors.js';
4
+ export { assertGraphProfile, assertGraphProfileSupported, assertGraphSpec } from './validators.js';
5
+ export * from './payload-value.js';
6
+ export * from './json-source.js';
7
+ export { CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.js';
8
+ export type { CallOptions, ConnectionState, ConnectionCloseSnapshot, } from './connection.js';
9
+ export type { WebSocketLike } from './socket.js';
10
+ export { AgentAttachSubscriptionStream, LogsSubscriptionStream, WatchSubscriptionStream, } from './subscriptions.js';
11
+ export type { Subscription, SubscriptionClosedItem, SubscriptionItem, WatchSubscriptionItem, WatchSubscriptionClosedItem, } from './subscriptions.js';
12
+ export { ClusterClient, connect, connectInitialized } from './client.js';
13
+ export type { AgentAttachSubscription, CoherentWatchSubscription, ConnectInitializedResult, ConnectOptions, LogsSubscription, WatchSubscription, WebSocketFactoryOptions, } from './client.js';
@@ -1,11 +1,11 @@
1
1
  export * from './generated/protocol.js';
2
2
  export { SUBSCRIPTION_QUEUE_MAX_BYTES } from './queue.js';
3
- export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, } from './errors.js';
3
+ export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, ClusterUpgradeError, } from './errors.js';
4
4
  export { assertGraphProfile, assertGraphProfileSupported, assertGraphSpec } from './validators.js';
5
5
  export * from './payload-value.js';
6
6
  export * from './json-source.js';
7
- export { CLOSE_REASON_MAX_BYTES, CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.js';
8
- export type { CallOptions, ConnectionState, } from './connection.js';
7
+ export { CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.js';
8
+ export type { CallOptions, ConnectionState, ConnectionCloseSnapshot, } from './connection.js';
9
9
  export type { WebSocketLike } from './socket.js';
10
10
  export { AgentAttachSubscriptionStream, LogsSubscriptionStream, WatchSubscriptionStream, } from './subscriptions.js';
11
11
  export type { Subscription, SubscriptionClosedItem, SubscriptionItem, WatchSubscriptionItem, WatchSubscriptionClosedItem, } from './subscriptions.js';
@@ -1,9 +1,9 @@
1
1
  export * from './generated/protocol.mjs';
2
2
  export { SUBSCRIPTION_QUEUE_MAX_BYTES } from './queue.mjs';
3
- export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, } from './errors.mjs';
3
+ export { ClusterConfigError, ClusterError, ClusterInternalError, ClusterProtocolError, ClusterRequestError, ClusterRpcError, ClusterStateError, ClusterTimeoutError, ClusterTransportError, ClusterUpgradeError, } from './errors.mjs';
4
4
  export { assertGraphProfile, assertGraphProfileSupported, assertGraphSpec } from './validators.mjs';
5
5
  export * from './payload-value.mjs';
6
6
  export * from './json-source.mjs';
7
- export { CLOSE_REASON_MAX_BYTES, CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.mjs';
7
+ export { CONNECTION_TRANSITIONS, PROTOCOL_DIAGNOSTIC_CAPACITY, Connection } from './connection.mjs';
8
8
  export { AgentAttachSubscriptionStream, LogsSubscriptionStream, WatchSubscriptionStream, } from './subscriptions.mjs';
9
9
  export { ClusterClient, connect, connectInitialized } from './client.mjs';
@@ -7,6 +7,7 @@ exports.assertDistinctRequestSources = assertDistinctRequestSources;
7
7
  const errors_js_1 = require("./errors.cjs");
8
8
  const protocol_js_1 = require("./generated/protocol.cjs");
9
9
  exports.MAX_REQUEST_BYTES = protocol_js_1.MAX_FRAME_BYTES;
10
+ /** Decode one already-bounded request body with strict UTF-8 and JSON handling. */
10
11
  function decodeBoundedJson(bytes) {
11
12
  if (bytes.length > exports.MAX_REQUEST_BYTES) {
12
13
  throw new errors_js_1.ClusterRequestError(`request payload of ${bytes.length} bytes exceeds the ${exports.MAX_REQUEST_BYTES} byte limit`, 'OVERSIZED_JSON');
@@ -0,0 +1,5 @@
1
+ export declare const MAX_REQUEST_BYTES: 1048576;
2
+ /** Decode one already-bounded request body with strict UTF-8 and JSON handling. */
3
+ export declare function decodeBoundedJson(bytes: Uint8Array): unknown;
4
+ export declare function readBoundedSource(source: AsyncIterable<Uint8Array | string>): Promise<Uint8Array>;
5
+ export declare function assertDistinctRequestSources(graph: string, input: string | undefined): asserts input is string;
@@ -0,0 +1,5 @@
1
+ export declare const MAX_REQUEST_BYTES: 1048576;
2
+ /** Decode one already-bounded request body with strict UTF-8 and JSON handling. */
3
+ export declare function decodeBoundedJson(bytes: Uint8Array): unknown;
4
+ export declare function readBoundedSource(source: AsyncIterable<Uint8Array | string>): Promise<Uint8Array>;
5
+ export declare function assertDistinctRequestSources(graph: string, input: string | undefined): asserts input is string;
@@ -1,4 +1,5 @@
1
1
  export declare const MAX_REQUEST_BYTES: 1048576;
2
+ /** Decode one already-bounded request body with strict UTF-8 and JSON handling. */
2
3
  export declare function decodeBoundedJson(bytes: Uint8Array): unknown;
3
4
  export declare function readBoundedSource(source: AsyncIterable<Uint8Array | string>): Promise<Uint8Array>;
4
5
  export declare function assertDistinctRequestSources(graph: string, input: string | undefined): asserts input is string;
@@ -1,6 +1,7 @@
1
1
  import { ClusterRequestError } from './errors.mjs';
2
2
  import { MAX_FRAME_BYTES } from './generated/protocol.mjs';
3
3
  export const MAX_REQUEST_BYTES = MAX_FRAME_BYTES;
4
+ /** Decode one already-bounded request body with strict UTF-8 and JSON handling. */
4
5
  export function decodeBoundedJson(bytes) {
5
6
  if (bytes.length > MAX_REQUEST_BYTES) {
6
7
  throw new ClusterRequestError(`request payload of ${bytes.length} bytes exceeds the ${MAX_REQUEST_BYTES} byte limit`, 'OVERSIZED_JSON');
@@ -64,6 +64,7 @@ function evaluate(type, value, path) {
64
64
  }
65
65
  }
66
66
  }
67
+ /** Return the first deterministic schema issue without retaining the input value. */
67
68
  function firstInputValidationIssue(type, value, path = '') {
68
69
  const issue = evaluate(type, value, path);
69
70
  return issue ? { path: issue.path, code: issue.code } : null;
@@ -0,0 +1,8 @@
1
+ import type { PayloadType } from './generated/protocol.js';
2
+ export type InputValidationIssue = {
3
+ readonly path: string;
4
+ readonly code: 'TYPE_MISMATCH' | 'MISSING_REQUIRED_FIELD' | 'UNKNOWN_FIELD' | 'UNKNOWN_ENUM_LABEL';
5
+ };
6
+ /** Return the first deterministic schema issue without retaining the input value. */
7
+ export declare function firstInputValidationIssue(type: PayloadType, value: unknown, path?: string): InputValidationIssue | null;
8
+ export declare function assertInputValue(type: PayloadType, value: unknown): void;
@@ -0,0 +1,8 @@
1
+ import type { PayloadType } from './generated/protocol.js';
2
+ export type InputValidationIssue = {
3
+ readonly path: string;
4
+ readonly code: 'TYPE_MISMATCH' | 'MISSING_REQUIRED_FIELD' | 'UNKNOWN_FIELD' | 'UNKNOWN_ENUM_LABEL';
5
+ };
6
+ /** Return the first deterministic schema issue without retaining the input value. */
7
+ export declare function firstInputValidationIssue(type: PayloadType, value: unknown, path?: string): InputValidationIssue | null;
8
+ export declare function assertInputValue(type: PayloadType, value: unknown): void;
@@ -3,5 +3,6 @@ export type InputValidationIssue = {
3
3
  readonly path: string;
4
4
  readonly code: 'TYPE_MISMATCH' | 'MISSING_REQUIRED_FIELD' | 'UNKNOWN_FIELD' | 'UNKNOWN_ENUM_LABEL';
5
5
  };
6
+ /** Return the first deterministic schema issue without retaining the input value. */
6
7
  export declare function firstInputValidationIssue(type: PayloadType, value: unknown, path?: string): InputValidationIssue | null;
7
8
  export declare function assertInputValue(type: PayloadType, value: unknown): void;
@@ -60,6 +60,7 @@ function evaluate(type, value, path) {
60
60
  }
61
61
  }
62
62
  }
63
+ /** Return the first deterministic schema issue without retaining the input value. */
63
64
  export function firstInputValidationIssue(type, value, path = '') {
64
65
  const issue = evaluate(type, value, path);
65
66
  return issue ? { path: issue.path, code: issue.code } : null;
@@ -0,0 +1,15 @@
1
+ export declare const SUBSCRIPTION_QUEUE_MAX_BYTES: number;
2
+ export type QueueValue<T> = {
3
+ readonly done: false;
4
+ readonly value: T;
5
+ } | {
6
+ readonly done: true;
7
+ };
8
+ export declare class BoundedQueue<T> {
9
+ #private;
10
+ get retainedCount(): number;
11
+ push(value: T, bytes: number): 'buffered' | 'delivered' | 'overflow' | 'closed';
12
+ recv(): Promise<QueueValue<T>>;
13
+ endRetainingBuffer(): void;
14
+ closeAndDiscard(): void;
15
+ }
@@ -0,0 +1,15 @@
1
+ export declare const SUBSCRIPTION_QUEUE_MAX_BYTES: number;
2
+ export type QueueValue<T> = {
3
+ readonly done: false;
4
+ readonly value: T;
5
+ } | {
6
+ readonly done: true;
7
+ };
8
+ export declare class BoundedQueue<T> {
9
+ #private;
10
+ get retainedCount(): number;
11
+ push(value: T, bytes: number): 'buffered' | 'delivered' | 'overflow' | 'closed';
12
+ recv(): Promise<QueueValue<T>>;
13
+ endRetainingBuffer(): void;
14
+ closeAndDiscard(): void;
15
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addSocketListener = addSocketListener;
4
+ exports.addSocketEmitterListener = addSocketEmitterListener;
4
5
  const errors_js_1 = require("./errors.cjs");
5
6
  function addSocketListener(socket, type, listener) {
6
7
  if (socket.addEventListener) {
@@ -13,3 +14,10 @@ function addSocketListener(socket, type, listener) {
13
14
  }
14
15
  throw new errors_js_1.ClusterConfigError('WebSocket implementation must support event listeners', 'INVALID_WEBSOCKET');
15
16
  }
17
+ function addSocketEmitterListener(socket, type, listener) {
18
+ if (socket.on) {
19
+ socket.on(type, listener);
20
+ return () => (socket.off ?? socket.removeListener)?.call(socket, type, listener);
21
+ }
22
+ return addSocketListener(socket, type, listener);
23
+ }
@@ -0,0 +1,13 @@
1
+ export interface WebSocketLike {
2
+ readonly readyState: number;
3
+ send(data: string, callback?: (error?: Error) => void): void | Promise<void>;
4
+ close(code?: number, reason?: string): void | Promise<void>;
5
+ terminate?(): void;
6
+ addEventListener?(type: string, listener: (...args: unknown[]) => void): void;
7
+ removeEventListener?(type: string, listener: (...args: unknown[]) => void): void;
8
+ on?(type: string, listener: (...args: unknown[]) => void): void;
9
+ off?(type: string, listener: (...args: unknown[]) => void): void;
10
+ removeListener?(type: string, listener: (...args: unknown[]) => void): void;
11
+ }
12
+ export declare function addSocketListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
13
+ export declare function addSocketEmitterListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
@@ -0,0 +1,13 @@
1
+ export interface WebSocketLike {
2
+ readonly readyState: number;
3
+ send(data: string, callback?: (error?: Error) => void): void | Promise<void>;
4
+ close(code?: number, reason?: string): void | Promise<void>;
5
+ terminate?(): void;
6
+ addEventListener?(type: string, listener: (...args: unknown[]) => void): void;
7
+ removeEventListener?(type: string, listener: (...args: unknown[]) => void): void;
8
+ on?(type: string, listener: (...args: unknown[]) => void): void;
9
+ off?(type: string, listener: (...args: unknown[]) => void): void;
10
+ removeListener?(type: string, listener: (...args: unknown[]) => void): void;
11
+ }
12
+ export declare function addSocketListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
13
+ export declare function addSocketEmitterListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
@@ -2,6 +2,7 @@ export interface WebSocketLike {
2
2
  readonly readyState: number;
3
3
  send(data: string, callback?: (error?: Error) => void): void | Promise<void>;
4
4
  close(code?: number, reason?: string): void | Promise<void>;
5
+ terminate?(): void;
5
6
  addEventListener?(type: string, listener: (...args: unknown[]) => void): void;
6
7
  removeEventListener?(type: string, listener: (...args: unknown[]) => void): void;
7
8
  on?(type: string, listener: (...args: unknown[]) => void): void;
@@ -9,3 +10,4 @@ export interface WebSocketLike {
9
10
  removeListener?(type: string, listener: (...args: unknown[]) => void): void;
10
11
  }
11
12
  export declare function addSocketListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
13
+ export declare function addSocketEmitterListener(socket: WebSocketLike, type: string, listener: (...args: unknown[]) => void): () => void;
@@ -10,3 +10,10 @@ export function addSocketListener(socket, type, listener) {
10
10
  }
11
11
  throw new ClusterConfigError('WebSocket implementation must support event listeners', 'INVALID_WEBSOCKET');
12
12
  }
13
+ export function addSocketEmitterListener(socket, type, listener) {
14
+ if (socket.on) {
15
+ socket.on(type, listener);
16
+ return () => (socket.off ?? socket.removeListener)?.call(socket, type, listener);
17
+ }
18
+ return addSocketListener(socket, type, listener);
19
+ }
@@ -0,0 +1,73 @@
1
+ import type { AgentAttachEvent, LogRecord, SubscriptionCloseReason, WatchEvent, WatchParams, WatchResult } from './generated/protocol.js';
2
+ import { Connection } from './connection.js';
3
+ import type { SubscriptionRegistration } from './connection.js';
4
+ import type { FrameRecord } from './frames.js';
5
+ export type SubscriptionClosedItem = {
6
+ readonly type: 'closed';
7
+ readonly reason: SubscriptionCloseReason;
8
+ };
9
+ export type WatchSubscriptionClosedItem = SubscriptionClosedItem & {
10
+ readonly lastDeliveredCursor?: string | null;
11
+ };
12
+ export type SubscriptionItem<T> = {
13
+ readonly type: 'event';
14
+ readonly event: T;
15
+ } | SubscriptionClosedItem;
16
+ export type WatchSubscriptionItem = {
17
+ readonly type: 'event';
18
+ readonly runId: string;
19
+ readonly cursor: string;
20
+ readonly event: WatchEvent;
21
+ } | WatchSubscriptionClosedItem;
22
+ export interface Subscription<T> extends AsyncIterator<SubscriptionItem<T>>, AsyncIterable<SubscriptionItem<T>> {
23
+ readonly subscriptionId: string;
24
+ readonly retainedCount: number;
25
+ cancel(): Promise<void>;
26
+ }
27
+ export interface WatchSubscription {
28
+ readonly result: WatchResult;
29
+ readonly stream: WatchSubscriptionStream;
30
+ }
31
+ type FrameParser<T> = (frame: FrameRecord) => SubscriptionItem<T>;
32
+ declare class SubscriptionStream<T> implements Subscription<T> {
33
+ #private;
34
+ protected readonly connection: Connection;
35
+ protected readonly registration: SubscriptionRegistration;
36
+ private readonly parse;
37
+ constructor(connection: Connection, registration: SubscriptionRegistration, parse: FrameParser<T>);
38
+ get subscriptionId(): string;
39
+ get retainedCount(): number;
40
+ [Symbol.asyncIterator](): this;
41
+ next(): Promise<IteratorResult<SubscriptionItem<T>>>;
42
+ return(): Promise<IteratorResult<SubscriptionItem<T>>>;
43
+ throw(error?: unknown): Promise<IteratorResult<SubscriptionItem<T>>>;
44
+ cancel(): Promise<void>;
45
+ }
46
+ export declare class LogsSubscriptionStream extends SubscriptionStream<LogRecord> {
47
+ constructor(connection: Connection, registration: SubscriptionRegistration);
48
+ }
49
+ export declare class AgentAttachSubscriptionStream extends SubscriptionStream<AgentAttachEvent> {
50
+ constructor(connection: Connection, registration: SubscriptionRegistration);
51
+ }
52
+ type WatchStreamInit = {
53
+ readonly connection: Connection;
54
+ readonly registration: SubscriptionRegistration;
55
+ readonly result: WatchResult;
56
+ readonly params: WatchParams;
57
+ readonly lastSeenRunId?: string;
58
+ readonly lastSeenCursor?: string;
59
+ };
60
+ export declare class WatchSubscriptionStream implements AsyncIterator<WatchSubscriptionItem>, AsyncIterable<WatchSubscriptionItem> {
61
+ #private;
62
+ constructor(init: WatchStreamInit);
63
+ get subscriptionId(): string;
64
+ get retainedCount(): number;
65
+ get lastDeliveredCursor(): string | null | undefined;
66
+ [Symbol.asyncIterator](): this;
67
+ next(): Promise<IteratorResult<WatchSubscriptionItem>>;
68
+ return(): Promise<IteratorResult<WatchSubscriptionItem>>;
69
+ throw(error?: unknown): Promise<IteratorResult<WatchSubscriptionItem>>;
70
+ cancel(): Promise<void>;
71
+ reconnect(freshConnection: Connection): Promise<WatchSubscription>;
72
+ }
73
+ export {};
@@ -0,0 +1,73 @@
1
+ import type { AgentAttachEvent, LogRecord, SubscriptionCloseReason, WatchEvent, WatchParams, WatchResult } from './generated/protocol.js';
2
+ import { Connection } from './connection.js';
3
+ import type { SubscriptionRegistration } from './connection.js';
4
+ import type { FrameRecord } from './frames.js';
5
+ export type SubscriptionClosedItem = {
6
+ readonly type: 'closed';
7
+ readonly reason: SubscriptionCloseReason;
8
+ };
9
+ export type WatchSubscriptionClosedItem = SubscriptionClosedItem & {
10
+ readonly lastDeliveredCursor?: string | null;
11
+ };
12
+ export type SubscriptionItem<T> = {
13
+ readonly type: 'event';
14
+ readonly event: T;
15
+ } | SubscriptionClosedItem;
16
+ export type WatchSubscriptionItem = {
17
+ readonly type: 'event';
18
+ readonly runId: string;
19
+ readonly cursor: string;
20
+ readonly event: WatchEvent;
21
+ } | WatchSubscriptionClosedItem;
22
+ export interface Subscription<T> extends AsyncIterator<SubscriptionItem<T>>, AsyncIterable<SubscriptionItem<T>> {
23
+ readonly subscriptionId: string;
24
+ readonly retainedCount: number;
25
+ cancel(): Promise<void>;
26
+ }
27
+ export interface WatchSubscription {
28
+ readonly result: WatchResult;
29
+ readonly stream: WatchSubscriptionStream;
30
+ }
31
+ type FrameParser<T> = (frame: FrameRecord) => SubscriptionItem<T>;
32
+ declare class SubscriptionStream<T> implements Subscription<T> {
33
+ #private;
34
+ protected readonly connection: Connection;
35
+ protected readonly registration: SubscriptionRegistration;
36
+ private readonly parse;
37
+ constructor(connection: Connection, registration: SubscriptionRegistration, parse: FrameParser<T>);
38
+ get subscriptionId(): string;
39
+ get retainedCount(): number;
40
+ [Symbol.asyncIterator](): this;
41
+ next(): Promise<IteratorResult<SubscriptionItem<T>>>;
42
+ return(): Promise<IteratorResult<SubscriptionItem<T>>>;
43
+ throw(error?: unknown): Promise<IteratorResult<SubscriptionItem<T>>>;
44
+ cancel(): Promise<void>;
45
+ }
46
+ export declare class LogsSubscriptionStream extends SubscriptionStream<LogRecord> {
47
+ constructor(connection: Connection, registration: SubscriptionRegistration);
48
+ }
49
+ export declare class AgentAttachSubscriptionStream extends SubscriptionStream<AgentAttachEvent> {
50
+ constructor(connection: Connection, registration: SubscriptionRegistration);
51
+ }
52
+ type WatchStreamInit = {
53
+ readonly connection: Connection;
54
+ readonly registration: SubscriptionRegistration;
55
+ readonly result: WatchResult;
56
+ readonly params: WatchParams;
57
+ readonly lastSeenRunId?: string;
58
+ readonly lastSeenCursor?: string;
59
+ };
60
+ export declare class WatchSubscriptionStream implements AsyncIterator<WatchSubscriptionItem>, AsyncIterable<WatchSubscriptionItem> {
61
+ #private;
62
+ constructor(init: WatchStreamInit);
63
+ get subscriptionId(): string;
64
+ get retainedCount(): number;
65
+ get lastDeliveredCursor(): string | null | undefined;
66
+ [Symbol.asyncIterator](): this;
67
+ next(): Promise<IteratorResult<WatchSubscriptionItem>>;
68
+ return(): Promise<IteratorResult<WatchSubscriptionItem>>;
69
+ throw(error?: unknown): Promise<IteratorResult<WatchSubscriptionItem>>;
70
+ cancel(): Promise<void>;
71
+ reconnect(freshConnection: Connection): Promise<WatchSubscription>;
72
+ }
73
+ export {};
@@ -24,6 +24,10 @@ export interface Subscription<T> extends AsyncIterator<SubscriptionItem<T>>, Asy
24
24
  readonly retainedCount: number;
25
25
  cancel(): Promise<void>;
26
26
  }
27
+ export interface WatchSubscription {
28
+ readonly result: WatchResult;
29
+ readonly stream: WatchSubscriptionStream;
30
+ }
27
31
  type FrameParser<T> = (frame: FrameRecord) => SubscriptionItem<T>;
28
32
  declare class SubscriptionStream<T> implements Subscription<T> {
29
33
  #private;
@@ -64,6 +68,6 @@ export declare class WatchSubscriptionStream implements AsyncIterator<WatchSubsc
64
68
  return(): Promise<IteratorResult<WatchSubscriptionItem>>;
65
69
  throw(error?: unknown): Promise<IteratorResult<WatchSubscriptionItem>>;
66
70
  cancel(): Promise<void>;
67
- reconnect(freshConnection: Connection): Promise<import('./client.js').WatchSubscription>;
71
+ reconnect(freshConnection: Connection): Promise<WatchSubscription>;
68
72
  }
69
73
  export {};
@@ -54,6 +54,7 @@ function assertRequestDefinition(definition, value, code) {
54
54
  const details = (validate.errors ?? []).map((error) => `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`).join('; ');
55
55
  throw new errors_js_1.ClusterRequestError(`${definition} validation failed: ${details}`, code);
56
56
  }
57
+ /** Validate an execution graph against the frozen cluster protocol schema. */
57
58
  function assertGraphSpec(value) {
58
59
  assertRequestDefinition('GraphSpec', value, 'INVALID_GRAPH');
59
60
  }
@@ -0,0 +1,7 @@
1
+ import type { ClusterMethod, GraphProfile, GraphSpec, ServerCapabilities } from './generated/protocol.js';
2
+ export declare function assertDefinition(definition: string, value: unknown): void;
3
+ export declare function assertMethodResult(method: ClusterMethod, value: unknown): void;
4
+ /** Validate an execution graph against the frozen cluster protocol schema. */
5
+ export declare function assertGraphSpec(value: unknown): asserts value is GraphSpec;
6
+ export declare function assertGraphProfile(value: unknown): asserts value is GraphProfile;
7
+ export declare function assertGraphProfileSupported(profile: GraphProfile, capabilities: ServerCapabilities): void;
@@ -0,0 +1,7 @@
1
+ import type { ClusterMethod, GraphProfile, GraphSpec, ServerCapabilities } from './generated/protocol.js';
2
+ export declare function assertDefinition(definition: string, value: unknown): void;
3
+ export declare function assertMethodResult(method: ClusterMethod, value: unknown): void;
4
+ /** Validate an execution graph against the frozen cluster protocol schema. */
5
+ export declare function assertGraphSpec(value: unknown): asserts value is GraphSpec;
6
+ export declare function assertGraphProfile(value: unknown): asserts value is GraphProfile;
7
+ export declare function assertGraphProfileSupported(profile: GraphProfile, capabilities: ServerCapabilities): void;
@@ -1,6 +1,7 @@
1
1
  import type { ClusterMethod, GraphProfile, GraphSpec, ServerCapabilities } from './generated/protocol.js';
2
2
  export declare function assertDefinition(definition: string, value: unknown): void;
3
3
  export declare function assertMethodResult(method: ClusterMethod, value: unknown): void;
4
+ /** Validate an execution graph against the frozen cluster protocol schema. */
4
5
  export declare function assertGraphSpec(value: unknown): asserts value is GraphSpec;
5
6
  export declare function assertGraphProfile(value: unknown): asserts value is GraphProfile;
6
7
  export declare function assertGraphProfileSupported(profile: GraphProfile, capabilities: ServerCapabilities): void;
@@ -47,6 +47,7 @@ function assertRequestDefinition(definition, value, code) {
47
47
  const details = (validate.errors ?? []).map((error) => `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`).join('; ');
48
48
  throw new ClusterRequestError(`${definition} validation failed: ${details}`, code);
49
49
  }
50
+ /** Validate an execution graph against the frozen cluster protocol schema. */
50
51
  export function assertGraphSpec(value) {
51
52
  assertRequestDefinition('GraphSpec', value, 'INVALID_GRAPH');
52
53
  }
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const PUBLIC_ADAPTER_METHODS = Object.freeze([
4
+ 'start',
5
+ 'status',
6
+ 'stop',
7
+ 'waitForCleanup',
8
+ 'close',
9
+ ]);
10
+
11
+ function createAdapterFacade(adapter) {
12
+ return Object.freeze(
13
+ Object.fromEntries(PUBLIC_ADAPTER_METHODS.map((name) => [name, adapter[name].bind(adapter)]))
14
+ );
15
+ }
16
+
17
+ function requestText(request, artifactText) {
18
+ if (request.source === 'issue') return request.issue;
19
+ if (request.source === 'prompt') return request.prompt;
20
+ return typeof artifactText === 'function' ? artifactText() : artifactText;
21
+ }
22
+
23
+ function declaredFailureEvent() {
24
+ return { type: 'failed', code: 'crash', reason: 'declared_failure' };
25
+ }
26
+
27
+ function frozenResourceStatus(resource, state, details) {
28
+ if (!resource) return null;
29
+ return Object.freeze({ clusterId: resource.clusterId, state, ...details });
30
+ }
31
+
32
+ module.exports = {
33
+ createAdapterFacade,
34
+ declaredFailureEvent,
35
+ frozenResourceStatus,
36
+ requestText,
37
+ };