@opengeni/api-router 2.13.0-canary.0 → 2.13.0-canary.1

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-BJWHVMOL.js";
10
+ } from "./chunk-V4IDX7VJ.js";
11
11
 
12
12
  // src/index.ts
13
13
  import {
@@ -65,7 +65,7 @@ export declare function requireGitHubLensConnect(deps: ApiRouteDeps, workspaceId
65
65
  adapterId: string;
66
66
  eventTypes: string[];
67
67
  sessionTemplate: {
68
- bundledSkillIds?: ("builtin:opengeni-documents" | "builtin:opengeni-presentations" | "builtin:opengeni-projects" | "builtin:opengeni-sites" | "builtin:opengeni-skills" | "builtin:opengeni-spreadsheets" | "builtin:opengeni-video-generation")[] | undefined;
68
+ bundledSkillIds?: ("builtin:document-parsing" | "builtin:opengeni-documents" | "builtin:opengeni-presentations" | "builtin:opengeni-projects" | "builtin:opengeni-sites" | "builtin:opengeni-skills" | "builtin:opengeni-spreadsheets" | "builtin:opengeni-video-generation" | "builtin:opengeni-visualize")[] | undefined;
69
69
  prompt: string;
70
70
  instructions: string | null;
71
71
  resources: ({
@@ -3,7 +3,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import type { Settings } from "@opengeni/config";
4
4
  import { ToolGatewayDeclarationsResponse, type AccessGrant, type ToolGatewayCatalog, type ToolGatewayIdentity } from "@opengeni/contracts";
5
5
  import { type AccessGrantAuthorization, type ApiRouteDeps } from "@opengeni/core";
6
- import { consumeToolGatewayApproval, issueToolGatewayApproval } from "@opengeni/db";
6
+ import { consumeToolGatewayApproval, getWorkspaceArtifactContentRef, issueToolGatewayApproval } from "@opengeni/db";
7
7
  import { type PreparedWorkspaceToolGatewayTools } from "@opengeni/runtime/workspace-tool-gateway";
8
8
  import { type ToolGatewayDefinition } from "@opengeni/tool-gateway";
9
9
  import type { Observability } from "@opengeni/observability";
@@ -115,6 +115,7 @@ export declare function approveWorkspaceToolGatewayCall(prepared: PreparedWorksp
115
115
  approvalToken: string;
116
116
  expiresAt: string;
117
117
  }>;
118
+ export declare function requireWorkspaceSiteToolAuthorization(db: ApiRouteDeps["db"], grant: AccessGrant, context: WorkspaceSiteToolContext, resolveVersion?: typeof getWorkspaceArtifactContentRef): Promise<void>;
118
119
  export declare function toolGatewayCatalogResponse(catalog: ToolGatewayCatalog): ToolGatewayCatalog;
119
120
  export declare function workspaceToolGatewayDeclarations(prepared: PreparedWorkspaceToolGateway): ToolGatewayDeclarationsResponse;
120
121
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/api-router",
3
- "version": "2.13.0-canary.0",
3
+ "version": "2.13.0-canary.1",
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.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",
46
+ "@opengeni/agent-proto": "^0.6.0-canary.1",
47
+ "@opengeni/artifact-tool": "^0.3.27-canary.1",
48
+ "@opengeni/capabilities": "^0.3.3-canary.13",
49
+ "@opengeni/codemode": "^0.5.7-canary.1",
50
+ "@opengeni/codex": "^0.2.22-canary.13",
51
+ "@opengeni/config": "^1.2.0-canary.1",
52
+ "@opengeni/contracts": "^3.1.0-canary.1",
53
+ "@opengeni/core": "^2.10.0-canary.1",
54
+ "@opengeni/db": "^4.4.0-canary.1",
55
+ "@opengeni/documents": "^0.8.28-canary.1",
56
+ "@opengeni/events": "^0.4.26-canary.1",
57
+ "@opengeni/github": "^0.7.11-canary.1",
58
+ "@opengeni/network": "^0.3.1-canary.13",
59
+ "@opengeni/observability": "^0.8.27-canary.1",
60
+ "@opengeni/runtime": "^2.6.0-canary.1",
61
+ "@opengeni/storage": "^0.2.128-canary.1",
62
+ "@opengeni/tool-gateway": "^0.1.8-canary.1",
63
+ "@opengeni/xai-subscription": "^0.1.4-canary.13",
64
64
  "@temporalio/client": "^1.17.0",
65
65
  "better-auth": "^1.6.14",
66
66
  "hono": "^4.12.18",
package/src/codemode.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { siteRequestHeaders } from "@opengeni/contracts/site-session-http";
1
2
  import {
2
3
  codemodeDispatchSubject,
3
4
  decodeCodemodeDispatchAck,
@@ -93,14 +94,9 @@ export async function codemodeSessionRequest(
93
94
  const target = new URL(request.url);
94
95
  const rewritten = siteSessionPath(path, authority.workspaceId, request.method);
95
96
  const url = new URL(rewritten, target.origin);
96
- const headers = new Headers({
97
- authorization: `Bearer ${token}`,
98
- [OPENGENI_API_CONTRACT_HEADER]: OPENGENI_API_CONTRACT_REVISION,
99
- });
100
- for (const name of ["content-type", "accept", "last-event-id"]) {
101
- const value = request.headers.get(name);
102
- if (value) headers.set(name, value);
103
- }
97
+ const headers = siteRequestHeaders(request.headers);
98
+ headers.set("authorization", `Bearer ${token}`);
99
+ headers.set(OPENGENI_API_CONTRACT_HEADER, OPENGENI_API_CONTRACT_REVISION);
104
100
  return new Request(url, {
105
101
  method: request.method,
106
102
  headers,
@@ -48,7 +48,7 @@ import {
48
48
  requireWorkspace,
49
49
  withCodexAppsRequestAuthorization,
50
50
  consumeToolGatewayApproval,
51
- getWorkspaceArtifact,
51
+ getWorkspaceArtifactContentRef,
52
52
  issueToolGatewayApproval,
53
53
  ToolGatewayApprovalOperationStartedError,
54
54
  ToolGatewayApprovalRateLimitError,
@@ -719,24 +719,25 @@ function throwWorkspaceToolGatewayHttpError(error: unknown): never {
719
719
  throw error;
720
720
  }
721
721
 
722
- async function requireWorkspaceSiteToolAuthorization(
722
+ export async function requireWorkspaceSiteToolAuthorization(
723
723
  db: ApiRouteDeps["db"],
724
724
  grant: AccessGrant,
725
725
  context: WorkspaceSiteToolContext,
726
+ resolveVersion = getWorkspaceArtifactContentRef,
726
727
  ): Promise<void> {
727
728
  try {
728
- const detail = await getWorkspaceArtifact(db, grant.workspaceId, context.siteArtifactId);
729
- const currentVersion = detail.artifact.currentVersion;
730
- const requested = currentVersion?.requestedTools.some(
729
+ const { status, version } = await resolveVersion(
730
+ db,
731
+ grant.workspaceId,
732
+ context.siteArtifactId,
733
+ context.siteVersionId,
734
+ );
735
+ const requested = version.requestedTools.some(
731
736
  (identity) =>
732
737
  identity.serverId === context.identity.serverId &&
733
738
  identity.toolName === context.identity.toolName,
734
739
  );
735
- if (
736
- detail.artifact.status !== "active" ||
737
- currentVersion?.id !== context.siteVersionId ||
738
- !requested
739
- ) {
740
+ if (status !== "active" || version.id !== context.siteVersionId || !requested) {
740
741
  throw new HTTPException(403, { message: "site_tool_not_authorized" });
741
742
  }
742
743
  } catch (error) {