@pellux/goodvibes-sdk 0.37.2 → 1.0.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 (555) hide show
  1. package/dist/contracts/artifacts/operator-contract.json +3171 -929
  2. package/dist/daemon.d.ts +2 -0
  3. package/dist/daemon.d.ts.map +1 -1
  4. package/dist/daemon.js +4 -0
  5. package/dist/events/communication.d.ts +21 -1
  6. package/dist/events/communication.d.ts.map +1 -1
  7. package/dist/events/surfaces.d.ts +25 -3
  8. package/dist/events/surfaces.d.ts.map +1 -1
  9. package/dist/events/surfaces.js +22 -1
  10. package/dist/events/workflows.d.ts +7 -6
  11. package/dist/events/workflows.d.ts.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/platform/agents/archetypes.d.ts.map +1 -1
  15. package/dist/platform/agents/archetypes.js +7 -0
  16. package/dist/platform/agents/index.d.ts +1 -0
  17. package/dist/platform/agents/index.d.ts.map +1 -1
  18. package/dist/platform/agents/index.js +1 -0
  19. package/dist/platform/agents/message-bus-core.d.ts +7 -0
  20. package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
  21. package/dist/platform/agents/message-bus-core.js +2 -1
  22. package/dist/platform/agents/orchestrator-runner.d.ts +50 -1
  23. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  24. package/dist/platform/agents/orchestrator-runner.js +172 -7
  25. package/dist/platform/agents/orchestrator.d.ts +78 -6
  26. package/dist/platform/agents/orchestrator.d.ts.map +1 -1
  27. package/dist/platform/agents/orchestrator.js +95 -18
  28. package/dist/platform/agents/planner-decomposition-runner.d.ts +38 -0
  29. package/dist/platform/agents/planner-decomposition-runner.d.ts.map +1 -0
  30. package/dist/platform/agents/planner-decomposition-runner.js +113 -0
  31. package/dist/platform/agents/turn-knowledge-injection.d.ts +192 -0
  32. package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -0
  33. package/dist/platform/agents/turn-knowledge-injection.js +269 -0
  34. package/dist/platform/agents/worktree.d.ts +126 -8
  35. package/dist/platform/agents/worktree.d.ts.map +1 -1
  36. package/dist/platform/agents/worktree.js +240 -19
  37. package/dist/platform/agents/wrfc-controller.d.ts +46 -0
  38. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  39. package/dist/platform/agents/wrfc-controller.js +213 -32
  40. package/dist/platform/agents/wrfc-gate-runtime.d.ts +9 -0
  41. package/dist/platform/agents/wrfc-gate-runtime.d.ts.map +1 -1
  42. package/dist/platform/agents/wrfc-gate-runtime.js +7 -3
  43. package/dist/platform/agents/wrfc-gates.d.ts +1 -1
  44. package/dist/platform/agents/wrfc-gates.d.ts.map +1 -1
  45. package/dist/platform/agents/wrfc-gates.js +7 -1
  46. package/dist/platform/agents/wrfc-types.d.ts +23 -3
  47. package/dist/platform/agents/wrfc-types.d.ts.map +1 -1
  48. package/dist/platform/automation/types.d.ts +9 -1
  49. package/dist/platform/automation/types.d.ts.map +1 -1
  50. package/dist/platform/calendar/calendar-api-shared.d.ts +25 -0
  51. package/dist/platform/calendar/calendar-api-shared.d.ts.map +1 -0
  52. package/dist/platform/calendar/calendar-api-shared.js +100 -0
  53. package/dist/platform/calendar/calendar-connector.d.ts +79 -0
  54. package/dist/platform/calendar/calendar-connector.d.ts.map +1 -0
  55. package/dist/platform/calendar/calendar-connector.js +155 -0
  56. package/dist/platform/calendar/google-calendar-api.d.ts +25 -0
  57. package/dist/platform/calendar/google-calendar-api.d.ts.map +1 -0
  58. package/dist/platform/calendar/google-calendar-api.js +89 -0
  59. package/dist/platform/calendar/http-fetch-adapter.d.ts +25 -0
  60. package/dist/platform/calendar/http-fetch-adapter.d.ts.map +1 -0
  61. package/dist/platform/calendar/http-fetch-adapter.js +25 -0
  62. package/dist/platform/calendar/ics-parser.d.ts +35 -0
  63. package/dist/platform/calendar/ics-parser.d.ts.map +1 -0
  64. package/dist/platform/calendar/ics-parser.js +236 -0
  65. package/dist/platform/calendar/index.d.ts +41 -0
  66. package/dist/platform/calendar/index.d.ts.map +1 -0
  67. package/dist/platform/calendar/index.js +49 -0
  68. package/dist/platform/calendar/merged-calendar-model.d.ts +67 -0
  69. package/dist/platform/calendar/merged-calendar-model.d.ts.map +1 -0
  70. package/dist/platform/calendar/merged-calendar-model.js +181 -0
  71. package/dist/platform/calendar/microsoft-graph-api.d.ts +25 -0
  72. package/dist/platform/calendar/microsoft-graph-api.d.ts.map +1 -0
  73. package/dist/platform/calendar/microsoft-graph-api.js +95 -0
  74. package/dist/platform/calendar/oauth-flow.d.ts +62 -0
  75. package/dist/platform/calendar/oauth-flow.d.ts.map +1 -0
  76. package/dist/platform/calendar/oauth-flow.js +305 -0
  77. package/dist/platform/calendar/oauth-providers.d.ts +43 -0
  78. package/dist/platform/calendar/oauth-providers.d.ts.map +1 -0
  79. package/dist/platform/calendar/oauth-providers.js +120 -0
  80. package/dist/platform/calendar/oauth-token-store.d.ts +72 -0
  81. package/dist/platform/calendar/oauth-token-store.d.ts.map +1 -0
  82. package/dist/platform/calendar/oauth-token-store.js +189 -0
  83. package/dist/platform/calendar/oauth-types.d.ts +274 -0
  84. package/dist/platform/calendar/oauth-types.d.ts.map +1 -0
  85. package/dist/platform/calendar/oauth-types.js +22 -0
  86. package/dist/platform/calendar/rrule.d.ts +39 -0
  87. package/dist/platform/calendar/rrule.d.ts.map +1 -0
  88. package/dist/platform/calendar/rrule.js +261 -0
  89. package/dist/platform/calendar/subscription-store.d.ts +118 -0
  90. package/dist/platform/calendar/subscription-store.d.ts.map +1 -0
  91. package/dist/platform/calendar/subscription-store.js +293 -0
  92. package/dist/platform/calendar/types.d.ts +170 -0
  93. package/dist/platform/calendar/types.d.ts.map +1 -0
  94. package/dist/platform/calendar/types.js +21 -0
  95. package/dist/platform/companion/companion-chat-attachments.d.ts +29 -0
  96. package/dist/platform/companion/companion-chat-attachments.d.ts.map +1 -0
  97. package/dist/platform/companion/companion-chat-attachments.js +121 -0
  98. package/dist/platform/companion/companion-chat-broker-bridge.d.ts +40 -0
  99. package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -0
  100. package/dist/platform/companion/companion-chat-broker-bridge.js +14 -0
  101. package/dist/platform/companion/companion-chat-broker-sync.d.ts +38 -0
  102. package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -0
  103. package/dist/platform/companion/companion-chat-broker-sync.js +80 -0
  104. package/dist/platform/companion/companion-chat-gc.d.ts +63 -0
  105. package/dist/platform/companion/companion-chat-gc.d.ts.map +1 -0
  106. package/dist/platform/companion/companion-chat-gc.js +38 -0
  107. package/dist/platform/companion/companion-chat-manager.d.ts +67 -20
  108. package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
  109. package/dist/platform/companion/companion-chat-manager.js +130 -144
  110. package/dist/platform/companion/companion-chat-persistence.d.ts +9 -1
  111. package/dist/platform/companion/companion-chat-persistence.d.ts.map +1 -1
  112. package/dist/platform/companion/companion-chat-persistence.js +10 -2
  113. package/dist/platform/companion/companion-chat-routes.d.ts +2 -1
  114. package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
  115. package/dist/platform/companion/companion-chat-routes.js +37 -4
  116. package/dist/platform/config/credential-status.d.ts +28 -0
  117. package/dist/platform/config/credential-status.d.ts.map +1 -0
  118. package/dist/platform/config/credential-status.js +75 -0
  119. package/dist/platform/config/index.d.ts +25 -0
  120. package/dist/platform/config/index.d.ts.map +1 -1
  121. package/dist/platform/config/index.js +18 -0
  122. package/dist/platform/config/manager.d.ts +18 -0
  123. package/dist/platform/config/manager.d.ts.map +1 -1
  124. package/dist/platform/config/manager.js +36 -2
  125. package/dist/platform/config/migrations.d.ts +48 -0
  126. package/dist/platform/config/migrations.d.ts.map +1 -0
  127. package/dist/platform/config/migrations.js +54 -0
  128. package/dist/platform/config/schema-domain-core.d.ts +10 -1
  129. package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
  130. package/dist/platform/config/schema-domain-core.js +46 -3
  131. package/dist/platform/config/schema-types.d.ts +13 -7
  132. package/dist/platform/config/schema-types.d.ts.map +1 -1
  133. package/dist/platform/config/schema.d.ts.map +1 -1
  134. package/dist/platform/config/schema.js +2 -0
  135. package/dist/platform/control-plane/approval-broker.d.ts +11 -0
  136. package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
  137. package/dist/platform/control-plane/approval-broker.js +17 -1
  138. package/dist/platform/control-plane/approval-hunk-apply.d.ts +77 -0
  139. package/dist/platform/control-plane/approval-hunk-apply.d.ts.map +1 -0
  140. package/dist/platform/control-plane/approval-hunk-apply.js +80 -0
  141. package/dist/platform/control-plane/gateway-disabled-response.d.ts +20 -0
  142. package/dist/platform/control-plane/gateway-disabled-response.d.ts.map +1 -0
  143. package/dist/platform/control-plane/gateway-disabled-response.js +24 -0
  144. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts +68 -0
  145. package/dist/platform/control-plane/gateway-scope-enforcement.d.ts.map +1 -0
  146. package/dist/platform/control-plane/gateway-scope-enforcement.js +91 -0
  147. package/dist/platform/control-plane/gateway-utils.d.ts +17 -0
  148. package/dist/platform/control-plane/gateway-utils.d.ts.map +1 -1
  149. package/dist/platform/control-plane/gateway-utils.js +30 -0
  150. package/dist/platform/control-plane/gateway.d.ts +12 -2
  151. package/dist/platform/control-plane/gateway.d.ts.map +1 -1
  152. package/dist/platform/control-plane/gateway.js +27 -31
  153. package/dist/platform/control-plane/index.d.ts +6 -1
  154. package/dist/platform/control-plane/index.d.ts.map +1 -1
  155. package/dist/platform/control-plane/index.js +4 -0
  156. package/dist/platform/control-plane/invoke-input-validation.d.ts +56 -0
  157. package/dist/platform/control-plane/invoke-input-validation.d.ts.map +1 -0
  158. package/dist/platform/control-plane/invoke-input-validation.js +163 -0
  159. package/dist/platform/control-plane/method-catalog-admin.d.ts.map +1 -1
  160. package/dist/platform/control-plane/method-catalog-admin.js +12 -1
  161. package/dist/platform/control-plane/method-catalog-calendar.d.ts +16 -0
  162. package/dist/platform/control-plane/method-catalog-calendar.d.ts.map +1 -1
  163. package/dist/platform/control-plane/method-catalog-calendar.js +21 -0
  164. package/dist/platform/control-plane/method-catalog-channels.d.ts.map +1 -1
  165. package/dist/platform/control-plane/method-catalog-channels.js +32 -3
  166. package/dist/platform/control-plane/method-catalog-control-automation.d.ts.map +1 -1
  167. package/dist/platform/control-plane/method-catalog-control-automation.js +19 -34
  168. package/dist/platform/control-plane/method-catalog-control-companion.d.ts +15 -0
  169. package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -0
  170. package/dist/platform/control-plane/method-catalog-control-companion.js +133 -0
  171. package/dist/platform/control-plane/method-catalog-control-core.d.ts.map +1 -1
  172. package/dist/platform/control-plane/method-catalog-control-core.js +104 -122
  173. package/dist/platform/control-plane/method-catalog-control.d.ts.map +1 -1
  174. package/dist/platform/control-plane/method-catalog-control.js +4 -0
  175. package/dist/platform/control-plane/method-catalog-email.d.ts +17 -0
  176. package/dist/platform/control-plane/method-catalog-email.d.ts.map +1 -1
  177. package/dist/platform/control-plane/method-catalog-email.js +21 -0
  178. package/dist/platform/control-plane/method-catalog-events.d.ts +28 -0
  179. package/dist/platform/control-plane/method-catalog-events.d.ts.map +1 -1
  180. package/dist/platform/control-plane/method-catalog-events.js +74 -1
  181. package/dist/platform/control-plane/method-catalog-fleet.d.ts +24 -0
  182. package/dist/platform/control-plane/method-catalog-fleet.d.ts.map +1 -0
  183. package/dist/platform/control-plane/method-catalog-fleet.js +65 -0
  184. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +84 -0
  185. package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts.map +1 -0
  186. package/dist/platform/control-plane/method-catalog-route-reconcile.js +103 -0
  187. package/dist/platform/control-plane/method-catalog-shared.d.ts +29 -0
  188. package/dist/platform/control-plane/method-catalog-shared.d.ts.map +1 -1
  189. package/dist/platform/control-plane/method-catalog.d.ts +9 -0
  190. package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
  191. package/dist/platform/control-plane/method-catalog.js +32 -3
  192. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts +8 -0
  193. package/dist/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
  194. package/dist/platform/control-plane/operator-contract-schemas-admin.js +22 -1
  195. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts +18 -0
  196. package/dist/platform/control-plane/operator-contract-schemas-fleet.d.ts.map +1 -0
  197. package/dist/platform/control-plane/operator-contract-schemas-fleet.js +182 -0
  198. package/dist/platform/control-plane/operator-contract-schemas-permissions.d.ts.map +1 -1
  199. package/dist/platform/control-plane/operator-contract-schemas-permissions.js +5 -0
  200. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +29 -0
  201. package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
  202. package/dist/platform/control-plane/operator-contract-schemas-runtime.js +57 -3
  203. package/dist/platform/control-plane/operator-contract-schemas.d.ts +1 -0
  204. package/dist/platform/control-plane/operator-contract-schemas.d.ts.map +1 -1
  205. package/dist/platform/control-plane/operator-contract-schemas.js +1 -0
  206. package/dist/platform/control-plane/operator-contract.d.ts.map +1 -1
  207. package/dist/platform/control-plane/operator-contract.js +8 -0
  208. package/dist/platform/control-plane/routes/checkpoints.d.ts +39 -0
  209. package/dist/platform/control-plane/routes/checkpoints.d.ts.map +1 -0
  210. package/dist/platform/control-plane/routes/checkpoints.js +166 -0
  211. package/dist/platform/control-plane/routes/fleet.d.ts +53 -0
  212. package/dist/platform/control-plane/routes/fleet.d.ts.map +1 -0
  213. package/dist/platform/control-plane/routes/fleet.js +153 -0
  214. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +30 -0
  215. package/dist/platform/control-plane/routes/gateway-verb-error.d.ts.map +1 -0
  216. package/dist/platform/control-plane/routes/gateway-verb-error.js +36 -0
  217. package/dist/platform/control-plane/routes/index.d.ts +0 -6
  218. package/dist/platform/control-plane/routes/index.d.ts.map +1 -1
  219. package/dist/platform/control-plane/routes/index.js +5 -5
  220. package/dist/platform/control-plane/routes/invocation-params.d.ts +23 -0
  221. package/dist/platform/control-plane/routes/invocation-params.d.ts.map +1 -0
  222. package/dist/platform/control-plane/routes/invocation-params.js +9 -0
  223. package/dist/platform/control-plane/routes/register-w3-s2.d.ts +26 -0
  224. package/dist/platform/control-plane/routes/register-w3-s2.d.ts.map +1 -0
  225. package/dist/platform/control-plane/routes/register-w3-s2.js +8 -0
  226. package/dist/platform/control-plane/routes/session-search.d.ts +37 -0
  227. package/dist/platform/control-plane/routes/session-search.d.ts.map +1 -0
  228. package/dist/platform/control-plane/routes/session-search.js +113 -0
  229. package/dist/platform/control-plane/session-broker-gc.d.ts +16 -0
  230. package/dist/platform/control-plane/session-broker-gc.d.ts.map +1 -1
  231. package/dist/platform/control-plane/session-broker-gc.js +23 -6
  232. package/dist/platform/control-plane/session-broker-helpers.d.ts +3 -3
  233. package/dist/platform/control-plane/session-broker-helpers.d.ts.map +1 -1
  234. package/dist/platform/control-plane/session-broker-inputs.d.ts +18 -0
  235. package/dist/platform/control-plane/session-broker-inputs.d.ts.map +1 -1
  236. package/dist/platform/control-plane/session-broker-inputs.js +34 -0
  237. package/dist/platform/control-plane/session-broker-sessions.d.ts +102 -3
  238. package/dist/platform/control-plane/session-broker-sessions.d.ts.map +1 -1
  239. package/dist/platform/control-plane/session-broker-sessions.js +179 -5
  240. package/dist/platform/control-plane/session-broker-state.d.ts +20 -1
  241. package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
  242. package/dist/platform/control-plane/session-broker-state.js +67 -5
  243. package/dist/platform/control-plane/session-broker.d.ts +51 -38
  244. package/dist/platform/control-plane/session-broker.d.ts.map +1 -1
  245. package/dist/platform/control-plane/session-broker.js +183 -75
  246. package/dist/platform/control-plane/session-store-importer.d.ts +57 -0
  247. package/dist/platform/control-plane/session-store-importer.d.ts.map +1 -0
  248. package/dist/platform/control-plane/session-store-importer.js +227 -0
  249. package/dist/platform/control-plane/session-types.d.ts +142 -7
  250. package/dist/platform/control-plane/session-types.d.ts.map +1 -1
  251. package/dist/platform/core/adaptive-planner.d.ts +50 -0
  252. package/dist/platform/core/adaptive-planner.d.ts.map +1 -1
  253. package/dist/platform/core/adaptive-planner.js +49 -0
  254. package/dist/platform/core/execution-plan.d.ts +43 -1
  255. package/dist/platform/core/execution-plan.d.ts.map +1 -1
  256. package/dist/platform/core/execution-plan.js +46 -10
  257. package/dist/platform/core/index.d.ts +2 -0
  258. package/dist/platform/core/index.d.ts.map +1 -1
  259. package/dist/platform/core/index.js +2 -0
  260. package/dist/platform/core/orchestrator-runtime.d.ts +31 -0
  261. package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
  262. package/dist/platform/core/orchestrator-tool-runtime.d.ts +7 -0
  263. package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  264. package/dist/platform/core/orchestrator-tool-runtime.js +10 -0
  265. package/dist/platform/core/orchestrator-turn-loop.d.ts +35 -1
  266. package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
  267. package/dist/platform/core/orchestrator-turn-loop.js +121 -3
  268. package/dist/platform/core/orchestrator.d.ts +67 -0
  269. package/dist/platform/core/orchestrator.d.ts.map +1 -1
  270. package/dist/platform/core/orchestrator.js +89 -1
  271. package/dist/platform/core/plan-decomposition.d.ts +196 -0
  272. package/dist/platform/core/plan-decomposition.d.ts.map +1 -0
  273. package/dist/platform/core/plan-decomposition.js +417 -0
  274. package/dist/platform/core/plan-proposal.d.ts +204 -0
  275. package/dist/platform/core/plan-proposal.d.ts.map +1 -0
  276. package/dist/platform/core/plan-proposal.js +296 -0
  277. package/dist/platform/core/wrfc-routing.d.ts +1 -0
  278. package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
  279. package/dist/platform/core/wrfc-routing.js +51 -1
  280. package/dist/platform/daemon/boot.d.ts +63 -0
  281. package/dist/platform/daemon/boot.d.ts.map +1 -0
  282. package/dist/platform/daemon/boot.js +60 -0
  283. package/dist/platform/daemon/cli.js +2 -1
  284. package/dist/platform/daemon/control-plane.d.ts.map +1 -1
  285. package/dist/platform/daemon/control-plane.js +50 -1
  286. package/dist/platform/daemon/facade-composition.d.ts.map +1 -1
  287. package/dist/platform/daemon/facade-composition.js +6 -0
  288. package/dist/platform/daemon/facade.d.ts +18 -6
  289. package/dist/platform/daemon/facade.d.ts.map +1 -1
  290. package/dist/platform/daemon/facade.js +50 -43
  291. package/dist/platform/daemon/http/router-route-contexts.d.ts +1 -0
  292. package/dist/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
  293. package/dist/platform/daemon/http/router-route-contexts.js +1 -0
  294. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +13 -0
  295. package/dist/platform/daemon/http/router-session-broker-adapter.d.ts.map +1 -0
  296. package/dist/platform/daemon/http/router-session-broker-adapter.js +27 -0
  297. package/dist/platform/daemon/http/router.d.ts +1 -1
  298. package/dist/platform/daemon/http/router.d.ts.map +1 -1
  299. package/dist/platform/daemon/http/router.js +7 -22
  300. package/dist/platform/daemon/http/runtime-route-types.d.ts +42 -4
  301. package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  302. package/dist/platform/daemon/index.d.ts +2 -0
  303. package/dist/platform/daemon/index.d.ts.map +1 -1
  304. package/dist/platform/daemon/index.js +1 -0
  305. package/dist/platform/daemon/service-manager.d.ts +16 -0
  306. package/dist/platform/daemon/service-manager.d.ts.map +1 -1
  307. package/dist/platform/daemon/service-manager.js +79 -15
  308. package/dist/platform/intelligence/tree-sitter/service.d.ts.map +1 -1
  309. package/dist/platform/intelligence/tree-sitter/service.js +16 -2
  310. package/dist/platform/knowledge/browser-history/readers.d.ts.map +1 -1
  311. package/dist/platform/knowledge/browser-history/readers.js +15 -5
  312. package/dist/platform/knowledge/knowledge-api.d.ts +26 -0
  313. package/dist/platform/knowledge/knowledge-api.d.ts.map +1 -1
  314. package/dist/platform/knowledge/knowledge-api.js +11 -0
  315. package/dist/platform/knowledge/project-planning/service.d.ts +14 -1
  316. package/dist/platform/knowledge/project-planning/service.d.ts.map +1 -1
  317. package/dist/platform/knowledge/project-planning/service.js +77 -0
  318. package/dist/platform/knowledge/project-planning/types.d.ts +32 -0
  319. package/dist/platform/knowledge/project-planning/types.d.ts.map +1 -1
  320. package/dist/platform/orchestration/bookkeeping.d.ts +12 -0
  321. package/dist/platform/orchestration/bookkeeping.d.ts.map +1 -0
  322. package/dist/platform/orchestration/bookkeeping.js +91 -0
  323. package/dist/platform/orchestration/budget.d.ts +22 -0
  324. package/dist/platform/orchestration/budget.d.ts.map +1 -0
  325. package/dist/platform/orchestration/budget.js +35 -0
  326. package/dist/platform/orchestration/cancellation.d.ts +31 -0
  327. package/dist/platform/orchestration/cancellation.d.ts.map +1 -0
  328. package/dist/platform/orchestration/cancellation.js +25 -0
  329. package/dist/platform/orchestration/controller-compat.d.ts +46 -0
  330. package/dist/platform/orchestration/controller-compat.d.ts.map +1 -0
  331. package/dist/platform/orchestration/controller-compat.js +27 -0
  332. package/dist/platform/orchestration/dirty-guard.d.ts +32 -0
  333. package/dist/platform/orchestration/dirty-guard.d.ts.map +1 -0
  334. package/dist/platform/orchestration/dirty-guard.js +147 -0
  335. package/dist/platform/orchestration/engine.d.ts +82 -0
  336. package/dist/platform/orchestration/engine.d.ts.map +1 -0
  337. package/dist/platform/orchestration/engine.js +623 -0
  338. package/dist/platform/orchestration/index.d.ts +20 -0
  339. package/dist/platform/orchestration/index.d.ts.map +1 -0
  340. package/dist/platform/orchestration/index.js +11 -0
  341. package/dist/platform/orchestration/persistence.d.ts +24 -0
  342. package/dist/platform/orchestration/persistence.d.ts.map +1 -0
  343. package/dist/platform/orchestration/persistence.js +179 -0
  344. package/dist/platform/orchestration/phase-runner.d.ts +114 -0
  345. package/dist/platform/orchestration/phase-runner.d.ts.map +1 -0
  346. package/dist/platform/orchestration/phase-runner.js +347 -0
  347. package/dist/platform/orchestration/proposal-workstream.d.ts +56 -0
  348. package/dist/platform/orchestration/proposal-workstream.d.ts.map +1 -0
  349. package/dist/platform/orchestration/proposal-workstream.js +76 -0
  350. package/dist/platform/orchestration/scheduler.d.ts +64 -0
  351. package/dist/platform/orchestration/scheduler.d.ts.map +1 -0
  352. package/dist/platform/orchestration/scheduler.js +73 -0
  353. package/dist/platform/orchestration/types.d.ts +535 -0
  354. package/dist/platform/orchestration/types.d.ts.map +1 -0
  355. package/dist/platform/orchestration/types.js +47 -0
  356. package/dist/platform/orchestration/worktree-isolation.d.ts +33 -0
  357. package/dist/platform/orchestration/worktree-isolation.d.ts.map +1 -0
  358. package/dist/platform/orchestration/worktree-isolation.js +248 -0
  359. package/dist/platform/presentation/glyphs.d.ts +91 -0
  360. package/dist/platform/presentation/glyphs.d.ts.map +1 -0
  361. package/dist/platform/presentation/glyphs.js +93 -0
  362. package/dist/platform/presentation/index.d.ts +28 -0
  363. package/dist/platform/presentation/index.d.ts.map +1 -0
  364. package/dist/platform/presentation/index.js +27 -0
  365. package/dist/platform/presentation/thinking-phrases.d.ts +12 -0
  366. package/dist/platform/presentation/thinking-phrases.d.ts.map +1 -0
  367. package/dist/platform/presentation/thinking-phrases.js +32 -0
  368. package/dist/platform/presentation/tones.d.ts +121 -0
  369. package/dist/platform/presentation/tones.d.ts.map +1 -0
  370. package/dist/platform/presentation/tones.js +145 -0
  371. package/dist/platform/presentation/waiting-wording.d.ts +54 -0
  372. package/dist/platform/presentation/waiting-wording.d.ts.map +1 -0
  373. package/dist/platform/presentation/waiting-wording.js +51 -0
  374. package/dist/platform/providers/runtime-snapshot.d.ts.map +1 -1
  375. package/dist/platform/providers/runtime-snapshot.js +12 -2
  376. package/dist/platform/runtime/bootstrap-services.d.ts +62 -2
  377. package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
  378. package/dist/platform/runtime/bootstrap-services.js +217 -50
  379. package/dist/platform/runtime/daemon-version-compat.d.ts +39 -0
  380. package/dist/platform/runtime/daemon-version-compat.d.ts.map +1 -0
  381. package/dist/platform/runtime/daemon-version-compat.js +75 -0
  382. package/dist/platform/runtime/detached-daemon-runtime.d.ts +26 -0
  383. package/dist/platform/runtime/detached-daemon-runtime.d.ts.map +1 -0
  384. package/dist/platform/runtime/detached-daemon-runtime.js +49 -0
  385. package/dist/platform/runtime/emitters/communication.d.ts +11 -0
  386. package/dist/platform/runtime/emitters/communication.d.ts.map +1 -1
  387. package/dist/platform/runtime/emitters/communication.js +9 -0
  388. package/dist/platform/runtime/emitters/workflows.d.ts +1 -1
  389. package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
  390. package/dist/platform/runtime/events/index.d.ts +13 -0
  391. package/dist/platform/runtime/events/index.d.ts.map +1 -1
  392. package/dist/platform/runtime/events/index.js +13 -0
  393. package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
  394. package/dist/platform/runtime/feature-flags/flags.js +56 -1
  395. package/dist/platform/runtime/fleet/adapters/agent.d.ts +56 -0
  396. package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -0
  397. package/dist/platform/runtime/fleet/adapters/agent.js +143 -0
  398. package/dist/platform/runtime/fleet/adapters/automation.d.ts +30 -0
  399. package/dist/platform/runtime/fleet/adapters/automation.d.ts.map +1 -0
  400. package/dist/platform/runtime/fleet/adapters/automation.js +41 -0
  401. package/dist/platform/runtime/fleet/adapters/background-process.d.ts +12 -0
  402. package/dist/platform/runtime/fleet/adapters/background-process.d.ts.map +1 -0
  403. package/dist/platform/runtime/fleet/adapters/background-process.js +46 -0
  404. package/dist/platform/runtime/fleet/adapters/code-index.d.ts +21 -0
  405. package/dist/platform/runtime/fleet/adapters/code-index.d.ts.map +1 -0
  406. package/dist/platform/runtime/fleet/adapters/code-index.js +44 -0
  407. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +69 -0
  408. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -0
  409. package/dist/platform/runtime/fleet/adapters/orchestration.js +329 -0
  410. package/dist/platform/runtime/fleet/adapters/schedule.d.ts +14 -0
  411. package/dist/platform/runtime/fleet/adapters/schedule.d.ts.map +1 -0
  412. package/dist/platform/runtime/fleet/adapters/schedule.js +28 -0
  413. package/dist/platform/runtime/fleet/adapters/trigger.d.ts +12 -0
  414. package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -0
  415. package/dist/platform/runtime/fleet/adapters/trigger.js +22 -0
  416. package/dist/platform/runtime/fleet/adapters/watcher.d.ts +13 -0
  417. package/dist/platform/runtime/fleet/adapters/watcher.d.ts.map +1 -0
  418. package/dist/platform/runtime/fleet/adapters/watcher.js +47 -0
  419. package/dist/platform/runtime/fleet/adapters/workflow.d.ts +11 -0
  420. package/dist/platform/runtime/fleet/adapters/workflow.d.ts.map +1 -0
  421. package/dist/platform/runtime/fleet/adapters/workflow.js +34 -0
  422. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +35 -0
  423. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -0
  424. package/dist/platform/runtime/fleet/adapters/wrfc.js +275 -0
  425. package/dist/platform/runtime/fleet/index.d.ts +10 -0
  426. package/dist/platform/runtime/fleet/index.d.ts.map +1 -0
  427. package/dist/platform/runtime/fleet/index.js +6 -0
  428. package/dist/platform/runtime/fleet/registry.d.ts +113 -0
  429. package/dist/platform/runtime/fleet/registry.d.ts.map +1 -0
  430. package/dist/platform/runtime/fleet/registry.js +664 -0
  431. package/dist/platform/runtime/fleet/types.d.ts +199 -0
  432. package/dist/platform/runtime/fleet/types.d.ts.map +1 -0
  433. package/dist/platform/runtime/fleet/types.js +2 -0
  434. package/dist/platform/runtime/operator-client.d.ts +20 -2
  435. package/dist/platform/runtime/operator-client.d.ts.map +1 -1
  436. package/dist/platform/runtime/operator-client.js +11 -1
  437. package/dist/platform/runtime/provider-accounts/registry.d.ts.map +1 -1
  438. package/dist/platform/runtime/provider-accounts/registry.js +11 -1
  439. package/dist/platform/runtime/runtime-knowledge-api.d.ts +1 -1
  440. package/dist/platform/runtime/runtime-knowledge-api.d.ts.map +1 -1
  441. package/dist/platform/runtime/runtime-knowledge-api.js +1 -0
  442. package/dist/platform/runtime/services.d.ts +48 -0
  443. package/dist/platform/runtime/services.d.ts.map +1 -1
  444. package/dist/platform/runtime/services.js +95 -2
  445. package/dist/platform/runtime/session-spine/client.d.ts +234 -0
  446. package/dist/platform/runtime/session-spine/client.d.ts.map +1 -0
  447. package/dist/platform/runtime/session-spine/client.js +449 -0
  448. package/dist/platform/runtime/session-spine/index.d.ts +12 -0
  449. package/dist/platform/runtime/session-spine/index.d.ts.map +1 -0
  450. package/dist/platform/runtime/session-spine/index.js +11 -0
  451. package/dist/platform/runtime/session-spine/union-cache.d.ts +225 -0
  452. package/dist/platform/runtime/session-spine/union-cache.d.ts.map +1 -0
  453. package/dist/platform/runtime/session-spine/union-cache.js +333 -0
  454. package/dist/platform/runtime/shell-command-ops.d.ts +3 -1
  455. package/dist/platform/runtime/shell-command-ops.d.ts.map +1 -1
  456. package/dist/platform/runtime/transports/daemon-http-client-validators.d.ts.map +1 -1
  457. package/dist/platform/runtime/transports/daemon-http-client-validators.js +22 -0
  458. package/dist/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
  459. package/dist/platform/runtime/transports/daemon-http-client.js +25 -2
  460. package/dist/platform/runtime/transports/http-types.d.ts +9 -2
  461. package/dist/platform/runtime/transports/http-types.d.ts.map +1 -1
  462. package/dist/platform/state/canonical-memory.d.ts +95 -0
  463. package/dist/platform/state/canonical-memory.d.ts.map +1 -0
  464. package/dist/platform/state/canonical-memory.js +155 -0
  465. package/dist/platform/state/code-index-chunking.d.ts +49 -0
  466. package/dist/platform/state/code-index-chunking.d.ts.map +1 -0
  467. package/dist/platform/state/code-index-chunking.js +111 -0
  468. package/dist/platform/state/code-index-db.d.ts +53 -0
  469. package/dist/platform/state/code-index-db.d.ts.map +1 -0
  470. package/dist/platform/state/code-index-db.js +101 -0
  471. package/dist/platform/state/code-index-reindex.d.ts +73 -0
  472. package/dist/platform/state/code-index-reindex.d.ts.map +1 -0
  473. package/dist/platform/state/code-index-reindex.js +156 -0
  474. package/dist/platform/state/code-index-store.d.ts +175 -0
  475. package/dist/platform/state/code-index-store.d.ts.map +1 -0
  476. package/dist/platform/state/code-index-store.js +620 -0
  477. package/dist/platform/state/index.d.ts +12 -2
  478. package/dist/platform/state/index.d.ts.map +1 -1
  479. package/dist/platform/state/index.js +6 -1
  480. package/dist/platform/state/knowledge-injection.d.ts +23 -0
  481. package/dist/platform/state/knowledge-injection.d.ts.map +1 -1
  482. package/dist/platform/state/knowledge-injection.js +34 -19
  483. package/dist/platform/state/memory-recall-contract.d.ts +63 -0
  484. package/dist/platform/state/memory-recall-contract.d.ts.map +1 -0
  485. package/dist/platform/state/memory-recall-contract.js +94 -0
  486. package/dist/platform/state/memory-store.d.ts +2 -0
  487. package/dist/platform/state/memory-store.d.ts.map +1 -1
  488. package/dist/platform/state/memory-store.js +4 -0
  489. package/dist/platform/state/memory-vector-store.d.ts +1 -13
  490. package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
  491. package/dist/platform/state/memory-vector-store.js +18 -39
  492. package/dist/platform/state/sqlite-store.d.ts +2 -0
  493. package/dist/platform/state/sqlite-store.d.ts.map +1 -1
  494. package/dist/platform/state/sqlite-store.js +4 -0
  495. package/dist/platform/state/sqlite-vec-loader.d.ts +25 -0
  496. package/dist/platform/state/sqlite-vec-loader.d.ts.map +1 -0
  497. package/dist/platform/state/sqlite-vec-loader.js +43 -0
  498. package/dist/platform/state/vibe-projection.d.ts +67 -0
  499. package/dist/platform/state/vibe-projection.d.ts.map +1 -0
  500. package/dist/platform/state/vibe-projection.js +115 -0
  501. package/dist/platform/tools/agent/index.d.ts.map +1 -1
  502. package/dist/platform/tools/agent/index.js +8 -0
  503. package/dist/platform/tools/agent/manager.d.ts +140 -1
  504. package/dist/platform/tools/agent/manager.d.ts.map +1 -1
  505. package/dist/platform/tools/agent/manager.js +143 -1
  506. package/dist/platform/tools/agent/schema.d.ts +26 -0
  507. package/dist/platform/tools/agent/schema.d.ts.map +1 -1
  508. package/dist/platform/tools/agent/schema.js +2 -2
  509. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts +13 -0
  510. package/dist/platform/tools/agent/wrfc-batch-policy.d.ts.map +1 -1
  511. package/dist/platform/tools/agent/wrfc-batch-policy.js +60 -0
  512. package/dist/platform/tools/exec/runtime.d.ts +10 -0
  513. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  514. package/dist/platform/tools/exec/runtime.js +161 -49
  515. package/dist/platform/tools/exec/schema.d.ts +3 -1
  516. package/dist/platform/tools/exec/schema.d.ts.map +1 -1
  517. package/dist/platform/tools/exec/schema.js +2 -1
  518. package/dist/platform/tools/fetch/runtime.d.ts +7 -0
  519. package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
  520. package/dist/platform/tools/fetch/runtime.js +8 -6
  521. package/dist/platform/tools/index.d.ts +2 -0
  522. package/dist/platform/tools/index.d.ts.map +1 -1
  523. package/dist/platform/tools/index.js +2 -0
  524. package/dist/platform/tools/registry.d.ts +9 -3
  525. package/dist/platform/tools/registry.d.ts.map +1 -1
  526. package/dist/platform/tools/registry.js +9 -3
  527. package/dist/platform/tools/state/index.d.ts +9 -0
  528. package/dist/platform/tools/state/index.d.ts.map +1 -1
  529. package/dist/platform/tools/state/index.js +60 -3
  530. package/dist/platform/types/foundation-contract.d.ts +1 -1
  531. package/dist/platform/types/foundation-contract.d.ts.map +1 -1
  532. package/dist/platform/types/index.d.ts +1 -1
  533. package/dist/platform/types/index.d.ts.map +1 -1
  534. package/dist/platform/types/tools.d.ts +14 -1
  535. package/dist/platform/types/tools.d.ts.map +1 -1
  536. package/dist/platform/version.js +1 -1
  537. package/package.json +29 -9
  538. package/dist/platform/control-plane/routes/automation.d.ts +0 -3
  539. package/dist/platform/control-plane/routes/automation.d.ts.map +0 -1
  540. package/dist/platform/control-plane/routes/automation.js +0 -63
  541. package/dist/platform/control-plane/routes/context.d.ts +0 -2
  542. package/dist/platform/control-plane/routes/context.d.ts.map +0 -1
  543. package/dist/platform/control-plane/routes/context.js +0 -1
  544. package/dist/platform/control-plane/routes/operator.d.ts +0 -8
  545. package/dist/platform/control-plane/routes/operator.d.ts.map +0 -1
  546. package/dist/platform/control-plane/routes/operator.js +0 -415
  547. package/dist/platform/control-plane/routes/remote.d.ts +0 -3
  548. package/dist/platform/control-plane/routes/remote.d.ts.map +0 -1
  549. package/dist/platform/control-plane/routes/remote.js +0 -35
  550. package/dist/platform/control-plane/routes/sessions.d.ts +0 -3
  551. package/dist/platform/control-plane/routes/sessions.d.ts.map +0 -1
  552. package/dist/platform/control-plane/routes/sessions.js +0 -43
  553. package/dist/platform/control-plane/routes/tasks.d.ts +0 -3
  554. package/dist/platform/control-plane/routes/tasks.d.ts.map +0 -1
  555. package/dist/platform/control-plane/routes/tasks.js +0 -22
