@opengeni/api-router 2.12.4-canary.3 → 2.13.0-canary.0

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/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createOpenGeniSlackBotInteractionClient,
8
8
  startSlackInteractionPump,
9
9
  startTemporalScheduleCleanupPump
10
- } from "./chunk-VQCBJV4P.js";
10
+ } from "./chunk-BJWHVMOL.js";
11
11
 
12
12
  // src/index.ts
13
13
  import {
@@ -663,11 +663,11 @@ export declare function marketplacePlugin(url: string): {
663
663
  installation: string;
664
664
  upstream: {
665
665
  source: {
666
- ref?: never;
667
666
  path?: never;
668
667
  source: string;
669
668
  url: string;
670
669
  sha: string;
670
+ ref?: never;
671
671
  };
672
672
  policy: null;
673
673
  };
@@ -707,11 +707,11 @@ export declare function marketplacePlugin(url: string): {
707
707
  installation: string;
708
708
  upstream: {
709
709
  source: {
710
- ref?: never;
711
710
  path?: never;
712
711
  source: string;
713
712
  url: string;
714
713
  sha: string;
714
+ ref?: never;
715
715
  };
716
716
  policy: null;
717
717
  };
@@ -795,11 +795,11 @@ export declare function marketplacePlugin(url: string): {
795
795
  installation: string;
796
796
  upstream: {
797
797
  source: {
798
- ref?: never;
799
798
  path?: never;
800
799
  source: string;
801
800
  url: string;
802
801
  sha: string;
802
+ ref?: never;
803
803
  };
804
804
  policy: null;
805
805
  };
@@ -922,11 +922,11 @@ export declare function marketplacePlugin(url: string): {
922
922
  installation: string;
923
923
  upstream: {
924
924
  source: {
925
- ref?: never;
926
925
  path?: never;
927
926
  source: string;
928
927
  url: string;
929
928
  sha: string;
929
+ ref?: never;
930
930
  };
931
931
  policy: null;
932
932
  };
@@ -966,11 +966,11 @@ export declare function marketplacePlugin(url: string): {
966
966
  installation: string;
967
967
  upstream: {
968
968
  source: {
969
- ref?: never;
970
969
  path?: never;
971
970
  source: string;
972
971
  url: string;
973
972
  sha: string;
973
+ ref?: never;
974
974
  };
975
975
  policy: null;
976
976
  };
@@ -1185,11 +1185,11 @@ export declare function marketplacePlugin(url: string): {
1185
1185
  installation: string;
1186
1186
  upstream: {
1187
1187
  source: {
1188
- ref?: never;
1189
1188
  path?: never;
1190
1189
  source: string;
1191
1190
  url: string;
1192
1191
  sha: string;
1192
+ ref?: never;
1193
1193
  };
1194
1194
  policy: null;
1195
1195
  };
@@ -1225,11 +1225,11 @@ export declare function marketplacePlugin(url: string): {
1225
1225
  installation: string;
1226
1226
  upstream: {
1227
1227
  source: {
1228
- ref?: never;
1229
1228
  path?: never;
1230
1229
  source: string;
1231
1230
  url: string;
1232
1231
  sha: string;
1232
+ ref?: never;
1233
1233
  };
1234
1234
  policy: null;
1235
1235
  };
@@ -1360,11 +1360,11 @@ export declare function marketplacePlugin(url: string): {
1360
1360
  installation: string;
1361
1361
  upstream: {
1362
1362
  source: {
1363
- ref?: never;
1364
1363
  path?: never;
1365
1364
  source: string;
1366
1365
  url: string;
1367
1366
  sha: string;
1367
+ ref?: never;
1368
1368
  };
1369
1369
  policy: null;
1370
1370
  };
@@ -1409,11 +1409,11 @@ export declare function marketplacePlugin(url: string): {
1409
1409
  installation: string;
1410
1410
  upstream: {
1411
1411
  source: {
1412
- ref?: never;
1413
1412
  path?: never;
1414
1413
  source: string;
1415
1414
  url: string;
1416
1415
  sha: string;
1416
+ ref?: never;
1417
1417
  };
1418
1418
  policy: null;
1419
1419
  };
@@ -1453,11 +1453,11 @@ export declare function marketplacePlugin(url: string): {
1453
1453
  installation: string;
1454
1454
  upstream: {
1455
1455
  source: {
1456
- ref?: never;
1457
1456
  path?: never;
1458
1457
  source: string;
1459
1458
  url: string;
1460
1459
  sha: string;
1460
+ ref?: never;
1461
1461
  };
1462
1462
  policy: null;
1463
1463
  };
@@ -1523,11 +1523,11 @@ export declare function marketplacePlugin(url: string): {
1523
1523
  installation: string;
1524
1524
  upstream: {
1525
1525
  source: {
1526
- ref?: never;
1527
1526
  path?: never;
1528
1527
  source: string;
1529
1528
  url: string;
1530
1529
  sha: string;
1530
+ ref?: never;
1531
1531
  };
1532
1532
  policy: null;
1533
1533
  };
@@ -1596,11 +1596,11 @@ export declare function marketplacePlugin(url: string): {
1596
1596
  installation: string;
1597
1597
  upstream: {
1598
1598
  source: {
1599
- ref?: never;
1600
1599
  path?: never;
1601
1600
  source: string;
1602
1601
  url: string;
1603
1602
  sha: string;
1603
+ ref?: never;
1604
1604
  };
1605
1605
  policy: null;
1606
1606
  };
@@ -1640,11 +1640,11 @@ export declare function marketplacePlugin(url: string): {
1640
1640
  installation: string;
1641
1641
  upstream: {
1642
1642
  source: {
1643
- ref?: never;
1644
1643
  path?: never;
1645
1644
  source: string;
1646
1645
  url: string;
1647
1646
  sha: string;
1647
+ ref?: never;
1648
1648
  };
1649
1649
  policy: null;
1650
1650
  };
@@ -1679,11 +1679,11 @@ export declare function marketplacePlugin(url: string): {
1679
1679
  installation: string;
1680
1680
  upstream: {
1681
1681
  source: {
1682
- ref?: never;
1683
1682
  path?: never;
1684
1683
  source: string;
1685
1684
  url: string;
1686
1685
  sha: string;
1686
+ ref?: never;
1687
1687
  };
1688
1688
  policy: null;
1689
1689
  };
@@ -1723,11 +1723,11 @@ export declare function marketplacePlugin(url: string): {
1723
1723
  installation: string;
1724
1724
  upstream: {
1725
1725
  source: {
1726
- ref?: never;
1727
1726
  path?: never;
1728
1727
  source: string;
1729
1728
  url: string;
1730
1729
  sha: string;
1730
+ ref?: never;
1731
1731
  };
1732
1732
  policy: null;
1733
1733
  };
@@ -1835,11 +1835,11 @@ export declare function marketplacePlugin(url: string): {
1835
1835
  installation: string;
1836
1836
  upstream: {
1837
1837
  source: {
1838
- ref?: never;
1839
1838
  path?: never;
1840
1839
  source: string;
1841
1840
  url: string;
1842
1841
  sha: string;
1842
+ ref?: never;
1843
1843
  };
1844
1844
  policy: null;
1845
1845
  };
@@ -2006,11 +2006,11 @@ export declare function marketplacePlugin(url: string): {
2006
2006
  installation: string;
2007
2007
  upstream: {
2008
2008
  source: {
2009
- ref?: never;
2010
2009
  path?: never;
2011
2010
  source: string;
2012
2011
  url: string;
2013
2012
  sha: string;
2013
+ ref?: never;
2014
2014
  };
2015
2015
  policy: null;
2016
2016
  };
@@ -2050,11 +2050,11 @@ export declare function marketplacePlugin(url: string): {
2050
2050
  installation: string;
2051
2051
  upstream: {
2052
2052
  source: {
2053
- ref?: never;
2054
2053
  path?: never;
2055
2054
  source: string;
2056
2055
  url: string;
2057
2056
  sha: string;
2057
+ ref?: never;
2058
2058
  };
2059
2059
  policy: null;
2060
2060
  };
@@ -2090,11 +2090,11 @@ export declare function marketplacePlugin(url: string): {
2090
2090
  installation: string;
2091
2091
  upstream: {
2092
2092
  source: {
2093
- ref?: never;
2094
2093
  path?: never;
2095
2094
  source: string;
2096
2095
  url: string;
2097
2096
  sha: string;
2097
+ ref?: never;
2098
2098
  };
2099
2099
  policy: null;
2100
2100
  };
@@ -2178,11 +2178,11 @@ export declare function marketplacePlugin(url: string): {
2178
2178
  installation: string;
2179
2179
  upstream: {
2180
2180
  source: {
2181
- ref?: never;
2182
2181
  path?: never;
2183
2182
  source: string;
2184
2183
  url: string;
2185
2184
  sha: string;
2185
+ ref?: never;
2186
2186
  };
2187
2187
  policy: null;
2188
2188
  };
@@ -2261,11 +2261,11 @@ export declare function marketplacePlugin(url: string): {
2261
2261
  installation: string;
2262
2262
  upstream: {
2263
2263
  source: {
2264
- ref?: never;
2265
2264
  path?: never;
2266
2265
  source: string;
2267
2266
  url: string;
2268
2267
  sha: string;
2268
+ ref?: never;
2269
2269
  };
2270
2270
  policy: null;
2271
2271
  };
@@ -2307,11 +2307,11 @@ export declare function marketplacePlugin(url: string): {
2307
2307
  installation: string;
2308
2308
  upstream: {
2309
2309
  source: {
2310
- ref?: never;
2311
2310
  path?: never;
2312
2311
  source: string;
2313
2312
  url: string;
2314
2313
  sha: string;
2314
+ ref?: never;
2315
2315
  };
2316
2316
  policy: null;
2317
2317
  };
@@ -2351,11 +2351,11 @@ export declare function marketplacePlugin(url: string): {
2351
2351
  installation: string;
2352
2352
  upstream: {
2353
2353
  source: {
2354
- ref?: never;
2355
2354
  source: string;
2356
2355
  url: string;
2357
2356
  path: string;
2358
2357
  sha: string;
2358
+ ref?: never;
2359
2359
  };
2360
2360
  policy: null;
2361
2361
  };
@@ -2390,11 +2390,11 @@ export declare function marketplacePlugin(url: string): {
2390
2390
  installation: string;
2391
2391
  upstream: {
2392
2392
  source: {
2393
- ref?: never;
2394
2393
  path?: never;
2395
2394
  source: string;
2396
2395
  url: string;
2397
2396
  sha: string;
2397
+ ref?: never;
2398
2398
  };
2399
2399
  policy: null;
2400
2400
  };
@@ -2429,11 +2429,11 @@ export declare function marketplacePlugin(url: string): {
2429
2429
  installation: string;
2430
2430
  upstream: {
2431
2431
  source: {
2432
- ref?: never;
2433
2432
  path?: never;
2434
2433
  source: string;
2435
2434
  url: string;
2436
2435
  sha: string;
2436
+ ref?: never;
2437
2437
  };
2438
2438
  policy: null;
2439
2439
  };
@@ -2556,11 +2556,11 @@ export declare function marketplacePlugin(url: string): {
2556
2556
  installation: string;
2557
2557
  upstream: {
2558
2558
  source: {
2559
- ref?: never;
2560
2559
  path?: never;
2561
2560
  source: string;
2562
2561
  url: string;
2563
2562
  sha: string;
2563
+ ref?: never;
2564
2564
  };
2565
2565
  policy: null;
2566
2566
  };
@@ -82,8 +82,8 @@ export declare function scheduledTaskMcpSummary(task: ScheduledTask): {
82
82
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
83
83
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
84
84
  action: {
85
- readonly sourceId?: never;
86
85
  kind: "agent_turn";
86
+ sourceId?: never;
87
87
  sourceGeneration?: never;
88
88
  sourceLifecycleGeneration?: never;
89
89
  destination?: never;
@@ -205,8 +205,8 @@ export declare function boundScheduledTaskDetailMcp(task: ScheduledTask): {
205
205
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
206
206
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
207
207
  action: {
208
- readonly sourceId?: never;
209
208
  kind: "agent_turn";
209
+ sourceId?: never;
210
210
  sourceGeneration?: never;
211
211
  sourceLifecycleGeneration?: never;
212
212
  destination?: never;
@@ -389,8 +389,8 @@ export declare function boundScheduledTaskMcpPage(input: {
389
389
  runMode: "existing_session" | "new_session_per_run" | "reusable_session";
390
390
  overlapPolicy: "allow_concurrent" | "buffer_one" | "skip";
391
391
  action: {
392
- readonly sourceId?: never;
393
392
  kind: "agent_turn";
393
+ sourceId?: never;
394
394
  sourceGeneration?: never;
395
395
  sourceLifecycleGeneration?: never;
396
396
  destination?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/api-router",
3
- "version": "2.12.4-canary.3",
3
+ "version": "2.13.0-canary.0",
4
4
  "description": "OpenGeni HTTP surface: the Hono adapter/router (createApp), routes, MCP HTTP transport, and HTTP access adapters over @opengeni/core. An engine-distribution surface — its runtime closure includes engine-internal packages.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,24 +43,24 @@
43
43
  "@hono/zod-validator": "^0.7.6",
44
44
  "@llamaindex/liteparse": "2.14.2",
45
45
  "@modelcontextprotocol/sdk": "^1.29.0",
46
- "@opengeni/agent-proto": "^0.5.1-canary.29",
47
- "@opengeni/artifact-tool": "^0.3.26-canary.3",
48
- "@opengeni/capabilities": "^0.3.3-canary.11",
49
- "@opengeni/codemode": "^0.5.6-canary.3",
50
- "@opengeni/codex": "^0.2.22-canary.11",
51
- "@opengeni/config": "^1.1.2-canary.3",
52
- "@opengeni/contracts": "^3.0.2-canary.3",
53
- "@opengeni/core": "^2.9.4-canary.3",
54
- "@opengeni/db": "^4.3.3-canary.3",
55
- "@opengeni/documents": "^0.8.27-canary.3",
56
- "@opengeni/events": "^0.4.25-canary.3",
57
- "@opengeni/github": "^0.7.10-canary.3",
58
- "@opengeni/network": "^0.3.1-canary.11",
59
- "@opengeni/observability": "^0.8.26-canary.3",
60
- "@opengeni/runtime": "^2.5.3-canary.3",
61
- "@opengeni/storage": "^0.2.127-canary.3",
62
- "@opengeni/tool-gateway": "^0.1.7-canary.3",
63
- "@opengeni/xai-subscription": "^0.1.4-canary.11",
46
+ "@opengeni/agent-proto": "^0.6.0-canary.0",
47
+ "@opengeni/artifact-tool": "^0.3.27-canary.0",
48
+ "@opengeni/capabilities": "^0.3.3-canary.12",
49
+ "@opengeni/codemode": "^0.5.7-canary.0",
50
+ "@opengeni/codex": "^0.2.22-canary.12",
51
+ "@opengeni/config": "^1.2.0-canary.0",
52
+ "@opengeni/contracts": "^3.1.0-canary.0",
53
+ "@opengeni/core": "^2.10.0-canary.0",
54
+ "@opengeni/db": "^4.4.0-canary.0",
55
+ "@opengeni/documents": "^0.8.28-canary.0",
56
+ "@opengeni/events": "^0.4.26-canary.0",
57
+ "@opengeni/github": "^0.7.11-canary.0",
58
+ "@opengeni/network": "^0.3.1-canary.12",
59
+ "@opengeni/observability": "^0.8.27-canary.0",
60
+ "@opengeni/runtime": "^2.6.0-canary.0",
61
+ "@opengeni/storage": "^0.2.128-canary.0",
62
+ "@opengeni/tool-gateway": "^0.1.8-canary.0",
63
+ "@opengeni/xai-subscription": "^0.1.4-canary.12",
64
64
  "@temporalio/client": "^1.17.0",
65
65
  "better-auth": "^1.6.14",
66
66
  "hono": "^4.12.18",
package/src/mcp/server.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ getAttemptToolCatalog,
2
3
  createChannel,
3
4
  listChannels,
4
5
  getChannel,
@@ -6072,6 +6073,33 @@ function registerCapabilityDiscoveryTools(
6072
6073
  await authorizeFirstPartySession(deps, grant, sessionId, "session.first_party_mcp.call");
6073
6074
  };
6074
6075
 
6076
+ // Installation is workspace metadata; an enabled personal MCP is usable only
6077
+ // when its tools actually made it into this caller's immutable attempt catalog.
6078
+ // This is a readiness projection, never credential resolution or a new grant.
6079
+ const setupProjections = async (items: CapabilityCatalogItem[]) => {
6080
+ const availableServerIds = new Set<string>();
6081
+ if (items.some((item) => item.enabled && item.connectionRef?.subjectScope === "subject")) {
6082
+ const claims = exactAgentCommandContext(grant, sessionId);
6083
+ const attemptCatalog = await getAttemptToolCatalog(deps.db, {
6084
+ accountId: grant.accountId,
6085
+ workspaceId: grant.workspaceId,
6086
+ attemptId: claims.callerAttemptId,
6087
+ });
6088
+ if (
6089
+ attemptCatalog?.sessionId === sessionId &&
6090
+ attemptCatalog.turnId === claims.callerTurnId &&
6091
+ attemptCatalog.executionGeneration === claims.callerExecutionGeneration
6092
+ ) {
6093
+ for (const entry of attemptCatalog.entries) availableServerIds.add(entry.identity.serverId);
6094
+ }
6095
+ }
6096
+ return await Promise.all(
6097
+ items.map((item) =>
6098
+ capabilitySetupProjection(deps, grant.workspaceId, item, availableServerIds),
6099
+ ),
6100
+ );
6101
+ };
6102
+
6075
6103
  server.registerTool(
6076
6104
  "capability_catalog_search",
6077
6105
  {
@@ -6090,25 +6118,24 @@ function registerCapabilityDiscoveryTools(
6090
6118
  query,
6091
6119
  limit ?? 8,
6092
6120
  );
6093
- const matches = await Promise.all(
6094
- ranked.map(async ({ item, matchedOn }) => ({
6095
- capabilityId: item.id,
6096
- name: item.name,
6097
- description: item.description,
6098
- kind: item.kind,
6099
- source: item.source,
6100
- category: item.category,
6101
- tags: item.tags.slice(0, 16),
6102
- providerDomain: item.providerDomain,
6103
- authKind: item.authKind,
6104
- tier: item.tier,
6105
- matchedOn,
6106
- setup: {
6107
- ...(await capabilitySetupProjection(deps, grant.workspaceId, item)),
6108
- requiredVariables: capabilityRequiredVariables(item),
6109
- },
6110
- })),
6111
- );
6121
+ const setups = await setupProjections(ranked.map(({ item }) => item));
6122
+ const matches = ranked.map(({ item, matchedOn }, index) => ({
6123
+ capabilityId: item.id,
6124
+ name: item.name,
6125
+ description: item.description,
6126
+ kind: item.kind,
6127
+ source: item.source,
6128
+ category: item.category,
6129
+ tags: item.tags.slice(0, 16),
6130
+ providerDomain: item.providerDomain,
6131
+ authKind: item.authKind,
6132
+ tier: item.tier,
6133
+ matchedOn,
6134
+ setup: {
6135
+ ...setups[index]!,
6136
+ requiredVariables: capabilityRequiredVariables(item),
6137
+ },
6138
+ }));
6112
6139
  return json({ query, matches });
6113
6140
  },
6114
6141
  );
@@ -6132,7 +6159,8 @@ function registerCapabilityDiscoveryTools(
6132
6159
  if (!item || !capabilityCatalogItemIsTrustedForExposure(item)) {
6133
6160
  throw new Error("Unknown or untrusted capability; search the catalog again.");
6134
6161
  }
6135
- const setup = await capabilitySetupProjection(deps, grant.workspaceId, item);
6162
+ const [setup] = await setupProjections([item]);
6163
+ if (!setup) throw new Error("Capability setup projection is unavailable.");
6136
6164
  if (setup.status === "ready") {
6137
6165
  return json({
6138
6166
  capabilityId: item.id,
@@ -6194,6 +6222,7 @@ async function capabilitySetupProjection(
6194
6222
  deps: ApiRouteDeps,
6195
6223
  workspaceId: string,
6196
6224
  item: CapabilityCatalogItem,
6225
+ availableServerIds: ReadonlySet<string>,
6197
6226
  ): Promise<CapabilitySetupProjection> {
6198
6227
  if (item.id === "api:github-app" || item.surfaceType === "first_party_github") {
6199
6228
  const missing = githubAppMissingSettings(deps.settings);
@@ -6234,6 +6263,21 @@ async function capabilitySetupProjection(
6234
6263
  detail: "A workspace admin must designate an authorized Codex Apps subscription.",
6235
6264
  };
6236
6265
  }
6266
+ if (item.enabled && item.connectionRef?.subjectScope === "subject") {
6267
+ if (item.runtime.mcpServerId && availableServerIds.has(item.runtime.mcpServerId)) {
6268
+ return {
6269
+ status: "ready",
6270
+ action: null,
6271
+ detail: "This capability has tools available in this turn.",
6272
+ };
6273
+ }
6274
+ return {
6275
+ status: "authorization_required",
6276
+ action: "connect",
6277
+ detail:
6278
+ "This capability is enabled, but its personal account is not available in this turn. The account owner must review access using Use in this conversation, then send a new message. Shared conversations require acknowledgement that results are visible to workspace members.",
6279
+ };
6280
+ }
6237
6281
  if (item.enabled) {
6238
6282
  return {
6239
6283
  status: "ready",
@@ -242,6 +242,7 @@ import {
242
242
  requireAccessGrant,
243
243
  requireAccessGrantAuthorization,
244
244
  requireFreshAccessGrant,
245
+ rotateSessionMcpCredentialsForRequest,
245
246
  hasVerifiedOwningUserAuthorization,
246
247
  requirePermission,
247
248
  requireSessionAuthorization,
@@ -2872,6 +2873,27 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
2872
2873
  );
2873
2874
  });
2874
2875
 
2876
+ app.post("/v1/workspaces/:workspaceId/sessions/:sessionId/mcp-credentials/rotate", async (c) => {
2877
+ const workspaceId = c.req.param("workspaceId");
2878
+ const authorization = await requireAccessGrantAuthorization(
2879
+ c,
2880
+ deps,
2881
+ workspaceId,
2882
+ "sessions:control",
2883
+ );
2884
+ const payload = await c.req.json().catch(() => null);
2885
+ c.header("cache-control", "private, no-store");
2886
+ return c.json(
2887
+ await rotateSessionMcpCredentialsForRequest(
2888
+ deps,
2889
+ authorization,
2890
+ c.req.param("sessionId"),
2891
+ payload,
2892
+ (tx) => requireFreshAccessGrant(c, { ...deps, db: tx }, workspaceId, "sessions:control"),
2893
+ ),
2894
+ );
2895
+ });
2896
+
2875
2897
  app.get("/v1/workspaces/:workspaceId/sessions/:sessionId/queue", async (c) => {
2876
2898
  const workspaceId = c.req.param("workspaceId");
2877
2899
  await requireAccessGrant(c, deps, workspaceId, "sessions:read");
@@ -4519,6 +4541,8 @@ export function sessionAuthorizationOperationForHttp(
4519
4541
  if (suffix === "/channel" && verb === "PUT") return "session.channel.write";
4520
4542
  if (suffix === "/variable-sets" && verb === "PUT") return "session.variable_sets.write";
4521
4543
  if (suffix === "/tool-policy" && verb === "PUT") return "session.tool_policy.write";
4544
+ if (suffix === "/mcp-credentials/rotate" && verb === "POST")
4545
+ return "session.mcp.credentials.rotate";
4522
4546
  if (/^\/mcp-servers\/[^/]+\/approval-policy$/.test(suffix) && verb === "PATCH") {
4523
4547
  return "session.mcp.approval_policy.write";
4524
4548
  }