@opengeni/core 5.1.1 → 5.2.0-canary.37090756480001

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.
@@ -1,5 +1,6 @@
1
1
  import { modelAllowedByConnections, type ConnectionModelRestrictions } from "@opengeni/db";
2
2
  import {
3
+ withDirectModelProviders,
3
4
  applyModelCatalogDocument,
4
5
  CLAUDE_CONNECTION_KINDS,
5
6
  claudeProviderId,
@@ -36,6 +37,7 @@ import {
36
37
  type WorkspaceModelPolicyContract,
37
38
  } from "@opengeni/contracts";
38
39
  import {
40
+ listConnectionsMetadata,
39
41
  getDeploymentModelCatalog,
40
42
  listWorkspaceProviderCustomModels,
41
43
  getWorkspaceProviderCustomModelForExecution,
@@ -254,6 +256,7 @@ export async function resolveWorkspaceCatalogSettings(
254
256
  organizationOpenRouterCustomModels,
255
257
  retainedOrganizationGatewayCustomModels,
256
258
  retainedOrganizationOpenRouterCustomModels,
259
+ directConnections,
257
260
  ] = await Promise.all([
258
261
  resolveCatalogSettings(db, envSettings),
259
262
  listWorkspaceGatewayCustomModels(db, {
@@ -324,6 +327,9 @@ export async function resolveWorkspaceCatalogSettings(
324
327
  ),
325
328
  )
326
329
  : Promise.resolve([]),
330
+ supportsOrganizationProviderReads
331
+ ? listConnectionsMetadata(db, input.workspaceId, null)
332
+ : Promise.resolve([]),
327
333
  ]);
328
334
  const includeRetainedModels = <T extends { upstreamModelId: string }>(
329
335
  activeModels: readonly T[],
@@ -403,22 +409,25 @@ export async function resolveWorkspaceCatalogSettings(
403
409
  }
404
410
  return {
405
411
  ...resolved,
406
- settings: withClaudeConnectionCatalog(
412
+ settings: withDirectModelProviders(
407
413
  withClaudeConnectionCatalog(
408
- withOrganizationOpenRouterCatalogProvider(
409
- withOrganizationGatewayCatalogProvider(
410
- withWorkspaceOpenRouterCatalogProvider(
411
- withWorkspaceGatewayCatalogProvider(resolved.settings, gatewayCustomModels),
412
- openRouterCustomModels,
414
+ withClaudeConnectionCatalog(
415
+ withOrganizationOpenRouterCatalogProvider(
416
+ withOrganizationGatewayCatalogProvider(
417
+ withWorkspaceOpenRouterCatalogProvider(
418
+ withWorkspaceGatewayCatalogProvider(resolved.settings, gatewayCustomModels),
419
+ openRouterCustomModels,
420
+ ),
421
+ organizationGatewayModels,
413
422
  ),
414
- organizationGatewayModels,
423
+ organizationOpenRouterModels,
415
424
  ),
416
- organizationOpenRouterModels,
425
+ claudeConnections,
417
426
  ),
418
- claudeConnections,
427
+ workspaceClaudeConnections,
428
+ "workspace",
419
429
  ),
420
- workspaceClaudeConnections,
421
- "workspace",
430
+ directConnections,
422
431
  ),
423
432
  };
424
433
  }
@@ -592,11 +601,15 @@ function credentialReadinessFor(input: {
592
601
  const claudeKind = CLAUDE_CONNECTION_KINDS.find(
593
602
  (kind) => claudeProviderId(kind, "workspace") === input.model.providerId,
594
603
  );
595
- const connectionActive = claudeKind
596
- ? input.workspaceClaudeConnections?.[claudeKind]?.active === true
597
- : input.model.providerId === WORKSPACE_OPENROUTER_PROVIDER_ID
598
- ? input.workspaceOpenRouterConnectionActive
599
- : input.workspaceGatewayConnectionActive;
604
+ const connectionActive =
605
+ input.provider?.kind === "direct-openai-workspace" ||
606
+ input.provider?.kind === "direct-azure-workspace"
607
+ ? true
608
+ : claudeKind
609
+ ? input.workspaceClaudeConnections?.[claudeKind]?.active === true
610
+ : input.model.providerId === WORKSPACE_OPENROUTER_PROVIDER_ID
611
+ ? input.workspaceOpenRouterConnectionActive
612
+ : input.workspaceGatewayConnectionActive;
600
613
  return connectionActive
601
614
  ? { status: "ready", reason: null, basis: "connection", checkedAt: null }
602
615
  : {