@@ -0,0 +1,68 @@
1
+ /**
2
+ * gateway-scope-enforcement.ts
3
+ *
4
+ * Per-client delivery enforcement for the control-plane event fan-out. Two
5
+ * orthogonal, AND-ed filters live here:
6
+ * 1. Scope: some wire channels declare a read scope (e.g. `session-update` ⇒
7
+ * `read:sessions`); a scoped-down token cannot receive a channel it was not
8
+ * granted.
9
+ * 2. Domain: a broadcast event (published via `ControlPlaneGateway.publishEvent`,
10
+ * i.e. NOT flowing through a runtime-bus `onDomain` subscription) carries a
11
+ * `RuntimeEventDomain` tag; a client that opted into a narrower set of
12
+ * domains only receives events whose domain is in that set.
13
+ */
14
+ import type { RuntimeEventDomain } from '../runtime/events/index.js';
15
+ /**
16
+ * Wire events whose descriptor declares a read scope. Enforced per-client on the
17
+ * web SSE/WS fan-out so a scoped-down token cannot receive a channel it was not
18
+ * granted. In-process/local/service clients and admin tokens bypass (the
19
+ * single-admin-token model collapses scopes — see method-catalog-events.ts).
20
+ */
21
+ export declare const CHANNEL_REQUIRED_SCOPE: Readonly<Record<string, string>>;
22
+ /** The subset of a live client this decision needs. */
23
+ export interface ScopedClientView {
24
+ readonly kind: string;
25
+ readonly admin?: boolean | undefined;
26
+ readonly scopes?: readonly string[] | undefined;
27
+ }
28
+ /**
29
+ * Whether a live client may receive a scope-gated channel. Only web SSE/WS
30
+ * clients (which carry a principal's scopes) are filtered; in-process/local and
31
+ * service ('daemon') clients are trusted and always pass, and an admin token
32
+ * bypasses (single-admin-token model — scopes collapse). A `*` scope is a
33
+ * wildcard grant. A principal-scoped client is filtered only when it carries an
34
+ * explicit scopes array; internal streams with no scopes stay trusted.
35
+ */
36
+ export declare function clientMaySeeScopedChannel(client: ScopedClientView, requiredScope: string): boolean;
37
+ /**
38
+ * Maps a manually-broadcast wire event (published via
39
+ * `ControlPlaneGateway.publishEvent`) to the `RuntimeEventDomain` a client must
40
+ * have subscribed to in order to receive it. These events do NOT flow through a
41
+ * runtime-bus `onDomain` subscription — that path is already domain-scoped by the
42
+ * subscription itself — so without this map the fan-out ignored the subscriber's
43
+ * declared domains and over-delivered (e.g. `session-update` reached the webui,
44
+ * which declares no `session` domain and dropped it as inert).
45
+ *
46
+ * An event ABSENT from this map carries no domain tag and is delivered to every
47
+ * scope-permitted client regardless of its subscribed domains (deliver-all). That
48
+ * keeps domain scoping strictly opt-in narrowing: a newly-added broadcast event
49
+ * cannot be silently dropped just because it is not yet tagged here. New verbs
50
+ * (later waves) should register their broadcast events in this map.
51
+ */
52
+ export declare const EVENT_DOMAIN: Readonly<Record<string, RuntimeEventDomain>>;
53
+ /**
54
+ * Whether a live client that subscribed to `clientDomains` should receive
55
+ * `event` under the domain filter.
56
+ *
57
+ * `clientDomains === null` means the client did NOT opt into domain narrowing
58
+ * (it connected with no `?domains=` param) and receives everything it is
59
+ * scope-permitted to see — today's behavior, preserved. This null=deliver-all
60
+ * default is the only migration-safe choice: an empty-set-means-nothing default
61
+ * would silently black out every consumer that did not opt in.
62
+ *
63
+ * An event with no `EVENT_DOMAIN` tag is always delivered (untagged ⇒ inert to
64
+ * the domain filter), so narrowing can only ever remove events we can positively
65
+ * attribute to a domain the client did not subscribe to.
66
+ */
67
+ export declare function clientMayReceiveEventDomain(clientDomains: ReadonlySet<RuntimeEventDomain> | null, event: string): boolean;
68
+ //# sourceMappingURL=gateway-scope-enforcement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway-scope-enforcement.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway-scope-enforcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnE,CAAC;AAEF,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACjD;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAKlG;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAcrE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI,EACrD,KAAK,EAAE,MAAM,GACZ,OAAO,CAKT"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * gateway-scope-enforcement.ts
3
+ *
4
+ * Per-client delivery enforcement for the control-plane event fan-out. Two
5
+ * orthogonal, AND-ed filters live here:
6
+ * 1. Scope: some wire channels declare a read scope (e.g. `session-update` ⇒
7
+ * `read:sessions`); a scoped-down token cannot receive a channel it was not
8
+ * granted.
9
+ * 2. Domain: a broadcast event (published via `ControlPlaneGateway.publishEvent`,
10
+ * i.e. NOT flowing through a runtime-bus `onDomain` subscription) carries a
11
+ * `RuntimeEventDomain` tag; a client that opted into a narrower set of
12
+ * domains only receives events whose domain is in that set.
13
+ */
14
+ /**
15
+ * Wire events whose descriptor declares a read scope. Enforced per-client on the
16
+ * web SSE/WS fan-out so a scoped-down token cannot receive a channel it was not
17
+ * granted. In-process/local/service clients and admin tokens bypass (the
18
+ * single-admin-token model collapses scopes — see method-catalog-events.ts).
19
+ */
20
+ export const CHANNEL_REQUIRED_SCOPE = {
21
+ 'session-update': 'read:sessions',
22
+ };
23
+ /**
24
+ * Whether a live client may receive a scope-gated channel. Only web SSE/WS
25
+ * clients (which carry a principal's scopes) are filtered; in-process/local and
26
+ * service ('daemon') clients are trusted and always pass, and an admin token
27
+ * bypasses (single-admin-token model — scopes collapse). A `*` scope is a
28
+ * wildcard grant. A principal-scoped client is filtered only when it carries an
29
+ * explicit scopes array; internal streams with no scopes stay trusted.
30
+ */
31
+ export function clientMaySeeScopedChannel(client, requiredScope) {
32
+ if (client.kind !== 'web')
33
+ return true;
34
+ if (client.admin)
35
+ return true;
36
+ if (client.scopes === undefined)
37
+ return true;
38
+ return client.scopes.includes(requiredScope) || client.scopes.includes('*');
39
+ }
40
+ /**
41
+ * Maps a manually-broadcast wire event (published via
42
+ * `ControlPlaneGateway.publishEvent`) to the `RuntimeEventDomain` a client must
43
+ * have subscribed to in order to receive it. These events do NOT flow through a
44
+ * runtime-bus `onDomain` subscription — that path is already domain-scoped by the
45
+ * subscription itself — so without this map the fan-out ignored the subscriber's
46
+ * declared domains and over-delivered (e.g. `session-update` reached the webui,
47
+ * which declares no `session` domain and dropped it as inert).
48
+ *
49
+ * An event ABSENT from this map carries no domain tag and is delivered to every
50
+ * scope-permitted client regardless of its subscribed domains (deliver-all). That
51
+ * keeps domain scoping strictly opt-in narrowing: a newly-added broadcast event
52
+ * cannot be silently dropped just because it is not yet tagged here. New verbs
53
+ * (later waves) should register their broadcast events in this map.
54
+ */
55
+ export const EVENT_DOMAIN = {
56
+ 'session-update': 'session',
57
+ 'approval-update': 'permissions',
58
+ // W3-S3: sessions.detach's `session-detached` is TODAY a payload discriminant
59
+ // inside the `session-update` channel (session-broker.ts publishUpdate wraps
60
+ // it), so it is already domain-scoped by the entry above. This tag is
61
+ // defense-in-depth: if the discriminant is ever promoted to a top-level
62
+ // broadcast, it stays in the session domain instead of silently deliver-all.
63
+ 'session-detached': 'session',
64
+ // W5-S1: sessions.delete's `session-deleted` is likewise a payload discriminant
65
+ // inside `session-update` today (already domain-scoped by the entry above); this
66
+ // tag is the same defense-in-depth as `session-detached` if it is ever promoted
67
+ // to a top-level broadcast.
68
+ 'session-deleted': 'session',
69
+ };
70
+ /**
71
+ * Whether a live client that subscribed to `clientDomains` should receive
72
+ * `event` under the domain filter.
73
+ *
74
+ * `clientDomains === null` means the client did NOT opt into domain narrowing
75
+ * (it connected with no `?domains=` param) and receives everything it is
76
+ * scope-permitted to see — today's behavior, preserved. This null=deliver-all
77
+ * default is the only migration-safe choice: an empty-set-means-nothing default
78
+ * would silently black out every consumer that did not opt in.
79
+ *
80
+ * An event with no `EVENT_DOMAIN` tag is always delivered (untagged ⇒ inert to
81
+ * the domain filter), so narrowing can only ever remove events we can positively
82
+ * attribute to a domain the client did not subscribe to.
83
+ */
84
+ export function clientMayReceiveEventDomain(clientDomains, event) {
85
+ if (clientDomains === null)
86
+ return true;
87
+ const domain = EVENT_DOMAIN[event];
88
+ if (domain === undefined)
89
+ return true;
90
+ return clientDomains.has(domain);
91
+ }
@@ -34,4 +34,21 @@ export declare function hasReplayScope(scope: ControlPlaneEventReplayScope): boo
34
34
  export declare function canReplayEventToClient(event: ScopedControlPlaneRecentEvent, options: ControlPlaneReplayClientOptions): boolean;
