@pellux/goodvibes-sdk 0.21.29 → 0.21.33

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 (323) hide show
  1. package/dist/_internal/contracts/zod-schemas/accounts.d.ts +9 -9
  2. package/dist/_internal/contracts/zod-schemas/auth.d.ts +1 -1
  3. package/dist/_internal/daemon/context.d.ts +1 -0
  4. package/dist/_internal/daemon/context.d.ts.map +1 -1
  5. package/dist/_internal/daemon/error-response.js +22 -22
  6. package/dist/_internal/daemon/integration-route-types.d.ts +2 -1
  7. package/dist/_internal/daemon/integration-route-types.d.ts.map +1 -1
  8. package/dist/_internal/daemon/knowledge-routes.js +5 -5
  9. package/dist/_internal/daemon/media-routes.d.ts.map +1 -1
  10. package/dist/_internal/daemon/media-routes.js +4 -3
  11. package/dist/_internal/daemon/operator.d.ts +1 -1
  12. package/dist/_internal/daemon/operator.d.ts.map +1 -1
  13. package/dist/_internal/daemon/operator.js +2 -0
  14. package/dist/_internal/daemon/runtime-route-types.d.ts +2 -1
  15. package/dist/_internal/daemon/runtime-route-types.d.ts.map +1 -1
  16. package/dist/_internal/daemon/runtime-routes.d.ts +1 -1
  17. package/dist/_internal/daemon/runtime-routes.d.ts.map +1 -1
  18. package/dist/_internal/daemon/runtime-routes.js +1 -0
  19. package/dist/_internal/daemon/telemetry-routes.d.ts.map +1 -1
  20. package/dist/_internal/daemon/telemetry-routes.js +13 -12
  21. package/dist/_internal/errors/daemon-error-contract.d.ts +17 -0
  22. package/dist/_internal/errors/daemon-error-contract.d.ts.map +1 -1
  23. package/dist/_internal/errors/daemon-error-contract.js +17 -1
  24. package/dist/_internal/errors/index.d.ts +2 -1
  25. package/dist/_internal/errors/index.d.ts.map +1 -1
  26. package/dist/_internal/errors/index.js +1 -0
  27. package/dist/_internal/platform/artifacts/store.d.ts.map +1 -1
  28. package/dist/_internal/platform/artifacts/store.js +2 -1
  29. package/dist/_internal/platform/automation/scheduler-capacity.d.ts +29 -0
  30. package/dist/_internal/platform/automation/scheduler-capacity.d.ts.map +1 -0
  31. package/dist/_internal/platform/automation/scheduler-capacity.js +31 -0
  32. package/dist/_internal/platform/channels/delivery/shared.d.ts.map +1 -1
  33. package/dist/_internal/platform/channels/delivery/shared.js +3 -2
  34. package/dist/_internal/platform/channels/delivery/strategies-bridge.d.ts.map +1 -1
  35. package/dist/_internal/platform/channels/delivery/strategies-bridge.js +3 -2
  36. package/dist/_internal/platform/channels/delivery/strategies-core.d.ts.map +1 -1
  37. package/dist/_internal/platform/channels/delivery/strategies-core.js +5 -4
  38. package/dist/_internal/platform/channels/delivery/strategies-enterprise.d.ts.map +1 -1
  39. package/dist/_internal/platform/channels/delivery/strategies-enterprise.js +4 -3
  40. package/dist/_internal/platform/companion/companion-chat-rate-limiter.d.ts +7 -0
  41. package/dist/_internal/platform/companion/companion-chat-rate-limiter.d.ts.map +1 -1
  42. package/dist/_internal/platform/companion/companion-chat-rate-limiter.js +16 -0
  43. package/dist/_internal/platform/config/manager.d.ts.map +1 -1
  44. package/dist/_internal/platform/config/manager.js +2 -1
  45. package/dist/_internal/platform/config/schema-domain-runtime.d.ts +6 -0
  46. package/dist/_internal/platform/config/schema-domain-runtime.d.ts.map +1 -1
  47. package/dist/_internal/platform/config/schema-domain-runtime.js +22 -0
  48. package/dist/_internal/platform/config/schema-types.d.ts +16 -2
  49. package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
  50. package/dist/_internal/platform/config/schema.d.ts.map +1 -1
  51. package/dist/_internal/platform/config/schema.js +1 -0
  52. package/dist/_internal/platform/config/service-registry.d.ts.map +1 -1
  53. package/dist/_internal/platform/config/service-registry.js +2 -1
  54. package/dist/_internal/platform/control-plane/gateway-web-ui.d.ts +0 -1
  55. package/dist/_internal/platform/control-plane/gateway-web-ui.d.ts.map +1 -1
  56. package/dist/_internal/platform/control-plane/gateway-web-ui.js +7 -6
  57. package/dist/_internal/platform/control-plane/gateway.d.ts.map +1 -1
  58. package/dist/_internal/platform/control-plane/gateway.js +7 -0
  59. package/dist/_internal/platform/control-plane/session-broker.d.ts.map +1 -1
  60. package/dist/_internal/platform/control-plane/session-broker.js +38 -5
  61. package/dist/_internal/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  62. package/dist/_internal/platform/core/orchestrator-tool-runtime.js +6 -6
  63. package/dist/_internal/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
  64. package/dist/_internal/platform/core/orchestrator-turn-loop.js +10 -2
  65. package/dist/_internal/platform/core/orchestrator.d.ts.map +1 -1
  66. package/dist/_internal/platform/core/orchestrator.js +2 -0
  67. package/dist/_internal/platform/daemon/facade-composition.d.ts +4 -131
  68. package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
  69. package/dist/_internal/platform/daemon/facade-composition.js +9 -10
  70. package/dist/_internal/platform/daemon/facade-types.d.ts +141 -0
  71. package/dist/_internal/platform/daemon/facade-types.d.ts.map +1 -0
  72. package/dist/_internal/platform/daemon/facade-types.js +1 -0
  73. package/dist/_internal/platform/daemon/http/rate-limiter.d.ts +23 -0
  74. package/dist/_internal/platform/daemon/http/rate-limiter.d.ts.map +1 -0
  75. package/dist/_internal/platform/daemon/http/rate-limiter.js +71 -0
  76. package/dist/_internal/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
  77. package/dist/_internal/platform/daemon/http/router-route-contexts.js +2 -1
  78. package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
  79. package/dist/_internal/platform/daemon/http/router.js +90 -66
  80. package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  81. package/dist/_internal/platform/daemon/http-listener.d.ts +14 -0
  82. package/dist/_internal/platform/daemon/http-listener.d.ts.map +1 -1
  83. package/dist/_internal/platform/daemon/http-listener.js +92 -86
  84. package/dist/_internal/platform/daemon/surface-delivery.d.ts.map +1 -1
  85. package/dist/_internal/platform/daemon/surface-delivery.js +6 -5
  86. package/dist/_internal/platform/discovery/mcp-scanner.d.ts.map +1 -1
  87. package/dist/_internal/platform/discovery/mcp-scanner.js +28 -22
  88. package/dist/_internal/platform/discovery/scanner.d.ts.map +1 -1
  89. package/dist/_internal/platform/discovery/scanner.js +38 -22
  90. package/dist/_internal/platform/export/session-export.d.ts +0 -1
  91. package/dist/_internal/platform/export/session-export.d.ts.map +1 -1
  92. package/dist/_internal/platform/export/session-export.js +1 -33
  93. package/dist/_internal/platform/hooks/runners/http.d.ts.map +1 -1
  94. package/dist/_internal/platform/hooks/runners/http.js +15 -1
  95. package/dist/_internal/platform/hooks/types.d.ts +7 -0
  96. package/dist/_internal/platform/hooks/types.d.ts.map +1 -1
  97. package/dist/_internal/platform/integrations/delivery.d.ts +3 -1
  98. package/dist/_internal/platform/integrations/delivery.d.ts.map +1 -1
  99. package/dist/_internal/platform/integrations/delivery.js +3 -2
  100. package/dist/_internal/platform/integrations/discord.d.ts.map +1 -1
  101. package/dist/_internal/platform/integrations/discord.js +6 -5
  102. package/dist/_internal/platform/integrations/ntfy.d.ts.map +1 -1
  103. package/dist/_internal/platform/integrations/ntfy.js +3 -2
  104. package/dist/_internal/platform/integrations/webhooks.d.ts.map +1 -1
  105. package/dist/_internal/platform/integrations/webhooks.js +12 -1
  106. package/dist/_internal/platform/intelligence/lsp/binary-downloader.d.ts.map +1 -1
  107. package/dist/_internal/platform/intelligence/lsp/binary-downloader.js +4 -3
  108. package/dist/_internal/platform/knowledge/store.d.ts.map +1 -1
  109. package/dist/_internal/platform/knowledge/store.js +50 -25
  110. package/dist/_internal/platform/mcp/client.d.ts.map +1 -1
  111. package/dist/_internal/platform/mcp/client.js +3 -2
  112. package/dist/_internal/platform/media/builtin-generation-providers.d.ts.map +1 -1
  113. package/dist/_internal/platform/media/builtin-generation-providers.js +4 -3
  114. package/dist/_internal/platform/media/builtin-image-understanding.d.ts.map +1 -1
  115. package/dist/_internal/platform/media/builtin-image-understanding.js +5 -4
  116. package/dist/_internal/platform/providers/anthropic-compat.d.ts.map +1 -1
  117. package/dist/_internal/platform/providers/anthropic-compat.js +5 -3
  118. package/dist/_internal/platform/providers/anthropic.d.ts.map +1 -1
  119. package/dist/_internal/platform/providers/anthropic.js +10 -7
  120. package/dist/_internal/platform/providers/builtin-catalog.d.ts.map +1 -1
  121. package/dist/_internal/platform/providers/builtin-catalog.js +3 -2
  122. package/dist/_internal/platform/providers/catalogue.d.ts +56 -0
  123. package/dist/_internal/platform/providers/catalogue.d.ts.map +1 -0
  124. package/dist/_internal/platform/providers/catalogue.js +111 -0
  125. package/dist/_internal/platform/providers/context-discovery.d.ts.map +1 -1
  126. package/dist/_internal/platform/providers/context-discovery.js +2 -1
  127. package/dist/_internal/platform/providers/credentials.d.ts +12 -0
  128. package/dist/_internal/platform/providers/credentials.d.ts.map +1 -0
  129. package/dist/_internal/platform/providers/credentials.js +54 -0
  130. package/dist/_internal/platform/providers/gemini.d.ts.map +1 -1
  131. package/dist/_internal/platform/providers/gemini.js +6 -5
  132. package/dist/_internal/platform/providers/github-copilot.d.ts.map +1 -1
  133. package/dist/_internal/platform/providers/github-copilot.js +2 -1
  134. package/dist/_internal/platform/providers/health.d.ts +15 -0
  135. package/dist/_internal/platform/providers/health.d.ts.map +1 -0
  136. package/dist/_internal/platform/providers/health.js +32 -0
  137. package/dist/_internal/platform/providers/llama-cpp.d.ts.map +1 -1
  138. package/dist/_internal/platform/providers/llama-cpp.js +5 -3
  139. package/dist/_internal/platform/providers/lm-studio.d.ts.map +1 -1
  140. package/dist/_internal/platform/providers/lm-studio.js +5 -3
  141. package/dist/_internal/platform/providers/model-benchmarks.d.ts.map +1 -1
  142. package/dist/_internal/platform/providers/model-benchmarks.js +2 -1
  143. package/dist/_internal/platform/providers/model-catalog-cache.d.ts.map +1 -1
  144. package/dist/_internal/platform/providers/model-catalog-cache.js +2 -1
  145. package/dist/_internal/platform/providers/model-limits.d.ts.map +1 -1
  146. package/dist/_internal/platform/providers/model-limits.js +2 -1
  147. package/dist/_internal/platform/providers/ollama.d.ts.map +1 -1
  148. package/dist/_internal/platform/providers/ollama.js +5 -3
  149. package/dist/_internal/platform/providers/openai-codex.d.ts.map +1 -1
  150. package/dist/_internal/platform/providers/openai-codex.js +4 -2
  151. package/dist/_internal/platform/providers/openai-compat.d.ts.map +1 -1
  152. package/dist/_internal/platform/providers/openai-compat.js +3 -2
  153. package/dist/_internal/platform/providers/provider-not-found-error.d.ts +3 -1
  154. package/dist/_internal/platform/providers/provider-not-found-error.d.ts.map +1 -1
  155. package/dist/_internal/platform/providers/provider-not-found-error.js +3 -4
  156. package/dist/_internal/platform/providers/well-known-endpoints.d.ts +53 -0
  157. package/dist/_internal/platform/providers/well-known-endpoints.d.ts.map +1 -0
  158. package/dist/_internal/platform/providers/well-known-endpoints.js +52 -0
  159. package/dist/_internal/platform/runtime/auth/oauth-core.d.ts.map +1 -1
  160. package/dist/_internal/platform/runtime/auth/oauth-core.js +2 -1
  161. package/dist/_internal/platform/runtime/bootstrap-runtime-events.d.ts.map +1 -1
  162. package/dist/_internal/platform/runtime/bootstrap-runtime-events.js +2 -0
  163. package/dist/_internal/platform/runtime/contracts/index.d.ts.map +1 -1
  164. package/dist/_internal/platform/runtime/contracts/index.js +1 -5
  165. package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts +57 -0
  166. package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts.map +1 -0
  167. package/dist/_internal/platform/runtime/contracts/migrations/schemas.js +157 -0
  168. package/dist/_internal/platform/runtime/correlation.d.ts +44 -0
  169. package/dist/_internal/platform/runtime/correlation.d.ts.map +1 -0
  170. package/dist/_internal/platform/runtime/correlation.js +40 -0
  171. package/dist/_internal/platform/runtime/emitters/security.d.ts +32 -0
  172. package/dist/_internal/platform/runtime/emitters/security.d.ts.map +1 -1
  173. package/dist/_internal/platform/runtime/emitters/security.js +26 -0
  174. package/dist/_internal/platform/runtime/emitters/tools.d.ts +11 -2
  175. package/dist/_internal/platform/runtime/emitters/tools.d.ts.map +1 -1
  176. package/dist/_internal/platform/runtime/emitters/tools.js +27 -0
  177. package/dist/_internal/platform/runtime/emitters/transport.d.ts +27 -0
  178. package/dist/_internal/platform/runtime/emitters/transport.d.ts.map +1 -1
  179. package/dist/_internal/platform/runtime/emitters/transport.js +19 -0
  180. package/dist/_internal/platform/runtime/emitters/turn.d.ts +22 -1
  181. package/dist/_internal/platform/runtime/emitters/turn.d.ts.map +1 -1
  182. package/dist/_internal/platform/runtime/emitters/turn.js +9 -0
  183. package/dist/_internal/platform/runtime/events/index.d.ts +45 -0
  184. package/dist/_internal/platform/runtime/events/index.d.ts.map +1 -1
  185. package/dist/_internal/platform/runtime/events/index.js +130 -22
  186. package/dist/_internal/platform/runtime/events/ops.d.ts +8 -0
  187. package/dist/_internal/platform/runtime/events/ops.d.ts.map +1 -1
  188. package/dist/_internal/platform/runtime/events/security.d.ts +47 -0
  189. package/dist/_internal/platform/runtime/events/security.d.ts.map +1 -1
  190. package/dist/_internal/platform/runtime/events/tools.d.ts +14 -2
  191. package/dist/_internal/platform/runtime/events/tools.d.ts.map +1 -1
  192. package/dist/_internal/platform/runtime/events/transport.d.ts +31 -0
  193. package/dist/_internal/platform/runtime/events/transport.d.ts.map +1 -1
  194. package/dist/_internal/platform/runtime/events/turn.d.ts +25 -1
  195. package/dist/_internal/platform/runtime/events/turn.d.ts.map +1 -1
  196. package/dist/_internal/platform/runtime/events/workspace.d.ts +16 -0
  197. package/dist/_internal/platform/runtime/events/workspace.d.ts.map +1 -1
  198. package/dist/_internal/platform/runtime/integration/helpers.d.ts.map +1 -1
  199. package/dist/_internal/platform/runtime/integration/helpers.js +5 -0
  200. package/dist/_internal/platform/runtime/llm-observability.d.ts +43 -0
  201. package/dist/_internal/platform/runtime/llm-observability.d.ts.map +1 -0
  202. package/dist/_internal/platform/runtime/llm-observability.js +107 -0
  203. package/dist/_internal/platform/runtime/metrics.d.ts +49 -0
  204. package/dist/_internal/platform/runtime/metrics.d.ts.map +1 -0
  205. package/dist/_internal/platform/runtime/metrics.js +114 -0
  206. package/dist/_internal/platform/runtime/ops/control-plane.d.ts +5 -2
  207. package/dist/_internal/platform/runtime/ops/control-plane.d.ts.map +1 -1
  208. package/dist/_internal/platform/runtime/ops/control-plane.js +5 -4
  209. package/dist/_internal/platform/runtime/perf/slo-collector.d.ts.map +1 -1
  210. package/dist/_internal/platform/runtime/perf/slo-collector.js +2 -0
  211. package/dist/_internal/platform/runtime/permissions/divergence-dashboard.d.ts +3 -1
  212. package/dist/_internal/platform/runtime/permissions/divergence-dashboard.d.ts.map +1 -1
  213. package/dist/_internal/platform/runtime/permissions/divergence-dashboard.js +3 -2
  214. package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts +3 -1
  215. package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts.map +1 -1
  216. package/dist/_internal/platform/runtime/permissions/policy-loader.js +3 -2
  217. package/dist/_internal/platform/runtime/permissions/policy-signer.d.ts.map +1 -1
  218. package/dist/_internal/platform/runtime/permissions/policy-signer.js +7 -2
  219. package/dist/_internal/platform/runtime/permissions/simulation.d.ts +3 -1
  220. package/dist/_internal/platform/runtime/permissions/simulation.d.ts.map +1 -1
  221. package/dist/_internal/platform/runtime/permissions/simulation.js +3 -2
  222. package/dist/_internal/platform/runtime/remote/transport-contract.d.ts +14 -2
  223. package/dist/_internal/platform/runtime/remote/transport-contract.d.ts.map +1 -1
  224. package/dist/_internal/platform/runtime/remote/transport-contract.js +7 -5
  225. package/dist/_internal/platform/runtime/store/helpers/reducers/sync.d.ts.map +1 -1
  226. package/dist/_internal/platform/runtime/store/helpers/reducers/sync.js +12 -1
  227. package/dist/_internal/platform/runtime/tasks/manager.d.ts +7 -3
  228. package/dist/_internal/platform/runtime/tasks/manager.d.ts.map +1 -1
  229. package/dist/_internal/platform/runtime/tasks/manager.js +7 -6
  230. package/dist/_internal/platform/runtime/telemetry/api-helpers.d.ts +14 -0
  231. package/dist/_internal/platform/runtime/telemetry/api-helpers.d.ts.map +1 -1
  232. package/dist/_internal/platform/runtime/telemetry/api-helpers.js +59 -0
  233. package/dist/_internal/platform/runtime/telemetry/api.d.ts.map +1 -1
  234. package/dist/_internal/platform/runtime/telemetry/api.js +19 -4
  235. package/dist/_internal/platform/runtime/telemetry/exporters/otlp.d.ts.map +1 -1
  236. package/dist/_internal/platform/runtime/telemetry/exporters/otlp.js +19 -6
  237. package/dist/_internal/platform/runtime/telemetry/exporters/queue.d.ts.map +1 -1
  238. package/dist/_internal/platform/runtime/telemetry/exporters/queue.js +11 -4
  239. package/dist/_internal/platform/runtime/telemetry/meter.d.ts.map +1 -1
  240. package/dist/_internal/platform/runtime/telemetry/meter.js +7 -3
  241. package/dist/_internal/platform/runtime/telemetry/redaction-config.d.ts +9 -0
  242. package/dist/_internal/platform/runtime/telemetry/redaction-config.d.ts.map +1 -0
  243. package/dist/_internal/platform/runtime/telemetry/redaction-config.js +52 -0
  244. package/dist/_internal/platform/runtime/tools/phases/budget.d.ts.map +1 -1
  245. package/dist/_internal/platform/runtime/tools/phases/budget.js +3 -2
  246. package/dist/_internal/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
  247. package/dist/_internal/platform/runtime/transports/daemon-http-client.js +138 -17
  248. package/dist/_internal/platform/scheduler/scheduler.d.ts +19 -2
  249. package/dist/_internal/platform/scheduler/scheduler.d.ts.map +1 -1
  250. package/dist/_internal/platform/scheduler/scheduler.js +65 -25
  251. package/dist/_internal/platform/sessions/manager.d.ts.map +1 -1
  252. package/dist/_internal/platform/sessions/manager.js +6 -2
  253. package/dist/_internal/platform/state/memory-embedding-http.d.ts.map +1 -1
  254. package/dist/_internal/platform/state/memory-embedding-http.js +3 -2
  255. package/dist/_internal/platform/state/project-index.d.ts.map +1 -1
  256. package/dist/_internal/platform/state/project-index.js +6 -4
  257. package/dist/_internal/platform/tools/agent/index.d.ts.map +1 -1
  258. package/dist/_internal/platform/tools/agent/index.js +2 -1
  259. package/dist/_internal/platform/tools/analyze/git-modes.d.ts.map +1 -1
  260. package/dist/_internal/platform/tools/analyze/git-modes.js +2 -1
  261. package/dist/_internal/platform/tools/edit/core.d.ts.map +1 -1
  262. package/dist/_internal/platform/tools/edit/core.js +2 -1
  263. package/dist/_internal/platform/tools/exec/runtime.d.ts.map +1 -1
  264. package/dist/_internal/platform/tools/exec/runtime.js +3 -2
  265. package/dist/_internal/platform/tools/fetch/runtime.d.ts.map +1 -1
  266. package/dist/_internal/platform/tools/fetch/runtime.js +4 -2
  267. package/dist/_internal/platform/tools/read/index.d.ts.map +1 -1
  268. package/dist/_internal/platform/tools/read/index.js +2 -1
  269. package/dist/_internal/platform/tools/registry-tool/index.d.ts.map +1 -1
  270. package/dist/_internal/platform/tools/registry-tool/index.js +2 -1
  271. package/dist/_internal/platform/tools/state/index.d.ts.map +1 -1
  272. package/dist/_internal/platform/tools/state/index.js +2 -1
  273. package/dist/_internal/platform/tools/task/index.d.ts.map +1 -1
  274. package/dist/_internal/platform/tools/task/index.js +2 -1
  275. package/dist/_internal/platform/tools/team/index.d.ts.map +1 -1
  276. package/dist/_internal/platform/tools/team/index.js +2 -1
  277. package/dist/_internal/platform/tools/web-search/index.d.ts.map +1 -1
  278. package/dist/_internal/platform/tools/web-search/index.js +2 -1
  279. package/dist/_internal/platform/tools/worklist/index.d.ts.map +1 -1
  280. package/dist/_internal/platform/tools/worklist/index.js +2 -1
  281. package/dist/_internal/platform/types/errors.d.ts +12 -10
  282. package/dist/_internal/platform/types/errors.d.ts.map +1 -1
  283. package/dist/_internal/platform/types/errors.js +21 -20
  284. package/dist/_internal/platform/utils/error-display.d.ts.map +1 -1
  285. package/dist/_internal/platform/utils/error-display.js +6 -4
  286. package/dist/_internal/platform/utils/fetch-with-timeout.d.ts +17 -0
  287. package/dist/_internal/platform/utils/fetch-with-timeout.d.ts.map +1 -1
  288. package/dist/_internal/platform/utils/fetch-with-timeout.js +59 -0
  289. package/dist/_internal/platform/utils/record-coerce.d.ts +11 -0
  290. package/dist/_internal/platform/utils/record-coerce.d.ts.map +1 -0
  291. package/dist/_internal/platform/utils/record-coerce.js +12 -0
  292. package/dist/_internal/platform/utils/redaction.js +1 -1
  293. package/dist/_internal/platform/utils/ring-buffer.d.ts +54 -0
  294. package/dist/_internal/platform/utils/ring-buffer.d.ts.map +1 -0
  295. package/dist/_internal/platform/utils/ring-buffer.js +96 -0
  296. package/dist/_internal/platform/utils/shell-split.d.ts +11 -0
  297. package/dist/_internal/platform/utils/shell-split.d.ts.map +1 -0
  298. package/dist/_internal/platform/utils/shell-split.js +83 -0
  299. package/dist/_internal/platform/version.js +1 -1
  300. package/dist/_internal/platform/voice/providers/deepgram.d.ts.map +1 -1
  301. package/dist/_internal/platform/voice/providers/deepgram.js +2 -1
  302. package/dist/_internal/platform/voice/providers/elevenlabs.d.ts.map +1 -1
  303. package/dist/_internal/platform/voice/providers/elevenlabs.js +5 -4
  304. package/dist/_internal/platform/voice/providers/google.d.ts.map +1 -1
  305. package/dist/_internal/platform/voice/providers/google.js +5 -4
  306. package/dist/_internal/platform/voice/providers/microsoft.d.ts.map +1 -1
  307. package/dist/_internal/platform/voice/providers/microsoft.js +2 -1
  308. package/dist/_internal/platform/voice/providers/openai.d.ts.map +1 -1
  309. package/dist/_internal/platform/voice/providers/openai.js +4 -3
  310. package/dist/_internal/platform/voice/providers/shared.d.ts.map +1 -1
  311. package/dist/_internal/platform/voice/providers/shared.js +2 -1
  312. package/dist/_internal/platform/voice/providers/vydra.d.ts.map +1 -1
  313. package/dist/_internal/platform/voice/providers/vydra.js +3 -2
  314. package/dist/_internal/platform/watchers/registry.d.ts.map +1 -1
  315. package/dist/_internal/platform/watchers/registry.js +3 -2
  316. package/dist/_internal/platform/workflow/trigger-executor.d.ts.map +1 -1
  317. package/dist/_internal/platform/workflow/trigger-executor.js +5 -3
  318. package/dist/_internal/platform/workspace/daemon-home.d.ts.map +1 -1
  319. package/dist/_internal/platform/workspace/daemon-home.js +6 -2
  320. package/dist/_internal/platform/workspace/workspace-swap-manager.d.ts +1 -0
  321. package/dist/_internal/platform/workspace/workspace-swap-manager.d.ts.map +1 -1
  322. package/dist/_internal/platform/workspace/workspace-swap-manager.js +14 -2
  323. package/package.json +1 -1
