@evalops/maestro 0.10.8 → 0.10.11

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 (1009) hide show
  1. package/README.md +3 -1
  2. package/dist/agent/action-approval.d.ts +6 -0
  3. package/dist/agent/action-approval.d.ts.map +1 -1
  4. package/dist/agent/action-approval.js.map +1 -1
  5. package/dist/agent/agent.d.ts +13 -1
  6. package/dist/agent/agent.d.ts.map +1 -1
  7. package/dist/agent/agent.js +368 -1
  8. package/dist/agent/agent.js.map +1 -1
  9. package/dist/agent/auto-compaction.d.ts +4 -4
  10. package/dist/agent/auto-compaction.d.ts.map +1 -1
  11. package/dist/agent/auto-compaction.js.map +1 -1
  12. package/dist/agent/compaction-cleanup.d.ts +2 -0
  13. package/dist/agent/compaction-cleanup.d.ts.map +1 -1
  14. package/dist/agent/compaction-cleanup.js +17 -2
  15. package/dist/agent/compaction-cleanup.js.map +1 -1
  16. package/dist/agent/compaction.d.ts +3 -1
  17. package/dist/agent/compaction.d.ts.map +1 -1
  18. package/dist/agent/compaction.js +10 -2
  19. package/dist/agent/compaction.js.map +1 -1
  20. package/dist/agent/context-manager.d.ts +4 -0
  21. package/dist/agent/context-manager.d.ts.map +1 -1
  22. package/dist/agent/context-manager.js +8 -0
  23. package/dist/agent/context-manager.js.map +1 -1
  24. package/dist/agent/context-providers.d.ts +2 -0
  25. package/dist/agent/context-providers.d.ts.map +1 -1
  26. package/dist/agent/context-providers.js +3 -2
  27. package/dist/agent/context-providers.js.map +1 -1
  28. package/dist/agent/providers/google-gemini-cli.js +17 -5
  29. package/dist/agent/providers/google.js +174 -144
  30. package/dist/agent/providers/openai-codex-responses.d.ts +4 -0
  31. package/dist/agent/providers/openai-codex-responses.d.ts.map +1 -0
  32. package/dist/agent/providers/openai-codex-responses.js +637 -0
  33. package/dist/agent/providers/openai-codex-responses.js.map +1 -0
  34. package/dist/agent/providers/openai-codex-session.d.ts +18 -0
  35. package/dist/agent/providers/openai-codex-session.d.ts.map +1 -0
  36. package/dist/agent/providers/openai-codex-session.js +53 -0
  37. package/dist/agent/providers/openai-codex-session.js.map +1 -0
  38. package/dist/agent/providers/openai-responses-sdk.d.ts.map +1 -1
  39. package/dist/agent/providers/openai-responses-sdk.js +16 -6
  40. package/dist/agent/providers/openai-responses-sdk.js.map +1 -1
  41. package/dist/agent/providers/openai-shared.d.ts +12 -5
  42. package/dist/agent/providers/openai-shared.d.ts.map +1 -1
  43. package/dist/agent/providers/openai-shared.js +291 -2
  44. package/dist/agent/providers/openai-shared.js.map +1 -1
  45. package/dist/agent/providers/openai.d.ts +1 -1
  46. package/dist/agent/providers/openai.d.ts.map +1 -1
  47. package/dist/agent/providers/openai.js +48 -20
  48. package/dist/agent/providers/openai.js.map +1 -1
  49. package/dist/agent/providers/vertex.js +7 -0
  50. package/dist/agent/tracing.d.ts +16 -5
  51. package/dist/agent/tracing.d.ts.map +1 -1
  52. package/dist/agent/tracing.js +44 -2
  53. package/dist/agent/tracing.js.map +1 -1
  54. package/dist/agent/transport/create-provider-stream.d.ts.map +1 -1
  55. package/dist/agent/transport/create-provider-stream.js +9 -0
  56. package/dist/agent/transport/create-provider-stream.js.map +1 -1
  57. package/dist/agent/transport/tool-execution-bridge.d.ts +86 -0
  58. package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -0
  59. package/dist/agent/transport/tool-execution-bridge.js +665 -0
  60. package/dist/agent/transport/tool-execution-bridge.js.map +1 -0
  61. package/dist/agent/transport/tool-execution.d.ts +3 -0
  62. package/dist/agent/transport/tool-execution.d.ts.map +1 -1
  63. package/dist/agent/transport/tool-execution.js +16 -1
  64. package/dist/agent/transport/tool-execution.js.map +1 -1
  65. package/dist/agent/transport/tool-safety-pipeline.d.ts +7 -1
  66. package/dist/agent/transport/tool-safety-pipeline.d.ts.map +1 -1
  67. package/dist/agent/transport/tool-safety-pipeline.js +207 -40
  68. package/dist/agent/transport/tool-safety-pipeline.js.map +1 -1
  69. package/dist/agent/transport/tool-update-queue.d.ts +2 -0
  70. package/dist/agent/transport/tool-update-queue.d.ts.map +1 -1
  71. package/dist/agent/transport/tool-update-queue.js.map +1 -1
  72. package/dist/agent/transport.d.ts +3 -0
  73. package/dist/agent/transport.d.ts.map +1 -1
  74. package/dist/agent/transport.js +96 -16
  75. package/dist/agent/transport.js.map +1 -1
  76. package/dist/agent/types.d.ts +50 -2
  77. package/dist/agent/types.d.ts.map +1 -1
  78. package/dist/agent/types.js.map +1 -1
  79. package/dist/approvals/platform-action-approval.d.ts +32 -0
  80. package/dist/approvals/platform-action-approval.d.ts.map +1 -0
  81. package/dist/approvals/platform-action-approval.js +210 -0
  82. package/dist/approvals/platform-action-approval.js.map +1 -0
  83. package/dist/approvals/service-client.d.ts +56 -0
  84. package/dist/approvals/service-client.d.ts.map +1 -0
  85. package/dist/approvals/service-client.js +316 -0
  86. package/dist/approvals/service-client.js.map +1 -0
  87. package/dist/audit/logger.d.ts +4 -4
  88. package/dist/bootstrap/auth-setup.d.ts +2 -2
  89. package/dist/bootstrap/auth-setup.d.ts.map +1 -1
  90. package/dist/bootstrap/auth-setup.js +4 -7
  91. package/dist/bootstrap/auth-setup.js.map +1 -1
  92. package/dist/cli/args.d.ts +2 -0
  93. package/dist/cli/args.d.ts.map +1 -1
  94. package/dist/cli/args.js +29 -0
  95. package/dist/cli/args.js.map +1 -1
  96. package/dist/cli/commands/codex.d.ts +2 -0
  97. package/dist/cli/commands/codex.d.ts.map +1 -0
  98. package/dist/cli/commands/codex.js +65 -0
  99. package/dist/cli/commands/codex.js.map +1 -0
  100. package/dist/cli/commands/config.js +1 -1
  101. package/dist/cli/commands/config.js.map +1 -1
  102. package/dist/cli/commands/evalops.d.ts +2 -0
  103. package/dist/cli/commands/evalops.d.ts.map +1 -0
  104. package/dist/cli/commands/evalops.js +74 -0
  105. package/dist/cli/commands/evalops.js.map +1 -0
  106. package/dist/cli/commands/hosted-runner.d.ts +23 -0
  107. package/dist/cli/commands/hosted-runner.d.ts.map +1 -0
  108. package/dist/cli/commands/hosted-runner.js +241 -0
  109. package/dist/cli/commands/hosted-runner.js.map +1 -0
  110. package/dist/cli/commands/init.d.ts +4 -0
  111. package/dist/cli/commands/init.d.ts.map +1 -0
  112. package/dist/cli/commands/init.js +140 -0
  113. package/dist/cli/commands/init.js.map +1 -0
  114. package/dist/cli/commands/memory.d.ts.map +1 -1
  115. package/dist/cli/commands/memory.js +23 -30
  116. package/dist/cli/commands/memory.js.map +1 -1
  117. package/dist/cli/commands/remote.d.ts +3 -0
  118. package/dist/cli/commands/remote.d.ts.map +1 -0
  119. package/dist/cli/commands/remote.js +631 -0
  120. package/dist/cli/commands/remote.js.map +1 -0
  121. package/dist/cli/commands/stats.d.ts +7 -0
  122. package/dist/cli/commands/stats.d.ts.map +1 -0
  123. package/dist/cli/commands/stats.js +167 -0
  124. package/dist/cli/commands/stats.js.map +1 -0
  125. package/dist/cli/headless-protocol.d.ts +16 -1
  126. package/dist/cli/headless-protocol.d.ts.map +1 -1
  127. package/dist/cli/headless-protocol.js +60 -4
  128. package/dist/cli/headless-protocol.js.map +1 -1
  129. package/dist/cli/headless.d.ts.map +1 -1
  130. package/dist/cli/headless.js +1 -0
  131. package/dist/cli/headless.js.map +1 -1
  132. package/dist/cli/help.d.ts.map +1 -1
  133. package/dist/cli/help.js +44 -1
  134. package/dist/cli/help.js.map +1 -1
  135. package/dist/cli/jsonl-writer.d.ts.map +1 -1
  136. package/dist/cli/jsonl-writer.js +19 -6
  137. package/dist/cli/jsonl-writer.js.map +1 -1
  138. package/dist/cli-tui/client-tools/client-tool-controller.d.ts.map +1 -1
  139. package/dist/cli-tui/client-tools/client-tool-controller.js +17 -1
  140. package/dist/cli-tui/client-tools/client-tool-controller.js.map +1 -1
  141. package/dist/cli-tui/commands/access-command.js +1 -1
  142. package/dist/cli-tui/commands/access-command.js.map +1 -1
  143. package/dist/cli-tui/commands/audit-command.js +1 -1
  144. package/dist/cli-tui/commands/audit-command.js.map +1 -1
  145. package/dist/cli-tui/commands/command-catalog.d.ts +29 -0
  146. package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -0
  147. package/dist/cli-tui/commands/command-catalog.js +645 -0
  148. package/dist/cli-tui/commands/command-catalog.js.map +1 -0
  149. package/dist/cli-tui/commands/command-registry-adapter.d.ts +12 -0
  150. package/dist/cli-tui/commands/command-registry-adapter.d.ts.map +1 -0
  151. package/dist/cli-tui/commands/command-registry-adapter.js +120 -0
  152. package/dist/cli-tui/commands/command-registry-adapter.js.map +1 -0
  153. package/dist/cli-tui/commands/command-suite-catalog.d.ts +14 -0
  154. package/dist/cli-tui/commands/command-suite-catalog.d.ts.map +1 -0
  155. package/dist/cli-tui/commands/command-suite-catalog.js +147 -0
  156. package/dist/cli-tui/commands/command-suite-catalog.js.map +1 -0
  157. package/dist/cli-tui/commands/{grouped-command-handlers.d.ts → command-suite-handlers.d.ts} +27 -26
  158. package/dist/cli-tui/commands/command-suite-handlers.d.ts.map +1 -0
  159. package/dist/cli-tui/commands/command-suite-handlers.js +110 -0
  160. package/dist/cli-tui/commands/command-suite-handlers.js.map +1 -0
  161. package/dist/cli-tui/commands/hotkeys-command.d.ts +1 -1
  162. package/dist/cli-tui/commands/hotkeys-command.d.ts.map +1 -1
  163. package/dist/cli-tui/commands/hotkeys-command.js +2 -2
  164. package/dist/cli-tui/commands/hotkeys-command.js.map +1 -1
  165. package/dist/cli-tui/commands/limits-command.js +1 -1
  166. package/dist/cli-tui/commands/limits-command.js.map +1 -1
  167. package/dist/cli-tui/commands/pii-command.js +1 -1
  168. package/dist/cli-tui/commands/pii-command.js.map +1 -1
  169. package/dist/cli-tui/commands/registry.d.ts +1 -1
  170. package/dist/cli-tui/commands/registry.d.ts.map +1 -1
  171. package/dist/cli-tui/commands/registry.js +29 -921
  172. package/dist/cli-tui/commands/registry.js.map +1 -1
  173. package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.d.ts +2 -1
  174. package/dist/cli-tui/commands/subcommands/auth-commands.d.ts.map +1 -0
  175. package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.js +22 -6
  176. package/dist/cli-tui/commands/subcommands/auth-commands.js.map +1 -0
  177. package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.d.ts +0 -1
  178. package/dist/cli-tui/commands/subcommands/config-commands.d.ts.map +1 -0
  179. package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.js +2 -2
  180. package/dist/cli-tui/commands/subcommands/config-commands.js.map +1 -0
  181. package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.d.ts +1 -2
  182. package/dist/cli-tui/commands/subcommands/diag-commands.d.ts.map +1 -0
  183. package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.js +5 -7
  184. package/dist/cli-tui/commands/subcommands/diag-commands.js.map +1 -0
  185. package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.d.ts +0 -2
  186. package/dist/cli-tui/commands/subcommands/git-commands.d.ts.map +1 -0
  187. package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.js +2 -2
  188. package/dist/cli-tui/commands/subcommands/git-commands.js.map +1 -0
  189. package/dist/cli-tui/commands/{grouped → subcommands}/index.d.ts +2 -2
  190. package/dist/cli-tui/commands/subcommands/index.d.ts.map +1 -0
  191. package/dist/cli-tui/commands/{grouped → subcommands}/index.js +2 -2
  192. package/dist/cli-tui/commands/subcommands/index.js.map +1 -0
  193. package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.d.ts +0 -1
  194. package/dist/cli-tui/commands/subcommands/safety-commands.d.ts.map +1 -0
  195. package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.js +12 -12
  196. package/dist/cli-tui/commands/subcommands/safety-commands.js.map +1 -0
  197. package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.d.ts +1 -2
  198. package/dist/cli-tui/commands/subcommands/session-commands.d.ts.map +1 -0
  199. package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.js +3 -3
  200. package/dist/cli-tui/commands/subcommands/session-commands.js.map +1 -0
  201. package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.d.ts +0 -1
  202. package/dist/cli-tui/commands/subcommands/tools-commands.d.ts.map +1 -0
  203. package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.js +2 -2
  204. package/dist/cli-tui/commands/subcommands/tools-commands.js.map +1 -0
  205. package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.d.ts +0 -1
  206. package/dist/cli-tui/commands/subcommands/ui-commands.d.ts.map +1 -0
  207. package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.js +5 -5
  208. package/dist/cli-tui/commands/subcommands/ui-commands.js.map +1 -0
  209. package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.d.ts +1 -2
  210. package/dist/cli-tui/commands/subcommands/undo-commands.d.ts.map +1 -0
  211. package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.js +6 -6
  212. package/dist/cli-tui/commands/subcommands/undo-commands.js.map +1 -0
  213. package/dist/cli-tui/commands/subcommands/usage-commands.d.ts.map +1 -0
  214. package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.js +2 -2
  215. package/dist/cli-tui/commands/subcommands/usage-commands.js.map +1 -0
  216. package/dist/cli-tui/commands/{grouped → subcommands}/utils.d.ts +15 -15
  217. package/dist/cli-tui/commands/subcommands/utils.d.ts.map +1 -0
  218. package/dist/cli-tui/commands/{grouped → subcommands}/utils.js +13 -8
  219. package/dist/cli-tui/commands/subcommands/utils.js.map +1 -0
  220. package/dist/cli-tui/commands/types.d.ts +3 -3
  221. package/dist/cli-tui/commands/types.d.ts.map +1 -1
  222. package/dist/cli-tui/commands/types.js.map +1 -1
  223. package/dist/cli-tui/editor-view.d.ts +1 -1
  224. package/dist/cli-tui/editor-view.d.ts.map +1 -1
  225. package/dist/cli-tui/editor-view.js +1 -1
  226. package/dist/cli-tui/editor-view.js.map +1 -1
  227. package/dist/cli-tui/oauth/oauth-flow-controller.d.ts +4 -0
  228. package/dist/cli-tui/oauth/oauth-flow-controller.d.ts.map +1 -1
  229. package/dist/cli-tui/oauth/oauth-flow-controller.js +76 -5
  230. package/dist/cli-tui/oauth/oauth-flow-controller.js.map +1 -1
  231. package/dist/cli-tui/run/run-controller.d.ts +2 -2
  232. package/dist/cli-tui/run/run-controller.d.ts.map +1 -1
  233. package/dist/cli-tui/run/run-controller.js +3 -2
  234. package/dist/cli-tui/run/run-controller.js.map +1 -1
  235. package/dist/cli-tui/run/run-shell-command.d.ts.map +1 -1
  236. package/dist/cli-tui/run/run-shell-command.js +11 -3
  237. package/dist/cli-tui/run/run-shell-command.js.map +1 -1
  238. package/dist/cli-tui/run/streaming-shell-command.d.ts.map +1 -1
  239. package/dist/cli-tui/run/streaming-shell-command.js +11 -3
  240. package/dist/cli-tui/run/streaming-shell-command.js.map +1 -1
  241. package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
  242. package/dist/cli-tui/selectors/model-selector.js +1 -0
  243. package/dist/cli-tui/selectors/model-selector.js.map +1 -1
  244. package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts +8 -0
  245. package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts.map +1 -1
  246. package/dist/cli-tui/tui-renderer/agent-event-bridge.js +23 -2
  247. package/dist/cli-tui/tui-renderer/agent-event-bridge.js.map +1 -1
  248. package/dist/cli-tui/tui-renderer/command-registry-options.d.ts +3 -3
  249. package/dist/cli-tui/tui-renderer/command-registry-options.d.ts.map +1 -1
  250. package/dist/cli-tui/tui-renderer/command-registry-options.js +12 -2
  251. package/dist/cli-tui/tui-renderer/command-registry-options.js.map +1 -1
  252. package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts +32 -0
  253. package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts.map +1 -0
  254. package/dist/cli-tui/tui-renderer/command-suite-wiring.js +108 -0
  255. package/dist/cli-tui/tui-renderer/command-suite-wiring.js.map +1 -0
  256. package/dist/cli-tui/tui-renderer/input-controller.d.ts +2 -2
  257. package/dist/cli-tui/tui-renderer/input-controller.d.ts.map +1 -1
  258. package/dist/cli-tui/tui-renderer/input-controller.js +2 -2
  259. package/dist/cli-tui/tui-renderer/input-controller.js.map +1 -1
  260. package/dist/cli-tui/tui-renderer/ui-state-controller.d.ts +1 -1
  261. package/dist/cli-tui/tui-renderer/ui-state-controller.js +1 -1
  262. package/dist/cli-tui/tui-renderer/ui-state-controller.js.map +1 -1
  263. package/dist/cli-tui/tui-renderer.d.ts +1 -3
  264. package/dist/cli-tui/tui-renderer.d.ts.map +1 -1
  265. package/dist/cli-tui/tui-renderer.js +37 -83
  266. package/dist/cli-tui/tui-renderer.js.map +1 -1
  267. package/dist/cli-tui/utils/runtime-badges.d.ts +8 -0
  268. package/dist/cli-tui/utils/runtime-badges.d.ts.map +1 -1
  269. package/dist/cli-tui/utils/runtime-badges.js +58 -0
  270. package/dist/cli-tui/utils/runtime-badges.js.map +1 -1
  271. package/dist/cli.js +42555 -23133
  272. package/dist/cli.js.map +1 -1
  273. package/dist/config/env-vars.d.ts +4 -0
  274. package/dist/config/env-vars.d.ts.map +1 -1
  275. package/dist/config/env-vars.js +4 -0
  276. package/dist/config/env-vars.js.map +1 -1
  277. package/dist/config/feature-flags.d.ts +44 -0
  278. package/dist/config/feature-flags.d.ts.map +1 -1
  279. package/dist/config/feature-flags.js +214 -0
  280. package/dist/config/feature-flags.js.map +1 -1
  281. package/dist/connectors/service-client.d.ts +98 -0
  282. package/dist/connectors/service-client.d.ts.map +1 -0
  283. package/dist/connectors/service-client.js +459 -0
  284. package/dist/connectors/service-client.js.map +1 -0
  285. package/dist/conversation/render-model.d.ts.map +1 -1
  286. package/dist/conversation/render-model.js +53 -3
  287. package/dist/conversation/render-model.js.map +1 -1
  288. package/dist/db/health.d.ts +8 -0
  289. package/dist/db/health.d.ts.map +1 -0
  290. package/dist/db/health.js +64 -0
  291. package/dist/db/health.js.map +1 -0
  292. package/dist/db/migrate.d.ts +301 -0
  293. package/dist/db/migrate.d.ts.map +1 -1
  294. package/dist/db/migrate.js +186 -0
  295. package/dist/db/migrate.js.map +1 -1
  296. package/dist/db/migrations/0000_initial.sql +308 -0
  297. package/dist/db/migrations/0001_shared_sessions.sql +18 -0
  298. package/dist/db/migrations/0002_usage_metrics.sql +28 -0
  299. package/dist/db/migrations/0003_execution_traces.sql +18 -0
  300. package/dist/db/migrations/0004_workspace_config.sql +11 -0
  301. package/dist/db/migrations/0005_revenue_attribution.sql +31 -0
  302. package/dist/db/migrations/0006_hosted_session_storage.sql +51 -0
  303. package/dist/db/migrations/0007_reconcile_legacy_audit_hash_cache.sql +24 -0
  304. package/dist/db/migrations/0008_reconcile_legacy_webhook_deliveries.sql +290 -0
  305. package/dist/db/migrations/meta/0000_snapshot.json +2438 -0
  306. package/dist/db/migrations/meta/_journal.json +69 -0
  307. package/dist/db/schema.d.ts +2232 -844
  308. package/dist/db/schema.d.ts.map +1 -1
  309. package/dist/db/schema.js +187 -1
  310. package/dist/db/schema.js.map +1 -1
  311. package/dist/evalops/agent-bootstrap.d.ts +73 -0
  312. package/dist/evalops/agent-bootstrap.d.ts.map +1 -0
  313. package/dist/evalops/agent-bootstrap.js +380 -0
  314. package/dist/evalops/agent-bootstrap.js.map +1 -0
  315. package/dist/export-html.d.ts.map +1 -1
  316. package/dist/export-html.js +7 -4
  317. package/dist/export-html.js.map +1 -1
  318. package/dist/headless/utility-command-manager.d.ts +2 -1
  319. package/dist/headless/utility-command-manager.d.ts.map +1 -1
  320. package/dist/headless/utility-command-manager.js +12 -6
  321. package/dist/headless/utility-command-manager.js.map +1 -1
  322. package/dist/headless/utility-file-read.d.ts +1 -0
  323. package/dist/headless/utility-file-read.d.ts.map +1 -1
  324. package/dist/headless/utility-file-read.js +5 -1
  325. package/dist/headless/utility-file-read.js.map +1 -1
  326. package/dist/headless/utility-file-search.d.ts +1 -0
  327. package/dist/headless/utility-file-search.d.ts.map +1 -1
  328. package/dist/headless/utility-file-search.js +4 -1
  329. package/dist/headless/utility-file-search.js.map +1 -1
  330. package/dist/headless/utility-file-watch-manager.d.ts +2 -1
  331. package/dist/headless/utility-file-watch-manager.d.ts.map +1 -1
  332. package/dist/headless/utility-file-watch-manager.js +6 -2
  333. package/dist/headless/utility-file-watch-manager.js.map +1 -1
  334. package/dist/headless/workspace-root.d.ts +8 -0
  335. package/dist/headless/workspace-root.d.ts.map +1 -0
  336. package/dist/headless/workspace-root.js +74 -0
  337. package/dist/headless/workspace-root.js.map +1 -0
  338. package/dist/hooks/notification-hooks.d.ts +5 -0
  339. package/dist/hooks/notification-hooks.d.ts.map +1 -1
  340. package/dist/hooks/notification-hooks.js +4 -0
  341. package/dist/hooks/notification-hooks.js.map +1 -1
  342. package/dist/lsp/diagnostic-deltas.d.ts +20 -0
  343. package/dist/lsp/diagnostic-deltas.d.ts.map +1 -0
  344. package/dist/lsp/diagnostic-deltas.js +92 -0
  345. package/dist/lsp/diagnostic-deltas.js.map +1 -0
  346. package/dist/lsp/diagnostic-repair.d.ts +48 -0
  347. package/dist/lsp/diagnostic-repair.d.ts.map +1 -0
  348. package/dist/lsp/diagnostic-repair.js +143 -0
  349. package/dist/lsp/diagnostic-repair.js.map +1 -0
  350. package/dist/main.d.ts.map +1 -1
  351. package/dist/main.js +127 -37
  352. package/dist/main.js.map +1 -1
  353. package/dist/mcp/config.d.ts +4 -2
  354. package/dist/mcp/config.d.ts.map +1 -1
  355. package/dist/mcp/config.js +58 -14
  356. package/dist/mcp/config.js.map +1 -1
  357. package/dist/mcp/index.d.ts +1 -0
  358. package/dist/mcp/index.d.ts.map +1 -1
  359. package/dist/mcp/index.js +1 -0
  360. package/dist/mcp/index.js.map +1 -1
  361. package/dist/mcp/manager.d.ts +1 -0
  362. package/dist/mcp/manager.d.ts.map +1 -1
  363. package/dist/mcp/manager.js +1 -0
  364. package/dist/mcp/manager.js.map +1 -1
  365. package/dist/mcp/platform-plugin.d.ts +3 -0
  366. package/dist/mcp/platform-plugin.d.ts.map +1 -0
  367. package/dist/mcp/platform-plugin.js +117 -0
  368. package/dist/mcp/platform-plugin.js.map +1 -0
  369. package/dist/mcp/tool-bridge.d.ts +15 -0
  370. package/dist/mcp/tool-bridge.d.ts.map +1 -1
  371. package/dist/mcp/tool-bridge.js +194 -6
  372. package/dist/mcp/tool-bridge.js.map +1 -1
  373. package/dist/memory/platform-memory-client.d.ts +130 -0
  374. package/dist/memory/platform-memory-client.d.ts.map +1 -0
  375. package/dist/memory/platform-memory-client.js +330 -0
  376. package/dist/memory/platform-memory-client.js.map +1 -0
  377. package/dist/memory/service-client.d.ts.map +1 -1
  378. package/dist/memory/service-client.js +1 -2
  379. package/dist/memory/service-client.js.map +1 -1
  380. package/dist/models/builtin.d.ts.map +1 -1
  381. package/dist/models/builtin.js +137 -0
  382. package/dist/models/builtin.js.map +1 -1
  383. package/dist/models/config-loader.d.ts +10 -10
  384. package/dist/models/config-loader.d.ts.map +1 -1
  385. package/dist/models/config-loader.js +1 -0
  386. package/dist/models/config-loader.js.map +1 -1
  387. package/dist/models/registry.d.ts +1 -0
  388. package/dist/models/registry.d.ts.map +1 -1
  389. package/dist/models/registry.js +1 -0
  390. package/dist/models/registry.js.map +1 -1
  391. package/dist/oauth/connectors.d.ts +25 -0
  392. package/dist/oauth/connectors.d.ts.map +1 -0
  393. package/dist/oauth/connectors.js +253 -0
  394. package/dist/oauth/connectors.js.map +1 -0
  395. package/dist/oauth/device-identity.d.ts +18 -0
  396. package/dist/oauth/device-identity.d.ts.map +1 -0
  397. package/dist/oauth/device-identity.js +193 -0
  398. package/dist/oauth/device-identity.js.map +1 -0
  399. package/dist/oauth/evalops.d.ts.map +1 -1
  400. package/dist/oauth/evalops.js +74 -15
  401. package/dist/oauth/evalops.js.map +1 -1
  402. package/dist/oauth/index.d.ts +1 -1
  403. package/dist/oauth/index.d.ts.map +1 -1
  404. package/dist/oauth/index.js +31 -1
  405. package/dist/oauth/index.js.map +1 -1
  406. package/dist/oauth/openai-codex.d.ts +16 -0
  407. package/dist/oauth/openai-codex.d.ts.map +1 -0
  408. package/dist/oauth/openai-codex.js +300 -0
  409. package/dist/oauth/openai-codex.js.map +1 -0
  410. package/dist/opentelemetry.d.ts.map +1 -1
  411. package/dist/opentelemetry.js +9 -2
  412. package/dist/opentelemetry.js.map +1 -1
  413. package/dist/platform/agent-runtime-client.d.ts +279 -0
  414. package/dist/platform/agent-runtime-client.d.ts.map +1 -0
  415. package/dist/platform/agent-runtime-client.js +515 -0
  416. package/dist/platform/agent-runtime-client.js.map +1 -0
  417. package/dist/platform/cerebro-facts-client.d.ts +56 -0
  418. package/dist/platform/cerebro-facts-client.d.ts.map +1 -0
  419. package/dist/platform/cerebro-facts-client.js +297 -0
  420. package/dist/platform/cerebro-facts-client.js.map +1 -0
  421. package/dist/platform/client.d.ts +2 -1
  422. package/dist/platform/client.d.ts.map +1 -1
  423. package/dist/platform/client.js +9 -26
  424. package/dist/platform/client.js.map +1 -1
  425. package/dist/platform/core-services.d.ts +128 -0
  426. package/dist/platform/core-services.d.ts.map +1 -1
  427. package/dist/platform/core-services.js +128 -0
  428. package/dist/platform/core-services.js.map +1 -1
  429. package/dist/platform/maestro-timeline-client.d.ts +22 -0
  430. package/dist/platform/maestro-timeline-client.d.ts.map +1 -0
  431. package/dist/platform/maestro-timeline-client.js +373 -0
  432. package/dist/platform/maestro-timeline-client.js.map +1 -0
  433. package/dist/platform/tool-execution-client.d.ts +104 -0
  434. package/dist/platform/tool-execution-client.d.ts.map +1 -0
  435. package/dist/platform/tool-execution-client.js +284 -0
  436. package/dist/platform/tool-execution-client.js.map +1 -0
  437. package/dist/prompts/service-client.d.ts.map +1 -1
  438. package/dist/prompts/service-client.js +5 -2
  439. package/dist/prompts/service-client.js.map +1 -1
  440. package/dist/providers/anthropic-auth.d.ts.map +1 -1
  441. package/dist/providers/anthropic-auth.js +8 -6
  442. package/dist/providers/anthropic-auth.js.map +1 -1
  443. package/dist/providers/api-keys.d.ts +1 -0
  444. package/dist/providers/api-keys.d.ts.map +1 -1
  445. package/dist/providers/api-keys.js +5 -0
  446. package/dist/providers/api-keys.js.map +1 -1
  447. package/dist/providers/auth.d.ts +2 -1
  448. package/dist/providers/auth.d.ts.map +1 -1
  449. package/dist/providers/auth.js +26 -3
  450. package/dist/providers/auth.js.map +1 -1
  451. package/dist/remote-runner/attach-client.d.ts +41 -0
  452. package/dist/remote-runner/attach-client.d.ts.map +1 -0
  453. package/dist/remote-runner/attach-client.js +692 -0
  454. package/dist/remote-runner/attach-client.js.map +1 -0
  455. package/dist/remote-runner/client.d.ts +205 -0
  456. package/dist/remote-runner/client.d.ts.map +1 -0
  457. package/dist/remote-runner/client.js +633 -0
  458. package/dist/remote-runner/client.js.map +1 -0
  459. package/dist/safety/action-firewall.d.ts +6 -1
  460. package/dist/safety/action-firewall.d.ts.map +1 -1
  461. package/dist/safety/action-firewall.js +62 -26
  462. package/dist/safety/action-firewall.js.map +1 -1
  463. package/dist/safety/governance-service-client.d.ts +36 -0
  464. package/dist/safety/governance-service-client.d.ts.map +1 -0
  465. package/dist/safety/governance-service-client.js +279 -0
  466. package/dist/safety/governance-service-client.js.map +1 -0
  467. package/dist/safety/policy.d.ts +13 -2
  468. package/dist/safety/policy.d.ts.map +1 -1
  469. package/dist/safety/policy.js +474 -52
  470. package/dist/safety/policy.js.map +1 -1
  471. package/dist/sdk-tools.d.ts +21 -0
  472. package/dist/sdk-tools.d.ts.map +1 -1
  473. package/dist/sdk-tools.js +16 -0
  474. package/dist/sdk-tools.js.map +1 -1
  475. package/dist/server/app-context.d.ts +25 -0
  476. package/dist/server/app-context.d.ts.map +1 -1
  477. package/dist/server/app-context.js.map +1 -1
  478. package/dist/server/approval-service.d.ts +7 -8
  479. package/dist/server/approval-service.d.ts.map +1 -1
  480. package/dist/server/approval-service.js +12 -24
  481. package/dist/server/approval-service.js.map +1 -1
  482. package/dist/server/authz.d.ts +23 -2
  483. package/dist/server/authz.d.ts.map +1 -1
  484. package/dist/server/authz.js +153 -17
  485. package/dist/server/authz.js.map +1 -1
  486. package/dist/server/handlers/approvals.d.ts.map +1 -1
  487. package/dist/server/handlers/approvals.js +3 -10
  488. package/dist/server/handlers/approvals.js.map +1 -1
  489. package/dist/server/handlers/branch.d.ts.map +1 -1
  490. package/dist/server/handlers/branch.js +29 -20
  491. package/dist/server/handlers/branch.js.map +1 -1
  492. package/dist/server/handlers/bridge.d.ts.map +1 -1
  493. package/dist/server/handlers/bridge.js +3 -2
  494. package/dist/server/handlers/bridge.js.map +1 -1
  495. package/dist/server/handlers/chat-ws.d.ts.map +1 -1
  496. package/dist/server/handlers/chat-ws.js +23 -31
  497. package/dist/server/handlers/chat-ws.js.map +1 -1
  498. package/dist/server/handlers/chat.d.ts.map +1 -1
  499. package/dist/server/handlers/chat.js +105 -46
  500. package/dist/server/handlers/chat.js.map +1 -1
  501. package/dist/server/handlers/compliance.d.ts +3 -0
  502. package/dist/server/handlers/compliance.d.ts.map +1 -0
  503. package/dist/server/handlers/compliance.js +53 -0
  504. package/dist/server/handlers/compliance.js.map +1 -0
  505. package/dist/server/handlers/context.d.ts.map +1 -1
  506. package/dist/server/handlers/context.js +3 -8
  507. package/dist/server/handlers/context.js.map +1 -1
  508. package/dist/server/handlers/fleet.d.ts +4 -0
  509. package/dist/server/handlers/fleet.d.ts.map +1 -0
  510. package/dist/server/handlers/fleet.js +9 -0
  511. package/dist/server/handlers/fleet.js.map +1 -0
  512. package/dist/server/handlers/headless-sessions.d.ts +4 -0
  513. package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
  514. package/dist/server/handlers/headless-sessions.js +168 -3
  515. package/dist/server/handlers/headless-sessions.js.map +1 -1
  516. package/dist/server/handlers/health.d.ts +31 -2
  517. package/dist/server/handlers/health.d.ts.map +1 -1
  518. package/dist/server/handlers/health.js +82 -8
  519. package/dist/server/handlers/health.js.map +1 -1
  520. package/dist/server/handlers/hosted-runner-drain.d.ts +128 -0
  521. package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -0
  522. package/dist/server/handlers/hosted-runner-drain.js +373 -0
  523. package/dist/server/handlers/hosted-runner-drain.js.map +1 -0
  524. package/dist/server/handlers/hosted-runner-identity.d.ts +17 -0
  525. package/dist/server/handlers/hosted-runner-identity.d.ts.map +1 -0
  526. package/dist/server/handlers/hosted-runner-identity.js +39 -0
  527. package/dist/server/handlers/hosted-runner-identity.js.map +1 -0
  528. package/dist/server/handlers/intelligent-router.d.ts +3 -0
  529. package/dist/server/handlers/intelligent-router.d.ts.map +1 -0
  530. package/dist/server/handlers/intelligent-router.js +141 -0
  531. package/dist/server/handlers/intelligent-router.js.map +1 -0
  532. package/dist/server/handlers/models.d.ts.map +1 -1
  533. package/dist/server/handlers/models.js +14 -0
  534. package/dist/server/handlers/models.js.map +1 -1
  535. package/dist/server/handlers/pending-requests.d.ts +8 -0
  536. package/dist/server/handlers/pending-requests.d.ts.map +1 -0
  537. package/dist/server/handlers/pending-requests.js +149 -0
  538. package/dist/server/handlers/pending-requests.js.map +1 -0
  539. package/dist/server/handlers/revenue-attribution.d.ts +3 -0
  540. package/dist/server/handlers/revenue-attribution.d.ts.map +1 -0
  541. package/dist/server/handlers/revenue-attribution.js +45 -0
  542. package/dist/server/handlers/revenue-attribution.js.map +1 -0
  543. package/dist/server/handlers/runtime-app-server-ws.d.ts +10 -0
  544. package/dist/server/handlers/runtime-app-server-ws.d.ts.map +1 -0
  545. package/dist/server/handlers/runtime-app-server-ws.js +206 -0
  546. package/dist/server/handlers/runtime-app-server-ws.js.map +1 -0
  547. package/dist/server/handlers/session-artifacts.js +2 -2
  548. package/dist/server/handlers/session-artifacts.js.map +1 -1
  549. package/dist/server/handlers/session-attachments.js +3 -3
  550. package/dist/server/handlers/session-attachments.js.map +1 -1
  551. package/dist/server/handlers/session-timeline.d.ts +11 -0
  552. package/dist/server/handlers/session-timeline.d.ts.map +1 -0
  553. package/dist/server/handlers/session-timeline.js +77 -0
  554. package/dist/server/handlers/session-timeline.js.map +1 -0
  555. package/dist/server/handlers/sessions.d.ts +11 -0
  556. package/dist/server/handlers/sessions.d.ts.map +1 -1
  557. package/dist/server/handlers/sessions.js +68 -100
  558. package/dist/server/handlers/sessions.js.map +1 -1
  559. package/dist/server/handlers/traces.d.ts +3 -0
  560. package/dist/server/handlers/traces.d.ts.map +1 -0
  561. package/dist/server/handlers/traces.js +60 -0
  562. package/dist/server/handlers/traces.js.map +1 -0
  563. package/dist/server/handlers/usage-analytics.d.ts +3 -0
  564. package/dist/server/handlers/usage-analytics.d.ts.map +1 -0
  565. package/dist/server/handlers/usage-analytics.js +40 -0
  566. package/dist/server/handlers/usage-analytics.js.map +1 -0
  567. package/dist/server/handlers/workspace-config.d.ts +3 -0
  568. package/dist/server/handlers/workspace-config.d.ts.map +1 -0
  569. package/dist/server/handlers/workspace-config.js +62 -0
  570. package/dist/server/handlers/workspace-config.js.map +1 -0
  571. package/dist/server/headless-in-process-host.d.ts +8 -1
  572. package/dist/server/headless-in-process-host.d.ts.map +1 -1
  573. package/dist/server/headless-in-process-host.js +6 -0
  574. package/dist/server/headless-in-process-host.js.map +1 -1
  575. package/dist/server/headless-runtime-service.d.ts +99 -1
  576. package/dist/server/headless-runtime-service.d.ts.map +1 -1
  577. package/dist/server/headless-runtime-service.js +286 -23
  578. package/dist/server/headless-runtime-service.js.map +1 -1
  579. package/dist/server/hosted-session-manager.d.ts +103 -0
  580. package/dist/server/hosted-session-manager.d.ts.map +1 -0
  581. package/dist/server/hosted-session-manager.js +629 -0
  582. package/dist/server/hosted-session-manager.js.map +1 -0
  583. package/dist/server/pending-request-payload.d.ts +4 -0
  584. package/dist/server/pending-request-payload.d.ts.map +1 -0
  585. package/dist/server/pending-request-payload.js +107 -0
  586. package/dist/server/pending-request-payload.js.map +1 -0
  587. package/dist/server/request-context.d.ts +4 -0
  588. package/dist/server/request-context.d.ts.map +1 -1
  589. package/dist/server/request-context.js +9 -0
  590. package/dist/server/request-context.js.map +1 -1
  591. package/dist/server/routes.d.ts.map +1 -1
  592. package/dist/server/routes.js +149 -1
  593. package/dist/server/routes.js.map +1 -1
  594. package/dist/server/runtime-ws-access.d.ts +16 -0
  595. package/dist/server/runtime-ws-access.d.ts.map +1 -0
  596. package/dist/server/runtime-ws-access.js +21 -0
  597. package/dist/server/runtime-ws-access.js.map +1 -0
  598. package/dist/server/server-middlewares.d.ts +1 -1
  599. package/dist/server/server-middlewares.d.ts.map +1 -1
  600. package/dist/server/server-middlewares.js +35 -27
  601. package/dist/server/server-middlewares.js.map +1 -1
  602. package/dist/server/server-request-manager.d.ts +8 -27
  603. package/dist/server/server-request-manager.d.ts.map +1 -1
  604. package/dist/server/server-request-manager.js +7 -0
  605. package/dist/server/server-request-manager.js.map +1 -1
  606. package/dist/server/server-utils.d.ts +2 -1
  607. package/dist/server/server-utils.d.ts.map +1 -1
  608. package/dist/server/server-utils.js +11 -1
  609. package/dist/server/server-utils.js.map +1 -1
  610. package/dist/server/session-event-env.d.ts +2 -0
  611. package/dist/server/session-event-env.d.ts.map +1 -0
  612. package/dist/server/session-event-env.js +8 -0
  613. package/dist/server/session-event-env.js.map +1 -0
  614. package/dist/server/session-initialization.d.ts +25 -4
  615. package/dist/server/session-initialization.d.ts.map +1 -1
  616. package/dist/server/session-initialization.js +22 -5
  617. package/dist/server/session-initialization.js.map +1 -1
  618. package/dist/server/session-scope.d.ts +4 -0
  619. package/dist/server/session-scope.d.ts.map +1 -1
  620. package/dist/server/session-scope.js +44 -4
  621. package/dist/server/session-scope.js.map +1 -1
  622. package/dist/server/session-timeline.d.ts +13 -0
  623. package/dist/server/session-timeline.d.ts.map +1 -0
  624. package/dist/server/session-timeline.js +566 -0
  625. package/dist/server/session-timeline.js.map +1 -0
  626. package/dist/services/compliance/controls.d.ts +6 -0
  627. package/dist/services/compliance/controls.d.ts.map +1 -0
  628. package/dist/services/compliance/controls.js +113 -0
  629. package/dist/services/compliance/controls.js.map +1 -0
  630. package/dist/services/compliance/index.d.ts +6 -0
  631. package/dist/services/compliance/index.d.ts.map +1 -0
  632. package/dist/services/compliance/index.js +5 -0
  633. package/dist/services/compliance/index.js.map +1 -0
  634. package/dist/services/compliance/normalize.d.ts +23 -0
  635. package/dist/services/compliance/normalize.d.ts.map +1 -0
  636. package/dist/services/compliance/normalize.js +226 -0
  637. package/dist/services/compliance/normalize.js.map +1 -0
  638. package/dist/services/compliance/recorder.d.ts +22 -0
  639. package/dist/services/compliance/recorder.d.ts.map +1 -0
  640. package/dist/services/compliance/recorder.js +89 -0
  641. package/dist/services/compliance/recorder.js.map +1 -0
  642. package/dist/services/compliance/service.d.ts +24 -0
  643. package/dist/services/compliance/service.d.ts.map +1 -0
  644. package/dist/services/compliance/service.js +426 -0
  645. package/dist/services/compliance/service.js.map +1 -0
  646. package/dist/services/compliance/types.d.ts +185 -0
  647. package/dist/services/compliance/types.d.ts.map +1 -0
  648. package/dist/services/compliance/types.js +2 -0
  649. package/dist/services/compliance/types.js.map +1 -0
  650. package/dist/services/intelligent-router/index.d.ts +5 -0
  651. package/dist/services/intelligent-router/index.d.ts.map +1 -0
  652. package/dist/services/intelligent-router/index.js +5 -0
  653. package/dist/services/intelligent-router/index.js.map +1 -0
  654. package/dist/services/intelligent-router/normalize.d.ts +9 -0
  655. package/dist/services/intelligent-router/normalize.d.ts.map +1 -0
  656. package/dist/services/intelligent-router/normalize.js +169 -0
  657. package/dist/services/intelligent-router/normalize.js.map +1 -0
  658. package/dist/services/intelligent-router/recorder.d.ts +24 -0
  659. package/dist/services/intelligent-router/recorder.d.ts.map +1 -0
  660. package/dist/services/intelligent-router/recorder.js +98 -0
  661. package/dist/services/intelligent-router/recorder.js.map +1 -0
  662. package/dist/services/intelligent-router/service.d.ts +22 -0
  663. package/dist/services/intelligent-router/service.d.ts.map +1 -0
  664. package/dist/services/intelligent-router/service.js +328 -0
  665. package/dist/services/intelligent-router/service.js.map +1 -0
  666. package/dist/services/intelligent-router/types.d.ts +98 -0
  667. package/dist/services/intelligent-router/types.d.ts.map +1 -0
  668. package/dist/services/intelligent-router/types.js +7 -0
  669. package/dist/services/intelligent-router/types.js.map +1 -0
  670. package/dist/services/revenue-attribution/index.d.ts +4 -0
  671. package/dist/services/revenue-attribution/index.d.ts.map +1 -0
  672. package/dist/services/revenue-attribution/index.js +4 -0
  673. package/dist/services/revenue-attribution/index.js.map +1 -0
  674. package/dist/services/revenue-attribution/normalize.d.ts +13 -0
  675. package/dist/services/revenue-attribution/normalize.d.ts.map +1 -0
  676. package/dist/services/revenue-attribution/normalize.js +155 -0
  677. package/dist/services/revenue-attribution/normalize.js.map +1 -0
  678. package/dist/services/revenue-attribution/service.d.ts +21 -0
  679. package/dist/services/revenue-attribution/service.d.ts.map +1 -0
  680. package/dist/services/revenue-attribution/service.js +248 -0
  681. package/dist/services/revenue-attribution/service.js.map +1 -0
  682. package/dist/services/revenue-attribution/types.d.ts +96 -0
  683. package/dist/services/revenue-attribution/types.d.ts.map +1 -0
  684. package/dist/services/revenue-attribution/types.js +7 -0
  685. package/dist/services/revenue-attribution/types.js.map +1 -0
  686. package/dist/services/traces/index.d.ts +5 -0
  687. package/dist/services/traces/index.d.ts.map +1 -0
  688. package/dist/services/traces/index.js +4 -0
  689. package/dist/services/traces/index.js.map +1 -0
  690. package/dist/services/traces/normalize.d.ts +20 -0
  691. package/dist/services/traces/normalize.d.ts.map +1 -0
  692. package/dist/services/traces/normalize.js +261 -0
  693. package/dist/services/traces/normalize.js.map +1 -0
  694. package/dist/services/traces/otel.d.ts +3 -0
  695. package/dist/services/traces/otel.d.ts.map +1 -0
  696. package/dist/services/traces/otel.js +173 -0
  697. package/dist/services/traces/otel.js.map +1 -0
  698. package/dist/services/traces/service.d.ts +17 -0
  699. package/dist/services/traces/service.d.ts.map +1 -0
  700. package/dist/services/traces/service.js +197 -0
  701. package/dist/services/traces/service.js.map +1 -0
  702. package/dist/services/traces/types.d.ts +130 -0
  703. package/dist/services/traces/types.d.ts.map +1 -0
  704. package/dist/services/traces/types.js +8 -0
  705. package/dist/services/traces/types.js.map +1 -0
  706. package/dist/services/usage-analytics/aggregation.d.ts +18 -0
  707. package/dist/services/usage-analytics/aggregation.d.ts.map +1 -0
  708. package/dist/services/usage-analytics/aggregation.js +130 -0
  709. package/dist/services/usage-analytics/aggregation.js.map +1 -0
  710. package/dist/services/usage-analytics/index.d.ts +5 -0
  711. package/dist/services/usage-analytics/index.d.ts.map +1 -0
  712. package/dist/services/usage-analytics/index.js +4 -0
  713. package/dist/services/usage-analytics/index.js.map +1 -0
  714. package/dist/services/usage-analytics/recorder.d.ts +16 -0
  715. package/dist/services/usage-analytics/recorder.d.ts.map +1 -0
  716. package/dist/services/usage-analytics/recorder.js +128 -0
  717. package/dist/services/usage-analytics/recorder.js.map +1 -0
  718. package/dist/services/usage-analytics/service.d.ts +15 -0
  719. package/dist/services/usage-analytics/service.d.ts.map +1 -0
  720. package/dist/services/usage-analytics/service.js +210 -0
  721. package/dist/services/usage-analytics/service.js.map +1 -0
  722. package/dist/services/usage-analytics/types.d.ts +80 -0
  723. package/dist/services/usage-analytics/types.d.ts.map +1 -0
  724. package/dist/services/usage-analytics/types.js +2 -0
  725. package/dist/services/usage-analytics/types.js.map +1 -0
  726. package/dist/services/workspace-config/index.d.ts +6 -0
  727. package/dist/services/workspace-config/index.d.ts.map +1 -0
  728. package/dist/services/workspace-config/index.js +5 -0
  729. package/dist/services/workspace-config/index.js.map +1 -0
  730. package/dist/services/workspace-config/middleware.d.ts +5 -0
  731. package/dist/services/workspace-config/middleware.d.ts.map +1 -0
  732. package/dist/services/workspace-config/middleware.js +98 -0
  733. package/dist/services/workspace-config/middleware.js.map +1 -0
  734. package/dist/services/workspace-config/normalize.d.ts +17 -0
  735. package/dist/services/workspace-config/normalize.d.ts.map +1 -0
  736. package/dist/services/workspace-config/normalize.js +148 -0
  737. package/dist/services/workspace-config/normalize.js.map +1 -0
  738. package/dist/services/workspace-config/policy.d.ts +16 -0
  739. package/dist/services/workspace-config/policy.d.ts.map +1 -0
  740. package/dist/services/workspace-config/policy.js +77 -0
  741. package/dist/services/workspace-config/policy.js.map +1 -0
  742. package/dist/services/workspace-config/service.d.ts +20 -0
  743. package/dist/services/workspace-config/service.d.ts.map +1 -0
  744. package/dist/services/workspace-config/service.js +162 -0
  745. package/dist/services/workspace-config/service.js.map +1 -0
  746. package/dist/services/workspace-config/types.d.ts +71 -0
  747. package/dist/services/workspace-config/types.d.ts.map +1 -0
  748. package/dist/services/workspace-config/types.js +2 -0
  749. package/dist/services/workspace-config/types.js.map +1 -0
  750. package/dist/session/manager.d.ts.map +1 -1
  751. package/dist/session/manager.js +10 -0
  752. package/dist/session/manager.js.map +1 -1
  753. package/dist/session/migration.d.ts.map +1 -1
  754. package/dist/session/migration.js +2 -1
  755. package/dist/session/migration.js.map +1 -1
  756. package/dist/session/session-memory.d.ts.map +1 -1
  757. package/dist/session/session-memory.js +7 -1
  758. package/dist/session/session-memory.js.map +1 -1
  759. package/dist/session/types.d.ts +1 -2
  760. package/dist/session/types.d.ts.map +1 -1
  761. package/dist/session/types.js +1 -22
  762. package/dist/session/types.js.map +1 -1
  763. package/dist/session/wire-format.d.ts +7 -0
  764. package/dist/session/wire-format.d.ts.map +1 -0
  765. package/dist/session/wire-format.generated.d.ts +95 -0
  766. package/dist/session/wire-format.generated.d.ts.map +1 -0
  767. package/dist/session/wire-format.generated.js +111 -0
  768. package/dist/session/wire-format.generated.js.map +1 -0
  769. package/dist/session/wire-format.js +145 -0
  770. package/dist/session/wire-format.js.map +1 -0
  771. package/dist/shared-memory/client.d.ts.map +1 -1
  772. package/dist/shared-memory/client.js +22 -22
  773. package/dist/shared-memory/client.js.map +1 -1
  774. package/dist/skills/artifact-metadata.d.ts +16 -0
  775. package/dist/skills/artifact-metadata.d.ts.map +1 -0
  776. package/dist/skills/artifact-metadata.js +86 -0
  777. package/dist/skills/artifact-metadata.js.map +1 -0
  778. package/dist/skills/loader.d.ts +2 -2
  779. package/dist/skills/loader.d.ts.map +1 -1
  780. package/dist/skills/loader.js +1 -0
  781. package/dist/skills/loader.js.map +1 -1
  782. package/dist/skills/service-client.d.ts +42 -0
  783. package/dist/skills/service-client.d.ts.map +1 -0
  784. package/dist/skills/service-client.js +258 -0
  785. package/dist/skills/service-client.js.map +1 -0
  786. package/dist/skills/tool.d.ts +3 -0
  787. package/dist/skills/tool.d.ts.map +1 -1
  788. package/dist/skills/tool.js +67 -5
  789. package/dist/skills/tool.js.map +1 -1
  790. package/dist/telemetry/index.d.ts +4 -0
  791. package/dist/telemetry/index.d.ts.map +1 -1
  792. package/dist/telemetry/index.js +5 -0
  793. package/dist/telemetry/index.js.map +1 -1
  794. package/dist/telemetry/maestro-event-bus.d.ts +440 -0
  795. package/dist/telemetry/maestro-event-bus.d.ts.map +1 -0
  796. package/dist/telemetry/maestro-event-bus.js +784 -0
  797. package/dist/telemetry/maestro-event-bus.js.map +1 -0
  798. package/dist/telemetry/maestro-event-catalog.d.ts +48 -0
  799. package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -0
  800. package/dist/telemetry/maestro-event-catalog.js +69 -0
  801. package/dist/telemetry/maestro-event-catalog.js.map +1 -0
  802. package/dist/telemetry/maestro-platform-replay-fixture.d.ts +24 -0
  803. package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -0
  804. package/dist/telemetry/maestro-platform-replay-fixture.js +400 -0
  805. package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -0
  806. package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts +29 -0
  807. package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts.map +1 -0
  808. package/dist/telemetry/maestro-publisher-conformance-fixture.js +240 -0
  809. package/dist/telemetry/maestro-publisher-conformance-fixture.js.map +1 -0
  810. package/dist/telemetry/meter-service-client.d.ts +0 -33
  811. package/dist/telemetry/meter-service-client.d.ts.map +1 -1
  812. package/dist/telemetry/meter-service-client.js +22 -50
  813. package/dist/telemetry/meter-service-client.js.map +1 -1
  814. package/dist/telemetry/turn-tracker.d.ts.map +1 -1
  815. package/dist/telemetry/turn-tracker.js +5 -5
  816. package/dist/telemetry/turn-tracker.js.map +1 -1
  817. package/dist/telemetry/wide-events.d.ts +8 -0
  818. package/dist/telemetry/wide-events.d.ts.map +1 -1
  819. package/dist/telemetry/wide-events.js +28 -0
  820. package/dist/telemetry/wide-events.js.map +1 -1
  821. package/dist/telemetry.d.ts +1 -1
  822. package/dist/telemetry.d.ts.map +1 -1
  823. package/dist/telemetry.js +14 -4
  824. package/dist/telemetry.js.map +1 -1
  825. package/dist/timeline/redaction.d.ts +5 -0
  826. package/dist/timeline/redaction.d.ts.map +1 -0
  827. package/dist/timeline/redaction.js +119 -0
  828. package/dist/timeline/redaction.js.map +1 -0
  829. package/dist/tools/ask-user.d.ts +26 -0
  830. package/dist/tools/ask-user.d.ts.map +1 -1
  831. package/dist/tools/ask-user.js +33 -1
  832. package/dist/tools/ask-user.js.map +1 -1
  833. package/dist/tools/background/task-types.d.ts +1 -1
  834. package/dist/tools/edit.d.ts +2 -0
  835. package/dist/tools/edit.d.ts.map +1 -1
  836. package/dist/tools/edit.js +27 -7
  837. package/dist/tools/edit.js.map +1 -1
  838. package/dist/tools/index.d.ts +9 -0
  839. package/dist/tools/index.d.ts.map +1 -1
  840. package/dist/tools/pipeline.d.ts.map +1 -1
  841. package/dist/tools/pipeline.js +16 -7
  842. package/dist/tools/pipeline.js.map +1 -1
  843. package/dist/tools/write.d.ts +2 -0
  844. package/dist/tools/write.d.ts.map +1 -1
  845. package/dist/tools/write.js +24 -6
  846. package/dist/tools/write.js.map +1 -1
  847. package/dist/tracking/cost-tracker.d.ts +15 -12
  848. package/dist/tracking/cost-tracker.d.ts.map +1 -1
  849. package/dist/tracking/cost-tracker.js +29 -40
  850. package/dist/tracking/cost-tracker.js.map +1 -1
  851. package/dist/utils/checkpoint-profiler.d.ts +29 -0
  852. package/dist/utils/checkpoint-profiler.d.ts.map +1 -0
  853. package/dist/utils/checkpoint-profiler.js +118 -0
  854. package/dist/utils/checkpoint-profiler.js.map +1 -0
  855. package/dist/utils/downstream-http.d.ts +21 -0
  856. package/dist/utils/downstream-http.d.ts.map +1 -0
  857. package/dist/utils/downstream-http.js +151 -0
  858. package/dist/utils/downstream-http.js.map +1 -0
  859. package/dist/utils/downstream.d.ts +18 -0
  860. package/dist/utils/downstream.d.ts.map +1 -0
  861. package/dist/utils/downstream.js +47 -0
  862. package/dist/utils/downstream.js.map +1 -0
  863. package/dist/utils/logger.d.ts +3 -1
  864. package/dist/utils/logger.d.ts.map +1 -1
  865. package/dist/utils/logger.js +12 -1
  866. package/dist/utils/logger.js.map +1 -1
  867. package/dist/utils/oauth-http.d.ts +8 -0
  868. package/dist/utils/oauth-http.d.ts.map +1 -0
  869. package/dist/utils/oauth-http.js +41 -0
  870. package/dist/utils/oauth-http.js.map +1 -0
  871. package/dist/utils/path-utils.d.ts +2 -0
  872. package/dist/utils/path-utils.d.ts.map +1 -0
  873. package/dist/utils/path-utils.js +12 -0
  874. package/dist/utils/path-utils.js.map +1 -0
  875. package/dist/utils/path-validation.d.ts +1 -1
  876. package/dist/utils/path-validation.d.ts.map +1 -1
  877. package/dist/utils/path-validation.js +3 -3
  878. package/dist/utils/path-validation.js.map +1 -1
  879. package/dist/version.json +2 -2
  880. package/dist/web-server.d.ts +7 -1
  881. package/dist/web-server.d.ts.map +1 -1
  882. package/dist/web-server.js +117 -15
  883. package/dist/web-server.js.map +1 -1
  884. package/dist/webhooks/delivery.d.ts.map +1 -1
  885. package/dist/webhooks/delivery.js +9 -12
  886. package/dist/webhooks/delivery.js.map +1 -1
  887. package/node_modules/@bufbuild/protobuf/dist/cjs/descriptors.d.ts +12 -5
  888. package/node_modules/@bufbuild/protobuf/dist/cjs/from-binary.js +7 -7
  889. package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.d.ts +1 -1
  890. package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.js +1 -1
  891. package/node_modules/@bufbuild/protobuf/dist/cjs/reflect/path.d.ts +1 -1
  892. package/node_modules/@bufbuild/protobuf/dist/cjs/registry.js +24 -1
  893. package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.d.ts +1 -1
  894. package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.js +9 -10
  895. package/node_modules/@bufbuild/protobuf/dist/cjs/types.d.ts +1 -1
  896. package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.d.ts +9 -7
  897. package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.js +18 -8
  898. package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.d.ts +4 -2
  899. package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.js +8 -1
  900. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
  901. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
  902. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
  903. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  904. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
  905. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
  906. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +38 -2
  907. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
  908. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
  909. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.d.ts +10 -0
  910. package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.js +24 -0
  911. package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +12 -5
  912. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +7 -7
  913. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +1 -1
  914. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +2 -2
  915. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +1 -1
  916. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +24 -1
  917. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +1 -1
  918. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +10 -11
  919. package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +1 -1
  920. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +9 -7
  921. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +18 -8
  922. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +4 -2
  923. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +8 -1
  924. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
  925. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
  926. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
  927. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  928. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
  929. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
  930. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +37 -1
  931. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
  932. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
  933. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +10 -0
  934. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +23 -0
  935. package/node_modules/@bufbuild/protobuf/package.json +1 -1
  936. package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +305 -2
  937. package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts.map +1 -1
  938. package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js +34 -4
  939. package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js.map +1 -1
  940. package/node_modules/@evalops/contracts/dist/index.d.ts +88 -0
  941. package/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
  942. package/node_modules/@evalops/contracts/dist/index.js +2 -0
  943. package/node_modules/@evalops/contracts/dist/index.js.map +1 -1
  944. package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts +77 -77
  945. package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts.map +1 -1
  946. package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js +1 -1
  947. package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js.map +1 -1
  948. package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +182 -0
  949. package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts.map +1 -0
  950. package/node_modules/@evalops/contracts/dist/runtime-app-server.js +83 -0
  951. package/node_modules/@evalops/contracts/dist/runtime-app-server.js.map +1 -0
  952. package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +133 -0
  953. package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts.map +1 -0
  954. package/node_modules/@evalops/contracts/dist/runtime-server-request.js +68 -0
  955. package/node_modules/@evalops/contracts/dist/runtime-server-request.js.map +1 -0
  956. package/node_modules/@evalops/contracts/dist/schemas.d.ts +178 -0
  957. package/node_modules/@evalops/contracts/dist/schemas.d.ts.map +1 -1
  958. package/node_modules/@evalops/contracts/dist/schemas.js +165 -0
  959. package/node_modules/@evalops/contracts/dist/schemas.js.map +1 -1
  960. package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts +2 -0
  961. package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts.map +1 -0
  962. package/node_modules/@evalops/contracts/dist/typebox-utils.js +5 -0
  963. package/node_modules/@evalops/contracts/dist/typebox-utils.js.map +1 -0
  964. package/node_modules/@evalops/contracts/dist/validators.d.ts +4 -1
  965. package/node_modules/@evalops/contracts/dist/validators.d.ts.map +1 -1
  966. package/node_modules/@evalops/contracts/dist/validators.js +4 -1
  967. package/node_modules/@evalops/contracts/dist/validators.js.map +1 -1
  968. package/node_modules/@evalops/contracts/package.json +1 -1
  969. package/node_modules/@evalops/tui/package.json +1 -1
  970. package/node_modules/string-width/index.js +93 -9
  971. package/node_modules/string-width/package.json +1 -1
  972. package/package.json +32 -25
  973. package/dist/cli-tui/commands/grouped/auth-commands.d.ts.map +0 -1
  974. package/dist/cli-tui/commands/grouped/auth-commands.js.map +0 -1
  975. package/dist/cli-tui/commands/grouped/config-commands.d.ts.map +0 -1
  976. package/dist/cli-tui/commands/grouped/config-commands.js.map +0 -1
  977. package/dist/cli-tui/commands/grouped/diag-commands.d.ts.map +0 -1
  978. package/dist/cli-tui/commands/grouped/diag-commands.js.map +0 -1
  979. package/dist/cli-tui/commands/grouped/git-commands.d.ts.map +0 -1
  980. package/dist/cli-tui/commands/grouped/git-commands.js.map +0 -1
  981. package/dist/cli-tui/commands/grouped/index.d.ts.map +0 -1
  982. package/dist/cli-tui/commands/grouped/index.js.map +0 -1
  983. package/dist/cli-tui/commands/grouped/safety-commands.d.ts.map +0 -1
  984. package/dist/cli-tui/commands/grouped/safety-commands.js.map +0 -1
  985. package/dist/cli-tui/commands/grouped/session-commands.d.ts.map +0 -1
  986. package/dist/cli-tui/commands/grouped/session-commands.js.map +0 -1
  987. package/dist/cli-tui/commands/grouped/tools-commands.d.ts.map +0 -1
  988. package/dist/cli-tui/commands/grouped/tools-commands.js.map +0 -1
  989. package/dist/cli-tui/commands/grouped/ui-commands.d.ts.map +0 -1
  990. package/dist/cli-tui/commands/grouped/ui-commands.js.map +0 -1
  991. package/dist/cli-tui/commands/grouped/undo-commands.d.ts.map +0 -1
  992. package/dist/cli-tui/commands/grouped/undo-commands.js.map +0 -1
  993. package/dist/cli-tui/commands/grouped/usage-commands.d.ts.map +0 -1
  994. package/dist/cli-tui/commands/grouped/usage-commands.js.map +0 -1
  995. package/dist/cli-tui/commands/grouped/utils.d.ts.map +0 -1
  996. package/dist/cli-tui/commands/grouped/utils.js.map +0 -1
  997. package/dist/cli-tui/commands/grouped-command-handlers.d.ts.map +0 -1
  998. package/dist/cli-tui/commands/grouped-command-handlers.js +0 -135
  999. package/dist/cli-tui/commands/grouped-command-handlers.js.map +0 -1
  1000. package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts +0 -78
  1001. package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts.map +0 -1
  1002. package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js +0 -129
  1003. package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js.map +0 -1
  1004. package/node_modules/@evalops/memory/dist/client.d.ts +0 -94
  1005. package/node_modules/@evalops/memory/dist/client.js +0 -503
  1006. package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.d.ts +0 -608
  1007. package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.js +0 -187
  1008. package/node_modules/@evalops/memory/package.json +0 -26
  1009. /package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.d.ts +0 -0
