@opengeni/api-router 0.30.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/dist/access-grant-rls.d.ts +3 -0
  2. package/dist/admission-trace.d.ts +8 -0
  3. package/dist/api-websocket.d.ts +18 -0
  4. package/dist/app.d.ts +50 -2
  5. package/dist/app.js +12 -1
  6. package/dist/artifact-catalog-cursor.d.ts +27 -0
  7. package/dist/auth/managed-auth-attempt-context.d.ts +10 -0
  8. package/dist/auth/managed-auth-rate-limits.d.ts +167 -0
  9. package/dist/auth/managed-auth-session-adapter.d.ts +6 -0
  10. package/dist/auth/managed-auth.d.ts +102 -3
  11. package/dist/auth/managed-email.d.ts +29 -0
  12. package/dist/auth/managed-sign-in-notifications.d.ts +4 -0
  13. package/dist/auth/new-signups-gate.d.ts +23 -0
  14. package/dist/auth/organization-user-setup.d.ts +80 -0
  15. package/dist/auth/signup-funnel-metrics.d.ts +44 -0
  16. package/dist/browser-controller-authority.d.ts +1 -61
  17. package/dist/browser-ephemeral.d.ts +5 -0
  18. package/dist/browser-state-authority.d.ts +1 -27
  19. package/dist/chunk-6TZ5LG3O.js +123948 -0
  20. package/dist/chunk-6TZ5LG3O.js.map +1 -0
  21. package/dist/chunk-OGQDXVXY.js +18 -0
  22. package/dist/chunk-OGQDXVXY.js.map +1 -0
  23. package/dist/claude-subscription-account-conflicts.d.ts +1 -0
  24. package/dist/claude-subscription-account-usage.d.ts +39 -0
  25. package/dist/claude-subscription-oauth.d.ts +25 -0
  26. package/dist/claude-subscription-profile.d.ts +9 -0
  27. package/dist/claude-subscription-usage.d.ts +44 -0
  28. package/dist/claude-workspace-connection.d.ts +15 -0
  29. package/dist/codemode.d.ts +32 -1
  30. package/dist/company-brain-okf.d.ts +24 -0
  31. package/dist/connected-machine-computer-access.d.ts +11 -0
  32. package/dist/connection-ownership.d.ts +54 -0
  33. package/dist/controller-data-plane.d.ts +32 -0
  34. package/dist/editable-artifact-source-session.d.ts +3 -0
  35. package/dist/editable-artifact-websocket.d.ts +10 -18
  36. package/dist/editable-artifact-workspace-files.d.ts +1 -1
  37. package/dist/fatal-process-boundary.d.ts +25 -0
  38. package/dist/github-access.d.ts +31 -2
  39. package/dist/http/acting-person.d.ts +24 -0
  40. package/dist/http/api-contract-compat.d.ts +19 -0
  41. package/dist/http/api-error.d.ts +27 -1
  42. package/dist/http/cors.d.ts +17 -0
  43. package/dist/http/deprecation.d.ts +42 -0
  44. package/dist/http/interaction-control-error.d.ts +13 -0
  45. package/dist/http/keyed-admission.d.ts +12 -0
  46. package/dist/http/local-browser-boundary.d.ts +72 -0
  47. package/dist/http/metrics-listener.d.ts +22 -0
  48. package/dist/http/path-identifier.d.ts +17 -0
  49. package/dist/http/registered-route-label.d.ts +16 -0
  50. package/dist/http/request-body.d.ts +27 -0
  51. package/dist/http/request-source.d.ts +52 -0
  52. package/dist/http/sse.d.ts +17 -6
  53. package/dist/http/unmatched-route.d.ts +18 -0
  54. package/dist/http/user-content.d.ts +36 -0
  55. package/dist/http/websocket-upgrade-dispatch.d.ts +18 -0
  56. package/dist/index.d.ts +10 -3
  57. package/dist/index.js +1091 -162
  58. package/dist/index.js.map +1 -1
  59. package/dist/integration-endpoint-test.d.ts +20 -0
  60. package/dist/integrations/api-integrations.d.ts +2 -2
  61. package/dist/integrations/atlassian.d.ts +29 -3
  62. package/dist/integrations/connect-authority.d.ts +1 -0
  63. package/dist/integrations/connect-callback-return.d.ts +6 -0
  64. package/dist/integrations/fiken.d.ts +16 -2
  65. package/dist/integrations/github-app-connect.d.ts +47 -0
  66. package/dist/integrations/github-installation-proof.d.ts +3 -0
  67. package/dist/integrations/github-lens-connect.d.ts +116 -0
  68. package/dist/integrations/github-skill-source.d.ts +1 -5
  69. package/dist/integrations/google-drive.d.ts +24 -0
  70. package/dist/integrations/integration-commit-authority.d.ts +13 -0
  71. package/dist/integrations/marketplace-plugin.d.ts +2691 -0
  72. package/dist/integrations/oauth-client.d.ts +178 -18
  73. package/dist/integrations/oauth-profiles.d.ts +222 -0
  74. package/dist/integrations/oauth-return-path.d.ts +1 -0
  75. package/dist/integrations/personal-github-repositories.d.ts +84 -0
  76. package/dist/integrations/personal-github.d.ts +42 -0
  77. package/dist/integrations/pr-review-provider.d.ts +22 -0
  78. package/dist/integrations/provider-oauth.d.ts +19 -1
  79. package/dist/integrations/slack-app-home.d.ts +24 -0
  80. package/dist/integrations/slack-bot.d.ts +367 -12
  81. package/dist/integrations/slack-file-upload-flow.d.ts +62 -0
  82. package/dist/integrations/slack-install.d.ts +20 -0
  83. package/dist/integrations/slack-interactions.d.ts +107 -9
  84. package/dist/integrations/slack-mrkdwn.d.ts +41 -0
  85. package/dist/integrations/slack-routing.d.ts +120 -0
  86. package/dist/integrations/slack-session-defaults.d.ts +58 -0
  87. package/dist/integrations/slack-task-file-upload.d.ts +36 -0
  88. package/dist/integrations/social-oauth.d.ts +7 -0
  89. package/dist/interaction-agent-access.d.ts +15 -0
  90. package/dist/interaction-frame-proxy.d.ts +68 -0
  91. package/dist/interaction-metrics.d.ts +2 -0
  92. package/dist/mcp/action-catalog-types.d.ts +9 -0
  93. package/dist/mcp/action-catalog.gen.d.ts +2 -0
  94. package/dist/mcp/capability-account-readiness.d.ts +7 -0
  95. package/dist/mcp/child-read-evidence.d.ts +9 -0
  96. package/dist/mcp/command-read.d.ts +24 -0
  97. package/dist/mcp/company-profile-agent-admin.d.ts +44 -0
  98. package/dist/mcp/contract-input.d.ts +11 -0
  99. package/dist/mcp/documents.d.ts +7 -5
  100. package/dist/mcp/files.d.ts +2 -2
  101. package/dist/mcp/first-party-tool-permissions.d.ts +650 -0
  102. package/dist/mcp/knowledge-entries.d.ts +5 -0
  103. package/dist/mcp/orchestration-failure-diagnostic.d.ts +43 -0
  104. package/dist/mcp/receipts.d.ts +9 -0
  105. package/dist/mcp/request-abort.d.ts +19 -0
  106. package/dist/mcp/scheduled-task-input.d.ts +1189 -0
  107. package/dist/mcp/scheduled-task-view.d.ts +22 -4
  108. package/dist/mcp/server.d.ts +255 -3
  109. package/dist/mcp/session-event-view.d.ts +94 -0
  110. package/dist/mcp/session-view.d.ts +66 -2
  111. package/dist/mcp/session-wait.d.ts +174 -0
  112. package/dist/mcp-oauth.d.ts +52 -0
  113. package/dist/model-catalog.d.ts +11 -31
  114. package/dist/observability.d.ts +3 -1
  115. package/dist/organization-mcp.d.ts +52 -0
  116. package/dist/organization-recovery-notifications.d.ts +41 -0
  117. package/dist/routes/analytics-consent.d.ts +26 -0
  118. package/dist/routes/api-integrations.d.ts +25 -0
  119. package/dist/routes/api-keys.d.ts +17 -0
  120. package/dist/routes/artifact-catalog.d.ts +6 -0
  121. package/dist/routes/automations.d.ts +19 -0
  122. package/dist/routes/billing.d.ts +49 -0
  123. package/dist/routes/browser-sessions.d.ts +59 -2
  124. package/dist/routes/claude-subscription-accounts.d.ts +3 -0
  125. package/dist/routes/claude-subscription-oauth.d.ts +3 -0
  126. package/dist/routes/client-errors.d.ts +146 -0
  127. package/dist/routes/codex.d.ts +76 -2
  128. package/dist/routes/company-brain.d.ts +3 -0
  129. package/dist/routes/company-profile.d.ts +2 -1
  130. package/dist/routes/computer-sessions.d.ts +14 -0
  131. package/dist/routes/connect.d.ts +5 -0
  132. package/dist/routes/editable-artifacts.d.ts +2 -0
  133. package/dist/routes/external-identity-links.d.ts +6 -0
  134. package/dist/routes/feedback.d.ts +3 -0
  135. package/dist/routes/github-browser-pages.d.ts +12 -0
  136. package/dist/routes/github.d.ts +2 -0
  137. package/dist/routes/insights-response-cache.d.ts +10 -0
  138. package/dist/routes/insights-usage.d.ts +12 -0
  139. package/dist/routes/insights.d.ts +30 -1
  140. package/dist/routes/knowledge.d.ts +3 -0
  141. package/dist/routes/managed-auth-session-sets.d.ts +26 -0
  142. package/dist/routes/managed-onboarding.d.ts +29 -0
  143. package/dist/routes/managed-sign-in-methods.d.ts +6 -0
  144. package/dist/routes/model-connection-access.d.ts +3 -0
  145. package/dist/routes/organization-integration-policy.d.ts +3 -0
  146. package/dist/routes/organization-integrations.d.ts +6 -0
  147. package/dist/routes/organization-mcp-connections.d.ts +3 -0
  148. package/dist/routes/organization-model-providers.d.ts +3 -0
  149. package/dist/routes/organization-recovery.d.ts +19 -0
  150. package/dist/routes/organization-service-accounts.d.ts +3 -0
  151. package/dist/routes/organization-sessions.d.ts +26 -0
  152. package/dist/routes/personal-github-git-broker.d.ts +29 -0
  153. package/dist/routes/personal-github.d.ts +3 -0
  154. package/dist/routes/pr-review-github.d.ts +3 -0
  155. package/dist/routes/pr-review.d.ts +3 -0
  156. package/dist/routes/session-artifact-associations.d.ts +4 -0
  157. package/dist/routes/session-history-imports.d.ts +9 -0
  158. package/dist/routes/sessions.d.ts +44 -6
  159. package/dist/routes/skill-content.d.ts +4 -0
  160. package/dist/routes/skill-install-authority.d.ts +6 -0
  161. package/dist/routes/subscription-account-pools.d.ts +34 -0
  162. package/dist/routes/subscription-pool-access.d.ts +16 -0
  163. package/dist/routes/supergrok.d.ts +6 -1
  164. package/dist/routes/usage-allowances.d.ts +12 -0
  165. package/dist/routes/user-resource-authorities.d.ts +3 -0
  166. package/dist/routes/workspace-artifacts.d.ts +2 -1
  167. package/dist/routes/workspace-capture.d.ts +10 -2
  168. package/dist/routes/workspace-integrations.d.ts +35 -0
  169. package/dist/routes/workspace-learning.d.ts +3 -0
  170. package/dist/routes/workspace-model-providers.d.ts +4 -0
  171. package/dist/routes/workspaces.d.ts +29 -0
  172. package/dist/sandbox/auth-callout.d.ts +8 -0
  173. package/dist/sandbox/channel-a.d.ts +19 -1
  174. package/dist/sandbox/connection-authority.d.ts +3 -0
  175. package/dist/sandbox/enrollment.d.ts +9 -1
  176. package/dist/sandbox/machines.d.ts +5 -2
  177. package/dist/sandbox/metrics-ingestion.d.ts +28 -20
  178. package/dist/sandbox/rematerialize.d.ts +2 -0
  179. package/dist/sandbox/session-attach-variable-sets.d.ts +30 -0
  180. package/dist/sandbox/viewer.d.ts +26 -1
  181. package/dist/sandbox-file-artifacts.d.ts +50 -0
  182. package/dist/scheduled-task-deletion.d.ts +13 -0
  183. package/dist/session-create-observability.d.ts +5 -0
  184. package/dist/session-event-view-MPS2OZD3.js +292 -0
  185. package/dist/session-event-view-MPS2OZD3.js.map +1 -0
  186. package/dist/site-session-origin.d.ts +13 -0
  187. package/dist/site-uploads.d.ts +41 -0
  188. package/dist/slack-reaction-files.d.ts +1 -1
  189. package/dist/temporal-schedule-cleanup.d.ts +1 -0
  190. package/dist/temporal-schedule-sync.d.ts +26 -0
  191. package/dist/transcription/providers/xai-subscription.d.ts +1 -0
  192. package/dist/transcription/service.d.ts +2 -1
  193. package/dist/work-discovery-observability.d.ts +33 -0
  194. package/dist/workspace-artifact-content.d.ts +28 -0
  195. package/dist/workspace-artifact-provenance.d.ts +7 -0
  196. package/dist/workspace-delete-observability.d.ts +10 -0
  197. package/dist/workspace-deletion.d.ts +6 -0
  198. package/dist/workspace-state-projection.d.ts +3 -5
  199. package/dist/workspace-tool-gateway-observability.d.ts +17 -0
  200. package/dist/workspace-tool-gateway.d.ts +123 -0
  201. package/dist/workspace-webhook-dispatch.d.ts +26 -0
  202. package/package.json +23 -19
  203. package/src/access-grant-rls.ts +75 -0
  204. package/src/admission-trace.ts +14 -0
  205. package/src/api-websocket.ts +23 -0
  206. package/src/app.ts +1967 -252
  207. package/src/artifact-catalog-cursor.ts +60 -0
  208. package/src/auth/managed-auth-attempt-context.ts +70 -0
  209. package/src/auth/managed-auth-rate-limits.ts +252 -0
  210. package/src/auth/managed-auth-session-adapter.ts +222 -0
  211. package/src/auth/managed-auth.ts +536 -60
  212. package/src/auth/managed-email.ts +174 -0
  213. package/src/auth/managed-sign-in-notifications.ts +81 -0
  214. package/src/auth/new-signups-gate.ts +49 -0
  215. package/src/auth/organization-user-setup.ts +307 -0
  216. package/src/auth/signup-funnel-metrics.ts +164 -0
  217. package/src/browser-controller-authority.ts +1 -186
  218. package/src/browser-ephemeral.ts +39 -0
  219. package/src/browser-state-authority.ts +1 -236
  220. package/src/claude-subscription-account-conflicts.ts +12 -0
  221. package/src/claude-subscription-account-usage.ts +48 -0
  222. package/src/claude-subscription-oauth.ts +362 -0
  223. package/src/claude-subscription-profile.ts +73 -0
  224. package/src/claude-subscription-usage.ts +97 -0
  225. package/src/claude-workspace-connection.ts +82 -0
  226. package/src/codemode.ts +194 -30
  227. package/src/codex-realtime.ts +8 -2
  228. package/src/company-brain-okf.ts +340 -0
  229. package/src/connected-machine-computer-access.ts +33 -0
  230. package/src/connection-ownership.ts +199 -0
  231. package/src/controller-data-plane.ts +81 -0
  232. package/src/editable-artifact-native-kernel.ts +26 -15
  233. package/src/editable-artifact-office-import.ts +28 -3
  234. package/src/editable-artifact-production.ts +23 -7
  235. package/src/editable-artifact-source-session.ts +123 -0
  236. package/src/editable-artifact-websocket.ts +27 -21
  237. package/src/editable-artifact-workspace-files.ts +31 -6
  238. package/src/fatal-process-boundary.ts +246 -0
  239. package/src/gateway-realtime.ts +1 -1
  240. package/src/github-access.ts +147 -5
  241. package/src/http/acting-person.ts +71 -0
  242. package/src/http/api-contract-compat.ts +49 -0
  243. package/src/http/api-error.ts +115 -1
  244. package/src/http/auth.ts +48 -0
  245. package/src/http/cors.ts +67 -0
  246. package/src/http/deprecation.ts +118 -0
  247. package/src/http/interaction-control-error.ts +164 -0
  248. package/src/http/keyed-admission.ts +29 -0
  249. package/src/http/local-browser-boundary.ts +343 -0
  250. package/src/http/metrics-listener.ts +57 -0
  251. package/src/http/path-identifier.ts +54 -0
  252. package/src/http/registered-route-label.ts +34 -0
  253. package/src/http/request-body.ts +127 -0
  254. package/src/http/request-source.ts +178 -0
  255. package/src/http/sse.ts +486 -132
  256. package/src/http/unmatched-route.ts +60 -0
  257. package/src/http/user-content.ts +158 -0
  258. package/src/http/websocket-upgrade-dispatch.ts +29 -0
  259. package/src/index.ts +157 -52
  260. package/src/integration-endpoint-test.ts +291 -0
  261. package/src/integrations/api-integrations.ts +98 -11
  262. package/src/integrations/atlassian.ts +474 -136
  263. package/src/integrations/connect-authority.ts +2 -0
  264. package/src/integrations/connect-callback-return.ts +86 -0
  265. package/src/integrations/fiken.ts +354 -64
  266. package/src/integrations/github-app-connect.ts +435 -0
  267. package/src/integrations/github-installation-proof.ts +60 -0
  268. package/src/integrations/github-lens-connect.ts +76 -0
  269. package/src/integrations/github-skill-source.ts +2 -142
  270. package/src/integrations/google-drive.ts +717 -225
  271. package/src/integrations/integration-commit-authority.ts +69 -0
  272. package/src/integrations/marketplace-plugin.ts +48 -0
  273. package/src/integrations/oauth-client.ts +1356 -459
  274. package/src/integrations/oauth-profiles.ts +537 -0
  275. package/src/integrations/oauth-return-path.ts +18 -0
  276. package/src/integrations/personal-github-repositories.ts +674 -0
  277. package/src/integrations/personal-github.ts +825 -0
  278. package/src/integrations/pr-review-provider.ts +246 -0
  279. package/src/integrations/provider-oauth.ts +250 -22
  280. package/src/integrations/slack-app-home.ts +300 -0
  281. package/src/integrations/slack-bot.ts +963 -239
  282. package/src/integrations/slack-file-upload-flow.ts +147 -0
  283. package/src/integrations/slack-install.ts +83 -0
  284. package/src/integrations/slack-interactions.ts +3167 -474
  285. package/src/integrations/slack-mrkdwn.ts +193 -0
  286. package/src/integrations/slack-routing.ts +337 -0
  287. package/src/integrations/slack-session-defaults.ts +224 -0
  288. package/src/integrations/slack-task-file-upload.ts +323 -0
  289. package/src/integrations/social-oauth.ts +213 -15
  290. package/src/interaction-agent-access.ts +48 -0
  291. package/src/interaction-frame-proxy.ts +409 -0
  292. package/src/interaction-metrics.ts +30 -0
  293. package/src/mcp/action-catalog-types.ts +9 -0
  294. package/src/mcp/action-catalog.gen.ts +6696 -0
  295. package/src/mcp/capability-account-readiness.ts +17 -0
  296. package/src/mcp/child-read-evidence.ts +19 -0
  297. package/src/mcp/command-read.ts +109 -0
  298. package/src/mcp/company-profile-agent-admin.ts +198 -0
  299. package/src/mcp/contract-input.ts +141 -0
  300. package/src/mcp/documents.ts +65 -377
  301. package/src/mcp/editable-artifacts.ts +12 -6
  302. package/src/mcp/files.ts +80 -43
  303. package/src/mcp/first-party-tool-permissions.ts +305 -0
  304. package/src/mcp/knowledge-entries.ts +322 -0
  305. package/src/mcp/orchestration-failure-diagnostic.ts +43 -0
  306. package/src/mcp/receipts.ts +34 -0
  307. package/src/mcp/request-abort.ts +44 -0
  308. package/src/mcp/scheduled-task-input.ts +76 -0
  309. package/src/mcp/scheduled-task-view.ts +44 -3
  310. package/src/mcp/server.ts +3030 -1267
  311. package/src/mcp/session-event-view.ts +383 -0
  312. package/src/mcp/session-view.ts +84 -3
  313. package/src/mcp/session-wait.ts +665 -0
  314. package/src/mcp-oauth.ts +1123 -0
  315. package/src/model-catalog.ts +91 -333
  316. package/src/observability.ts +15 -1
  317. package/src/organization-mcp.ts +397 -0
  318. package/src/organization-recovery-notifications.ts +103 -0
  319. package/src/routes/analytics-consent.ts +123 -0
  320. package/src/routes/api-integrations.ts +364 -74
  321. package/src/routes/api-keys.ts +336 -10
  322. package/src/routes/artifact-catalog.ts +279 -0
  323. package/src/routes/automations.ts +768 -0
  324. package/src/routes/billing.ts +461 -46
  325. package/src/routes/browser-sessions.ts +780 -112
  326. package/src/routes/canonical-human-identities.ts +90 -14
  327. package/src/routes/capabilities.ts +107 -6
  328. package/src/routes/channels.ts +20 -3
  329. package/src/routes/claude-subscription-accounts.ts +334 -0
  330. package/src/routes/claude-subscription-oauth.ts +142 -0
  331. package/src/routes/client-errors.ts +362 -0
  332. package/src/routes/codex.ts +833 -116
  333. package/src/routes/company-brain.ts +322 -0
  334. package/src/routes/company-profile.ts +65 -1
  335. package/src/routes/computer-sessions.ts +557 -106
  336. package/src/routes/connect.ts +1938 -0
  337. package/src/routes/connections.ts +1039 -349
  338. package/src/routes/documents.ts +488 -287
  339. package/src/routes/editable-artifacts.ts +79 -9
  340. package/src/routes/enrollments.ts +135 -39
  341. package/src/routes/environments.ts +154 -58
  342. package/src/routes/external-identity-links.ts +201 -0
  343. package/src/routes/feedback.ts +113 -0
  344. package/src/routes/files.ts +267 -33
  345. package/src/routes/github-browser-pages.ts +162 -0
  346. package/src/routes/github.ts +446 -144
  347. package/src/routes/insights-response-cache.ts +83 -0
  348. package/src/routes/insights-usage.ts +345 -0
  349. package/src/routes/insights.ts +153 -19
  350. package/src/routes/install.ts +133 -38
  351. package/src/routes/integration-facets.ts +107 -33
  352. package/src/routes/interaction-resources.ts +30 -3
  353. package/src/routes/knowledge.ts +488 -0
  354. package/src/routes/machines.ts +313 -15
  355. package/src/routes/managed-auth-session-sets.ts +1218 -0
  356. package/src/routes/managed-onboarding.ts +337 -0
  357. package/src/routes/managed-sign-in-methods.ts +433 -0
  358. package/src/routes/memory-slack-publications.ts +3 -2
  359. package/src/routes/model-connection-access.ts +208 -0
  360. package/src/routes/organization-integration-policy.ts +116 -0
  361. package/src/routes/organization-integrations.ts +326 -0
  362. package/src/routes/organization-mcp-connections.ts +178 -0
  363. package/src/routes/organization-memberships.ts +1019 -27
  364. package/src/routes/organization-model-providers.ts +293 -0
  365. package/src/routes/organization-recovery.ts +325 -0
  366. package/src/routes/organization-service-accounts.ts +128 -0
  367. package/src/routes/organization-sessions.ts +350 -0
  368. package/src/routes/personal-github-git-broker.ts +785 -0
  369. package/src/routes/personal-github.ts +370 -0
  370. package/src/routes/plugins.ts +251 -22
  371. package/src/routes/pr-review-github.ts +881 -0
  372. package/src/routes/pr-review.ts +622 -0
  373. package/src/routes/preference-registry.ts +12 -93
  374. package/src/routes/rigs.ts +167 -50
  375. package/src/routes/scheduled-tasks.ts +346 -41
  376. package/src/routes/session-artifact-associations.ts +87 -0
  377. package/src/routes/session-history-imports.ts +280 -0
  378. package/src/routes/sessions.ts +2306 -264
  379. package/src/routes/skill-content.ts +297 -0
  380. package/src/routes/skill-install-authority.ts +64 -0
  381. package/src/routes/skills.ts +62 -9
  382. package/src/routes/social.ts +46 -18
  383. package/src/routes/subscription-account-pools.ts +436 -0
  384. package/src/routes/subscription-pool-access.ts +126 -0
  385. package/src/routes/supergrok.ts +219 -303
  386. package/src/routes/transcription-recordings.ts +38 -3
  387. package/src/routes/transcriptions.ts +4 -0
  388. package/src/routes/usage-allowances.ts +378 -0
  389. package/src/routes/user-resource-authorities.ts +138 -0
  390. package/src/routes/video-generation.ts +14 -10
  391. package/src/routes/workspace-artifacts.ts +275 -69
  392. package/src/routes/workspace-capture.ts +21 -0
  393. package/src/routes/workspace-integrations.ts +576 -0
  394. package/src/routes/workspace-learning.ts +159 -0
  395. package/src/routes/workspace-model-providers.ts +148 -0
  396. package/src/routes/workspace-state.ts +38 -25
  397. package/src/routes/workspaces.ts +1004 -127
  398. package/src/sandbox/auth-callout.ts +96 -19
  399. package/src/sandbox/channel-a.ts +323 -24
  400. package/src/sandbox/connection-authority.ts +3 -0
  401. package/src/sandbox/enrollment.ts +81 -6
  402. package/src/sandbox/machines.ts +218 -76
  403. package/src/sandbox/metrics-ingestion.ts +411 -62
  404. package/src/sandbox/rematerialize.ts +121 -19
  405. package/src/sandbox/session-attach-variable-sets.ts +131 -0
  406. package/src/sandbox/viewer.ts +280 -25
  407. package/src/sandbox-file-artifacts.ts +413 -0
  408. package/src/scheduled-task-deletion.ts +138 -0
  409. package/src/session-create-observability.ts +46 -0
  410. package/src/session-realtime-context.ts +6 -3
  411. package/src/site-session-origin.ts +48 -0
  412. package/src/site-uploads.ts +224 -0
  413. package/src/slack-reaction-files.ts +16 -5
  414. package/src/temporal-schedule-cleanup.ts +13 -0
  415. package/src/temporal-schedule-sync.ts +74 -0
  416. package/src/transcription/providers/codex-subscription.ts +2 -0
  417. package/src/transcription/providers/openai.ts +1 -0
  418. package/src/transcription/providers/xai-subscription.ts +49 -3
  419. package/src/transcription/segmenter.ts +8 -2
  420. package/src/transcription/service.ts +43 -6
  421. package/src/work-discovery-observability.ts +121 -0
  422. package/src/workspace-artifact-content.ts +144 -0
  423. package/src/workspace-artifact-provenance.ts +104 -0
  424. package/src/workspace-delete-observability.ts +75 -0
  425. package/src/workspace-deletion.ts +73 -0
  426. package/src/workspace-state-projection.ts +18 -148
  427. package/src/workspace-tool-gateway-observability.ts +100 -0
  428. package/src/workspace-tool-gateway.ts +870 -0
  429. package/src/workspace-webhook-dispatch.ts +190 -0
  430. package/src/xai-subscription-auth.ts +9 -2
  431. package/dist/chunk-WCXHI3FF.js +0 -49920
  432. package/dist/chunk-WCXHI3FF.js.map +0 -1
  433. package/dist/routes/packs.d.ts +0 -3
  434. package/src/routes/packs.ts +0 -729
