@opengeni/api-router 0.30.1 → 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 (436) 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-office-import.d.ts +7 -4
  35. package/dist/editable-artifact-source-session.d.ts +3 -0
  36. package/dist/editable-artifact-websocket.d.ts +10 -18
  37. package/dist/editable-artifact-workspace-files.d.ts +1 -1
  38. package/dist/fatal-process-boundary.d.ts +25 -0
  39. package/dist/github-access.d.ts +31 -2
  40. package/dist/http/acting-person.d.ts +24 -0
  41. package/dist/http/api-contract-compat.d.ts +19 -0
  42. package/dist/http/api-error.d.ts +27 -1
  43. package/dist/http/cors.d.ts +17 -0
  44. package/dist/http/deprecation.d.ts +42 -0
  45. package/dist/http/interaction-control-error.d.ts +13 -0
  46. package/dist/http/keyed-admission.d.ts +12 -0
  47. package/dist/http/local-browser-boundary.d.ts +72 -0
  48. package/dist/http/metrics-listener.d.ts +22 -0
  49. package/dist/http/path-identifier.d.ts +17 -0
  50. package/dist/http/registered-route-label.d.ts +16 -0
  51. package/dist/http/request-body.d.ts +27 -0
  52. package/dist/http/request-source.d.ts +52 -0
  53. package/dist/http/sse.d.ts +17 -6
  54. package/dist/http/unmatched-route.d.ts +18 -0
  55. package/dist/http/user-content.d.ts +36 -0
  56. package/dist/http/websocket-upgrade-dispatch.d.ts +18 -0
  57. package/dist/index.d.ts +10 -3
  58. package/dist/index.js +1129 -166
  59. package/dist/index.js.map +1 -1
  60. package/dist/integration-endpoint-test.d.ts +20 -0
  61. package/dist/integrations/api-integrations.d.ts +2 -2
  62. package/dist/integrations/atlassian.d.ts +29 -3
  63. package/dist/integrations/connect-authority.d.ts +1 -0
  64. package/dist/integrations/connect-callback-return.d.ts +6 -0
  65. package/dist/integrations/fiken.d.ts +16 -2
  66. package/dist/integrations/github-app-connect.d.ts +47 -0
  67. package/dist/integrations/github-installation-proof.d.ts +3 -0
  68. package/dist/integrations/github-lens-connect.d.ts +116 -0
  69. package/dist/integrations/github-skill-source.d.ts +1 -5
  70. package/dist/integrations/google-drive.d.ts +25 -0
  71. package/dist/integrations/integration-commit-authority.d.ts +13 -0
  72. package/dist/integrations/marketplace-plugin.d.ts +2691 -0
  73. package/dist/integrations/oauth-client.d.ts +178 -18
  74. package/dist/integrations/oauth-profiles.d.ts +222 -0
  75. package/dist/integrations/oauth-return-path.d.ts +1 -0
  76. package/dist/integrations/personal-github-repositories.d.ts +84 -0
  77. package/dist/integrations/personal-github.d.ts +42 -0
  78. package/dist/integrations/pr-review-provider.d.ts +22 -0
  79. package/dist/integrations/provider-oauth.d.ts +19 -1
  80. package/dist/integrations/slack-app-home.d.ts +24 -0
  81. package/dist/integrations/slack-bot.d.ts +367 -12
  82. package/dist/integrations/slack-file-upload-flow.d.ts +62 -0
  83. package/dist/integrations/slack-install.d.ts +20 -0
  84. package/dist/integrations/slack-interactions.d.ts +113 -10
  85. package/dist/integrations/slack-mrkdwn.d.ts +41 -0
  86. package/dist/integrations/slack-routing.d.ts +120 -0
  87. package/dist/integrations/slack-session-defaults.d.ts +58 -0
  88. package/dist/integrations/slack-task-file-upload.d.ts +36 -0
  89. package/dist/integrations/social-oauth.d.ts +7 -0
  90. package/dist/interaction-agent-access.d.ts +15 -0
  91. package/dist/interaction-frame-proxy.d.ts +68 -0
  92. package/dist/interaction-metrics.d.ts +2 -0
  93. package/dist/mcp/action-catalog-types.d.ts +9 -0
  94. package/dist/mcp/action-catalog.gen.d.ts +2 -0
  95. package/dist/mcp/capability-account-readiness.d.ts +7 -0
  96. package/dist/mcp/child-read-evidence.d.ts +9 -0
  97. package/dist/mcp/command-read.d.ts +24 -0
  98. package/dist/mcp/company-profile-agent-admin.d.ts +44 -0
  99. package/dist/mcp/contract-input.d.ts +11 -0
  100. package/dist/mcp/documents.d.ts +7 -5
  101. package/dist/mcp/files.d.ts +2 -2
  102. package/dist/mcp/first-party-tool-permissions.d.ts +650 -0
  103. package/dist/mcp/knowledge-entries.d.ts +5 -0
  104. package/dist/mcp/orchestration-failure-diagnostic.d.ts +43 -0
  105. package/dist/mcp/receipts.d.ts +9 -0
  106. package/dist/mcp/request-abort.d.ts +19 -0
  107. package/dist/mcp/scheduled-task-input.d.ts +1189 -0
  108. package/dist/mcp/scheduled-task-view.d.ts +22 -4
  109. package/dist/mcp/server.d.ts +255 -3
  110. package/dist/mcp/session-event-view.d.ts +94 -0
  111. package/dist/mcp/session-view.d.ts +66 -2
  112. package/dist/mcp/session-wait.d.ts +174 -0
  113. package/dist/mcp-oauth.d.ts +52 -0
  114. package/dist/model-catalog.d.ts +11 -31
  115. package/dist/observability.d.ts +3 -1
  116. package/dist/organization-mcp.d.ts +52 -0
  117. package/dist/organization-recovery-notifications.d.ts +41 -0
  118. package/dist/routes/analytics-consent.d.ts +26 -0
  119. package/dist/routes/api-integrations.d.ts +25 -0
  120. package/dist/routes/api-keys.d.ts +17 -0
  121. package/dist/routes/artifact-catalog.d.ts +6 -0
  122. package/dist/routes/automations.d.ts +19 -0
  123. package/dist/routes/billing.d.ts +49 -0
  124. package/dist/routes/browser-sessions.d.ts +71 -3
  125. package/dist/routes/claude-subscription-accounts.d.ts +3 -0
  126. package/dist/routes/claude-subscription-oauth.d.ts +3 -0
  127. package/dist/routes/client-errors.d.ts +146 -0
  128. package/dist/routes/codex.d.ts +76 -2
  129. package/dist/routes/company-brain.d.ts +3 -0
  130. package/dist/routes/company-profile.d.ts +2 -1
  131. package/dist/routes/computer-sessions.d.ts +14 -0
  132. package/dist/routes/connect.d.ts +5 -0
  133. package/dist/routes/editable-artifacts.d.ts +2 -0
  134. package/dist/routes/external-identity-links.d.ts +6 -0
  135. package/dist/routes/feedback.d.ts +3 -0
  136. package/dist/routes/files.d.ts +4 -0
  137. package/dist/routes/github-browser-pages.d.ts +12 -0
  138. package/dist/routes/github.d.ts +2 -0
  139. package/dist/routes/insights-response-cache.d.ts +10 -0
  140. package/dist/routes/insights-usage.d.ts +12 -0
  141. package/dist/routes/insights.d.ts +30 -1
  142. package/dist/routes/knowledge.d.ts +3 -0
  143. package/dist/routes/managed-auth-session-sets.d.ts +26 -0
  144. package/dist/routes/managed-onboarding.d.ts +29 -0
  145. package/dist/routes/managed-sign-in-methods.d.ts +6 -0
  146. package/dist/routes/model-connection-access.d.ts +3 -0
  147. package/dist/routes/organization-integration-policy.d.ts +3 -0
  148. package/dist/routes/organization-integrations.d.ts +6 -0
  149. package/dist/routes/organization-mcp-connections.d.ts +3 -0
  150. package/dist/routes/organization-model-providers.d.ts +3 -0
  151. package/dist/routes/organization-recovery.d.ts +19 -0
  152. package/dist/routes/organization-service-accounts.d.ts +3 -0
  153. package/dist/routes/organization-sessions.d.ts +26 -0
  154. package/dist/routes/personal-github-git-broker.d.ts +29 -0
  155. package/dist/routes/personal-github.d.ts +3 -0
  156. package/dist/routes/pr-review-github.d.ts +3 -0
  157. package/dist/routes/pr-review.d.ts +3 -0
  158. package/dist/routes/session-artifact-associations.d.ts +4 -0
  159. package/dist/routes/session-history-imports.d.ts +9 -0
  160. package/dist/routes/sessions.d.ts +44 -6
  161. package/dist/routes/skill-content.d.ts +4 -0
  162. package/dist/routes/skill-install-authority.d.ts +6 -0
  163. package/dist/routes/subscription-account-pools.d.ts +34 -0
  164. package/dist/routes/subscription-pool-access.d.ts +16 -0
  165. package/dist/routes/supergrok.d.ts +6 -1
  166. package/dist/routes/usage-allowances.d.ts +12 -0
  167. package/dist/routes/user-resource-authorities.d.ts +3 -0
  168. package/dist/routes/workspace-artifacts.d.ts +2 -1
  169. package/dist/routes/workspace-capture.d.ts +10 -2
  170. package/dist/routes/workspace-integrations.d.ts +35 -0
  171. package/dist/routes/workspace-learning.d.ts +3 -0
  172. package/dist/routes/workspace-model-providers.d.ts +4 -0
  173. package/dist/routes/workspaces.d.ts +29 -0
  174. package/dist/sandbox/auth-callout.d.ts +8 -0
  175. package/dist/sandbox/channel-a.d.ts +19 -1
  176. package/dist/sandbox/connection-authority.d.ts +3 -0
  177. package/dist/sandbox/enrollment.d.ts +9 -1
  178. package/dist/sandbox/machines.d.ts +5 -2
  179. package/dist/sandbox/metrics-ingestion.d.ts +28 -20
  180. package/dist/sandbox/rematerialize.d.ts +2 -0
  181. package/dist/sandbox/session-attach-variable-sets.d.ts +30 -0
  182. package/dist/sandbox/viewer.d.ts +26 -1
  183. package/dist/sandbox-file-artifacts.d.ts +50 -0
  184. package/dist/scheduled-task-deletion.d.ts +13 -0
  185. package/dist/session-create-observability.d.ts +5 -0
  186. package/dist/session-event-view-MPS2OZD3.js +292 -0
  187. package/dist/session-event-view-MPS2OZD3.js.map +1 -0
  188. package/dist/site-session-origin.d.ts +13 -0
  189. package/dist/site-uploads.d.ts +41 -0
  190. package/dist/slack-reaction-files.d.ts +1 -1
  191. package/dist/temporal-schedule-cleanup.d.ts +1 -0
  192. package/dist/temporal-schedule-sync.d.ts +26 -0
  193. package/dist/transcription/providers/xai-subscription.d.ts +1 -0
  194. package/dist/transcription/service.d.ts +2 -1
  195. package/dist/work-discovery-observability.d.ts +33 -0
  196. package/dist/workspace-artifact-content.d.ts +28 -0
  197. package/dist/workspace-artifact-provenance.d.ts +7 -0
  198. package/dist/workspace-delete-observability.d.ts +10 -0
  199. package/dist/workspace-deletion.d.ts +6 -0
  200. package/dist/workspace-state-projection.d.ts +3 -5
  201. package/dist/workspace-tool-gateway-observability.d.ts +17 -0
  202. package/dist/workspace-tool-gateway.d.ts +123 -0
  203. package/dist/workspace-webhook-dispatch.d.ts +26 -0
  204. package/package.json +23 -19
  205. package/src/access-grant-rls.ts +75 -0
  206. package/src/admission-trace.ts +14 -0
  207. package/src/api-websocket.ts +23 -0
  208. package/src/app.ts +1974 -256
  209. package/src/artifact-catalog-cursor.ts +60 -0
  210. package/src/auth/managed-auth-attempt-context.ts +70 -0
  211. package/src/auth/managed-auth-rate-limits.ts +252 -0
  212. package/src/auth/managed-auth-session-adapter.ts +222 -0
  213. package/src/auth/managed-auth.ts +536 -60
  214. package/src/auth/managed-email.ts +174 -0
  215. package/src/auth/managed-sign-in-notifications.ts +81 -0
  216. package/src/auth/new-signups-gate.ts +49 -0
  217. package/src/auth/organization-user-setup.ts +307 -0
  218. package/src/auth/signup-funnel-metrics.ts +164 -0
  219. package/src/browser-controller-authority.ts +1 -186
  220. package/src/browser-ephemeral.ts +39 -0
  221. package/src/browser-state-authority.ts +1 -236
  222. package/src/claude-subscription-account-conflicts.ts +12 -0
  223. package/src/claude-subscription-account-usage.ts +48 -0
  224. package/src/claude-subscription-oauth.ts +362 -0
  225. package/src/claude-subscription-profile.ts +73 -0
  226. package/src/claude-subscription-usage.ts +97 -0
  227. package/src/claude-workspace-connection.ts +82 -0
  228. package/src/codemode.ts +194 -30
  229. package/src/codex-realtime.ts +8 -2
  230. package/src/company-brain-okf.ts +340 -0
  231. package/src/connected-machine-computer-access.ts +33 -0
  232. package/src/connection-ownership.ts +199 -0
  233. package/src/controller-data-plane.ts +81 -0
  234. package/src/editable-artifact-native-kernel.ts +26 -15
  235. package/src/editable-artifact-office-import.ts +77 -9
  236. package/src/editable-artifact-production.ts +23 -7
  237. package/src/editable-artifact-source-session.ts +123 -0
  238. package/src/editable-artifact-websocket.ts +27 -21
  239. package/src/editable-artifact-workspace-files.ts +31 -6
  240. package/src/fatal-process-boundary.ts +246 -0
  241. package/src/gateway-realtime.ts +1 -1
  242. package/src/github-access.ts +147 -5
  243. package/src/http/acting-person.ts +71 -0
  244. package/src/http/api-contract-compat.ts +49 -0
  245. package/src/http/api-error.ts +115 -1
  246. package/src/http/auth.ts +48 -0
  247. package/src/http/cors.ts +67 -0
  248. package/src/http/deprecation.ts +118 -0
  249. package/src/http/interaction-control-error.ts +164 -0
  250. package/src/http/keyed-admission.ts +29 -0
  251. package/src/http/local-browser-boundary.ts +343 -0
  252. package/src/http/metrics-listener.ts +57 -0
  253. package/src/http/path-identifier.ts +54 -0
  254. package/src/http/registered-route-label.ts +34 -0
  255. package/src/http/request-body.ts +127 -0
  256. package/src/http/request-source.ts +178 -0
  257. package/src/http/sse.ts +486 -132
  258. package/src/http/unmatched-route.ts +60 -0
  259. package/src/http/user-content.ts +158 -0
  260. package/src/http/websocket-upgrade-dispatch.ts +29 -0
  261. package/src/index.ts +157 -52
  262. package/src/integration-endpoint-test.ts +291 -0
  263. package/src/integrations/api-integrations.ts +98 -11
  264. package/src/integrations/atlassian.ts +474 -136
  265. package/src/integrations/connect-authority.ts +2 -0
  266. package/src/integrations/connect-callback-return.ts +86 -0
  267. package/src/integrations/fiken.ts +354 -64
  268. package/src/integrations/github-app-connect.ts +435 -0
  269. package/src/integrations/github-installation-proof.ts +60 -0
  270. package/src/integrations/github-lens-connect.ts +76 -0
  271. package/src/integrations/github-skill-source.ts +2 -142
  272. package/src/integrations/google-drive.ts +820 -222
  273. package/src/integrations/integration-commit-authority.ts +69 -0
  274. package/src/integrations/marketplace-plugin.ts +48 -0
  275. package/src/integrations/oauth-client.ts +1356 -459
  276. package/src/integrations/oauth-profiles.ts +537 -0
  277. package/src/integrations/oauth-return-path.ts +18 -0
  278. package/src/integrations/personal-github-repositories.ts +674 -0
  279. package/src/integrations/personal-github.ts +825 -0
  280. package/src/integrations/pr-review-provider.ts +246 -0
  281. package/src/integrations/provider-oauth.ts +250 -22
  282. package/src/integrations/slack-app-home.ts +300 -0
  283. package/src/integrations/slack-bot.ts +963 -239
  284. package/src/integrations/slack-file-upload-flow.ts +147 -0
  285. package/src/integrations/slack-install.ts +83 -0
  286. package/src/integrations/slack-interactions.ts +3170 -474
  287. package/src/integrations/slack-mrkdwn.ts +193 -0
  288. package/src/integrations/slack-routing.ts +337 -0
  289. package/src/integrations/slack-session-defaults.ts +224 -0
  290. package/src/integrations/slack-task-file-upload.ts +323 -0
  291. package/src/integrations/social-oauth.ts +213 -15
  292. package/src/interaction-agent-access.ts +48 -0
  293. package/src/interaction-frame-proxy.ts +409 -0
  294. package/src/interaction-metrics.ts +30 -0
  295. package/src/mcp/action-catalog-types.ts +9 -0
  296. package/src/mcp/action-catalog.gen.ts +6696 -0
  297. package/src/mcp/capability-account-readiness.ts +17 -0
  298. package/src/mcp/child-read-evidence.ts +19 -0
  299. package/src/mcp/command-read.ts +109 -0
  300. package/src/mcp/company-profile-agent-admin.ts +198 -0
  301. package/src/mcp/contract-input.ts +141 -0
  302. package/src/mcp/documents.ts +65 -377
  303. package/src/mcp/editable-artifacts.ts +12 -6
  304. package/src/mcp/files.ts +80 -38
  305. package/src/mcp/first-party-tool-permissions.ts +305 -0
  306. package/src/mcp/knowledge-entries.ts +322 -0
  307. package/src/mcp/orchestration-failure-diagnostic.ts +43 -0
  308. package/src/mcp/receipts.ts +34 -0
  309. package/src/mcp/request-abort.ts +44 -0
  310. package/src/mcp/scheduled-task-input.ts +76 -0
  311. package/src/mcp/scheduled-task-view.ts +44 -3
  312. package/src/mcp/server.ts +3030 -1267
  313. package/src/mcp/session-event-view.ts +383 -0
  314. package/src/mcp/session-view.ts +84 -3
  315. package/src/mcp/session-wait.ts +665 -0
  316. package/src/mcp-oauth.ts +1123 -0
  317. package/src/model-catalog.ts +91 -333
  318. package/src/observability.ts +15 -1
  319. package/src/organization-mcp.ts +397 -0
  320. package/src/organization-recovery-notifications.ts +103 -0
  321. package/src/routes/analytics-consent.ts +123 -0
  322. package/src/routes/api-integrations.ts +364 -74
  323. package/src/routes/api-keys.ts +336 -10
  324. package/src/routes/artifact-catalog.ts +279 -0
  325. package/src/routes/automations.ts +768 -0
  326. package/src/routes/billing.ts +461 -46
  327. package/src/routes/browser-sessions.ts +839 -131
  328. package/src/routes/canonical-human-identities.ts +90 -14
  329. package/src/routes/capabilities.ts +107 -6
  330. package/src/routes/channels.ts +20 -3
  331. package/src/routes/claude-subscription-accounts.ts +334 -0
  332. package/src/routes/claude-subscription-oauth.ts +142 -0
  333. package/src/routes/client-errors.ts +362 -0
  334. package/src/routes/codex.ts +833 -116
  335. package/src/routes/company-brain.ts +322 -0
  336. package/src/routes/company-profile.ts +65 -1
  337. package/src/routes/computer-sessions.ts +557 -106
  338. package/src/routes/connect.ts +1938 -0
  339. package/src/routes/connections.ts +1040 -349
  340. package/src/routes/documents.ts +488 -287
  341. package/src/routes/editable-artifacts.ts +79 -9
  342. package/src/routes/enrollments.ts +135 -39
  343. package/src/routes/environments.ts +154 -58
  344. package/src/routes/external-identity-links.ts +201 -0
  345. package/src/routes/feedback.ts +113 -0
  346. package/src/routes/files.ts +337 -39
  347. package/src/routes/github-browser-pages.ts +162 -0
  348. package/src/routes/github.ts +446 -144
  349. package/src/routes/insights-response-cache.ts +83 -0
  350. package/src/routes/insights-usage.ts +345 -0
  351. package/src/routes/insights.ts +153 -19
  352. package/src/routes/install.ts +133 -38
  353. package/src/routes/integration-facets.ts +107 -33
  354. package/src/routes/interaction-resources.ts +30 -3
  355. package/src/routes/knowledge.ts +488 -0
  356. package/src/routes/machines.ts +313 -15
  357. package/src/routes/managed-auth-session-sets.ts +1218 -0
  358. package/src/routes/managed-onboarding.ts +337 -0
  359. package/src/routes/managed-sign-in-methods.ts +433 -0
  360. package/src/routes/memory-slack-publications.ts +3 -2
  361. package/src/routes/model-connection-access.ts +208 -0
  362. package/src/routes/organization-integration-policy.ts +116 -0
  363. package/src/routes/organization-integrations.ts +326 -0
  364. package/src/routes/organization-mcp-connections.ts +178 -0
  365. package/src/routes/organization-memberships.ts +1019 -27
  366. package/src/routes/organization-model-providers.ts +293 -0
  367. package/src/routes/organization-recovery.ts +325 -0
  368. package/src/routes/organization-service-accounts.ts +128 -0
  369. package/src/routes/organization-sessions.ts +350 -0
  370. package/src/routes/personal-github-git-broker.ts +785 -0
  371. package/src/routes/personal-github.ts +370 -0
  372. package/src/routes/plugins.ts +251 -22
  373. package/src/routes/pr-review-github.ts +881 -0
  374. package/src/routes/pr-review.ts +622 -0
  375. package/src/routes/preference-registry.ts +12 -93
  376. package/src/routes/rigs.ts +167 -50
  377. package/src/routes/scheduled-tasks.ts +346 -41
  378. package/src/routes/session-artifact-associations.ts +87 -0
  379. package/src/routes/session-history-imports.ts +280 -0
  380. package/src/routes/sessions.ts +2306 -264
  381. package/src/routes/skill-content.ts +297 -0
  382. package/src/routes/skill-install-authority.ts +64 -0
  383. package/src/routes/skills.ts +62 -9
  384. package/src/routes/social.ts +46 -18
  385. package/src/routes/subscription-account-pools.ts +436 -0
  386. package/src/routes/subscription-pool-access.ts +126 -0
  387. package/src/routes/supergrok.ts +219 -303
  388. package/src/routes/transcription-recordings.ts +38 -3
  389. package/src/routes/transcriptions.ts +4 -0
  390. package/src/routes/usage-allowances.ts +378 -0
  391. package/src/routes/user-resource-authorities.ts +138 -0
  392. package/src/routes/video-generation.ts +14 -10
  393. package/src/routes/workspace-artifacts.ts +275 -69
  394. package/src/routes/workspace-capture.ts +21 -0
  395. package/src/routes/workspace-integrations.ts +576 -0
  396. package/src/routes/workspace-learning.ts +159 -0
  397. package/src/routes/workspace-model-providers.ts +148 -0
  398. package/src/routes/workspace-state.ts +38 -25
  399. package/src/routes/workspaces.ts +1004 -127
  400. package/src/sandbox/auth-callout.ts +96 -19
  401. package/src/sandbox/channel-a.ts +323 -24
  402. package/src/sandbox/connection-authority.ts +3 -0
  403. package/src/sandbox/enrollment.ts +81 -6
  404. package/src/sandbox/machines.ts +218 -76
  405. package/src/sandbox/metrics-ingestion.ts +411 -62
  406. package/src/sandbox/rematerialize.ts +121 -19
  407. package/src/sandbox/session-attach-variable-sets.ts +131 -0
  408. package/src/sandbox/viewer.ts +280 -25
  409. package/src/sandbox-file-artifacts.ts +413 -0
  410. package/src/scheduled-task-deletion.ts +138 -0
  411. package/src/session-create-observability.ts +46 -0
  412. package/src/session-realtime-context.ts +6 -3
  413. package/src/site-session-origin.ts +48 -0
  414. package/src/site-uploads.ts +224 -0
  415. package/src/slack-reaction-files.ts +16 -5
  416. package/src/temporal-schedule-cleanup.ts +13 -0
  417. package/src/temporal-schedule-sync.ts +74 -0
  418. package/src/transcription/providers/codex-subscription.ts +2 -0
  419. package/src/transcription/providers/openai.ts +1 -0
  420. package/src/transcription/providers/xai-subscription.ts +49 -3
  421. package/src/transcription/segmenter.ts +8 -2
  422. package/src/transcription/service.ts +43 -6
  423. package/src/work-discovery-observability.ts +121 -0
  424. package/src/workspace-artifact-content.ts +144 -0
  425. package/src/workspace-artifact-provenance.ts +104 -0
  426. package/src/workspace-delete-observability.ts +75 -0
  427. package/src/workspace-deletion.ts +73 -0
  428. package/src/workspace-state-projection.ts +18 -148
  429. package/src/workspace-tool-gateway-observability.ts +100 -0
  430. package/src/workspace-tool-gateway.ts +870 -0
  431. package/src/workspace-webhook-dispatch.ts +190 -0
  432. package/src/xai-subscription-auth.ts +9 -2
  433. package/dist/chunk-2PQMSRCB.js +0 -49759
  434. package/dist/chunk-2PQMSRCB.js.map +0 -1
  435. package/dist/routes/packs.d.ts +0 -3
  436. package/src/routes/packs.ts +0 -729