35
35
  export declare function stripReplayScope(event: ScopedControlPlaneRecentEvent): ControlPlaneRecentEvent;
36
36
  export declare function pruneDisconnectedClientRecords(clients: Map<string, ControlPlaneClientRecord>, now?: number): void;
37
+ /**
38
+ * Replay recent traffic to a freshly-connected client. Mirrors live delivery:
39
+ * canReplayEventToClient applies the kind/route/surface/domain-name filters, and
40
+ * the EVENT_DOMAIN broadcast-domain filter is applied on top so a domain-narrowed
41
+ * client is not handed a replayed broadcast (e.g. session-update) for a domain it
42
+ * did not subscribe to.
43
+ *
44
+ * `replayDomains` MUST be the same null-or-set value the caller registered on the
45
+ * live client (`LiveControlPlaneClient.domains`) — null when the client did NOT
46
+ * opt into narrowing (deliver-all, matching live), a `Set` when it did. Do NOT
47
+ * derive this from `options.domains` here: by the time options reaches this
48
+ * function it has already been normalized (empty/undefined domains fall back to
49
+ * DEFAULT_DOMAINS, which excludes e.g. 'permissions'), so re-deriving from it
50
+ * would always look "explicit" and silently narrow every default consumer's
51
+ * replay — the bug this parameter exists to prevent.
52
+ */
53
+ export declare function replayRecentTraffic(recentEvents: readonly ScopedControlPlaneRecentEvent[], send: (event: string, payload: unknown, id?: string) => void, options: ControlPlaneReplayClientOptions, replayDomains: ReadonlySet<RuntimeEventDomain> | null, sinceId?: string): void;
37
54
  //# sourceMappingURL=gateway-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-utils.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5G,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,qBAAqB,EAAE,wBAMnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,kBAAkB,EAexD,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,M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ACf,IAAI,CAUN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,6BAA6B,EAAE,EACtD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,EAC5D,OAAO,EAAE,+BAA+B,EACxC,aAAa,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI,EACrD,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAUN"}