@@ -0,0 +1,174 @@
1
+ /**
2
+ * `session_wait`: one blocking first-party MCP call that replaces the
3
+ * `sleep 55` plus three or four `session_events`/`session_get` probes an agent
4
+ * otherwise runs per loop while it waits for a child or peer session.
5
+ *
6
+ * The durable `session_events` table is the only authority. The NATS event bus
7
+ * is live fanout only, so every wake (bus, deadline, or the initial call) is
8
+ * followed by a database read and the returned rows are always the exact
9
+ * durable events, never the bus payload. Subscriptions are opened before the
10
+ * first read so an event committed between the read and the subscription
11
+ * cannot be missed.
12
+ *
13
+ * Timing facts: the built-in `opengeni` MCP server entry carries no
14
+ * `timeoutMs`, so the worker's MCP client uses the SDK default request timeout
15
+ * of 60 s and a longer call would surface as a `-32001` tool error. The wait is
16
+ * therefore capped at {@link SESSION_WAIT_MAX_SECONDS} both in the tool schema
17
+ * and inside {@link waitForSessionChanges}. The API's `Bun.serve`
18
+ * `idleTimeout` is 255 s, far above that cap.
19
+ *
20
+ * Cancellation: the API serves one transport per POST, so the worker's MCP
21
+ * `notifications/cancelled` never reaches this handler; instead the route binds
22
+ * the HTTP request's own abort to `transport.close()` (`request-abort.ts`),
23
+ * which aborts `extra.signal`. A worker that drops the call on Steer/Pause
24
+ * therefore ends the server-side wait promptly; the deadline bounds it anyway.
25
+ *
26
+ * The live bus is best-effort: a failed subscription degrades the wait to the
27
+ * durable pre-check plus the deadline re-check and is reported as
28
+ * `liveFanout: false` rather than failing the tool.
29
+ */
30
+ import type { SessionEvent, SessionEventSemanticClass, SessionEventType } from "@opengeni/contracts";
31
+ export declare const SESSION_WAIT_MAX_TARGETS = 16;
32
+ export declare const SESSION_WAIT_MAX_SECONDS = 50;
33
+ export declare const SESSION_WAIT_DEFAULT_SECONDS = 45;
34
+ /** Newest-first durable rows read per target on every database check. */
35
+ export declare const SESSION_WAIT_EVENTS_PER_TARGET = 20;
36
+ /**
37
+ * The durable event types that matter to a waiter: turn lifecycle, completed
38
+ * agent messages, blocking failures, goal facts, and session status/control
39
+ * changes. Raw deltas, tool receipts, sandbox/machine diagnostics, and PTY
40
+ * noise never wake a waiter; `session_events` remains the drill-down for them.
41
+ * The change mode further drops per-message completions: see
42
+ * {@link sessionWaitChangeEventMatches}.
43
+ */
44
+ export declare const SESSION_WAIT_EVENT_TYPES: readonly ["turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.superseded", "turn.capacity_waiting", "agent.message.completed", "session.status.changed", "session.requiresAction", "session.humanInput.requested", "session.control.paused", "session.control.resumed", "session.wait.started", "session.wait.finished", "tool.auth_needed", "session.command.finished", "credential.auth_needed", "rig.setup.failed", "goal.set", "goal.updated", "goal.progress", "goal.rewrite.proposed", "goal.rewrite.rejected", "goal.completed", "goal.paused", "goal.resumed", "goal.cleared", "goal.continuation"];
45
+ /**
46
+ * Settlement and blocking events that make a child result usable.
47
+ * Goal facts are deliberately absent: an agent can complete its durable goal
48
+ * before it emits the final assistant message and settles the turn. Completed
49
+ * agent messages are also absent because commentary messages use the same
50
+ * event type; an ordinary result-bearing `turn.completed` carries the
51
+ * authoritative final output.
52
+ */
53
+ export declare const SESSION_WAIT_COMPLETION_EVENT_TYPES: readonly ["turn.completed", "turn.failed", "turn.cancelled", "turn.superseded", "turn.capacity_waiting", "session.requiresAction", "session.humanInput.requested", "session.control.paused", "tool.auth_needed", "credential.auth_needed", "rig.setup.failed", "goal.paused"];
54
+ /**
55
+ * A completed turn is result-bearing only when it carries the ordinary final
56
+ * output. Segment-limit and maintenance turns settle one execution segment
57
+ * while the session still has work to do, so they must not release a parent.
58
+ */
59
+ export declare function sessionWaitCompletionEventMatches(event: SessionEvent): boolean;
60
+ /**
61
+ * `waitFor=change` wakes on settled changes. A per-message assistant completion
62
+ * (commentary, or a final message the turn is about to settle) is not one: the
63
+ * `turn.completed` that follows carries the answer. Waking on every progress
64
+ * note would only buy the waiter another poll. The phase-less, id-less
65
+ * completion older workers publish with `turn.completed` still matches.
66
+ * Readers pair this with `excludeStreamedAssistantMessages` in SQL.
67
+ */
68
+ export declare function sessionWaitChangeEventMatches(event: SessionEvent): boolean;
69
+ /** The self-session event that announces a newly pending machine input. */
70
+ export declare const SESSION_WAIT_OWN_PENDING_EVENT_TYPE = "system.update.pending";
71
+ /**
72
+ * Whether a pending own machine input of this kind ends the wait. Every
73
+ * pre-existing kind and `child_requires_action` are `immediate`; deferred
74
+ * child notices are reported but do not end the wait by themselves.
75
+ */
76
+ export declare function ownPendingKindWakes(kind: string): boolean;
77
+ /**
78
+ * Re-derive the caller's own pending-input facts after the returned content
79
+ * consumed some of that input, keeping the same byte bound.
80
+ */
81
+ export declare function withOwnPendingUpdateKinds(result: SessionWaitResult, kinds: readonly string[]): SessionWaitResult;
82
+ export declare function sessionWaitSemanticClass(type: SessionEventType): SessionEventSemanticClass;
83
+ export type SessionWaitTarget = {
84
+ sessionId: string;
85
+ afterSequence: number;
86
+ };
87
+ export type SessionWaitEventSummary = {
88
+ /** True only when every semantic result field survived all projections. */
89
+ contentComplete?: boolean;
90
+ id: string;
91
+ sequence: number;
92
+ type: SessionEventType;
93
+ occurredAt: string;
94
+ turnId: string | null;
95
+ turnGeneration: number | null;
96
+ status: string;
97
+ text: string | null;
98
+ failure: {
99
+ error: string | null;
100
+ code: string | null;
101
+ retryable: boolean | null;
102
+ recovery: string | null;
103
+ } | null;
104
+ result?: unknown;
105
+ };
106
+ export type SessionWaitTargetResult = {
107
+ sessionId: string;
108
+ afterSequence: number;
109
+ /** Cursor for the next `session_wait`/`session_events after=` call. */
110
+ latestSequence: number;
111
+ hasMore: boolean;
112
+ events: SessionWaitEventSummary[];
113
+ };
114
+ export type SessionWaitResult = {
115
+ changed: SessionWaitTargetResult[];
116
+ ownPendingUpdates: number;
117
+ ownPendingUpdateKinds: string[];
118
+ /**
119
+ * Pending own inputs whose kind wakes the session by itself (every
120
+ * pre-existing kind plus `child_requires_action`). Only these end the wait;
121
+ * `deferred` child notices (resolution, pause, capacity wait, progress) are
122
+ * reported but keep the wait on the targets.
123
+ */
124
+ ownPendingImmediateUpdates: number;
125
+ ownPendingDeferredUpdateKinds: string[];
126
+ waitedMs: number;
127
+ timedOut: boolean;
128
+ aborted: boolean;
129
+ /** False when at least one live-fanout subscription failed; the wait then relied on the deadline re-check. */
130
+ liveFanout: boolean;
131
+ truncated: boolean;
132
+ bytes: number;
133
+ maxBytes: number;
134
+ };
135
+ export type SessionWaitTargetRead = {
136
+ events: readonly SessionEvent[];
137
+ hasMore: boolean;
138
+ };
139
+ export type SessionWaitSource = {
140
+ /** Durable forward read of matching events strictly after the target cursor. */
141
+ readTargetEvents: (target: SessionWaitTarget) => Promise<SessionWaitTargetRead>;
142
+ /** Kinds of the caller's own pending machine inputs; null disables self tracking. */
143
+ readOwnPendingUpdateKinds: (() => Promise<readonly string[]>) | null;
144
+ /** Live fanout subscription for one session; the returned function unsubscribes. */
145
+ subscribe: (sessionId: string, onEvents: (events: SessionEvent[]) => void | Promise<void>) => Promise<() => void>;
146
+ /**
147
+ * Re-run target authorization for the sessions about to be returned after a
148
+ * wait (parity with SSE re-authorization). Throws to refuse the result.
149
+ */
150
+ reauthorizeTargets?: ((sessionIds: readonly string[]) => Promise<void>) | undefined;
151
+ };
152
+ export type SessionWaitInput = {
153
+ targets: readonly SessionWaitTarget[];
154
+ ownSessionId: string | null;
155
+ maxWaitMs: number;
156
+ /** Target events that end the wait. Defaults to the ordinary activity set. */
157
+ targetEventTypes?: readonly SessionEventType[] | undefined;
158
+ /** Optional payload-aware refinement applied after the event-type filter. */
159
+ targetEventMatches?: ((event: SessionEvent) => boolean) | undefined;
160
+ source: SessionWaitSource;
161
+ signal?: AbortSignal | undefined;
162
+ now?: (() => number) | undefined;
163
+ maxBytes?: number | undefined;
164
+ };
165
+ export declare function waitForSessionChanges(input: SessionWaitInput): Promise<SessionWaitResult>;
166
+ /** One bounded, result-bearing summary of a durable event for a waiter. */
167
+ export declare function summarizeSessionWaitEvent(event: SessionEvent, textChars?: number): SessionWaitEventSummary;
168
+ /**
169
+ * Keep the whole model-visible result at or below the `session_events` MCP
170
+ * envelope. Text is tightened first; only then are newest rows dropped from the
171
+ * largest target, which keeps each target's `latestSequence` an exact cursor
172
+ * for the rows actually delivered and marks the remainder as `hasMore`.
173
+ */
174
+ export declare function boundSessionWaitResult(input: Omit<SessionWaitResult, "truncated" | "bytes" | "maxBytes">, maxBytes?: number): SessionWaitResult;
@@ -0,0 +1,52 @@
1
+ import { OrganizationAccessPolicy, type AccessGrant, type ToolGatewayCatalog, type ToolGatewayIdentity } from "@opengeni/contracts";
2
+ import { type McpOAuthAccess } from "@opengeni/db";
3
+ import { type ApiRouteDeps } from "@opengeni/core";
4
+ import { Hono, type Context } from "hono";
5
+ /** One organization MCP server for everyone; the sign-in chooses the organization. */
6
+ export declare const ORGANIZATION_MCP_PATH = "/v1/mcp";
7
+ export type McpOAuthResource = {
8
+ resource: string;
9
+ /** Null for the organization server. */
10
+ workspaceId: string | null;
11
+ kind: "all" | "docs" | "files" | "organization";
12
+ };
13
+ export type McpOAuthRouteAccess = {
14
+ grant: AccessGrant;
15
+ allowedToolIdentities: ToolGatewayIdentity[];
16
+ };
17
+ export declare function registerMcpOAuthRoutes(app: Hono, deps: ApiRouteDeps): void;
18
+ export declare function resolveMcpOAuthRouteAccess(deps: ApiRouteDeps, request: Request, workspaceId: string): Promise<McpOAuthRouteAccess | null>;
19
+ export declare function mcpOAuthBearerToken(request: Request): string | null;
20
+ export declare function isMcpOAuthResourcePath(pathname: string): boolean;
21
+ export declare function mcpOAuthConsentToolIdentities(catalog: ToolGatewayCatalog): ToolGatewayIdentity[];
22
+ export declare function isMcpOAuthPublicProtocolPath(pathname: string): boolean;
23
+ export declare function mcpOAuthAuthenticateHeader(deps: ApiRouteDeps, pathname: string): string;
24
+ export declare function mcpOAuthRedirectUriCandidates(registered: string[], requested: string): string[];
25
+ export declare function completeAuthorizationRedirect(c: Context, redirectTo: string): Response;
26
+ export type McpOAuthConsentAccount = {
27
+ id: string;
28
+ name: string;
29
+ };
30
+ export type McpOAuthConsentWorkspace = {
31
+ id: string;
32
+ accountId: string;
33
+ name: string;
34
+ kind: "personal" | "shared";
35
+ };
36
+ export declare function renderMcpOAuthConsentPage(input: {
37
+ clientName: string;
38
+ requestToken: string;
39
+ accounts: McpOAuthConsentAccount[];
40
+ workspaces: McpOAuthConsentWorkspace[];
41
+ selectedWorkspaceId: string;
42
+ }): string;
43
+ export declare function renderMcpOAuthContinuePage(redirectTo: string): string;
44
+ export declare function renderMcpOAuthExpiredPage(message: string): string;
45
+ /**
46
+ * The organization connection behind an organization-server bearer, or null
47
+ * when the request carries no MCP OAuth token. Invalid, revoked, expired or
48
+ * workspace-bound tokens are refused.
49
+ */
50
+ export declare function resolveOrganizationMcpOAuthAccess(deps: ApiRouteDeps, request: Request): Promise<(McpOAuthAccess & {
51
+ organizationAccess: OrganizationAccessPolicy;
52
+ }) | null>;
@@ -1,23 +1,7 @@
1
- import { type ConfiguredModel, type Settings } from "@opengeni/config";
2
- import { ClientModel, type WorkspaceModelCatalogResponse as WorkspaceModelCatalogResponseType, type WorkspaceModelPolicyContract } from "@opengeni/contracts";
3
- export type ModelAvailabilityObservation = {
4
- status: "available" | "degraded" | "unavailable";
5
- reason: "not_entitled" | "provider_unhealthy" | null;
6
- checkedAt: string;
7
- };
8
- export type ModelCredentialReadinessObservation = {
9
- status: "ready";
10
- checkedAt: string;
11
- } | {
12
- status: "not_ready";
13
- reason: "prerequisites_missing" | "needs_reauth";
14
- checkedAt: string;
15
- } | {
16
- status: "error";
17
- reason: "resolver_error";
18
- checkedAt: string;
19
- };
20
- export declare const MODEL_CREDENTIAL_READINESS_OBSERVATION_MAX_AGE_MS: number;
1
+ import { type ConfiguredModel } from "@opengeni/config";
2
+ import { ClientModel, type DefaultModelSelection, type WorkspaceModelCatalogResponse as WorkspaceModelCatalogResponseType } from "@opengeni/contracts";
3
+ import { type WorkspaceModelSelection, type WorkspaceModelSelectionInput } from "@opengeni/core";
4
+ export { MODEL_CREDENTIAL_READINESS_OBSERVATION_MAX_AGE_MS, type ModelAvailabilityObservation, type ModelCredentialReadinessObservation, } from "@opengeni/core";
21
5
  /** Static, client-safe definition projection. No provider secret is reachable. */
