@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
@@ -11,6 +11,15 @@ type Utf8Projection = {
11
11
  };
12
12
  export type ScheduledTaskUtf8ProjectionFact = Omit<Utf8Projection, "value">;
13
13
  type ScheduledTaskScheduleProjection = {
14
+ schedule: Extract<ScheduledTaskScheduleSpec, {
15
+ type: "manual";
16
+ }>;
17
+ projection: {
18
+ type: "manual";
19
+ truncated: false;
20
+ fields: Record<string, never>;
21
+ };
22
+ } | {
14
23
  schedule: Extract<ScheduledTaskScheduleSpec, {
15
24
  type: "once";
16
25
  }>;
@@ -53,6 +62,8 @@ export declare function scheduledTaskMcpSummary(task: ScheduledTask): {
53
62
  name: string;
54
63
  status: "active" | "paused";
55
64
  schedule: {
65
+ type: "manual";
66
+ } | {
56
67
  type: "once";
57
68
  runAt: string;
58
69
  timeZone: string;
@@ -70,6 +81,53 @@ export declare function scheduledTaskMcpSummary(task: ScheduledTask): {
70
81
  };
71
82
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
72
83
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
84
+ action: {
85
+ kind: "agent_turn";
86
+ sourceId?: never;
87
+ sourceGeneration?: never;
88
+ sourceLifecycleGeneration?: never;
89
+ destination?: never;
90
+ initiatingSubjectId?: never;
91
+ allDescendants?: never;
92
+ connection?: never;
93
+ limits?: never;
94
+ } | {
95
+ kind: "knowledge_source_sync";
96
+ sourceId: string;
97
+ sourceGeneration: number;
98
+ sourceLifecycleGeneration: number;
99
+ destination: {
100
+ kind: "organization";
101
+ workspaceId: null;
102
+ subjectId: null;
103
+ } | {
104
+ kind: "workspace";
105
+ workspaceId: string;
106
+ subjectId: null;
107
+ } | {
108
+ kind: "personal";
109
+ workspaceId: string | null;
110
+ subjectId: string;
111
+ };
112
+ initiatingSubjectId: string;
113
+ allDescendants: boolean;
114
+ connection: {
115
+ connectionId: string;
116
+ connectionVersion: number;
117
+ providerDomain: string;
118
+ kind: "api_key" | "app_install" | "delegated" | "oauth2";
119
+ ownerSubjectId: string;
120
+ };
121
+ limits: {
122
+ maxItems: number;
123
+ maxBytes: number;
124
+ maxFileBytes: number;
125
+ maxProviderRequests: number;
126
+ maxElapsedSeconds: number;
127
+ maxConcurrency: number;
128
+ maxFailureDetails: number;
129
+ };
130
+ };
73
131
  targetSessionId: string | null;
74
132
  reusableSessionId: string | null;
75
133
  variableSetId: string | null;
@@ -91,6 +149,10 @@ export declare function scheduledTaskMcpSummary(task: ScheduledTask): {
91
149
  bounded: boolean;
92
150
  name: ScheduledTaskUtf8ProjectionFact;
93
151
  schedule: {
152
+ type: "manual";
153
+ truncated: false;
154
+ fields: Record<string, never>;
155
+ } | {
94
156
  type: "once";
95
157
  truncated: boolean;
96
158
  fields: {
@@ -123,6 +185,8 @@ export declare function boundScheduledTaskDetailMcp(task: ScheduledTask): {
123
185
  name: string;
124
186
  status: "active" | "paused";
125
187
  schedule: {
188
+ type: "manual";
189
+ } | {
126
190
  type: "once";
127
191
  runAt: string;
128
192
  timeZone: string;
@@ -140,6 +204,53 @@ export declare function boundScheduledTaskDetailMcp(task: ScheduledTask): {
140
204
  };
141
205
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
142
206
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
207
+ action: {
208
+ kind: "agent_turn";
209
+ sourceId?: never;
210
+ sourceGeneration?: never;
211
+ sourceLifecycleGeneration?: never;
212
+ destination?: never;
213
+ initiatingSubjectId?: never;
214
+ allDescendants?: never;
215
+ connection?: never;
216
+ limits?: never;
217
+ } | {
218
+ kind: "knowledge_source_sync";
219
+ sourceId: string;
220
+ sourceGeneration: number;
221
+ sourceLifecycleGeneration: number;
222
+ destination: {
223
+ kind: "organization";
224
+ workspaceId: null;
225
+ subjectId: null;
226
+ } | {
227
+ kind: "workspace";
228
+ workspaceId: string;
229
+ subjectId: null;
230
+ } | {
231
+ kind: "personal";
232
+ workspaceId: string | null;
233
+ subjectId: string;
234
+ };
235
+ initiatingSubjectId: string;
236
+ allDescendants: boolean;
237
+ connection: {
238
+ connectionId: string;
239
+ connectionVersion: number;
240
+ providerDomain: string;
241
+ kind: "api_key" | "app_install" | "delegated" | "oauth2";
242
+ ownerSubjectId: string;
243
+ };
244
+ limits: {
245
+ maxItems: number;
246
+ maxBytes: number;
247
+ maxFileBytes: number;
248
+ maxProviderRequests: number;
249
+ maxElapsedSeconds: number;
250
+ maxConcurrency: number;
251
+ maxFailureDetails: number;
252
+ };
253
+ };
143
254
  targetSessionId: string | null;
144
255
  reusableSessionId: string | null;
145
256
  variableSetId: string | null;
@@ -161,6 +272,10 @@ export declare function boundScheduledTaskDetailMcp(task: ScheduledTask): {
161
272
  bounded: boolean;
162
273
  name: ScheduledTaskUtf8ProjectionFact;
163
274
  schedule: {
275
+ type: "manual";
276
+ truncated: false;
277
+ fields: Record<string, never>;
278
+ } | {
164
279
  type: "once";
165
280
  truncated: boolean;
166
281
  fields: {
@@ -254,6 +369,8 @@ export declare function boundScheduledTaskMcpPage(input: {
254
369
  name: string;
255
370
  status: "active" | "paused";
256
371
  schedule: {
372
+ type: "manual";
373
+ } | {
257
374
  type: "once";
258
375
  runAt: string;
259
376
  timeZone: string;
@@ -271,6 +388,53 @@ export declare function boundScheduledTaskMcpPage(input: {
271
388
  };
272
389
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
273
390
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
391
+ action: {
392
+ kind: "agent_turn";
393
+ sourceId?: never;
394
+ sourceGeneration?: never;
395
+ sourceLifecycleGeneration?: never;
396
+ destination?: never;
397
+ initiatingSubjectId?: never;
398
+ allDescendants?: never;
399
+ connection?: never;
400
+ limits?: never;
401
+ } | {
402
+ kind: "knowledge_source_sync";
403
+ sourceId: string;
404
+ sourceGeneration: number;
405
+ sourceLifecycleGeneration: number;
406
+ destination: {
407
+ kind: "organization";
408
+ workspaceId: null;
409
+ subjectId: null;
410
+ } | {
411
+ kind: "workspace";
412
+ workspaceId: string;
413
+ subjectId: null;
414
+ } | {
415
+ kind: "personal";
416
+ workspaceId: string | null;
417
+ subjectId: string;
418
+ };
419
+ initiatingSubjectId: string;
420
+ allDescendants: boolean;
421
+ connection: {
422
+ connectionId: string;
423
+ connectionVersion: number;
424
+ providerDomain: string;
425
+ kind: "api_key" | "app_install" | "delegated" | "oauth2";
426
+ ownerSubjectId: string;
427
+ };
428
+ limits: {
429
+ maxItems: number;
430
+ maxBytes: number;
431
+ maxFileBytes: number;
432
+ maxProviderRequests: number;
433
+ maxElapsedSeconds: number;
434
+ maxConcurrency: number;
435
+ maxFailureDetails: number;
436
+ };
437
+ };
274
438
  targetSessionId: string | null;
275
439
  reusableSessionId: string | null;
276
440
  variableSetId: string | null;
@@ -292,6 +456,10 @@ export declare function boundScheduledTaskMcpPage(input: {
292
456
  bounded: boolean;
293
457
  name: ScheduledTaskUtf8ProjectionFact;
294
458
  schedule: {
459
+ type: "manual";
460
+ truncated: false;
461
+ fields: Record<string, never>;
462
+ } | {
295
463
  type: "once";
296
464
  truncated: boolean;
297
465
  fields: {
@@ -1,12 +1,11 @@
1
- import { type AccessGrant } from "@opengeni/contracts";
1
+ import { type AccessGrant, type SessionAuthorizationActor, type WorkspaceMemoryPromptMode } from "@opengeni/contracts";
2
2
  import { listSessionDiscoverySummaries, type SessionDiscoveryCursor, type SessionDiscoveryOrderBy } from "@opengeni/db";
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import type { ApiRouteDeps } from "@opengeni/core";
5
- import type { ToolspaceMcpSurface } from "./toolspace";
6
5
  export type McpServerOptions = {
7
6
  requestOrigin?: string | null;
8
- toolspace?: ToolspaceMcpSurface | null;
9
7
  workspaceMemoryEnabled?: boolean | undefined;
8
+ workspaceMemoryPromptMode?: WorkspaceMemoryPromptMode | undefined;
10
9
  };
11
10
  export declare function buildOpenGeniMcpServer(deps: ApiRouteDeps, grant: AccessGrant, options?: McpServerOptions): McpServer;
12
11
  /** Only a prompt explicitly supplied through the human/API channel may redirect a user-paused goal. */
@@ -33,6 +32,19 @@ export declare function isHumanDirectedTurn(turn: {
33
32
  * identified machine child-notification caller is refused).
34
33
  */
35
34
  export declare function assertGoalReactivationAllowed(deps: ApiRouteDeps, workspaceId: string, sessionId: string, callerTurnId: string | null): Promise<void>;
35
+ export declare function memorySlackPublicationActor(actor: Extract<SessionAuthorizationActor, {
36
+ kind: "agent_attempt";
37
+ }>, sessionId: string, fallbackOwnerLabel: string | null): {
38
+ actor: {
39
+ kind: "human" | "service";
40
+ subjectId: string;
41
+ initiatingHumanSubjectId: string | null;
42
+ sessionId: string;
43
+ turnId: string;
44
+ attemptId: string;
45
+ };
46
+ ownerLabel: string | null;
47
+ };
36
48
  export declare function encodeSessionDiscoveryCursor(cursor: SessionDiscoveryCursor): string;
37
49
  export declare function decodeSessionDiscoveryCursor(value: string): SessionDiscoveryCursor;
38
50
  export declare function capSessionDiscoveryPage(page: Awaited<ReturnType<typeof listSessionDiscoverySummaries>>, includeLastMessage: boolean): {
@@ -70,7 +82,7 @@ export declare function capSessionDiscoveryPage(page: Awaited<ReturnType<typeof
70
82
  truncated: boolean;
71
83
  };
72
84
  latestMessage?: {
73
- type: "agent.message.completed" | "agent.message.delta" | "agent.model.request" | "agent.model.usage" | "agent.reasoning.delta" | "agent.toolCall.created" | "agent.toolCall.output" | "agent.updated" | "artifact.created" | "codex.account.switched" | "codex.capacity.resumed" | "codex.capacity.superseded" | "codex.capacity.waiting" | "codex.credential.selected" | "codex.fleet.decision" | "credential.auth_needed" | "fs.changed" | "git.changed" | "goal.cleared" | "goal.completed" | "goal.continuation" | "goal.paused" | "goal.resumed" | "goal.set" | "goal.updated" | "machine.link.lost" | "machine.link.restored" | "machine.op.failed" | "machine.op.recovered" | "machine.runner.restarted" | "memory.corrected" | "memory.saved" | "recording.available" | "recording.failed" | "recording.started" | "rig.setup.completed" | "rig.setup.failed" | "rig.setup.skipped" | "rig.setup.started" | "sandbox.box.created" | "sandbox.box.lost" | "sandbox.box.snapshot" | "sandbox.box.terminated" | "sandbox.command.output.delta" | "sandbox.env.drift" | "sandbox.operation.completed" | "sandbox.operation.failed" | "sandbox.operation.started" | "session.context.cleared" | "session.context.compacted" | "session.context.compaction.requested" | "session.context.compaction.skipped" | "session.context.compaction.started" | "session.control.paused" | "session.control.resumed" | "session.control.steer_requested" | "session.created" | "session.event.envelope_omitted" | "session.humanInput.requested" | "session.mcp.approval_policy.updated" | "session.queue.changed" | "session.queue.history" | "session.queue.prompt.cancelled" | "session.realtime.ended" | "session.realtime.started" | "session.requiresAction" | "session.route.reconciled" | "session.status.changed" | "session.title_set" | "session.tool_policy.updated" | "stream.closed" | "stream.opened" | "stream.revoked" | "stream.url.rotated" | "system.update.cancelled" | "system.update.delivered" | "system.update.pending" | "system.update.settled" | "system.update.superseded" | "terminal.pty.exited" | "terminal.pty.output.delta" | "terminal.pty.started" | "tool.auth_needed" | "turn.cancelled" | "turn.capacity_waiting" | "turn.completed" | "turn.event.rejected_late" | "turn.failed" | "turn.queued" | "turn.recovery.requested" | "turn.started" | "turn.superseded" | "user.approvalDecision" | "user.humanInputResponse" | "user.message" | "user.pause" | "workspace.inference.paused" | "workspace.inference.resumed" | "workspace.revision.captured" | "workspace.revision.degraded";
85
+ type: "agent.message.completed" | "agent.message.delta" | "agent.model.request" | "agent.model.usage" | "agent.reasoning.delta" | "agent.toolCall.created" | "agent.toolCall.output" | "agent.updated" | "artifact.created" | "codex.account.switched" | "codex.capacity.resumed" | "codex.capacity.superseded" | "codex.capacity.waiting" | "codex.credential.selected" | "codex.fleet.decision" | "credential.auth_needed" | "fs.changed" | "git.changed" | "goal.cleared" | "goal.completed" | "goal.continuation" | "goal.paused" | "goal.progress" | "goal.resumed" | "goal.rewrite.proposed" | "goal.rewrite.rejected" | "goal.set" | "goal.updated" | "machine.link.lost" | "machine.link.restored" | "machine.op.failed" | "machine.op.recovered" | "machine.runner.restarted" | "memory.corrected" | "memory.saved" | "recording.available" | "recording.failed" | "recording.started" | "rig.setup.completed" | "rig.setup.failed" | "rig.setup.skipped" | "rig.setup.started" | "sandbox.box.created" | "sandbox.box.lost" | "sandbox.box.snapshot" | "sandbox.box.terminated" | "sandbox.command.output.delta" | "sandbox.env.drift" | "sandbox.operation.completed" | "sandbox.operation.failed" | "sandbox.operation.started" | "session.context.cleared" | "session.context.compacted" | "session.context.compaction.requested" | "session.context.compaction.skipped" | "session.context.compaction.started" | "session.control.paused" | "session.control.resumed" | "session.control.steer_requested" | "session.created" | "session.event.envelope_omitted" | "session.humanInput.requested" | "session.mcp.approval_policy.updated" | "session.queue.changed" | "session.queue.history" | "session.queue.prompt.cancelled" | "session.realtime.ended" | "session.realtime.started" | "session.requiresAction" | "session.route.reconciled" | "session.status.changed" | "session.title_set" | "session.tool_policy.updated" | "session.visibility.changed" | "stream.closed" | "stream.opened" | "stream.revoked" | "stream.url.rotated" | "system.update.cancelled" | "system.update.delivered" | "system.update.pending" | "system.update.settled" | "system.update.superseded" | "terminal.pty.exited" | "terminal.pty.output.delta" | "terminal.pty.started" | "tool.auth_needed" | "turn.cancelled" | "turn.capacity_waiting" | "turn.completed" | "turn.event.rejected_late" | "turn.failed" | "turn.queued" | "turn.recovery.requested" | "turn.started" | "turn.superseded" | "user.approvalDecision" | "user.humanInputResponse" | "user.message" | "user.pause" | "workspace.inference.paused" | "workspace.inference.resumed" | "workspace.revision.captured" | "workspace.revision.degraded";
74
86
  preview: string | null;
75
87
  previewTruncated: boolean;
76
88
  } | null;
@@ -0,0 +1,9 @@
1
+ import { type ClaimedMemorySlackPublication } from "@opengeni/db";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ export declare function drainMemorySlackPublicationsOnce(deps: ApiRouteDeps): Promise<boolean>;
4
+ export declare function startMemorySlackPublicationPump(deps: ApiRouteDeps, options?: {
5
+ intervalMs?: number;
6
+ maxPerTick?: number;
7
+ }): () => Promise<void>;
8
+ export declare function formatMemorySlackPublicationMessage(deps: Pick<ApiRouteDeps, "settings">, publication: ClaimedMemorySlackPublication): string;
9
+ export declare function memorySlackDestinationDrift(error: unknown): boolean;
@@ -32,6 +32,7 @@ export declare function buildWorkspaceModelCatalog(input: {
32
32
  settings: Settings;
33
33
  policy: WorkspaceModelPolicyContract | null;
34
34
  codexSubscriptionActive: boolean;
35
+ xaiSubscriptionActive?: boolean;
35
36
  workspaceGatewayConnectionActive?: boolean;
36
37
  credentialReadinessObservations?: Readonly<Record<string, ModelCredentialReadinessObservation>> | undefined;
37
38
  observations?: Readonly<Record<string, ModelAvailabilityObservation>> | undefined;
@@ -0,0 +1,8 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { FetchLike } from "@opengeni/network";
3
+ import type { Hono } from "hono";
4
+ export type ApiIntegrationRouteOverrides = Readonly<{
5
+ fetchImpl?: FetchLike;
6
+ }>;
7
+ export declare function apiIntegrationRequiresConnection(authScheme: Record<string, unknown>): boolean;
8
+ export declare function registerApiIntegrationRoutes(app: Hono, deps: ApiRouteDeps, overrides?: ApiIntegrationRouteOverrides): void;
@@ -0,0 +1,5 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ import { HTTPException } from "hono/http-exception";
4
+ export declare function registerBrowserIdentityRoutes(app: Hono, deps: ApiRouteDeps): void;
5
+ export declare function browserIdentityRouteError(error: unknown): HTTPException;
@@ -0,0 +1,6 @@
1
+ import { InteractionActor, type AccessGrant } from "@opengeni/contracts";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ import type { Hono } from "hono";
4
+ 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 interactionActorForGrant(grant: AccessGrant): ReturnType<typeof InteractionActor.parse>;
@@ -0,0 +1,3 @@
1
+ import type { ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export declare function registerCanonicalHumanIdentityRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,3 @@
1
+ import type { Hono } from "hono";
2
+ import type { ApiRouteDeps } from "@opengeni/core";
3
+ export declare function registerChannelRoutes(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 registerCompanyProfileRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,6 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ /** Public ComputerSession resource surface. Physical app/window authority stays
4
+ * in the same placement controller used by BrowserSession; this route owns only
5
+ * durable authorization, placement fencing, lifecycle receipts, and routing. */
6
+ export declare function registerComputerSessionRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,44 @@
1
+ import type { AccessGrant } from "@opengeni/contracts";
2
+ import { type AccessDeps, type EditableArtifactActor, type EditableArtifactApplicationPort, type EditableArtifactDurableExportService, type EditableArtifactOfficeImportPort, type EditableArtifactModality } from "@opengeni/core";
3
+ import type { Hono } from "hono";
4
+ export declare const EDITABLE_ARTIFACT_HTTP_REQUEST_MAX_BYTES: number;
5
+ export declare const EDITABLE_ARTIFACT_EXPORT_REQUEST_MAX_BYTES: number;
6
+ export declare const EDITABLE_ARTIFACT_LIVE_TICKET_REQUEST_MAX_BYTES: number;
7
+ export type EditableArtifactRouteScope = Readonly<{
8
+ accountId: string;
9
+ workspaceId: string;
10
+ }>;
11
+ export type EditableArtifactRouteActor = EditableArtifactActor;
12
+ /**
13
+ * Authenticated transport context. Until a distinct editable-artifact
14
+ * capability is introduced, the existing workspace `artifacts:read` and
15
+ * `artifacts:publish` capabilities intentionally gate read and write here too;
16
+ * the application still performs the durable per-artifact authorization.
17
+ */
18
+ export type EditableArtifactRouteAuthority = Readonly<{
19
+ scope: EditableArtifactRouteScope;
20
+ actor: EditableArtifactRouteActor;
21
+ }>;
22
+ export type MintEditableArtifactLiveTicketOutput = Readonly<{
23
+ artifactId: string;
24
+ modality: EditableArtifactModality;
25
+ replicaId: string;
26
+ token: string;
27
+ expiresAt: string;
28
+ protocolVersion: number;
29
+ }>;
30
+ export type EditableArtifactRouteDependencies = AccessDeps & Readonly<{
31
+ editableArtifacts?: EditableArtifactApplicationPort;
32
+ editableArtifactExports?: EditableArtifactDurableExportService;
33
+ editableArtifactOfficeImports?: EditableArtifactOfficeImportPort;
34
+ /** Test/embedding seam; returned ids are still authorized one by one. */
35
+ editableArtifactSessionArtifactIds?: (scope: EditableArtifactRouteScope, sourceSessionId: string, limit: number) => Promise<readonly string[]>;
36
+ }>;
37
+ export type EditableArtifactApplicationErrorCode = "not_found" | "forbidden" | "conflict" | "unsupported_protocol" | "limit_exceeded" | "unavailable";
38
+ /** A bounded, deliberate failure emitted by the injected application boundary. */
39
+ export declare class EditableArtifactApplicationError extends Error {
40
+ readonly code: EditableArtifactApplicationErrorCode;
41
+ constructor(code: EditableArtifactApplicationErrorCode);
42
+ }
43
+ export declare function registerEditableArtifactRoutes(app: Hono, deps: EditableArtifactRouteDependencies): void;
44
+ export declare function editableArtifactActorForGrant(grant: AccessGrant, rawReplicaId: string): EditableArtifactRouteActor;
@@ -0,0 +1,3 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export declare function registerIntegrationFacetRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,5 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ import { HTTPException } from "hono/http-exception";
4
+ export declare function registerInteractionResourceRoutes(app: Hono, deps: ApiRouteDeps): void;
5
+ export declare function interactionResourceRouteError(error: unknown): HTTPException;
@@ -0,0 +1,6 @@
1
+ import { type MemorySlackPublication as MemorySlackPublicationRecord } from "@opengeni/contracts";
2
+ import { type ApiRouteDeps } from "@opengeni/core";
3
+ import type { Hono } from "hono";
4
+ export declare function registerMemorySlackPublicationRoutes(app: Hono, deps: ApiRouteDeps): void;
5
+ /** Defensively protects legacy rows without rewriting their durable projection. */
6
+ export declare function sanitizeMemorySlackPublicationHistory(publication: MemorySlackPublicationRecord): MemorySlackPublicationRecord;
@@ -0,0 +1,3 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export declare function registerOrganizationMembershipRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -0,0 +1,8 @@
1
+ import { type ApiRouteDeps, type GitHubSkillSourceClient } from "@opengeni/core";
2
+ import type { FetchLike } from "@opengeni/network";
3
+ import type { Hono } from "hono";
4
+ export type PluginRouteOverrides = Readonly<{
5
+ fetchImpl?: FetchLike;
6
+ github?: GitHubSkillSourceClient;
7
+ }>;
8
+ export declare function registerPluginRoutes(app: Hono, deps: ApiRouteDeps, overrides?: PluginRouteOverrides): void;
@@ -1,15 +1,31 @@
1
- import { type SessionAuthorizationOperation } from "@opengeni/contracts";
1
+ import { ClientSessionEvent, SteerSessionMessageRequest, type SessionGoalRevision, type SessionAuthorizationOperation } from "@opengeni/contracts";
2
+ import { type SessionDiscoveryCursor } from "@opengeni/db";
2
3
  import type { Context, Hono } from "hono";
3
4
  import type { ApiRouteDeps } from "@opengeni/core";
4
- import { type ViewerServices } from "../sandbox/viewer";
5
+ import { type ViewerServices } from "../sandbox/viewer.js";
5
6
  type SessionRouteDeps = ApiRouteDeps & Pick<ViewerServices, "establishSandboxSession">;
6
7
  export declare function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void;
8
+ export declare function goalProposalMatchesExpectedRevision(revision: Pick<SessionGoalRevision, "baseObjectiveRevision">, expectedObjectiveRevision: number): boolean;
7
9
  /**
8
10
  * Map every mounted session-addressed HTTP path to the host-neutral operation
9
11
  * the embedding port authorizes. Returning null is deliberately fail-closed in
10
12
  * host-managed mode; standalone deployments never consult this classifier.
11
13
  */
12
14
  export declare function sessionAuthorizationOperationForHttp(method: string, pathname: string, sessionId: string): SessionAuthorizationOperation | null;
15
+ export type AgentTopologyCursorEnvelope = {
16
+ cursor: SessionDiscoveryCursor;
17
+ parentSessionId: string | null;
18
+ search: string | null;
19
+ };
20
+ export declare function encodeAgentTopologyCursor(value: AgentTopologyCursorEnvelope): string;
21
+ export declare function agentTopologyQuery(query: Record<string, string>): {
22
+ limit: number;
23
+ parentSessionId: string | null;
24
+ search: string | undefined;
25
+ cursor: SessionDiscoveryCursor | undefined;
26
+ };
13
27
  /** Stable, value-free JSON errors for only the create-session boundary. */
14
28
  export declare function sessionCreateErrorResponse(c: Context, error: unknown): Response;
29
+ export declare function parseSessionEventAdmission(raw: unknown): ClientSessionEvent;
30
+ export declare function parseSteerSessionAdmission(raw: unknown): SteerSessionMessageRequest;
15
31
  export {};
@@ -0,0 +1,6 @@
1
+ import { type ApiRouteDeps, type GitHubSkillSourceClient } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export type SkillRouteOverrides = Readonly<{
4
+ github?: GitHubSkillSourceClient;
5
+ }>;
6
+ export declare function registerSkillRoutes(app: Hono, deps: ApiRouteDeps, overrides?: SkillRouteOverrides): void;
@@ -0,0 +1,3 @@
1
+ import { type ApiRouteDeps } from "@opengeni/core";
2
+ import type { Hono } from "hono";
3
+ export declare function registerSlackTaskPolicyRoutes(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 registerSuperGrokRoutes(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 registerVideoGenerationRoutes(app: Hono, deps: ApiRouteDeps): void;
@@ -3,31 +3,80 @@ import type { Session } from "@opengeni/contracts";
3
3
  import { type Database, type LeaseSnapshot } from "@opengeni/db";
4
4
  import { type EventBus } from "@opengeni/events";
5
5
  import { type Observability } from "@opengeni/observability";
6
- import { SandboxChannelAService, type EstablishedSandboxSession, type RoutingSandboxSession } from "@opengeni/runtime/sandbox";
6
+ import { SandboxChannelAService, type ChannelASession, type EstablishedSandboxSession, type RoutingSandboxSession } from "@opengeni/runtime/sandbox";
7
7
  export type ChannelAServices = {
8
8
  db: Database;
9
9
  settings: Settings;
10
10
  bus: EventBus;
11
11
  observability?: Observability | undefined;
12
12
  };
13
+ export type ChannelAOperation = "fs.list" | "fs.list-batch" | "fs.read" | "fs.write" | "fs.delete" | "fs.move" | "fs.mkdir" | "git.status" | "git.diff" | "git.read-batch" | "git.log" | "git.show" | "terminal.exec" | "terminal.pty.open" | "terminal.pty.write" | "terminal.pty.resize" | "terminal.pty.close" | "browser.create" | "browser.resume" | "browser.suspend" | "browser.end" | "browser.read" | "browser.action" | "browser.control" | "browser.download.save" | "browser.attach" | "computer.create" | "computer.end" | "computer.read" | "computer.action" | "computer.control" | "computer.attach";
13
14
  export type ChannelAContext = {
14
15
  accountId: string;
15
16
  workspaceId: string;
16
17
  session: Session;
17
18
  subjectId: string;
19
+ /** Cancel lifecycle waiting when the originating HTTP request disconnects. */
20
+ waitSignal?: AbortSignal | undefined;
21
+ /** Bounded route identity for metrics and safe operator diagnostics. */
22
+ operation?: ChannelAOperation | undefined;
23
+ /** The callback is an interaction-controller read or an exactly-once action.
24
+ * A controller transport failure may therefore rebuild the exact fenced
25
+ * provider handle and replay the request. Tab/lifecycle mutations that lack
26
+ * a controller operation id must never opt into this recovery. */
27
+ retryControllerTransport?: boolean | undefined;
28
+ };
29
+ export type ChannelAOperationFailureReason = "request_cancelled" | "provider_read_busy" | "provider_unavailable" | "lifecycle_conflict" | "request_rejected" | "unexpected";
30
+ export type ChannelAOperationFailureDiagnostic = {
31
+ reason: ChannelAOperationFailureReason;
32
+ status: number;
33
+ errorCode: "sandbox_channel_a_cancelled" | "sandbox_channel_a_provider_busy" | "sandbox_channel_a_provider_unavailable" | "sandbox_channel_a_lifecycle_conflict" | "sandbox_channel_a_operation_failed";
18
34
  };
19
35
  export type ChannelAHandle = {
20
36
  service: SandboxChannelAService;
21
37
  /** Connected Machine homes deliberately have no cloud lease. Durable PTYs
22
38
  * require a real home-provider lease and reject this null case. */
23
39
  lease: LeaseSnapshot | null;
40
+ /** Exact placement-home session established under this request's lease or
41
+ * Connected Machine fence. Unlike routingSession, this never follows a later
42
+ * active-sandbox pointer and is safe for placement-bound controllers. */
43
+ homeSession: ChannelASession;
24
44
  routingSession: RoutingSandboxSession;
25
45
  requestId: string;
26
46
  };
47
+ export type EstablishedHandleCacheKind = "read" | "process" | "none";
48
+ export declare function isChannelAHandleCacheEntryFresh(lastUsedAtMonotonicMs: number, nowMonotonicMs: number, idleTtlMs?: number): boolean;
49
+ export declare function isChannelAProcessHandleCacheEntryFresh(lastUsedAtMonotonicMs: number, nowMonotonicMs: number, idleTtlMs?: number): boolean;
27
50
  /** Reuse the exact lease-fenced provider handle across API-direct surfaces.
28
51
  * Stream capability negotiation and the first Files/Changes reads commonly run
29
52
  * back-to-back; sharing this handle avoids paying the same Modal resume twice. */
30
53
  export declare function establishCachedChannelAHandle(workspaceId: string, sessionId: string, lease: LeaseSnapshot, establish: () => Promise<EstablishedSandboxSession>): Promise<EstablishedSandboxSession>;
54
+ /**
55
+ * Run independent, side-effect-free Channel-A reads concurrently without
56
+ * releasing the direct-request holder while sibling provider commands are
57
+ * still settling. A typed temporary-unavailable failure is retried exactly
58
+ * once after every first attempt has settled; validation, conflict, not-found,
59
+ * and unknown failures are never replayed.
60
+ */
61
+ export declare function runConcurrentChannelAReads<T>(operations: readonly (() => Promise<T>)[]): Promise<T[]>;
62
+ type ChannelAReadRecoveryOptions = {
63
+ /** Modal may expose one more stale command-router route after the first
64
+ * successful handle rebuild. Keep this closed and statically bounded. */
65
+ maxFreshHandleRetries?: 1 | 2;
66
+ /** Never start another provider attempt after the originating request ends. */
67
+ waitSignal?: AbortSignal | undefined;
68
+ /** Additional callback-specific failure that is safe to replay. */
69
+ retryableError?: ((error: unknown) => boolean) | undefined;
70
+ };
71
+ /** Retry a side-effect-free Channel-A read only after the caller has discarded
72
+ * and freshly re-established its provider handle. The ordinary provider-neutral
73
+ * contract allows one retry; Modal opts into one additional rebuild because a
74
+ * command-router rollover can outlive the first replacement handle. Provider
75
+ * commands are never replayed for validation/conflict/unknown errors, mutation
76
+ * routes never call this helper, and request cancellation stops recovery before
77
+ * another provider command begins. */
78
+ export declare function runChannelAReadWithFreshHandleRetry<T>(run: () => Promise<T>, refreshHandle: (attempt: 1 | 2) => Promise<void>, options?: ChannelAReadRecoveryOptions): Promise<T>;
79
+ export declare function shouldEvictChannelAHandleAfterError(error: unknown, cacheKind: EstablishedHandleCacheKind): boolean;
31
80
  /**
32
81
  * Run a Channel-A op against a live box, API-direct. Acquires an exact direct holder
33
82
  * (warming the box when cold), resumes by id, builds the service, runs `fn`, and
@@ -38,6 +87,17 @@ export declare function establishCachedChannelAHandle(workspaceId: string, sessi
38
87
  * otherwise). A `backend:none` session has no box -> 409 before touching it.
39
88
  */
40
89
  export declare function withChannelA<T>(services: ChannelAServices, ctx: ChannelAContext, fn: (handle: ChannelAHandle) => Promise<T>): Promise<T>;
90
+ /** Read-only API-direct seam. Separate requests for the same exact live Modal
91
+ * instance are serialized across API replicas; each request's batched reads
92
+ * remain concurrent behind that one distributed boundary. A typed temporary
93
+ * provider-channel failure gets one retry only after rebuilding the exact
94
+ * lease-fenced handle. */
95
+ export declare function withChannelARead<T>(services: ChannelAServices, ctx: ChannelAContext, fn: (handle: ChannelAHandle) => Promise<T>): Promise<T>;
41
96
  /** Map the service's typed errors to HTTP status (the §5.3 matrix). Re-throws an
42
97
  * already-HTTPException unchanged. */
43
- export declare function mapChannelAError(error: unknown): unknown;
98
+ export declare function mapChannelAError(error: unknown, waitSignal?: AbortSignal): unknown;
99
+ export declare function isChannelARequestCancellation(error: unknown, waitSignal?: AbortSignal): boolean;
100
+ /** Structural classification only: exact provider exception text, codes, URLs,
101
+ * and identifiers never cross the telemetry boundary. */
102
+ export declare function channelAOperationFailureDiagnostic(error: unknown, waitSignal?: AbortSignal): ChannelAOperationFailureDiagnostic;
103
+ export {};
@@ -18,8 +18,8 @@ export type MachinesServices = {
18
18
  export declare function metricRowToSample(row: MachineMetricsRow): MetricSample;
19
19
  /**
20
20
  * Build the Machines dashboard response for a workspace. When `sessionId` is
21
- * supplied (an in-session view) the session's synthetic Modal group box is
22
- * prepended (`isSessionGroup:true`) and the active-sandbox pointer is echoed;
21
+ * supplied (an in-session view) the session's synthetic home group box is
22
+ * prepended when one exists (`isSessionGroup:true`) and the active-sandbox pointer is echoed;
23
23
  * without it (the pure workspace dashboard) `activeSandboxId` is null and only
24
24
  * the enrolled machines are listed.
25
25
  */
@@ -1,7 +1,8 @@
1
1
  import { type Database, type MachineMetricsSample } from "@opengeni/db";
2
+ import { type AttachedBrowserInventorySnapshot as AttachedBrowserInventoryContractValue } from "@opengeni/contracts";
2
3
  import { type EventBus } from "@opengeni/events";
3
4
  import type { Observability } from "@opengeni/observability";
4
- import { Hello, type MetricsSample } from "@opengeni/agent-proto";
5
+ import { Hello, type AttachedBrowserInventorySnapshot as WireAttachedBrowserInventorySnapshot, type MetricsSample } from "@opengeni/agent-proto";
5
6
  /** The wildcard subject the agent event plane publishes heartbeats on. */
6
7
  export declare const AGENT_EVENTS_SUBJECT = "agent.*.*.events";
7
8
  /** The wildcard subject the agent publishes its connect Hello on. */
@@ -27,6 +28,10 @@ export declare function parseAgentHelloSubject(subject: string): {
27
28
  * GPU plane; cpu/mem/disk 0 is a legitimate reading the dashboard shows as 0).
28
29
  */
29
30
  export declare function wireSampleToDbSample(wire: MetricsSample): MachineMetricsSample;
31
+ /** Validate and project one wire inventory before it reaches durable browser
32
+ * discovery. Unknown enum values and unsafe uint64 counters reject the whole
33
+ * authoritative snapshot instead of partially disconnecting good endpoints. */
34
+ export declare function wireAttachedBrowserInventoryToContract(wire: WireAttachedBrowserInventorySnapshot): AttachedBrowserInventoryContractValue;
30
35
  /**
31
36
  * Ingest ONE decoded heartbeat for an enrolled machine. Resolves the enrollment's
32
37
  * accountId (needed for the RLS-scoped writes) from the enrollment row; an