@opengeni/api-router 0.23.1 → 0.30.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 (152) hide show
  1. package/dist/app.d.ts +3 -2
  2. package/dist/app.js +5 -3
  3. package/dist/auth/canonical-human-session-admission.d.ts +27 -0
  4. package/dist/browser-auth-broker.d.ts +20 -0
  5. package/dist/browser-controller-authority.d.ts +61 -0
  6. package/dist/browser-network-route.d.ts +8 -0
  7. package/dist/browser-state-authority.d.ts +27 -0
  8. package/dist/{chunk-T4T2PGU4.js → chunk-2PQMSRCB.js} +37891 -17463
  9. package/dist/chunk-2PQMSRCB.js.map +1 -0
  10. package/dist/codemode.d.ts +23 -0
  11. package/dist/controller-data-plane.d.ts +12 -0
  12. package/dist/editable-artifact-live-hints.d.ts +11 -0
  13. package/dist/editable-artifact-native-kernel.d.ts +37 -0
  14. package/dist/editable-artifact-office-import.d.ts +22 -0
  15. package/dist/editable-artifact-production.d.ts +29 -0
  16. package/dist/editable-artifact-websocket.d.ts +49 -0
  17. package/dist/editable-artifact-workspace-files.d.ts +23 -0
  18. package/dist/github-browser-flow.d.ts +6 -0
  19. package/dist/http/auth.d.ts +1 -1
  20. package/dist/http/cors.d.ts +1 -0
  21. package/dist/http/sse.d.ts +18 -1
  22. package/dist/index.d.ts +3 -2
  23. package/dist/index.js +1796 -22
  24. package/dist/index.js.map +1 -1
  25. package/dist/integrations/api-integrations.d.ts +24 -0
  26. package/dist/integrations/atlassian.d.ts +176 -0
  27. package/dist/integrations/fiken.d.ts +233 -0
  28. package/dist/integrations/github-skill-source.d.ts +5 -0
  29. package/dist/integrations/google-drive.d.ts +85 -0
  30. package/dist/integrations/oauth-client.d.ts +22 -1
  31. package/dist/integrations/provider-oauth.d.ts +17 -0
  32. package/dist/integrations/slack-bot.d.ts +175 -1
  33. package/dist/integrations/slack-interactions.d.ts +24 -6
  34. package/dist/integrations/social-api.d.ts +2 -1
  35. package/dist/interaction-holder-heartbeat.d.ts +17 -0
  36. package/dist/interaction-metrics.d.ts +11 -0
  37. package/dist/mcp/editable-artifact-query-schema.d.ts +4 -0
  38. package/dist/mcp/editable-artifacts.d.ts +13 -0
  39. package/dist/mcp/scheduled-task-view.d.ts +168 -0
  40. package/dist/mcp/server.d.ts +16 -4
  41. package/dist/memory-slack-delivery.d.ts +9 -0
  42. package/dist/model-catalog.d.ts +1 -0
  43. package/dist/routes/api-integrations.d.ts +8 -0
  44. package/dist/routes/browser-identities.d.ts +5 -0
  45. package/dist/routes/browser-sessions.d.ts +6 -0
  46. package/dist/routes/canonical-human-identities.d.ts +3 -0
  47. package/dist/routes/channels.d.ts +3 -0
  48. package/dist/routes/company-profile.d.ts +3 -0
  49. package/dist/routes/computer-sessions.d.ts +6 -0
  50. package/dist/routes/editable-artifacts.d.ts +44 -0
  51. package/dist/routes/integration-facets.d.ts +3 -0
  52. package/dist/routes/interaction-resources.d.ts +5 -0
  53. package/dist/routes/memory-slack-publications.d.ts +6 -0
  54. package/dist/routes/organization-memberships.d.ts +3 -0
  55. package/dist/routes/plugins.d.ts +8 -0
  56. package/dist/routes/sessions.d.ts +18 -2
  57. package/dist/routes/skills.d.ts +6 -0
  58. package/dist/routes/slack-task-policy.d.ts +3 -0
  59. package/dist/routes/supergrok.d.ts +3 -0
  60. package/dist/routes/video-generation.d.ts +3 -0
  61. package/dist/sandbox/channel-a.d.ts +62 -2
  62. package/dist/sandbox/machines.d.ts +2 -2
  63. package/dist/sandbox/metrics-ingestion.d.ts +6 -1
  64. package/dist/sandbox/viewer.d.ts +7 -3
  65. package/dist/slack-reaction-files.d.ts +27 -0
  66. package/dist/temporal-schedule-cleanup.d.ts +26 -0
  67. package/dist/transcription/providers/xai-subscription.d.ts +8 -0
  68. package/dist/xai-realtime.d.ts +26 -0
  69. package/dist/xai-subscription-auth.d.ts +23 -0
  70. package/package.json +20 -14
  71. package/src/app.ts +604 -64
  72. package/src/auth/canonical-human-session-admission.ts +116 -0
  73. package/src/auth/managed-auth.ts +101 -0
  74. package/src/browser-auth-broker.ts +155 -0
  75. package/src/browser-controller-authority.ts +186 -0
  76. package/src/browser-network-route.ts +34 -0
  77. package/src/browser-state-authority.ts +236 -0
  78. package/src/codemode.ts +186 -0
  79. package/src/controller-data-plane.ts +35 -0
  80. package/src/editable-artifact-live-hints.ts +64 -0
  81. package/src/editable-artifact-native-kernel.ts +659 -0
  82. package/src/editable-artifact-office-import.ts +230 -0
  83. package/src/editable-artifact-production.ts +419 -0
  84. package/src/editable-artifact-websocket.ts +311 -0
  85. package/src/editable-artifact-workspace-files.ts +186 -0
  86. package/src/github-browser-flow.ts +35 -6
  87. package/src/http/auth.ts +29 -9
  88. package/src/http/cors.ts +3 -0
  89. package/src/http/sse.ts +229 -5
  90. package/src/index.ts +119 -20
  91. package/src/integrations/api-integrations.ts +365 -0
  92. package/src/integrations/atlassian.ts +1621 -0
  93. package/src/integrations/fiken.ts +1230 -0
  94. package/src/integrations/github-skill-source.ts +142 -0
  95. package/src/integrations/google-drive.ts +1005 -64
  96. package/src/integrations/oauth-client.ts +123 -33
  97. package/src/integrations/provider-oauth.ts +756 -0
  98. package/src/integrations/slack-bot.ts +669 -11
  99. package/src/integrations/slack-interactions.ts +2063 -93
  100. package/src/integrations/social-api.ts +11 -0
  101. package/src/interaction-holder-heartbeat.ts +95 -0
  102. package/src/interaction-metrics.ts +159 -0
  103. package/src/mcp/documents.ts +146 -6
  104. package/src/mcp/editable-artifact-query-schema.ts +236 -0
  105. package/src/mcp/editable-artifacts.ts +448 -0
  106. package/src/mcp/scheduled-task-view.ts +34 -0
  107. package/src/mcp/server.ts +1756 -355
  108. package/src/memory-slack-delivery.ts +209 -0
  109. package/src/model-catalog.ts +19 -6
  110. package/src/routes/api-integrations.ts +410 -0
  111. package/src/routes/browser-identities.ts +160 -0
  112. package/src/routes/browser-sessions.ts +4482 -0
  113. package/src/routes/canonical-human-identities.ts +156 -0
  114. package/src/routes/channels.ts +90 -0
  115. package/src/routes/company-profile.ts +255 -0
  116. package/src/routes/computer-sessions.ts +1602 -0
  117. package/src/routes/connections.ts +421 -99
  118. package/src/routes/documents.ts +22 -3
  119. package/src/routes/editable-artifacts.ts +1159 -0
  120. package/src/routes/files.ts +106 -4
  121. package/src/routes/github.ts +18 -2
  122. package/src/routes/install.ts +7 -1
  123. package/src/routes/integration-facets.ts +258 -0
  124. package/src/routes/interaction-resources.ts +595 -0
  125. package/src/routes/memory-slack-publications.ts +216 -0
  126. package/src/routes/organization-memberships.ts +53 -0
  127. package/src/routes/packs.ts +437 -7
  128. package/src/routes/plugins.ts +752 -0
  129. package/src/routes/rigs.ts +77 -20
  130. package/src/routes/scheduled-tasks.ts +67 -40
  131. package/src/routes/sessions.ts +830 -278
  132. package/src/routes/skills.ts +256 -0
  133. package/src/routes/slack-task-policy.ts +115 -0
  134. package/src/routes/supergrok.ts +717 -0
  135. package/src/routes/transcription-recordings.ts +9 -2
  136. package/src/routes/transcriptions.ts +2 -1
  137. package/src/routes/video-generation.ts +162 -0
  138. package/src/routes/workspaces.ts +68 -28
  139. package/src/sandbox/channel-a.ts +750 -116
  140. package/src/sandbox/machines.ts +5 -5
  141. package/src/sandbox/metrics-ingestion.ts +121 -3
  142. package/src/sandbox/rematerialize.ts +35 -47
  143. package/src/sandbox/viewer.ts +39 -12
  144. package/src/slack-reaction-files.ts +181 -0
  145. package/src/temporal-schedule-cleanup.ts +135 -0
  146. package/src/transcription/providers/xai-subscription.ts +110 -0
  147. package/src/transcription/service.ts +17 -2
  148. package/src/xai-realtime.ts +216 -0
  149. package/src/xai-subscription-auth.ts +132 -0
  150. package/dist/chunk-T4T2PGU4.js.map +0 -1
  151. package/dist/mcp/toolspace.d.ts +0 -71
  152. package/src/mcp/toolspace.ts +0 -1190