22
6
  export declare function projectClientModel(model: ConfiguredModel): ClientModel;
23
7
  /**
@@ -28,14 +12,10 @@ export declare function projectClientModel(model: ConfiguredModel): ClientModel;
28
12
  * successful typed resolver observation; credential health and provider health
29
13
  * are separate inputs and neither is fabricated.
30
14
  */
31
- export declare function buildWorkspaceModelCatalog(input: {
32
- settings: Settings;
33
- policy: WorkspaceModelPolicyContract | null;
34
- codexSubscriptionActive: boolean;
35
- xaiSubscriptionActive?: boolean;
36
- workspaceGatewayConnectionActive?: boolean;
37
- credentialReadinessObservations?: Readonly<Record<string, ModelCredentialReadinessObservation>> | undefined;
38
- observations?: Readonly<Record<string, ModelAvailabilityObservation>> | undefined;
39
- now?: Date | undefined;
40
- credentialReadinessMaxAgeMs?: number | undefined;
41
- }): WorkspaceModelCatalogResponseType;
15
+ export declare function buildWorkspaceModelCatalog(input: WorkspaceModelSelectionInput, defaults?: WorkspaceModelCatalogDefaults): WorkspaceModelCatalogResponseType;
16
+ /** Resolved new-chat defaults published beside the catalog rows. */
17
+ export type WorkspaceModelCatalogDefaults = {
18
+ defaultSelection: DefaultModelSelection;
19
+ creditsSelection: DefaultModelSelection | null;
20
+ };
21
+ export declare function projectWorkspaceModelCatalog(selections: readonly WorkspaceModelSelection[], defaults?: WorkspaceModelCatalogDefaults): WorkspaceModelCatalogResponseType;
@@ -1,3 +1,5 @@
1
- import type { EventLogger } from "@opengeni/events";
1
+ import { type EventBusOptions, type EventLogger } from "@opengeni/events";
2
2
  import type { Observability } from "@opengeni/observability";
