@opengeni/core 3.0.2-canary.38894290271001 → 3.1.2

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.
@@ -155,6 +155,11 @@ export declare function loadWorkspaceModelSelectionInput(db: Database, settings:
155
155
  export declare function resolveCallerWorkspaceModelSelections(db: Database, settings: Settings, context: WorkspaceModelSelectionContext, options?: {
156
156
  observeAvailability?: boolean;
157
157
  }): Promise<WorkspaceModelSelection[]>;
158
+ /**
159
+ * Catalog membership only: true while the workspace still lists the model,
160
+ * selectable or not. Retired and removed models are not listed.
161
+ */
162
+ export declare function workspaceCatalogListsModel(selections: readonly WorkspaceModelSelection[], modelId: string): boolean;
158
163
  /** Transient selectability for existing consumers; not fresh-create admission. */
159
164
  export declare function selectableWorkspaceModel(selections: readonly WorkspaceModelSelection[], modelId: string): WorkspaceModelSelection | undefined;
160
165
  /** Same stable decision used by client config and direct fresh session creation. */
@@ -21,6 +21,7 @@ type ListedTool = {
21
21
  destructiveHint?: boolean | undefined;
22
22
  title?: string | undefined;
23
23
  } | undefined;
24
+ _meta?: Record<string, unknown> | undefined;
24
25
  };
25
26
  export declare function connectorToolGroup(tool: ListedTool): "read" | "write" | "other";
26
27
  /** A selector can supply discovery credentials only when one visible account
package/dist/index.js CHANGED
@@ -9881,6 +9881,9 @@ async function resolveCallerWorkspaceModelSelections(db, settings, context, opti
9881
9881
  })
9882
9882
  );
9883
9883
  }
9884
+ function workspaceCatalogListsModel(selections, modelId) {
9885
+ return findSelection(selections, modelId) !== void 0;
9886
+ }
9884
9887
  function selectableWorkspaceModel(selections, modelId) {
9885
9888
  const selection = findSelection(selections, modelId);
9886
9889
  return selection?.availability.selectable ? selection : void 0;
@@ -26162,11 +26165,29 @@ async function actorDefaultModel(deps, grant, workspaceId) {
26162
26165
  subjectId: grant.subjectId
26163
26166
  });
26164
26167
  }
26168
+ async function workspaceCatalogMayHaveModel(deps, grant, workspaceId, modelId) {
26169
+ try {
26170
+ const selections = await resolveCallerWorkspaceModelSelections(deps.db, deps.settings, {
26171
+ accountId: grant.accountId,
26172
+ workspaceId,
26173
+ subjectId: grant.subjectId
26174
+ });
26175
+ return workspaceCatalogListsModel(
26176
+ selections,
26177
+ canonicalizeConfiguredModelId6(deps.settings, modelId)
26178
+ );
26179
+ } catch {
26180
+ return true;
26181
+ }
26182
+ }
26165
26183
  async function hydrateNewSessionDraft(deps, grant, workspaceId, row, readOptions = {}) {
26166
26184
  if (!row) return null;
26167
26185
  const stored2 = mapNewSessionDraft(row);
26168
26186
  if (!stored2) return null;
26169
- const modelProvided = draftModelProvided(deps.settings, stored2);
26187
+ let modelProvided = draftModelProvided(deps.settings, stored2);
26188
+ if (modelProvided && readOptions.projectDefaultModel !== false && !await workspaceCatalogMayHaveModel(deps, grant, workspaceId, stored2.model)) {
26189
+ modelProvided = false;
26190
+ }
26170
26191
  let mapped = { ...stored2, modelProvided };
26171
26192
  if (!modelProvided && readOptions.projectDefaultModel !== false) {
26172
26193
  const resolved = await actorDefaultModel(deps, grant, workspaceId);
@@ -27836,6 +27857,7 @@ import {
27836
27857
  assertMcpToolListWithinBounds
27837
27858
  } from "@opengeni/runtime/mcp-network";
27838
27859
  import { createPinnedIntegrationTransport as createPinnedIntegrationTransport2 } from "@opengeni/capabilities";
27860
+ import { mcpToolRecommendsApproval } from "@opengeni/contracts";
27839
27861
  import {
27840
27862
  buildConnectionTokenResolver,
27841
27863
  getConnectionMetadata as getConnectionMetadata6,
@@ -28116,7 +28138,7 @@ async function getConnectorToolPermissions(input) {
28116
28138
  connectionId: target.connectionId,
28117
28139
  serverId: target.server.id,
28118
28140
  toolName: tool.name,
28119
- defaultDecision: target.server.requireApproval === true || Array.isArray(target.server.requireApproval) && target.server.requireApproval.includes(tool.name) ? "ask" : "allow"
28141
+ defaultDecision: target.server.requireApproval === true || Array.isArray(target.server.requireApproval) && target.server.requireApproval.includes(tool.name) || mcpToolRecommendsApproval(tool) ? "ask" : "allow"
28120
28142
  })
28121
28143
  })
28122
28144
  ),
@@ -29040,6 +29062,7 @@ export {
29040
29062
  withWorkspaceDefaultMcpTools,
29041
29063
  withXaiSubscriptionProvider,
29042
29064
  workflowIdForSession,
29065
+ workspaceCatalogListsModel,
29043
29066
  workspaceCreditsDisabled,
29044
29067
  workspaceCustomModelReference,
29045
29068
  workspaceInsightsPhaseMetricObserver,