@opengeni/api-router 2.6.4 → 2.8.1-canary.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.
- package/dist/app.d.ts +2 -1
- package/dist/app.js +3 -1
- package/dist/{chunk-XTLI3CBH.js → chunk-HHKQMVY7.js} +3009 -1699
- package/dist/chunk-HHKQMVY7.js.map +1 -0
- package/dist/github-access.d.ts +25 -2
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/personal-github-repositories.d.ts +41 -2
- package/dist/mcp/scheduled-task-view.d.ts +3 -3
- package/dist/model-catalog.d.ts +5 -31
- package/dist/routes/codex.d.ts +8 -1
- package/dist/routes/github.d.ts +2 -0
- package/dist/routes/organization-model-providers.d.ts +3 -0
- package/dist/workspace-deletion.d.ts +6 -0
- package/package.json +18 -18
- package/src/app.ts +55 -9
- package/src/auth/organization-user-setup.ts +3 -3
- package/src/github-access.ts +117 -1
- package/src/http/sse.ts +15 -7
- package/src/index.ts +13 -1
- package/src/integrations/personal-github-repositories.ts +238 -9
- package/src/integrations/slack-app-home.ts +2 -2
- package/src/integrations/slack-interactions.ts +77 -37
- package/src/mcp/company-brain-governed-writes.ts +2 -2
- package/src/mcp/company-profile-agent-admin.ts +1 -1
- package/src/mcp/remember.ts +1 -1
- package/src/mcp/server.ts +11 -2
- package/src/model-catalog.ts +45 -337
- package/src/routes/automations.ts +178 -19
- package/src/routes/codex.ts +136 -32
- package/src/routes/connections.ts +271 -16
- package/src/routes/github.ts +116 -15
- package/src/routes/organization-memberships.ts +50 -3
- package/src/routes/organization-model-providers.ts +231 -0
- package/src/routes/packs.ts +1 -0
- package/src/routes/personal-github.ts +39 -0
- package/src/routes/pr-review.ts +72 -4
- package/src/routes/scheduled-tasks.ts +40 -13
- package/src/routes/sessions.ts +88 -52
- package/src/routes/supergrok.ts +3 -2
- package/src/routes/workspaces.ts +405 -62
- package/src/workspace-deletion.ts +64 -0
- package/dist/chunk-XTLI3CBH.js.map +0 -1
package/src/routes/sessions.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
GatewayRealtimeConnectRequest,
|
|
13
13
|
ClientSessionEvent,
|
|
14
14
|
CompactSessionContextRequest,
|
|
15
|
+
CreateSessionRequest,
|
|
15
16
|
DeleteSessionQueueItemRequest,
|
|
16
17
|
EditSessionQueueItemRequest,
|
|
17
18
|
EndSessionRealtimeRequest,
|
|
@@ -47,6 +48,7 @@ import {
|
|
|
47
48
|
SessionEventSemanticClass,
|
|
48
49
|
SessionEventType,
|
|
49
50
|
SessionMcpServerId,
|
|
51
|
+
SaveNewSessionDraftRequest,
|
|
50
52
|
compactSessionEventResult,
|
|
51
53
|
sessionEventLatestClassToSemanticClass,
|
|
52
54
|
SaveComposerDraftRequest,
|
|
@@ -195,7 +197,7 @@ import {
|
|
|
195
197
|
import {
|
|
196
198
|
appendAndPublishEvents,
|
|
197
199
|
boundSessionEventHttpPage,
|
|
198
|
-
|
|
200
|
+
coalesceSessionEventDeltasWithCoverage,
|
|
199
201
|
publishDurableSessionEvents,
|
|
200
202
|
} from "@opengeni/events";
|
|
201
203
|
import {
|
|
@@ -231,6 +233,7 @@ import {
|
|
|
231
233
|
requirePermission,
|
|
232
234
|
requireSessionAuthorization,
|
|
233
235
|
requireSessionAuthorizationListScope,
|
|
236
|
+
resolveWorkspaceCatalogSettings,
|
|
234
237
|
withResolvedSessionAuthorization,
|
|
235
238
|
SESSION_AUTHORIZATION_DEFAULT_REAUTHORIZE_MS,
|
|
236
239
|
SessionAuthorizationDeniedError,
|
|
@@ -549,6 +552,7 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
549
552
|
}
|
|
550
553
|
let session: Session;
|
|
551
554
|
try {
|
|
555
|
+
CreateSessionRequest.parse(payload);
|
|
552
556
|
session = await createSessionForRequest(deps, grant, workspaceId, payload, authorization);
|
|
553
557
|
} catch (error) {
|
|
554
558
|
return sessionCreateErrorResponse(c, error);
|
|
@@ -562,7 +566,13 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
562
566
|
app.get("/v1/workspaces/:workspaceId/new-session-draft", async (c) => {
|
|
563
567
|
const workspaceId = c.req.param("workspaceId");
|
|
564
568
|
const grant = await requireAccessGrant(c, deps, workspaceId, "sessions:read");
|
|
565
|
-
|
|
569
|
+
const catalog = await resolveWorkspaceCatalogSettings(db, settings, {
|
|
570
|
+
accountId: grant.accountId,
|
|
571
|
+
workspaceId,
|
|
572
|
+
});
|
|
573
|
+
return c.json(
|
|
574
|
+
await getActorNewSessionDraft({ settings: catalog.settings, db }, grant, workspaceId),
|
|
575
|
+
);
|
|
566
576
|
});
|
|
567
577
|
|
|
568
578
|
app.put("/v1/workspaces/:workspaceId/new-session-draft", async (c) => {
|
|
@@ -587,9 +597,14 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
587
597
|
);
|
|
588
598
|
}
|
|
589
599
|
try {
|
|
600
|
+
SaveNewSessionDraftRequest.parse(payload);
|
|
601
|
+
const catalog = await resolveWorkspaceCatalogSettings(db, settings, {
|
|
602
|
+
accountId: grant.accountId,
|
|
603
|
+
workspaceId,
|
|
604
|
+
});
|
|
590
605
|
return c.json(
|
|
591
606
|
await saveActorNewSessionDraft(
|
|
592
|
-
{ settings, db, objectStorage },
|
|
607
|
+
{ settings: catalog.settings, db, objectStorage },
|
|
593
608
|
grant,
|
|
594
609
|
workspaceId,
|
|
595
610
|
payload,
|
|
@@ -2606,10 +2621,16 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
2606
2621
|
c.header("X-OpenGeni-Covered-Last", String(result.coveredSequence.last));
|
|
2607
2622
|
return c.json(result);
|
|
2608
2623
|
}
|
|
2609
|
-
const
|
|
2624
|
+
const compactProjection = compact ? coalesceSessionEventDeltasWithCoverage(events) : null;
|
|
2625
|
+
const projected = compactProjection?.events ?? events;
|
|
2626
|
+
const forensicExact =
|
|
2627
|
+
!compact && mode === "forensic" && payloadMode === "full" && dbPage.fullPayloadsExact;
|
|
2610
2628
|
const page = boundSessionEventHttpPage(projected, {
|
|
2611
2629
|
direction,
|
|
2612
|
-
eventProjection:
|
|
2630
|
+
eventProjection: forensicExact ? "exact" : "bounded",
|
|
2631
|
+
...(compactProjection
|
|
2632
|
+
? { coveredThroughBySequence: compactProjection.coveredThroughBySequence }
|
|
2633
|
+
: {}),
|
|
2613
2634
|
});
|
|
2614
2635
|
const hasMore = dbPage.hasMore || page.truncated;
|
|
2615
2636
|
c.header("X-OpenGeni-Page-Bytes", String(page.bytes));
|
|
@@ -2619,9 +2640,14 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
2619
2640
|
c.header("X-OpenGeni-Event-Mode", mode);
|
|
2620
2641
|
c.header("X-OpenGeni-Event-Direction", direction);
|
|
2621
2642
|
c.header("X-OpenGeni-Payload-Mode", payloadMode);
|
|
2622
|
-
c.header("X-OpenGeni-Forensic-Exact", String(
|
|
2643
|
+
c.header("X-OpenGeni-Forensic-Exact", String(forensicExact));
|
|
2623
2644
|
const coveredFirst = page.events[0]?.sequence;
|
|
2624
|
-
const
|
|
2645
|
+
const coveredLastEvent = page.events.at(-1);
|
|
2646
|
+
const coveredLast =
|
|
2647
|
+
coveredLastEvent === undefined
|
|
2648
|
+
? undefined
|
|
2649
|
+
: (compactProjection?.coveredThroughBySequence.get(coveredLastEvent.sequence) ??
|
|
2650
|
+
coveredLastEvent.sequence);
|
|
2625
2651
|
if (coveredFirst !== undefined) c.header("X-OpenGeni-Covered-First", String(coveredFirst));
|
|
2626
2652
|
if (coveredLast !== undefined) c.header("X-OpenGeni-Covered-Last", String(coveredLast));
|
|
2627
2653
|
const truncatedBy = page.truncated ? "http_bytes" : dbPage.truncatedBy;
|
|
@@ -2898,28 +2924,33 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
2898
2924
|
const sessionId = c.req.param("sessionId");
|
|
2899
2925
|
await assertSessionExists(db, workspaceId, sessionId);
|
|
2900
2926
|
const payload = parseSteerSessionAdmission(await c.req.json().catch(() => null));
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
? {
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2927
|
+
let result: Awaited<ReturnType<typeof acceptSessionUserMessage>>;
|
|
2928
|
+
try {
|
|
2929
|
+
result = await acceptSessionUserMessage(deps, grant, workspaceId, sessionId, {
|
|
2930
|
+
text: payload.text,
|
|
2931
|
+
annotations: payload.annotations,
|
|
2932
|
+
modelContext: payload.modelContext ?? null,
|
|
2933
|
+
resources: payload.resources,
|
|
2934
|
+
model: payload.model ?? null,
|
|
2935
|
+
reasoningEffort: payload.reasoningEffort ?? null,
|
|
2936
|
+
latencyMode: payload.latencyMode ?? null,
|
|
2937
|
+
mcpCredentialUpdates: payload.mcpCredentialUpdates ?? [],
|
|
2938
|
+
connectionAuthorities: payload.connectionAuthorities,
|
|
2939
|
+
...(payload.personalResourceAttachment
|
|
2940
|
+
? { personalResourceAttachment: payload.personalResourceAttachment }
|
|
2941
|
+
: {}),
|
|
2942
|
+
authorization,
|
|
2943
|
+
delivery: "steer",
|
|
2944
|
+
origin: "human",
|
|
2945
|
+
...(payload.controlEtag !== undefined ? { controlEtag: payload.controlEtag } : {}),
|
|
2946
|
+
...(payload.expectedDraftRevision !== undefined
|
|
2947
|
+
? { expectedDraftRevision: payload.expectedDraftRevision }
|
|
2948
|
+
: {}),
|
|
2949
|
+
...(payload.clientEventId ? { clientEventId: payload.clientEventId } : {}),
|
|
2950
|
+
});
|
|
2951
|
+
} catch (error) {
|
|
2952
|
+
return commandConflictResponse(c, error);
|
|
2953
|
+
}
|
|
2923
2954
|
return c.json(result, 202);
|
|
2924
2955
|
});
|
|
2925
2956
|
|
|
@@ -2975,29 +3006,34 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
|
|
|
2975
3006
|
}
|
|
2976
3007
|
}
|
|
2977
3008
|
if (event.type === "user.message") {
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3009
|
+
let result: Awaited<ReturnType<typeof acceptSessionUserMessage>>;
|
|
3010
|
+
try {
|
|
3011
|
+
result = await acceptSessionUserMessage(deps, grant, workspaceId, sessionId, {
|
|
3012
|
+
text: event.payload.text,
|
|
3013
|
+
annotations: event.payload.annotations,
|
|
3014
|
+
modelContext: event.payload.modelContext ?? null,
|
|
3015
|
+
resources: event.payload.resources ?? [],
|
|
3016
|
+
model: event.payload.model ?? null,
|
|
3017
|
+
reasoningEffort: event.payload.reasoningEffort ?? null,
|
|
3018
|
+
latencyMode: event.payload.latencyMode ?? null,
|
|
3019
|
+
mcpCredentialUpdates: event.payload.mcpCredentialUpdates ?? [],
|
|
3020
|
+
connectionAuthorities: event.payload.connectionAuthorities,
|
|
3021
|
+
...(event.payload.personalResourceAttachment
|
|
3022
|
+
? { personalResourceAttachment: event.payload.personalResourceAttachment }
|
|
3023
|
+
: {}),
|
|
3024
|
+
authorization,
|
|
3025
|
+
...(event.payload.controlEtag !== undefined
|
|
3026
|
+
? { controlEtag: event.payload.controlEtag }
|
|
3027
|
+
: {}),
|
|
3028
|
+
...(event.payload.expectedDraftRevision !== undefined
|
|
3029
|
+
? { expectedDraftRevision: event.payload.expectedDraftRevision }
|
|
3030
|
+
: {}),
|
|
3031
|
+
...(event.clientEventId ? { clientEventId: event.clientEventId } : {}),
|
|
3032
|
+
});
|
|
3033
|
+
} catch (error) {
|
|
3034
|
+
return commandConflictResponse(c, error);
|
|
3035
|
+
}
|
|
3036
|
+
return c.json(result.accepted, 202);
|
|
3001
3037
|
}
|
|
3002
3038
|
|
|
3003
3039
|
if (event.type === "user.approvalDecision") {
|
package/src/routes/supergrok.ts
CHANGED
|
@@ -552,8 +552,9 @@ export function registerSuperGrokRoutes(app: Hono, deps: ApiRouteDeps): void {
|
|
|
552
552
|
} catch {
|
|
553
553
|
valid = false;
|
|
554
554
|
}
|
|
555
|
-
const
|
|
556
|
-
|
|
555
|
+
const catalogSettings = valid ? (await deps.resolveCatalogSettings()).settings : null;
|
|
556
|
+
const catalog = catalogSettings
|
|
557
|
+
? configuredModels(withXaiSubscriptionCatalogProvider(catalogSettings))
|
|
557
558
|
.filter(
|
|
558
559
|
(model) =>
|
|
559
560
|
model.credentialSource.kind === "connected_subscription" &&
|