3
+ /** Logger plus the closed-label subscription-termination counter for NATS connections. */
4
+ export declare function observabilityEventBusOptions(observability: Observability): Pick<EventBusOptions, "logger" | "onSubscriptionTerminated">;
3
5
  export declare function observabilityEventLogger(observability: Observability): EventLogger;
@@ -0,0 +1,52 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { type OrganizationAccessPolicy } from "@opengeni/contracts";
3
+ import type { ActionCatalogEntry } from "./mcp/action-catalog-types.js";
4
+ export type OrganizationMcpCaller = {
5
+ kind: "person";
6
+ accountId: string;
7
+ subjectId: string;
8
+ access: OrganizationAccessPolicy;
9
+ } | {
10
+ kind: "key";
11
+ authorization: string;
12
+ accessKey: string | null;
13
+ };
14
+ /**
15
+ * Requests that only read but are sent as POST (a search query or a file path
16
+ * in the body). Read only connections may run them; each route still checks
17
+ * its own read permission.
18
+ */
19
+ export declare const READ_ONLY_POST_ACTIONS: ReadonlySet<string>;
20
+ export declare function buildOrganizationMcpServer(input: {
21
+ caller: OrganizationMcpCaller;
22
+ /** This API's own origin; the call never leaves the process. */
23
+ origin: string;
24
+ dispatch: (request: Request) => Promise<Response>;
25
+ signal?: AbortSignal;
26
+ }): Server;
27
+ export declare function findAction(id: string): ActionCatalogEntry | undefined;
28
+ export declare function searchActions(input: {
29
+ query: string;
30
+ limit: number;
31
+ offset: number;
32
+ }): {
33
+ total: number;
34
+ offset: number;
35
+ actions: {
36
+ id: string;
37
+ method: string;
38
+ path: string;
39
+ }[];
40
+ };
41
+ export declare function describeAction(entry: ActionCatalogEntry): {
42
+ id: string;
43
+ method: string;
44
+ path: string;
45
+ pathParameters: string[];
46
+ input: {
47
+ name: string;
48
+ in: string;
49
+ schema: unknown;
50
+ }[];
51
+ response: string[];
52
+ };
@@ -0,0 +1,41 @@
1
+ import type { Database } from "@opengeni/db";
2
+ import { prepareOrganizationRecoveryNotifications, settleOrganizationRecoveryNotification, type OrganizationRecoveryNotificationClaim, type OrganizationRecoveryNotificationSettlement } from "@opengeni/db";
3
+ export type OrganizationRecoveryNotificationDeliveryResult = {
4
+ status: "sent";
5
+ providerMessageId: string | null;
6
+ } | {
7
+ status: "failed";
8
+ errorClass: string;
9
+ } | {
10
+ status: "outcome_unknown";
11
+ };
12
+ export interface OrganizationRecoveryNotificationTransport {
13
+ readonly provider: string;
14
+ send(claim: OrganizationRecoveryNotificationClaim): Promise<OrganizationRecoveryNotificationDeliveryResult>;
15
+ }
16
+ export type OrganizationRecoveryNotificationLifecycle = {
17
+ prepare: typeof prepareOrganizationRecoveryNotifications;
18
+ settle: typeof settleOrganizationRecoveryNotification;
19
+ };
20
+ export declare function dispatchOrganizationRecoveryNotifications(input: {
21
+ db: Database;
22
+ transport: OrganizationRecoveryNotificationTransport;
23
+ claimOwner: string;
24
+ limit?: number;
25
+ leaseSeconds?: number;
26
+ lifecycle?: OrganizationRecoveryNotificationLifecycle;
27
+ }): Promise<OrganizationRecoveryNotificationSettlement[]>;
28
+ export declare class InMemoryOrganizationRecoveryNotificationTransport implements OrganizationRecoveryNotificationTransport {
29
+ readonly provider = "fake";
30
+ readonly attempts: Array<{
31
+ idempotencyKey: string;
32
+ payloadDigest: string;
33
+ recipientCanonicalIdentityId: string;
34
+ providerMessageId: string;
35
+ }>;
36
+ private readonly deliveries;
37
+ private readonly scripted;
38
+ enqueue(...results: OrganizationRecoveryNotificationDeliveryResult[]): void;
39
+ logicalDeliveryCount(): number;
40
+ send(claim: OrganizationRecoveryNotificationClaim): Promise<OrganizationRecoveryNotificationDeliveryResult>;
41
+ }
@@ -0,0 +1,26 @@
1
+ import type { Settings } from "@opengeni/config";
2
+ import { ANALYTICS_CONSENT_DECISIONS, ANALYTICS_CONSENT_PATH, type AnalyticsConsentDecision } from "@opengeni/contracts/analytics-consent-report";
3
+ import type { Observability } from "@opengeni/observability";
4
+ import type { Hono } from "hono";
5
+ import { z } from "zod";
6
+ import { type KeyedAdmission } from "../http/keyed-admission.js";
7
+ export { ANALYTICS_CONSENT_DECISIONS, ANALYTICS_CONSENT_PATH, type AnalyticsConsentDecision };
8
+ export declare const AnalyticsConsentReport: z.ZodObject<{
9
+ decision: z.ZodEnum<{
10
+ denied: "denied";
11
+ granted: "granted";
12
+ }>;
13
+ }, z.core.$strict>;
14
+ export type AnalyticsConsentReport = z.infer<typeof AnalyticsConsentReport>;
15
+ export type AnalyticsConsentAdmission = KeyedAdmission<AnalyticsConsentDecision>;
16
+ export declare function parseAnalyticsConsentReport(body: string | null): AnalyticsConsentReport | null;
17
+ /**
18
+ * The exact beacon request. The app-wide request-body limit skips it because
19
+ * the route enforces its own small limit on the streamed body.
20
+ */
21
+ export declare function isAnalyticsConsentReportRequest(method: string, pathname: string): boolean;
22
+ export declare function registerAnalyticsConsentRoutes(app: Hono, deps: {
23
+ observability: Observability;
24
+ settings: Pick<Settings, "corsAllowOriginRegex" | "publicBaseUrl" | "webBaseUrl">;
25
+ admission?: AnalyticsConsentAdmission;
26
+ }): void;
@@ -1,8 +1,33 @@
1
+ import { createPinnedIntegrationTransport } from "@opengeni/capabilities";
2
+ import { InstallApiIntegrationRequest, PreviewApiIntegrationRequest, type AccessGrant } from "@opengeni/contracts";
1
3
  import { type ApiRouteDeps } from "@opengeni/core";
