@the-open-engine/zeroshot 6.28.0 → 6.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +3 -3
  2. package/cli/index.js +20 -224
  3. package/docker/zeroshot-cluster/Dockerfile +2 -3
  4. package/lib/cluster/client.cjs +30 -7
  5. package/lib/cluster/client.d.cts +52 -0
  6. package/lib/cluster/client.d.mts +52 -0
  7. package/lib/cluster/client.d.ts +4 -6
  8. package/lib/cluster/client.mjs +32 -9
  9. package/lib/cluster/connection-state.cjs +25 -0
  10. package/lib/cluster/connection-state.d.cts +13 -0
  11. package/lib/cluster/connection-state.d.mts +13 -0
  12. package/lib/cluster/connection-state.d.ts +13 -0
  13. package/lib/cluster/connection-state.mjs +21 -0
  14. package/lib/cluster/connection-types.cjs +2 -0
  15. package/lib/cluster/connection-types.d.cts +33 -0
  16. package/lib/cluster/connection-types.d.mts +33 -0
  17. package/lib/cluster/connection-types.d.ts +33 -0
  18. package/lib/cluster/connection-types.mjs +1 -0
  19. package/lib/cluster/connection.cjs +18 -46
  20. package/lib/cluster/connection.d.cts +26 -0
  21. package/lib/cluster/connection.d.mts +26 -0
  22. package/lib/cluster/connection.d.ts +7 -25
  23. package/lib/cluster/connection.mjs +12 -42
  24. package/lib/cluster/errors.cjs +9 -1
  25. package/lib/cluster/errors.d.cts +29 -0
  26. package/lib/cluster/errors.d.mts +29 -0
  27. package/lib/cluster/errors.d.ts +4 -0
  28. package/lib/cluster/errors.mjs +7 -0
  29. package/lib/cluster/frames.d.cts +12 -0
  30. package/lib/cluster/frames.d.mts +12 -0
  31. package/lib/cluster/generated/protocol-schema.d.cts +1 -0
  32. package/lib/cluster/generated/protocol-schema.d.mts +1 -0
  33. package/lib/cluster/generated/protocol.d.cts +781 -0
  34. package/lib/cluster/generated/protocol.d.mts +781 -0
  35. package/lib/cluster/index.cjs +2 -2
  36. package/lib/cluster/index.d.cts +13 -0
  37. package/lib/cluster/index.d.mts +13 -0
  38. package/lib/cluster/index.d.ts +3 -3
  39. package/lib/cluster/index.mjs +2 -2
  40. package/lib/cluster/json-source.cjs +1 -0
  41. package/lib/cluster/json-source.d.cts +5 -0
  42. package/lib/cluster/json-source.d.mts +5 -0
  43. package/lib/cluster/json-source.d.ts +1 -0
  44. package/lib/cluster/json-source.mjs +1 -0
  45. package/lib/cluster/payload-value.cjs +1 -0
  46. package/lib/cluster/payload-value.d.cts +8 -0
  47. package/lib/cluster/payload-value.d.mts +8 -0
  48. package/lib/cluster/payload-value.d.ts +1 -0
  49. package/lib/cluster/payload-value.mjs +1 -0
  50. package/lib/cluster/queue.d.cts +15 -0
  51. package/lib/cluster/queue.d.mts +15 -0
  52. package/lib/cluster/socket.cjs +8 -0
  53. package/lib/cluster/socket.d.cts +13 -0
  54. package/lib/cluster/socket.d.mts +13 -0
  55. package/lib/cluster/socket.d.ts +2 -0
  56. package/lib/cluster/socket.mjs +7 -0
  57. package/lib/cluster/subscriptions.d.cts +73 -0
  58. package/lib/cluster/subscriptions.d.mts +73 -0
  59. package/lib/cluster/subscriptions.d.ts +5 -1
  60. package/lib/cluster/validators.cjs +1 -0
  61. package/lib/cluster/validators.d.cts +7 -0
  62. package/lib/cluster/validators.d.mts +7 -0
  63. package/lib/cluster/validators.d.ts +1 -0
  64. package/lib/cluster/validators.mjs +1 -0
  65. package/lib/cluster-worker/engine-adapter.js +1 -11
  66. package/lib/cluster-worker/engine-input.js +14 -0
  67. package/lib/hosted-session/authority.cjs +61 -0
  68. package/lib/hosted-session/authority.d.cts +3 -0
  69. package/lib/hosted-session/authority.d.mts +3 -0
  70. package/lib/hosted-session/authority.d.ts +3 -0
  71. package/lib/hosted-session/authority.mjs +57 -0
  72. package/lib/hosted-session/coordinator.cjs +78 -51
  73. package/lib/hosted-session/coordinator.d.cts +11 -0
  74. package/lib/hosted-session/coordinator.d.mts +11 -0
  75. package/lib/hosted-session/coordinator.d.ts +4 -2
  76. package/lib/hosted-session/coordinator.mjs +75 -51
  77. package/lib/hosted-session/errors.cjs +25 -0
  78. package/lib/hosted-session/errors.d.cts +10 -0
  79. package/lib/hosted-session/errors.d.mts +10 -0
  80. package/lib/hosted-session/errors.d.ts +10 -0
  81. package/lib/hosted-session/errors.mjs +19 -0
  82. package/lib/hosted-session/index.cjs +4 -1
  83. package/lib/hosted-session/index.d.cts +2 -0
  84. package/lib/hosted-session/index.d.mts +2 -0
  85. package/lib/hosted-session/index.d.ts +2 -2
  86. package/lib/hosted-session/index.mjs +1 -1
  87. package/lib/hosted-session/reconnecting-watch.cjs +131 -0
  88. package/lib/hosted-session/reconnecting-watch.d.cts +13 -0
  89. package/lib/hosted-session/reconnecting-watch.d.mts +13 -0
  90. package/lib/hosted-session/reconnecting-watch.d.ts +13 -0
  91. package/lib/hosted-session/reconnecting-watch.mjs +127 -0
  92. package/lib/hosted-session/types.d.cts +32 -0
  93. package/lib/hosted-session/types.d.mts +32 -0
  94. package/lib/hosted-session/types.d.ts +19 -7
  95. package/lib/hosted-target/access-url.cjs +44 -0
  96. package/lib/hosted-target/access-url.d.cts +2 -0
  97. package/lib/hosted-target/access-url.d.mts +2 -0
  98. package/lib/hosted-target/access-url.d.ts +2 -0
  99. package/lib/hosted-target/access-url.mjs +41 -0
  100. package/lib/hosted-target/adapter-request.cjs +12 -0
  101. package/lib/hosted-target/adapter-request.d.cts +17 -0
  102. package/lib/hosted-target/adapter-request.d.mts +17 -0
  103. package/lib/hosted-target/adapter-request.d.ts +17 -0
  104. package/lib/hosted-target/adapter-request.mjs +9 -0
  105. package/lib/hosted-target/adapter-types.cjs +2 -0
  106. package/lib/hosted-target/adapter-types.d.cts +27 -0
  107. package/lib/hosted-target/adapter-types.d.mts +27 -0
  108. package/lib/hosted-target/adapter-types.d.ts +27 -0
  109. package/lib/hosted-target/adapter-types.mjs +1 -0
  110. package/lib/hosted-target/bounds.cjs +10 -0
  111. package/lib/hosted-target/bounds.d.cts +7 -0
  112. package/lib/hosted-target/bounds.d.mts +7 -0
  113. package/lib/hosted-target/bounds.d.ts +7 -0
  114. package/lib/hosted-target/bounds.mjs +7 -0
  115. package/lib/hosted-target/capsule-error-response.cjs +76 -0
  116. package/lib/hosted-target/capsule-error-response.d.cts +2 -0
  117. package/lib/hosted-target/capsule-error-response.d.mts +2 -0
  118. package/lib/hosted-target/capsule-error-response.d.ts +2 -0
  119. package/lib/hosted-target/capsule-error-response.mjs +73 -0
  120. package/lib/hosted-target/errors.cjs +88 -0
  121. package/lib/hosted-target/errors.d.cts +36 -0
  122. package/lib/hosted-target/errors.d.mts +36 -0
  123. package/lib/hosted-target/errors.d.ts +36 -0
  124. package/lib/hosted-target/errors.mjs +75 -0
  125. package/lib/hosted-target/index.cjs +16 -0
  126. package/lib/hosted-target/index.d.cts +3 -0
  127. package/lib/hosted-target/index.d.mts +3 -0
  128. package/lib/hosted-target/index.d.ts +3 -0
  129. package/lib/hosted-target/index.mjs +2 -0
  130. package/lib/hosted-target/response-validation.cjs +169 -0
  131. package/lib/hosted-target/response-validation.d.cts +5 -0
  132. package/lib/hosted-target/response-validation.d.mts +5 -0
  133. package/lib/hosted-target/response-validation.d.ts +5 -0
  134. package/lib/hosted-target/response-validation.mjs +163 -0
  135. package/lib/hosted-target/retry-executor.cjs +51 -0
  136. package/lib/hosted-target/retry-executor.d.cts +8 -0
  137. package/lib/hosted-target/retry-executor.d.mts +8 -0
  138. package/lib/hosted-target/retry-executor.d.ts +8 -0
  139. package/lib/hosted-target/retry-executor.mjs +48 -0
  140. package/lib/hosted-target/retry.cjs +78 -0
  141. package/lib/hosted-target/retry.d.cts +9 -0
  142. package/lib/hosted-target/retry.d.mts +9 -0
  143. package/lib/hosted-target/retry.d.ts +9 -0
  144. package/lib/hosted-target/retry.mjs +73 -0
  145. package/lib/hosted-target/target-adapter.cjs +10 -0
  146. package/lib/hosted-target/target-adapter.d.cts +3 -0
  147. package/lib/hosted-target/target-adapter.d.mts +3 -0
  148. package/lib/hosted-target/target-adapter.d.ts +3 -0
  149. package/lib/hosted-target/target-adapter.mjs +7 -0
  150. package/lib/hosted-target/types.cjs +4 -0
  151. package/lib/hosted-target/types.d.cts +50 -0
  152. package/lib/hosted-target/types.d.mts +50 -0
  153. package/lib/hosted-target/types.d.ts +50 -0
  154. package/lib/hosted-target/types.mjs +1 -0
  155. package/lib/hosted-target/zero-cloud-v1-adapter.cjs +185 -0
  156. package/lib/hosted-target/zero-cloud-v1-adapter.d.cts +13 -0
  157. package/lib/hosted-target/zero-cloud-v1-adapter.d.mts +13 -0
  158. package/lib/hosted-target/zero-cloud-v1-adapter.d.ts +13 -0
  159. package/lib/hosted-target/zero-cloud-v1-adapter.mjs +181 -0
  160. package/lib/target/bounded-response.cjs +51 -0
  161. package/lib/target/bounded-response.d.cts +1 -0
  162. package/lib/target/bounded-response.d.mts +1 -0
  163. package/lib/target/bounded-response.d.ts +1 -0
  164. package/lib/target/bounded-response.js +51 -0
  165. package/lib/target/bounded-response.mjs +48 -0
  166. package/lib/target/credential-lock.js +1 -3
  167. package/lib/target/credential-store.js +9 -4
  168. package/lib/target/device-flow.cjs +213 -0
  169. package/lib/target/device-flow.d.cts +54 -0
  170. package/lib/target/device-flow.d.mts +54 -0
  171. package/lib/target/device-flow.d.ts +26 -10
  172. package/lib/target/device-flow.js +162 -53
  173. package/lib/target/device-flow.mjs +203 -0
  174. package/lib/target/discovery-errors.cjs +10 -0
  175. package/lib/target/discovery-errors.d.cts +3 -0
  176. package/lib/target/discovery-errors.d.mts +3 -0
  177. package/lib/target/discovery-errors.d.ts +3 -0
  178. package/lib/target/discovery-errors.js +10 -0
  179. package/lib/target/discovery-errors.mjs +6 -0
  180. package/lib/target/discovery-sections.cjs +191 -0
  181. package/lib/target/discovery-sections.d.cts +52 -0
  182. package/lib/target/discovery-sections.d.mts +52 -0
  183. package/lib/target/discovery-sections.d.ts +52 -0
  184. package/lib/target/discovery-sections.js +191 -0
  185. package/lib/target/discovery-sections.mjs +179 -0
  186. package/lib/target/discovery-validation.cjs +109 -0
  187. package/lib/target/discovery-validation.d.cts +28 -0
  188. package/lib/target/discovery-validation.d.mts +28 -0
  189. package/lib/target/discovery-validation.d.ts +28 -0
  190. package/lib/target/discovery-validation.js +109 -0
  191. package/lib/target/discovery-validation.mjs +99 -0
  192. package/lib/target/discovery.cjs +112 -0
  193. package/lib/target/discovery.d.cts +74 -0
  194. package/lib/target/discovery.d.mts +74 -0
  195. package/lib/target/discovery.d.ts +68 -5
  196. package/lib/target/discovery.js +93 -101
  197. package/lib/target/discovery.mjs +105 -0
  198. package/lib/target/index.d.ts +6 -6
  199. package/lib/target/index.js +36 -36
  200. package/lib/target/oauth-http.d.ts +2 -0
  201. package/lib/target/oauth-http.js +25 -0
  202. package/lib/target/refresh-exchange.d.ts +11 -0
  203. package/lib/target/refresh-exchange.js +24 -0
  204. package/lib/target/refresh-revocation.d.ts +8 -0
  205. package/lib/target/refresh-revocation.js +19 -0
  206. package/lib/target/route-template.cjs +85 -0
  207. package/lib/target/route-template.d.cts +7 -0
  208. package/lib/target/route-template.d.mts +7 -0
  209. package/lib/target/route-template.d.ts +7 -0
  210. package/lib/target/route-template.js +85 -0
  211. package/lib/target/route-template.mjs +81 -0
  212. package/lib/target/session-errors.d.ts +4 -0
  213. package/lib/target/session-errors.js +12 -0
  214. package/lib/target/session-verification.d.ts +10 -0
  215. package/lib/target/session-verification.js +42 -0
  216. package/lib/target/target-registry.d.ts +7 -3
  217. package/lib/target/target-registry.js +41 -10
  218. package/lib/target/target-session-manager.d.ts +48 -0
  219. package/lib/target/target-session-manager.js +226 -0
  220. package/lib/target/target-session.d.ts +39 -31
  221. package/lib/target/target-session.js +63 -150
  222. package/lib/target/token-response.cjs +51 -0
  223. package/lib/target/token-response.d.cts +7 -0
  224. package/lib/target/token-response.d.mts +7 -0
  225. package/lib/target/token-response.d.ts +7 -0
  226. package/lib/target/token-response.js +51 -0
  227. package/lib/target/token-response.mjs +48 -0
  228. package/package.json +16 -6
  229. package/scripts/audit-production-dependencies.js +150 -0
  230. package/scripts/build-cluster.js +23 -3
  231. package/scripts/opcore-agent-gate.js +159 -0
  232. package/scripts/opcore-agent-tool-overlays.js +154 -0
  233. package/scripts/opcore-introduced-check.js +288 -0
  234. package/src/cluster/client.ts +42 -15
  235. package/src/cluster/connection-state.ts +33 -0
  236. package/src/cluster/connection-types.ts +28 -0
  237. package/src/cluster/connection.ts +37 -68
  238. package/src/cluster/errors.ts +5 -0
  239. package/src/cluster/index.ts +3 -1
  240. package/src/cluster/json-source.ts +1 -0
  241. package/src/cluster/payload-value.ts +1 -0
  242. package/src/cluster/socket.ts +13 -0
  243. package/src/cluster/subscriptions.ts +7 -2
  244. package/src/cluster/validators.ts +1 -0
  245. package/src/cluster/ws.d.ts +1 -1
  246. package/src/hosted-session/authority.ts +77 -0
  247. package/src/hosted-session/coordinator.ts +113 -56
  248. package/src/hosted-session/errors.ts +21 -0
  249. package/src/hosted-session/index.ts +14 -2
  250. package/src/hosted-session/reconnecting-watch.ts +148 -0
  251. package/src/hosted-session/types.ts +22 -8
  252. package/src/hosted-target/access-url.ts +46 -0
  253. package/src/hosted-target/adapter-request.ts +28 -0
  254. package/src/hosted-target/adapter-types.ts +39 -0
  255. package/src/hosted-target/bounds.ts +1 -0
  256. package/src/hosted-target/capsule-error-response.ts +107 -0
  257. package/src/hosted-target/errors.ts +36 -35
  258. package/src/hosted-target/index.ts +10 -23
  259. package/src/hosted-target/response-validation.ts +170 -62
  260. package/src/hosted-target/retry-executor.ts +62 -0
  261. package/src/hosted-target/retry.ts +47 -11
  262. package/src/hosted-target/target-adapter.ts +12 -8
  263. package/src/hosted-target/types.ts +19 -18
  264. package/src/hosted-target/zero-cloud-v1-adapter.ts +229 -316
  265. package/src/target/bounded-response.ts +68 -0
  266. package/src/target/credential-lock.ts +1 -3
  267. package/src/target/credential-store.ts +14 -10
  268. package/src/target/device-flow.ts +206 -71
  269. package/src/target/discovery-errors.ts +6 -0
  270. package/src/target/discovery-sections.ts +251 -0
  271. package/src/target/discovery-validation.ts +144 -0
  272. package/src/target/discovery.ts +163 -115
  273. package/src/target/index.ts +15 -11
  274. package/src/target/oauth-http.ts +27 -0
  275. package/src/target/refresh-exchange.ts +36 -0
  276. package/src/target/refresh-revocation.ts +29 -0
  277. package/src/target/route-template.ts +105 -0
  278. package/src/target/session-errors.ts +9 -0
  279. package/src/target/session-verification.ts +51 -0
  280. package/src/target/target-registry.ts +60 -27
  281. package/src/target/target-session-manager.ts +285 -0
  282. package/src/target/target-session.ts +105 -222
  283. package/src/target/token-response.ts +62 -0