@@ -65,6 +65,8 @@ export declare function attachViewer(services: ViewerServices, input: {
65
65
  workspaceId: string;
66
66
  session: Session;
67
67
  viewerId?: string;
68
+ /** Cancel lifecycle waiting when the originating HTTP request disconnects. */
69
+ waitSignal?: AbortSignal;
68
70
  }): Promise<ViewerAttachResult>;
69
71
  export type SessionGroupReadinessHold = {
70
72
  lease: LeaseSnapshot;
@@ -149,7 +151,7 @@ export type MintDesktopStreamInput = {
149
151
  session: Session;
150
152
  /** The viewer holder id the scoped token is minted for. */
151
153
  viewerId: string;
152
- /** The live lease (must be warm/draining — the box is up). A selfhosted-active
154
+ /** The live lease (must be holder-confirmed warm). A selfhosted-active
153
155
  * session may have no Modal group lease; omit and the selfhosted branch handles it. */
154
156
  lease?: LeaseSnapshot;
155
157
  /** The epoch the CALLER last observed the URL minted under. When the live
@@ -189,14 +191,16 @@ export type TerminalStreamMint = {
189
191
  token: string;
190
192
  expiresAt: string;
191
193
  leaseEpoch: number;
194
+ transport: "pty-ws" | "relay-pty";
192
195
  };
196
+ type SelfhostedStreamMint = Omit<TerminalStreamMint, "transport">;
193
197
  export type MintTerminalStreamInput = {
194
198
  accountId: string;
195
199
  workspaceId: string;
196
200
  session: Session;
197
201
  /** The viewer holder / principal id the scoped token is minted for. */
198
202
  viewerId: string;
199
- /** The live lease (must be warm/draining — the box is up). A selfhosted-active
203
+ /** The live lease (must be holder-confirmed warm). A selfhosted-active
200
204
  * session may have no Modal group lease; omit and the selfhosted branch handles it. */
201
205
  lease?: LeaseSnapshot;
202
206
  /** Test seam: override how the box is re-established by id (see
@@ -247,5 +251,5 @@ export type MintSelfhostedStreamInput = {
247
251
  * query param (the relay validates the in-band token); the relay's stale-viewer
248
252
  * fence uses the token's leaseEpoch claim (== activeEpoch here).
249
253
  */
250
- export declare function mintSelfhostedStream(services: ViewerServices, input: MintSelfhostedStreamInput): Promise<TerminalStreamMint | null>;
254
+ export declare function mintSelfhostedStream(services: ViewerServices, input: MintSelfhostedStreamInput): Promise<SelfhostedStreamMint | null>;
251
255
  export {};
@@ -0,0 +1,27 @@
1
+ import type { FileResourceRef } from "@opengeni/contracts";
2
+ import { completeFileUpload, prepareGeneratedWorkspaceFile, type Database } from "@opengeni/db";
3
+ import type { ObjectStorage } from "@opengeni/storage";
4
+ import type { DownloadedSlackReactionImage } from "./integrations/slack-bot.js";
5
+ export type SlackReactionImageImportSource = Readonly<{
6
+ accountId: string;
7
+ workspaceId: string;
8
+ connectionId: string;
9
+ slackTeamId: string;
10
+ slackChannelId: string;
11
+ slackMessageTs: string;
12
+ }>;
13
+ export type ImportedSlackReactionImage = Readonly<{
14
+ resource: FileResourceRef;
15
+ filename: string;
16
+ contentType: "image/png" | "image/jpeg" | "image/webp";
17
+ sizeBytes: number;
18
+ }>;
19
+ export declare function importSlackReactionImage(dependencies: Readonly<{
20
+ db: Database;
21
+ objectStorage: ObjectStorage;
22
+ now?: () => Date;
23
+ prepareFile?: typeof prepareGeneratedWorkspaceFile;
24
+ completeFile?: typeof completeFileUpload;
25
+ }>, source: SlackReactionImageImportSource, image: DownloadedSlackReactionImage, ordinal: number): Promise<ImportedSlackReactionImage>;
26
+ export declare function slackReactionImageIdentity(source: SlackReactionImageImportSource, slackFileId: string): string;
27
+ export declare function safeSlackImageFilename(value: string, contentType: "image/png" | "image/jpeg" | "image/webp"): string;
@@ -0,0 +1,26 @@
1
+ import { type Database, type TemporalScheduleCleanupClaim } from "@opengeni/db";
2
+ import type { Observability } from "@opengeni/observability";
3
+ type TemporalScheduleCleanupDependencies = {
4
+ db: Database;
5
+ deleteSchedule: (temporalScheduleId: string) => Promise<void>;
6
+ observability?: Pick<Observability, "info" | "warn" | "error">;
7
+ };
8
+ export type TemporalScheduleCleanupBatchResult = {
9
+ claimed: number;
10
+ deleted: number;
11
+ failed: number;
12
+ stale: number;
13
+ };
14
+ /** Settle exact claims concurrently; every external delete is idempotent. */
15
+ export declare function processTemporalScheduleCleanupClaims(deps: TemporalScheduleCleanupDependencies, claims: readonly TemporalScheduleCleanupClaim[]): Promise<TemporalScheduleCleanupBatchResult>;
16
+ /** Claim and process one globally bounded batch. */
17
+ export declare function drainTemporalScheduleCleanupOutbox(deps: TemporalScheduleCleanupDependencies): Promise<TemporalScheduleCleanupBatchResult>;
18
+ /**
19
+ * Start one non-overlapping reconciliation loop. PostgreSQL claims coordinate
20
+ * replicas; an API crash merely delays the exact row until its short claim
21
+ * expires.
22
+ */
23
+ export declare function startTemporalScheduleCleanupPump(deps: TemporalScheduleCleanupDependencies, options?: {
24
+ intervalMs?: number;
25
+ }): () => Promise<void>;
26
+ export {};
@@ -0,0 +1,8 @@
1
+ import { type Settings } from "@opengeni/config";
2
+ import { type TranscriptionProvider } from "@opengeni/core";
3
+ import { type Database } from "@opengeni/db";
4
+ export declare function createXaiSubscriptionTranscriptionProvider(input: {
5
+ settings: Settings;
6
+ db: Database;
7
+ fetch?: typeof fetch;
8
+ }): TranscriptionProvider;
@@ -0,0 +1,26 @@
1
+ import { type Settings } from "@opengeni/config";
2
+ import type { GatewayRealtimeInitialItem } from "@opengeni/contracts";
3
+ import { type Database } from "@opengeni/db";
4
+ export declare class XaiRealtimeBrokerError extends Error {
5
+ readonly code: "model_unavailable" | "credential_unavailable" | "provider_error" | "invalid_provider_response";
6
+ readonly providerStatus: number | null;
7
+ constructor(code: "model_unavailable" | "credential_unavailable" | "provider_error" | "invalid_provider_response", message: string, providerStatus?: number | null);
8
+ }
9
+ export type XaiRealtimeConnectionSecret = {
10
+ token: string;
11
+ url: string;
12
+ upstreamModelId: string;
13
+ expiresAt: number | null;
14
+ initialItems: GatewayRealtimeInitialItem[];
15
+ instructions: string;
16
+ };
17
+ export declare function createXaiRealtimeConnectionSecret(input: {
18
+ db: Database;
19
+ settings: Settings;
20
+ accountId: string;
21
+ workspaceId: string;
22
+ subjectId: string;
23
+ sessionId: string;
24
+ model: string;
25
+ fetchImpl?: typeof fetch;
26
+ }): Promise<XaiRealtimeConnectionSecret>;
@@ -0,0 +1,23 @@
1
+ import { type Settings } from "@opengeni/config";
2
+ import type { XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
3
+ import { type Database } from "@opengeni/db";
4
+ import { type XaiFetch, type XaiProxyAuthContext } from "@opengeni/xai-subscription";
5
+ export type XaiSubscriptionAuthorization = {
6
+ context: XaiProxyAuthContext;
7
+ credentialId: string;
8
+ authoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
9
+ rotationEnabled: boolean;
10
+ };
11
+ export declare function buildXaiSubscriptionAuthorization(input: {
12
+ db: Database;
13
+ settings: Settings;
14
+ accountId: string;
15
+ workspaceId: string;
16
+ subjectId: string;
17
+ shardKey: string;
18
+ pinnedCredentialId?: string | null;
19
+ pinSource?: "manual" | "policy" | null;
20
+ authoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
21
+ sessionId?: string;
22
+ fetch?: XaiFetch;
23
+ }): Promise<XaiSubscriptionAuthorization>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/api-router",
3
- "version": "0.23.1",
3
+ "version": "0.30.0",
4
4
  "description": "OpenGeni HTTP surface: the Hono adapter/router (createApp), routes, MCP HTTP transport, and HTTP access adapters over @opengeni/core. An engine-distribution surface — its runtime closure includes engine-internal packages.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,25 +41,31 @@
41
41
  "@aws-sdk/client-s3": "^3.1044.0",
42
42
  "@aws-sdk/s3-request-presigner": "^3.1044.0",
43
43
  "@hono/zod-validator": "^0.7.6",
44
+ "@llamaindex/liteparse": "^1.5.3",
44
45
  "@modelcontextprotocol/sdk": "^1.29.0",
45
- "@opengeni/agent-proto": "^0.3.0",
46
- "@opengeni/codex": "^0.2.13",
47
- "@opengeni/config": "^0.12.1",
48
- "@opengeni/contracts": "^0.40.0",
49
- "@opengeni/core": "^0.21.10",
50
- "@opengeni/db": "^0.28.9",
51
- "@opengeni/documents": "^0.5.18",
52
- "@opengeni/events": "^0.3.88",
53
- "@opengeni/github": "^0.4.38",
54
- "@opengeni/network": "^0.2.0",
55
- "@opengeni/observability": "^0.5.6",
56
- "@opengeni/runtime": "^0.18.24",
57
- "@opengeni/storage": "^0.2.75",
46
+ "@opengeni/agent-proto": "^0.5.0",
47
+ "@opengeni/artifact-tool": "^0.2.8",
48
+ "@opengeni/capabilities": "^0.2.0",
49
+ "@opengeni/codemode": "^0.4.1",
50
+ "@opengeni/codex": "^0.2.16",
51
+ "@opengeni/config": "^0.16.1",
52
+ "@opengeni/contracts": "^0.50.0",
53
+ "@opengeni/core": "^0.28.0",
54
+ "@opengeni/db": "^0.36.0",
55
+ "@opengeni/documents": "^0.5.38",
56
+ "@opengeni/events": "^0.3.109",
57
+ "@opengeni/github": "^0.4.56",
58
+ "@opengeni/network": "^0.2.2",
59
+ "@opengeni/observability": "^0.7.5",
60
+ "@opengeni/runtime": "^0.23.0",
61
+ "@opengeni/storage": "^0.2.93",
62
+ "@opengeni/xai-subscription": "^0.1.0",
58
63
  "@temporalio/client": "^1.17.0",
59
64
  "better-auth": "^1.6.14",
60
65
  "hono": "^4.12.18",
61
66
  "pg": "^8.21.0",
62
67
  "resend": "^6.12.4",
68
+ "sharp": "^0.34.5",
63
69
  "stripe": "^22.2.0",
64
70
  "zod": "^4.2.1"
65
71
  },