4
+ import { installApiIntegration } from "@opengeni/db";
2
5
  import type { FetchLike } from "@opengeni/network";
3
6
  import type { Hono } from "hono";
7
+ import { resolveApiIntegrationPreview, type ResolvedApiIntegrationPreview } from "../integrations/api-integrations.js";
4
8
  export type ApiIntegrationRouteOverrides = Readonly<{
5
9
  fetchImpl?: FetchLike;
6
10
  }>;
7
11
  export declare function apiIntegrationRequiresConnection(authScheme: Record<string, unknown>): boolean;
12
+ /** Shared native/embedded install validation. The caller must still authorize
13
+ * capabilities:manage and commit under its own live-authority boundary. */
14
+ export declare function validatedIntegrationInstallInput(grant: AccessGrant, workspaceId: string, payload: InstallApiIntegrationRequest, resolved: ResolvedApiIntegrationPreview): Parameters<typeof installApiIntegration>[1];
15
+ /**
16
+ * `allowedTools` names tools by their preview `id`, the stable identity the
17
+ * install persists. Reject anything else as a client error that lists the
18
+ * valid ids; a caller that sent a preview `operationKey` is told which id it
19
+ * maps to rather than having it silently reinterpreted.
20
+ */
21
+ export declare function validatedAllowedToolIds(allowedTools: readonly string[], tools: readonly {
22
+ id: string;
23
+ operationKey: string;
24
+ }[]): string[];
8
25
  export declare function registerApiIntegrationRoutes(app: Hono, deps: ApiRouteDeps, overrides?: ApiIntegrationRouteOverrides): void;
