@opengeni/api-router 0.16.1 → 0.16.5
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.js +1 -1
- package/dist/{chunk-ZD5YBUNA.js → chunk-FGNCK7HE.js} +34 -16
- package/dist/chunk-FGNCK7HE.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/model-catalog.d.ts +1 -0
- package/package.json +11 -11
- package/src/app.ts +1 -1
- package/src/model-catalog.ts +31 -6
- package/src/routes/documents.ts +8 -3
- package/src/routes/sessions.ts +1 -0
- package/src/routes/workspaces.ts +4 -1
- package/dist/chunk-ZD5YBUNA.js.map +0 -1
package/dist/app.js
CHANGED
|
@@ -11999,7 +11999,7 @@ import {
|
|
|
11999
11999
|
ensureDefaultBase,
|
|
12000
12000
|
getDocument,
|
|
12001
12001
|
getDocumentBase,
|
|
12002
|
-
|
|
12002
|
+
listDocumentBasesEnsuringDefault,
|
|
12003
12003
|
listDocuments,
|
|
12004
12004
|
moveDocumentToBase,
|
|
12005
12005
|
queueDocumentForReindex,
|
|
@@ -12677,9 +12677,12 @@ function registerDocumentRoutes(app, deps) {
|
|
|
12677
12677
|
});
|
|
12678
12678
|
app.get("/v1/workspaces/:workspaceId/document-bases", async (c) => {
|
|
12679
12679
|
const workspaceId = c.req.param("workspaceId");
|
|
12680
|
-
await requireAccessGrant5(c, deps, workspaceId, "documents:search");
|
|
12680
|
+
const grant = await requireAccessGrant5(c, deps, workspaceId, "documents:search");
|
|
12681
12681
|
return c.json(
|
|
12682
|
-
(await
|
|
12682
|
+
(await listDocumentBasesEnsuringDefault(db, {
|
|
12683
|
+
accountId: grant.accountId,
|
|
12684
|
+
workspaceId
|
|
12685
|
+
})).map((base) => DocumentBase.parse(base))
|
|
12683
12686
|
);
|
|
12684
12687
|
});
|
|
12685
12688
|
app.get("/v1/workspaces/:workspaceId/document-bases/:baseId", async (c) => {
|
|
@@ -18205,6 +18208,7 @@ function registerSessionRoutes(app, deps) {
|
|
|
18205
18208
|
accountId: grant.accountId,
|
|
18206
18209
|
workspaceId,
|
|
18207
18210
|
sessionId,
|
|
18211
|
+
subjectId: grant.subjectId,
|
|
18208
18212
|
payload: event.payload,
|
|
18209
18213
|
clientEventId: event.clientEventId ?? null
|
|
18210
18214
|
});
|
|
@@ -19470,7 +19474,8 @@ import {
|
|
|
19470
19474
|
updateWorkspace,
|
|
19471
19475
|
updateWorkspaceSettings,
|
|
19472
19476
|
upsertWorkspaceModelPolicy,
|
|
19473
|
-
workspaceCodexSubscriptionActive
|
|
19477
|
+
workspaceCodexSubscriptionActive,
|
|
19478
|
+
workspaceVercelAiGatewayConnectionActive
|
|
19474
19479
|
} from "@opengeni/db";
|
|
19475
19480
|
import { boundWorkspaceControlHttpPage } from "@opengeni/events";
|
|
19476
19481
|
import { HTTPException as HTTPException26 } from "hono/http-exception";
|
|
@@ -19487,7 +19492,8 @@ import {
|
|
|
19487
19492
|
import {
|
|
19488
19493
|
configuredModels,
|
|
19489
19494
|
configuredProviders,
|
|
19490
|
-
withCodexCatalogProvider
|
|
19495
|
+
withCodexCatalogProvider,
|
|
19496
|
+
withWorkspaceGatewayCatalogProvider
|
|
19491
19497
|
} from "@opengeni/config";
|
|
19492
19498
|
import {
|
|
19493
19499
|
ClientModel,
|
|
@@ -19496,18 +19502,18 @@ import {
|
|
|
19496
19502
|
} from "@opengeni/contracts";
|
|
19497
19503
|
var MODEL_CREDENTIAL_READINESS_OBSERVATION_MAX_AGE_MS = 5 * 6e4;
|
|
19498
19504
|
function projectClientModel(model) {
|
|
19505
|
+
const source = model.credentialSource.kind === "connected_subscription" ? "codex" : model.credentialSource.kind === "workspace_connection" ? "workspace_gateway" : "opengeni";
|
|
19506
|
+
const publicProvider = source === "codex" ? { provider: "codex", providerLabel: "Codex" } : source === "workspace_gateway" ? { provider: "workspace-gateway", providerLabel: "Your Gateway" } : { provider: "opengeni", providerLabel: "OpenGeni" };
|
|
19499
19507
|
return ClientModel.parse({
|
|
19500
19508
|
id: model.id,
|
|
19501
19509
|
label: model.label,
|
|
19502
|
-
|
|
19503
|
-
|
|
19510
|
+
...publicProvider,
|
|
19511
|
+
source,
|
|
19504
19512
|
api: model.api,
|
|
19505
19513
|
...model.contextWindowTokens === void 0 ? {} : { contextWindowTokens: model.contextWindowTokens },
|
|
19506
19514
|
schemaVersion: model.schemaVersion,
|
|
19507
19515
|
aliases: model.aliases,
|
|
19508
|
-
deployment: model.deployment,
|
|
19509
19516
|
executionLimits: model.executionLimits,
|
|
19510
|
-
credentialSource: model.credentialSource,
|
|
19511
19517
|
billing: model.billing,
|
|
19512
19518
|
capabilities: model.capabilities,
|
|
19513
19519
|
...model.pricing === void 0 ? {} : { pricing: model.pricing },
|
|
@@ -19572,6 +19578,14 @@ function credentialReadinessFor(input) {
|
|
|
19572
19578
|
checkedAt: null
|
|
19573
19579
|
};
|
|
19574
19580
|
}
|
|
19581
|
+
if (source.kind === "workspace_connection") {
|
|
19582
|
+
return input.workspaceGatewayConnectionActive ? { status: "ready", reason: null, basis: "connection", checkedAt: null } : {
|
|
19583
|
+
status: "not_ready",
|
|
19584
|
+
reason: "needs_reauth",
|
|
19585
|
+
basis: "connection",
|
|
19586
|
+
checkedAt: null
|
|
19587
|
+
};
|
|
19588
|
+
}
|
|
19575
19589
|
if (source.kind === "deployment" && source.mechanism === "api_key") {
|
|
19576
19590
|
return input.provider?.apiKey ? { status: "ready", reason: null, basis: "configuration", checkedAt: null } : {
|
|
19577
19591
|
status: "not_ready",
|
|
@@ -19582,7 +19596,7 @@ function credentialReadinessFor(input) {
|
|
|
19582
19596
|
}
|
|
19583
19597
|
return observedCredentialReadiness({
|
|
19584
19598
|
observation: input.observation,
|
|
19585
|
-
basis:
|
|
19599
|
+
basis: "resolver",
|
|
19586
19600
|
nowMs: input.nowMs,
|
|
19587
19601
|
maxAgeMs: input.maxAgeMs
|
|
19588
19602
|
});
|
|
@@ -19672,7 +19686,8 @@ function availabilityFor(input) {
|
|
|
19672
19686
|
};
|
|
19673
19687
|
}
|
|
19674
19688
|
function buildWorkspaceModelCatalog(input) {
|
|
19675
|
-
const
|
|
19689
|
+
const codexSettings = input.settings.codexSubscriptionEnabled ? withCodexCatalogProvider(input.settings) : input.settings;
|
|
19690
|
+
const catalogSettings = withWorkspaceGatewayCatalogProvider(codexSettings);
|
|
19676
19691
|
const providers = new Map(
|
|
19677
19692
|
configuredProviders(catalogSettings).map((provider) => [provider.id, provider])
|
|
19678
19693
|
);
|
|
@@ -19685,6 +19700,7 @@ function buildWorkspaceModelCatalog(input) {
|
|
|
19685
19700
|
model,
|
|
19686
19701
|
provider,
|
|
19687
19702
|
codexSubscriptionActive: input.codexSubscriptionActive,
|
|
19703
|
+
workspaceGatewayConnectionActive: input.workspaceGatewayConnectionActive === true,
|
|
19688
19704
|
observation: input.credentialReadinessObservations?.[model.definitionVersion],
|
|
19689
19705
|
nowMs,
|
|
19690
19706
|
maxAgeMs
|
|
@@ -19792,9 +19808,10 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
19792
19808
|
app.get("/v1/workspaces/:workspaceId/model-catalog", async (c) => {
|
|
19793
19809
|
const workspaceId = c.req.param("workspaceId");
|
|
19794
19810
|
await requireAccessGrant16(c, deps, workspaceId, "workspace:read");
|
|
19795
|
-
const [policy, codexSubscriptionActive] = await Promise.all([
|
|
19811
|
+
const [policy, codexSubscriptionActive, workspaceGatewayConnectionActive] = await Promise.all([
|
|
19796
19812
|
getWorkspaceModelPolicy(deps.db, workspaceId),
|
|
19797
|
-
workspaceCodexSubscriptionActive(deps.db, deps.settings, workspaceId)
|
|
19813
|
+
workspaceCodexSubscriptionActive(deps.db, deps.settings, workspaceId),
|
|
19814
|
+
workspaceVercelAiGatewayConnectionActive(deps.db, workspaceId)
|
|
19798
19815
|
]);
|
|
19799
19816
|
c.header("cache-control", "private, no-store");
|
|
19800
19817
|
return c.json(
|
|
@@ -19802,7 +19819,8 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
19802
19819
|
buildWorkspaceModelCatalog({
|
|
19803
19820
|
settings: deps.settings,
|
|
19804
19821
|
policy,
|
|
19805
|
-
codexSubscriptionActive
|
|
19822
|
+
codexSubscriptionActive,
|
|
19823
|
+
workspaceGatewayConnectionActive
|
|
19806
19824
|
})
|
|
19807
19825
|
)
|
|
19808
19826
|
);
|
|
@@ -22770,7 +22788,7 @@ function createAppComposition(deps) {
|
|
|
22770
22788
|
// Provider-grouped model list for the picker. configuredModels() carries the
|
|
22771
22789
|
// union of the built-in allow-list and every registry provider's models, in
|
|
22772
22790
|
// selection order (default model first); project each to the client-safe
|
|
22773
|
-
// ClientModel shape (
|
|
22791
|
+
// provider-blind ClientModel shape (execution topology remains server-side).
|
|
22774
22792
|
models: configuredModels2(catalogSettings).map(projectClientModel),
|
|
22775
22793
|
defaultReasoningEffort: deps.settings.openaiReasoningEffort,
|
|
22776
22794
|
allowedReasoningEfforts: configuredAllowedReasoningEfforts(deps.settings),
|
|
@@ -23540,4 +23558,4 @@ export {
|
|
|
23540
23558
|
withDefaultEnabledCapabilityMcpTools,
|
|
23541
23559
|
workflowIdForSession2 as workflowIdForSession
|
|
23542
23560
|
};
|
|
23543
|
-
//# sourceMappingURL=chunk-
|
|
23561
|
+
//# sourceMappingURL=chunk-FGNCK7HE.js.map
|