@@ -1,4 +1,5 @@
1
1
  import { isRuntimeEventDomain } from '../runtime/events/index.js';
2
+ import { clientMayReceiveEventDomain } from './gateway-scope-enforcement.js';
2
3
  export const DEFAULT_SERVER_CONFIG = {
3
4
  enabled: false,
4
5
  host: '127.0.0.1',
@@ -95,3 +96,32 @@ export function pruneDisconnectedClientRecords(clients, now = Date.now()) {
95
96
  clients.delete(client.id);
96
97
  }
97
98
  }
99
+ /**
100
+ * Replay recent traffic to a freshly-connected client. Mirrors live delivery:
101
+ * canReplayEventToClient applies the kind/route/surface/domain-name filters, and
102
+ * the EVENT_DOMAIN broadcast-domain filter is applied on top so a domain-narrowed
103
+ * client is not handed a replayed broadcast (e.g. session-update) for a domain it
104
+ * did not subscribe to.
105
+ *
106
+ * `replayDomains` MUST be the same null-or-set value the caller registered on the
107
+ * live client (`LiveControlPlaneClient.domains`) — null when the client did NOT
108
+ * opt into narrowing (deliver-all, matching live), a `Set` when it did. Do NOT
109
+ * derive this from `options.domains` here: by the time options reaches this
110
+ * function it has already been normalized (empty/undefined domains fall back to
111
+ * DEFAULT_DOMAINS, which excludes e.g. 'permissions'), so re-deriving from it
112
+ * would always look "explicit" and silently narrow every default consumer's
113
+ * replay — the bug this parameter exists to prevent.
114
+ */
115
+ export function replayRecentTraffic(recentEvents, send, options, replayDomains, sinceId) {
116
+ const sinceIndex = sinceId ? recentEvents.findIndex((event) => event.id === sinceId) : -1;
117
+ const window = sinceIndex >= 0
118
+ ? recentEvents.slice(0, sinceIndex).reverse()
119
+ : recentEvents.slice(0, 20).reverse();
120
+ for (const recentEvent of window) {
121
+ if (!canReplayEventToClient(recentEvent, options))
122
+ continue;
123
+ if (!clientMayReceiveEventDomain(replayDomains, recentEvent.event))
124
+ continue;
125
+ send(recentEvent.event, recentEvent.payload, recentEvent.id);
126
+ }
127
+ }
@@ -1,7 +1,7 @@
1
1
  import type { RuntimeStore } from '../runtime/store/index.js';