26
+ export declare function resolveForRoute(input: {
27
+ deps: ApiRouteDeps;
28
+ transport: ReturnType<typeof createPinnedIntegrationTransport>;
29
+ accountId: string;
30
+ workspaceId: string;
31
+ subjectId: string;
32
+ payload: PreviewApiIntegrationRequest | InstallApiIntegrationRequest;
33
+ }): ReturnType<typeof resolveApiIntegrationPreview>;
@@ -1,3 +1,20 @@
1
+ import { CreateOrganizationApiKeyRequest, Permission, type AccessContext, type OrganizationApiKeyAccess } from "@opengeni/contracts";
1
2
  import type { Hono } from "hono";
2
3
  import type { ApiRouteDeps } from "@opengeni/core";
4
+ export { organizationApiKeyAccess } from "@opengeni/core";
5
+ /** Permissions minted onto a `full` organization API key. */
6
+ export declare const organizationApiKeyPermissions: Permission[];
7
+ /**
8
+ * Permissions minted onto a `read` organization API key. The key inventories
9
+ * shared workspaces and reads their sessions, events, and files; it holds no
10
+ * `workspace:admin` wildcard, so every control, create, and key-management
11
+ * route denies it, and no `api_keys:manage`, so it cannot mint keys.
12
+ */
13
+ export declare const organizationReadApiKeyPermissions: Permission[];
14
+ export declare function organizationApiKeyPermissionsForAccess(access: OrganizationApiKeyAccess): Permission[];
15
+ /** Existing callers retain their expiry; setup keys default to one day. */
16
+ export declare function organizationApiKeyExpiryDate(request: Pick<CreateOrganizationApiKeyRequest, "preset" | "expiresAt"> & Partial<Pick<CreateOrganizationApiKeyRequest, "access">>, now?: Date): Date | null;
3
17
  export declare function registerApiKeyRoutes(app: Hono, deps: ApiRouteDeps): void;
