@opengeni/api-router 0.16.4 → 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-TFHWQL2W.js → chunk-FGNCK7HE.js} +27 -13
- 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/workspaces.ts +4 -1
- package/dist/chunk-TFHWQL2W.js.map +0 -1
package/dist/app.js
CHANGED
|
@@ -19474,7 +19474,8 @@ import {
|
|
|
19474
19474
|
updateWorkspace,
|
|
19475
19475
|
updateWorkspaceSettings,
|
|
19476
19476
|
upsertWorkspaceModelPolicy,
|
|
19477
|
-
workspaceCodexSubscriptionActive
|
|
19477
|
+
workspaceCodexSubscriptionActive,
|
|
19478
|
+
workspaceVercelAiGatewayConnectionActive
|
|
19478
19479
|
} from "@opengeni/db";
|
|
19479
19480
|
import { boundWorkspaceControlHttpPage } from "@opengeni/events";
|
|
19480
19481
|
import { HTTPException as HTTPException26 } from "hono/http-exception";
|
|
@@ -19491,7 +19492,8 @@ import {
|
|
|
19491
19492
|
import {
|
|
19492
19493
|
configuredModels,
|
|
19493
19494
|
configuredProviders,
|
|
19494
|
-
withCodexCatalogProvider
|
|
19495
|
+
withCodexCatalogProvider,
|
|
19496
|
+
withWorkspaceGatewayCatalogProvider
|
|
19495
19497
|
} from "@opengeni/config";
|
|
19496
19498
|
import {
|
|
19497
19499
|
ClientModel,
|
|
@@ -19500,18 +19502,18 @@ import {
|
|
|
19500
19502
|
} from "@opengeni/contracts";
|
|
19501
19503
|
var MODEL_CREDENTIAL_READINESS_OBSERVATION_MAX_AGE_MS = 5 * 6e4;
|
|
19502
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" };
|
|
19503
19507
|
return ClientModel.parse({
|
|
19504
19508
|
id: model.id,
|
|
19505
19509
|
label: model.label,
|
|
19506
|
-
|
|
19507
|
-
|
|
19510
|
+
...publicProvider,
|
|
19511
|
+
source,
|
|
19508
19512
|
api: model.api,
|
|
19509
19513
|
...model.contextWindowTokens === void 0 ? {} : { contextWindowTokens: model.contextWindowTokens },
|
|
19510
19514
|
schemaVersion: model.schemaVersion,
|
|
19511
19515
|
aliases: model.aliases,
|
|
19512
|
-
deployment: model.deployment,
|
|
19513
19516
|
executionLimits: model.executionLimits,
|
|
19514
|
-
credentialSource: model.credentialSource,
|
|
19515
19517
|
billing: model.billing,
|
|
19516
19518
|
capabilities: model.capabilities,
|
|
19517
19519
|
...model.pricing === void 0 ? {} : { pricing: model.pricing },
|
|
@@ -19576,6 +19578,14 @@ function credentialReadinessFor(input) {
|
|
|
19576
19578
|
checkedAt: null
|
|
19577
19579
|
};
|
|
19578
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
|
+
}
|
|
19579
19589
|
if (source.kind === "deployment" && source.mechanism === "api_key") {
|
|
19580
19590
|
return input.provider?.apiKey ? { status: "ready", reason: null, basis: "configuration", checkedAt: null } : {
|
|
19581
19591
|
status: "not_ready",
|
|
@@ -19586,7 +19596,7 @@ function credentialReadinessFor(input) {
|
|
|
19586
19596
|
}
|
|
19587
19597
|
return observedCredentialReadiness({
|
|
19588
19598
|
observation: input.observation,
|
|
19589
|
-
basis:
|
|
19599
|
+
basis: "resolver",
|
|
19590
19600
|
nowMs: input.nowMs,
|
|
19591
19601
|
maxAgeMs: input.maxAgeMs
|
|
19592
19602
|
});
|
|
@@ -19676,7 +19686,8 @@ function availabilityFor(input) {
|
|
|
19676
19686
|
};
|
|
19677
19687
|
}
|
|
19678
19688
|
function buildWorkspaceModelCatalog(input) {
|
|
19679
|
-
const
|
|
19689
|
+
const codexSettings = input.settings.codexSubscriptionEnabled ? withCodexCatalogProvider(input.settings) : input.settings;
|
|
19690
|
+
const catalogSettings = withWorkspaceGatewayCatalogProvider(codexSettings);
|
|
19680
19691
|
const providers = new Map(
|
|
19681
19692
|
configuredProviders(catalogSettings).map((provider) => [provider.id, provider])
|
|
19682
19693
|
);
|
|
@@ -19689,6 +19700,7 @@ function buildWorkspaceModelCatalog(input) {
|
|
|
19689
19700
|
model,
|
|
19690
19701
|
provider,
|
|
19691
19702
|
codexSubscriptionActive: input.codexSubscriptionActive,
|
|
19703
|
+
workspaceGatewayConnectionActive: input.workspaceGatewayConnectionActive === true,
|
|
19692
19704
|
observation: input.credentialReadinessObservations?.[model.definitionVersion],
|
|
19693
19705
|
nowMs,
|
|
19694
19706
|
maxAgeMs
|
|
@@ -19796,9 +19808,10 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
19796
19808
|
app.get("/v1/workspaces/:workspaceId/model-catalog", async (c) => {
|
|
19797
19809
|
const workspaceId = c.req.param("workspaceId");
|
|
19798
19810
|
await requireAccessGrant16(c, deps, workspaceId, "workspace:read");
|
|
19799
|
-
const [policy, codexSubscriptionActive] = await Promise.all([
|
|
19811
|
+
const [policy, codexSubscriptionActive, workspaceGatewayConnectionActive] = await Promise.all([
|
|
19800
19812
|
getWorkspaceModelPolicy(deps.db, workspaceId),
|
|
19801
|
-
workspaceCodexSubscriptionActive(deps.db, deps.settings, workspaceId)
|
|
19813
|
+
workspaceCodexSubscriptionActive(deps.db, deps.settings, workspaceId),
|
|
19814
|
+
workspaceVercelAiGatewayConnectionActive(deps.db, workspaceId)
|
|
19802
19815
|
]);
|
|
19803
19816
|
c.header("cache-control", "private, no-store");
|
|
19804
19817
|
return c.json(
|
|
@@ -19806,7 +19819,8 @@ function registerWorkspaceRoutes(app, deps) {
|
|
|
19806
19819
|
buildWorkspaceModelCatalog({
|
|
19807
19820
|
settings: deps.settings,
|
|
19808
19821
|
policy,
|
|
19809
|
-
codexSubscriptionActive
|
|
19822
|
+
codexSubscriptionActive,
|
|
19823
|
+
workspaceGatewayConnectionActive
|
|
19810
19824
|
})
|
|
19811
19825
|
)
|
|
19812
19826
|
);
|
|
@@ -22774,7 +22788,7 @@ function createAppComposition(deps) {
|
|
|
22774
22788
|
// Provider-grouped model list for the picker. configuredModels() carries the
|
|
22775
22789
|
// union of the built-in allow-list and every registry provider's models, in
|
|
22776
22790
|
// selection order (default model first); project each to the client-safe
|
|
22777
|
-
// ClientModel shape (
|
|
22791
|
+
// provider-blind ClientModel shape (execution topology remains server-side).
|
|
22778
22792
|
models: configuredModels2(catalogSettings).map(projectClientModel),
|
|
22779
22793
|
defaultReasoningEffort: deps.settings.openaiReasoningEffort,
|
|
22780
22794
|
allowedReasoningEfforts: configuredAllowedReasoningEfforts(deps.settings),
|
|
@@ -23544,4 +23558,4 @@ export {
|
|
|
23544
23558
|
withDefaultEnabledCapabilityMcpTools,
|
|
23545
23559
|
workflowIdForSession2 as workflowIdForSession
|
|
23546
23560
|
};
|
|
23547
|
-
//# sourceMappingURL=chunk-
|
|
23561
|
+
//# sourceMappingURL=chunk-FGNCK7HE.js.map
|