2
2
  import type { RuntimeEventBus, RuntimeEventDomain } from '../runtime/events/index.js';
3
3
  import type { ControlPlaneClientDescriptor, ControlPlaneServerConfig, ControlPlaneSurfaceMessage } from './types.js';
4
- import type { FeatureFlagReader } from '../runtime/feature-flags/index.js';
4
+ import { type FeatureFlagReader } from '../runtime/feature-flags/index.js';
5
5
  import { DEFAULT_DOMAINS, type ControlPlaneRecentEvent } from './gateway-utils.js';
6
6
  export type { ControlPlaneRecentEvent } from './gateway-utils.js';
7
7
  export interface ControlPlaneGatewayConfig {
@@ -19,6 +19,8 @@ export interface ControlPlaneEventStreamOptions {
19
19
  readonly principalId?: string | undefined;
20
20
  readonly principalKind?: 'user' | 'bot' | 'service' | 'token' | undefined;
21
21
  readonly scopes?: readonly string[] | undefined;
22
+ /** Admin token — scopes collapse; sees all channels. */
23
+ readonly admin?: boolean | undefined;
22
24
  readonly sessionId?: string | undefined;
23
25
  readonly routeId?: string | undefined;
24
26
  readonly surfaceId?: string | undefined;
@@ -30,6 +32,15 @@ interface LiveControlPlaneClient {
30
32
  readonly kind: 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'telephony' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon';
31
33
  readonly surfaceId?: string | undefined;
32
34
  readonly routeId?: string | undefined;
35
+ /** Principal scopes (SSE/WS); `admin` collapses scopes (sees every channel). */
36
+ readonly scopes?: readonly string[] | undefined;
37
+ readonly admin?: boolean | undefined;
38
+ /**
39
+ * Subscribed domains for the broadcast (`publishEvent`) fan-out. `null` =
40
+ * deliver-all (client did not opt into narrowing); a non-null set narrows to
41
+ * tagged events in the set. For WS this is a live ref to the subscription set.
42
+ */
43
+ readonly domains: ReadonlySet<RuntimeEventDomain> | null;
33
44
  readonly send: (event: string, payload: unknown, id?: string) => void;
34
45
  }
35
46
  export declare class ControlPlaneGateway {
@@ -93,7 +104,6 @@ export declare class ControlPlaneGateway {
93
104
  subscribeWebSocketClient(clientId: string, domains: readonly RuntimeEventDomain[]): void;
94
105
  unsubscribeWebSocketClient(clientId: string, domains?: readonly RuntimeEventDomain[]): void;
95
106
  closeWebSocketClient(clientId: string, reason?: string): void;
96
- private replayRecentTraffic;
97
107
  createEventStream(request: Request, options?: ControlPlaneEventStreamOptions): Response;
98
108
  renderWebUi(authTokenHint?: string): Response;
99
109
  private _scheduleControlPlaneSync;
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/gateway.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAYtF,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EACL,eAAe,EAUf,KAAK,uBAAuB,EAE7B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG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C,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAkB,GAAG,IAAI;IA2CtE,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,8BAAmC,GAAG,QAAQ;IAiM3F,WAAW,CAAC,aAAa,SAAK,GAAG,QAAQ;IAOzC,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,aAAa;CAmBtB;AAGD,OAAO,EAAE,eAAe,IAAI,2BAA2B,EAAE,CAAC"}
@@ -3,8 +3,10 @@ import { logger } from '../utils/logger.js';
3
3
  import { createDomainDispatch } from '../runtime/store/index.js';
4
4
  import { emitControlPlaneAuthGranted, emitControlPlaneClientConnected, emitControlPlaneClientDisconnected, emitControlPlaneSubscriptionCreated, emitControlPlaneSubscriptionDropped, emitStreamSubscriberConnected, emitStreamSubscriberDisconnected, } from '../runtime/emitters/index.js';
5
5
  import { renderControlPlaneGatewayWebUi } from './gateway-web-ui.js';
6
+ import { buildGatewayDisabledResponseBody } from './gateway-disabled-response.js';
7
+ import { CHANNEL_REQUIRED_SCOPE, clientMayReceiveEventDomain, clientMaySeeScopedChannel } from './gateway-scope-enforcement.js';
6
8
  import { isFeatureGateEnabled, requireFeatureGate } from '../runtime/feature-flags/index.js';
7
- import { DEFAULT_DOMAINS, DEFAULT_SERVER_CONFIG, canReplayEventToClient, hasReplayScope, normalizeRuntimeDomains, pruneDisconnectedClientRecords, serializeEnvelope, stripReplayScope, toClientDescriptor, } from './gateway-utils.js';
9
+ import { DEFAULT_DOMAINS, DEFAULT_SERVER_CONFIG, hasReplayScope, normalizeRuntimeDomains, pruneDisconnectedClientRecords, replayRecentTraffic, serializeEnvelope, stripReplayScope, toClientDescriptor, } from './gateway-utils.js';
8
10
  export class ControlPlaneGateway {
9
11
  runtimeBus;
10
12
  dispatch;
@@ -14,7 +16,6 @@ export class ControlPlaneGateway {
14
16
  liveClients = new Map();
15
17
  websocketClients = new Map();
16
18
  recentMessages = [];
17
- // Circular ring buffer for O(1) insert instead of O(n) unshift.
18
19
  _recentEventsRing;
19
20
  _recentEventsHead = 0;
20
21
  _recentEventsCount = 0;
@@ -31,7 +32,6 @@ export class ControlPlaneGateway {
31
32
  out.push(entry);
32
33
  }
33
34
  else if (process.env.NODE_ENV !== 'production') {
34
- // Dev-only: undefined slot despite valid count — ring buffer accounting bug.
35
35
  logger.error('[ControlPlaneGateway] recentEvents: undefined slot at ring index', { head: this._recentEventsHead, count: this._recentEventsCount, index: idx, offset: i });
36
36
  }
37
37
  }
@@ -170,6 +170,7 @@ export class ControlPlaneGateway {
170
170
  if (!this.isEnabled())
171
171
  return;
172
172
  const record = this.rememberEvent(event, payload, filter);
173
+ const requiredScope = CHANNEL_REQUIRED_SCOPE[event];
173
174
  for (const client of this.liveClients.values()) {
174
175
  if (filter?.clientKind && client.kind !== filter.clientKind)
175
176
  continue;
@@ -179,6 +180,11 @@ export class ControlPlaneGateway {
179
180
  continue;
180
181
  if (filter?.surfaceId && client.surfaceId !== filter.surfaceId)
181
182
  continue;
183
+ if (requiredScope && !clientMaySeeScopedChannel(client, requiredScope))
184
+ continue;
185
+ // Domain filter, AND-ed with scope (null = deliver-all; untagged = delivered).
186
+ if (!clientMayReceiveEventDomain(client.domains, event))
187
+ continue;
182
188
  client.send(event, payload, record.id);
183
189
  }
184
190
  }
@@ -256,18 +262,24 @@ export class ControlPlaneGateway {
256
262
  },
257
263
  };
258
264
  const traceId = `control-plane:${clientId}`;
265
+ // Live ref to the WS subscription set, shared with the liveClient (null = deliver-all).
266
+ const wsDomains = new Set();
267
+ const explicitDomains = (options.domains?.length ?? 0) > 0;
259
268
  this.clients.set(clientId, clientRecord);
260
269
  this.liveClients.set(clientId, {
261
270
  clientId,
262
271
  kind: options.clientKind ?? 'web',
263
272
  surfaceId: options.surfaceId,
264
273
  routeId: options.routeId,
274
+ scopes: options.scopes,
275
+ admin: options.admin,
276
+ domains: explicitDomains ? wsDomains : null,
265
277
  send,
266
278
  });
267
279
  this.websocketClients.set(clientId, {
268
280
  clientId,
269
281
  traceId,
270
- domains: new Set(),
282
+ domains: wsDomains,
271
283
  unsubscribers: new Map(),
272
284
  });
273
285
  this.dispatch?.syncControlPlaneState({
@@ -309,7 +321,7 @@ export class ControlPlaneGateway {
309
321
  }
310
322
  this.subscribeWebSocketClient(clientId, selectedDomains);
311
323
  send('ready', { clientId, domains: selectedDomains, transport: 'websocket' });
312
- this.replayRecentTraffic(send, { ...options, clientId, domains: selectedDomains });
324
+ replayRecentTraffic(this.recentEvents, send, { ...options, clientId, domains: selectedDomains }, explicitDomains ? wsDomains : null);
313
325
  return { clientId, domains: selectedDomains };
314
326
  }
315
327
  touchWebSocketClient(clientId, metadata = {}) {
@@ -443,20 +455,9 @@ export class ControlPlaneGateway {
443
455
  connectionState: [...this.clients.values()].some((client) => client.connected) ? 'connected' : 'disconnected',
444
456
  }, 'control-plane.gateway.ws-disconnect');
445
457
  }
446
- replayRecentTraffic(send, options, sinceId) {
447
- const sinceIndex = sinceId ? this.recentEvents.findIndex((event) => event.id === sinceId) : -1;
448
- const recentEvents = sinceIndex >= 0
449
- ? this.recentEvents.slice(0, sinceIndex).reverse()
450
- : this.recentEvents.slice(0, 20).reverse();
451
- for (const recentEvent of recentEvents) {
452
- if (!canReplayEventToClient(recentEvent, options))
453
- continue;
454
- send(recentEvent.event, recentEvent.payload, recentEvent.id);
455
- }
456
- }
457
458
  createEventStream(request, options = {}) {
458
459
  if (!this.isEnabled()) {
459
- return Response.json({ error: 'control-plane-gateway feature flag is disabled' }, { status: 503 });
460
+ return Response.json(buildGatewayDisabledResponseBody(), { status: 503 });
460
461
  }
461
462
  if (!this.runtimeBus) {
462
463
  return Response.json({ error: 'Runtime event bus unavailable' }, { status: 503 });
@@ -527,16 +528,11 @@ export class ControlPlaneGateway {
527
528
  });
528
529
  }
529
530
  let teardown = () => { };
530
- // ReadableStream default HWM is 1, which causes startup `ready` + replay
531
- // enqueues to drop subsequent chunks before any consumer has pulled. Raise HWM to
532
- // 256 chunks so initial handshake + recent-traffic replay + live events fit without
533
- // tripping the backpressure guard for a healthy consumer.
531
+ // HWM 256 (default 1 drops handshake/replay chunks before the consumer pulls).
534
532
  const stream = new ReadableStream({
535
533
  start: (controller) => {
536
534
  const send = (event, payload, id) => {
537
- // Drop event if the stream's internal queue is full (backpressure guard).
538
- // desiredSize <= 0 means the consumer is falling behind; dropping prevents
539
- // unbounded memory growth from enqueued-but-unread chunks.
535
+ // Backpressure guard: drop when the consumer is falling behind (desiredSize<=0).
540
536
  if ((controller.desiredSize ?? 1) <= 0)
541
537
  return;
542
538
  controller.enqueue(encoder.encode(`${id ? `id: ${id}\n` : ''}event: ${event}\ndata: ${JSON.stringify(payload)}\n\n`));
@@ -556,14 +552,18 @@ export class ControlPlaneGateway {
556
552
  const record = this.rememberEvent(domain, serialized);
557
553
  send(domain, serialized, record.id);
558
554
  }));
555
+ // Opt-in narrowing (null=deliver-all, never the DEFAULT_DOMAINS fallback); reused below for replay.
556
+ const sseLiveDomains = (options.domains?.length ?? 0) > 0 ? new Set(selectedDomains) : null;
559
557
  this.liveClients.set(clientId, {
560
558
  clientId,
561
559
  kind: options.clientKind ?? 'web',
562
560
  surfaceId: options.surfaceId,
563
561
  routeId: options.routeId,
562
+ scopes: options.scopes,
563
+ admin: options.admin,
564
+ domains: sseLiveDomains,
564
565
  send,
565
566
  });
566
- // emit STREAM_SUBSCRIBER_CONNECTED when the SSE client is registered.
567
567
  emitStreamSubscriberConnected(this.runtimeBus, {
568
568
  sessionId: options.sessionId ?? 'control-plane',
569
569
  source: 'control-plane.gateway',
@@ -576,7 +576,6 @@ export class ControlPlaneGateway {
576
576
  const heartbeat = setInterval(() => {
577
577
  send('heartbeat', { clientId, ts: Date.now() });
578
578
  }, 15_000);
579
- // Don't block clean process exit.
580
579
  heartbeat.unref?.();
581
580
  teardown = () => {
582
581
  clearInterval(heartbeat);
@@ -615,7 +614,6 @@ export class ControlPlaneGateway {
615
614
  clientId,
616
615
  reason: 'stream-closed',
617
616
  });
618
- // emit STREAM_SUBSCRIBER_DISCONNECTED when the SSE client tears down.
619
617
  emitStreamSubscriberDisconnected(this.runtimeBus, {
620
618
  sessionId: options.sessionId ?? 'control-plane',
621
619
  source: 'control-plane.gateway',
@@ -633,7 +631,7 @@ export class ControlPlaneGateway {
633
631
  controller.close();
634
632
  }, { once: true });
635
633
  send('ready', { clientId, domains: selectedDomains });
636
- this.replayRecentTraffic(send, { ...options, clientId, domains: selectedDomains }, lastEventId);
634
+ replayRecentTraffic(this.recentEvents, send, { ...options, clientId, domains: selectedDomains }, sseLiveDomains, lastEventId);
637
635
  },
638
636
  cancel: () => {
639
637
  teardown();
@@ -649,7 +647,7 @@ export class ControlPlaneGateway {
649
647
  }
650
648
  renderWebUi(authTokenHint = '') {
651
649
  if (!this.isEnabled()) {
652
- return Response.json({ error: 'control-plane-gateway feature flag is disabled' }, { status: 503 });
650
+ return Response.json(buildGatewayDisabledResponseBody(), { status: 503 });
653
651
  }
654
652
  return renderControlPlaneGatewayWebUi(authTokenHint);
655
653
  }
@@ -675,13 +673,11 @@ export class ControlPlaneGateway {
675
673
  payload,
676
674
  ...(replayScope && hasReplayScope(replayScope) ? { replayScope } : {}),
677
675
  };
678
- // O(1) circular ring buffer write — no array shifting.
679
676
  this._recentEventsRing[this._recentEventsHead] = record;
680
677
  this._recentEventsHead = (this._recentEventsHead + 1) % this._recentEventsCapacity;
681
678
  if (this._recentEventsCount < this._recentEventsCapacity)
682
679
  this._recentEventsCount++;
683
680
  this._lastEventAt = record.createdAt;
684
- // Debounced: coalesce N events/frame into 1 store sync.
685
681
  this._scheduleControlPlaneSync();
686
682
  return record;
687
683
  }
@@ -3,11 +3,15 @@ export type { ControlPlaneGatewayConfig, ControlPlaneEventStreamOptions, Control
3
3
  export { ControlPlaneGateway } from './gateway.js';
4
4
  export { GatewayMethodCatalog, } from './method-catalog.js';
5
5
  export type { GatewayEventDescriptor, GatewayEventListOptions, GatewayEventTransport, GatewayHttpBinding, GatewayMethodAccess, GatewayMethodDescriptor, GatewayMethodHandler, GatewayMethodInvocation, GatewayMethodInvocationContext, GatewayMethodListOptions, GatewayMethodSource, GatewayMethodTransport, } from './method-catalog.js';
6
- export type { FindSharedSessionOptions, SharedSessionMessage, SharedSessionParticipant, SharedSessionRecord, SharedSessionSubmission, SteerSharedSessionMessageInput, SubmitSharedSessionMessageInput, } from './session-types.js';
6
+ export type { CreateSharedSessionInput, EnsureSharedSessionInput, FindSharedSessionOptions, ListSharedSessionsOptions, ParticipantRouteAttachInput, RegisterSharedSessionInput, SharedSessionRegisterResult, SharedSessionKind, SharedSessionMessage, SharedSessionParticipant, SharedSessionRecord, SharedSessionStatus, SharedSessionSubmission, SteerSharedSessionMessageInput, SubmitSharedSessionMessageInput, } from './session-types.js';
7
7
  export type { SharedSessionCompletion, SharedSessionContinuationRequest, SharedSessionContinuationResult, SharedSessionHelperModelOverride, SharedSessionInputIntent, SharedSessionInputRecord, SharedSessionInputState, SharedSessionRoutingIntent, } from './session-intents.js';
8
8
  export { SharedSessionBroker } from './session-broker.js';
9
+ export { discoverLegacySessionSources, importLegacySessionStores, } from './session-store-importer.js';
10
+ export type { LegacySessionSource, ImportLegacySessionsResult, } from './session-store-importer.js';
9
11
  export type { SharedApprovalRecord, SharedApprovalAuditRecord, SharedApprovalStatus, RequestSharedApprovalInput, } from './approval-broker.js';
10
12
  export { ApprovalBroker } from './approval-broker.js';
13
+ export { buildModifiedEditArgs, readApprovalEditHunks, resolveApprovalHunkSelection, } from './approval-hunk-apply.js';
14
+ export type { EditHunkLike, ApprovalHunkSelectionResolution } from './approval-hunk-apply.js';
11
15
  export type { ControlPlaneAuthMode, ControlPlaneAuthSnapshot } from '../../client-auth/control-plane-auth-snapshot.js';
12
16
  export type { MessageSource, ConversationMessageEnvelope } from './conversation-message.js';
13
17
  export { buildOperatorContract } from './operator-contract.js';
@@ -17,4 +21,5 @@ export { ARTIFACT_ATTACHMENT_SCHEMA, ARTIFACT_DESCRIPTOR_SCHEMA, } from './opera
17
21
  export { AUTOMATION_RUN_SCHEMA, ROUTE_BINDING_SCHEMA, } from './operator-contract-schemas-admin.js';
18
22
  export { SHARED_SESSION_INPUT_RECORD_SCHEMA, SHARED_SESSION_ROUTING_INTENT_SCHEMA, } from './operator-contract-schemas-runtime.js';
19
23
  export { KNOWLEDGE_INJECTION_PROMPT_SCHEMA, KNOWLEDGE_INJECTION_SCHEMA, } from './operator-contract-schemas-knowledge.js';
24
+ export { registerW3S2GatewayMethods } from './routes/register-w3-s2.js';
20
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AACvH,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,u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BAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,7 +1,9 @@
1
1
  export { ControlPlaneGateway } from './gateway.js';
2
2
  export { GatewayMethodCatalog, } from './method-catalog.js';
3
3
  export { SharedSessionBroker } from './session-broker.js';
4
+ export { discoverLegacySessionSources, importLegacySessionStores, } from './session-store-importer.js';
4
5
  export { ApprovalBroker } from './approval-broker.js';
6
+ export { buildModifiedEditArgs, readApprovalEditHunks, resolveApprovalHunkSelection, } from './approval-hunk-apply.js';
5
7
  export { buildOperatorContract } from './operator-contract.js';
6
8
  export { dispatchDaemonApiRoutes } from './routes/index.js';
7
9
  export { ARTIFACT_ACQUISITION_MODE_SCHEMA, ARTIFACT_FETCH_MODE_SCHEMA, } from './media-contract-schemas.js';
@@ -9,3 +11,5 @@ export { ARTIFACT_ATTACHMENT_SCHEMA, ARTIFACT_DESCRIPTOR_SCHEMA, } from './opera
9
11
  export { AUTOMATION_RUN_SCHEMA, ROUTE_BINDING_SCHEMA, } from './operator-contract-schemas-admin.js';
10
12
  export { SHARED_SESSION_INPUT_RECORD_SCHEMA, SHARED_SESSION_ROUTING_INTENT_SCHEMA, } from './operator-contract-schemas-runtime.js';
11
13
  export { KNOWLEDGE_INJECTION_PROMPT_SCHEMA, KNOWLEDGE_INJECTION_SCHEMA, } from './operator-contract-schemas-knowledge.js';
14
+ // W3-S2 — fleet.*/checkpoints.*/sessions.search verb registration (see routes/register-w3-s2.ts).
15
+ export { registerW3S2GatewayMethods } from './routes/register-w3-s2.js';
@@ -0,0 +1,56 @@
1
+ /**
2
+ * invoke-input-validation.ts (W3-S1, Part B)
3
+ *
4
+ * A central, catalog-driven input gate for the gateway invoke layer. Before a
5
+ * resolved verb's handler (or its HTTP delegate) runs, the invocation's params
6
+ * are validated against the method catalog's `inputSchema`, returning an honest
7
+ * 400 instead of letting a wrong-typed or missing-required field reach a handler
8
+ * that would silently coerce or misbehave.
9
+ *
10
+ * Scope is deliberately the TYPED subset only:
11
+ * - Object schemas that declare `properties` are structurally validated.
12
+ * - Generic object schemas (object with no `properties`, e.g. an
13
+ * additionalProperties-only "any JSON object") pass through unchanged — the
14
+ * status quo — so no verb is falsely rejected for extra fields.
15
+ * - A verb with no `inputSchema` is untyped and passes through.
16
+ *
17
+ * The validator is lenient on unknown keys (does NOT enforce
18
+ * `additionalProperties: false`): the goal is to reject provable type/shape
19
+ * mismatches, not to tighten every loose handler that historically tolerated
20
+ * extra fields. It reports the first violation it finds.
21
+ */
22
+ import type { GatewayMethodDescriptor } from './method-catalog-shared.js';
23
+ /** Structured result of a rejected invocation — same 400 shape the router uses. */
24
+ export interface InvokeValidationError {
25
+ readonly code: 'INVALID_INPUT';
26
+ readonly detail: string;
27
+ }
28
+ /** How a descriptor's inputSchema is treated by the validate gate. */
29
+ export type InvokeValidationDisposition = 'validated' | 'generic' | 'untyped';
30
+ /**
31
+ * Classify an inputSchema for both the validate gate and coverage accounting:
32
+ * - 'validated' — an object schema with declared properties (structurally checked)
33
+ * - 'generic' — an object schema with no properties (skipped)
34
+ * - 'untyped' — absent, or a non-object root we do not structurally validate (skipped)
35
+ */
36
+ export declare function classifyInputSchema(schema: Record<string, unknown> | undefined): InvokeValidationDisposition;
37
+ /**
38
+ * Validate an invocation's params against a verb's inputSchema. Returns an
39
+ * `InvokeValidationError` when a typed schema is violated, or null when the
40
+ * params conform, the schema is generic/untyped, or there is nothing to check.
41
+ *
42
+ * `params` is the request payload the verb receives (the invoke body for
43
+ * body-carrying verbs). `undefined` is treated as an empty object so a schema
44
+ * with required fields honestly reports them missing.
45
+ */
46
+ export declare function validateInvocationInput(descriptor: GatewayMethodDescriptor, params: unknown): InvokeValidationError | null;
47
+ /** Coverage tallies for the operator contract manifest: how many cataloged verbs
48
+ * the invoke input gate structurally validates vs skips (generic/untyped). */
49
+ export interface InvokeValidationCoverage {
50
+ readonly methods: number;
51
+ readonly validated: number;
52
+ readonly skippedGeneric: number;
53
+ readonly skippedUntyped: number;
54
+ }
55
+ export declare function summarizeInvokeValidationCoverage(methods: readonly GatewayMethodDescriptor[]): InvokeValidationCoverage;
56
+ //# sourceMappingURL=invoke-input-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke-input-validation.d.ts","sourceRoot":"","sources":["../../../src/platform/control-plane/invoke-input-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAY9E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,2BAA2B,CAK5G;AAsFD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,uBAAuB,EACnC,MAAM,EAAE,OAAO,GACd,qBAAqB,GAAG,IAAI,CAM9B;AAED;+EAC+E;AAC/E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAC1C,wBAAwB,CAY1B"}