18
+ /** Service account problems read as the person would expect. */
19
+ export declare function throwServiceAccountError(error: unknown): void;
20
+ export declare function requireOrganizationApiKeyControlPermission(context: AccessContext, organizationId: string): void;
@@ -0,0 +1,6 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ import { type EditableArtifactRouteDependencies } from "./editable-artifacts.js";
4
+ type Dependencies = ApiRouteDeps & EditableArtifactRouteDependencies;
5
+ export declare function registerArtifactCatalogRoutes(app: Hono, deps: Dependencies): void;
6
+ export {};
@@ -0,0 +1,19 @@
1
+ import { AutomationNormalizedEvent } from "@opengeni/contracts";
2
+ import { type AutomationSourceSecret } from "@opengeni/db";
3
+ import { type ApiRouteDeps } from "@opengeni/core";
4
+ import type { Hono } from "hono";
5
+ export declare function registerAutomationRoutes(app: Hono, deps: ApiRouteDeps): void;
6
+ export declare function acceptAutomationEvent(deps: ApiRouteDeps, source: AutomationSourceSecret, input: {
7
+ deliveryKey: string;
8
+ requestDigest: string;
9
+ normalizedEvent: AutomationNormalizedEvent;
10
+ /** Canonical manual caller restriction, not normalized event metadata. */
11
+ credentialRestriction?: "developer_setup";
12
+ }): Promise<{
13
+ accepted: boolean;
14
+ duplicate: boolean;
15
+ ignoredReason: string | null;
16
+ eventId: string | null;
17
+ runIds: string[];
18
+ }>;
19
+ export declare function readAutomationWebhookBody(request: Request, maxBytes: number): Promise<Uint8Array>;
@@ -1,3 +1,4 @@
1
+ import { type AccessContext, type Permission } from "@opengeni/contracts";
1
2
  import type { Hono } from "hono";
