From fcbe0615b5dc2fa3b1df783c4703fda9f0687dc6 Mon Sep 17 00:00:00 2001 From: gengruilin Date: Mon, 2 Nov 2026 15:12:56 +0800 Subject: [PATCH] refactor(notion): register the account on the Host The Notion row registers its Plugins page account with ctx.mcpAccounts while the account registry runs, with the text that names Notion in every shipped language in src/copy.ts. The browser half, its 41-key dictionary, and its client build are removed; the section, tag, activation guidance, and notices now come from the shared account surfaces, and headless profiles load the row without the account. --- docs/config-catalog.md | 2 +- docs/config-catalog.zh.md | 2 +- packages/connector/notion/README.i18n.yaml | 20 +- packages/connector/notion/README.md | 10 +- packages/connector/notion/README.zh.md | 10 +- packages/connector/notion/package.json | 14 - packages/connector/notion/src/client/index.ts | 24 -- .../connector/notion/src/client/locales.ts | 373 ------------------ packages/connector/notion/src/copy.ts | 167 ++++++++ packages/connector/notion/src/index.ts | 18 +- .../notion/tests/mount.client.spec.ts | 23 -- .../connector/notion/tests/plugin.spec.ts | 24 ++ .../connector/notion/tsconfig.client.json | 25 -- packages/connector/notion/tsconfig.host.json | 25 -- packages/connector/notion/tsconfig.json | 22 +- packages/connector/notion/tsdown.config.ts | 3 - pnpm-lock.yaml | 6 - tsconfig.client.json | 1 - tsconfig.host.json | 2 +- 19 files changed, 245 insertions(+), 526 deletions(-) delete mode 100644 packages/connector/notion/src/client/index.ts delete mode 100644 packages/connector/notion/src/client/locales.ts create mode 100644 packages/connector/notion/src/copy.ts delete mode 100644 packages/connector/notion/tests/mount.client.spec.ts delete mode 100644 packages/connector/notion/tsconfig.client.json delete mode 100644 packages/connector/notion/tsconfig.host.json delete mode 100644 packages/connector/notion/tsdown.config.ts diff --git a/docs/config-catalog.md b/docs/config-catalog.md index 1f0dbabab0..762e818514 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -2548,7 +2548,7 @@ export interface Config { ## `@deepseek-ai/dsh-notion` - `inject`: `mcpServers` · `systemPrompt` -- `source`: [`packages/connector/notion/src/index.ts:27`](../packages/connector/notion/src/index.ts) +- `source`: [`packages/connector/notion/src/index.ts:29`](../packages/connector/notion/src/index.ts) ```ts config-catalog /** Notion MCP endpoint and tool loading for the managed server entry. */ diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index ba323117b3..534cf424d7 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -2550,7 +2550,7 @@ export interface Config { ## `@deepseek-ai/dsh-notion` - `inject`: `mcpServers` · `systemPrompt` -- `source`: [`packages/connector/notion/src/index.ts:27`](../packages/connector/notion/src/index.ts) +- `source`: [`packages/connector/notion/src/index.ts:29`](../packages/connector/notion/src/index.ts) ```ts config-catalog /** Notion MCP endpoint and tool loading for the managed server entry. */ diff --git a/packages/connector/notion/README.i18n.yaml b/packages/connector/notion/README.i18n.yaml index b0a6843f8f..4f44bd9905 100644 --- a/packages/connector/notion/README.i18n.yaml +++ b/packages/connector/notion/README.i18n.yaml @@ -9,8 +9,8 @@ en: ebcdb43f309b330c zh: 364385eb8bbf6171 /deepseek-ai-dsh-notion/summary: - en: ce335815b5b7cb53 - zh: a26d3e61baf53eb9 + en: 2dd2e76509bacfe4 + zh: 802a242e78d1ac1f /deepseek-ai-dsh-notion/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb @@ -21,8 +21,8 @@ en: 9643befdbb99d390 zh: b7d6cf34bd69993e /deepseek-ai-dsh-notion/use-this-package/authorize-and-sign-out: - en: e98a624daa22ab7f - zh: 26a9018a6b6f9aed + en: b415b91b5c6debef + zh: bed3fa4b2f6a8ad8 /deepseek-ai-dsh-notion/use-this-package/turn-off-and-uninstall: en: 8fb8e3a36288a635 zh: 3ba01fe30e802d1f @@ -30,11 +30,11 @@ en: 74b045a61a3fec72 zh: 69d64b33e8d1812e /deepseek-ai-dsh-notion/understand-the-implementation: - en: cd9b6fe5dd2ac152 - zh: 6a122d381701cc22 + en: 7ff8ca7c6a7f9671 + zh: 2f6d2c27eed0b826 /deepseek-ai-dsh-notion/further-exploration: - en: e49745a851cd5ca9 - zh: 1b7b0f0d595d7ad7 + en: f1eff44168e63e36 + zh: 65f7fce6a40a615e /deepseek-ai-dsh-notion/model-experience: en: 215e7ba838619b7b zh: a311da3843709f90 @@ -69,5 +69,5 @@ en: 9f145e50fb31de42 zh: fdc6da981ae79456 /deepseek-ai-dsh-notion/known-limitations-and-deferred-work/dev-note: - en: 6c2567cf59c4740e - zh: 1e14c7e8eb07bdfd + en: be76e387a7ea3a71 + zh: d53904834ac3525c diff --git a/packages/connector/notion/README.md b/packages/connector/notion/README.md index b5fe551d3e..f3ded3d997 100644 --- a/packages/connector/notion/README.md +++ b/packages/connector/notion/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -The Notion plugin registers Notion's hosted MCP server, `https://mcp.notion.com/mcp`, with the Host's shared [MCP manager](../../mcp/mcp-manager/README.md) for as long as the plugin is loaded. The user connects a Notion account from the plugin's page on the Web sidebar's **Plugins** page; afterwards every conversation on that Host can use the server's tools, and the model is told to call the integration the Notion plugin. The manager owns the connection, OAuth authorization, the saved grant, and sign-out; the page reads and drives them through the manager's Remote and adds no account interface of its own. It runs in the Web and Desktop compositions. +The Notion plugin registers Notion's hosted MCP server, `https://mcp.notion.com/mcp`, with the Host's shared [MCP manager](../../mcp/mcp-manager/README.md) for as long as the plugin is loaded. The user connects a Notion account from the plugin's page on the Web sidebar's **Plugins** page; afterwards every conversation on that Host can use the server's tools, and the model is told to call the integration the Notion plugin. The manager owns the connection, OAuth authorization, the saved grant, and sign-out, which the shared [MCP account surfaces](../../client/ui-mcp-account/README.md) show on the Plugins page. It runs in the Web and Desktop compositions. ## Table of Contents @@ -50,7 +50,7 @@ While the plugin is on, its page on the **Plugins** page shows a **Notion accoun Authorization must be completed in a browser on the Host machine. After the user approves access in Notion, the callback page says DSH received the authorization; the section then shows the result. Leaving the page does not cancel an attempt, which the Host owns. A failed attempt shows **Authorization was not completed. Try again.**; a failed page action shows a toast. Sign-out keeps the client registration and does not revoke the connection on Notion's side. -The page calls the manager's [OAuth operations](../../mcp/mcp-manager/README.md#oauth-authorization) through Remote: `watch` reports the entry, `startAuthorization('notion')` returns an attempt whose `authorizationUrl` the stream reports, `cancelAuthorization('notion', id)` cancels it, `signOut('notion')` deletes the grant, and `restart('notion')` retries. Other Remote clients can use the same operations. +The page follows the account through the `mcpAccounts` Remote, which reports the manager's entry, and calls the manager's [OAuth operations](../../mcp/mcp-manager/README.md#oauth-authorization) through Remote: `startAuthorization('notion')` returns an attempt whose `authorizationUrl` the stream reports, `cancelAuthorization('notion', id)` cancels it, `signOut('notion')` deletes the grant, and `restart('notion')` retries. Other Remote clients can use the same operations. ### Turn off and uninstall @@ -75,7 +75,7 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-no [`cordis.patch.yml`](cordis.patch.yml) inserts one row with id `notion` naming this package, so the package is both the bundle and its only row; `config` overrides target that id. The Host half, [`src/index.ts`](src/index.ts), makes two registrations, both effects of the plugin's fiber: `ctx.mcpServers.register('notion', …)` adds a Streamable HTTP entry with the configured `url` and OAuth credential key, and `ctx.systemPrompt.section()` adds the naming guidance at the `MCP_SERVERS` order. The server name fixes the `mcp__notion__` tool namespace, and the credential key fixes the grant address, so a reloaded or reinstalled plugin reaches the same tools and grant. The manager validates the entry when it is registered; a configured or registered server that already uses the name or key makes the plugin fail to load before the guidance is added. -The browser half, [`src/client/index.ts`](src/client/index.ts), attaches to the `notion` row, so its registrations exist while that row is on. It registers the `notion` dictionary and calls `ctx.mcpAccounts.register({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', locale: 'notion' })`; [`ui-mcp-account`](../../client/ui-mcp-account/README.md) then mirrors the `notion` entry and contributes the section, guidance, tag, and toast described above. +While the account registry runs, the plugin also calls `ctx.mcpAccounts.register({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', copy })`, where [`src/copy.ts`](src/copy.ts) holds the text that names Notion in every shipped language; [`ui-mcp-account`](../../client/ui-mcp-account/README.md) then serves the `notion` entry and renders the section, guidance, tag, and toast described above. A composition without the registry, such as a headless profile, loads the plugin without the account section. @@ -89,7 +89,7 @@ The browser half, [`src/client/index.ts`](src/client/index.ts), attaches to the - [MCP client](../../mcp/mcp-client/README.md) — connection, tool naming, OAuth grant refresh, and redaction. - [MCP subsystem](../../../docs/subsystems/mcp.md) — how the MCP packages fit together. - [Plugin Manager](../../boot/plugin-manager/README.md) — installation and enablement. -- [MCP account surfaces](../../client/ui-mcp-account/README.md) — the section, tag, guidance, and notices the browser half registers. +- [MCP account surfaces](../../client/ui-mcp-account/README.md) — the section, tag, guidance, and notices the account registration shows. - [Plugins page](../../client/ui-plugin-manager/README.md#use-this-package) — the bundle page those surfaces occupy. ----- @@ -149,6 +149,6 @@ Notion's instructions (or, with `eager`, its tools) appear when the connection s
Working context for maintainers — click to expand -Host specs run the plugin against the MCP manager and the mcp-client loopback OAuth server fixture; a client spec checks that the browser half registers the dictionary and account and removes both with the row. The `notion-plugin` session snapshot replays the Notion row without a saved grant, so it pins the naming guidance and verifies that no request reaches the server. +Host specs run the plugin against the MCP manager and the mcp-client loopback OAuth server fixture; another checks that the account registry serves the Notion account with its text and withdraws it with the plugin. The `notion-plugin` session snapshot replays the Notion row without a saved grant, so it pins the naming guidance and verifies that no request reaches the server.
diff --git a/packages/connector/notion/README.zh.md b/packages/connector/notion/README.zh.md index 1a070b4d07..cc196473dc 100644 --- a/packages/connector/notion/README.zh.md +++ b/packages/connector/notion/README.zh.md @@ -9,7 +9,7 @@ kind: "package-bundle" ## 概述 -Notion 插件在加载期间把 Notion 托管的 MCP 服务器 `https://mcp.notion.com/mcp` 注册到 Host 共用的 [MCP 管理器](../../mcp/mcp-manager/README.zh.md)。用户在 Web 侧栏**插件**页面的插件详情页中连接 Notion 账号,之后该 Host 上的所有对话都能使用这个服务器的工具,模型也会被告知把这项集成称为 Notion 插件。连接、OAuth 授权、已保存的 grant 和退出登录都由管理器负责;页面通过管理器的 Remote 读取和操作它们,不另设账号接口。插件运行在 Web 与 Desktop 组合中。 +Notion 插件在加载期间把 Notion 托管的 MCP 服务器 `https://mcp.notion.com/mcp` 注册到 Host 共用的 [MCP 管理器](../../mcp/mcp-manager/README.zh.md)。用户在 Web 侧栏**插件**页面的插件详情页中连接 Notion 账号,之后该 Host 上的所有对话都能使用这个服务器的工具,模型也会被告知把这项集成称为 Notion 插件。连接、OAuth 授权、已保存的 grant 和退出登录都由管理器负责,并由共用的 [MCP 账号界面](../../client/ui-mcp-account/README.zh.md)显示在插件页面上。插件运行在 Web 与 Desktop 组合中。 ## 目录 @@ -50,7 +50,7 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS 授权必须在 Host 所在机器的浏览器中完成。用户在 Notion 中同意授权后,回调页面说明 DSH 已收到授权,区块随后显示结果。离开页面不会取消授权尝试,尝试由 Host 持有。授权失败时显示**授权未完成,请重试**;页面操作失败时显示 toast。退出登录保留客户端注册,不会在 Notion 一侧撤销连接。 -页面通过 Remote 调用管理器的 [OAuth 操作](../../mcp/mcp-manager/README.zh.md#oauth-authorization):`watch` 报告条目,`startAuthorization('notion')` 返回一次授权尝试,其 `authorizationUrl` 由流报告,`cancelAuthorization('notion', id)` 取消它,`signOut('notion')` 删除 grant,`restart('notion')` 重试。其他 Remote 客户端可以使用同样的操作。 +页面通过 `mcpAccounts` Remote 跟随账号,该 Remote 报告管理器的条目;页面通过 Remote 调用管理器的 [OAuth 操作](../../mcp/mcp-manager/README.zh.md#oauth-authorization):`startAuthorization('notion')` 返回一次授权尝试,其 `authorizationUrl` 由流报告,`cancelAuthorization('notion', id)` 取消它,`signOut('notion')` 删除 grant,`restart('notion')` 重试。其他 Remote 客户端可以使用同样的操作。 ### 停用与卸载 @@ -75,7 +75,7 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS [`cordis.patch.yml`](cordis.patch.yml) 插入一行 id 为 `notion` 的条目,指向本包,因此本包既是 bundle,也是其唯一的一行;`config` 覆盖以该 id 为目标。Host 侧的 [`src/index.ts`](src/index.ts) 进行两项注册,二者都是插件 fiber 的 effect:`ctx.mcpServers.register('notion', …)` 以配置的 `url` 和 OAuth 凭据 key 添加一个 Streamable HTTP 条目,`ctx.systemPrompt.section()` 在 `MCP_SERVERS` 排序位置添加称呼指引。服务器名固定了 `mcp__notion__` 工具命名空间,凭据 key 固定了 grant 地址,因此重新加载或重新安装的插件会得到同样的工具和 grant。管理器在注册时校验条目;如果已配置或已注册的服务器占用了该名称或 key,插件会在添加指引之前加载失败。 -浏览器侧的 [`src/client/index.ts`](src/client/index.ts) 挂在 `notion` 行上,因此其注册只在该行开启时存在。它注册 `notion` 文案,并调用 `ctx.mcpAccounts.register({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', locale: 'notion' })`;随后由 [`ui-mcp-account`](../../client/ui-mcp-account/README.zh.md) 镜像 `notion` 条目,并提供上文所述的区块、引导、标签与 toast。 +账号注册表运行时,插件还调用 `ctx.mcpAccounts.register({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', copy })`,其中 [`src/copy.ts`](src/copy.ts) 以每种已发布语言保存指明 Notion 的文案;随后由 [`ui-mcp-account`](../../client/ui-mcp-account/README.zh.md) 提供 `notion` 条目,并渲染上文所述的区块、引导、标签与 toast。没有注册表的组合(如 headless profile)加载插件时不带账号区块。 @@ -89,7 +89,7 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS - [MCP 客户端](../../mcp/mcp-client/README.zh.md)——连接、工具命名、OAuth grant 刷新与脱敏。 - [MCP 子系统](../../../docs/subsystems/mcp.zh.md)——各 MCP 包如何协同。 - [Plugin Manager](../../boot/plugin-manager/README.zh.md)——安装与启用。 -- [MCP 账号界面](../../client/ui-mcp-account/README.zh.md)——浏览器侧注册的区块、标签、引导与提示。 +- [MCP 账号界面](../../client/ui-mcp-account/README.zh.md)——账号注册后显示的区块、标签、引导与提示。 - [插件页面](../../client/ui-plugin-manager/README.zh.md#use-this-package)——这些界面所在的 bundle 详情页。 ----- @@ -149,6 +149,6 @@ Notion 的服务器说明(设为 `eager` 时则是其工具)在连接成功
维护者工作上下文——点击展开 -Host 侧单测让插件运行在 MCP 管理器和 mcp-client 的回环 OAuth 服务器夹具之上;客户端单测检查浏览器侧注册文案与账号,并随该行一起移除两者。`notion-plugin` 会话快照在没有已保存 grant 的情况下回放 Notion 行,因此它固定称呼指引,并验证没有请求到达服务器。 +Host 侧单测让插件运行在 MCP 管理器和 mcp-client 的回环 OAuth 服务器夹具之上;另一项单测检查账号注册表提供带文案的 Notion 账号,并随插件一起撤下。`notion-plugin` 会话快照在没有已保存 grant 的情况下回放 Notion 行,因此它固定称呼指引,并验证没有请求到达服务器。
diff --git a/packages/connector/notion/package.json b/packages/connector/notion/package.json index a656e81e29..995e47ac41 100644 --- a/packages/connector/notion/package.json +++ b/packages/connector/notion/package.json @@ -18,10 +18,6 @@ "types": "./lib/types/index.d.ts", "default": "./lib/index.js" }, - "./client": { - "types": "./lib/types/client/index.d.ts", - "default": "./lib/client.js" - }, "./locale/*.json": "./locale/*.json", "./src/*": "./src/*", "./package.json": "./package.json", @@ -30,7 +26,6 @@ "files": [ "locale/*.json", "lib/index.js", - "lib/client.js", "cordis.patch.yml", "lib/types/**/*.d.ts" ], @@ -38,13 +33,6 @@ "dsh": { "bundle": { "patch": "./cordis.patch.yml" - }, - "client": { - "inject": [ - "@deepseek-ai/dsh-client-locale", - "@deepseek-ai/dsh-client-ui-mcp-account" - ], - "platform": "web" } }, "scripts": { @@ -66,9 +54,7 @@ "@deepseek-ai/dsh-mcp-resources": "workspace:*", "@deepseek-ai/dsh-scope": "workspace:*", "@deepseek-ai/dsh-system-prompt": "workspace:*", - "@deepseek-ai/dsh-client-locale": "workspace:*", "@deepseek-ai/dsh-client-ui-mcp-account": "workspace:*", - "@deepseek-ai/dsh-client-ui-slots": "workspace:*", "@deepseek-ai/dsh-tool-testkit": "workspace:*" } } diff --git a/packages/connector/notion/src/client/index.ts b/packages/connector/notion/src/client/index.ts deleted file mode 100644 index fde0e249fd..0000000000 --- a/packages/connector/notion/src/client/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Notion plugin, browser half: the Notion dictionary and the account - * registration that shows the connection section, the tag beside the bundle - * title, guidance after the bundle is switched on, and connection notices on - * the Notion bundle's page. - */ -import type { Context } from '@deepseek-ai/cordis' -import type {} from '@deepseek-ai/dsh-client-locale/client' -import type {} from '@deepseek-ai/dsh-client-ui-mcp-account/client' -import { de, en, es, fr, ja, NS, pt, ru, zh } from './locales.ts' - -/** Services the dictionary and the account registration need. */ -export const inject = ['locale', 'mcpAccounts'] - -/** - * Register the Notion account surfaces for as long as the Notion row is on. - * @param ctx - the browser plugin context. - */ -export function apply(ctx: Context): void { - ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'notion: dictionaries') - ctx.effect(() => ctx.mcpAccounts.register({ - server: 'notion', packageName: '@deepseek-ai/dsh-notion', locale: NS, - }), 'notion: account') -} diff --git a/packages/connector/notion/src/client/locales.ts b/packages/connector/notion/src/client/locales.ts deleted file mode 100644 index 90b49c2457..0000000000 --- a/packages/connector/notion/src/client/locales.ts +++ /dev/null @@ -1,373 +0,0 @@ -/** Locale-owned copy for the Notion plugin's connection on the Plugins page. */ -import type {} from '@deepseek-ai/dsh-client-ui-slots' -import type { McpAccountKey } from '@deepseek-ai/dsh-client-ui-mcp-account/client' - -/** Dictionary namespace for every Notion connection surface. */ -export const NS = 'notion' - -/** Chinese dictionary. */ -export const zh: Record = { - 'section.title': 'Notion 账号', - 'status.checking': '正在检查连接', - 'status.disconnected': '未连接', - 'status.waiting-browser': '等待你在浏览器中确认', - 'status.authorizing': '正在连接', - 'status.connecting': '正在连接', - 'status.connected': '已连接', - 'status.reconnect': '需要重新连接', - 'status.unavailable': '暂时无法连接', - 'detail.disconnected': '连接 Notion 账号后,可以在对话中搜索、读取和编辑你授权的页面与数据库。', - 'detail.waiting-browser': '已打开 Notion 授权页面。在 Notion 中确认后,回到这里查看结果。', - 'detail.authorizing': '正在与 Notion 完成授权。', - 'detail.connecting': '正在连接 Notion。', - 'detail.connected': '可以在对话中直接请 Agent 使用 Notion。', - 'detail.reconnect.expired': '授权已过期,请重新连接。', - 'detail.reconnect.binding': '授权与当前设置不再匹配,请重新连接。', - 'detail.reconnect.rejected': 'Notion 不再接受当前授权,请重新连接。', - 'detail.reconnect.scope': '当前授权缺少所需权限。重新连接时,请在 Notion 中确认权限。', - 'detail.unavailable': '已保留现有授权,可以稍后重试。', - hostBrowser: '授权需要在运行 DSH 的这台电脑上的浏览器中完成。', - failed: '授权未完成,请重试', - 'action.connect': '连接 Notion', - 'action.reconnect': '重新连接', - 'action.open': '打开授权页面', - 'action.cancel': '取消', - 'action.signOut': '退出登录', - 'action.retry': '重试', - 'badge.connected': '已连接', - 'badge.disconnected': '未连接', - 'badge.reconnect': '需要重新连接', - 'badge.unavailable': '暂时无法连接', - 'badge.connecting': '连接中', - 'signOut.title': '退出 Notion 登录?', - 'signOut.body': '将删除 DSH 保存的 Notion 授权,之后对话中无法使用 Notion。如需在 Notion 一侧撤销连接,请到 Notion 的设置中处理。', - 'activation.title': '连接 Notion 账号', - 'activation.body': 'Notion 插件已开启。连接你的 Notion 账号后,就可以在对话中使用它。', - 'activation.later': '稍后', - 'notice.connected': 'Notion 已连接', - 'notice.signed-out': '已退出 Notion 登录', - 'notice.action-failed': '操作未完成,请重试', - close: '关闭', -} - -/** English dictionary. */ -export const en: Record = { - 'section.title': 'Notion account', - 'status.checking': 'Checking connection', - 'status.disconnected': 'Not connected', - 'status.waiting-browser': 'Waiting for you to confirm in the browser', - 'status.authorizing': 'Connecting', - 'status.connecting': 'Connecting', - 'status.connected': 'Connected', - 'status.reconnect': 'Reconnection needed', - 'status.unavailable': 'Cannot connect right now', - 'detail.disconnected': 'Connect your Notion account to search, read, and edit the pages and databases you authorize, right from a conversation.', - 'detail.waiting-browser': 'The Notion authorization page is open. Confirm in Notion, then come back here to see the result.', - 'detail.authorizing': 'Finishing authorization with Notion.', - 'detail.connecting': 'Connecting to Notion.', - 'detail.connected': 'Ask the agent to use Notion directly in a conversation.', - 'detail.reconnect.expired': 'The authorization has expired. Connect again.', - 'detail.reconnect.binding': 'The authorization no longer matches the current settings. Connect again.', - 'detail.reconnect.rejected': 'Notion no longer accepts the current authorization. Connect again.', - 'detail.reconnect.scope': 'The current authorization lacks required permissions. Confirm them in Notion when you connect again.', - 'detail.unavailable': 'The existing authorization is kept. Try again later.', - hostBrowser: 'Authorization must be completed in a browser on the computer running DSH.', - failed: 'Authorization was not completed. Try again.', - 'action.connect': 'Connect Notion', - 'action.reconnect': 'Connect again', - 'action.open': 'Open authorization page', - 'action.cancel': 'Cancel', - 'action.signOut': 'Sign out', - 'action.retry': 'Retry', - 'badge.connected': 'Connected', - 'badge.disconnected': 'Not connected', - 'badge.reconnect': 'Reconnect', - 'badge.unavailable': 'Unavailable', - 'badge.connecting': 'Connecting', - 'signOut.title': 'Sign out of Notion?', - 'signOut.body': 'This deletes the Notion authorization DSH saved, so conversations can no longer use Notion. To revoke the connection on Notion\'s side, use Notion\'s settings.', - 'activation.title': 'Connect your Notion account', - 'activation.body': 'The Notion plugin is on. Connect your Notion account to use it in conversations.', - 'activation.later': 'Later', - 'notice.connected': 'Notion connected', - 'notice.signed-out': 'Signed out of Notion', - 'notice.action-failed': 'The action did not finish. Try again.', - close: 'Close', -} - -/** Japanese dictionary. */ -export const ja: Record = { - 'section.title': 'Notion アカウント', - 'status.checking': '接続を確認中', - 'status.disconnected': '未接続', - 'status.waiting-browser': 'ブラウザーでの確認を待っています', - 'status.authorizing': '接続中', - 'status.connecting': '接続中', - 'status.connected': '接続済み', - 'status.reconnect': '再接続が必要です', - 'status.unavailable': '現在接続できません', - 'detail.disconnected': 'Notion アカウントを接続すると、承認したページやデータベースを会話の中から直接検索、閲覧、編集できます。', - 'detail.waiting-browser': 'Notion の認可ページを開きました。Notion で確定したら、ここに戻って結果を確認してください。', - 'detail.authorizing': 'Notion での認可を完了しています。', - 'detail.connecting': 'Notion に接続しています。', - 'detail.connected': '会話の中でエージェントに Notion の使用を直接依頼できます。', - 'detail.reconnect.expired': '認可の有効期限が切れました。再度接続してください。', - 'detail.reconnect.binding': '認可が現在の設定と一致しなくなりました。再度接続してください。', - 'detail.reconnect.rejected': 'Notion は現在の認可を受け付けなくなりました。再度接続してください。', - 'detail.reconnect.scope': '現在の認可には必要な権限が不足しています。再度接続するときに、Notion で権限を確認してください。', - 'detail.unavailable': '現在の認可は保持されています。しばらくしてから再試行してください。', - hostBrowser: '認可は、DSH を実行しているコンピューターのブラウザーで完了する必要があります。', - failed: '認可が完了しませんでした。もう一度お試しください。', - 'action.connect': 'Notion を接続', - 'action.reconnect': '再接続', - 'action.open': '認可ページを開く', - 'action.cancel': 'キャンセル', - 'action.signOut': 'サインアウト', - 'action.retry': '再試行', - 'badge.connected': '接続済み', - 'badge.disconnected': '未接続', - 'badge.reconnect': '要再接続', - 'badge.unavailable': '利用不可', - 'badge.connecting': '接続中', - 'signOut.title': 'Notion からサインアウトしますか?', - 'signOut.body': 'DSH が保存した Notion の認可を削除します。以後、会話の中で Notion は使用できなくなります。Notion 側で接続を取り消すには、Notion の設定から行ってください。', - 'activation.title': 'Notion アカウントを接続', - 'activation.body': 'Notion プラグインがオンになりました。Notion アカウントを接続すると、会話の中で使用できます。', - 'activation.later': '後で', - 'notice.connected': 'Notion を接続しました', - 'notice.signed-out': 'Notion からサインアウトしました', - 'notice.action-failed': '操作が完了しませんでした。もう一度お試しください。', - close: '閉じる', -} - -/** Spanish dictionary. */ -export const es: Record = { - 'section.title': 'Cuenta de Notion', - 'status.checking': 'Comprobando la conexión', - 'status.disconnected': 'No conectado', - 'status.waiting-browser': 'Esperando su confirmación en el navegador', - 'status.authorizing': 'Conectando', - 'status.connecting': 'Conectando', - 'status.connected': 'Conectado', - 'status.reconnect': 'Se necesita volver a conectar', - 'status.unavailable': 'No se puede conectar en este momento', - 'detail.disconnected': 'Conecte su cuenta de Notion para buscar, leer y editar las páginas y bases de datos que autorice, directamente desde una conversación.', - 'detail.waiting-browser': 'La página de autorización de Notion está abierta. Confirme en Notion y luego vuelva aquí para ver el resultado.', - 'detail.authorizing': 'Completando la autorización con Notion.', - 'detail.connecting': 'Conectando con Notion.', - 'detail.connected': 'Pida al agente que use Notion directamente en una conversación.', - 'detail.reconnect.expired': 'La autorización ha caducado. Vuelva a conectar.', - 'detail.reconnect.binding': 'La autorización ya no coincide con la configuración actual. Vuelva a conectar.', - 'detail.reconnect.rejected': 'Notion ya no acepta la autorización actual. Vuelva a conectar.', - 'detail.reconnect.scope': 'A la autorización actual le faltan permisos necesarios. Confírmelos en Notion cuando vuelva a conectar.', - 'detail.unavailable': 'Se conserva la autorización actual. Inténtelo de nuevo más tarde.', - hostBrowser: 'La autorización debe completarse en un navegador de la computadora donde se ejecuta DSH.', - failed: 'La autorización no se completó. Inténtelo de nuevo.', - 'action.connect': 'Conectar Notion', - 'action.reconnect': 'Volver a conectar', - 'action.open': 'Abrir página de autorización', - 'action.cancel': 'Cancelar', - 'action.signOut': 'Cerrar sesión', - 'action.retry': 'Reintentar', - 'badge.connected': 'Conectado', - 'badge.disconnected': 'No conectado', - 'badge.reconnect': 'Reconectar', - 'badge.unavailable': 'No disponible', - 'badge.connecting': 'Conectando', - 'signOut.title': '¿Cerrar sesión en Notion?', - 'signOut.body': 'Se eliminará la autorización de Notion que guardó DSH, por lo que las conversaciones ya no podrán usar Notion. Para revocar la conexión del lado de Notion, use la configuración de Notion.', - 'activation.title': 'Conecte su cuenta de Notion', - 'activation.body': 'El complemento de Notion está activado. Conecte su cuenta de Notion para usarlo en las conversaciones.', - 'activation.later': 'Más tarde', - 'notice.connected': 'Notion conectado', - 'notice.signed-out': 'Sesión de Notion cerrada', - 'notice.action-failed': 'La acción no se completó. Inténtelo de nuevo.', - close: 'Cerrar', -} - -/** French dictionary. */ -export const fr: Record = { - 'section.title': 'Compte Notion', - 'status.checking': 'Vérification de la connexion', - 'status.disconnected': 'Non connecté', - 'status.waiting-browser': 'En attente de votre confirmation dans le navigateur', - 'status.authorizing': 'Connexion en cours', - 'status.connecting': 'Connexion en cours', - 'status.connected': 'Connecté', - 'status.reconnect': 'Reconnexion nécessaire', - 'status.unavailable': 'Connexion impossible pour le moment', - 'detail.disconnected': 'Connectez votre compte Notion pour rechercher, lire et modifier les pages et bases de données que vous autorisez, directement depuis une conversation.', - 'detail.waiting-browser': 'La page d’autorisation Notion est ouverte. Confirmez dans Notion, puis revenez ici pour voir le résultat.', - 'detail.authorizing': 'Finalisation de l’autorisation avec Notion.', - 'detail.connecting': 'Connexion à Notion en cours.', - 'detail.connected': 'Demandez à l’agent d’utiliser Notion directement dans une conversation.', - 'detail.reconnect.expired': 'L’autorisation a expiré. Reconnectez-vous.', - 'detail.reconnect.binding': 'L’autorisation ne correspond plus aux paramètres actuels. Reconnectez-vous.', - 'detail.reconnect.rejected': 'Notion n’accepte plus l’autorisation actuelle. Reconnectez-vous.', - 'detail.reconnect.scope': 'L’autorisation actuelle ne dispose pas des permissions requises. Confirmez-les dans Notion lors de la reconnexion.', - 'detail.unavailable': 'L’autorisation existante est conservée. Réessayez plus tard.', - hostBrowser: 'L’autorisation doit être effectuée dans un navigateur de l’ordinateur qui exécute DSH.', - failed: 'L’autorisation n’a pas abouti. Réessayez.', - 'action.connect': 'Connecter Notion', - 'action.reconnect': 'Se reconnecter', - 'action.open': 'Ouvrir la page d’autorisation', - 'action.cancel': 'Annuler', - 'action.signOut': 'Se déconnecter', - 'action.retry': 'Réessayer', - 'badge.connected': 'Connecté', - 'badge.disconnected': 'Non connecté', - 'badge.reconnect': 'À reconnecter', - 'badge.unavailable': 'Indisponible', - 'badge.connecting': 'Connexion en cours', - 'signOut.title': 'Se déconnecter de Notion ?', - 'signOut.body': 'Cela supprime l’autorisation Notion enregistrée par DSH : les conversations ne pourront plus utiliser Notion. Pour révoquer la connexion côté Notion, utilisez les paramètres de Notion.', - 'activation.title': 'Connectez votre compte Notion', - 'activation.body': 'Le plugin Notion est activé. Connectez votre compte Notion pour l’utiliser dans les conversations.', - 'activation.later': 'Plus tard', - 'notice.connected': 'Notion connecté', - 'notice.signed-out': 'Déconnecté de Notion', - 'notice.action-failed': 'L’action n’a pas abouti. Réessayez.', - close: 'Fermer', -} - -/** German dictionary. */ -export const de: Record = { - 'section.title': 'Notion-Konto', - 'status.checking': 'Verbindung wird geprüft', - 'status.disconnected': 'Nicht verbunden', - 'status.waiting-browser': 'Warten auf Ihre Bestätigung im Browser', - 'status.authorizing': 'Wird verbunden', - 'status.connecting': 'Wird verbunden', - 'status.connected': 'Verbunden', - 'status.reconnect': 'Erneute Verbindung erforderlich', - 'status.unavailable': 'Verbindung gerade nicht möglich', - 'detail.disconnected': 'Verbinden Sie Ihr Notion-Konto, um die von Ihnen freigegebenen Seiten und Datenbanken direkt aus einer Unterhaltung heraus zu durchsuchen, zu lesen und zu bearbeiten.', - 'detail.waiting-browser': 'Die Notion-Autorisierungsseite ist geöffnet. Bestätigen Sie in Notion und kehren Sie dann hierher zurück, um das Ergebnis zu sehen.', - 'detail.authorizing': 'Die Autorisierung mit Notion wird abgeschlossen.', - 'detail.connecting': 'Verbindung mit Notion wird hergestellt.', - 'detail.connected': 'Bitten Sie den Agenten, Notion direkt in einer Unterhaltung zu verwenden.', - 'detail.reconnect.expired': 'Die Autorisierung ist abgelaufen. Verbinden Sie erneut.', - 'detail.reconnect.binding': 'Die Autorisierung passt nicht mehr zu den aktuellen Einstellungen. Verbinden Sie erneut.', - 'detail.reconnect.rejected': 'Notion akzeptiert die aktuelle Autorisierung nicht mehr. Verbinden Sie erneut.', - 'detail.reconnect.scope': 'Der aktuellen Autorisierung fehlen erforderliche Berechtigungen. Bestätigen Sie diese in Notion, wenn Sie erneut verbinden.', - 'detail.unavailable': 'Die bestehende Autorisierung bleibt erhalten. Versuchen Sie es später erneut.', - hostBrowser: 'Die Autorisierung muss in einem Browser auf dem Computer abgeschlossen werden, auf dem DSH läuft.', - failed: 'Die Autorisierung wurde nicht abgeschlossen. Versuchen Sie es erneut.', - 'action.connect': 'Notion verbinden', - 'action.reconnect': 'Erneut verbinden', - 'action.open': 'Autorisierungsseite öffnen', - 'action.cancel': 'Abbrechen', - 'action.signOut': 'Abmelden', - 'action.retry': 'Erneut versuchen', - 'badge.connected': 'Verbunden', - 'badge.disconnected': 'Nicht verbunden', - 'badge.reconnect': 'Neu verbinden', - 'badge.unavailable': 'Nicht verfügbar', - 'badge.connecting': 'Wird verbunden', - 'signOut.title': 'Von Notion abmelden?', - 'signOut.body': 'Dadurch wird die von DSH gespeicherte Notion-Autorisierung gelöscht, sodass Unterhaltungen Notion nicht mehr verwenden können. Um die Verbindung auf Notion-Seite zu widerrufen, verwenden Sie die Einstellungen von Notion.', - 'activation.title': 'Notion-Konto verbinden', - 'activation.body': 'Das Notion-Plugin ist aktiviert. Verbinden Sie Ihr Notion-Konto, um es in Unterhaltungen zu verwenden.', - 'activation.later': 'Später', - 'notice.connected': 'Notion verbunden', - 'notice.signed-out': 'Von Notion abgemeldet', - 'notice.action-failed': 'Die Aktion wurde nicht abgeschlossen. Versuchen Sie es erneut.', - close: 'Schließen', -} - -/** Russian dictionary. */ -export const ru: Record = { - 'section.title': 'Аккаунт Notion', - 'status.checking': 'Проверка подключения', - 'status.disconnected': 'Не подключено', - 'status.waiting-browser': 'Ожидание вашего подтверждения в браузере', - 'status.authorizing': 'Подключение', - 'status.connecting': 'Подключение', - 'status.connected': 'Подключено', - 'status.reconnect': 'Требуется повторное подключение', - 'status.unavailable': 'Сейчас не удаётся подключиться', - 'detail.disconnected': 'Подключите аккаунт Notion, чтобы искать, читать и редактировать разрешённые вами страницы и базы данных прямо из беседы.', - 'detail.waiting-browser': 'Страница авторизации Notion открыта. Подтвердите в Notion, затем вернитесь сюда, чтобы увидеть результат.', - 'detail.authorizing': 'Завершение авторизации в Notion.', - 'detail.connecting': 'Подключение к Notion.', - 'detail.connected': 'Попросите агента использовать Notion прямо в беседе.', - 'detail.reconnect.expired': 'Срок действия авторизации истёк. Подключитесь снова.', - 'detail.reconnect.binding': 'Авторизация больше не соответствует текущим настройкам. Подключитесь снова.', - 'detail.reconnect.rejected': 'Notion больше не принимает текущую авторизацию. Подключитесь снова.', - 'detail.reconnect.scope': 'Текущей авторизации не хватает нужных разрешений. Подтвердите их в Notion при повторном подключении.', - 'detail.unavailable': 'Текущая авторизация сохранена. Повторите попытку позже.', - hostBrowser: 'Авторизацию нужно завершить в браузере на компьютере, где запущен DSH.', - failed: 'Авторизация не завершена. Повторите попытку.', - 'action.connect': 'Подключить Notion', - 'action.reconnect': 'Подключить снова', - 'action.open': 'Открыть страницу авторизации', - 'action.cancel': 'Отмена', - 'action.signOut': 'Выйти', - 'action.retry': 'Повторить', - 'badge.connected': 'Подключено', - 'badge.disconnected': 'Не подключено', - 'badge.reconnect': 'Переподключить', - 'badge.unavailable': 'Недоступно', - 'badge.connecting': 'Подключение', - 'signOut.title': 'Выйти из Notion?', - 'signOut.body': 'Сохранённая DSH авторизация Notion будет удалена, и беседы больше не смогут использовать Notion. Чтобы отозвать подключение на стороне Notion, воспользуйтесь настройками Notion.', - 'activation.title': 'Подключите аккаунт Notion', - 'activation.body': 'Плагин Notion включён. Подключите аккаунт Notion, чтобы использовать его в беседах.', - 'activation.later': 'Позже', - 'notice.connected': 'Notion подключён', - 'notice.signed-out': 'Выполнен выход из Notion', - 'notice.action-failed': 'Действие не завершено. Повторите попытку.', - close: 'Закрыть', -} - -/** Portuguese dictionary. */ -export const pt: Record = { - 'section.title': 'Conta do Notion', - 'status.checking': 'Verificando a conexão', - 'status.disconnected': 'Não conectado', - 'status.waiting-browser': 'Aguardando sua confirmação no navegador', - 'status.authorizing': 'Conectando', - 'status.connecting': 'Conectando', - 'status.connected': 'Conectado', - 'status.reconnect': 'É necessário reconectar', - 'status.unavailable': 'Não é possível conectar no momento', - 'detail.disconnected': 'Conecte sua conta do Notion para pesquisar, ler e editar as páginas e os bancos de dados que você autorizar, direto de uma conversa.', - 'detail.waiting-browser': 'A página de autorização do Notion está aberta. Confirme no Notion e depois volte aqui para ver o resultado.', - 'detail.authorizing': 'Concluindo a autorização com o Notion.', - 'detail.connecting': 'Conectando ao Notion.', - 'detail.connected': 'Peça ao agente que use o Notion diretamente em uma conversa.', - 'detail.reconnect.expired': 'A autorização expirou. Conecte novamente.', - 'detail.reconnect.binding': 'A autorização não corresponde mais às configurações atuais. Conecte novamente.', - 'detail.reconnect.rejected': 'O Notion não aceita mais a autorização atual. Conecte novamente.', - 'detail.reconnect.scope': 'A autorização atual não tem as permissões necessárias. Confirme-as no Notion ao conectar novamente.', - 'detail.unavailable': 'A autorização atual foi mantida. Tente novamente mais tarde.', - hostBrowser: 'A autorização deve ser concluída em um navegador no computador que executa o DSH.', - failed: 'A autorização não foi concluída. Tente novamente.', - 'action.connect': 'Conectar Notion', - 'action.reconnect': 'Conectar novamente', - 'action.open': 'Abrir página de autorização', - 'action.cancel': 'Cancelar', - 'action.signOut': 'Sair', - 'action.retry': 'Tentar novamente', - 'badge.connected': 'Conectado', - 'badge.disconnected': 'Não conectado', - 'badge.reconnect': 'Reconectar', - 'badge.unavailable': 'Indisponível', - 'badge.connecting': 'Conectando', - 'signOut.title': 'Sair do Notion?', - 'signOut.body': 'Isso exclui a autorização do Notion salva pelo DSH, e as conversas não poderão mais usar o Notion. Para revogar a conexão no lado do Notion, use as configurações do Notion.', - 'activation.title': 'Conecte sua conta do Notion', - 'activation.body': 'O plugin do Notion está ativado. Conecte sua conta do Notion para usá-lo nas conversas.', - 'activation.later': 'Mais tarde', - 'notice.connected': 'Notion conectado', - 'notice.signed-out': 'Você saiu do Notion', - 'notice.action-failed': 'A ação não foi concluída. Tente novamente.', - close: 'Fechar', -} - -declare module '@deepseek-ai/dsh-client-ui-slots' { - interface LocaleNamespaceMap { - /** Notion connection section, tag, guidance, and notices on the Plugins page. */ - 'notion': McpAccountKey - } -} diff --git a/packages/connector/notion/src/copy.ts b/packages/connector/notion/src/copy.ts new file mode 100644 index 0000000000..14525ce105 --- /dev/null +++ b/packages/connector/notion/src/copy.ts @@ -0,0 +1,167 @@ +/** The Plugins page text that names Notion; the shared account copy comes from the account surfaces' dictionary. */ +import type { McpAccountCopy } from '@deepseek-ai/dsh-client-ui-mcp-account' + +/** Every language the Web app ships. */ +type ShippedText = Readonly> + +/** Notion's account text in every shipped language. */ +export const COPY: McpAccountCopy = { + title: { + zh: 'Notion 账号', + en: 'Notion account', + ja: 'Notion アカウント', + es: 'Cuenta de Notion', + fr: 'Compte Notion', + de: 'Notion-Konto', + ru: 'Аккаунт Notion', + pt: 'Conta do Notion', + }, + connect: { + zh: '连接 Notion', + en: 'Connect Notion', + ja: 'Notion を接続', + es: 'Conectar Notion', + fr: 'Connecter Notion', + de: 'Notion verbinden', + ru: 'Подключить Notion', + pt: 'Conectar Notion', + }, + activation: { + title: { + zh: '连接 Notion 账号', + en: 'Connect your Notion account', + ja: 'Notion アカウントを接続', + es: 'Conecte su cuenta de Notion', + fr: 'Connectez votre compte Notion', + de: 'Notion-Konto verbinden', + ru: 'Подключите аккаунт Notion', + pt: 'Conecte sua conta do Notion', + }, + body: { + zh: 'Notion 插件已开启。连接你的 Notion 账号后,就可以在对话中使用它。', + en: 'The Notion plugin is on. Connect your Notion account to use it in conversations.', + ja: 'Notion プラグインがオンになりました。Notion アカウントを接続すると、会話の中で使用できます。', + es: 'El complemento de Notion está activado. Conecte su cuenta de Notion para usarlo en las conversaciones.', + fr: 'Le plugin Notion est activé. Connectez votre compte Notion pour l’utiliser dans les conversations.', + de: 'Das Notion-Plugin ist aktiviert. Verbinden Sie Ihr Notion-Konto, um es in Unterhaltungen zu verwenden.', + ru: 'Плагин Notion включён. Подключите аккаунт Notion, чтобы использовать его в беседах.', + pt: 'O plugin do Notion está ativado. Conecte sua conta do Notion para usá-lo nas conversas.', + }, + }, + detail: { + disconnected: { + zh: '连接 Notion 账号后,可以在对话中搜索、读取和编辑你授权的页面与数据库。', + en: 'Connect your Notion account to search, read, and edit the pages and databases you authorize, right from a conversation.', + ja: 'Notion アカウントを接続すると、承認したページやデータベースを会話の中から直接検索、閲覧、編集できます。', + es: 'Conecte su cuenta de Notion para buscar, leer y editar las páginas y bases de datos que autorice, directamente desde una conversación.', + fr: 'Connectez votre compte Notion pour rechercher, lire et modifier les pages et bases de données que vous autorisez, directement depuis une conversation.', + de: 'Verbinden Sie Ihr Notion-Konto, um die von Ihnen freigegebenen Seiten und Datenbanken direkt aus einer Unterhaltung heraus zu durchsuchen, zu lesen und zu bearbeiten.', + ru: 'Подключите аккаунт Notion, чтобы искать, читать и редактировать разрешённые вами страницы и базы данных прямо из беседы.', + pt: 'Conecte sua conta do Notion para pesquisar, ler e editar as páginas e os bancos de dados que você autorizar, direto de uma conversa.', + }, + waitingBrowser: { + zh: '已打开 Notion 授权页面。在 Notion 中确认后,回到这里查看结果。', + en: 'The Notion authorization page is open. Confirm in Notion, then come back here to see the result.', + ja: 'Notion の認可ページを開きました。Notion で確定したら、ここに戻って結果を確認してください。', + es: 'La página de autorización de Notion está abierta. Confirme en Notion y luego vuelva aquí para ver el resultado.', + fr: 'La page d’autorisation Notion est ouverte. Confirmez dans Notion, puis revenez ici pour voir le résultat.', + de: 'Die Notion-Autorisierungsseite ist geöffnet. Bestätigen Sie in Notion und kehren Sie dann hierher zurück, um das Ergebnis zu sehen.', + ru: 'Страница авторизации Notion открыта. Подтвердите в Notion, затем вернитесь сюда, чтобы увидеть результат.', + pt: 'A página de autorização do Notion está aberta. Confirme no Notion e depois volte aqui para ver o resultado.', + }, + authorizing: { + zh: '正在与 Notion 完成授权。', + en: 'Finishing authorization with Notion.', + ja: 'Notion での認可を完了しています。', + es: 'Completando la autorización con Notion.', + fr: 'Finalisation de l’autorisation avec Notion.', + de: 'Die Autorisierung mit Notion wird abgeschlossen.', + ru: 'Завершение авторизации в Notion.', + pt: 'Concluindo a autorização com o Notion.', + }, + connecting: { + zh: '正在连接 Notion。', + en: 'Connecting to Notion.', + ja: 'Notion に接続しています。', + es: 'Conectando con Notion.', + fr: 'Connexion à Notion en cours.', + de: 'Verbindung mit Notion wird hergestellt.', + ru: 'Подключение к Notion.', + pt: 'Conectando ao Notion.', + }, + connected: { + zh: '可以在对话中直接请 Agent 使用 Notion。', + en: 'Ask the agent to use Notion directly in a conversation.', + ja: '会話の中でエージェントに Notion の使用を直接依頼できます。', + es: 'Pida al agente que use Notion directamente en una conversación.', + fr: 'Demandez à l’agent d’utiliser Notion directement dans une conversation.', + de: 'Bitten Sie den Agenten, Notion direkt in einer Unterhaltung zu verwenden.', + ru: 'Попросите агента использовать Notion прямо в беседе.', + pt: 'Peça ao agente que use o Notion diretamente em uma conversa.', + }, + rejected: { + zh: 'Notion 不再接受当前授权,请重新连接。', + en: 'Notion no longer accepts the current authorization. Connect again.', + ja: 'Notion は現在の認可を受け付けなくなりました。再度接続してください。', + es: 'Notion ya no acepta la autorización actual. Vuelva a conectar.', + fr: 'Notion n’accepte plus l’autorisation actuelle. Reconnectez-vous.', + de: 'Notion akzeptiert die aktuelle Autorisierung nicht mehr. Verbinden Sie erneut.', + ru: 'Notion больше не принимает текущую авторизацию. Подключитесь снова.', + pt: 'O Notion não aceita mais a autorização atual. Conecte novamente.', + }, + scope: { + zh: '当前授权缺少所需权限。重新连接时,请在 Notion 中确认权限。', + en: 'The current authorization lacks required permissions. Confirm them in Notion when you connect again.', + ja: '現在の認可には必要な権限が不足しています。再度接続するときに、Notion で権限を確認してください。', + es: 'A la autorización actual le faltan permisos necesarios. Confírmelos en Notion cuando vuelva a conectar.', + fr: 'L’autorisation actuelle ne dispose pas des permissions requises. Confirmez-les dans Notion lors de la reconnexion.', + de: 'Der aktuellen Autorisierung fehlen erforderliche Berechtigungen. Bestätigen Sie diese in Notion, wenn Sie erneut verbinden.', + ru: 'Текущей авторизации не хватает нужных разрешений. Подтвердите их в Notion при повторном подключении.', + pt: 'A autorização atual não tem as permissões necessárias. Confirme-as no Notion ao conectar novamente.', + }, + }, + signOut: { + title: { + zh: '退出 Notion 登录?', + en: 'Sign out of Notion?', + ja: 'Notion からサインアウトしますか?', + es: '¿Cerrar sesión en Notion?', + fr: 'Se déconnecter de Notion ?', + de: 'Von Notion abmelden?', + ru: 'Выйти из Notion?', + pt: 'Sair do Notion?', + }, + body: { + zh: '将删除 DSH 保存的 Notion 授权,之后对话中无法使用 Notion。如需在 Notion 一侧撤销连接,请到 Notion 的设置中处理。', + en: 'This deletes the Notion authorization DSH saved, so conversations can no longer use Notion. To revoke the connection on Notion\'s side, use Notion\'s settings.', + ja: 'DSH が保存した Notion の認可を削除します。以後、会話の中で Notion は使用できなくなります。Notion 側で接続を取り消すには、Notion の設定から行ってください。', + es: 'Se eliminará la autorización de Notion que guardó DSH, por lo que las conversaciones ya no podrán usar Notion. Para revocar la conexión del lado de Notion, use la configuración de Notion.', + fr: 'Cela supprime l’autorisation Notion enregistrée par DSH : les conversations ne pourront plus utiliser Notion. Pour révoquer la connexion côté Notion, utilisez les paramètres de Notion.', + de: 'Dadurch wird die von DSH gespeicherte Notion-Autorisierung gelöscht, sodass Unterhaltungen Notion nicht mehr verwenden können. Um die Verbindung auf Notion-Seite zu widerrufen, verwenden Sie die Einstellungen von Notion.', + ru: 'Сохранённая DSH авторизация Notion будет удалена, и беседы больше не смогут использовать Notion. Чтобы отозвать подключение на стороне Notion, воспользуйтесь настройками Notion.', + pt: 'Isso exclui a autorização do Notion salva pelo DSH, e as conversas não poderão mais usar o Notion. Para revogar a conexão no lado do Notion, use as configurações do Notion.', + }, + }, + notice: { + connected: { + zh: 'Notion 已连接', + en: 'Notion connected', + ja: 'Notion を接続しました', + es: 'Notion conectado', + fr: 'Notion connecté', + de: 'Notion verbunden', + ru: 'Notion подключён', + pt: 'Notion conectado', + }, + signedOut: { + zh: '已退出 Notion 登录', + en: 'Signed out of Notion', + ja: 'Notion からサインアウトしました', + es: 'Sesión de Notion cerrada', + fr: 'Déconnecté de Notion', + de: 'Von Notion abgemeldet', + ru: 'Выполнен выход из Notion', + pt: 'Você saiu do Notion', + }, + }, +} diff --git a/packages/connector/notion/src/index.ts b/packages/connector/notion/src/index.ts index 96e510fa5f..ecc1d4310d 100644 --- a/packages/connector/notion/src/index.ts +++ b/packages/connector/notion/src/index.ts @@ -1,17 +1,19 @@ /** * Notion plugin: registers Notion's hosted MCP server with the shared MCP - * manager for this plugin's lifetime and tells the model to call it the - * Notion plugin. The manager owns connection, OAuth authorization, saved - * grants, and sign-out; once a grant exists, the server's `mcp__notion__*` - * tools are listed in the system prompt and each agent loads the ones it - * needs. + * manager for this plugin's lifetime, tells the model to call it the Notion + * plugin, and shows the account on the Plugins page while the account registry + * runs. The manager owns connection, OAuth authorization, saved grants, and + * sign-out; once a grant exists, the server's `mcp__notion__*` tools are + * listed in the system prompt and each agent loads the ones it needs. * @module @deepseek-ai/dsh-notion */ import type { Context } from '@deepseek-ai/cordis' import z from '@deepseek-ai/schemastery' +import type {} from '@deepseek-ai/dsh-client-ui-mcp-account' import type {} from '@deepseek-ai/dsh-mcp-manager' import type {} from '@deepseek-ai/dsh-system-prompt' +import { COPY } from './copy.ts' export const name = 'notion' export const inject = ['mcpServers', 'systemPrompt'] @@ -38,7 +40,8 @@ export const Config: z, Config> = z.object({ }) /** - * Register the Notion server and its naming guidance; both are withdrawn when the plugin unloads. + * Register the Notion server, its naming guidance, and, while the account registry runs, its Plugins page account; all + * are withdrawn when the plugin unloads. * @param ctx - Context carrying the MCP manager and system prompt. * @param config - Notion endpoint and tool loading. * @throws when another configured or registered server already uses the `notion` name or credential key. @@ -56,4 +59,7 @@ export function apply(ctx: Context, config: Config): void { order: ctx.systemPrompt.getSectionOrder('MCP_SERVERS'), text: GUIDANCE, }) + ctx.inject(['mcpAccounts'], (scope) => { + scope.effect(() => scope.mcpAccounts.register({ server: SERVER_NAME, packageName: '@deepseek-ai/dsh-notion', copy: COPY }), 'notion: Plugins page account') + }) } diff --git a/packages/connector/notion/tests/mount.client.spec.ts b/packages/connector/notion/tests/mount.client.spec.ts deleted file mode 100644 index 6432f31eb1..0000000000 --- a/packages/connector/notion/tests/mount.client.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** The browser half registers the Notion dictionary and account while the Notion row is on and withdraws both with it. */ -import { Context } from '@deepseek-ai/cordis' -import { expect, it, vi } from 'vitest' -import { apply, inject } from '../src/client/index.ts' -import { de, en, es, fr, ja, pt, ru, zh } from '../src/client/locales.ts' - -it('registers the Notion account under its dictionary and removes both on disposal', async () => { - const ctx = new Context() - const dictionaryRemoved = vi.fn(), accountRemoved = vi.fn() - const locale = { register: vi.fn(() => dictionaryRemoved) } - const mcpAccounts = { register: vi.fn(() => accountRemoved) } - ctx.provide('locale', locale) - ctx.provide('mcpAccounts', mcpAccounts) - try { - const fiber = ctx.plugin({ inject: [...inject], apply }) - await fiber - expect(locale.register).toHaveBeenCalledWith('notion', { zh, en, ja, es, fr, de, ru, pt }) - expect(mcpAccounts.register).toHaveBeenCalledWith({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', locale: 'notion' }) - await fiber.dispose() - expect(dictionaryRemoved).toHaveBeenCalledOnce() - expect(accountRemoved).toHaveBeenCalledOnce() - } finally { await ctx.fiber.dispose() } -}) diff --git a/packages/connector/notion/tests/plugin.spec.ts b/packages/connector/notion/tests/plugin.spec.ts index 95e82c1291..e3615ac113 100644 --- a/packages/connector/notion/tests/plugin.spec.ts +++ b/packages/connector/notion/tests/plugin.spec.ts @@ -3,6 +3,7 @@ import { expect, it, vi } from 'vitest' import type { Context } from '@deepseek-ai/cordis' import type { Agent } from '@deepseek-ai/dsh-agent' +import McpAccounts, { type McpAccountsView } from '@deepseek-ai/dsh-client-ui-mcp-account' import { parseCredentialKey } from '@deepseek-ai/dsh-credentials' import { ToolCallId } from '@deepseek-ai/dsh-llm' import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit' @@ -12,6 +13,7 @@ import { createScope } from '@deepseek-ai/dsh-scope' import { renderPrompt } from '@deepseek-ai/dsh-system-prompt' import { callback, oauthWorld, phase } from '../../../mcp/mcp-client/tests/oauth-fixture.ts' import { managerProfile } from '../../../mcp/mcp-manager/tests/profile-fixture.ts' +import { COPY } from '../src/copy.ts' import * as Notion from '../src/index.ts' // Verbatim pin of the model-visible guidance in src/index.ts. @@ -100,6 +102,28 @@ it('keeps Notion tools hidden from an agent until it loads them, unless loading expect(b.ctx.tools.get('mcp__notion__ping', other)).toBeDefined() }) +/** Read the account stream until a view satisfies the predicate. */ +async function until(stream: AsyncIterator, predicate: (view: McpAccountsView) => boolean): Promise { + for (;;) { + const next = await stream.next() + if (next.done === true) throw new Error('account stream ended') + if (predicate(next.value)) return next.value + } +} + +it('shows the Notion account on the Plugins page while the account registry runs, and withdraws it with the plugin', async () => { + const b = await fixture() + await b.ctx.plugin(McpAccounts) + const stream = b.ctx.mcpAccounts.watch(new AbortController().signal)[Symbol.asyncIterator]() + const plugin = b.mount() + await plugin.await() + const shown = await until(stream, view => view.accounts[0]?.view !== undefined) + expect(shown.accounts).toHaveLength(1) + expect(shown.accounts[0]).toMatchObject({ server: 'notion', packageName: '@deepseek-ai/dsh-notion', copy: COPY, view: { name: 'notion' } }) + await plugin.dispose() + await until(stream, view => view.accounts.length === 0) +}) + it('refuses to load when a configured server already uses the Notion name', async () => { const b = await fixture({ notion: { transport: 'streamable-http', url: 'https://notion.example/mcp', enabled: false } }) await expect(b.mount().await()).rejects.toThrow('server "notion" is already configured or registered') diff --git a/packages/connector/notion/tsconfig.client.json b/packages/connector/notion/tsconfig.client.json deleted file mode 100644 index 21df0aea76..0000000000 --- a/packages/connector/notion/tsconfig.client.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../../tsconfig.base.client.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types", - "tsBuildInfoFile": "lib/tsconfig.client.tsbuildinfo" - }, - "include": [ - "src/client" - ], - "references": [ - { - "path": "../../../vendor/cordis" - }, - { - "path": "../../client/locale/tsconfig.client.json" - }, - { - "path": "../../client/ui-mcp-account" - }, - { - "path": "../../client/ui-slots" - } - ] -} diff --git a/packages/connector/notion/tsconfig.host.json b/packages/connector/notion/tsconfig.host.json deleted file mode 100644 index 2add6b53a9..0000000000 --- a/packages/connector/notion/tsconfig.host.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types", - "tsBuildInfoFile": "lib/tsconfig.host.tsbuildinfo" - }, - "files": [ - "src/index.ts" - ], - "references": [ - { - "path": "../../../vendor/cordis" - }, - { - "path": "../../../vendor/schemastery" - }, - { - "path": "../../mcp/mcp-manager" - }, - { - "path": "../../core/system-prompt" - } - ] -} diff --git a/packages/connector/notion/tsconfig.json b/packages/connector/notion/tsconfig.json index 2eca820546..6ecf716356 100644 --- a/packages/connector/notion/tsconfig.json +++ b/packages/connector/notion/tsconfig.json @@ -1,11 +1,27 @@ { - "files": [], + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib/types" + }, + "include": [ + "src" + ], "references": [ { - "path": "./tsconfig.host.json" + "path": "../../../vendor/cordis" }, { - "path": "./tsconfig.client.json" + "path": "../../../vendor/schemastery" + }, + { + "path": "../../mcp/mcp-manager" + }, + { + "path": "../../core/system-prompt" + }, + { + "path": "../../client/ui-mcp-account/tsconfig.host.json" } ] } diff --git a/packages/connector/notion/tsdown.config.ts b/packages/connector/notion/tsdown.config.ts deleted file mode 100644 index e0c1efd7dc..0000000000 --- a/packages/connector/notion/tsdown.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { clientBundle } from '../../client/tsdown.client.ts' - -export default clientBundle(import.meta.dirname, ['lib/types/index.js'], { hostPhase: true }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95b605d892..33b2cd65c9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7519,15 +7519,9 @@ importers: '@deepseek-ai/dsh-agent': specifier: workspace:* version: link:../../core/agent - '@deepseek-ai/dsh-client-locale': - specifier: workspace:* - version: link:../../client/locale '@deepseek-ai/dsh-client-ui-mcp-account': specifier: workspace:* version: link:../../client/ui-mcp-account - '@deepseek-ai/dsh-client-ui-slots': - specifier: workspace:* - version: link:../../client/ui-slots '@deepseek-ai/dsh-credentials': specifier: workspace:* version: link:../../credentials/credentials diff --git a/tsconfig.client.json b/tsconfig.client.json index f4fb08ec14..a978b1755e 100644 --- a/tsconfig.client.json +++ b/tsconfig.client.json @@ -163,7 +163,6 @@ { "path": "./packages/client/ui-settings-models" }, { "path": "./packages/client/ui-plugin-manager/tsconfig.client.json" }, { "path": "./packages/client/ui-plugin-market" }, - { "path": "./packages/connector/notion/tsconfig.client.json" }, { "path": "./packages/client/ui-settings-plugin-inventory" }, { "path": "./packages/client/locale/tsconfig.client.json" }, { "path": "./packages/client/ui-renderer" }, diff --git a/tsconfig.host.json b/tsconfig.host.json index 660c96f1f2..86ceb2c20b 100644 --- a/tsconfig.host.json +++ b/tsconfig.host.json @@ -578,7 +578,7 @@ { "path": "./packages/mcp/mcp-client" }, { "path": "./packages/mcp/mcp-manager" }, { "path": "./packages/mcp/mcp-resources" }, - { "path": "./packages/connector/notion/tsconfig.host.json" }, + { "path": "./packages/connector/notion" }, { "path": "./packages/host/directory-picker" }, { "path": "./packages/host/directory-picker-auto" }, { "path": "./packages/host/directory-picker-browse" },