@opengeni/api-router 3.0.0-canary.0 → 3.0.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-7IAWEYBH.js";
10
+ } from "./chunk-AJ62T5QN.js";
11
11
 
12
12
  // src/index.ts
13
13
  import { scheduledTaskKnowledgeSource } from "@opengeni/contracts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/api-router",
3
- "version": "3.0.0-canary.0",
3
+ "version": "3.0.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.3",
47
- "@opengeni/artifact-tool": "^0.3.28-canary.0",
48
- "@opengeni/capabilities": "^0.3.3-canary.15",
49
- "@opengeni/codemode": "^0.5.8-canary.0",
50
- "@opengeni/codex": "^0.2.23-canary.0",
51
- "@opengeni/config": "^1.2.1-canary.0",
52
- "@opengeni/contracts": "^4.0.0-canary.0",
53
- "@opengeni/core": "^3.0.0-canary.0",
54
- "@opengeni/db": "^5.0.0-canary.0",
55
- "@opengeni/documents": "^0.8.29-canary.0",
56
- "@opengeni/events": "^0.4.27-canary.0",
57
- "@opengeni/github": "^0.7.12-canary.0",
58
- "@opengeni/network": "^0.3.1-canary.15",
59
- "@opengeni/observability": "^0.8.28-canary.0",
60
- "@opengeni/runtime": "^3.0.0-canary.0",
61
- "@opengeni/storage": "^0.2.129-canary.0",
62
- "@opengeni/tool-gateway": "^0.1.9-canary.0",
63
- "@opengeni/xai-subscription": "^0.1.4-canary.15",
46
+ "@opengeni/agent-proto": "^0.6.0",
47
+ "@opengeni/artifact-tool": "^0.3.29",
48
+ "@opengeni/capabilities": "^0.3.4",
49
+ "@opengeni/codemode": "^0.5.9",
50
+ "@opengeni/codex": "^0.2.23",
51
+ "@opengeni/config": "^1.2.2",
52
+ "@opengeni/contracts": "^4.1.0",
53
+ "@opengeni/core": "^3.0.1",
54
+ "@opengeni/db": "^5.0.1",
55
+ "@opengeni/documents": "^0.8.30",
56
+ "@opengeni/events": "^0.4.28",
57
+ "@opengeni/github": "^0.7.13",
58
+ "@opengeni/network": "^0.3.1",
59
+ "@opengeni/observability": "^0.8.29",
60
+ "@opengeni/runtime": "^3.0.1",
61
+ "@opengeni/storage": "^0.2.130",
62
+ "@opengeni/tool-gateway": "^0.1.10",
63
+ "@opengeni/xai-subscription": "^0.1.4",
64
64
  "@temporalio/client": "^1.17.0",
65
65
  "better-auth": "^1.6.14",
66
66
  "hono": "^4.12.18",
@@ -75,6 +75,7 @@ import {
75
75
  import { resolveForRoute, validatedIntegrationInstallInput } from "./api-integrations";
76
76
  import { executeConnectOperation } from "@opengeni/core";
77
77
  import { startMcpOAuth, requireIntegrationsStateSecret } from "../integrations/oauth-client";
78
+ import { OFFICIAL_GMAIL_MCP_URL } from "../integrations/oauth-profiles";
78
79
  import { z } from "zod";
79
80
  import {
80
81
  WORKSPACE_OPENROUTER_CONNECTION_DOMAIN,
@@ -227,6 +228,19 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
227
228
  ownership: ["workspace"],
228
229
  setup: ["oauth"],
229
230
  }),