2
3
  import Stripe from "stripe";
3
4
  import type { ApiRouteDeps } from "@opengeni/core";
@@ -9,8 +10,56 @@ export declare function stripeCheckoutSessionCreateParams(input: {
9
10
  amountMicros: number;
10
11
  creditsProductId?: string | undefined;
11
12
  publicBaseUrl?: string | undefined;
13
+ webBaseUrl?: string | undefined;
12
14
  successUrl?: string | undefined;
13
15
  cancelUrl?: string | undefined;
14
16
  idempotencyKey: string;
17
+ /** Apply this promotion code up front instead of letting Stripe ask for one. */
18
+ promotionCodeId?: string | undefined;
19
+ /**
20
+ * The applied code covers the whole package, so the total is $0. Nothing is
21
+ * taxable, so Checkout skips tax and with it the billing address: the
22
+ * customer only confirms.
23
+ */
24
+ fullyDiscounted?: boolean | undefined;
15
25
  }): Stripe.Checkout.SessionCreateParams;
26
+ export declare function stripeBillingPortalSessionCreateParams(input: {
27
+ customerId: string;
28
+ publicBaseUrl?: string | undefined;
29
+ webBaseUrl?: string | undefined;
30
+ returnUrl?: string | undefined;
31
+ }): Stripe.BillingPortal.SessionCreateParams;
32
+ export type StripeCheckoutCreditDecision = {
33
+ action: "grant";
34
+ credit: CheckoutCreditMetadata;
35
+ } | {
36
+ action: "ignore";
37
+ reason: "foreign_checkout" | "not_payment_mode" | "payment_not_paid";
38
+ };
39
+ /**
40
+ * Decides whether a Checkout Session webhook grants OpenGeni credits.
41
+ *
42
+ * Sessions created outside OpenGeni on the same Stripe account carry no
43
+ * `opengeni_` metadata and are acknowledged without effect. An OpenGeni
44
+ * session with malformed credit metadata still throws so the failure stays
45
+ * visible. Credits are granted once Stripe reports the payment `paid` or a
46
+ * completed checkout fully covered by a coupon:
47
+ * on `checkout.session.completed` for immediate methods, or on
48
+ * `checkout.session.async_payment_succeeded` for delayed methods, whose
49
+ * completion event arrives `unpaid`. Both events carry the same session
50
+ * metadata, so the ledger idempotency key grants at most once.
51
+ */
52
+ export declare function stripeCheckoutCreditDecision(session: Stripe.Checkout.Session): StripeCheckoutCreditDecision;
53
+ export type CheckoutCreditMetadata = {
54
+ accountId: string;
55
+ amountMicros: number;
56
+ idempotencyKey: string;
57
+ amountUsd?: string;
58
+ packageId?: string;
59
+ };
16
60
  export declare function stripeCustomerProvider(input: ApiRouteDeps | Stripe.Event): "stripe:live" | "stripe:test";
61
+ /** Billing routes do not traverse the workspace actor middleware. Always bind
62
+ * these reads explicitly; only a revalidated live attempt may supply a human
63
+ * initiator. Neither query parameters nor serviceInitiator claims are proof. */
64
+ export declare function withBillingUsageActor<T>(deps: ApiRouteDeps, context: AccessContext, accountId: string, read: () => Promise<T>): Promise<T>;
65
+ export declare function requireSelectedAccount(context: AccessContext, requested: string | undefined, permission: Permission): string;
@@ -1,8 +1,65 @@
1
- import { InteractionActor, type AccessGrant, type FileAsset } from "@opengeni/contracts";
1
+ import { InteractionActor, type AccessGrant, type FileAsset, type CreateBrowserSessionRequest as CreateBrowserSessionRequestValue, type InteractionPlacement } from "@opengeni/contracts";
2
2
  import { type ApiRouteDeps, type ResolvedSessionAuthorization } from "@opengeni/core";
3
+ import { type BrowserControlScreenshotOptions, type BrowserControlFrame } from "@opengeni/runtime/sandbox";
3
4
  import type { Hono } from "hono";
4
5
  export declare function registerBrowserSessionRoutes(app: Hono, deps: ApiRouteDeps): void;
5
- export declare function validateBrowserRequestOrigin(value: string | undefined, allowedPattern: string): string | null;
6
+ export declare function browserCreateInput(grant: AccessGrant, workspaceId: string, request: CreateBrowserSessionRequestValue, placement: InteractionPlacement): {
7
+ accountId: string;
8
+ workspaceId: string;
9
+ operationId: string;
10
+ associatedSessionId: string;
11
+ actorSubjectId: string;
12
+ name: string;
13
+ initialUrl: string | null;
14
+ placement: {
15
+ kind: "sandbox_group";
16
+ sandboxGroupId: string;
17
+ } | {
18
+ kind: "connected_machine";
19
+ sandboxId: string;
20
+ } | {
21
+ kind: "attached_device";
22
+ deviceId: string;
23
+ } | {
24
+ kind: "external_provider";
25
+ providerId: string;
26
+ placementId: string;
27
+ };
28
+ driverId: string;
29
+ engine: "chrome" | "chromium" | "external" | "lightpanda";
30
+ headless: boolean;
31
+ identityId: string | null;
32
+ baseRevisionId: string | null;
33
+ networkRouteId: string | null;
34
+ linkedComputerSessionId: string | null;
35
+ resolveDefaultRevision: boolean;
36
+ capabilities?: {
37
+ semanticObservation: boolean;
38
+ screenshots: boolean;
39
+ liveFrames: boolean;
40
+ humanInput: boolean;
41
+ tabs: boolean;
42
+ downloads: boolean;
43
+ uploads: boolean;
44
+ clipboard: boolean;
45
+ permissions: boolean;
46
+ diagnostics: boolean;
47
+ rawCdp: boolean;
48
+ linkedComputer: boolean;
49
+ privateCheckpoint: boolean;
50
+ identityPublication: boolean;
51
+ parallelTargets: boolean;
52
+ };
53
+ };
54
+ export declare function browserNeedsStandaloneDisplayStack(input: {
55
+ headless: boolean;
56
+ linkedComputer: boolean;
57
+ nativeBrowserControl: boolean;
58
+ }): boolean;
59
+ export declare function parseBrowserScreenshotOptions(query: URLSearchParams): BrowserControlScreenshotOptions;
60
+ /** Keep a definite read timeout useful without publishing driver diagnostics. */
61
+ export declare function browserScreenshotError(error: unknown): unknown;
62
+ export declare function browserScreenshotResponse(frame: Pick<BrowserControlFrame, "data" | "mediaType" | "metadataHeader">): Response;
6
63
  export declare function interactionActorForGrant(grant: AccessGrant): ReturnType<typeof InteractionActor.parse>;
7
64
  /** Resolve Drive authority from the same immutable session authorization that
8
65
  * admitted the browser action. Agent-attempt subjects are technical worker
@@ -0,0 +1,3 @@
1
+ import type { ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export declare function registerClaudeSubscriptionAccountRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,3 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import { type Hono } from "hono";
3
+ export declare function registerClaudeSubscriptionOAuthRoutes(app: Hono, deps: ApiRouteDeps, fetchImpl?: typeof fetch): void;