DSH / Atlas
2026-11-06implementedarchitecture

One Host registry and one browser half for connector accounts

连接器账号使用一个 Host 注册表和一个浏览器一半

Connector plugins show an account section on the Plugins page. CLI app plugins keep the account in their vendor CLI; MCP connectors keep an OAuth grant through the MCP manager. Both kinds need the same surfaces: a bundle's section, title tag, and activation prompt, a confirmation before an action that changes the account outside DSH, and a notice in the browser that started the operation. A client plugin cannot share

Source compatibility: Chinese title uses a compatible non-canonical header

English

Problem

Connector plugins show an account section on the Plugins page. CLI app plugins keep the account in their vendor CLI; MCP connectors keep an OAuth grant through the MCP manager. Both kinds need the same surfaces: a bundle's section, title tag, and activation prompt, a confirmation before an action that changes the account outside DSH, and a notice in the browser that started the operation. A client plugin cannot share runtime code with another feature plugin (packages/client/AGENTS.md rule 3), so one browser half per connector kind duplicates the same code and lets the copies drift. When the browser decides an account's state or relays an identifier from one Remote to another, the Host can no longer run the flow without the browser.

Decision

@deepseek-ai/dsh-client-ui-connector-account provides one Host registry, ctx.connectorAccounts, one connectorAccounts Remote, and one browser half for every connector kind.

PartContract
Registrationregister({ key, packageName?, source, operations, copy, present }) returns the disposer that withdraws the account
KeyUnique among registered accounts and independent of the package, so an account that no bundle owns, such as the account of an MCP server row, registers too
PackageDecides which bundle page carries the section and tag; a package carries at most one account
SourceThe registrant's account: snapshot, observe, refresh, start, and cancel
Displaypresent(view) on the Host gives the phase, status text, title tag, buttons and their commands, confirmations, failure, and the operation the activation prompt starts
Remotewatch, plus start(key, operation) and cancel(key, id), which route by key to the account's source

The Host decides everything except opening the authorization page. The browser never learns how an account connects: it receives only the display, the operation in progress with its authorization page, and the latest result with its success text. The browser half keeps only what belongs to one browser: the operations it started, so their authorization pages open and their success is reported only there; the latest notice; and whether its stream is delivering. Buttons call start and cancel on the Remote themselves, and each surface keeps its own pending state.

The page registers one title tag entry and one notice entry. It also registers a section and an activation prompt for each account that names a package, because those two slots are keyed by package.

Alternatives considered

Two registries behind one browser half. Rejected: the browser would follow both Remotes and choose which one each button calls, which relays between Host services again, and the two Host registries would hold the same code.

One browser half per connector kind. Rejected: client plugins cannot import each other's values, so the shared surfaces would be written twice and diverge.

Share the browser half through PLATFORM_MODULES or a browser-side service. Rejected: new shared runtime code does not enter the module table's baseline, and a browser-side service would keep the registrations in the browser, which only repeat what the Host knows.

Let the browser derive an account's phase and actions from the registrant's raw state. Rejected: the rules for which actions apply would live where the Host cannot test or run them, and the browser would need the registrant's own Remote.

Consequences

The registry and browser half exist once. A new connector kind writes a source and present on the Host and needs no browser code. The account rules live beside the services that own them, and the Host can run every operation without a browser.

Registrants map their account states onto five phases (checking, connecting, connected, disconnected, unavailable); a state outside them shows through its status text and detail. The Web and Desktop compositions load the registry whether or not a connector plugin is installed. An authorization page that opens after the start call answers can be blocked by the browser; the section's open button shows it again.

中文

问题

连接器插件会在插件页显示账号区块。CLI 应用插件的账号保存在厂商 CLI 中;MCP 连接器通过 MCP 管理器保存 OAuth 授权。两类插件需要同样的界面:插件包的区块、标题旁标签和开启引导,在会改变 DSH 之外账号状态的操作前确认,以及只在发起操作的浏览器中显示的提示。客户端插件不能与其他功能插件共享运行时代码(packages/client/AGENTS.md 第 3 条),因此每类连接器各有一个浏览器一半,就会把同样的代码写两遍,副本还会逐渐不一致。如果由浏览器决定账号状态,或在两个 Remote 之间转发标识,Host 就无法在没有浏览器的情况下完成流程。

决定

@deepseek-ai/dsh-client-ui-connector-account 为所有连接器类型提供一个 Host 注册表 ctx.connectorAccounts、一个 connectorAccounts Remote 和一个浏览器一半。

部分约定
注册register({ key, packageName?, source, operations, copy, present }) 返回撤下账号的销毁函数
键在已注册账号中唯一,且与包无关,因此没有插件包承载的账号(如 MCP 服务器行的账号)也能注册
包决定由哪个插件包页面承载区块和标签;一个包最多承载一个账号
来源注册方的账号:snapshot、observe、refresh、start 和 cancel
展示Host 上的 present(view) 给出阶段、状态文字、标题旁标签、按钮及其命令、确认、失败信息,以及开启引导启动的操作
Remotewatch,以及按键路由到账号来源的 start(key, operation) 和 cancel(key, id)

除了打开授权页,其余都由 Host 决定。浏览器不知道账号如何连接:它只收到展示内容、进行中的操作及其授权页,以及带成功文本的最新结果。浏览器一半只保存属于本浏览器的东西:它发起的操作(授权页只在这里打开,成功只在这里报告)、最新提示,以及它的流是否在推送。按钮自己调用 Remote 的 start 和 cancel,每个界面自己保存未完成状态。

页面只注册一个标题旁标签条目和一个提示条目;对每个带包名的账号,再注册一个区块和一个开启引导,因为这两个插槽以包为键。

考虑过的替代方案

一个浏览器一半背后有两个注册表。 否决:浏览器要同时跟随两个 Remote,并为每个按钮选择调用哪一个,这又是在 Host 服务之间转发;两个 Host 注册表的代码也会相同。

每类连接器各有一个浏览器一半。 否决:客户端插件不能导入彼此的值,共用界面就要写两遍,并逐渐不一致。

通过 PLATFORM_MODULES 或浏览器端服务共享浏览器一半。 否决:新的共享运行时代码不进入模块表的基座;浏览器端服务会把注册留在浏览器中,而这些注册只是重复 Host 已知的信息。

由浏览器根据注册方的原始状态推算账号阶段和操作。 否决:哪些操作可用的规则会放在 Host 无法测试和执行的地方,浏览器还需要注册方自己的 Remote。

后果

注册表和浏览器一半只有一份。新的连接器类型只需在 Host 上编写来源和 present,不需要浏览器代码。账号规则与拥有它们的服务在一起,Host 不依赖浏览器就能执行每个操作。

注册方需要把账号状态映射到五个阶段(检查中、连接中、已连接、未连接、不可用);超出这些阶段的状态通过状态文字和说明表达。无论是否安装了连接器插件,Web 与桌面端组合都会加载注册表。启动调用返回后才打开的授权页可能被浏览器拦截;区块中的打开按钮可以再次打开它。