231
+ ConnectProvider.parse({
232
+ id: "gmail",
233
+ label: "Gmail",
234
+ family: "google",
235
+ readiness:
236
+ !external || !canWrite || !personal
237
+ ? "unsupported"
238
+ : mcpConfigured
239
+ ? "available"
240
+ : "needs_configuration",
241
+ ownership: personal ? ["personal"] : [],
242
+ setup: ["oauth"],
243
+ }),
230
244
  ConnectProvider.parse({
231
245
  id: "slack-personal",
232
246
  label: "My Slack account",
@@ -557,7 +571,9 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
557
571
  providerId:
558
572
  connection.metadata.mcpUrl === OPENGENI_PERSONAL_SLACK_MCP_URL
559
573
  ? "slack-personal"
560
- : "mcp-oauth",
574
+ : connection.metadata.mcpUrl === OFFICIAL_GMAIL_MCP_URL
575
+ ? "gmail"
576
+ : "mcp-oauth",
561
577
  label: connection.providerDomain,
562
578
  ownership: connection.subjectId === null ? "workspace" : "personal",
563
579
  status:
@@ -1007,16 +1023,18 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
1007
1023
  }),
1008
1024
  );
1009
1025
  }
1010
- if (["mcp-oauth", "slack-personal"].includes(before.providerId)) {
1026
+ if (["mcp-oauth", "slack-personal", "gmail"].includes(before.providerId)) {
1011
1027
  if (action.type !== "credentials")
1012
1028
  throw new HTTPException(422, { message: "MCP OAuth requires a server URL" });
1013
1029
  const values =
1014
1030
  before.providerId === "slack-personal"
1015
1031
  ? { mcpUrl: OPENGENI_PERSONAL_SLACK_MCP_URL }
1016
- : z
1017
- .object({ mcpUrl: z.string().url().max(4096) })
1018
- .strict()
1019
- .parse(action.values);
1032
+ : before.providerId === "gmail"
1033
+ ? { mcpUrl: OFFICIAL_GMAIL_MCP_URL }
1034
+ : z
1035
+ .object({ mcpUrl: z.string().url().max(4096) })
1036
+ .strict()
1037
+ .parse(action.values);
1020
1038
  return c.json(
1021
1039
  await executeConnectOperation({
1022
1040
  db: deps.db,
@@ -1552,6 +1570,7 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
1552
1570
  [
1553
1571
  "mcp-oauth",
1554
1572
  "slack-personal",
1573
+ "gmail",
1555
1574
  "mcp-bearer",
1556
1575
  "mcp-headers",
1557
1576
  "fiken-token",
@@ -1567,18 +1586,27 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
1567
1586
  message: "MCP credential setup does not install an API integration instance",
1568
1587
  });
1569
1588
  if (
1570
- ["mcp-oauth", "slack-personal", "mcp-bearer", "mcp-headers", "fiken-token"].includes(
1571
- input.providerId,
1572
- )
1589
+ [
1590
+ "mcp-oauth",
1591
+ "slack-personal",
1592
+ "gmail",
1593
+ "mcp-bearer",
1594
+ "mcp-headers",
1595
+ "fiken-token",
1596
+ ].includes(input.providerId)
1573
1597
  ) {
1574
1598
  if (input.providerId === "slack-personal" && input.ownership !== "personal")
1575
1599
  throw new HTTPException(422, {
1576
1600
  message: "Hosted Slack MCP requires personal ownership",
1577
1601
  });
1602
+ if (input.providerId === "gmail" && input.ownership !== "personal")
1603
+ throw new HTTPException(422, {
1604
+ message: "Gmail requires personal ownership; each user connects their own account",
1605
+ });
1578
1606
  if (input.providerId === "fiken-token" && input.ownership !== "workspace")
1579
1607
  throw new HTTPException(422, { message: "Fiken is workspace-owned" });
1580
1608
  requireEnvironmentEncryption(deps.settings);
1581
- if (["mcp-oauth", "slack-personal"].includes(input.providerId))
1609
+ if (["mcp-oauth", "slack-personal", "gmail"].includes(input.providerId))
1582
1610
  requireIntegrationsStateSecret(deps.settings);
1583
1611
  const existing = input.reconnectAccountId
1584
1612
  ? await getConnectionMetadata(
@@ -1593,11 +1621,13 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
1593
1621
  (!existing ||
1594
1622
  (input.providerId === "fiken-token"
1595
1623
  ? !isFikenConnection(existing)
1596
- : ["mcp-oauth", "slack-personal"].includes(input.providerId)
1624
+ : ["mcp-oauth", "slack-personal", "gmail"].includes(input.providerId)
1597
1625
  ? existing.kind !== "oauth2" ||
1598
1626
  !existing.metadata.oauthDiscovery ||
1599
1627
  (input.providerId === "slack-personal" &&
1600
- existing.metadata.mcpUrl !== OPENGENI_PERSONAL_SLACK_MCP_URL)
1628
+ existing.metadata.mcpUrl !== OPENGENI_PERSONAL_SLACK_MCP_URL) ||
1629
+ (input.providerId === "gmail" &&
1630
+ existing.metadata.mcpUrl !== OFFICIAL_GMAIL_MCP_URL)
1601
1631
  : existing.kind !== "api_key" ||
1602
1632
  existing.metadata.connectAdapter !== input.providerId) ||
1603
1633
  (existing.subjectId === null ? "workspace" : "personal") !== input.ownership)
@@ -1634,51 +1664,50 @@ export function registerConnectRoutes(app: Hono, deps: ApiRouteDeps): void {
1634
1664
  : {}),
1635
1665
  nextAction: {
1636
1666
  type: "credentials",
1637
- fields:
1638
- input.providerId === "slack-personal"
1639
- ? []
1640
- : input.providerId === "fiken-token"
1641
- ? [
1642
- {
1643
- name: "apiToken",
1644
- label: "Fiken API token",
1645
- required: true,
1646
- secret: true,
1647
- },
1648
- {
1649
- name: "defaultCompanySlug",
1650
- label: "Default company slug (optional)",
1651
- required: false,
1652
- secret: false,
1653
- },
1654
- ]
1655
- : [
1656
- {
1657
- name: "mcpUrl",
1658
- label: "MCP server URL",
1659
- required: true,
1660
- secret: false,
1661
- },
1662
- ...(input.providerId === "mcp-bearer"
1667
+ fields: ["slack-personal", "gmail"].includes(input.providerId)
1668
+ ? []
1669
+ : input.providerId === "fiken-token"
1670
+ ? [
1671
+ {
1672
+ name: "apiToken",
1673
+ label: "Fiken API token",
1674
+ required: true,
1675
+ secret: true,
1676
+ },
1677
+ {
1678
+ name: "defaultCompanySlug",
1679
+ label: "Default company slug (optional)",
1680
+ required: false,
1681
+ secret: false,
1682
+ },
1683
+ ]
1684
+ : [
1685
+ {
1686
+ name: "mcpUrl",
1687
+ label: "MCP server URL",
1688
+ required: true,
1689
+ secret: false,
1690
+ },
1691
+ ...(input.providerId === "mcp-bearer"
1692
+ ? [
1693
+ {
1694
+ name: "token",
1695
+ label: "Bearer credential",
1696
+ required: true,
1697
+ secret: true,
1698
+ },
1699
+ ]
1700
+ : input.providerId === "mcp-headers"
1663
1701
  ? [
1664
1702
  {
1665
- name: "token",
1666
- label: "Bearer credential",
1703
+ name: "headers",
1704
+ label: "Credential headers (JSON)",
1667
1705
  required: true,
1668
1706
  secret: true,
1669
1707
  },
1670
1708
  ]
1671
- : input.providerId === "mcp-headers"
1672
- ? [
1673
- {
1674
- name: "headers",
1675
- label: "Credential headers (JSON)",
1676
- required: true,
1677
- secret: true,
1678
- },
1679
- ]
1680
- : []),
1681
- ],
1709
+ : []),
1710
+ ],
1682
1711
  },
1683
1712
  expiresAt: new Date(Date.now() + 15 * 60_000).toISOString(),
1684
1713
  },