@@ -1,20 +1,33 @@
1
- import { type FileResourceRef, type WorkspaceSlackReactionSummonSettings } from "@opengeni/contracts";
2
- import { type SlackInstallationRoute, type SlackInteractionInboxEntry, type SlackInteractionTriggerKind } from "@opengeni/db";
1
+ import { type FileResourceRef, type FirstPartyMcpToolName, type WorkspaceSlackReactionSummonSettings } from "@opengeni/contracts";
2
+ import { type Settings } from "@opengeni/config";
3
+ import { type SlackInstallationRoute, type SlackInteraction, type SlackInteractionInboxEntry, type SlackInteractionTriggerKind } from "@opengeni/db";
3
4
  import { type ApiRouteDeps } from "@opengeni/core";
4
5
  import type { Hono } from "hono";
5
- import { type OpenGeniSlackBotClient } from "./slack-bot.js";
6
+ import { HTTPException } from "hono/http-exception";
7
+ import { type OpenGeniSlackBotClient, type SlackMessageBlock } from "./slack-bot.js";
6
8
  import { type ImportedSlackReactionImage } from "../slack-reaction-files.js";
7
9
  export declare const SLACK_INTERACTION_MAX_BODY_BYTES: number;
8
10
  export declare const SLACK_SIGNATURE_REPLAY_WINDOW_SECONDS = 300;
