@opengeni/api-router 6.37.0 → 6.37.1-canary.45137095157001

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.
@@ -99,7 +99,13 @@ export type AppServerRunInput = {
99
99
  */
100
100
  export declare function runAppServer(deps: AppServerDeps, input: AppServerRunInput): Promise<AppServerFetchResponse>;
101
101
  /** The viewer the code sees for a workspace grant (a member in the console, or their agent). */
102
- export declare function appServerViewerForGrant(deps: Pick<ApiRouteDeps, "db">, grant: AccessGrant): Promise<AppServerViewer>;
102
+ export declare function appServerViewerForGrant(deps: Pick<ApiRouteDeps, "db">, grant: AccessGrant, subjectId?: string): Promise<AppServerViewer>;
103
+ /**
104
+ * The person a grant acts for, as app data resolves it: its own subject, or
105
+ * for an agent the person behind its live turn. Null for a turn without a
106
+ * person (a schedule, a key).
107
+ */
108
+ export declare function appServerActingSubject(deps: Pick<ApiRouteDeps, "db">, grant: AccessGrant): Promise<string | null>;
103
109
  /**
104
110
  * Someone who may open the app calls its server code: a member in the
105
111
  * console (or their agent), or a published app's viewer. A Site frame may
package/dist/app.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  withDefaultEnabledCapabilityMcpTools,
30
30
  workflowIdForSession,
31
31
  workspaceActorContextExempt
32
- } from "./chunk-GAWTCUEH.js";
32
+ } from "./chunk-POJVB7DX.js";
33
33
  import "./chunk-M6YFLNSY.js";
34
34
  export {
35
35
  API_MAX_REQUEST_BODY_BYTES,
@@ -3050,7 +3050,7 @@ import {
3050
3050
  settingsWithEnabledCapabilityMcpServers as settingsWithEnabledCapabilityMcpServers2,
3051
3051
  settingsWithEnabledCapabilityMcpServersForTargets,
3052
3052
  visibleMcpAccountConnectionsByIds,
3053
- siteViewerForGrant as siteViewerForGrant10
3053
+ siteViewerForGrant as siteViewerForGrant11
3054
3054
  } from "@opengeni/core";
3055
3055
  import {
3056
3056
  buildConnectionTokenResolver as buildConnectionTokenResolver5,
@@ -16506,7 +16506,8 @@ import {
16506
16506
  hasIntegrationAdminPermission as hasIntegrationAdminPermission3,
16507
16507
  hasPermission as hasPermission8,
16508
16508
  resolveServiceConnectionHeaders,
16509
- ServiceConnectionCredentialError
16509
+ ServiceConnectionCredentialError,
16510
+ siteViewerForGrant as siteViewerForGrant3
16510
16511
  } from "@opengeni/core";
16511
16512
  import {
16512
16513
  claimAppServerHostCall,
@@ -23195,6 +23196,7 @@ async function requireAppServerPublishable(deps, grant, manifest) {
23195
23196
  throw new WorkspaceArtifactOperationError3(
23196
23197
  "App server code is not enabled on this deployment, so this version can't carry server code. Publish without the server upload."
23197
23198
  );
23199
+ await requireAppServerToolsKnown(deps, grant, manifest);
23198
23200
  if (sendsToolDataOut(manifest) && !mayUseWorkspaceSecrets(grant))
23199
23201
  throw new WorkspaceArtifactOperationError3(
23200
23202
  "Only a workspace admin can publish server code that both calls tools and lists outside hosts, since it can send tool data out of the workspace. Ask an admin to publish it, or remove the tools or the hosts."
@@ -23599,15 +23601,63 @@ function parseGatewayResult(bytes) {
23599
23601
  error: typeof result2.error === "string" ? result2.error.slice(0, 2e3) : null
23600
23602
  };
23601
23603
  }
23602
- async function appServerViewerForGrant(deps, grant) {
23604
+ async function appServerViewerForGrant(deps, grant, subjectId = grant.subjectId) {
23603
23605
  const [email, name] = await Promise.all([
23604
- getVerifiedSubjectEmail2(deps.db, grant.subjectId).catch(() => null),
23606
+ getVerifiedSubjectEmail2(deps.db, subjectId).catch(() => null),
23605
23607
  workspaceMemberDisplayName(deps.db, {
23606
23608
  workspaceId: grant.workspaceId,
23607
- subjectId: grant.subjectId
23609
+ subjectId
23608
23610
  }).catch(() => null)
23609
23611
  ]);
23610
- return { id: `user:${grant.subjectId}`, email, name, kind: "member" };
23612
+ return { id: `user:${subjectId}`, email, name, kind: "member" };
23613
+ }
23614
+ async function appServerActingSubject(deps, grant) {
23615
+ return await siteViewerForGrant3(deps.db, grant).then(
23616
+ (viewer) => viewer.subjectId,
23617
+ () => null
23618
+ );
23619
+ }
23620
+ var ACCOUNT_ALIAS = /_([0-9a-f]{6})$/u;
23621
+ var ACCOUNT_ROUTE = /^account-[0-9a-f]{64}$/u;
23622
+ var connectorSlug = (value) => value.toLowerCase().replace(/[^a-z0-9]+/gu, "_").replace(/^_+|_+$/gu, "");
23623
+ function sharedRouteFor(inventory, serverId) {
23624
+ const shared = inventory.accounts.filter((account) => account.shared === true);
23625
+ const hex2 = ACCOUNT_ALIAS.exec(serverId)?.[1];
23626
+ const byAlias = hex2 ? shared.filter((account) => account.serverId.startsWith(`account-${hex2}`)) : [];
23627
+ if (byAlias.length === 1) return byAlias[0].serverId;
23628
+ const slug = connectorSlug(serverId.replace(ACCOUNT_ALIAS, ""));
23629
+ const byConnector = shared.filter((account) => connectorSlug(account.connector) === slug);
23630
+ return byConnector.length === 1 ? byConnector[0].serverId : void 0;
23631
+ }
23632
+ async function requireAppServerToolsKnown(deps, grant, manifest) {
23633
+ const declared = appServerDeclaredTools(manifest);
23634
+ if (declared.length === 0) return;
23635
+ const person2 = await appServerActingSubject(deps, grant);
23636
+ const member = person2 ? await liveMemberGrant(
23637
+ deps,
23638
+ { accountId: grant.accountId, workspaceId: grant.workspaceId },
23639
+ person2
23640
+ ).catch(() => null) : null;
23641
+ if (!member) return;
23642
+ const inventory = await memberToolInventory(deps, member).catch(() => null);
23643
+ if (!inventory) return;
23644
+ const unknown8 = declared.filter((tool2) => {
23645
+ if (ACCOUNT_ROUTE.test(tool2.serverId)) return false;
23646
+ try {
23647
+ routeAppServerTool(inventory, declared, tool2);
23648
+ return false;
23649
+ } catch (error) {
23650
+ return error instanceof AppServerError && error.details["reason"] === "tool_unavailable";
23651
+ }
23652
+ });
23653
+ if (unknown8.length === 0) return;
23654
+ const named = unknown8.map((tool2) => {
23655
+ const route3 = sharedRouteFor(inventory, tool2.serverId);
23656
+ return route3 ? `${tool2.serverId}/${tool2.toolName} (use ${route3}/${tool2.toolName})` : `${tool2.serverId}/${tool2.toolName}`;
23657
+ });
23658
+ throw new WorkspaceArtifactOperationError3(
23659
+ `The server code names tools that aren't available to you here: ${named.join(", ")}. Name each tool by its identity, serverId/toolName as \`ogtool show <path>\` lists it, in both the bundle's tools and env.tools.call, then upload again and publish.`
23660
+ );
23611
23661
  }
23612
23662
  async function runAppServerAs(deps, authority, siteId4, request, options = {}) {
23613
23663
  let access;
@@ -24112,7 +24162,7 @@ async function appServerStatus(deps, grant, siteId4) {
24112
24162
  tools: []
24113
24163
  };
24114
24164
  const summary = await summarizeAppServerRuns(deps.db, scope, access.site.id, startOfUtcDay());
24115
- const mayRead = runOutputReader(deps, grant, access.site.id);
24165
+ const mayRead = runOutputReader(deps, grant, access.site.id, access.subjectId);
24116
24166
  let paused = null;
24117
24167
  try {
24118
24168
  await serverAuthority(deps, deployment);
@@ -24140,16 +24190,19 @@ async function appServerRuns(deps, grant, siteId4, options) {
24140
24190
  ...options.status ? { status: options.status } : {},
24141
24191
  ...options.before ? { before: options.before } : {}
24142
24192
  });
24143
- const mayRead = runOutputReader(deps, grant, access.site.id);
24193
+ const mayRead = runOutputReader(deps, grant, access.site.id, access.subjectId);
24144
24194
  return { runs: await Promise.all(runs.map((run5) => withheldUnlessPermitted(run5, mayRead))) };
24145
24195
  }
24146
24196
  async function appServerRun(deps, grant, siteId4, runId) {
24147
24197
  const { access, scope } = await managerScope(deps, grant, siteId4);
24148
24198
  const run5 = await getAppServerRun(deps.db, scope, access.site.id, runId);
24149
- return run5 ? await withheldUnlessPermitted(run5, runOutputReader(deps, grant, access.site.id)) : null;
24199
+ return run5 ? await withheldUnlessPermitted(
24200
+ run5,
24201
+ runOutputReader(deps, grant, access.site.id, access.subjectId)
24202
+ ) : null;
24150
24203
  }
24151
24204
  var RUN_OUTPUT_WITHHELD = "Hidden: this version's code uses tools or secrets you can't use, so its logs and errors may hold their data.";
24152
- function runOutputReader(deps, grant, siteId4) {
24205
+ function runOutputReader(deps, grant, siteId4, person2) {
24153
24206
  const verdicts = /* @__PURE__ */ new Map();
24154
24207
  return (versionId, known) => {
24155
24208
  let verdict = verdicts.get(versionId);
@@ -24159,10 +24212,11 @@ function runOutputReader(deps, grant, siteId4) {
24159
24212
  const tools = manifest ? appServerDeclaredTools(manifest) : [];
24160
24213
  const secrets = manifest ? manifest.secrets.length > 0 : false;
24161
24214
  if (tools.length === 0 && !secrets) return true;
24215
+ if (!person2) return false;
24162
24216
  const member = await liveMemberGrant(
24163
24217
  deps,
24164
24218
  { accountId: grant.accountId, workspaceId: grant.workspaceId },
24165
- grant.subjectId
24219
+ person2
24166
24220
  );
24167
24221
  if (!member) return false;
24168
24222
  const inventory = await memberToolInventory(deps, member).catch(() => null);
@@ -24193,10 +24247,11 @@ async function withheldUnlessPermitted(run5, mayRead) {
24193
24247
  }
24194
24248
  async function testAppServer(deps, grant, siteId4, request) {
24195
24249
  const { access, scope } = await managerScope(deps, grant, siteId4);
24250
+ const person2 = access.subjectId;
24196
24251
  return await runAppServer(deps, {
24197
24252
  scope,
24198
24253
  siteId: access.site.id,
24199
- viewer: await appServerViewerForGrant(deps, grant),
24254
+ viewer: person2 ? await appServerViewerForGrant(deps, grant, person2) : null,
24200
24255
  trigger: "manual",
24201
24256
  request
24202
24257
  });
@@ -26569,7 +26624,7 @@ import {
26569
26624
  assertOrganizationNotSuspended as assertOrganizationNotSuspended2,
26570
26625
  currentSiteSessionOrigin as currentSiteSessionOrigin2,
26571
26626
  hasLiteralPermission as hasLiteralPermission2,
26572
- siteViewerForGrant as siteViewerForGrant3
26627
+ siteViewerForGrant as siteViewerForGrant4
26573
26628
  } from "@opengeni/core";
26574
26629
  import {
26575
26630
  bumpSitePublicationGeneration,
@@ -27652,7 +27707,7 @@ async function requireSitePublicationWriter(_deps, _grant) {
27652
27707
  async function resolveSiteManagement(deps, grant, siteId4, options = {}) {
27653
27708
  if (options.mutate) await requireSitePublicationWriter(deps, grant);
27654
27709
  const scope = { accountId: grant.accountId, workspaceId: grant.workspaceId };
27655
- const viewer = await siteViewerForGrant3(deps.db, grant);
27710
+ const viewer = await siteViewerForGrant4(deps.db, grant);
27656
27711
  const site = await getSiteDataSite2(deps.db, scope, viewer, siteId4);
27657
27712
  const record17 = site ? await getPublishedSite2(deps.db, scope, siteId4) : null;
27658
27713
  if (!site || !record17)
@@ -30272,7 +30327,7 @@ import {
30272
30327
  parseAppPackage,
30273
30328
  stableJson as stableJson3
30274
30329
  } from "@opengeni/contracts";
30275
- import { resolveNewSiteAudience, siteViewerForGrant as siteViewerForGrant4 } from "@opengeni/core";
30330
+ import { resolveNewSiteAudience, siteViewerForGrant as siteViewerForGrant5 } from "@opengeni/core";
30276
30331
  import {
30277
30332
  artifactRequestedToolsMissingFromAttemptCatalog,
30278
30333
  createWorkspaceArtifact,
@@ -30549,7 +30604,7 @@ function selected(demo, kind, all) {
30549
30604
  async function exportAppPackage(deps, grant, appId2, request = {}) {
30550
30605
  if (!deps.objectStorage)
30551
30606
  throw new AppPackageError("unavailable", "File storage isn't configured");
30552
- const viewer = await siteViewerForGrant4(deps.db, grant);
30607
+ const viewer = await siteViewerForGrant5(deps.db, grant);
30553
30608
  const [artifact, ref] = await Promise.all([
30554
30609
  getWorkspaceArtifactCurrent(deps.db, grant.workspaceId, viewer, appId2),
30555
30610
  getWorkspaceArtifactContentRef(deps.db, grant.workspaceId, viewer, appId2)
@@ -30881,7 +30936,7 @@ async function installAppPackage(deps, grant, input) {
30881
30936
  demoRows: 0,
30882
30937
  demoFiles: 0
30883
30938
  };
30884
- const viewer = await siteViewerForGrant4(deps.db, grant);
30939
+ const viewer = await siteViewerForGrant5(deps.db, grant);
30885
30940
  const audience = await resolveNewSiteAudience({
30886
30941
  db: deps.db,
30887
30942
  settings: deps.settings,
@@ -31262,7 +31317,7 @@ import {
31262
31317
  siteSqlDestructiveChanges,
31263
31318
  stableJson as stableJson4
31264
31319
  } from "@opengeni/contracts";
31265
- import { siteViewerForGrant as siteViewerForGrant5 } from "@opengeni/core";
31320
+ import { siteViewerForGrant as siteViewerForGrant6 } from "@opengeni/core";
31266
31321
  import {
31267
31322
  artifactRequestedToolsMissingFromAttemptCatalog as artifactRequestedToolsMissingFromAttemptCatalog2,
31268
31323
  getAppPackageId as getAppPackageId2,
@@ -31310,7 +31365,7 @@ async function prepare(deps, grant, appId2, raw) {
31310
31365
  `This package is over ${APP_PACKAGE_MAX_BYTES2 / (1024 * 1024)} MB`
31311
31366
  );
31312
31367
  const { package: pkg, problems } = parseAppPackage2(raw);
31313
- const viewer = await siteViewerForGrant5(deps.db, grant);
31368
+ const viewer = await siteViewerForGrant6(deps.db, grant);
31314
31369
  const [artifact, ref] = await Promise.all([
31315
31370
  getWorkspaceArtifactCurrent2(deps.db, grant.workspaceId, viewer, appId2),
31316
31371
  getWorkspaceArtifactContentRef2(deps.db, grant.workspaceId, viewer, appId2)
@@ -31535,7 +31590,7 @@ async function upgradeAppFromPackage(deps, grant, appId2, input) {
31535
31590
  syncs: []
31536
31591
  };
31537
31592
  const notUpgraded = [];
31538
- const viewer = await siteViewerForGrant5(deps.db, grant);
31593
+ const viewer = await siteViewerForGrant6(deps.db, grant);
31539
31594
  const current = async () => redactWorkspaceArtifactProvenance(
31540
31595
  await getWorkspaceArtifactCurrent2(deps.db, grant.workspaceId, viewer, appId2)
31541
31596
  );
@@ -31747,7 +31802,7 @@ async function publishVersion(deps, grant, appId2, prepared, tools, provenance2)
31747
31802
  accountId: grant.accountId,
31748
31803
  workspaceId: grant.workspaceId,
31749
31804
  artifactId: appId2,
31750
- viewer: await siteViewerForGrant5(deps.db, grant),
31805
+ viewer: await siteViewerForGrant6(deps.db, grant),
31751
31806
  expectedCurrentVersionId: prepared.currentVersionId,
31752
31807
  ...content,
31753
31808
  assetManifest,
@@ -34044,7 +34099,7 @@ import { z as z17 } from "zod";
34044
34099
  import {
34045
34100
  resolveArtifactAudienceChange,
34046
34101
  resolveNewArtifactAudience,
34047
- siteViewerForGrant as siteViewerForGrant6
34102
+ siteViewerForGrant as siteViewerForGrant7
34048
34103
  } from "@opengeni/core";
34049
34104
  import {
34050
34105
  readEditableArtifactAudiences,
@@ -34064,7 +34119,7 @@ function postgresEditableArtifactAudiences(deps) {
34064
34119
  db: deps.db,
34065
34120
  settings: deps.settings,
34066
34121
  grant,
34067
- viewer: await siteViewerForGrant6(deps.db, grant),
34122
+ viewer: await siteViewerForGrant7(deps.db, grant),
34068
34123
  requested: options.requested,
34069
34124
  sourceSessionId: options.sourceSessionId === void 0 ? editableArtifactSourceSessionId(grant) : options.sourceSessionId,
34070
34125
  sourcePrivate,
@@ -34073,7 +34128,7 @@ function postgresEditableArtifactAudiences(deps) {
34073
34128
  ),
34074
34129
  read: (scope, artifactIds) => readEditableArtifactAudiences(deps.db, scope, artifactIds),
34075
34130
  change: async (grant, input) => {
34076
- const viewer = await siteViewerForGrant6(deps.db, grant);
34131
+ const viewer = await siteViewerForGrant7(deps.db, grant);
34077
34132
  const visibility = await resolveArtifactAudienceChange({
34078
34133
  db: deps.db,
34079
34134
  settings: deps.settings,
@@ -35641,7 +35696,7 @@ import {
35641
35696
  import {
35642
35697
  creationInitiatorForGrant,
35643
35698
  hasPermission as hasPermission12,
35644
- siteViewerForGrant as siteViewerForGrant7
35699
+ siteViewerForGrant as siteViewerForGrant8
35645
35700
  } from "@opengeni/core";
35646
35701
  import {
35647
35702
  getManagedUserProfilesByIds as getManagedUserProfilesByIds2,
@@ -35769,7 +35824,7 @@ function registerMeetingTools(input) {
35769
35824
  only: summary.recordingId
35770
35825
  };
35771
35826
  }
35772
- const viewer = await siteViewerForGrant7(deps.db, grant);
35827
+ const viewer = await siteViewerForGrant8(deps.db, grant);
35773
35828
  return {
35774
35829
  workspaceId: grant.workspaceId,
35775
35830
  subjectId: viewer.subjectId ?? grant.subjectId,
@@ -39578,7 +39633,7 @@ import {
39578
39633
  audienceAccessFor,
39579
39634
  hasPermission as hasPermission17,
39580
39635
  resolveSiteAudienceChange,
39581
- siteViewerForGrant as siteViewerForGrant8
39636
+ siteViewerForGrant as siteViewerForGrant9
39582
39637
  } from "@opengeni/core";
39583
39638
  import {
39584
39639
  requireWorkspace as requireWorkspace4,
@@ -39588,7 +39643,7 @@ import {
39588
39643
  import { HTTPException as HTTPException36 } from "hono/http-exception";
39589
39644
  async function changeSiteAudience(deps, input) {
39590
39645
  const { grant } = input;
39591
- const viewer = await siteViewerForGrant8(deps.db, grant);
39646
+ const viewer = await siteViewerForGrant9(deps.db, grant);
39592
39647
  const visibility = await resolveSiteAudienceChange({
39593
39648
  db: deps.db,
39594
39649
  settings: deps.settings,
@@ -40739,7 +40794,7 @@ import {
40739
40794
  scheduledTaskAccess,
40740
40795
  scheduledTaskViewerForGrant as scheduledTaskViewerForGrant2,
40741
40796
  eventSourceAccess as sessionLinkEventSourceAccess,
40742
- siteViewerForGrant as siteViewerForGrant9,
40797
+ siteViewerForGrant as siteViewerForGrant10,
40743
40798
  resolveNewSiteAudience as resolveNewSiteAudience2,
40744
40799
  resolveNewProjectAudience,
40745
40800
  projectSourceSessionId,
@@ -92846,7 +92901,7 @@ function buildOpenGeniMcpServer(deps, grant, options = {}) {
92846
92901
  await listWorkspaceArtifacts(
92847
92902
  deps.db,
92848
92903
  grant.workspaceId,
92849
- await siteViewerForGrant9(deps.db, grant)
92904
+ await siteViewerForGrant10(deps.db, grant)
92850
92905
  )
92851
92906
  )
92852
92907
  );
@@ -95199,7 +95254,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95199
95254
  async ({ artifactId: artifactId2, versionId }) => {
95200
95255
  await authorize3();
95201
95256
  if (!deps.objectStorage) throw new Error("Object storage is not configured");
95202
- const viewer = await siteViewerForGrant9(deps.db, grant);
95257
+ const viewer = await siteViewerForGrant10(deps.db, grant);
95203
95258
  const [rawDetail, ref] = await Promise.all([
95204
95259
  getWorkspaceArtifact2(deps.db, grant.workspaceId, viewer, artifactId2),
95205
95260
  getWorkspaceArtifactContentRef3(deps.db, grant.workspaceId, viewer, artifactId2, versionId)
@@ -95290,7 +95345,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95290
95345
  db: deps.db,
95291
95346
  settings: deps.settings,
95292
95347
  grant,
95293
- viewer: await siteViewerForGrant9(deps.db, grant),
95348
+ viewer: await siteViewerForGrant10(deps.db, grant),
95294
95349
  requested: visibility,
95295
95350
  sourceSessionId: attempt().sessionId
95296
95351
  });
@@ -95369,7 +95424,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95369
95424
  await siteMutation(
95370
95425
  await publishWorkspaceArtifactVersion2(deps.db, {
95371
95426
  artifactId: artifactId2,
95372
- viewer: await siteViewerForGrant9(deps.db, grant),
95427
+ viewer: await siteViewerForGrant10(deps.db, grant),
95373
95428
  expectedCurrentVersionId,
95374
95429
  ...title2 !== void 0 ? { title: title2 } : {},
95375
95430
  ...description !== void 0 ? { description } : {},
@@ -95400,7 +95455,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95400
95455
  await siteMutation(
95401
95456
  await rollbackWorkspaceArtifact(deps.db, {
95402
95457
  artifactId: artifactId2,
95403
- viewer: await siteViewerForGrant9(deps.db, grant),
95458
+ viewer: await siteViewerForGrant10(deps.db, grant),
95404
95459
  versionId,
95405
95460
  expectedCurrentVersionId,
95406
95461
  reason: reason2,
@@ -95428,7 +95483,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95428
95483
  await siteMutation(
95429
95484
  await setWorkspaceArtifactStatus(deps.db, {
95430
95485
  artifactId: artifactId2,
95431
- viewer: await siteViewerForGrant9(deps.db, grant),
95486
+ viewer: await siteViewerForGrant10(deps.db, grant),
95432
95487
  status: "archived",
95433
95488
  expectedCurrentVersionId,
95434
95489
  reason: reason2,
@@ -95456,7 +95511,7 @@ function registerWorkspaceArtifactTools(server, deps, grant, sessionId, json3) {
95456
95511
  await siteMutation(
95457
95512
  await setWorkspaceArtifactStatus(deps.db, {
95458
95513
  artifactId: artifactId2,
95459
- viewer: await siteViewerForGrant9(deps.db, grant),
95514
+ viewer: await siteViewerForGrant10(deps.db, grant),
95460
95515
  status: "active",
95461
95516
  expectedCurrentVersionId,
95462
95517
  reason: reason2,
@@ -100999,7 +101054,7 @@ function throwWorkspaceToolGatewayExecuteError(error) {
100999
101054
  var resolveVisibleSiteVersion = async (db, grant, artifactId2, versionId) => await getWorkspaceArtifactContentRef4(
101000
101055
  db,
101001
101056
  grant.workspaceId,
101002
- await siteViewerForGrant10(db, grant),
101057
+ await siteViewerForGrant11(db, grant),
101003
101058
  artifactId2,
101004
101059
  versionId
101005
101060
  );
@@ -109089,7 +109144,7 @@ import {
109089
109144
  hasPermission as hasPermission31,
109090
109145
  isVerifiedDelegatedHumanAuthorization as isVerifiedDelegatedHumanAuthorization5,
109091
109146
  withSiteSessionOrigin as withSiteSessionOrigin3,
109092
- siteViewerForGrant as siteViewerForGrant11
109147
+ siteViewerForGrant as siteViewerForGrant12
109093
109148
  } from "@opengeni/core";
109094
109149
  import {
109095
109150
  appSyncActionOf as appSyncActionOf2,
@@ -109384,7 +109439,7 @@ function projectedPath(identity2) {
109384
109439
  async function siteVersionReader(deps, authorization) {
109385
109440
  if (isPublishedSiteToolAuthorization(authorization))
109386
109441
  return publishedSiteToolAuthority(authorization).readVersion;
109387
- const viewer = await siteViewerForGrant11(deps.db, authorization.grant);
109442
+ const viewer = await siteViewerForGrant12(deps.db, authorization.grant);
109388
109443
  return async (db, grant, artifactId2, versionId) => await getWorkspaceArtifactContentRef5(db, grant.workspaceId, viewer, artifactId2, versionId);
109389
109444
  }
109390
109445
  function siteToolReviewRefusal(error) {
@@ -110804,7 +110859,7 @@ function siteFrameFieldForbidden(field) {
110804
110859
  import {
110805
110860
  requireAccessGrant as requireAccessGrant24,
110806
110861
  requireSessionAuthorization as requireSessionAuthorization8,
110807
- siteViewerForGrant as siteViewerForGrant12,
110862
+ siteViewerForGrant as siteViewerForGrant13,
110808
110863
  currentSiteSessionOrigin as currentSiteSessionOrigin4
110809
110864
  } from "@opengeni/core";
110810
110865
  import { listSiteSessionAccess, setSiteSessionAccess } from "@opengeni/db";
@@ -120512,7 +120567,7 @@ function registerSiteSessionAccessRoutes(app, deps) {
120512
120567
  );
120513
120568
  if (currentSiteSessionOrigin4())
120514
120569
  throw new HTTPException74(403, { message: "An app page cannot manage chat access" });
120515
- const { subjectId } = await siteViewerForGrant12(deps.db, grant);
120570
+ const { subjectId } = await siteViewerForGrant13(deps.db, grant);
120516
120571
  if (!subjectId) throw new HTTPException74(403, { message: "Chat owner authority required" });
120517
120572
  return { workspaceId, siteId: siteId4, subjectId, grant };
120518
120573
  };
@@ -166759,7 +166814,7 @@ import {
166759
166814
  SessionAuthorizationDeniedError as SessionAuthorizationDeniedError18,
166760
166815
  SessionAuthorizationUnavailableError as SessionAuthorizationUnavailableError16,
166761
166816
  currentSiteSessionOrigin as currentSiteSessionOrigin5,
166762
- siteViewerForGrant as siteViewerForGrant13
166817
+ siteViewerForGrant as siteViewerForGrant14
166763
166818
  } from "@opengeni/core";
166764
166819
  import {
166765
166820
  createWorkspaceArtifact as createWorkspaceArtifact3,
@@ -166920,7 +166975,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
166920
166975
  const ref = await getWorkspaceArtifactContentRef6(
166921
166976
  deps.db,
166922
166977
  workspaceId,
166923
- await siteViewerForGrant13(deps.db, grant),
166978
+ await siteViewerForGrant14(deps.db, grant),
166924
166979
  artifactId(context),
166925
166980
  parseVersionId(context.req.query("versionId"))
166926
166981
  );
@@ -166935,7 +166990,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
166935
166990
  if (currentSiteSessionOrigin5())
166936
166991
  throw new HTTPException157(403, { message: "An app page cannot record opening an app" });
166937
166992
  const siteId4 = artifactId(context);
166938
- const viewer = await siteViewerForGrant13(deps.db, grant);
166993
+ const viewer = await siteViewerForGrant14(deps.db, grant);
166939
166994
  if (!viewer.subjectId)
166940
166995
  throw new HTTPException157(403, { message: "A signed-in person is required" });
166941
166996
  try {
@@ -166960,7 +167015,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
166960
167015
  throw new HTTPException157(403, { message: "An app page cannot change the sidebar" });
166961
167016
  const siteId4 = artifactId(context);
166962
167017
  const change = await body2(context, UpdateSiteSidebarStateRequest2);
166963
- const viewer = await siteViewerForGrant13(deps.db, grant);
167018
+ const viewer = await siteViewerForGrant14(deps.db, grant);
166964
167019
  if (!viewer.subjectId)
166965
167020
  throw new HTTPException157(403, { message: "A signed-in person is required" });
166966
167021
  try {
@@ -166986,7 +167041,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
166986
167041
  throw new HTTPException157(403, { message: "An app page cannot change the sidebar" });
166987
167042
  const siteId4 = artifactId(context);
166988
167043
  const change = await body2(context, UpdateSiteProjectRequest2);
166989
- const viewer = await siteViewerForGrant13(deps.db, grant);
167044
+ const viewer = await siteViewerForGrant14(deps.db, grant);
166990
167045
  if (!viewer.subjectId)
166991
167046
  throw new HTTPException157(403, { message: "A signed-in person is required" });
166992
167047
  const sessionIds = await listSiteProjectConversationIds(deps.db, {
@@ -167053,7 +167108,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167053
167108
  await listWorkspaceArtifacts2(
167054
167109
  deps.db,
167055
167110
  workspaceId,
167056
- await siteViewerForGrant13(deps.db, grant),
167111
+ await siteViewerForGrant14(deps.db, grant),
167057
167112
  {
167058
167113
  limit: query.limit,
167059
167114
  ...query.cursor ? { cursor: query.cursor } : {},
@@ -167086,7 +167141,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167086
167141
  db: deps.db,
167087
167142
  settings: deps.settings,
167088
167143
  grant,
167089
- viewer: await siteViewerForGrant13(deps.db, grant),
167144
+ viewer: await siteViewerForGrant14(deps.db, grant),
167090
167145
  requested: request.visibility,
167091
167146
  sourceSessionId: null
167092
167147
  });
@@ -167126,7 +167181,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167126
167181
  const detail = await getWorkspaceArtifact3(
167127
167182
  deps.db,
167128
167183
  workspaceId,
167129
- await siteViewerForGrant13(deps.db, grant),
167184
+ await siteViewerForGrant14(deps.db, grant),
167130
167185
  artifactId(context)
167131
167186
  );
167132
167187
  return context.json(
@@ -167148,7 +167203,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167148
167203
  const artifact = await getWorkspaceArtifactCurrent3(
167149
167204
  deps.db,
167150
167205
  workspaceId,
167151
- await siteViewerForGrant13(deps.db, grant),
167206
+ await siteViewerForGrant14(deps.db, grant),
167152
167207
  artifactId(context)
167153
167208
  );
167154
167209
  return context.json(
@@ -167172,7 +167227,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167172
167227
  ref = await getWorkspaceArtifactContentRef6(
167173
167228
  deps.db,
167174
167229
  workspaceId,
167175
- await siteViewerForGrant13(deps.db, grant),
167230
+ await siteViewerForGrant14(deps.db, grant),
167176
167231
  artifactId(context),
167177
167232
  parseVersionId(context.req.query("versionId"))
167178
167233
  );
@@ -167238,7 +167293,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167238
167293
  const ref = await getWorkspaceArtifactContentRef6(
167239
167294
  deps.db,
167240
167295
  workspaceId,
167241
- await siteViewerForGrant13(deps.db, grant),
167296
+ await siteViewerForGrant14(deps.db, grant),
167242
167297
  artifactId(context),
167243
167298
  parsedVersion
167244
167299
  );
@@ -167301,7 +167356,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167301
167356
  accountId: grant.accountId,
167302
167357
  workspaceId,
167303
167358
  artifactId: id3,
167304
- viewer: await siteViewerForGrant13(deps.db, grant),
167359
+ viewer: await siteViewerForGrant14(deps.db, grant),
167305
167360
  expectedCurrentVersionId: request.expectedCurrentVersionId,
167306
167361
  ...request.title !== void 0 ? { title: request.title } : {},
167307
167362
  ...request.description !== void 0 ? { description: request.description } : {},
@@ -167337,7 +167392,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167337
167392
  accountId: grant.accountId,
167338
167393
  workspaceId,
167339
167394
  artifactId: id3,
167340
- viewer: await siteViewerForGrant13(deps.db, grant),
167395
+ viewer: await siteViewerForGrant14(deps.db, grant),
167341
167396
  versionId: request.versionId,
167342
167397
  expectedCurrentVersionId: request.expectedCurrentVersionId,
167343
167398
  reason: request.reason,
@@ -167363,7 +167418,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167363
167418
  const request = await body2(context, DuplicateWorkspaceArtifactRequest2);
167364
167419
  const sourceId = artifactId(context);
167365
167420
  try {
167366
- const viewer = await siteViewerForGrant13(deps.db, grant);
167421
+ const viewer = await siteViewerForGrant14(deps.db, grant);
167367
167422
  return context.json(
167368
167423
  await mutationResponse(
167369
167424
  deps,
@@ -167416,7 +167471,7 @@ function registerWorkspaceArtifactRoutes(app, deps) {
167416
167471
  accountId: grant.accountId,
167417
167472
  workspaceId,
167418
167473
  artifactId: id3,
167419
- viewer: await siteViewerForGrant13(deps.db, grant),
167474
+ viewer: await siteViewerForGrant14(deps.db, grant),
167420
167475
  status: request.status,
167421
167476
  expectedCurrentVersionId: request.expectedCurrentVersionId,
167422
167477
  reason: request.reason,
@@ -167621,7 +167676,7 @@ import {
167621
167676
  APP_NOTIFY_WORKSPACE_SENDS_PER_WINDOW,
167622
167677
  AppNotifyRequest as AppNotifyRequest2
167623
167678
  } from "@opengeni/contracts";
167624
- import { siteViewerForGrant as siteViewerForGrant14 } from "@opengeni/core";
167679
+ import { siteViewerForGrant as siteViewerForGrant15 } from "@opengeni/core";
167625
167680
  import {
167626
167681
  getMemberNotificationsAllowed as getMemberNotificationsAllowed3,
167627
167682
  getSiteDataSite as getSiteDataSite3,
@@ -167650,7 +167705,7 @@ async function senderOf(deps, authority, siteId4, surface5) {
167650
167705
  if (surface5.frameSiteId != null && surface5.frameSiteId !== siteId4)
167651
167706
  throw forbidden4("An app can only send its own notifications", "other_app");
167652
167707
  const scope = { accountId: grant.accountId, workspaceId: grant.workspaceId };
167653
- const viewer = await siteViewerForGrant14(deps.db, grant);
167708
+ const viewer = await siteViewerForGrant15(deps.db, grant);
167654
167709
  const site = await getSiteDataSite3(deps.db, scope, viewer, siteId4);
167655
167710
  if (!site) throw new SiteDataError16("not_found", "App not found");
167656
167711
  if (!viewer.subjectId) throw forbidden4(MEMBERS_ONLY, "members_only");
@@ -170793,7 +170848,7 @@ import {
170793
170848
  readSessionAttachmentFiles as readSessionAttachmentFiles2,
170794
170849
  SessionAuthorizationDeniedError as SessionAuthorizationDeniedError19,
170795
170850
  SessionAuthorizationUnavailableError as SessionAuthorizationUnavailableError17,
170796
- siteViewerForGrant as siteViewerForGrant15
170851
+ siteViewerForGrant as siteViewerForGrant16
170797
170852
  } from "@opengeni/core";
170798
170853
  import {
170799
170854
  getFilesForSubject as getFilesForSubject5,
@@ -170904,7 +170959,7 @@ function registerArtifactCatalogRoutes(app, deps) {
170904
170959
  sitesAllowed ? isWorkspaceArtifactVisible(
170905
170960
  deps.db,
170906
170961
  workspaceId,
170907
- await siteViewerForGrant15(deps.db, grant),
170962
+ await siteViewerForGrant16(deps.db, grant),
170908
170963
  artifactId2
170909
170964
  ) : false
170910
170965
  ]);
@@ -170962,7 +171017,7 @@ function registerArtifactCatalogRoutes(app, deps) {
170962
171017
  if (kind.data === "site" && !await isWorkspaceArtifactVisible(
170963
171018
  deps.db,
170964
171019
  workspaceId,
170965
- await siteViewerForGrant15(deps.db, grant),
171020
+ await siteViewerForGrant16(deps.db, grant),
170966
171021
  artifactId2
170967
171022
  ))
170968
171023
  throw new HTTPException160(404, { message: "Artifact not found" });
@@ -171114,7 +171169,7 @@ function registerArtifactCatalogRoutes(app, deps) {
171114
171169
  let lastReturned;
171115
171170
  let nextCursor = null;
171116
171171
  const fileSubject = includesFiles ? await fileAuthoritySubjectIdForGrant(deps, grant) : null;
171117
- const siteViewer = kinds.some((kind) => kind === "site" || editableKinds.has(kind)) ? await siteViewerForGrant15(deps.db, grant) : { subjectId: null };
171172
+ const siteViewer = kinds.some((kind) => kind === "site" || editableKinds.has(kind)) ? await siteViewerForGrant16(deps.db, grant) : { subjectId: null };
171118
171173
  for (let batch = 0; batch < MAX_BATCHES; batch++) {
171119
171174
  const candidates = await listArtifactCatalogCandidates(
171120
171175
  deps.db,
@@ -171769,7 +171824,7 @@ import {
171769
171824
  listInsightsCalls,
171770
171825
  requireAccessContext as requireAccessContext24,
171771
171826
  requireWorkspaceSettingsGrant as requireWorkspaceSettingsGrant12,
171772
- siteViewerForGrant as siteViewerForGrant16
171827
+ siteViewerForGrant as siteViewerForGrant17
171773
171828
  } from "@opengeni/core";
171774
171829
  import {
171775
171830
  currentSessionRlsActorIdentityKey as currentSessionRlsActorIdentityKey2,
@@ -171986,7 +172041,7 @@ function registerInsightsUsageRoutes(app, deps) {
171986
172041
  message: "invalid app Insights query"
171987
172042
  }
171988
172043
  );
171989
- const viewer = await siteViewerForGrant16(deps.db, grant);
172044
+ const viewer = await siteViewerForGrant17(deps.db, grant);
171990
172045
  const response = await insightsWithFriendlyTimeout(
171991
172046
  () => getInsightsSiteUsage(deps.db, {
171992
172047
  accountId: grant.accountId,
@@ -173689,7 +173744,7 @@ import {
173689
173744
  requireSessionAuthorization as requireSessionAuthorization23,
173690
173745
  SessionAuthorizationDeniedError as SessionAuthorizationDeniedError20,
173691
173746
  SessionAuthorizationUnavailableError as SessionAuthorizationUnavailableError18,
173692
- siteViewerForGrant as siteViewerForGrant17
173747
+ siteViewerForGrant as siteViewerForGrant18
173693
173748
  } from "@opengeni/core";
173694
173749
  import {
173695
173750
  getGeneratedImageArtifact as getGeneratedImageArtifact5,
@@ -173743,7 +173798,7 @@ function registerSessionArtifactAssociationRoutes(app, deps) {
173743
173798
  ) : await hasWorkspaceArtifactSessionLink(
173744
173799
  deps.db,
173745
173800
  workspaceId,
173746
- await siteViewerForGrant17(deps.db, grant),
173801
+ await siteViewerForGrant18(deps.db, grant),
173747
173802
  sessionId,
173748
173803
  artifactId2
173749
173804
  );
@@ -189736,4 +189791,4 @@ export {
189736
189791
  withDefaultEnabledCapabilityMcpTools,
189737
189792
  workflowIdForSession5 as workflowIdForSession
189738
189793
  };
189739
- //# sourceMappingURL=chunk-GAWTCUEH.js.map
189794
+ //# sourceMappingURL=chunk-POJVB7DX.js.map