@@ -0,0 +1,459 @@
1
+ import { loadOAuthCredentials } from "../oauth/storage.js";
2
+ import { CONNECT_PROTOCOL_VERSION } from "../platform/client.js";
3
+ import { PLATFORM_CONNECT_METHODS, PLATFORM_CONNECT_SERVICES, platformConnectMethodPath, platformConnectServicePath, } from "../platform/core-services.js";
4
+ import { fetchDownstream } from "../utils/downstream-http.js";
5
+ import * as downstream from "../utils/downstream.js";
6
+ import { createLogger } from "../utils/logger.js";
7
+ const logger = createLogger("connectors:service");
8
+ const DEFAULT_LIST_LIMIT = 500;
9
+ const DEFAULT_MAX_ATTEMPTS = 2;
10
+ const DEFAULT_TIMEOUT_MS = 2_000;
11
+ const REGISTER_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.registerConnection);
12
+ const GET_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.getConnection);
13
+ const LIST_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.listConnections);
14
+ const REFRESH_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.refreshConnection);
15
+ const REVOKE_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.revokeConnection);
16
+ const GET_HEALTH_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.getHealth);
17
+ const RESOLVE_SOURCE_OF_TRUTH_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.resolveSourceOfTruth);
18
+ const GET_DEGRADED_READ_POLICY_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.getDegradedReadPolicy);
19
+ const SET_SOURCE_OF_TRUTH_POLICY_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.setSourceOfTruthPolicy);
20
+ const GET_CAPABILITIES_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.connectors.getCapabilities);
21
+ export const CONNECTORS_CALL_FAILURE_MODES = {
22
+ getCapabilities: downstream.FailOpen,
23
+ getConnection: downstream.FailOpen,
24
+ getDegradedReadPolicy: downstream.FailOpen,
25
+ getHealth: downstream.FailOpen,
26
+ listConnections: downstream.FailOpen,
27
+ refreshConnection: downstream.FailOpen,
28
+ registerConnection: downstream.FailOpen,
29
+ resolveSourceOfTruth: downstream.FailOpen,
30
+ revokeConnection: downstream.FailOpen,
31
+ setSourceOfTruthPolicy: downstream.FailOpen,
32
+ };
33
+ const SOURCE_OF_TRUTH_AREA_BY_LOCAL = {
34
+ analytics: "SOURCE_OF_TRUTH_AREA_ANALYTICS",
35
+ billing: "SOURCE_OF_TRUTH_AREA_BILLING",
36
+ crm: "SOURCE_OF_TRUTH_AREA_CRM",
37
+ hris: "SOURCE_OF_TRUTH_AREA_HRIS",
38
+ support: "SOURCE_OF_TRUTH_AREA_SUPPORT",
39
+ };
40
+ const downstreamClients = new Map();
41
+ function trimString(value) {
42
+ const trimmed = value?.trim();
43
+ return trimmed ? trimmed : undefined;
44
+ }
45
+ function getEnvValue(names) {
46
+ for (const name of names) {
47
+ const value = trimString(process.env[name]);
48
+ if (value) {
49
+ return value;
50
+ }
51
+ }
52
+ return undefined;
53
+ }
54
+ function parsePositiveInt(value, fallback) {
55
+ const parsed = Number.parseInt(value ?? "", 10);
56
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
57
+ }
58
+ function normalizeBaseUrl(baseUrl) {
59
+ let normalized = baseUrl.trim();
60
+ for (const suffix of [
61
+ REGISTER_PATH,
62
+ GET_PATH,
63
+ LIST_PATH,
64
+ REFRESH_PATH,
65
+ REVOKE_PATH,
66
+ GET_HEALTH_PATH,
67
+ RESOLVE_SOURCE_OF_TRUTH_PATH,
68
+ GET_DEGRADED_READ_POLICY_PATH,
69
+ SET_SOURCE_OF_TRUTH_POLICY_PATH,
70
+ GET_CAPABILITIES_PATH,
71
+ platformConnectServicePath(PLATFORM_CONNECT_SERVICES.connectors),
72
+ ]) {
73
+ if (normalized.endsWith(suffix)) {
74
+ normalized = normalized.slice(0, -suffix.length);
75
+ }
76
+ }
77
+ return normalized.replace(/\/+$/, "");
78
+ }
79
+ function normalizeStringList(values) {
80
+ return Array.from(new Set((values ?? [])
81
+ .map((value) => value.trim())
82
+ .filter((value) => value.length > 0)));
83
+ }
84
+ function normalizeStringMap(values) {
85
+ const entries = Object.entries(values ?? {})
86
+ .map(([key, value]) => [key.trim(), value.trim()])
87
+ .filter(([key, value]) => key.length > 0 && value.length > 0);
88
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
89
+ }
90
+ function normalizeEnum(value) {
91
+ const normalized = String(value ?? "")
92
+ .trim()
93
+ .toUpperCase();
94
+ return normalized ? normalized : undefined;
95
+ }
96
+ function normalizePositiveInteger(value) {
97
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
98
+ return Math.round(value);
99
+ }
100
+ if (typeof value === "string") {
101
+ const parsed = Number.parseInt(value.trim(), 10);
102
+ if (Number.isFinite(parsed) && parsed > 0) {
103
+ return parsed;
104
+ }
105
+ }
106
+ return undefined;
107
+ }
108
+ function resolveWorkspaceId(config) {
109
+ const configuredWorkspaceId = trimString(config?.workspaceId);
110
+ const envWorkspaceId = getEnvValue([
111
+ "CONNECTORS_SERVICE_WORKSPACE_ID",
112
+ "MAESTRO_CONNECTORS_WORKSPACE_ID",
113
+ "MAESTRO_EVALOPS_WORKSPACE_ID",
114
+ "MAESTRO_WORKSPACE_ID",
115
+ "MAESTRO_EVALOPS_ORG_ID",
116
+ "EVALOPS_ORGANIZATION_ID",
117
+ "MAESTRO_ENTERPRISE_ORG_ID",
118
+ ]);
119
+ if (configuredWorkspaceId ?? envWorkspaceId) {
120
+ return configuredWorkspaceId ?? envWorkspaceId;
121
+ }
122
+ const stored = loadOAuthCredentials("evalops")?.metadata?.organizationId;
123
+ return typeof stored === "string" && stored.trim().length > 0
124
+ ? stored.trim()
125
+ : undefined;
126
+ }
127
+ export function resolveConnectorsServiceConfig(config) {
128
+ if (config === false) {
129
+ return null;
130
+ }
131
+ const baseUrl = trimString(config?.baseUrl) ??
132
+ getEnvValue([
133
+ "CONNECTORS_SERVICE_URL",
134
+ "MAESTRO_CONNECTORS_SERVICE_URL",
135
+ "MAESTRO_PLATFORM_BASE_URL",
136
+ "MAESTRO_EVALOPS_BASE_URL",
137
+ "EVALOPS_BASE_URL",
138
+ ]);
139
+ if (!baseUrl) {
140
+ return null;
141
+ }
142
+ const storedToken = trimString(loadOAuthCredentials("evalops")?.access);
143
+ return {
144
+ baseUrl: normalizeBaseUrl(baseUrl),
145
+ circuitFailureThreshold: config?.circuitFailureThreshold ??
146
+ parsePositiveInt(getEnvValue([
147
+ "CONNECTORS_SERVICE_CIRCUIT_FAILURE_THRESHOLD",
148
+ "MAESTRO_CONNECTORS_SERVICE_CIRCUIT_FAILURE_THRESHOLD",
149
+ ]), 5),
150
+ circuitResetTimeoutMs: config?.circuitResetTimeoutMs ??
151
+ parsePositiveInt(getEnvValue([
152
+ "CONNECTORS_SERVICE_CIRCUIT_RESET_TIMEOUT_MS",
153
+ "MAESTRO_CONNECTORS_SERVICE_CIRCUIT_RESET_TIMEOUT_MS",
154
+ ]), 30_000),
155
+ circuitSuccessThreshold: config?.circuitSuccessThreshold ??
156
+ parsePositiveInt(getEnvValue([
157
+ "CONNECTORS_SERVICE_CIRCUIT_SUCCESS_THRESHOLD",
158
+ "MAESTRO_CONNECTORS_SERVICE_CIRCUIT_SUCCESS_THRESHOLD",
159
+ ]), 2),
160
+ maxAttempts: config?.maxAttempts ??
161
+ parsePositiveInt(getEnvValue([
162
+ "CONNECTORS_SERVICE_MAX_ATTEMPTS",
163
+ "MAESTRO_CONNECTORS_SERVICE_MAX_ATTEMPTS",
164
+ ]), DEFAULT_MAX_ATTEMPTS),
165
+ timeoutMs: config?.timeoutMs ??
166
+ parsePositiveInt(getEnvValue([
167
+ "CONNECTORS_SERVICE_TIMEOUT_MS",
168
+ "MAESTRO_CONNECTORS_SERVICE_TIMEOUT_MS",
169
+ ]), DEFAULT_TIMEOUT_MS),
170
+ token: trimString(config?.token) ??
171
+ getEnvValue([
172
+ "CONNECTORS_SERVICE_TOKEN",
173
+ "MAESTRO_CONNECTORS_SERVICE_TOKEN",
174
+ "MAESTRO_EVALOPS_ACCESS_TOKEN",
175
+ "EVALOPS_TOKEN",
176
+ ]) ??
177
+ storedToken,
178
+ workspaceId: resolveWorkspaceId(config),
179
+ };
180
+ }
181
+ function buildHeaders(config) {
182
+ return {
183
+ ...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),
184
+ "Connect-Protocol-Version": CONNECT_PROTOCOL_VERSION,
185
+ "Content-Type": "application/json",
186
+ };
187
+ }
188
+ function getDownstreamClient(config, op) {
189
+ const failureMode = CONNECTORS_CALL_FAILURE_MODES[op];
190
+ const key = JSON.stringify({
191
+ baseUrl: config.baseUrl,
192
+ failureMode,
193
+ op,
194
+ threshold: config.circuitFailureThreshold,
195
+ reset: config.circuitResetTimeoutMs,
196
+ success: config.circuitSuccessThreshold,
197
+ });
198
+ const cached = downstreamClients.get(key);
199
+ if (cached) {
200
+ return cached;
201
+ }
202
+ const client = downstream.New(`connectors.${op}`, {
203
+ failureMode,
204
+ breaker: {
205
+ failureThreshold: config.circuitFailureThreshold,
206
+ resetTimeoutMs: config.circuitResetTimeoutMs,
207
+ successThreshold: config.circuitSuccessThreshold,
208
+ toolName: `connectors.${op}`,
209
+ },
210
+ });
211
+ downstreamClients.set(key, client);
212
+ return client;
213
+ }
214
+ async function postConnectors(config, op, path, body, failOpenValue) {
215
+ const client = getDownstreamClient(config, op);
216
+ return downstream.CallOp(client, op, async () => {
217
+ const response = await fetchDownstream(`${config.baseUrl}${path}`, {
218
+ method: "POST",
219
+ headers: buildHeaders(config),
220
+ body: JSON.stringify(body),
221
+ }, {
222
+ serviceName: "connectors service",
223
+ failureMode: client.failureMode === downstream.FailClosed
224
+ ? "required"
225
+ : "optional",
226
+ timeoutMs: config.timeoutMs,
227
+ maxAttempts: config.maxAttempts,
228
+ });
229
+ if (!response.ok) {
230
+ const text = await response.text();
231
+ throw new Error(`connectors service returned ${response.status}: ${text || response.statusText}`);
232
+ }
233
+ return (await response.json());
234
+ }, failOpenValue);
235
+ }
236
+ function normalizeRemoteConnection(connection) {
237
+ if (!connection) {
238
+ return null;
239
+ }
240
+ const id = trimString(connection.id);
241
+ const workspaceId = trimString(connection.workspaceId);
242
+ const providerId = trimString(connection.providerId);
243
+ if (!id || !workspaceId || !providerId) {
244
+ return null;
245
+ }
246
+ const credentialRefs = normalizeStringMap(connection.credentialRefs);
247
+ return {
248
+ id,
249
+ workspaceId,
250
+ providerId,
251
+ displayName: trimString(connection.displayName),
252
+ authType: normalizeEnum(connection.authType),
253
+ scopes: normalizeStringList(connection.scopes),
254
+ ...(credentialRefs ? { credentialRefs } : {}),
255
+ healthStatus: normalizeEnum(connection.healthStatus),
256
+ lastHealthyAt: trimString(connection.lastHealthyAt),
257
+ createdAt: trimString(connection.createdAt),
258
+ updatedAt: trimString(connection.updatedAt),
259
+ };
260
+ }
261
+ function normalizeHealth(health) {
262
+ if (!health) {
263
+ return null;
264
+ }
265
+ return {
266
+ status: normalizeEnum(health.status),
267
+ latencyMs: typeof health.latencyMs === "number" && Number.isFinite(health.latencyMs)
268
+ ? Math.round(health.latencyMs)
269
+ : undefined,
270
+ lastCheckAt: trimString(health.lastCheckAt),
271
+ errorMessage: trimString(health.errorMessage),
272
+ };
273
+ }
274
+ function normalizeSourceOfTruthPolicy(policy, fallbackWorkspaceId, fallbackArea) {
275
+ if (!policy) {
276
+ return null;
277
+ }
278
+ const workspaceId = trimString(policy.workspaceId) ?? fallbackWorkspaceId;
279
+ const area = fallbackArea ??
280
+ (typeof policy.area === "string"
281
+ ? trimString(policy.area)?.replace(/^SOURCE_OF_TRUTH_AREA_/u, "")
282
+ : undefined)?.toLowerCase();
283
+ const primaryConnectionId = trimString(policy.primaryConnectionId);
284
+ if (!workspaceId || !area || !primaryConnectionId) {
285
+ return null;
286
+ }
287
+ return {
288
+ workspaceId,
289
+ area,
290
+ primaryConnectionId,
291
+ ...(trimString(policy.fallbackConnectionId)
292
+ ? { fallbackConnectionId: trimString(policy.fallbackConnectionId) }
293
+ : {}),
294
+ };
295
+ }
296
+ export async function listRemoteConnections(workspaceId, configInput) {
297
+ const config = resolveConnectorsServiceConfig(configInput);
298
+ const resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;
299
+ if (!config || !resolvedWorkspaceId) {
300
+ return [];
301
+ }
302
+ const response = await postConnectors(config, "listConnections", LIST_PATH, {
303
+ workspaceId: resolvedWorkspaceId,
304
+ limit: DEFAULT_LIST_LIMIT,
305
+ offset: 0,
306
+ }, () => ({ connections: [], total: 0 }));
307
+ return (response.connections ?? [])
308
+ .map(normalizeRemoteConnection)
309
+ .filter((connection) => connection !== null);
310
+ }
311
+ export async function getRemoteConnection(connectionId, configInput) {
312
+ const config = resolveConnectorsServiceConfig(configInput);
313
+ const id = trimString(connectionId);
314
+ if (!config || !id) {
315
+ return null;
316
+ }
317
+ const response = await postConnectors(config, "getConnection", GET_PATH, { id }, () => ({}));
318
+ return normalizeRemoteConnection(response.connection);
319
+ }
320
+ export async function registerRemoteConnection(input, configInput) {
321
+ const config = resolveConnectorsServiceConfig(configInput);
322
+ const workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;
323
+ const providerId = trimString(input.providerId);
324
+ if (!config || !workspaceId || !providerId) {
325
+ return null;
326
+ }
327
+ const credentials = normalizeStringMap(input.credentials);
328
+ const response = await postConnectors(config, "registerConnection", REGISTER_PATH, {
329
+ workspaceId,
330
+ providerId,
331
+ displayName: trimString(input.displayName) ?? providerId,
332
+ authType: input.authType,
333
+ scopes: normalizeStringList(input.scopes),
334
+ ...(credentials ? { credentials } : {}),
335
+ }, () => ({}));
336
+ return normalizeRemoteConnection(response.connection);
337
+ }
338
+ export async function refreshRemoteConnection(connectionId, configInput) {
339
+ const config = resolveConnectorsServiceConfig(configInput);
340
+ const id = trimString(connectionId);
341
+ if (!config || !id) {
342
+ return null;
343
+ }
344
+ const response = await postConnectors(config, "refreshConnection", REFRESH_PATH, { id }, () => ({}));
345
+ return normalizeRemoteConnection(response.connection);
346
+ }
347
+ export async function revokeRemoteConnection(connectionId, configInput) {
348
+ const config = resolveConnectorsServiceConfig(configInput);
349
+ const id = trimString(connectionId);
350
+ if (!config || !id) {
351
+ return false;
352
+ }
353
+ const response = await postConnectors(config, "revokeConnection", REVOKE_PATH, { id }, () => ({ revoked: false }));
354
+ return response.revoked !== false;
355
+ }
356
+ export async function getRemoteConnectionHealth(connectionId, configInput) {
357
+ const config = resolveConnectorsServiceConfig(configInput);
358
+ const id = trimString(connectionId);
359
+ if (!config || !id) {
360
+ return null;
361
+ }
362
+ const response = await postConnectors(config, "getHealth", GET_HEALTH_PATH, { connectionId: id }, () => ({}));
363
+ return normalizeHealth(response.health);
364
+ }
365
+ export async function resolveRemoteSourceOfTruth(workspaceId, area, configInput) {
366
+ const config = resolveConnectorsServiceConfig(configInput);
367
+ const resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;
368
+ const normalizedArea = trimString(area)?.toLowerCase();
369
+ const remoteArea = normalizedArea
370
+ ? SOURCE_OF_TRUTH_AREA_BY_LOCAL[normalizedArea]
371
+ : undefined;
372
+ if (!config || !resolvedWorkspaceId || !normalizedArea || !remoteArea) {
373
+ return null;
374
+ }
375
+ const response = await postConnectors(config, "resolveSourceOfTruth", RESOLVE_SOURCE_OF_TRUTH_PATH, {
376
+ workspaceId: resolvedWorkspaceId,
377
+ area: remoteArea,
378
+ }, () => ({}));
379
+ const primaryConnectionId = trimString(response.policy?.primaryConnectionId) ??
380
+ trimString(response.primaryConnection?.id);
381
+ const providerId = trimString(response.primaryConnection?.providerId);
382
+ if (!primaryConnectionId || !providerId) {
383
+ return null;
384
+ }
385
+ return {
386
+ workspaceId: trimString(response.policy?.workspaceId) ?? resolvedWorkspaceId,
387
+ area: normalizedArea,
388
+ primaryConnectionId,
389
+ ...(trimString(response.policy?.fallbackConnectionId)
390
+ ? {
391
+ fallbackConnectionId: trimString(response.policy?.fallbackConnectionId),
392
+ }
393
+ : {}),
394
+ providerId,
395
+ ...(trimString(response.primaryConnection?.displayName)
396
+ ? { displayName: trimString(response.primaryConnection?.displayName) }
397
+ : {}),
398
+ };
399
+ }
400
+ export async function setRemoteSourceOfTruthPolicy(input, configInput) {
401
+ const config = resolveConnectorsServiceConfig(configInput);
402
+ const workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;
403
+ const normalizedArea = trimString(input.area)?.toLowerCase();
404
+ const remoteArea = normalizedArea
405
+ ? SOURCE_OF_TRUTH_AREA_BY_LOCAL[normalizedArea]
406
+ : undefined;
407
+ const primaryConnectionId = trimString(input.primaryConnectionId);
408
+ const fallbackConnectionId = trimString(input.fallbackConnectionId);
409
+ if (!config ||
410
+ !workspaceId ||
411
+ !normalizedArea ||
412
+ !remoteArea ||
413
+ !primaryConnectionId) {
414
+ return null;
415
+ }
416
+ const response = await postConnectors(config, "setSourceOfTruthPolicy", SET_SOURCE_OF_TRUTH_POLICY_PATH, {
417
+ policy: {
418
+ workspaceId,
419
+ area: remoteArea,
420
+ primaryConnectionId,
421
+ ...(fallbackConnectionId ? { fallbackConnectionId } : {}),
422
+ },
423
+ }, () => ({}));
424
+ return normalizeSourceOfTruthPolicy(response.policy, workspaceId, normalizedArea);
425
+ }
426
+ export async function getRemoteDegradedReadPolicy(workspaceId, configInput) {
427
+ const config = resolveConnectorsServiceConfig(configInput);
428
+ const resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;
429
+ if (!config || !resolvedWorkspaceId) {
430
+ return null;
431
+ }
432
+ const response = await postConnectors(config, "getDegradedReadPolicy", GET_DEGRADED_READ_POLICY_PATH, { workspaceId: resolvedWorkspaceId }, () => ({}));
433
+ if (!response.policy) {
434
+ return null;
435
+ }
436
+ const maxAgeMinutes = normalizePositiveInteger(response.policy.maxAgeMinutes);
437
+ return {
438
+ mode: trimString(response.policy.mode),
439
+ integrations: normalizeStringList(response.policy.allowedIntegrations),
440
+ ...(maxAgeMinutes !== undefined ? { maxAgeMinutes } : {}),
441
+ ...(typeof response.policy.queuePrimaryRefresh === "boolean"
442
+ ? { queuePrimaryRefresh: response.policy.queuePrimaryRefresh }
443
+ : {}),
444
+ };
445
+ }
446
+ export async function getRemoteConnectionCapabilities(connectionId, configInput) {
447
+ const config = resolveConnectorsServiceConfig(configInput);
448
+ const id = trimString(connectionId);
449
+ if (!config || !id) {
450
+ return [];
451
+ }
452
+ const response = await postConnectors(config, "getCapabilities", GET_CAPABILITIES_PATH, { connectionId: id }, () => ({ capabilities: [] }));
453
+ return normalizeStringList(response.capabilities);
454
+ }
455
+ export function resetConnectorsDownstreamForTests() {
456
+ downstreamClients.clear();
457
+ logger.debug("Reset connectors downstream client cache");
458
+ }
459
+ //# sourceMappingURL=service-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-client.js","sourceRoot":"","sources":["../../src/connectors/service-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAElD,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,aAAa,GAAG,yBAAyB,CAC9C,wBAAwB,CAAC,UAAU,CAAC,kBAAkB,CACtD,CAAC;AACF,MAAM,QAAQ,GAAG,yBAAyB,CACzC,wBAAwB,CAAC,UAAU,CAAC,aAAa,CACjD,CAAC;AACF,MAAM,SAAS,GAAG,yBAAyB,CAC1C,wBAAwB,CAAC,UAAU,CAAC,eAAe,CACnD,CAAC;AACF,MAAM,YAAY,GAAG,yBAAyB,CAC7C,wBAAwB,CAAC,UAAU,CAAC,iBAAiB,CACrD,CAAC;AACF,MAAM,WAAW,GAAG,yBAAyB,CAC5C,wBAAwB,CAAC,UAAU,CAAC,gBAAgB,CACpD,CAAC;AACF,MAAM,eAAe,GAAG,yBAAyB,CAChD,wBAAwB,CAAC,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"../oauth/storage.js\";\nimport { CONNECT_PROTOCOL_VERSION } from \"../platform/client.js\";\nimport {\n\tPLATFORM_CONNECT_METHODS,\n\tPLATFORM_CONNECT_SERVICES,\n\tplatformConnectMethodPath,\n\tplatformConnectServicePath,\n} from \"../platform/core-services.js\";\nimport { fetchDownstream } from \"../utils/downstream-http.js\";\nimport * as downstream from \"../utils/downstream.js\";\nimport { createLogger } from \"../utils/logger.js\";\n\nconst logger = createLogger(\"connectors:service\");\n\nconst DEFAULT_LIST_LIMIT = 500;\nconst DEFAULT_MAX_ATTEMPTS = 2;\nconst DEFAULT_TIMEOUT_MS = 2_000;\nconst REGISTER_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.registerConnection,\n);\nconst GET_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.getConnection,\n);\nconst LIST_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.listConnections,\n);\nconst REFRESH_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.refreshConnection,\n);\nconst REVOKE_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.revokeConnection,\n);\nconst GET_HEALTH_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.getHealth,\n);\nconst RESOLVE_SOURCE_OF_TRUTH_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.resolveSourceOfTruth,\n);\nconst GET_DEGRADED_READ_POLICY_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.getDegradedReadPolicy,\n);\nconst SET_SOURCE_OF_TRUTH_POLICY_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.setSourceOfTruthPolicy,\n);\nconst GET_CAPABILITIES_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.connectors.getCapabilities,\n);\n\nexport const CONNECTORS_CALL_FAILURE_MODES = {\n\tgetCapabilities: downstream.FailOpen,\n\tgetConnection: downstream.FailOpen,\n\tgetDegradedReadPolicy: downstream.FailOpen,\n\tgetHealth: downstream.FailOpen,\n\tlistConnections: downstream.FailOpen,\n\trefreshConnection: downstream.FailOpen,\n\tregisterConnection: downstream.FailOpen,\n\tresolveSourceOfTruth: downstream.FailOpen,\n\trevokeConnection: downstream.FailOpen,\n\tsetSourceOfTruthPolicy: downstream.FailOpen,\n} as const;\n\ntype ConnectorsCall = keyof typeof CONNECTORS_CALL_FAILURE_MODES;\n\nexport interface ConnectorsServiceConfig {\n\tbaseUrl?: string;\n\ttoken?: string;\n\tworkspaceId?: string;\n\ttimeoutMs?: number;\n\tmaxAttempts?: number;\n\tcircuitFailureThreshold?: number;\n\tcircuitResetTimeoutMs?: number;\n\tcircuitSuccessThreshold?: number;\n}\n\nexport interface ResolvedConnectorsServiceConfig {\n\tbaseUrl: string;\n\ttoken?: string;\n\tworkspaceId?: string;\n\ttimeoutMs: number;\n\tmaxAttempts: number;\n\tcircuitFailureThreshold: number;\n\tcircuitResetTimeoutMs: number;\n\tcircuitSuccessThreshold: number;\n}\n\ninterface RemoteConnectionPayload {\n\tid?: string;\n\tworkspaceId?: string;\n\tproviderId?: string;\n\tdisplayName?: string;\n\tauthType?: string | number;\n\tscopes?: string[];\n\tcredentialRefs?: Record<string, string>;\n\thealthStatus?: string | number;\n\tlastHealthyAt?: string;\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n}\n\ninterface ConnectionResponse {\n\tconnection?: RemoteConnectionPayload;\n}\n\ninterface ListConnectionsResponse {\n\tconnections?: RemoteConnectionPayload[];\n\ttotal?: number;\n}\n\ninterface HealthPayload {\n\tstatus?: string | number;\n\tlatencyMs?: number;\n\tlastCheckAt?: string;\n\terrorMessage?: string;\n}\n\ninterface GetHealthResponse {\n\thealth?: HealthPayload;\n}\n\ninterface SourceOfTruthPolicyPayload {\n\tworkspaceId?: string;\n\tarea?: string | number;\n\tprimaryConnectionId?: string;\n\tfallbackConnectionId?: string;\n}\n\ninterface ResolveSourceOfTruthResponse {\n\tpolicy?: SourceOfTruthPolicyPayload;\n\tprimaryConnection?: RemoteConnectionPayload;\n}\n\ninterface RemoteDegradedReadPolicyPayload {\n\tmode?: string;\n\tallowedIntegrations?: string[];\n\tmaxAgeMinutes?: number | string;\n\tqueuePrimaryRefresh?: boolean;\n}\n\ninterface GetDegradedReadPolicyResponse {\n\tpolicy?: RemoteDegradedReadPolicyPayload;\n}\n\ninterface GetCapabilitiesResponse {\n\tcapabilities?: string[];\n}\n\nexport interface RemoteConnectorConnection {\n\tid: string;\n\tworkspaceId: string;\n\tproviderId: string;\n\tdisplayName?: string;\n\tauthType?: string;\n\tscopes: string[];\n\tcredentialRefs?: Record<string, string>;\n\thealthStatus?: string;\n\tlastHealthyAt?: string;\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n}\n\nexport interface RemoteConnectionHealth {\n\tstatus?: string;\n\tlatencyMs?: number;\n\tlastCheckAt?: string;\n\terrorMessage?: string;\n}\n\nexport interface RegisterRemoteConnectionInput {\n\tworkspaceId?: string;\n\tproviderId: string;\n\tdisplayName?: string;\n\tauthType: \"AUTH_TYPE_OAUTH2\" | \"AUTH_TYPE_API_KEY\" | \"AUTH_TYPE_BASIC\";\n\tscopes?: string[];\n\tcredentials?: Record<string, string>;\n}\n\nexport interface RemoteSourceOfTruthResolution {\n\tworkspaceId: string;\n\tarea: string;\n\tprimaryConnectionId: string;\n\tfallbackConnectionId?: string;\n\tproviderId: string;\n\tdisplayName?: string;\n}\n\nexport interface RemoteSourceOfTruthPolicy {\n\tworkspaceId: string;\n\tarea: string;\n\tprimaryConnectionId: string;\n\tfallbackConnectionId?: string;\n}\n\nexport interface SetRemoteSourceOfTruthPolicyInput {\n\tworkspaceId?: string;\n\tarea: string;\n\tprimaryConnectionId: string;\n\tfallbackConnectionId?: string;\n}\n\nexport interface RemoteDegradedReadPolicy {\n\tmode?: string;\n\tintegrations: string[];\n\tmaxAgeMinutes?: number;\n\tqueuePrimaryRefresh?: boolean;\n}\n\nconst SOURCE_OF_TRUTH_AREA_BY_LOCAL: Partial<Record<string, string>> = {\n\tanalytics: \"SOURCE_OF_TRUTH_AREA_ANALYTICS\",\n\tbilling: \"SOURCE_OF_TRUTH_AREA_BILLING\",\n\tcrm: \"SOURCE_OF_TRUTH_AREA_CRM\",\n\thris: \"SOURCE_OF_TRUTH_AREA_HRIS\",\n\tsupport: \"SOURCE_OF_TRUTH_AREA_SUPPORT\",\n};\n\nconst downstreamClients = new Map<string, downstream.DownstreamClient>();\n\nfunction trimString(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nfunction getEnvValue(names: string[]): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = trimString(process.env[name]);\n\t\tif (value) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction parsePositiveInt(value: string | undefined, fallback: number): number {\n\tconst parsed = Number.parseInt(value ?? \"\", 10);\n\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;\n}\n\nfunction normalizeBaseUrl(baseUrl: string): string {\n\tlet normalized = baseUrl.trim();\n\tfor (const suffix of [\n\t\tREGISTER_PATH,\n\t\tGET_PATH,\n\t\tLIST_PATH,\n\t\tREFRESH_PATH,\n\t\tREVOKE_PATH,\n\t\tGET_HEALTH_PATH,\n\t\tRESOLVE_SOURCE_OF_TRUTH_PATH,\n\t\tGET_DEGRADED_READ_POLICY_PATH,\n\t\tSET_SOURCE_OF_TRUTH_POLICY_PATH,\n\t\tGET_CAPABILITIES_PATH,\n\t\tplatformConnectServicePath(PLATFORM_CONNECT_SERVICES.connectors),\n\t]) {\n\t\tif (normalized.endsWith(suffix)) {\n\t\t\tnormalized = normalized.slice(0, -suffix.length);\n\t\t}\n\t}\n\treturn normalized.replace(/\\/+$/, \"\");\n}\n\nfunction normalizeStringList(values: string[] | undefined): string[] {\n\treturn Array.from(\n\t\tnew Set(\n\t\t\t(values ?? [])\n\t\t\t\t.map((value) => value.trim())\n\t\t\t\t.filter((value) => value.length > 0),\n\t\t),\n\t);\n}\n\nfunction normalizeStringMap(\n\tvalues: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n\tconst entries = Object.entries(values ?? {})\n\t\t.map(([key, value]) => [key.trim(), value.trim()] as const)\n\t\t.filter(([key, value]) => key.length > 0 && value.length > 0);\n\treturn entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\nfunction normalizeEnum(value: string | number | undefined): string | undefined {\n\tconst normalized = String(value ?? \"\")\n\t\t.trim()\n\t\t.toUpperCase();\n\treturn normalized ? normalized : undefined;\n}\n\nfunction normalizePositiveInteger(\n\tvalue: number | string | undefined,\n): number | undefined {\n\tif (typeof value === \"number\" && Number.isFinite(value) && value > 0) {\n\t\treturn Math.round(value);\n\t}\n\tif (typeof value === \"string\") {\n\t\tconst parsed = Number.parseInt(value.trim(), 10);\n\t\tif (Number.isFinite(parsed) && parsed > 0) {\n\t\t\treturn parsed;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction resolveWorkspaceId(\n\tconfig: ConnectorsServiceConfig | undefined,\n): string | undefined {\n\tconst configuredWorkspaceId = trimString(config?.workspaceId);\n\tconst envWorkspaceId = getEnvValue([\n\t\t\"CONNECTORS_SERVICE_WORKSPACE_ID\",\n\t\t\"MAESTRO_CONNECTORS_WORKSPACE_ID\",\n\t\t\"MAESTRO_EVALOPS_WORKSPACE_ID\",\n\t\t\"MAESTRO_WORKSPACE_ID\",\n\t\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\t\"EVALOPS_ORGANIZATION_ID\",\n\t\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n\t]);\n\tif (configuredWorkspaceId ?? envWorkspaceId) {\n\t\treturn configuredWorkspaceId ?? envWorkspaceId;\n\t}\n\tconst stored = loadOAuthCredentials(\"evalops\")?.metadata?.organizationId;\n\treturn typeof stored === \"string\" && stored.trim().length > 0\n\t\t? stored.trim()\n\t\t: undefined;\n}\n\nexport function resolveConnectorsServiceConfig(\n\tconfig?: ConnectorsServiceConfig | false,\n): ResolvedConnectorsServiceConfig | null {\n\tif (config === false) {\n\t\treturn null;\n\t}\n\n\tconst baseUrl =\n\t\ttrimString(config?.baseUrl) ??\n\t\tgetEnvValue([\n\t\t\t\"CONNECTORS_SERVICE_URL\",\n\t\t\t\"MAESTRO_CONNECTORS_SERVICE_URL\",\n\t\t\t\"MAESTRO_PLATFORM_BASE_URL\",\n\t\t\t\"MAESTRO_EVALOPS_BASE_URL\",\n\t\t\t\"EVALOPS_BASE_URL\",\n\t\t]);\n\tif (!baseUrl) {\n\t\treturn null;\n\t}\n\n\tconst storedToken = trimString(loadOAuthCredentials(\"evalops\")?.access);\n\treturn {\n\t\tbaseUrl: normalizeBaseUrl(baseUrl),\n\t\tcircuitFailureThreshold:\n\t\t\tconfig?.circuitFailureThreshold ??\n\t\t\tparsePositiveInt(\n\t\t\t\tgetEnvValue([\n\t\t\t\t\t\"CONNECTORS_SERVICE_CIRCUIT_FAILURE_THRESHOLD\",\n\t\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_CIRCUIT_FAILURE_THRESHOLD\",\n\t\t\t\t]),\n\t\t\t\t5,\n\t\t\t),\n\t\tcircuitResetTimeoutMs:\n\t\t\tconfig?.circuitResetTimeoutMs ??\n\t\t\tparsePositiveInt(\n\t\t\t\tgetEnvValue([\n\t\t\t\t\t\"CONNECTORS_SERVICE_CIRCUIT_RESET_TIMEOUT_MS\",\n\t\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_CIRCUIT_RESET_TIMEOUT_MS\",\n\t\t\t\t]),\n\t\t\t\t30_000,\n\t\t\t),\n\t\tcircuitSuccessThreshold:\n\t\t\tconfig?.circuitSuccessThreshold ??\n\t\t\tparsePositiveInt(\n\t\t\t\tgetEnvValue([\n\t\t\t\t\t\"CONNECTORS_SERVICE_CIRCUIT_SUCCESS_THRESHOLD\",\n\t\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_CIRCUIT_SUCCESS_THRESHOLD\",\n\t\t\t\t]),\n\t\t\t\t2,\n\t\t\t),\n\t\tmaxAttempts:\n\t\t\tconfig?.maxAttempts ??\n\t\t\tparsePositiveInt(\n\t\t\t\tgetEnvValue([\n\t\t\t\t\t\"CONNECTORS_SERVICE_MAX_ATTEMPTS\",\n\t\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_MAX_ATTEMPTS\",\n\t\t\t\t]),\n\t\t\t\tDEFAULT_MAX_ATTEMPTS,\n\t\t\t),\n\t\ttimeoutMs:\n\t\t\tconfig?.timeoutMs ??\n\t\t\tparsePositiveInt(\n\t\t\t\tgetEnvValue([\n\t\t\t\t\t\"CONNECTORS_SERVICE_TIMEOUT_MS\",\n\t\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_TIMEOUT_MS\",\n\t\t\t\t]),\n\t\t\t\tDEFAULT_TIMEOUT_MS,\n\t\t\t),\n\t\ttoken:\n\t\t\ttrimString(config?.token) ??\n\t\t\tgetEnvValue([\n\t\t\t\t\"CONNECTORS_SERVICE_TOKEN\",\n\t\t\t\t\"MAESTRO_CONNECTORS_SERVICE_TOKEN\",\n\t\t\t\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\t\t\t\"EVALOPS_TOKEN\",\n\t\t\t]) ??\n\t\t\tstoredToken,\n\t\tworkspaceId: resolveWorkspaceId(config),\n\t};\n}\n\nfunction buildHeaders(\n\tconfig: ResolvedConnectorsServiceConfig,\n): Record<string, string> {\n\treturn {\n\t\t...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),\n\t\t\"Connect-Protocol-Version\": CONNECT_PROTOCOL_VERSION,\n\t\t\"Content-Type\": \"application/json\",\n\t};\n}\n\nfunction getDownstreamClient(\n\tconfig: ResolvedConnectorsServiceConfig,\n\top: ConnectorsCall,\n): downstream.DownstreamClient {\n\tconst failureMode = CONNECTORS_CALL_FAILURE_MODES[op];\n\tconst key = JSON.stringify({\n\t\tbaseUrl: config.baseUrl,\n\t\tfailureMode,\n\t\top,\n\t\tthreshold: config.circuitFailureThreshold,\n\t\treset: config.circuitResetTimeoutMs,\n\t\tsuccess: config.circuitSuccessThreshold,\n\t});\n\tconst cached = downstreamClients.get(key);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\tconst client = downstream.New(`connectors.${op}`, {\n\t\tfailureMode,\n\t\tbreaker: {\n\t\t\tfailureThreshold: config.circuitFailureThreshold,\n\t\t\tresetTimeoutMs: config.circuitResetTimeoutMs,\n\t\t\tsuccessThreshold: config.circuitSuccessThreshold,\n\t\t\ttoolName: `connectors.${op}`,\n\t\t},\n\t});\n\tdownstreamClients.set(key, client);\n\treturn client;\n}\n\nasync function postConnectors<T>(\n\tconfig: ResolvedConnectorsServiceConfig,\n\top: ConnectorsCall,\n\tpath: string,\n\tbody: Record<string, unknown>,\n\tfailOpenValue: () => T,\n): Promise<T> {\n\tconst client = getDownstreamClient(config, op);\n\treturn downstream.CallOp(\n\t\tclient,\n\t\top,\n\t\tasync () => {\n\t\t\tconst response = await fetchDownstream(\n\t\t\t\t`${config.baseUrl}${path}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: buildHeaders(config),\n\t\t\t\t\tbody: JSON.stringify(body),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tserviceName: \"connectors service\",\n\t\t\t\t\tfailureMode:\n\t\t\t\t\t\tclient.failureMode === downstream.FailClosed\n\t\t\t\t\t\t\t? \"required\"\n\t\t\t\t\t\t\t: \"optional\",\n\t\t\t\t\ttimeoutMs: config.timeoutMs,\n\t\t\t\t\tmaxAttempts: config.maxAttempts,\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text();\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`connectors service returned ${response.status}: ${\n\t\t\t\t\t\ttext || response.statusText\n\t\t\t\t\t}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (await response.json()) as T;\n\t\t},\n\t\tfailOpenValue,\n\t);\n}\n\nfunction normalizeRemoteConnection(\n\tconnection: RemoteConnectionPayload | undefined,\n): RemoteConnectorConnection | null {\n\tif (!connection) {\n\t\treturn null;\n\t}\n\tconst id = trimString(connection.id);\n\tconst workspaceId = trimString(connection.workspaceId);\n\tconst providerId = trimString(connection.providerId);\n\tif (!id || !workspaceId || !providerId) {\n\t\treturn null;\n\t}\n\tconst credentialRefs = normalizeStringMap(connection.credentialRefs);\n\treturn {\n\t\tid,\n\t\tworkspaceId,\n\t\tproviderId,\n\t\tdisplayName: trimString(connection.displayName),\n\t\tauthType: normalizeEnum(connection.authType),\n\t\tscopes: normalizeStringList(connection.scopes),\n\t\t...(credentialRefs ? { credentialRefs } : {}),\n\t\thealthStatus: normalizeEnum(connection.healthStatus),\n\t\tlastHealthyAt: trimString(connection.lastHealthyAt),\n\t\tcreatedAt: trimString(connection.createdAt),\n\t\tupdatedAt: trimString(connection.updatedAt),\n\t};\n}\n\nfunction normalizeHealth(\n\thealth: HealthPayload | undefined,\n): RemoteConnectionHealth | null {\n\tif (!health) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tstatus: normalizeEnum(health.status),\n\t\tlatencyMs:\n\t\t\ttypeof health.latencyMs === \"number\" && Number.isFinite(health.latencyMs)\n\t\t\t\t? Math.round(health.latencyMs)\n\t\t\t\t: undefined,\n\t\tlastCheckAt: trimString(health.lastCheckAt),\n\t\terrorMessage: trimString(health.errorMessage),\n\t};\n}\n\nfunction normalizeSourceOfTruthPolicy(\n\tpolicy: SourceOfTruthPolicyPayload | undefined,\n\tfallbackWorkspaceId?: string,\n\tfallbackArea?: string,\n): RemoteSourceOfTruthPolicy | null {\n\tif (!policy) {\n\t\treturn null;\n\t}\n\tconst workspaceId = trimString(policy.workspaceId) ?? fallbackWorkspaceId;\n\tconst area =\n\t\tfallbackArea ??\n\t\t(typeof policy.area === \"string\"\n\t\t\t? trimString(policy.area)?.replace(/^SOURCE_OF_TRUTH_AREA_/u, \"\")\n\t\t\t: undefined\n\t\t)?.toLowerCase();\n\tconst primaryConnectionId = trimString(policy.primaryConnectionId);\n\tif (!workspaceId || !area || !primaryConnectionId) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tworkspaceId,\n\t\tarea,\n\t\tprimaryConnectionId,\n\t\t...(trimString(policy.fallbackConnectionId)\n\t\t\t? { fallbackConnectionId: trimString(policy.fallbackConnectionId) }\n\t\t\t: {}),\n\t};\n}\n\nexport async function listRemoteConnections(\n\tworkspaceId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteConnectorConnection[]> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;\n\tif (!config || !resolvedWorkspaceId) {\n\t\treturn [];\n\t}\n\n\tconst response = await postConnectors<ListConnectionsResponse>(\n\t\tconfig,\n\t\t\"listConnections\",\n\t\tLIST_PATH,\n\t\t{\n\t\t\tworkspaceId: resolvedWorkspaceId,\n\t\t\tlimit: DEFAULT_LIST_LIMIT,\n\t\t\toffset: 0,\n\t\t},\n\t\t() => ({ connections: [], total: 0 }),\n\t);\n\treturn (response.connections ?? [])\n\t\t.map(normalizeRemoteConnection)\n\t\t.filter(\n\t\t\t(connection): connection is RemoteConnectorConnection =>\n\t\t\t\tconnection !== null,\n\t\t);\n}\n\nexport async function getRemoteConnection(\n\tconnectionId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteConnectorConnection | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst id = trimString(connectionId);\n\tif (!config || !id) {\n\t\treturn null;\n\t}\n\tconst response = await postConnectors<ConnectionResponse>(\n\t\tconfig,\n\t\t\"getConnection\",\n\t\tGET_PATH,\n\t\t{ id },\n\t\t() => ({}),\n\t);\n\treturn normalizeRemoteConnection(response.connection);\n}\n\nexport async function registerRemoteConnection(\n\tinput: RegisterRemoteConnectionInput,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteConnectorConnection | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;\n\tconst providerId = trimString(input.providerId);\n\tif (!config || !workspaceId || !providerId) {\n\t\treturn null;\n\t}\n\n\tconst credentials = normalizeStringMap(input.credentials);\n\tconst response = await postConnectors<ConnectionResponse>(\n\t\tconfig,\n\t\t\"registerConnection\",\n\t\tREGISTER_PATH,\n\t\t{\n\t\t\tworkspaceId,\n\t\t\tproviderId,\n\t\t\tdisplayName: trimString(input.displayName) ?? providerId,\n\t\t\tauthType: input.authType,\n\t\t\tscopes: normalizeStringList(input.scopes),\n\t\t\t...(credentials ? { credentials } : {}),\n\t\t},\n\t\t() => ({}),\n\t);\n\treturn normalizeRemoteConnection(response.connection);\n}\n\nexport async function refreshRemoteConnection(\n\tconnectionId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteConnectorConnection | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst id = trimString(connectionId);\n\tif (!config || !id) {\n\t\treturn null;\n\t}\n\tconst response = await postConnectors<ConnectionResponse>(\n\t\tconfig,\n\t\t\"refreshConnection\",\n\t\tREFRESH_PATH,\n\t\t{ id },\n\t\t() => ({}),\n\t);\n\treturn normalizeRemoteConnection(response.connection);\n}\n\nexport async function revokeRemoteConnection(\n\tconnectionId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<boolean> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst id = trimString(connectionId);\n\tif (!config || !id) {\n\t\treturn false;\n\t}\n\tconst response = await postConnectors<{ revoked?: boolean }>(\n\t\tconfig,\n\t\t\"revokeConnection\",\n\t\tREVOKE_PATH,\n\t\t{ id },\n\t\t() => ({ revoked: false }),\n\t);\n\treturn response.revoked !== false;\n}\n\nexport async function getRemoteConnectionHealth(\n\tconnectionId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteConnectionHealth | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst id = trimString(connectionId);\n\tif (!config || !id) {\n\t\treturn null;\n\t}\n\tconst response = await postConnectors<GetHealthResponse>(\n\t\tconfig,\n\t\t\"getHealth\",\n\t\tGET_HEALTH_PATH,\n\t\t{ connectionId: id },\n\t\t() => ({}),\n\t);\n\treturn normalizeHealth(response.health);\n}\n\nexport async function resolveRemoteSourceOfTruth(\n\tworkspaceId?: string,\n\tarea?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteSourceOfTruthResolution | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;\n\tconst normalizedArea = trimString(area)?.toLowerCase();\n\tconst remoteArea = normalizedArea\n\t\t? SOURCE_OF_TRUTH_AREA_BY_LOCAL[normalizedArea]\n\t\t: undefined;\n\tif (!config || !resolvedWorkspaceId || !normalizedArea || !remoteArea) {\n\t\treturn null;\n\t}\n\tconst response = await postConnectors<ResolveSourceOfTruthResponse>(\n\t\tconfig,\n\t\t\"resolveSourceOfTruth\",\n\t\tRESOLVE_SOURCE_OF_TRUTH_PATH,\n\t\t{\n\t\t\tworkspaceId: resolvedWorkspaceId,\n\t\t\tarea: remoteArea,\n\t\t},\n\t\t() => ({}),\n\t);\n\tconst primaryConnectionId =\n\t\ttrimString(response.policy?.primaryConnectionId) ??\n\t\ttrimString(response.primaryConnection?.id);\n\tconst providerId = trimString(response.primaryConnection?.providerId);\n\tif (!primaryConnectionId || !providerId) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tworkspaceId:\n\t\t\ttrimString(response.policy?.workspaceId) ?? resolvedWorkspaceId,\n\t\tarea: normalizedArea,\n\t\tprimaryConnectionId,\n\t\t...(trimString(response.policy?.fallbackConnectionId)\n\t\t\t? {\n\t\t\t\t\tfallbackConnectionId: trimString(\n\t\t\t\t\t\tresponse.policy?.fallbackConnectionId,\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {}),\n\t\tproviderId,\n\t\t...(trimString(response.primaryConnection?.displayName)\n\t\t\t? { displayName: trimString(response.primaryConnection?.displayName) }\n\t\t\t: {}),\n\t};\n}\n\nexport async function setRemoteSourceOfTruthPolicy(\n\tinput: SetRemoteSourceOfTruthPolicyInput,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteSourceOfTruthPolicy | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;\n\tconst normalizedArea = trimString(input.area)?.toLowerCase();\n\tconst remoteArea = normalizedArea\n\t\t? SOURCE_OF_TRUTH_AREA_BY_LOCAL[normalizedArea]\n\t\t: undefined;\n\tconst primaryConnectionId = trimString(input.primaryConnectionId);\n\tconst fallbackConnectionId = trimString(input.fallbackConnectionId);\n\tif (\n\t\t!config ||\n\t\t!workspaceId ||\n\t\t!normalizedArea ||\n\t\t!remoteArea ||\n\t\t!primaryConnectionId\n\t) {\n\t\treturn null;\n\t}\n\n\tconst response = await postConnectors<SetSourceOfTruthPolicyResponse>(\n\t\tconfig,\n\t\t\"setSourceOfTruthPolicy\",\n\t\tSET_SOURCE_OF_TRUTH_POLICY_PATH,\n\t\t{\n\t\t\tpolicy: {\n\t\t\t\tworkspaceId,\n\t\t\t\tarea: remoteArea,\n\t\t\t\tprimaryConnectionId,\n\t\t\t\t...(fallbackConnectionId ? { fallbackConnectionId } : {}),\n\t\t\t},\n\t\t},\n\t\t() => ({}),\n\t);\n\treturn normalizeSourceOfTruthPolicy(\n\t\tresponse.policy,\n\t\tworkspaceId,\n\t\tnormalizedArea,\n\t);\n}\n\ninterface SetSourceOfTruthPolicyResponse {\n\tpolicy?: SourceOfTruthPolicyPayload;\n}\n\nexport async function getRemoteDegradedReadPolicy(\n\tworkspaceId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<RemoteDegradedReadPolicy | null> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst resolvedWorkspaceId = trimString(workspaceId) ?? config?.workspaceId;\n\tif (!config || !resolvedWorkspaceId) {\n\t\treturn null;\n\t}\n\tconst response = await postConnectors<GetDegradedReadPolicyResponse>(\n\t\tconfig,\n\t\t\"getDegradedReadPolicy\",\n\t\tGET_DEGRADED_READ_POLICY_PATH,\n\t\t{ workspaceId: resolvedWorkspaceId },\n\t\t() => ({}),\n\t);\n\tif (!response.policy) {\n\t\treturn null;\n\t}\n\tconst maxAgeMinutes = normalizePositiveInteger(response.policy.maxAgeMinutes);\n\treturn {\n\t\tmode: trimString(response.policy.mode),\n\t\tintegrations: normalizeStringList(response.policy.allowedIntegrations),\n\t\t...(maxAgeMinutes !== undefined ? { maxAgeMinutes } : {}),\n\t\t...(typeof response.policy.queuePrimaryRefresh === \"boolean\"\n\t\t\t? { queuePrimaryRefresh: response.policy.queuePrimaryRefresh }\n\t\t\t: {}),\n\t};\n}\n\nexport async function getRemoteConnectionCapabilities(\n\tconnectionId?: string,\n\tconfigInput?: ConnectorsServiceConfig | false,\n): Promise<string[]> {\n\tconst config = resolveConnectorsServiceConfig(configInput);\n\tconst id = trimString(connectionId);\n\tif (!config || !id) {\n\t\treturn [];\n\t}\n\tconst response = await postConnectors<GetCapabilitiesResponse>(\n\t\tconfig,\n\t\t\"getCapabilities\",\n\t\tGET_CAPABILITIES_PATH,\n\t\t{ connectionId: id },\n\t\t() => ({ capabilities: [] }),\n\t);\n\treturn normalizeStringList(response.capabilities);\n}\n\nexport function resetConnectorsDownstreamForTests(): void {\n\tdownstreamClients.clear();\n\tlogger.debug(\"Reset connectors downstream client cache\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"render-model.d.ts","sourceRoot":"","sources":["../../src/conversation/render-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACX,UAAU,EACV,gB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AAU,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACb;AA+GD,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,0BAA0B,GACjC,qBAAqB,CAevB;AAED,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,aAAkB,GACzB,0BAA0B,CAyD5B;AAgBD,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,iBAAiB,GACxB,2BAA2B,CAmB7B;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,UAAU,EACnB,OAAO,GAAE,aAAkB,GACzB,iBAAiB,GAAG,IAAI,CAW1B;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,GAAE,aAAkB,GACzB,iBAAiB,EAAE,CASrB;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,iBAAiB,GACxB,OAAO,IAAI,qBAAqB,CAElC;AAED,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,iBAAiB,GACxB,OAAO,IAAI,0BAA0B,CAEvC;AAED,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,iBAAiB,GACxB,OAAO,IAAI,2BAA2B,CAExC;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA8B3E"}
@@ -150,6 +150,56 @@ export function collapseRepeatedLinesWithHistory(text, options = {}) {
150
150
  }