9
- export declare const SLACK_DELIVERY_EVENT_TYPES: readonly ["agent.message.completed", "session.humanInput.requested", "session.requiresAction", "turn.completed", "turn.failed", "turn.cancelled", "session.status.changed"];
10
- export declare const SLACK_TASK_INSTRUCTIONS: string;
11
+ export declare const SLACK_DELIVERY_EVENT_TYPES: readonly ["agent.message.completed", "session.humanInput.requested", "session.requiresAction", "turn.completed", "turn.failed", "turn.cancelled", "session.status.changed", "system.update.pending", "goal.paused"];
12
+ /**
13
+ * Slack delivery restrictions are durable session-level authority, not
14
+ * attacker-adjacent user-message context. Migration 0240 backfills this exact
15
+ * policy onto every pre-cutover session reserved by a Slack interaction.
16
+ */
17
+ export declare const SLACK_SESSION_INSTRUCTIONS: string;
11
18
  /**
12
19
  * Slack-originated tasks may retrieve the workspace bot's bounded read surface
13
- * on demand. Connector tools are explicit-only, so freeze that narrow context
14
- * selection at session creation while keeping Slack mutations out of the model
15
- * surface; interaction delivery remains owned by the durable delivery pump.
20
+ * and explicitly deliver a retained task file to their own thread. Connector
21
+ * tools are explicit-only, so freeze that narrow selection at session creation;
22
+ * ordinary interaction messages remain owned by the durable delivery pump.
16
23
  */
