diff --git a/docs/config-catalog.md b/docs/config-catalog.md
index d4e61f781d..ca29a1f264 100644
--- a/docs/config-catalog.md
+++ b/docs/config-catalog.md
@@ -2560,7 +2560,7 @@ export interface Config {
## `@deepseek-ai/dsh-notion`
- `inject`: `mcpServers` · `systemPrompt`
-- `source`: [`packages/connector/notion/src/index.ts:26`](../packages/connector/notion/src/index.ts)
+- `source`: [`packages/connector/notion/src/index.ts:27`](../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 44984b226b..684051259a 100644
--- a/docs/config-catalog.zh.md
+++ b/docs/config-catalog.zh.md
@@ -2562,7 +2562,7 @@ export interface Config {
## `@deepseek-ai/dsh-notion`
- `inject`: `mcpServers` · `systemPrompt`
-- `source`: [`packages/connector/notion/src/index.ts:26`](../packages/connector/notion/src/index.ts)
+- `source`: [`packages/connector/notion/src/index.ts:27`](../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 228410cbdf..b34481a0bf 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: d987f216f9bebd1f
- zh: 0348b39e08b0d903
+ en: ce335815b5b7cb53
+ zh: a26d3e61baf53eb9
/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: bac2be240e693f4a
- zh: 10af6da37fd11807
+ en: d1709f5f06abcda7
+ zh: aa1522f7f858f822
/deepseek-ai-dsh-notion/use-this-package/turn-off-and-uninstall:
en: 8fb8e3a36288a635
zh: 3ba01fe30e802d1f
@@ -30,27 +30,27 @@
en: fbba2c704dab668a
zh: 7fd7ece85739c6e3
/deepseek-ai-dsh-notion/understand-the-implementation:
- en: 8e9f6ed96ee55201
- zh: 10e8d2071d85069d
+ en: 5fdb86f56d07b8e1
+ zh: 3fee4ea1c0689d1f
/deepseek-ai-dsh-notion/further-exploration:
- en: 9de5e710b4dd7ba9
- zh: d895238cbd9e08f7
+ en: b1a8832ec6aaa59a
+ zh: 69eb8266916d008a
/deepseek-ai-dsh-notion/model-experience:
en: 215e7ba838619b7b
zh: a311da3843709f90
-/deepseek-ai-dsh-notion/model-experience/naming-guidance:
- en: c5d4839916cd6dc2
- zh: cb6d9b8c4182929c
-/deepseek-ai-dsh-notion/model-experience/naming-guidance/what-the-model-sees:
+/deepseek-ai-dsh-notion/model-experience/naming-and-connection-guidance:
+ en: 01b6ec6d681e457b
+ zh: 7fe0d1c9d1037bd4
+/deepseek-ai-dsh-notion/model-experience/naming-and-connection-guidance/what-the-model-sees:
en: a62a8dbe1f7b7944
zh: 32a94fa68d8b30c2
-/deepseek-ai-dsh-notion/model-experience/naming-guidance/what-the-model-sees/guidance-text:
+/deepseek-ai-dsh-notion/model-experience/naming-and-connection-guidance/what-the-model-sees/guidance-text:
en: 8f57292f6821da96
zh: b2d3bc7e5c9cbc05
-/deepseek-ai-dsh-notion/model-experience/naming-guidance/token-effect:
- en: 570e40dca65df1ef
- zh: 4f71ad76a17a2c54
-/deepseek-ai-dsh-notion/model-experience/naming-guidance/kv-cache-effect:
+/deepseek-ai-dsh-notion/model-experience/naming-and-connection-guidance/token-effect:
+ en: 263969c79903e387
+ zh: d45f9e49d9a252c3
+/deepseek-ai-dsh-notion/model-experience/naming-and-connection-guidance/kv-cache-effect:
en: e9668826c9355444
zh: 66f609e3779fd510
/deepseek-ai-dsh-notion/model-experience/notion-server-tools-and-instructions:
@@ -66,8 +66,8 @@
en: c9327a5b0f494922
zh: e36a635527a79dee
/deepseek-ai-dsh-notion/known-limitations-and-deferred-work:
- en: ea61eb47ae041420
- zh: 65eed6f181f9b392
+ en: 7a6944464f5f1f93
+ zh: 8230c8d06b7d577b
/deepseek-ai-dsh-notion/known-limitations-and-deferred-work/dev-note:
- en: ad49c4ecc94eebdf
- zh: 965abefc874d8e55
+ en: fc88fd2563d58b64
+ zh: ac8c6b5db2138e28
diff --git a/packages/connector/notion/README.md b/packages/connector/notion/README.md
index d5232c1af1..7819a7a0fd 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. After the user authorizes a Notion account, 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; this package 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; 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.
## Table of Contents
@@ -39,7 +39,18 @@ The bundle patch inserts the `notion` row after the profile's other layers. The
The plugin registers the server `notion` with the fixed OAuth credential key `mcp-client/notion`. Without a saved grant the server waits for authorization and exposes no Notion tools. With a saved grant the manager connects at startup and refreshes tokens as needed. Notion's tools load [on demand](../../mcp/mcp-client/README.md#on-demand-tool-loading) by default: the system prompt lists them, and each agent loads the ones it needs with `mcp__notion__load_tools`.
-Authorization uses the manager's [OAuth operations](../../mcp/mcp-manager/README.md#oauth-authorization) through Remote; there is no sign-in page yet. A Remote client calls `ctx.remote.mcpServers.startAuthorization('notion')`, opens the returned `authorizationUrl` in a browser on the Host machine, and the user approves access in Notion. `list()` and `watch` report progress, and `cancelAuthorization('notion', id)` cancels one attempt. `signOut('notion')` deletes the local grant and keeps the client registration; it does not revoke the connection on Notion's side.
+While the plugin is on, its page on the **Plugins** page shows a **Notion account** section, and a tag beside the title reads Not connected, Connecting, Connected, Reconnect, or Unavailable. Switching the plugin on from the list while no account is connected offers **Connect Notion**, which opens the plugin's page and starts authorization.
+
+| Section state | Action |
+|---|---|
+| Not connected, or the grant expired, no longer matches the settings, was rejected, or lacks permissions | **Connect Notion** or **Connect again** starts an authorization attempt |
+| Waiting for you to confirm in the browser | The browser that started the attempt opens Notion's authorization page once; **Open authorization page** opens it again, and **Cancel** ends the attempt |
+| Connected | **Sign out** asks for confirmation, then deletes the local grant |
+| Cannot connect right now | **Retry** restarts the server and keeps the existing grant |
+
+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.
### Turn off and uninstall
@@ -62,7 +73,9 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-no
Implementation internals — click to expand
-[`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 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. One `NotionConnection` per browser plugin mirrors the manager's `watch` stream and derives the page state from the `notion` entry alone; it keeps only whether the stream is delivering, whether a page action is pending, and the latest notice. It registers `plugins.bundle.config` keyed by the package name for the section, `plugins.bundle.activation` for the guidance, `plugins.detail.badge` for the tag, and a `shell.overlay` toast. It opens an authorization URL only for the attempt this browser started, and only when the URL uses HTTPS or loopback HTTP.
@@ -76,13 +89,14 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-no
- [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.
+- [Plugins page](../../client/ui-plugin-manager/README.md#use-this-package) — the bundle page slots the browser half registers into.
-----
## Model Experience
-### Naming guidance
+### Naming and connection guidance
#### What the model sees
@@ -91,12 +105,12 @@ While the plugin is loaded, the system prompt contains the text below after the
##### Guidance text
```markdown
-Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP.
+Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP. If no `mcp__notion__*` tool appears in your tool list, Notion is not connected yet; ask the user to connect it on the Notion plugin page in Plugins.
```
#### Token effect
-The fixed sentence adds a few dozen tokens to every request while the plugin is loaded.
+The two fixed sentences add about 70 tokens to every request while the plugin is loaded.
#### KV Cache effect
@@ -120,7 +134,7 @@ Notion's instructions (or, with `eager`, its tools) appear when the connection s
-- There is no sign-in page. Until a Remote client presents the manager's authorization URL, a user cannot authorize Notion from the product.
+- The Notion account section exists only while the plugin is on. To sign out after turning the plugin off, turn it on again or delete the grant record.
- Only the Web and Desktop compositions mount the MCP manager; other profiles leave the plugin inactive.
- The authorization callback is `http://127.0.0.1:` on the Host, so the browser that completes authorization must run on the Host machine. A Web Host reached from another machine cannot finish authorization.
- Desktop listens on an OS-assigned port for each launch. Authorizing again after a restart registers a new OAuth client and keeps the earlier registration record; saved grants refresh normally across restarts.
@@ -133,6 +147,6 @@ Notion's instructions (or, with `eager`, its tools) appear when the connection s
Working context for maintainers — click to expand
-Specs run the plugin against the MCP manager and the mcp-client loopback OAuth server fixture. 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; client specs drive the browser half with a fake manager stream. 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 b2d3a4ad35..5578ddbb69 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)。用户授权一个 Notion 账号后,该 Host 上的所有对话都能使用这个服务器的工具,模型也会被告知把这项集成称为 Notion 插件。连接、OAuth 授权、已保存的 grant 和退出登录都由管理器负责,本包不另设账号接口。插件运行在 Web 与 Desktop 组合中。
+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 组合中。
## 目录
@@ -39,7 +39,18 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS
插件以固定的 OAuth 凭据 key `mcp-client/notion` 注册服务器 `notion`。没有已保存的 grant 时,服务器等待授权,不提供 Notion 工具。有已保存的 grant 时,管理器在启动时连接,并按需刷新 token。Notion 的工具默认[按需加载](../../mcp/mcp-client/README.zh.md#on-demand-tool-loading):系统提示词列出这些工具,每个 agent 用 `mcp__notion__load_tools` 加载需要的工具。
-授权通过 Remote 使用管理器的 [OAuth 操作](../../mcp/mcp-manager/README.zh.md#oauth-authorization);目前还没有登录页面。Remote 客户端调用 `ctx.remote.mcpServers.startAuthorization('notion')`,在 Host 所在机器的浏览器中打开返回的 `authorizationUrl`,用户在 Notion 中同意授权。`list()` 与 `watch` 报告进度,`cancelAuthorization('notion', id)` 取消一次授权尝试。`signOut('notion')` 删除本地 grant 并保留客户端注册;它不会在 Notion 一侧撤销连接。
+插件开启期间,它在**插件**页面的详情页显示 **Notion 账号**区块,标题旁的标签显示未连接、连接中、已连接、需要重新连接或暂时无法连接。在列表中开启插件而尚未连接账号时,页面提示**连接 Notion**,点击后打开插件详情页并发起授权。
+
+| 区块状态 | 操作 |
+|---|---|
+| 未连接,或授权已过期、与当前设置不再匹配、被拒绝、缺少权限 | **连接 Notion** 或**重新连接**发起一次授权尝试 |
+| 等待你在浏览器中确认 | 发起尝试的浏览器打开一次 Notion 授权页面;**打开授权页面**再次打开,**取消**结束这次尝试 |
+| 已连接 | **退出登录**确认后删除本地 grant |
+| 暂时无法连接 | **重试**重启服务器并保留现有授权 |
+
+授权必须在 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 客户端可以使用同样的操作。
### 停用与卸载
@@ -62,7 +73,9 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS
实现内部机制——点击展开
-[`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,插件会在添加指引之前加载失败。
+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` 行上,因此其注册只在该行开启时存在。每个浏览器插件有一个 `NotionConnection`,镜像管理器的 `watch` 流,只根据 `notion` 条目推导页面状态;它只保存流是否在送达、页面操作是否进行中以及最近一条提示。它注册以包名为 key 的 `plugins.bundle.config` 作为区块、`plugins.bundle.activation` 作为引导、`plugins.detail.badge` 作为标签,以及一个 `shell.overlay` toast。它只为本浏览器发起的尝试打开授权链接,且只打开使用 HTTPS 或回环 HTTP 的链接。
@@ -76,13 +89,14 @@ 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)——安装与启用。
+- [插件页面](../../client/ui-plugin-manager/README.zh.md#use-this-package)——浏览器侧注册所用的 bundle 详情页 slot。
-----
## 模型体验
-### 称呼指引
+### 称呼与连接指引
#### 模型看到什么
@@ -91,12 +105,12 @@ bundle patch 在 profile 其他层之后插入 `notion` 行。插件需要 `mcpS
##### 指引文本
```markdown
-Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP.
+Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP. If no `mcp__notion__*` tool appears in your tool list, Notion is not connected yet; ask the user to connect it on the Notion plugin page in Plugins.
```
#### Token 影响
-插件加载期间,这句固定文字为每次请求增加几十个 token。
+插件加载期间,这两句固定文字为每次请求增加约 70 个 token。
#### KV Cache 影响
@@ -120,7 +134,7 @@ Notion 的服务器说明(设为 `eager` 时则是其工具)在连接成功
-- 没有登录页面。在 Remote 客户端展示管理器的授权链接之前,用户无法在产品中授权 Notion。
+- Notion 账号区块只在插件开启时存在。关闭插件后如需退出登录,请先重新开启插件,或删除 grant 记录。
- 只有 Web 与 Desktop 组合挂载 MCP 管理器;在其他 profile 中插件保持未激活。
- 授权回调地址是 Host 上的 `http://127.0.0.1:`,因此完成授权的浏览器必须运行在 Host 所在机器上。从另一台机器访问的 Web Host 无法完成授权。
- Desktop 每次启动都监听操作系统分配的端口。重启后再次授权会注册一个新的 OAuth 客户端,并保留之前的注册记录;已保存的 grant 在重启前后正常刷新。
@@ -133,6 +147,6 @@ Notion 的服务器说明(设为 `eager` 时则是其工具)在连接成功
维护者工作上下文——点击展开
-单测让插件运行在 MCP 管理器和 mcp-client 的回环 OAuth 服务器夹具之上。`notion-plugin` 会话快照在没有已保存 grant 的情况下回放 Notion 行,因此它固定称呼指引,并验证没有请求到达服务器。
+Host 侧单测让插件运行在 MCP 管理器和 mcp-client 的回环 OAuth 服务器夹具之上;客户端单测用模拟的管理器流驱动浏览器侧。`notion-plugin` 会话快照在没有已保存 grant 的情况下回放 Notion 行,因此它固定称呼指引,并验证没有请求到达服务器。
diff --git a/packages/connector/notion/package.json b/packages/connector/notion/package.json
index d58e423d43..1378801a7f 100644
--- a/packages/connector/notion/package.json
+++ b/packages/connector/notion/package.json
@@ -18,6 +18,10 @@
"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",
@@ -26,6 +30,7 @@
"files": [
"locale/*.json",
"lib/index.js",
+ "lib/client.js",
"cordis.patch.yml",
"lib/types/**/*.d.ts"
],
@@ -33,8 +38,21 @@
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
+ },
+ "client": {
+ "inject": [
+ "@deepseek-ai/dsh-api-remotes",
+ "@deepseek-ai/dsh-client-locale",
+ "@deepseek-ai/dsh-client-ui-layout",
+ "@deepseek-ai/dsh-client-ui-plugin-manager"
+ ],
+ "platform": "web"
}
},
+ "scripts": {
+ "bundle": "tsdown",
+ "watch": "tsdown --watch"
+ },
"dependencies": {
"@deepseek-ai/schemastery": "workspace:~"
},
@@ -51,6 +69,23 @@
"@deepseek-ai/dsh-mcp-manager": "workspace:*",
"@deepseek-ai/dsh-mcp-resources": "workspace:*",
"@deepseek-ai/dsh-scope": "workspace:*",
- "@deepseek-ai/dsh-system-prompt": "workspace:*"
+ "@deepseek-ai/dsh-system-prompt": "workspace:*",
+ "@deepseek-ai/dsh-api-gateway": "workspace:*",
+ "@deepseek-ai/dsh-api-remotes": "workspace:*",
+ "@deepseek-ai/dsh-client-locale": "workspace:*",
+ "@deepseek-ai/dsh-client-store": "workspace:*",
+ "@deepseek-ai/dsh-client-test-runtime": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-layout": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-primitives": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-slots": "workspace:*",
+ "@deepseek-ai/dsh-mcp-client": "workspace:*",
+ "@deepseek-ai/dsh-typert-protocol": "workspace:*",
+ "@deepseek-ai/dsh-util-values": "workspace:*",
+ "@testing-library/react": "^16.3.3",
+ "@types/react": "~18.3.1",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
}
}
diff --git a/packages/connector/notion/src/client/NotionConnection.module.css b/packages/connector/notion/src/client/NotionConnection.module.css
new file mode 100644
index 0000000000..c15f495d50
--- /dev/null
+++ b/packages/connector/notion/src/client/NotionConnection.module.css
@@ -0,0 +1,51 @@
+.section {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.title {
+ margin: 0 0 4px;
+ font-size: 14px;
+ line-height: 20px;
+ font-weight: 500;
+}
+
+.status {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 28px;
+}
+
+.label {
+ font-size: 13px;
+ line-height: 20px;
+ color: var(--dsw-alias-label-primary);
+}
+
+.actions {
+ display: flex;
+ gap: 8px;
+ margin-left: auto;
+}
+
+.detail,
+.hint,
+.failure {
+ margin: 0;
+ font-size: 13px;
+ line-height: 20px;
+}
+
+.detail {
+ color: var(--dsw-alias-label-secondary);
+}
+
+.hint {
+ color: var(--dsw-alias-label-tertiary);
+}
+
+.failure {
+ color: var(--dsw-alias-state-error-primary);
+}
diff --git a/packages/connector/notion/src/client/NotionConnection.tsx b/packages/connector/notion/src/client/NotionConnection.tsx
new file mode 100644
index 0000000000..8635b69448
--- /dev/null
+++ b/packages/connector/notion/src/client/NotionConnection.tsx
@@ -0,0 +1,127 @@
+/** Notion connection surfaces on the Plugins page: the bundle section, title tag, activation guidance, and notices. */
+import { useEffect, useState, type ReactNode } from 'react'
+import { Button, IconWarningOutlineRegular, Modal, StateDot, Tag, Toast, type StateDotState, type TagTone } from '@deepseek-ai/dsh-client-ui-primitives'
+import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
+import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
+import { NOTION_PACKAGE, presentConnection, type ConnectionFace, type ConnectionPresentation } from './connection.ts'
+import type { NotionKey, NS } from './locales.ts'
+import css from './NotionConnection.module.css'
+
+type Phase = ConnectionPresentation['phase']
+type FaceProps = InjectFace & PropsLocale
+
+const TONE: Record = {
+ 'checking': 'ongoing', 'connecting': 'ongoing', 'authorizing': 'ongoing', 'waiting-browser': 'ongoing',
+ 'connected': 'done', 'disconnected': 'idle', 'reconnect': 'warning', 'unavailable': 'error',
+}
+
+const BADGE: Record = {
+ 'checking': undefined,
+ 'connecting': ['badge.connecting', 'info'], 'authorizing': ['badge.connecting', 'info'], 'waiting-browser': ['badge.connecting', 'info'],
+ 'connected': ['badge.connected', 'success'], 'disconnected': ['badge.disconnected', 'outline'],
+ 'reconnect': ['badge.reconnect', 'warning'], 'unavailable': ['badge.unavailable', 'danger'],
+}
+
+function detail(shown: ConnectionPresentation): NotionKey | undefined {
+ switch (shown.phase) {
+ case 'checking': return undefined
+ case 'reconnect': return `detail.reconnect.${shown.reason}`
+ default: return `detail.${shown.phase}`
+ }
+}
+
+/**
+ * The connection section on the Notion bundle's page.
+ * @param props - the shared connection face and the Notion dictionary.
+ * @returns the status line, its actions, and the sign-out confirmation.
+ */
+export function NotionConnectionSection(props: FaceProps): ReactNode {
+ const { useNotionConnection, connect, cancel, signOut, retry, openAuthorization, t } = props
+ const snapshot = useNotionConnection(value => value)
+ const [confirming, setConfirming] = useState(false)
+ const shown = presentConnection(snapshot.server)
+ const disabled = snapshot.busy || !snapshot.linked
+ const key = detail(shown)
+ const action = (label: NotionKey, onClick: () => void, variant: 'primary' | 'outline' | 'ghost' = 'outline'): ReactNode =>
+
+ const actions: ReactNode[] = []
+ switch (shown.phase) {
+ case 'disconnected': actions.push(action('action.connect', connect, 'primary')); break
+ case 'reconnect': actions.push(action('action.reconnect', connect, 'primary')); break
+ case 'waiting-browser': actions.push(action('action.open', openAuthorization, 'primary'), action('action.cancel', cancel, 'ghost')); break
+ case 'authorizing': actions.push(action('action.cancel', cancel, 'ghost')); break
+ case 'connected': actions.push(action('action.signOut', () => { setConfirming(true) })); break
+ case 'unavailable': actions.push(action('action.retry', retry)); break
+ case 'checking':
+ case 'connecting': break
+ }
+ return (
+