@@ -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
  }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { cloneJson } = require('./object-utils');
4
+ const { inputFromRequest } = require('./engine-input');
4
5
 
5
6
  const TERMINAL_TOPICS = new Set(['CLUSTER_COMPLETE', 'CLUSTER_FAILED']);
6
7
 
@@ -28,17 +29,6 @@ function terminalEventFromMessage(message) {
28
29
  };
29
30
  }
30
31
 
31
- function inputFromRequest(request, artifactManifest) {
32
- if (request.source === 'issue') return { issue: request.issue };
33
- if (request.source === 'prompt') return { text: request.prompt };
34
- return {
35
- text:
36
- 'Execute the task described by this registry-staged, byte-free artifact manifest. ' +
37
- 'Do not request interactive input.\n' +
38
- JSON.stringify(artifactManifest),
39
- };
40
- }
41
-
42
32
  function resolveOrchestrator(options) {
43
33
  if (options.orchestrator) return options.orchestrator;
44
34
  const Orchestrator = options.Orchestrator || require('../../src/orchestrator');
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ function inputFromRequest(request, artifactManifest) {
4
+ if (request.source === 'issue') return { issue: request.issue };
5
+ if (request.source === 'prompt') return { text: request.prompt };
6
+ return {
7
+ text:
8
+ 'Execute the task described by this registry-staged, byte-free artifact manifest. ' +
9
+ 'Do not request interactive input.\n' +
10
+ JSON.stringify(artifactManifest),
11
+ };
12
+ }
13
+
14
+ module.exports = { inputFromRequest };
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizedAuthority = normalizedAuthority;
4
+ exports.validateHostedAccess = validateHostedAccess;
5
+ const index_js_1 = require("../cluster/index.cjs");
6
+ const LOOPBACK_HOSTS = Object.freeze({
7
+ '127.0.0.1': true,
8
+ '::1': true,
9
+ '[::1]': true,
10
+ });
11
+ function parseCanonicalUrl(value, message, code) {
12
+ try {
13
+ if (/[\u0000-\u0020\u007f]/.test(value))
14
+ throw new TypeError('unsafe URL code point');
15
+ const url = new URL(value);
16
+ if (url.href !== value && url.origin !== value)
17
+ throw new TypeError('non-canonical URL');
18
+ return url;
19
+ }
20
+ catch {
21
+ throw new index_js_1.ClusterConfigError(message, code);
22
+ }
23
+ }
24
+ function hasOriginSuffix(url) {
25
+ return Boolean(url.username ||
26
+ url.password ||
27
+ url.pathname !== '/' ||
28
+ url.search ||
29
+ url.hash);
30
+ }
31
+ function normalizedAuthority(value) {
32
+ const message = 'targetAuthority must be an HTTPS or literal-loopback HTTP origin';
33
+ const url = parseCanonicalUrl(value, message, 'INVALID_TARGET_AUTHORITY');
34
+ const loopbackHttp = url.protocol === 'http:' && LOOPBACK_HOSTS[url.hostname] === true;
35
+ if ((url.protocol !== 'https:' && !loopbackHttp) || hasOriginSuffix(url) ||
36
+ value !== url.origin) {
37
+ throw new index_js_1.ClusterConfigError(message, 'INVALID_TARGET_AUTHORITY');
38
+ }
39
+ return url.origin;
40
+ }
41
+ function accessAuthorityMatches(endpoint, target) {
42
+ const expectedProtocol = target.protocol === 'http:' ? 'ws:' : 'wss:';
43
+ return (endpoint.protocol === expectedProtocol &&
44
+ endpoint.host === target.host &&
45
+ !endpoint.username &&
46
+ !endpoint.password &&
47
+ !endpoint.search &&
48
+ !endpoint.hash);
49
+ }
50
+ function validateHostedAccess(access, targetAuthority) {
51
+ const endpoint = parseCanonicalUrl(access.websocketUrl, 'access endpoint must be an absolute target WebSocket URL', 'INVALID_ACCESS_ENDPOINT');
52
+ if (endpoint.href !== access.websocketUrl ||
53
+ !accessAuthorityMatches(endpoint, new URL(targetAuthority))) {
54
+ throw new index_js_1.ClusterConfigError('access endpoint must remain on the exact target authority', 'INVALID_ACCESS_ENDPOINT');
55
+ }
56
+ if (access.protocol !== 'openengine.cluster/v1' ||
57
+ access.tokenType !== 'Bearer' ||
58
+ access.accessToken.length === 0) {
59
+ throw new index_js_1.ClusterConfigError('access grant does not match the hosted session contract', 'INVALID_ACCESS_GRANT');
60
+ }
61
+ }
@@ -0,0 +1,3 @@
1
+ import type { HostedAccess } from './types.js';
2
+ export declare function normalizedAuthority(value: string): string;
3
+ export declare function validateHostedAccess(access: HostedAccess, targetAuthority: string): void;
@@ -0,0 +1,3 @@
1
+ import type { HostedAccess } from './types.js';
2
+ export declare function normalizedAuthority(value: string): string;
3
+ export declare function validateHostedAccess(access: HostedAccess, targetAuthority: string): void;
@@ -0,0 +1,3 @@
1
+ import type { HostedAccess } from './types.js';
2
+ export declare function normalizedAuthority(value: string): string;
3
+ export declare function validateHostedAccess(access: HostedAccess, targetAuthority: string): void;