17
- export declare const SLACK_TASK_FIRST_PARTY_MCP_TOOLS: ("artifacts_create" | "artifacts_get_source" | "artifacts_list" | "artifacts_publish" | "artifacts_rollback" | "atlassian_get" | "atlassian_search" | "atlassian_sources_list" | "browser_act" | "browser_auth" | "browser_clipboard" | "browser_debug" | "browser_identity" | "browser_lifecycle" | "browser_observe" | "browser_open" | "browser_publish" | "browser_tabs" | "capability_authorization_request" | "capability_catalog_search" | "computer_act" | "computer_clipboard" | "computer_lifecycle" | "computer_observe" | "computer_open" | "computer_targets" | "connected_machine_remove" | "editable_artifact_apply" | "editable_artifact_create" | "editable_artifact_export" | "editable_artifact_export_status" | "editable_artifact_get" | "editable_artifact_import" | "editable_artifact_inspect" | "editable_artifact_list" | "environment_list" | "environment_set_variable" | "fiken_bank_accounts_list" | "fiken_companies_list" | "fiken_contact_create" | "fiken_contacts_list" | "fiken_invoice_draft_create" | "fiken_invoice_get" | "fiken_invoices_list" | "fiken_products_list" | "fiken_purchases_list" | "fiken_sales_list" | "github_connect_link" | "github_repositories_list" | "goal_complete" | "goal_pause" | "goal_progress" | "goal_set" | "goal_update" | "interaction_discover" | "interaction_request_human" | "memory_correct" | "memory_save" | "memory_search" | "preference_registry_get" | "preference_registry_summary" | "reddit_accounts_list" | "reddit_mentions_live" | "reddit_post_reply" | "reddit_posts_sync" | "reddit_search_live" | "reddit_thread_fetch" | "rig_get" | "rig_list" | "rig_promote" | "rig_propose_change" | "rig_verify" | "run_on" | "sandbox_attach" | "sandbox_provision" | "sandbox_swap" | "sandboxes_list" | "scheduled_task_runs_list" | "scheduled_tasks_create" | "scheduled_tasks_delete" | "scheduled_tasks_get" | "scheduled_tasks_list" | "scheduled_tasks_pause" | "scheduled_tasks_resume" | "scheduled_tasks_trigger" | "scheduled_tasks_update" | "session_create" | "session_events" | "session_get" | "session_pause" | "session_resume" | "session_send_message" | "session_steer" | "sessions_list" | "set_other_session_title" | "set_session_title" | "slack_bot_channel_history" | "slack_bot_delete_message" | "slack_bot_file_content" | "slack_bot_file_info" | "slack_bot_list_channels" | "slack_bot_list_files" | "slack_bot_list_users" | "slack_bot_post_message" | "slack_bot_thread_replies" | "social_connections_list" | "social_daily_analysis_context" | "social_mentions_live" | "social_post_reply" | "social_posts_recent" | "social_posts_sync" | "social_search_live" | "social_thread_fetch" | "task_note_archive" | "task_note_save" | "task_notes_list" | "variable_set_get_variable" | "variable_set_list" | "variable_set_set_variable" | "x_accounts_list" | "x_mentions_live" | "x_post_reply" | "x_posts_sync" | "x_search_live" | "x_thread_fetch")[];
24
+ export declare const SLACK_TASK_FIRST_PARTY_MCP_TOOLS: ("artifacts_archive" | "artifacts_create" | "artifacts_get_source" | "artifacts_list" | "artifacts_prepare_upload" | "artifacts_publish" | "artifacts_restore" | "artifacts_rollback" | "atlassian_get" | "atlassian_search" | "atlassian_sources_list" | "browser_act" | "browser_auth" | "browser_clipboard" | "browser_debug" | "browser_download_save" | "browser_downloads" | "browser_identity" | "browser_lifecycle" | "browser_observe" | "browser_open" | "browser_publish" | "browser_read" | "browser_screenshot" | "browser_tabs" | "capability_authorization_request" | "capability_catalog_search" | "command_read" | "command_wait" | "company_profile_confirm" | "company_profile_propose" | "computer_act" | "computer_clipboard" | "computer_lifecycle" | "computer_observe" | "computer_open" | "computer_targets" | "connected_machine_enroll_token" | "connected_machine_remove" | "custom_mcp_setup_request" | "editable_artifact_apply" | "editable_artifact_create" | "editable_artifact_export" | "editable_artifact_export_status" | "editable_artifact_get" | "editable_artifact_import" | "editable_artifact_inspect" | "editable_artifact_list" | "environment_list" | "environment_set_variable" | "fiken_bank_accounts_list" | "fiken_companies_list" | "fiken_contact_create" | "fiken_contacts_list" | "fiken_invoice_draft_create" | "fiken_invoice_get" | "fiken_invoices_list" | "fiken_products_list" | "fiken_purchases_list" | "fiken_sales_list" | "github_connect_link" | "github_repositories_list" | "goal_complete" | "goal_pause" | "goal_progress" | "goal_resume" | "goal_set" | "goal_update" | "instruction_policy_get" | "instruction_policy_propose" | "instruction_policy_save" | "interaction_discover" | "interaction_request_human" | "knowledge_archive" | "knowledge_browse" | "knowledge_correct" | "knowledge_get" | "knowledge_prepare_save" | "knowledge_propose" | "knowledge_retain_file" | "knowledge_retain_message" | "knowledge_save" | "knowledge_search" | "memory_correct" | "memory_save" | "memory_search" | "preference_propose" | "preference_registry_get" | "preference_registry_summary" | "project_create" | "project_delete" | "project_get" | "project_list" | "project_reorder" | "project_update" | "reddit_accounts_list" | "reddit_mentions_live" | "reddit_post_reply" | "reddit_posts_sync" | "reddit_search_live" | "reddit_thread_fetch" | "remember" | "remember_confirm" | "rig_get" | "rig_list" | "rig_promote" | "rig_propose_change" | "rig_verify" | "run_on" | "sandbox_attach" | "sandbox_file_publish" | "sandbox_provision" | "sandbox_swap" | "sandboxes_list" | "scheduled_task_runs_list" | "scheduled_tasks_create" | "scheduled_tasks_delete" | "scheduled_tasks_get" | "scheduled_tasks_list" | "scheduled_tasks_pause" | "scheduled_tasks_resume" | "scheduled_tasks_trigger" | "scheduled_tasks_update" | "session_create" | "session_events" | "session_get" | "session_human_input_respond" | "session_pause" | "session_resume" | "session_send_message" | "session_set_model" | "session_set_project" | "session_steer" | "session_wait" | "sessions_list" | "set_other_session_title" | "set_session_title" | "slack_bot_channel_history" | "slack_bot_delete_message" | "slack_bot_file_content" | "slack_bot_file_info" | "slack_bot_list_channels" | "slack_bot_list_files" | "slack_bot_list_users" | "slack_bot_post_message" | "slack_bot_prepare_message" | "slack_bot_search" | "slack_bot_send_prepared_message" | "slack_bot_thread_replies" | "slack_bot_upload_file" | "social_connections_list" | "social_daily_analysis_context" | "social_mentions_live" | "social_post_reply" | "social_posts_recent" | "social_posts_sync" | "social_search_live" | "social_thread_fetch" | "task_note_archive" | "task_note_promote_instruction_policy" | "task_note_promote_knowledge" | "task_note_promote_preference" | "task_note_replace" | "task_note_save" | "task_notes_list" | "variable_set_get_variable" | "variable_set_list" | "variable_set_set_variable" | "wait_for_input" | "work_claim_release" | "work_claim_upsert" | "x_accounts_list" | "x_mentions_live" | "x_post_reply" | "x_posts_sync" | "x_search_live" | "x_thread_fetch")[];
25
+ /**
26
+ * The workspace's default first-party selection (or the deployment default)
27
+ * plus the bounded Slack task tools. These are added whatever the base is, then
28
+ * intersected with deployment policy; existing accepted selections stay frozen.
29
+ */
30
+ export declare function slackTaskFirstPartyMcpTools(settings: Settings, workspaceSettings: unknown): FirstPartyMcpToolName[];
18
31
  export type NormalizedSlackInteraction = {
19
32
  providerEventId: string;
20
33
  providerMessageId: string;
@@ -48,12 +61,100 @@ export declare function startSlackInteractionPump(deps: ApiRouteDeps, options?:
48
61
  intervalMs?: number;
49
62
  maxPerTick?: number;
50
63
  }): () => void;