151
151
  return { text: result.join("\n"), changed };
152
152
  }
153
+ function isRecord(value) {
154
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
155
+ }
156
+ function isAssistantContentBlock(value) {
157
+ if (!isRecord(value)) {
158
+ return false;
159
+ }
160
+ switch (value.type) {
161
+ case "text":
162
+ return typeof value.text === "string";
163
+ case "thinking":
164
+ return typeof value.thinking === "string";
165
+ case "toolCall":
166
+ return (typeof value.id === "string" &&
167
+ typeof value.name === "string" &&
168
+ isRecord(value.arguments));
169
+ default:
170
+ return false;
171
+ }
172
+ }
173
+ function normalizeAssistantContent(content) {
174
+ if (typeof content === "string") {
175
+ return content.trim() ? [{ type: "text", text: content }] : [];
176
+ }
177
+ if (!Array.isArray(content)) {
178
+ return [];
179
+ }
180
+ return content.filter(isAssistantContentBlock);
181
+ }
182
+ function isToolResultContentBlock(value) {
183
+ if (!isRecord(value)) {
184
+ return false;
185
+ }
186
+ if (value.type === "text") {
187
+ return typeof value.text === "string";
188
+ }
189
+ if (value.type === "image") {
190
+ return typeof value.data === "string" && typeof value.mimeType === "string";
191
+ }
192
+ return false;
193
+ }
194
+ function normalizeToolResultContent(content) {
195
+ if (typeof content === "string") {
196
+ return content.trim() ? [{ type: "text", text: content }] : [];
197
+ }
198
+ if (!Array.isArray(content)) {
199
+ return [];
200
+ }
201
+ return content.filter(isToolResultContentBlock);
202
+ }
153
203
  function collapseProgressiveBlocks(blocks) {
154
204
  if (blocks.length <= 1)
155
205
  return { blocks, collapsed: false };
@@ -221,7 +271,7 @@ export function toRenderableAssistantMessage(message, options = {}) {
221
271
  sharedHistory: recentLines,
222
272
  });
223
273
  };
224
- for (const content of message.content) {
274
+ for (const content of normalizeAssistantContent(message.content)) {
225
275
  if (content.type === "text" && content.text.trim()) {
226
276
  const { text, changed } = cleanText(content.text.trim());
227
277
  textBlocks.push(text);
@@ -265,7 +315,7 @@ function maybeCleanText(text, mode) {
265
315
  }
266
316
  export function toRenderableToolResultMessage(message) {
267
317
  const textContent = extractTextFromToolResult(message);
268
- const images = message.content
318
+ const images = normalizeToolResultContent(message.content)
269
319
  .filter((content) => content.type === "image")
270
320
  .map((content) => ({
271
321
  mimeType: content.mimeType,
@@ -350,7 +400,7 @@ function extractTextFromUserContent(message) {
350
400
  return "";
351
401
  }
352
402
  function extractTextFromToolResult(message) {
353
- return message.content
403
+ return normalizeToolResultContent(message.content)
354
404
  .filter((content) => content.type === "text")
355
405
  .map((content) => content.text)
356
406
  .join("\n")