@opengeni/api-router 0.26.1 → 0.30.1
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.
- package/dist/app.d.ts +1 -0
- package/dist/app.js +5 -3
- package/dist/auth/canonical-human-session-admission.d.ts +27 -0
- package/dist/browser-auth-broker.d.ts +20 -0
- package/dist/browser-controller-authority.d.ts +19 -1
- package/dist/browser-network-route.d.ts +8 -0
- package/dist/{chunk-JIKNR5YL.js → chunk-2PQMSRCB.js} +15518 -6863
- package/dist/chunk-2PQMSRCB.js.map +1 -0
- package/dist/controller-data-plane.d.ts +12 -0
- package/dist/http/auth.d.ts +1 -1
- package/dist/http/sse.d.ts +18 -1
- package/dist/index.js +1 -1
- package/dist/integrations/api-integrations.d.ts +2 -2
- package/dist/integrations/fiken.d.ts +233 -0
- package/dist/integrations/google-drive.d.ts +6 -6
- package/dist/integrations/provider-oauth.d.ts +0 -2
- package/dist/integrations/slack-bot.d.ts +171 -1
- package/dist/integrations/slack-interactions.d.ts +17 -5
- package/dist/interaction-holder-heartbeat.d.ts +17 -0
- package/dist/interaction-metrics.d.ts +11 -0
- package/dist/mcp/server.d.ts +3 -2
- package/dist/model-catalog.d.ts +1 -0
- package/dist/routes/canonical-human-identities.d.ts +3 -0
- package/dist/routes/channels.d.ts +3 -0
- package/dist/routes/integration-facets.d.ts +3 -0
- package/dist/routes/interaction-resources.d.ts +5 -0
- package/dist/routes/organization-memberships.d.ts +3 -0
- package/dist/routes/sessions.d.ts +2 -1
- package/dist/routes/slack-task-policy.d.ts +3 -0
- package/dist/routes/supergrok.d.ts +3 -0
- package/dist/sandbox/channel-a.d.ts +8 -1
- package/dist/sandbox/machines.d.ts +2 -2
- package/dist/sandbox/viewer.d.ts +3 -1
- package/dist/slack-reaction-files.d.ts +27 -0
- package/dist/transcription/providers/xai-subscription.d.ts +8 -0
- package/dist/xai-realtime.d.ts +26 -0
- package/dist/xai-subscription-auth.d.ts +23 -0
- package/package.json +17 -16
- package/src/app.ts +352 -49
- package/src/auth/canonical-human-session-admission.ts +116 -0
- package/src/auth/managed-auth.ts +101 -0
- package/src/browser-auth-broker.ts +155 -0
- package/src/browser-controller-authority.ts +50 -1
- package/src/browser-network-route.ts +34 -0
- package/src/controller-data-plane.ts +35 -0
- package/src/http/auth.ts +27 -9
- package/src/http/sse.ts +229 -5
- package/src/integrations/api-integrations.ts +57 -42
- package/src/integrations/fiken.ts +1230 -0
- package/src/integrations/google-drive.ts +31 -26
- package/src/integrations/provider-oauth.ts +70 -91
- package/src/integrations/slack-bot.ts +638 -9
- package/src/integrations/slack-interactions.ts +1583 -73
- package/src/interaction-holder-heartbeat.ts +95 -0
- package/src/interaction-metrics.ts +159 -0
- package/src/mcp/documents.ts +115 -6
- package/src/mcp/server.ts +865 -242
- package/src/model-catalog.ts +19 -6
- package/src/routes/api-integrations.ts +32 -29
- package/src/routes/browser-identities.ts +24 -0
- package/src/routes/browser-sessions.ts +2122 -183
- package/src/routes/canonical-human-identities.ts +156 -0
- package/src/routes/channels.ts +90 -0
- package/src/routes/computer-sessions.ts +441 -86
- package/src/routes/connections.ts +141 -4
- package/src/routes/{integration-features.ts → integration-facets.ts} +63 -63
- package/src/routes/interaction-resources.ts +595 -0
- package/src/routes/organization-memberships.ts +53 -0
- package/src/routes/plugins.ts +2 -1
- package/src/routes/sessions.ts +419 -43
- package/src/routes/skills.ts +92 -10
- package/src/routes/slack-task-policy.ts +115 -0
- package/src/routes/supergrok.ts +717 -0
- package/src/routes/transcription-recordings.ts +9 -2
- package/src/routes/transcriptions.ts +2 -1
- package/src/routes/video-generation.ts +34 -4
- package/src/routes/workspaces.ts +22 -4
- package/src/sandbox/channel-a.ts +29 -2
- package/src/sandbox/machines.ts +5 -5
- package/src/sandbox/viewer.ts +10 -3
- package/src/slack-reaction-files.ts +181 -0
- package/src/transcription/providers/xai-subscription.ts +110 -0
- package/src/transcription/service.ts +17 -2
- package/src/xai-realtime.ts +216 -0
- package/src/xai-subscription-auth.ts +132 -0
- package/dist/chunk-JIKNR5YL.js.map +0 -1
- package/dist/routes/integration-features.d.ts +0 -3
package/src/model-catalog.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
configuredModels,
|
|
3
3
|
configuredProviders,
|
|
4
4
|
withCodexCatalogProvider,
|
|
5
|
+
withXaiSubscriptionCatalogProvider,
|
|
5
6
|
withWorkspaceGatewayCatalogProvider,
|
|
6
7
|
type ConfiguredModel,
|
|
7
8
|
type Settings,
|
|
@@ -37,16 +38,20 @@ export const MODEL_CREDENTIAL_READINESS_OBSERVATION_MAX_AGE_MS = 5 * 60_000;
|
|
|
37
38
|
export function projectClientModel(model: ConfiguredModel): ClientModel {
|
|
38
39
|
const source =
|
|
39
40
|
model.credentialSource.kind === "connected_subscription"
|
|
40
|
-
? "
|
|
41
|
+
? model.credentialSource.provider === "xai"
|
|
42
|
+
? "supergrok"
|
|
43
|
+
: "codex"
|
|
41
44
|
: model.credentialSource.kind === "workspace_connection"
|
|
42
45
|
? "workspace_gateway"
|
|
43
46
|
: "opengeni";
|
|
44
47
|
const publicProvider =
|
|
45
48
|
source === "codex"
|
|
46
49
|
? { provider: "codex", providerLabel: "Codex" }
|
|
47
|
-
: source === "
|
|
48
|
-
? { provider: "
|
|
49
|
-
:
|
|
50
|
+
: source === "supergrok"
|
|
51
|
+
? { provider: "supergrok", providerLabel: "SuperGrok" }
|
|
52
|
+
: source === "workspace_gateway"
|
|
53
|
+
? { provider: "workspace-gateway", providerLabel: "Your Gateway" }
|
|
54
|
+
: { provider: "opengeni", providerLabel: "OpenGeni" };
|
|
50
55
|
return ClientModel.parse({
|
|
51
56
|
id: model.id,
|
|
52
57
|
label: model.label,
|
|
@@ -131,6 +136,7 @@ function credentialReadinessFor(input: {
|
|
|
131
136
|
model: ConfiguredModel;
|
|
132
137
|
provider: ReturnType<typeof configuredProviders>[number] | undefined;
|
|
133
138
|
codexSubscriptionActive: boolean;
|
|
139
|
+
xaiSubscriptionActive: boolean;
|
|
134
140
|
workspaceGatewayConnectionActive: boolean;
|
|
135
141
|
observation: ModelCredentialReadinessObservation | undefined;
|
|
136
142
|
nowMs: number;
|
|
@@ -138,7 +144,9 @@ function credentialReadinessFor(input: {
|
|
|
138
144
|
}): ModelCredentialReadinessV1 {
|
|
139
145
|
const source = input.model.credentialSource;
|
|
140
146
|
if (source.kind === "connected_subscription") {
|
|
141
|
-
|
|
147
|
+
const active =
|
|
148
|
+
source.provider === "xai" ? input.xaiSubscriptionActive : input.codexSubscriptionActive;
|
|
149
|
+
return active
|
|
142
150
|
? { status: "ready", reason: null, basis: "connection", checkedAt: null }
|
|
143
151
|
: {
|
|
144
152
|
status: "not_ready",
|
|
@@ -309,6 +317,7 @@ export function buildWorkspaceModelCatalog(input: {
|
|
|
309
317
|
settings: Settings;
|
|
310
318
|
policy: WorkspaceModelPolicyContract | null;
|
|
311
319
|
codexSubscriptionActive: boolean;
|
|
320
|
+
xaiSubscriptionActive?: boolean;
|
|
312
321
|
workspaceGatewayConnectionActive?: boolean;
|
|
313
322
|
credentialReadinessObservations?:
|
|
314
323
|
| Readonly<Record<string, ModelCredentialReadinessObservation>>
|
|
@@ -320,7 +329,10 @@ export function buildWorkspaceModelCatalog(input: {
|
|
|
320
329
|
const codexSettings = input.settings.codexSubscriptionEnabled
|
|
321
330
|
? withCodexCatalogProvider(input.settings)
|
|
322
331
|
: input.settings;
|
|
323
|
-
const
|
|
332
|
+
const xaiSettings = input.settings.supergrokSubscriptionEnabled
|
|
333
|
+
? withXaiSubscriptionCatalogProvider(codexSettings)
|
|
334
|
+
: codexSettings;
|
|
335
|
+
const catalogSettings = withWorkspaceGatewayCatalogProvider(xaiSettings);
|
|
324
336
|
const providers = new Map(
|
|
325
337
|
configuredProviders(catalogSettings).map((provider) => [provider.id, provider]),
|
|
326
338
|
);
|
|
@@ -341,6 +353,7 @@ export function buildWorkspaceModelCatalog(input: {
|
|
|
341
353
|
model,
|
|
342
354
|
provider,
|
|
343
355
|
codexSubscriptionActive: input.codexSubscriptionActive,
|
|
356
|
+
xaiSubscriptionActive: input.xaiSubscriptionActive === true,
|
|
344
357
|
workspaceGatewayConnectionActive: input.workspaceGatewayConnectionActive === true,
|
|
345
358
|
observation: input.credentialReadinessObservations?.[model.definitionVersion],
|
|
346
359
|
nowMs,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CORE_INTEGRATION_DEFINITIONS,
|
|
3
3
|
createPinnedIntegrationTransport,
|
|
4
|
-
|
|
5
|
-
providerDomainForPreset,
|
|
4
|
+
integrationFacetDefinitions,
|
|
6
5
|
type IntegrationCredentialResolver,
|
|
7
6
|
} from "@opengeni/capabilities";
|
|
8
7
|
import {
|
|
9
8
|
ApiIntegrationPreview,
|
|
10
|
-
|
|
9
|
+
ListIntegrationDefinitionsResponse,
|
|
11
10
|
ApiIntegrationUninstallPreview,
|
|
12
11
|
InstallApiIntegrationRequest,
|
|
13
12
|
InstalledApiIntegration,
|
|
@@ -23,9 +22,9 @@ import {
|
|
|
23
22
|
getApiIntegrationUninstallPreview,
|
|
24
23
|
getConnectionMetadata,
|
|
25
24
|
installApiIntegration,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
IntegrationFacetBindingOwnershipConflictError,
|
|
26
|
+
IntegrationFacetBindingVersionConflictError,
|
|
27
|
+
IntegrationFacetBindingVersionRequiredError,
|
|
29
28
|
listInstalledApiIntegrations,
|
|
30
29
|
uninstallApiIntegration,
|
|
31
30
|
type ConnectionMetadataWithVerification,
|
|
@@ -56,24 +55,26 @@ export function registerApiIntegrationRoutes(
|
|
|
56
55
|
...(overrides.fetchImpl ? { fetchImpl: overrides.fetchImpl } : {}),
|
|
57
56
|
});
|
|
58
57
|
|
|
59
|
-
app.get("/v1/workspaces/:workspaceId/integrations/
|
|
58
|
+
app.get("/v1/workspaces/:workspaceId/integrations/definitions", async (c) => {
|
|
60
59
|
const workspaceId = c.req.param("workspaceId");
|
|
61
60
|
await requireAccessGrant(c, deps, workspaceId, "workspace:read");
|
|
62
61
|
return c.json(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
id:
|
|
66
|
-
name:
|
|
67
|
-
summary:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
ListIntegrationDefinitionsResponse.parse({
|
|
63
|
+
definitions: CORE_INTEGRATION_DEFINITIONS.map((definition) => ({
|
|
64
|
+
id: definition.id,
|
|
65
|
+
name: definition.name,
|
|
66
|
+
summary: definition.summary,
|
|
67
|
+
protocol: definition.protocol,
|
|
68
|
+
provider: { ...definition.provider },
|
|
69
|
+
authentication: {
|
|
70
|
+
kind: definition.authentication.kind,
|
|
71
|
+
scopes: [...definition.authentication.scopes],
|
|
72
|
+
},
|
|
73
|
+
facets: definition.facets.map((facet) => ({
|
|
74
|
+
facetKey: facet.facetKey,
|
|
75
|
+
kind: facet.kind,
|
|
76
|
+
configSchema: { ...facet.configSchema },
|
|
77
|
+
capabilities: { ...facet.capabilities },
|
|
77
78
|
})),
|
|
78
79
|
})),
|
|
79
80
|
}),
|
|
@@ -99,7 +100,8 @@ export function registerApiIntegrationRoutes(
|
|
|
99
100
|
name: integration.name,
|
|
100
101
|
description: integration.description,
|
|
101
102
|
protocol: integration.protocol,
|
|
102
|
-
|
|
103
|
+
definitionId: integration.definitionId,
|
|
104
|
+
definitionProvenance: integration.definitionProvenance,
|
|
103
105
|
providerDomain: integration.providerDomain,
|
|
104
106
|
baseUrl: integration.baseUrl,
|
|
105
107
|
sourceUrl: integration.sourceUrl,
|
|
@@ -193,7 +195,8 @@ export function registerApiIntegrationRoutes(
|
|
|
193
195
|
description: resolved.preview.description,
|
|
194
196
|
category: "integrations",
|
|
195
197
|
tags: [resolved.preview.protocol, resolved.preview.provider ?? "custom"],
|
|
196
|
-
|
|
198
|
+
definitionId: resolved.preview.definitionId,
|
|
199
|
+
definitionProvenance: resolved.preview.definitionProvenance,
|
|
197
200
|
...(resolved.provider ? { provider: resolved.provider } : {}),
|
|
198
201
|
providerDomain: resolved.preview.providerDomain,
|
|
199
202
|
protocol: resolved.preview.protocol,
|
|
@@ -210,7 +213,7 @@ export function registerApiIntegrationRoutes(
|
|
|
210
213
|
ownership:
|
|
211
214
|
resolved.preview.connectionOwnership === "personal" ? "subject" : "workspace",
|
|
212
215
|
...(payload.allowedTools ? { allowedTools: payload.allowedTools } : {}),
|
|
213
|
-
|
|
216
|
+
facetDefinitions: integrationFacetDefinitions(resolved.preview.definitionId),
|
|
214
217
|
revision: resolved.revision,
|
|
215
218
|
}),
|
|
216
219
|
),
|
|
@@ -218,9 +221,9 @@ export function registerApiIntegrationRoutes(
|
|
|
218
221
|
);
|
|
219
222
|
} catch (error) {
|
|
220
223
|
if (
|
|
221
|
-
error instanceof
|
|
222
|
-
error instanceof
|
|
223
|
-
error instanceof
|
|
224
|
+
error instanceof IntegrationFacetBindingVersionConflictError ||
|
|
225
|
+
error instanceof IntegrationFacetBindingVersionRequiredError ||
|
|
226
|
+
error instanceof IntegrationFacetBindingOwnershipConflictError
|
|
224
227
|
) {
|
|
225
228
|
throw new HTTPException(409, {
|
|
226
229
|
message:
|
|
@@ -275,7 +278,7 @@ export function registerApiIntegrationRoutes(
|
|
|
275
278
|
} catch (error) {
|
|
276
279
|
if (
|
|
277
280
|
error instanceof ApiIntegrationInstallationVersionConflictError ||
|
|
278
|
-
error instanceof
|
|
281
|
+
error instanceof IntegrationFacetBindingVersionConflictError
|
|
279
282
|
) {
|
|
280
283
|
throw new HTTPException(409, {
|
|
281
284
|
message:
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BrowserIdentityMutationResponse,
|
|
5
5
|
BrowserRevisionListResponse,
|
|
6
6
|
CreateBrowserIdentityRequest,
|
|
7
|
+
UpdateBrowserIdentityRequest,
|
|
7
8
|
} from "@opengeni/contracts";
|
|
8
9
|
import {
|
|
9
10
|
BrowserIdentityConflictError,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
getBrowserIdentity,
|
|
14
15
|
listBrowserIdentities,
|
|
15
16
|
listBrowserRevisions,
|
|
17
|
+
updateBrowserIdentity,
|
|
16
18
|
} from "@opengeni/db";
|
|
17
19
|
import { requireAccessGrant, type ApiRouteDeps } from "@opengeni/core";
|
|
18
20
|
import type { Context, Hono } from "hono";
|
|
@@ -76,6 +78,28 @@ export function registerBrowserIdentityRoutes(app: Hono, deps: ApiRouteDeps): vo
|
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
|
|
81
|
+
app.patch("/v1/workspaces/:workspaceId/browser-identities/:identityId", async (context) => {
|
|
82
|
+
const workspaceId = context.req.param("workspaceId") ?? "";
|
|
83
|
+
const grant = await requireAccessGrant(context, deps, workspaceId, "sessions:control");
|
|
84
|
+
const identityId = uuidParam(context, "identityId");
|
|
85
|
+
const request = await parseJsonBody(context, UpdateBrowserIdentityRequest);
|
|
86
|
+
try {
|
|
87
|
+
return context.json(
|
|
88
|
+
BrowserIdentityMutationResponse.parse(
|
|
89
|
+
await updateBrowserIdentity(deps.db, {
|
|
90
|
+
accountId: grant.accountId,
|
|
91
|
+
workspaceId,
|
|
92
|
+
identityId,
|
|
93
|
+
actorSubjectId: grant.subjectId,
|
|
94
|
+
...request,
|
|
95
|
+
}),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
throw browserIdentityRouteError(error);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
79
103
|
app.get(
|
|
80
104
|
"/v1/workspaces/:workspaceId/browser-identities/:identityId/revisions",
|
|
81
105
|
async (context) => {
|