64
+ /**
65
+ * Say where the work went, quietly.
66
+ *
67
+ * The line exists to stop work landing somewhere surprising, so it appears only
68
+ * when the routing decision was a genuine choice: a null label means routing is
69
+ * off, or the person had exactly one workspace anyway, and a constant footer on
70
+ * every message would be noise rather than information.
71
+ *
72
+ * The label is frozen on the interaction rather than looked up here, because a
73
+ * workspace rename between the original post and a reconciliation would make the
74
+ * post ledger's byte comparison raise.
75
+ */
76
+ export declare function withWorkspaceLine(label: string | null, text: string, blocks?: SlackMessageBlock[]): {
77
+ text: string;
78
+ blocks?: SlackMessageBlock[];
79
+ };
80
+ /**
81
+ * The post-ledger seed for one interaction's messages.
82
+ *
83
+ * The ledger binds one operation id to a digest over the rendered bytes, so
84
+ * adding the workspace line under an unchanged id would wedge every interaction
85
+ * with a claimed-but-unposted row. But bumping the id for interactions whose
86
+ * bytes did NOT change is not free either: their ledger rows become unreachable,
87
+ * so a repair or a cross-deploy retry posts a duplicate instead of finding the
88
+ * completed original, and an action handle still points at the old operation.
89
+ *
90
+ * Only a labelled interaction renders different bytes, and the label is written
91
+ * once at insert and never updated, so it is a stable discriminator. Version the
92
+ * id on the label rather than on the release: a labelled interaction can only
93
+ * have been created by an image that already renders the line, and every
94
+ * pre-existing and unlabelled interaction keeps its exact ledger identity.
95
+ *
96
+ * A compact interaction (one with a frozen `startMessageLine`) names its
97
+ * workspace once, on its first message, and nowhere else. For a labelled one
98
+ * that is again different bytes from what an older image renders for the same
99
+ * message, so its ids move once more, to `:v3`. Unlabelled interactions render
100
+ * the same bytes in both formats and keep their ids.
101
+ */
102
+ export declare function slackPostSeed(interaction: Pick<SlackInteraction, "routedWorkspaceLabel" | "startMessageLine">, seed: string): string;
103
+ /**
104
+ * The acknowledgement seed for interactions that already carry a frozen
105
+ * "Using" line from before new acknowledgements stopped including it.
106
+ *
107
+ * The old line was written once at session bind and never changes, so a
108
+ * historical retry must keep the same ledger identity and bytes. New
109
+ * interactions bind no line and use the original acknowledgement seed.
110
+ */
111
+ export declare function slackDefaultsLinePostSeed(interaction: Pick<SlackInteraction, "sessionDefaultsLine">, seed: string): string;
112
+ /**
113
+ * The post operation of an interaction's first message.
114
+ *
115
+ * A compact first message shares no bytes with anything an older image renders
116
+ * for the same interaction, so it has its own seed: an older image repairing it
117
+ * during a rolling deploy posts a second message rather than wedging on a digest
118
+ * conflict. Every handle on the first message carries this id.
119
+ */
120
+ export declare function slackAcknowledgementOperationId(interaction: Pick<SlackInteraction, "id" | "routedWorkspaceLabel" | "sessionDefaultsLine" | "startMessageLine">): string;
121
+ /** Where a compact task's first message says the task came from. */
122
+ export type SlackStartMessageOrigin = {
123
+ kind: "task";
124
+ } | {
125
+ kind: "private_dm_message";
126
+ } | {
127
+ kind: "private_conversation";
128
+ } | {
129
+ kind: "reaction";
130
+ emoji: string;
131
+ };
132
+ /**
133
+ * The opening sentence of a new task's first Slack message.
134
+ *
135
+ * The sentence itself links to the session, and a routed workspace is named
136
+ * inline, here and on no other message. The private variants keep their privacy
137
+ * sentence, and the reaction variant keeps its how-to, because a reaction-started
138
+ * task has no button and never shows the one-time hint.
139
+ *
140
+ * Rendered once when the session binds and frozen as `startMessageLine`, so a
141
+ * later change to the web base URL or the workspace name cannot change the bytes
142
+ * of a message the post and update ledgers already hold.
143
+ */
144
+ export declare function renderSlackStartMessageLine(input: {
145
+ sessionUrl: string;
146
+ routedWorkspaceLabel: string | null;
147
+ origin: SlackStartMessageOrigin;
148
+ }): string;
51
149
  export type SlackInvocationMessageContext = {
52
150
  messages: Awaited<ReturnType<OpenGeniSlackBotClient["threadReplies"]>>["messages"];
53
151
  nextCursor: string | null;
54
152
  kind: "thread" | "channel";
153
+ unavailable?: "rate_limited" | "attachments_only";
55
154
  };