@@ -45,13 +45,22 @@ export declare function emitToolPosthooked(bus: RuntimeEventBus, ctx: EmitterCon
45
45
  turnId: string;
46
46
  tool: string;
47
47
  }): void;
48
+ /**
49
+ * Convert any tool result (ToolResult, SyntheticToolResult, etc.) to a ToolResultSummary
50
+ * for safe emission in the event stream. Never leaks raw output; provides kind, byteSize, preview.
51
+ */
52
+ export declare function toToolResultSummary(result: {
53
+ success?: boolean;
54
+ output?: string;
55
+ error?: string;
56
+ }): import('../events/tools.js').ToolResultSummary;
48
57
  /** Emit TOOL_SUCCEEDED when a tool call completes successfully. */
49
58
  export declare function emitToolSucceeded(bus: RuntimeEventBus, ctx: EmitterContext, data: {
50
59
  callId: string;
51
60
  turnId: string;
52
61
  tool: string;
53
62
  durationMs: number;
54
- result?: unknown;
63
+ result?: import('../events/tools.js').ToolResultSummary;
55
64
  }): void;
56
65
  /** Emit TOOL_FAILED when a tool call fails. */
57
66
  export declare function emitToolFailed(bus: RuntimeEventBus, ctx: EmitterContext, data: {
@@ -60,7 +69,7 @@ export declare function emitToolFailed(bus: RuntimeEventBus, ctx: EmitterContext
60
69
  tool: string;
61
70
  error: string;
62
71
  durationMs: number;
63
- result?: unknown;
72
+ result?: import('../events/tools.js').ToolResultSummary;
64
73
  }): void;
65
74
  /** Emit TOOL_RECONCILED when unresolved tool calls are synthesized. */
66
75
  export declare function emitToolReconciled(bus: RuntimeEventBus, ctx: EmitterContext, data: {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACn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IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC7G,IAAI,CAEN;AAED,oEAAoE;AACpE,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC/G,IAAI,CAEN"}
@@ -30,6 +30,33 @@ export function emitToolMapped(bus, ctx, data) {
30
30
  export function emitToolPosthooked(bus, ctx, data) {
31
31
  bus.emit('tools', createEventEnvelope('TOOL_POSTHOOKED', { type: 'TOOL_POSTHOOKED', ...data }, ctx));
32
32
  }
33
+ /**
34
+ * Convert any tool result (ToolResult, SyntheticToolResult, etc.) to a ToolResultSummary
35
+ * for safe emission in the event stream. Never leaks raw output; provides kind, byteSize, preview.
36
+ */
37
+ export function toToolResultSummary(result) {
38
+ if (!result.success) {
39
+ const errStr = result.error ?? 'unknown error';
40
+ return {
41
+ kind: 'error',
42
+ byteSize: errStr.length,
43
+ preview: errStr.slice(0, 100),
44
+ };
45
+ }
46
+ const output = result.output ?? '';
47
+ let kind;
48
+ let preview;
49
+ try {
50
+ JSON.parse(output);
51
+ kind = 'json';
52
+ preview = output.slice(0, 100);
53
+ }
54
+ catch {
55
+ kind = 'text';
56
+ preview = output.slice(0, 100);
57
+ }
58
+ return { kind, byteSize: output.length, preview };
59
+ }
33
60
  /** Emit TOOL_SUCCEEDED when a tool call completes successfully. */
34
61
  export function emitToolSucceeded(bus, ctx, data) {
35
62
  bus.emit('tools', createEventEnvelope('TOOL_SUCCEEDED', { type: 'TOOL_SUCCEEDED', ...data }, ctx));
@@ -40,4 +40,31 @@ export declare function emitTransportTerminalFailure(bus: RuntimeEventBus, ctx:
40
40
  transportId: string;
41
41
  error: string;
42
42
  }): void;
43
+ /** OBS-18: Emit TRANSPORT_RETRY_SCHEDULED when a retry is queued with backoff. */
44
+ export declare function emitTransportRetryScheduled(bus: RuntimeEventBus, ctx: EmitterContext, data: {
45
+ transportId: string;
46
+ attempt: number;
47
+ maxAttempts: number;
48
+ backoffMs: number;
49
+ reason: string;
50
+ }): void;
51
+ /** OBS-18: Emit TRANSPORT_RETRY_EXECUTED when a retry attempt is fired. */
52
+ export declare function emitTransportRetryExecuted(bus: RuntimeEventBus, ctx: EmitterContext, data: {
53
+ transportId: string;
54
+ attempt: number;
55
+ maxAttempts: number;
56
+ }): void;
57
+ /** OBS-19: Emit STREAM_SUBSCRIBER_CONNECTED when an SSE subscriber connects. */
58
+ export declare function emitStreamSubscriberConnected(bus: RuntimeEventBus, ctx: EmitterContext, data: {
59
+ streamId: string;
60
+ subscriberId: string;
61
+ streamType: string;
62
+ }): void;
63
+ /** OBS-19: Emit STREAM_SUBSCRIBER_DISCONNECTED when an SSE subscriber disconnects. */
64
+ export declare function emitStreamSubscriberDisconnected(bus: RuntimeEventBus, ctx: EmitterContext, data: {
65
+ streamId: string;
66
+ subscriberId: string;
67
+ streamType: string;
68
+ reason?: string;
69
+ }): void;
43
70
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,mEAAmE;AACnE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAA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AAE,GACjE,IAAI,CAEN;AAED,gEAAgE;AAChE,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3C,IAAI,CAEN"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,mEAAmE;AACnE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9C,IAAI,CAEN;AAED,wEAAwE;AACxE,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAC5B,IAAI,CAEN;AAED,6DAA6D;AAC7D,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9C,IAAI,CAEN;AAED,2DAA2D;AAC3D,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAC5B,IAAI,CAEN;AAED,oEAAoE;AACpE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,WAAW,EAA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AC3C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACnE,IAAI,CAEN;AAED,sFAAsF;AACtF,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACpF,IAAI,CAEN"}
@@ -2,6 +2,7 @@
2
2
  * Transport emitters — typed emission wrappers for TransportEvent domain.
3
3
  */
4
4
  import { createEventEnvelope } from '../events/envelope.js';
5
+ import { transportRetriesTotal } from '../metrics.js';
5
6
  /** Emit TRANSPORT_INITIALIZING when the transport layer starts. */
6
7
  export function emitTransportInitializing(bus, ctx, data) {
7
8
  bus.emit('transport', createEventEnvelope('TRANSPORT_INITIALIZING', { type: 'TRANSPORT_INITIALIZING', ...data }, ctx));
@@ -34,3 +35,21 @@ export function emitTransportDisconnected(bus, ctx, data) {
34
35
  export function emitTransportTerminalFailure(bus, ctx, data) {
35
36
  bus.emit('transport', createEventEnvelope('TRANSPORT_TERMINAL_FAILURE', { type: 'TRANSPORT_TERMINAL_FAILURE', ...data }, ctx));
36
37
  }
38
+ /** OBS-18: Emit TRANSPORT_RETRY_SCHEDULED when a retry is queued with backoff. */
39
+ export function emitTransportRetryScheduled(bus, ctx, data) {
40
+ transportRetriesTotal.add(1, { transport_type: data.transportId, reason: data.reason });
41
+ bus.emit('transport', createEventEnvelope('TRANSPORT_RETRY_SCHEDULED', { type: 'TRANSPORT_RETRY_SCHEDULED', ...data }, ctx));
42
+ }
43
+ /** OBS-18: Emit TRANSPORT_RETRY_EXECUTED when a retry attempt is fired. */
44
+ export function emitTransportRetryExecuted(bus, ctx, data) {
45
+ transportRetriesTotal.add(1, { transport_type: data.transportId });
46
+ bus.emit('transport', createEventEnvelope('TRANSPORT_RETRY_EXECUTED', { type: 'TRANSPORT_RETRY_EXECUTED', ...data }, ctx));
47
+ }
48
+ /** OBS-19: Emit STREAM_SUBSCRIBER_CONNECTED when an SSE subscriber connects. */
49
+ export function emitStreamSubscriberConnected(bus, ctx, data) {
50
+ bus.emit('transport', createEventEnvelope('STREAM_SUBSCRIBER_CONNECTED', { type: 'STREAM_SUBSCRIBER_CONNECTED', ...data }, ctx));
51
+ }
52
+ /** OBS-19: Emit STREAM_SUBSCRIBER_DISCONNECTED when an SSE subscriber disconnects. */
53
+ export function emitStreamSubscriberDisconnected(bus, ctx, data) {
54
+ bus.emit('transport', createEventEnvelope('STREAM_SUBSCRIBER_DISCONNECTED', { type: 'STREAM_SUBSCRIBER_DISCONNECTED', ...data }, ctx));
55
+ }
@@ -32,17 +32,38 @@ export declare function emitStreamDelta(bus: RuntimeEventBus, ctx: EmitterContex
32
32
  export declare function emitStreamEnd(bus: RuntimeEventBus, ctx: EmitterContext, data: {
33
33
  turnId: string;
34
34
  }): void;
35
+ /** OBS-04: Emit LLM_REQUEST_STARTED when a provider chat request is about to be dispatched. */
36
+ export declare function emitLlmRequestStarted(bus: RuntimeEventBus, ctx: EmitterContext, data: {
37
+ turnId: string;
38
+ provider: string;
39
+ model: string;
40
+ promptSummary: {
41
+ length: number;
42
+ sha256: string;
43
+ first100chars: string;
44
+ } | string;
45
+ }): void;
35
46
  /** Emit LLM_RESPONSE_RECEIVED when a provider chat call completes within a turn iteration. */
36
47
  export declare function emitLlmResponseReceived(bus: RuntimeEventBus, ctx: EmitterContext, data: {
37
48
  turnId: string;
38
49
  provider: string;
39
50
  model: string;
40
- content: string;
51
+ contentSummary: {
52
+ length: number;
53
+ sha256: string;
54
+ first100chars: string;
55
+ } | string;
41
56
  toolCallCount: number;
42
57
  inputTokens: number;
43
58
  outputTokens: number;
44
59
  cacheReadTokens?: number;
45
60
  cacheWriteTokens?: number;
61
+ /** OBS-04 enrichments */
62
+ durationMs?: number;
63
+ retries?: number;
64
+ costUsdCents?: number;
65
+ finishReason?: string;
66
+ providerRequestId?: string;
46
67
  }): void;
47
68
  /** Emit TOOL_BATCH_READY when a set of tool calls is ready for execution. */
48
69
  export declare function emitToolBatchReady(bus: RuntimeEventBus, ctx: EmitterContext, data: {
@@ -1 +1 @@
1
- {"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/turn.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC,IAAI,CAEN;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAEN;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;CACrD,GACA,IAAI,CAEN;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAA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,IAAI,CAEN;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAEN;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,gBAAgB,CAAC;CAC5C,GACA,IAAI,CAEN;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EACN,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,GACb,2BAA2B,GAC3B,kBAAkB,CAAC;CACxB,GACA,IAAI,CAEN;AAED,mDAAmD;AACnD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,GACjE,IAAI,CAEN"}
1
+ {"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/turn.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,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AAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAEN;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAEN;AAED,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,gBAAgB,CAAC;CAC5C,GACA,IAAI,CAEN;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EACN,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,GACb,2BAA2B,GAC3B,kBAAkB,CAAC;CACxB,GACA,IAAI,CAEN;AAED,mDAAmD;AACnD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,GACjE,IAAI,CAEN"}
@@ -2,6 +2,11 @@
2
2
  * Turn emitters — typed emission wrappers for TurnEvent domain.
3
3
  *
4
4
  * Import and call these instead of emitting raw strings.
5
+ *
6
+ * Note: raw prompt/response content is carried on the event bus as-is so
7
+ * internal consumers (conversation reducer, reply pipeline, stream UI) can
8
+ * render and advance state. OBS-06 redaction happens at the telemetry
9
+ * boundary (TelemetryApiService) where events become externally observable.
5
10
  */
6
11
  import { createEventEnvelope } from '../events/envelope.js';
7
12
  /** Emit TURN_SUBMITTED when a user prompt is submitted. */
@@ -28,6 +33,10 @@ export function emitStreamDelta(bus, ctx, data) {
28
33
  export function emitStreamEnd(bus, ctx, data) {
29
34
  bus.emit('turn', createEventEnvelope('STREAM_END', { type: 'STREAM_END', ...data }, ctx));
30
35
  }
36
+ /** OBS-04: Emit LLM_REQUEST_STARTED when a provider chat request is about to be dispatched. */
37
+ export function emitLlmRequestStarted(bus, ctx, data) {
38
+ bus.emit('turn', createEventEnvelope('LLM_REQUEST_STARTED', { type: 'LLM_REQUEST_STARTED', ...data }, ctx));
39
+ }
31
40
  /** Emit LLM_RESPONSE_RECEIVED when a provider chat call completes within a turn iteration. */
32
41
  export function emitLlmResponseReceived(bus, ctx, data) {
33
42
  bus.emit('turn', createEventEnvelope('LLM_RESPONSE_RECEIVED', { type: 'LLM_RESPONSE_RECEIVED', ...data }, ctx));
@@ -36,6 +36,26 @@ export { SURFACE_KINDS } from './surfaces.js';
36
36
  export type { KnowledgeEvent, KnowledgeEventType } from './knowledge.js';
37
37
  /** Listener callback receiving a fully-formed envelope. */
38
38
  export type EnvelopeListener<T extends AnyRuntimeEvent = AnyRuntimeEvent> = (envelope: RuntimeEventEnvelope<T['type'], T>) => void;
39
+ /**
40
+ * Maximum listeners per channel before a potential memory leak warning is emitted.
41
+ *
42
+ * 100 is a generous threshold for a single event type or domain; normal usage
43
+ * rarely exceeds single-digit listeners. Exceeding this strongly suggests a
44
+ * subscriber is being registered without a corresponding unsubscribe.
45
+ */
46
+ export declare const MAX_LISTENERS = 100;
47
+ /**
48
+ * Options accepted by the RuntimeEventBus constructor.
49
+ */
50
+ export interface RuntimeEventBusOptions {
51
+ /**
52
+ * Override the maximum number of listeners per channel.
53
+ * Defaults to MAX_LISTENERS (100).
54
+ * Values above zero are accepted; the cap is applied per event-type channel
55
+ * and per domain channel independently.
56
+ */
57
+ maxListeners?: number;
58
+ }
39
59
  /**
40
60
  * RuntimeEventBus — typed event bus for domain-structured runtime events.
41
61
  *
@@ -53,6 +73,13 @@ export declare class RuntimeEventBus {
53
73
  private readonly _listeners;
54
74
  /** Per-domain listener sets. Keyed by RuntimeEventDomain. */
55
75
  private readonly _domainListeners;
76
+ /** Effective listener cap for this instance. */
77
+ private readonly _maxListeners;
78
+ /** Track per-listener error counts for misbehaving-listener dedup. */
79
+ private readonly _listenerErrorCounts;
80
+ /** Number of errors a listener must throw before OPS_LISTENER_MISBEHAVING is emitted. */
81
+ private static readonly _MISBEHAVE_DEDUP_THRESHOLD;
82
+ constructor(opts?: RuntimeEventBusOptions);
56
83
  /**
57
84
  * Subscribe to a specific event type.
58
85
  *
@@ -88,6 +115,24 @@ export declare class RuntimeEventBus {
88
115
  * @param envelope - The fully-formed envelope to dispatch.
89
116
  */
90
117
  emit<D extends RuntimeEventDomain>(domain: D, envelope: RuntimeEventEnvelope<DomainEventMap[D]['type'], DomainEventMap[D]>): void;
118
+ /**
119
+ * Record a listener error: increment metrics, update error count, emit
120
+ * OPS_LISTENER_MISBEHAVING once the dedup threshold is reached, and log.
121
+ *
122
+ * @param listener - The misbehaving listener function.
123
+ * @param eventType - The event type that triggered the listener.
124
+ * @param err - The thrown value caught from the listener.
125
+ * @param domain - Optional domain name, present when the listener was a domain subscriber.
126
+ */
127
+ private _recordListenerError;
128
+ /**
129
+ * Directly dispatch an OPS_LISTENER_MISBEHAVING envelope to any registered
130
+ * OPS_LISTENER_MISBEHAVING and 'ops' domain listeners.
131
+ *
132
+ * Bypasses emit() to avoid potential recursion: a listener watching for
133
+ * misbehaving events itself misbehaving would otherwise cause infinite loops.
134
+ */
135
+ private _emitListenerMisbehaving;
91
136
  private _off;
92
137
  private _offDomain;
93
138
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eA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AO,CAAC,IAAI;IAMZ,OAAO,CAAC,UAAU;CAKnB"}
@@ -7,7 +7,9 @@
7
7
  * ```
8
8
  */
9
9
  import { logger } from '../../utils/logger.js';
10
+ import { createEventEnvelope } from './envelope.js';
10
11
  import { summarizeError } from '../../utils/error-display.js';
12
+ import { listenerErrorsTotal } from '../metrics.js';
11
13
  export { createEventEnvelope } from './envelope.js';
12
14
  export { RUNTIME_EVENT_DOMAINS, isRuntimeEventDomain } from './domain-map.js';
13
15
  export { AUTOMATION_SCHEDULE_KINDS, AUTOMATION_RUN_OUTCOMES } from './automation.js';
@@ -23,7 +25,15 @@ export { SURFACE_KINDS } from './surfaces.js';
23
25
  * rarely exceeds single-digit listeners. Exceeding this strongly suggests a
24
26
  * subscriber is being registered without a corresponding unsubscribe.
25
27
  */
26
- const MAX_LISTENERS = 100;
28
+ export const MAX_LISTENERS = 100;
29
+ /** Extract a plain string error message from an unknown thrown value. */
30
+ function extractErrorMessage(err) {
31
+ if (err instanceof Error)
32
+ return err.message;
33
+ if (typeof err === 'string')
34
+ return err;
35
+ return summarizeError(err);
36
+ }
27
37
  /**
28
38
  * RuntimeEventBus — typed event bus for domain-structured runtime events.
29
39
  *
@@ -41,6 +51,15 @@ export class RuntimeEventBus {
41
51
  _listeners = new Map();
42
52
  /** Per-domain listener sets. Keyed by RuntimeEventDomain. */
43
53
  _domainListeners = new Map();
54
+ /** Effective listener cap for this instance. */
55
+ _maxListeners;
56
+ /** Track per-listener error counts for misbehaving-listener dedup. */
57
+ _listenerErrorCounts = new WeakMap();
58
+ /** Number of errors a listener must throw before OPS_LISTENER_MISBEHAVING is emitted. */
59
+ static _MISBEHAVE_DEDUP_THRESHOLD = 1;
60
+ constructor(opts) {
61
+ this._maxListeners = opts?.maxListeners ?? MAX_LISTENERS;
62
+ }
44
63
  /**
45
64
  * Subscribe to a specific event type.
46
65
  *
@@ -54,11 +73,18 @@ export class RuntimeEventBus {
54
73
  }
55
74
  const set = this._listeners.get(eventType);
56
75
  set.add(callback);
57
- if (set.size > MAX_LISTENERS) {
76
+ if (set.size > this._maxListeners) {
77
+ if (process.env['NODE_ENV'] === 'development') {
78
+ // Remove the just-added listener before throwing to maintain state consistency.
79
+ set.delete(callback);
80
+ if (set.size === 0)
81
+ this._listeners.delete(eventType);
82
+ throw new RangeError(`[RuntimeEventBus] listener cap exceeded — maxListeners=${this._maxListeners} eventType=${String(eventType)}`);
83
+ }
58
84
  logger.warn('[RuntimeEventBus] possible listener leak detected', {
59
85
  eventType,
60
86
  count: set.size,
61
- max: MAX_LISTENERS,
87
+ max: this._maxListeners,
62
88
  });
63
89
  }
64
90
  return () => this._off(eventType, callback);
@@ -76,11 +102,18 @@ export class RuntimeEventBus {
76
102
  }
77
103
  const set = this._domainListeners.get(domain);
78
104
  set.add(callback);
79
- if (set.size > MAX_LISTENERS) {
105
+ if (set.size > this._maxListeners) {
106
+ if (process.env['NODE_ENV'] === 'development') {
107
+ // Remove the just-added listener before throwing to maintain state consistency.
108
+ set.delete(callback);
109
+ if (set.size === 0)
110
+ this._domainListeners.delete(domain);
111
+ throw new RangeError(`[RuntimeEventBus] domain listener cap exceeded — maxListeners=${this._maxListeners} domain=${String(domain)}`);
112
+ }
80
113
  logger.warn('[RuntimeEventBus] possible domain listener leak detected', {
81
114
  domain,
82
115
  count: set.size,
83
- max: MAX_LISTENERS,
116
+ max: this._maxListeners,
84
117
  });
85
118
  }
86
119
  return () => this._offDomain(domain, callback);
@@ -92,29 +125,104 @@ export class RuntimeEventBus {
92
125
  const typeHandlers = typeSet ? Array.from(typeSet) : [];
93
126
  const domainSet = this._domainListeners.get(domain);
94
127
  const domainHandlers = domainSet ? Array.from(domainSet) : [];
128
+ // OBS-14: Dispatch each subscriber in its own microtask so a slow or
129
+ // throwing subscriber cannot block the emitter. Errors are caught and
130
+ // logged per-subscriber; a single bad handler never cascades to others.
95
131
  // Dispatch to per-type listeners
96
132
  for (const handler of typeHandlers) {
97
- try {
98
- handler(envelope);
99
- }
100
- catch (err) {
101
- logger.error('[RuntimeEventBus] listener error', {
102
- eventType: envelope.type,
103
- error: summarizeError(err),
104
- });
105
- }
133
+ const h = handler;
134
+ const ev = envelope;
135
+ const evType = envelope.type;
136
+ queueMicrotask(() => {
137
+ try {
138
+ h(ev);
139
+ }
140
+ catch (err) {
141
+ this._recordListenerError(h, evType, err);
142
+ }
143
+ });
106
144
  }
107
145
  // Dispatch to per-domain listeners
108
146
  for (const handler of domainHandlers) {
109
- try {
110
- handler(envelope);
147
+ const h = handler;
148
+ const ev = envelope;
149
+ const evType = envelope.type;
150
+ const d = domain;
151
+ queueMicrotask(() => {
152
+ try {
153
+ h(ev);
154
+ }
155
+ catch (err) {
156
+ this._recordListenerError(h, evType, err, String(d));
157
+ }
158
+ });
159
+ }
160
+ }
161
+ /**
162
+ * Record a listener error: increment metrics, update error count, emit
163
+ * OPS_LISTENER_MISBEHAVING once the dedup threshold is reached, and log.
164
+ *
165
+ * @param listener - The misbehaving listener function.
166
+ * @param eventType - The event type that triggered the listener.
167
+ * @param err - The thrown value caught from the listener.
168
+ * @param domain - Optional domain name, present when the listener was a domain subscriber.
169
+ */
170
+ _recordListenerError(listener, eventType, err, domain) {
171
+ const errMsg = extractErrorMessage(err);
172
+ listenerErrorsTotal.add(1, { event_type: eventType });
173
+ const prev = this._listenerErrorCounts.get(listener) ?? 0;
174
+ const next = prev + 1;
175
+ this._listenerErrorCounts.set(listener, next);
176
+ if (next === RuntimeEventBus._MISBEHAVE_DEDUP_THRESHOLD) {
177
+ this._emitListenerMisbehaving(listener, String(eventType), errMsg, next);
178
+ }
179
+ if (domain !== undefined) {
180
+ logger.error('[RuntimeEventBus] domain listener error', {
181
+ domain,
182
+ eventType,
183
+ error: summarizeError(err),
184
+ });
185
+ }
186
+ else {
187
+ logger.error('[RuntimeEventBus] listener error', {
188
+ eventType,
189
+ error: summarizeError(err),
190
+ });
191
+ }
192
+ }
193
+ /**
194
+ * Directly dispatch an OPS_LISTENER_MISBEHAVING envelope to any registered
195
+ * OPS_LISTENER_MISBEHAVING and 'ops' domain listeners.
196
+ *
197
+ * Bypasses emit() to avoid potential recursion: a listener watching for
198
+ * misbehaving events itself misbehaving would otherwise cause infinite loops.
199
+ */
200
+ _emitListenerMisbehaving(listener, eventType, errorMessage, errorCount) {
201
+ const payload = {
202
+ type: 'OPS_LISTENER_MISBEHAVING',
203
+ listenerId: listener.name || '(anonymous)',
204
+ eventType,
205
+ errorMessage,
206
+ errorCount,
207
+ };
208
+ const envelope = createEventEnvelope('OPS_LISTENER_MISBEHAVING', payload, { sessionId: 'runtime-bus', source: 'runtime-bus' });
209
+ // Dispatch directly — no queueMicrotask, no recursion path through emit().
210
+ const typeListeners = this._listeners.get('OPS_LISTENER_MISBEHAVING');
211
+ if (typeListeners) {
212
+ for (const h of Array.from(typeListeners)) {
213
+ try {
214
+ h(envelope);
215
+ }
216
+ catch { /* suppress secondary errors */ }
111
217
  }
112
- catch (err) {
113
- logger.error('[RuntimeEventBus] domain listener error', {
114
- domain,
115
- eventType: envelope.type,
116
- error: summarizeError(err),
117
- });
218
+ }
219
+ const domainListeners = this._domainListeners.get('ops');
220
+ if (domainListeners) {
221
+ for (const h of Array.from(domainListeners)) {
222
+ try {
223
+ h(envelope);
224
+ }
225
+ catch { /* suppress secondary errors */ }
118
226
  }
119
227
  }
120
228
  }
@@ -76,6 +76,14 @@ export type OpsEvent =
76
76
  note?: string;
77
77
  outcome: 'success' | 'rejected' | 'error';
78
78
  errorMessage?: string;
79
+ }
80
+ /** A subscriber threw an error during event dispatch; emitted after dedup threshold. */
81
+ | {
82
+ type: 'OPS_LISTENER_MISBEHAVING';
83
+ listenerId: string;
84
+ eventType: string;
85
+ errorMessage: string;
86
+ errorCount: number;
79
87
  };
80
88
  /** All ops event type literals as a union. */
81
89
  export type OpsEventType = OpsEvent['type'];
@@ -1 +1 @@
1
- {"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/ops.ts"],"names":[],"mappings":"AAAA,qF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C9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACH,0CAA0C;GACxC;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACH,kDAAkD;GAChD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEN,8CAA8C;AAC9C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/ops.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;GAMG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,kBAAkB,CAAC;AAEvB,MAAM,MAAM,QAAQ;AAClB,iDAAiD;AAC/C;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AACH,iDAAiD;GAC/C;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AACH,8CAA8C;GAC5C;IACE,IAAI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,IAAI,EAAE,0BAA0B,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN,8CAA8C;AAC9C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
@@ -38,6 +38,53 @@ export type SecurityEvent =
38
38
  tokenId: string;
39
39
  label: string;
40
40
  reason: 'scope_violation' | 'rotation_overdue' | 'scope_violation_and_rotation_overdue';
41
+ }
42
+ /** Emitted when a user authenticates successfully. Never includes credentials. */
43
+ | {
44
+ type: 'AUTH_SUCCEEDED';
45
+ /** Authenticated username (display-safe). */
46
+ username: string;
47
+ /** Session token ID (not the token value). */
48
+ sessionId: string;
49
+ /** Client IP address. */
50
+ clientIp: string;
51
+ /** Authentication method used. */
52
+ method: 'password' | 'cookie' | 'token';
53
+ }
54
+ /** Emitted when an authentication attempt fails. Never includes credential values. */
55
+ | {
56
+ type: 'AUTH_FAILED';
57
+ /** The username that was attempted (may be blank or spoofed). */
58
+ usernameAttempted: string;
59
+ /** Client IP address. */
60
+ clientIp: string;
61
+ /** Machine-readable failure reason. */
62
+ reason: 'invalid_credentials' | 'rate_limited' | 'session_expired' | 'origin_denied' | 'unknown';
63
+ }
64
+ /** Emitted when a companion pairing request is initiated. */
65
+ | {
66
+ type: 'COMPANION_PAIR_REQUESTED';
67
+ clientIp: string;
68
+ }
69
+ /** Emitted when a companion pairing is successfully verified. */
70
+ | {
71
+ type: 'COMPANION_PAIR_VERIFIED';
72
+ /** Opaque token ID (not the token value). */
73
+ tokenId: string;
74
+ clientIp: string;
75
+ }
76
+ /** Emitted when a companion token is rotated. */
77
+ | {
78
+ type: 'COMPANION_TOKEN_ROTATED';
79
+ /** New opaque token ID (not the token value). */
80
+ newTokenId: string;
81
+ clientIp: string;
82
+ }
83
+ /** Emitted when a companion token is revoked. */
84
+ | {
85
+ type: 'COMPANION_TOKEN_REVOKED';
86
+ clientIp: string;
87
+ reason?: string;
41
88
  };
42
89
  /** All security event type literals as a union. */
43
90
  export type SecurityEventType = SecurityEvent['type'];
@@ -1 +1 @@
1
- {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/security.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,aAAa;AACvB,0EAA0E;AACxE;IACE,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AACH,+EAA+E;GAC7E;IACE,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AACH,sEAAsE;GACpE;IACE,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AACH,+DAA+D;GAC7D;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,sCAAsC,CAAC;CACzF,CAAC;AAEN,mDAAmD;AACnD,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/security.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MA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