56
- export declare function slackInvocationTaskText(entry: Pick<SlackInteractionInboxEntry, "slackMessageTs" | "slackUserId" | "text">, context: SlackInvocationMessageContext): string;
155
+ /** Context is optional; only Slack's explicit history throttling may be omitted. */
156
+ export declare function loadSlackInvocationMessageContext(client: Pick<OpenGeniSlackBotClient, "threadReplies" | "channelHistory">, entry: Pick<SlackInteractionInboxEntry, "slackChannelId" | "slackThreadTs" | "slackMessageTs">, authorizeRead?: () => Promise<void>, exactMessageOnly?: boolean): Promise<SlackInvocationMessageContext>;
157
+ export declare function slackInvocationModelContext(invocationTimestamp: string, context: SlackInvocationMessageContext): string;
57
158
  type SlackReactionMessageContext = Awaited<ReturnType<OpenGeniSlackBotClient["reactionMessageContext"]>>;
58
159
  type PreparedSlackReactionTask = Readonly<{
59
160
  resources: FileResourceRef[];
@@ -64,6 +165,7 @@ type PreparedSlackReactionTask = Readonly<{
64
165
  export declare function slackReactionTaskText(context: SlackReactionMessageContext, prepared?: PreparedSlackReactionTask): string;
65
166
  export declare function slackDeliveryTextsCoalesce(left: string, right: string): boolean;
66
167
  export declare function normalizedBlockActionInteraction(payload: Record<string, unknown>): NormalizedSlackInteraction;
168
+ export declare function isSlackInfoCommand(text: string): boolean;
67
169
  type SlackUserLinkToken = {
68
170
  workspaceId: string;
69
171
  connectionId: string;
@@ -73,4 +175,5 @@ type SlackUserLinkToken = {
73
175
  };
74
176
  export declare function createSlackUserLinkToken(signingSecret: string, entry: Pick<SlackInteractionInboxEntry, "workspaceId" | "connectionId" | "slackTeamId" | "slackUserId">, nowMs?: number): string;
75
177
  export declare function verifySlackUserLinkToken(signingSecret: string, token: string, nowMs?: number): SlackUserLinkToken | null;
178
+ export declare function slackAdmissionFailureText(error: HTTPException): string;
76
179
  export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Markdown to Slack mrkdwn for model-authored text OpenGeni posts to Slack.
3
+ *
4
+ * Agents write ordinary Markdown because the same reply renders as Markdown in
5
+ * the OpenGeni console. Slack message text does not render Markdown headings,
6
+ * `**bold**`, or `[label](url)` links, so a reply that reads well in the
7
+ * console arrives in Slack full of literal syntax. This rewrites only that
8
+ * syntax, only for the bytes handed to Slack: stored session events, model
9
+ * history, and every other surface keep the model's exact text. It is
10
+ * formatting at a third-party sink, not content classification or redaction.
11
+ *
12
+ * Code is never rewritten: fenced code blocks keep every line between their
13
+ * fences, and inline code spans are copied as they are.
14
+ *
15
+ * The output is part of the Slack post and update ledgers' request digest, so a
16
+ * change to it changes the bytes an in-flight operation is bound to. Delivery
17
+ * (`deliverSlackModelText` in `slack-interactions.ts`) falls back only to the
18
+ * unformatted text; a later output change must keep the previous rendering
19
+ * reachable the same way, or operations started before the deploy conflict on
20
+ * every retry.
21
+ */
22
+ /** Remove provider citation handles and any stray citation delimiters. */
23
+ export declare function stripProviderCitationMarkers(text: string): string;
24
+ /**
25
+ * Rewrite common Markdown as Slack mrkdwn.
26
+ *
27
+ * - `# Heading` (any level) becomes a bold line.
28
+ * - `**bold**` and `__bold__` become `*bold*`, `***both***` becomes `*_both_*`,
29
+ * and `~~struck~~` becomes `~struck~`.
30
+ * - `[label](https://...)` becomes `<https://...|label>`.
31
+ * - `-`, `*`, and `+` bullets become Slack's `•` bullet, keeping indentation;
32
+ * numbered lists and block quotes are already Slack syntax and stay as they are.
33
+ * - Fenced code blocks, at any indentation, keep their contents byte for byte.
34
+ * The opening fence loses its language tag, which Slack would otherwise print
35
+ * as the first code line, and an unclosed block is closed so Slack still
36
+ * renders it as code.
37
+ * - Provider citation handles are removed.
38
+ *
39
+ * Text that uses none of this syntax comes back unchanged.
40
+ */
41
+ export declare function slackMrkdwnFromMarkdown(markdown: string): string;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Per-channel and per-DM Slack workspace routing.
3
+ *
4
+ * Routing is decided BEFORE any agent runs, from durable facts only, so it can
5
+ * never be a model judgement. The resolver is pure with respect to the database
6
+ * reads it is handed: it returns a decision, and the caller persists and acts on
7
+ * it.
8
+ *
9
+ * Two rules are load-bearing and easy to break by accident:
10
+ *
11
+ * A mapped thread keeps the workspace it was created in, unconditionally,
12
+ * including after the channel has been re-pointed. Otherwise a live
13
+ * conversation would silently change tenants mid-thread.
14
+ *
15
+ * A subject who lacks access to the routed workspace is NEVER quietly served
16
+ * from another workspace they happen to belong to. Every failure is explicit
17
+ * and creates no session.
18
+ */
19
+ import type { AccessGrant } from "@opengeni/contracts";
20
+ import type { SlackChannelRoute, SlackInteractionInboxEntry, SlackRoutableWorkspace, SlackUserDmRoute } from "@opengeni/db";
21
+ export type SlackRouteTenancy = {
22
+ accountId: string;
23
+ workspaceId: string;
24
+ };
25
+ export type SlackRouteResolution = (SlackRouteTenancy & {
26
+ kind: "resolved";
27
+ label: string | null;
28
+ source: "thread" | "prefix" | "channel" | "dm_route" | "dm_personal" | "sole_candidate" | "installation";
29
+ }) | {
30
+ kind: "ask";
31
+ candidates: readonly SlackRoutableWorkspace[];
32
+ } | {
33
+ kind: "denied";
34
+ reason: "no_access_to_named" | "no_access_to_route" | "no_candidates";
35
+ requested: string | null;
36
+ candidates: readonly SlackRoutableWorkspace[];
37
+ };
38
+ /**
39
+ * A Slack direct message to the bot, by any trigger that can carry one.
40
+ *
41
+ * `isDirectMessageShortcut` is deliberately narrower: it means "a message
42
+ * shortcut invoked inside a DM", which is a private-handoff concern. Routing
43
+ * cares about the broader question of whether this conversation is one human's
44
+ * private channel with the bot, which is also true of an ordinary `dm` event.
45
+ */
46
+ export declare function isSlackDirectMessageConversation(entry: Pick<SlackInteractionInboxEntry, "triggerKind" | "slackChannelId">): boolean;
47
+ /**
48
+ * Split a leading bot mention off the message text.
49
+ *
50
+ * Slack delivers an `app_mention` with the mention still in the text
51
+ * (`<@U123> do the thing`), and OpenGeni stores it verbatim. The workspace
52
+ * prefix is only an override when it is the first thing the person typed, so it
53
+ * is parsed after the mention rather than at byte 0 of the raw text. Everything
54
+ * split off here is put back, so the message the model sees is unchanged apart
55
+ * from the addressing the person used to route it.
56
+ */
57
+ export declare function splitSlackLeadingMention(text: string, botUserId: string | null): {
58
+ lead: string;
59
+ rest: string;
60
+ };
61
+ /**
62
+ * The strict `in <workspace>: ...` override.
63
+ *
64
+ * Parsed only at byte 0, so ordinary prose that happens to contain the word
65
+ * cannot trigger it, and matched case-insensitively against the exact label of a
66
+ * workspace the subject can already start work in. A prefix that names nothing
67
+ * recognizable is NOT a suggestion that falls through: it is a refusal, because
68
+ * silently ignoring an explicit override is how a message lands somewhere the
69
+ * person did not intend.
70
+ */
71
+ export declare function parseSlackWorkspacePrefix(text: string): {
72
+ requested: string;
73
+ remainder: string;
74
+ } | null;
75
+ export type SlackRouteInputs = {
76
+ /** The installation binding's tenancy. Always the fallback, never a silent one. */
77
+ home: SlackRouteTenancy;
78
+ entry: Pick<SlackInteractionInboxEntry, "triggerKind" | "slackChannelId" | "slackUserId" | "text">;
79
+ /**
80
+ * The tenancy of an interaction already mapped to this thread, if any. A
81
+ * mapped thread wins unconditionally.
82
+ */
83
+ threadTenancy: SlackRouteTenancy | null;
84
+ channelRoute: SlackChannelRoute | null;
85
+ dmRoute: SlackUserDmRoute | null;
86
+ /** The subject's own personal workspace in the home organization, if any. */
87
+ personalWorkspaceId: string | null;
88
+ /** Workspaces this subject may actually start work in, ordered stably. */
89
+ candidates: readonly SlackRoutableWorkspace[];
90
+ /** The installation's bot user, so a mention does not hide the prefix. */
91
+ botUserId: string | null;
92
+ /** `OPENGENI_SLACK_WORKSPACE_ROUTING_ENABLED`. */
93
+ routingEnabled: boolean;
94
+ /** Whether the first-use picker exists yet. Until it does, ambiguity keeps home. */
95
+ askEnabled: boolean;
96
+ };
97
+ /**
98
+ * Decide which workspace this Slack message starts work in.
99
+ *
100
+ * First match wins, and the order is deliberate: continuity beats an explicit
101
+ * override beats configuration beats derivation beats asking.
102
+ */
103
+ export declare function resolveSlackWorkspaceRoute(input: SlackRouteInputs): SlackRouteResolution;
104
+ /**
105
+ * The message text the model actually sees.
106
+ *
107
+ * A prefix override is addressing information, not part of the request, so it is
108
+ * stripped exactly once and only when it matched.
109
+ */
110
+ export declare function slackRoutedRequestText(text: string, resolution: SlackRouteResolution, botUserId: string | null): string;
111
+ export type SlackRouteAuthorization = {
112
+ kind: "authorized";
113
+ grant: AccessGrant;
114
+ tenancy: SlackRouteTenancy;
115
+ label: string | null;
116
+ } | {
117
+ kind: "denied";
118
+ reason: "no_access_to_route";
119
+ tenancy: SlackRouteTenancy;
120
+ };
@@ -0,0 +1,58 @@
1
+ import { type AccessGrant, type GitHubRepository, type RepositoryResourceRef } from "@opengeni/contracts";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ /**
4
+ * A Slack task starts with at most this many repositories. Each one is a
5
+ * shallow, blob-filtered fetch before the first command, so the set stays
6
+ * small: the person's own most recently used repositories, not a catalog.
7
+ */
8
+ export declare const SLACK_SESSION_RECENT_REPOSITORY_LIMIT = 5;
9
+ /** How far back the person's own sessions count as recent use. */
10
+ export declare const SLACK_SESSION_RECENT_REPOSITORY_WINDOW_MS: number;
11
+ /**
12
+ * Pick a Slack task's repositories: the person's recently used repositories,
13
+ * in recency order, that the workspace GitHub App catalog still offers them.
14
+ *
15
+ * `recent` is a usage signal only, and only repositories the person attached
16
+ * themselves count: an automatically attached (`optional`) one never does. A
17
+ * repository reaches the task only through its current catalog entry (the
18
+ * same catalog and `github:use` permission as the website picker), on its
19
+ * default branch, so a Slack task never reaches a repository the person could
20
+ * not attach on the website today. Archived and
21
+ * empty repositories are skipped when GitHub reported that, because a clone of
22
+ * an empty repository has nothing to check out. Every returned resource is
23
+ * best effort (`optional`): one failed clone warns instead of failing setup.
24
+ */
25
+ export declare function selectRecentRepositoryResources(recent: readonly RepositoryResourceRef[], catalog: readonly GitHubRepository[], limit?: number): RepositoryResourceRef[];
26
+ /**
27
+ * The repositories a new Slack task starts with: the person's own recently
28
+ * used repositories in this workspace (their own top-level sessions active in
29
+ * the last 30 days, most recent first, at most five), limited to what the
30
+ * workspace GitHub App catalog offers them now. None when they have none; the
31
+ * agent can still find and clone repositories through its GitHub tools.
32
+ *
33
+ * GitHub is asked only when there is something to look up. A GitHub outage or
34
+ * an unconfigured App starts the task without repositories instead of failing
35
+ * it, with a log line for diagnosis.
36
+ */
37
+ export declare function slackRecentRepositoryResources(deps: ApiRouteDeps, grant: Pick<AccessGrant, "permissions" | "subjectId">, workspaceId: string, now?: Date): Promise<RepositoryResourceRef[]>;
38
+ export type OtherDeploymentLink = {
39
+ url: string;
40
+ host: string;
41
+ };
42
+ /**
43
+ * OpenGeni workspace or session links in `text` that point at a sibling
44
+ * deployment of this one (for example staging versus production).
45
+ *
46
+ * A sibling is a different host under the same parent domain as this
47
+ * deployment's web origin, carrying OpenGeni's own route shape. Anything else
48
+ * is left alone: an unrelated product's URL must never be described as
49
+ * another OpenGeni.
50
+ */
51
+ export declare function otherDeploymentLinks(text: string, webBaseUrl: string | null | undefined): OtherDeploymentLink[];
52
+ /**
53
+ * Model context for links to another OpenGeni deployment. A session id from
54
+ * one deployment does not exist in another, so without this the agent reports
55
+ * "Session not found or access denied" and asks for access that no grant in
56
+ * this deployment can give.
57
+ */
58
+ export declare function otherDeploymentLinkContext(text: string, webBaseUrl: string | null | undefined): string | null;
@@ -0,0 +1,36 @@
1
+ import { type AccessGrant } from "@opengeni/contracts";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ import { type SlackInteraction } from "@opengeni/db";
4
+ export declare const SLACK_TASK_FILE_UPLOAD_MAX_BYTES: number;
5
+ /** The source and destination are canonical authorities, never a URL or channel supplied by the model. */
6
+ export declare function uploadSlackTaskFile(deps: ApiRouteDeps, input: {
7
+ grant: AccessGrant;
8
+ sessionId: string;
9
+ fileId: string;
10
+ operationId: string;
11
+ authorize: () => Promise<void>;
12
+ }): Promise<{
13
+ slackFileId: string;
14
+ replayed: boolean;
15
+ status: "uploaded";
16
+ fileId: string;
17
+ channelId: string;
18
+ threadTimestamp: string;
19
+ receipt: {
20
+ credentialRole: "opengeni_slack_bot";
21
+ credentialLabel: "OpenGeni Slack bot";
22
+ connectionId: string;
23
+ slackTeamId: string;
24
+ operation: string;
25
+ operationId: string;
26
+ };
27
+ }>;
28
+ export declare function slackTaskRequesterCanReceiveFile(permissions: AccessGrant["permissions"]): boolean;
29
+ /** Private shortcuts bind a runnable session before its bot-DM route commits. */
30
+ export declare function assertSlackTaskUploadTarget(interaction: Pick<SlackInteraction, "visibility" | "slackChannelId" | "slackThreadTs" | "routeKey" | "ackSlackMessageTs">): void;
31
+ export declare function assertSlackTaskUploadFile(file: {
32
+ status: string;
33
+ scope?: string | undefined;
34
+ sizeBytes: number;
35
+ sha256: string | null;
36
+ }, visibility: string): void;
@@ -42,9 +42,15 @@ type SocialOAuthDeps = {
42
42
  providerFetch?: SocialProviderFetch | undefined;
43
43
  };
44
44
  export type SocialOAuthStartContext = {
45
+ connectAttemptId?: string;
45
46
  accountId: string;
46
47
  workspaceId: string;
47
48
  subjectId: string;
49
+ /**
50
+ * False for every principal that cannot own a personal Connection. Resolved
51
+ * by the route from the live authenticated principal, never inferred here.
52
+ */
53
+ personalOwnershipAllowed: boolean;
48
54
  requestUrl: string;
49
55
  payload: SocialOAuthStartRequest;
50
56
  };
@@ -61,6 +67,7 @@ export declare function completeSocialOAuthCallback(deps: SocialOAuthDeps, input
61
67
  requestUrl: string;
62
68
  }): Promise<{
63
69
  redirectTo: string;
70
+ exactReturn?: boolean;
64
71
  }>;
65
72
  /**
66
73
  * Resolves a usable access token for a social connection, refreshing (and
@@ -0,0 +1,15 @@
1
+ import type { AccessGrant } from "@opengeni/contracts";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ type AssociatedInteractionSession = {
4
+ associations: ReadonlyArray<{
5
+ sessionId: string;
6
+ relationship: string;
7
+ }>;
8
+ };
9
+ /**
10
+ * Apply the same source-chat authorization as get/control routes, for every
11
+ * caller. A later using/observing/related association never transfers ownership
12
+ * or makes a private interaction discoverable through another chat.
13
+ */
14
+ export declare function filterInteractionSessionsForGrant<T extends AssociatedInteractionSession>(deps: Pick<ApiRouteDeps, "db" | "sessionAuthorization">, grant: AccessGrant, sessions: readonly T[]): Promise<T[]>;
15
+ export {};
@@ -0,0 +1,68 @@
1
+ import type { ApiWebSocketConnection, ApiWebSocketLike, ApiWebSocketUpgradeServer } from "./api-websocket.js";
2
+ export declare const INTERACTION_FRAME_PROXY_PATH = "/v1/interaction/frame-proxy";
3
+ export declare const INTERACTION_FRAME_PROXY_PROTOCOL_PREFIX = "opengeni-frame-proxy.";
4
+ type ProxyGrant = Readonly<{
5
+ version: 1;
6
+ upstreamUrl: string;
7
+ upstreamProtocols: readonly string[];
8
+ responseProtocol: string;
9
+ origin: string | null;
10
+ expiresAt: number;
11
+ }>;
12
+ export type InteractionFrameProxyAttachment = Readonly<{
13
+ url: string;
14
+ protocols: readonly string[];
15
+ }>;
16
+ /** Docker boxes cannot carry browserd's WebSocket subprotocol grant to the
17
+ * viewer. Unsigned OpenSandbox Channel B still uses the lifecycle proxy, so
18
+ * it needs the same hatch. Signed URI-mode ingress keeps native subprotocols;
19
+ * `openSandboxInteractionFrameProxy` is an emergency override only. */
20
+ export declare function placementUsesInteractionFrameProxy(backend: string | null | undefined, options?: {
21
+ openSandboxSignedEndpoints?: boolean;
22
+ openSandboxInteractionFrameProxy?: boolean;
23
+ }): boolean;
24
+ /** Public origin the browser can open. TLS-terminating reverse proxies make
25
+ * `requestUrl` `http://127.0.0.1` / the API container; that would mint `ws://`
26
+ * and Chrome blocks it from an `https://` console. */
27
+ export declare function resolveInteractionFrameProxyRequestUrl(input: {
28
+ requestUrl: string;
29
+ publicBaseUrl?: string | undefined;
30
+ webBaseUrl?: string | undefined;
31
+ forwardedProto?: string | null | undefined;
32
+ forwardedHost?: string | null | undefined;
33
+ }): string;
34
+ export declare function createInteractionFrameProxyAttachment(input: {
35
+ requestUrl: string;
36
+ publicBaseUrl?: string | undefined;
37
+ webBaseUrl?: string | undefined;
38
+ forwardedProto?: string | null | undefined;
39
+ forwardedHost?: string | null | undefined;
40
+ rootSecret: string;
41
+ upstreamUrl: string;
42
+ upstreamProtocols: readonly string[];
43
+ origin: string | null;
44
+ expiresAt: string;
45
+ }): InteractionFrameProxyAttachment;
46
+ export declare class InteractionFrameProxyTransport {
47
+ private readonly rootSecret;
48
+ private readonly clock;
49
+ constructor(rootSecret: string | undefined, clock?: () => number);
50
+ handles(request: Request): boolean;
51
+ upgrade(request: Request, server: ApiWebSocketUpgradeServer): Response | undefined;
52
+ }
53
+ export declare class InteractionFrameProxyConnection implements ApiWebSocketConnection {
54
+ private readonly grant;
55
+ private socket;
56
+ private upstream;
57
+ private upstreamOpen;
58
+ private terminal;
59
+ private queued;
60
+ private queuedBytes;
61
+ constructor(grant: ProxyGrant);
62
+ attach(socket: ApiWebSocketLike): void;
63
+ receive(message: string | Uint8Array | ArrayBuffer): void;
64
+ transportClosed(): void;
65
+ private fail;
66
+ private clear;
67
+ }
68
+ export {};
@@ -1,9 +1,11 @@
1
1
  import type { AuthRunMutationResponse, BrowserActionReceipt, BrowserActionRequest, PublishBrowserRevisionResponse, BrowserSessionMutationResponse, ComputerActionReceipt, ComputerActionRequest, ComputerSessionMutationResponse, InteractionInterventionMutationResponse, ProtectedAuthFillResponse } from "@opengeni/contracts";
2
2
  import { type Observability } from "@opengeni/observability";
3
+ import type { ComputerFrameEvidenceMismatchReason } from "@opengeni/runtime/sandbox";
3
4
  type InteractionLifecycleMutation = BrowserSessionMutationResponse | ComputerSessionMutationResponse;
4
5
  type AuthMutation = AuthRunMutationResponse | ProtectedAuthFillResponse;
5
6
  export declare function observeBrowserActionResult(observability: Observability | null | undefined, startedAtMs: number, request: BrowserActionRequest, receipt: BrowserActionReceipt): void;
6
7
  export declare function observeComputerActionResult(observability: Observability | null | undefined, startedAtMs: number, request: ComputerActionRequest, receipt: ComputerActionReceipt): void;
8
+ export declare function observeComputerFrameEvidenceMismatch(observability: Observability | null | undefined, reason: ComputerFrameEvidenceMismatchReason): void;
7
9
  export declare function observeLifecycleResult(observability: Observability | null | undefined, startedAtMs: number, response: InteractionLifecycleMutation): void;
8
10
  export declare function observeBrowserRevisionPublication(observability: Observability | null | undefined, startedAtMs: number, response: PublishBrowserRevisionResponse): void;
9
11
  export declare function observeAuthMutation(observability: Observability | null | undefined, startedAtMs: number, response: AuthMutation): void;
@@ -0,0 +1,9 @@
1
+ export type ActionCatalogEntry = {
2
+ /** Stable name an agent calls: the SDK method ("listSessions"), else "METHOD /path". */
3
+ id: string;
4
+ method: string;
5
+ path: string;
6
+ /** Contract schema names for the JSON body and response, when known. */
7
+ request: string[];
8
+ response: string[];
9
+ };
@@ -0,0 +1,2 @@
1
+ import type { ActionCatalogEntry } from "./action-catalog-types.js";
2
+ export declare const ACTION_CATALOG: readonly ActionCatalogEntry[];
@@ -0,0 +1,7 @@
1
+ import type { McpConnectionAccountBinding } from "@opengeni/contracts";
2
+ /** Canonical readiness comes only from routes present in this exact attempt,
3
+ * joined to this turn's accepted bindings. It never grants account access. */
4
+ export declare function capabilityAccountReadiness(availableRoutes: Iterable<string>, bindings: readonly McpConnectionAccountBinding[] | null): {
5
+ available: Set<string>;
6
+ accepted: Set<string>;
7
+ };
@@ -0,0 +1,9 @@
1
+ /** Select only whole items that actually survived the model-facing envelope.
2
+ * A cursor is a position, never proof that preceding content was consumed. */
3
+ export declare function completeChildReadSequences(page: {
4
+ view: string;
5
+ sourceExact: boolean;
6
+ events: readonly ({
7
+ sequence: number;
8
+ } & Record<string, unknown>)[];
9
+ }): number[];
@@ -0,0 +1,24 @@
1
+ import type { SessionEvent } from "@opengeni/contracts";
2
+ export declare const COMMAND_READ_MAX_WAIT_SECONDS = 50;
3
+ export declare const COMMAND_WAIT_DEFAULT_SECONDS = 45;
4
+ /** Shared provider-neutral command_read/command_wait operation. Notifications
5
+ * are only wake hints. Every result, including timeout, comes from durable DB
6
+ * state. Subscribe before reading to close the finish/subscription race, and
7
+ * periodically recheck durable state because live hints may be lost. */
8
+ export declare function readCommandWithWait<T extends {
9
+ terminal: boolean;
10
+ chunks: unknown[];
11
+ hasMore?: boolean;
12
+ }>(input: {
13
+ commandId: string;
14
+ waitSeconds?: number;
15
+ maxOutputBytes?: number | undefined;
16
+ signal?: AbortSignal;
17
+ read: () => Promise<T>;
18
+ subscribe: (onEvents: (events: SessionEvent[]) => void) => Promise<() => void>;
19
+ }): Promise<T & {
20
+ waitedMs: number;
21
+ timedOut: boolean;
22
+ aborted: boolean;
23
+ liveFanout: boolean;
24
+ }>;