Merge remote-tracking branch 'origin/master' into refactor/llm-route-credential

# Conflicts:
#	docs/capability-seams.i18n.yaml
#	docs/config-catalog.md
#	docs/config-catalog.zh.md
#	docs/event-producer-consumer.md
#	docs/event-producer-consumer.zh.md
#	packages/web/web-deepseek-api/src/index.ts
This commit is contained in:
LegGasai committed 2026-11-16 21:23:43 +08:00
commit d36dbee3d6
277 files changed
+7010 -518

No files matched your search

@@ -0,0 +1,19 @@
# Bilingual-pair consistency record for 2026-11-06-connector-account-registry.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-11-06-connector-account-registry.md
/agent-note-one-host-registry-and-one-browser-half-for-connector-accounts:
en: 3950421fb526f6b7
zh: 47c5f6cc4b735058
/agent-note-one-host-registry-and-one-browser-half-for-connector-accounts/problem:
en: 2a7b59cd509a0b9a
zh: 38130ce17829342d
/agent-note-one-host-registry-and-one-browser-half-for-connector-accounts/decision:
en: d96b43106a1ba837
zh: 97bc8f9436ec07d0
/agent-note-one-host-registry-and-one-browser-half-for-connector-accounts/alternatives-considered:
en: ee0aa3f9ea40ef15
zh: fded69a6dcc8ca87
/agent-note-one-host-registry-and-one-browser-half-for-connector-accounts/consequences:
en: 5228f32becfbdec3
zh: 013f1073e70d46f7
@@ -0,0 +1,42 @@
# Agent Note: One Host registry and one browser half for connector accounts
Status: implemented
English | [中文](2026-11-06-connector-account-registry.zh.md)
## 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](../../../../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`](../../../../packages/client/ui-connector-account/README.md) provides one Host registry, `ctx.connectorAccounts`, one `connectorAccounts` Remote, and one browser half for every connector kind.
| Part | Contract |
|---|---|
| Registration | `register({ key, packageName?, source, operations, copy, present })` returns the disposer that withdraws the account |
| Key | Unique among registered accounts and independent of the package, so an account that no bundle owns, such as a server configured in Settings, registers too |
| Package | Decides which bundle page carries the section and tag; a package carries at most one account |
| Source | The registrant's account: `snapshot`, `observe`, `refresh`, `start`, and `cancel` |
| Display | `present(view)` on the Host gives the phase, status text, title tag, buttons and their commands, confirmations, failure, and the operation the activation prompt starts |
| Remote | `watch`, 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: the module table is reserved for shell-seeded and static infrastructure libraries, 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.
@@ -0,0 +1,42 @@
# Agent Note:连接器账号使用一个 Host 注册表和一个浏览器一半
Status: implemented
[English](2026-11-06-connector-account-registry.md) | 中文
## 问题
连接器插件会在插件页显示账号区块。CLI 应用插件的账号保存在厂商 CLI 中;MCP 连接器通过 MCP 管理器保存 OAuth 授权。两类插件需要同样的界面:插件包的区块、标题旁标签和开启引导,在会改变 DSH 之外账号状态的操作前确认,以及只在发起操作的浏览器中显示的提示。客户端插件不能与其他功能插件共享运行时代码([packages/client/AGENTS.md](../../../../packages/client/AGENTS.md) 第 3 条),因此每类连接器各有一个浏览器一半,就会把同样的代码写两遍,副本还会逐渐不一致。如果由浏览器决定账号状态,或在两个 Remote 之间转发标识,Host 就无法在没有浏览器的情况下完成流程。
## 决定
[`@deepseek-ai/dsh-client-ui-connector-account`](../../../../packages/client/ui-connector-account/README.zh.md) 为所有连接器类型提供一个 Host 注册表 `ctx.connectorAccounts`、一个 `connectorAccounts` Remote 和一个浏览器一半。
| 部分 | 约定 |
|---|---|
| 注册 | `register({ key, packageName?, source, operations, copy, present })` 返回撤下账号的销毁函数 |
| 键 | 在已注册账号中唯一,且与包无关,因此没有插件包承载的账号(如在 Settings 中配置的服务器)也能注册 |
| 包 | 决定由哪个插件包页面承载区块和标签;一个包最多承载一个账号 |
| 来源 | 注册方的账号:`snapshot`、`observe`、`refresh`、`start` 和 `cancel` |
| 展示 | Host 上的 `present(view)` 给出阶段、状态文字、标题旁标签、按钮及其命令、确认、失败信息,以及开启引导启动的操作 |
| Remote | `watch`,以及按键路由到账号来源的 `start(key, operation)` 和 `cancel(key, id)` |
除了打开授权页,其余都由 Host 决定。浏览器不知道账号如何连接:它只收到展示内容、进行中的操作及其授权页,以及带成功文本的最新结果。浏览器一半只保存属于本浏览器的东西:它发起的操作(授权页只在这里打开,成功只在这里报告)、最新提示,以及它的流是否在推送。按钮自己调用 Remote 的 `start` 和 `cancel`,每个界面自己保存未完成状态。
页面只注册一个标题旁标签条目和一个提示条目;对每个带包名的账号,再注册一个区块和一个开启引导,因为这两个插槽以包为键。
## 考虑过的替代方案
**一个浏览器一半背后有两个注册表。** 否决:浏览器要同时跟随两个 Remote,并为每个按钮选择调用哪一个,这又是在 Host 服务之间转发;两个 Host 注册表的代码也会相同。
**每类连接器各有一个浏览器一半。** 否决:客户端插件不能导入彼此的值,共用界面就要写两遍,并逐渐不一致。
**通过 `PLATFORM_MODULES` 或浏览器端服务共享浏览器一半。** 否决:模块表只留给由 shell 预置的基础设施和静态库;浏览器端服务会把注册留在浏览器中,而这些注册只是重复 Host 已知的信息。
**由浏览器根据注册方的原始状态推算账号阶段和操作。** 否决:哪些操作可用的规则会放在 Host 无法测试和执行的地方,浏览器还需要注册方自己的 Remote。
## 后果
注册表和浏览器一半只有一份。新的连接器类型只需在 Host 上编写来源和 `present`,不需要浏览器代码。账号规则与拥有它们的服务在一起,Host 不依赖浏览器就能执行每个操作。
注册方需要把账号状态映射到五个阶段(检查中、连接中、已连接、未连接、不可用);超出这些阶段的状态通过状态文字和说明表达。无论是否安装了连接器插件,Web 与桌面端组合都会加载注册表。启动调用返回后才打开的授权页可能被浏览器拦截;区块中的打开按钮可以再次打开它。
@@ -0,0 +1,19 @@
# Bilingual-pair consistency record for 2026-11-13-draft-attachments-across-session-switches.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-11-13-draft-attachments-across-session-switches.md
/agent-note-draft-attachments-across-session-switches:
en: 2a1645c8c80d6dff
zh: 59277c3754231479
/agent-note-draft-attachments-across-session-switches/problem:
en: 3f4030763e1f0105
zh: c8a0bc5641d7bed4
/agent-note-draft-attachments-across-session-switches/decision:
en: 40697e88c2ed6ca8
zh: eeb363374b25c3a2
/agent-note-draft-attachments-across-session-switches/alternatives-considered:
en: 2c43ad479f4a3577
zh: 07743f45870eb0fe
/agent-note-draft-attachments-across-session-switches/consequences:
en: 6ac6defa552ea040
zh: aa64a3c3e54dbebc
@@ -0,0 +1,25 @@
# Agent Note: Draft attachments across Session switches
Status: implemented
English | [中文](2026-11-13-draft-attachments-across-session-switches.zh.md)
## Problem
Switching to another Session and back emptied the composer's attachment rail while its text survived (issue #5070). The Session scope disposer released every attachment the retiring composer held and revoked image previews, and nothing could rebuild them.
## Decision
**The Conversation service keeps every draft attachment across a switch.** `ConversationController` records which Session owns each draft attachment. A message the Host accepts leaves that ownership at once, while the registry keeps its attachments until the echo settles them. A retiring composer releases its attachments only when its Session was removed or a message or command was already submitted, because the Client cannot tell whether a submitted command consumed them; an aborted slash-line adjudication keeps them. Otherwise they stay registered, an active upload keeps running, a failed upload keeps its in-place retry, and the Session's next composer re-adopts them in rail order. A Session removed while no composer is mounted releases its attachments through the hub's catalog watch. Picked and dropped files hold only a browser file handle; a pasted image keeps its bytes in memory until it is sent or removed or its Session is removed.
**A reload reports discarded attachments instead of restoring them.** On `pagehide`, the input hub marks each Session that still owns draft attachments in browser storage; a back-forward cache restore clears the marks. A composer mounted with a mark and no registered attachments shows the "add them again" notice.
## Alternatives considered
**Restoring attachments after a reload from durable browser references and a Host `restore` Remote.** It would bring uploaded files and images back after a page reload, but it needs a Host Remote with its Liveshare and catalog classifications, a persisted browser format, a send gate during restoration, and an image byte payload. Desktop, where most users work, gains little: its Host binds a new port on every launch, so its storage origin, and with it every saved reference, does not survive an application restart.
**Releasing settled attachments on a switch and restoring them from the Host on return.** It would save the memory of pasted images while a Session is not shown, but every return needs a Host round trip, fails on a weak network, and allocates the same bytes again.
## Consequences
Switching never touches the Host, so a weak network cannot lose a draft attachment there. A reload or crash still discards attachments; a crash writes no mark and so shows no notice.
@@ -0,0 +1,25 @@
# Agent Note:草稿附件跨会话切换
Status: implemented
[English](2026-11-13-draft-attachments-across-session-switches.md) | 中文
## 问题
切到另一个会话再切回时,输入框的附件栏被清空,文字却还在(issue #5070)。会话 scope 销毁时会释放退役输入框持有的全部附件并回收图片预览,之后没有任何途径能重建它们。
## 决策
**Conversation 服务在切换期间保留全部草稿附件。** `ConversationController` 记录每个草稿附件属于哪个会话。Host 接受消息时,这些附件立即退出会话归属,注册表则保留它们直到回显结算。退役的输入框只在其会话已被删除、或消息与命令已经提交时释放附件,因为客户端无法判断已提交的命令是否用掉了附件;被中止的斜杠行裁决会保留附件。其他情况下附件继续登记,进行中的上传继续进行,失败的上传保留原位重试,会话下一次挂载的输入框按附件栏顺序接回它们。没有挂载输入框时被删除的会话,由 hub 的会话目录监听释放其附件。选择或拖入的文件只占一个浏览器文件句柄;粘贴的图片会把字节保留在内存中,直到发送、移除或其会话被删除。
**刷新时提示被丢弃的附件,而不恢复它们。** `pagehide` 时,输入 hub 在浏览器存储中为每个仍持有草稿附件的会话写一个标记;往返缓存恢复页面时清除这些标记。挂载时有标记且没有已登记附件的输入框,会显示「请重新添加」提示。
## 考虑过的替代方案
**刷新后通过浏览器 durable 引用与 Host `restore` Remote 恢复附件。** 它能在页面刷新后找回已上传的文件和图片,但需要新增一个 Host Remote 及其 Liveshare 与目录分类、一种浏览器持久化格式、恢复期间的发送拦截和图片字节载荷。主要用户所在的桌面端收益很小:桌面端 Host 每次启动都绑定新端口,存储 origin 连同所有已存引用都无法跨应用重启保留。
**切换时释放已结算附件,切回时由 Host 恢复。** 它能在会话不显示期间省下粘贴图片的内存,但每次切回都需要一次 Host 往返,弱网下会失败,并且之后还要再分配同样的字节。
## 影响
切换会话从不访问 Host,因此弱网不会让草稿附件在切换中丢失。刷新或崩溃仍会丢弃附件;崩溃时不会写标记,因此没有提示。
+47 -29
View File
@@ -1,29 +1,36 @@
/**
* Daily stale pull-request reminders for the `Stale pull requests` workflow.
* Daily stale pull-request reminders and closing for the `Stale pull requests` workflow.
*
* A pull request's last activity is the latest of its creation, a commit, a force push, a reopen or ready-for-review
* event, and a comment or review from a non-bot account. Other timeline events, such as mentions, labels and cross
* references, do not count, so reminder comments never extend it. After 7 and 14 days without activity the workflow
* comments once per stage and mentions the author. Activity starts a new cycle. Pull requests labelled `DO_NOT_CLOSE`
* and pull requests opened by bots receive no reminders. The workflow never closes pull requests.
* references, do not count, so reminder and closing comments never extend it. After 7 and 14 days without activity the
* workflow comments once per stage and mentions the author. After 21 days without activity, and at least 7 days after
* the 14-day reminder, it comments and closes the pull request; the reminder therefore always gives the author 7 days'
* notice, including for pull requests that were already inactive when the workflow started. Activity, including
* reopening, starts a new cycle. Pull requests labelled `DO_NOT_CLOSE` and pull requests opened by bots are neither
* reminded nor closed.
*
* Each run reads the timeline of every open pull request that is neither exempt nor bot-authored, because `updated_at`
* also changes on events that are not activity. Each run posts at most `MAX_COMMENTS_PER_RUN` reminders, least recently
* also changes on events that are not activity. Each run posts at most `MAX_COMMENTS_PER_RUN` comments, least recently
* updated pull requests first, so a backlog spreads over several days within GitHub's content-creation limits. A failed
* pull request is reported and skipped.
*/
/** Label that exempts a pull request from reminders. */
/** Label that exempts a pull request from reminders and closing. */
export const EXEMPT_LABEL = 'DO_NOT_CLOSE'
/** Days without activity after which each reminder is posted, in ascending order. */
export const REMINDER_DAYS = [7, 14]
/** Days without activity after which a pull request is closed. */
export const CLOSE_DAYS = 21
const DAY_MS = 24 * 60 * 60 * 1000
// GitHub asks integrations to wait at least one second between content-creating requests.
const COMMENT_INTERVAL_MS = 1000
const MAX_COMMENTS_PER_RUN = 100
const MARKER = /<!-- stale-pr-reminder:(\d+) -->/
// Reminders posted before closing existed use `stale-pr-reminder` and announce no closing, so they are ignored.
const MARKER = /<!-- stale-pr:(\d+) -->/
// Review bots that use ordinary user accounts.
const BOT_LOGINS = new Set(['ds-review-bot'])
@@ -55,39 +62,46 @@ function activityTimes(event) {
}
/**
* Selects the reminder a pull request is due for.
* Selects the reminder or closing a pull request is due for.
* @param {object} options
* @param {string} options.createdAt Pull-request creation time.
* @param {object[]} options.timeline Complete issue timeline of the pull request.
* @param {Date} options.now Evaluation time.
* @returns {number | undefined} Due reminder stage in days, or `undefined` when none is due.
* @returns {{ days: number, comment: boolean } | undefined} Due stage in days, `CLOSE_DAYS` for closing, and whether its
* comment is still unposted; `undefined` when nothing is due. A closing whose comment was posted but whose close failed
* is due again without a comment.
*/
export function dueReminder({ createdAt, timeline, now }) {
export function dueStage({ createdAt, timeline, now }) {
const times = [createdAt, ...timeline.flatMap(activityTimes)].map(time => Date.parse(time)).filter(Number.isFinite)
const lastActivity = Math.max(...times)
const due = REMINDER_DAYS.filter(days => now.getTime() - lastActivity >= days * DAY_MS).at(-1)
if (due === undefined) return undefined
const sent = timeline
.filter(event => event.event === 'commented' && isBot(event.actor) && Date.parse(event.created_at) > lastActivity)
.map(event => Number(MARKER.exec(event.body ?? '')?.[1]))
return sent.some(days => days >= due) ? undefined : due
.map(event => ({ days: Number(MARKER.exec(event.body ?? '')?.[1]), at: Date.parse(event.created_at) }))
const finalReminder = REMINDER_DAYS.at(-1)
const noticeMs = (CLOSE_DAYS - finalReminder) * DAY_MS
if (now.getTime() - lastActivity >= CLOSE_DAYS * DAY_MS && sent.some(({ days, at }) => days === finalReminder && now.getTime() - at >= noticeMs)) {
return { days: CLOSE_DAYS, comment: !sent.some(({ days }) => days === CLOSE_DAYS) }
}
const due = REMINDER_DAYS.filter(days => now.getTime() - lastActivity >= days * DAY_MS).at(-1)
if (due === undefined || sent.some(({ days }) => days >= due)) return undefined
return { days: due, comment: true }
}
/**
* Builds the reminder comment.
* Builds the reminder or closing comment.
* @param {string} author Pull-request author login.
* @param {number} days Reminder stage in days.
* @param {number} days Stage in days; `CLOSE_DAYS` builds the closing comment.
* @returns {string} Comment body.
*/
export function reminderBody(author, days) {
return [
`<!-- stale-pr-reminder:${days} -->`,
`@${author} This pull request has had no activity for ${days} days. Please update it, reply to keep it open, or close it if it is no longer needed. Add the \`${EXEMPT_LABEL}\` label, or ask a maintainer to add it, to stop these reminders.`,
].join('\n')
export function stageBody(author, days) {
const text = days === CLOSE_DAYS
? `@${author} This pull request has had no activity for ${days} days and is now closed. Reopen it, or ask a maintainer to reopen it, if you continue the work.`
: `@${author} This pull request has had no activity for ${days} days. Please update it, reply to keep it open, or close it if it is no longer needed. Pull requests are closed after ${CLOSE_DAYS} days without activity and at least ${CLOSE_DAYS - REMINDER_DAYS.at(-1)} days after the ${REMINDER_DAYS.at(-1)}-day reminder. Add the \`${EXEMPT_LABEL}\` label, or ask a maintainer to add it, to stop reminders and closing.`
return `<!-- stale-pr:${days} -->\n${text}`
}
/**
* Posts every due reminder on open pull requests of the workflow repository.
* Posts every due reminder and closes every due pull request among the open pull requests of the workflow repository.
* @param {object} options
* @param {object} options.github Authenticated Octokit client from `actions/github-script`.
* @param {object} options.context Workflow context from `actions/github-script`.
@@ -96,7 +110,7 @@ export function reminderBody(author, days) {
* @param {(ms: number) => Promise<void>} [options.sleep] Delay between comments.
* @returns {Promise<void>}
*/
export async function remindStalePullRequests({ github, context, core, now = new Date(), sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) }) {
export async function processStalePullRequests({ github, context, core, now = new Date(), sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) }) {
const { owner, repo } = context.repo
const pulls = await github.paginate(github.rest.pulls.list, { owner, repo, state: 'open', sort: 'updated', direction: 'asc', per_page: 100 })
let posted = 0
@@ -107,12 +121,16 @@ export async function remindStalePullRequests({ github, context, core, now = new
if (pull.labels.some(label => label.name === EXEMPT_LABEL)) continue
try {
const timeline = await github.paginate(github.rest.issues.listEventsForTimeline, { owner, repo, issue_number: pull.number, per_page: 100 })
const days = dueReminder({ createdAt: pull.created_at, timeline, now })
if (days === undefined) continue
if (posted > 0) await sleep(COMMENT_INTERVAL_MS)
await github.rest.issues.createComment({ owner, repo, issue_number: pull.number, body: reminderBody(pull.user.login, days) })
posted++
core.info(`#${pull.number}: posted the ${days}-day reminder`)
const stage = dueStage({ createdAt: pull.created_at, timeline, now })
if (stage === undefined) continue
const { days } = stage
if (stage.comment) {
if (posted > 0) await sleep(COMMENT_INTERVAL_MS)
await github.rest.issues.createComment({ owner, repo, issue_number: pull.number, body: stageBody(pull.user.login, days) })
posted++
}
if (days === CLOSE_DAYS) await github.rest.pulls.update({ owner, repo, pull_number: pull.number, state: 'closed' })
core.info(days === CLOSE_DAYS ? `#${pull.number}: closed after ${days} days without activity` : `#${pull.number}: posted the ${days}-day reminder`)
} catch (error) {
failed++
core.warning(`#${pull.number}: ${error.message}`)
+60 -28
View File
@@ -1,47 +1,67 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { dueReminder, reminderBody, remindStalePullRequests } from './remind.mjs'
import { dueStage as dueAction, stageBody, processStalePullRequests } from './remind.mjs'
const now = new Date('2026-11-30T00:00:00Z')
const daysAgo = days => new Date(now.getTime() - days * 24 * 60 * 60 * 1000).toISOString()
const human = { login: 'author', type: 'User' }
const bot = { login: 'github-actions[bot]', type: 'Bot' }
const comment = (actor, days, body = 'ok') => ({ event: 'commented', actor, created_at: daysAgo(days), body })
const reminder = (days, stage) => comment(bot, days, reminderBody('author', stage))
const reminder = (days, stage) => comment(bot, days, stageBody('author', stage))
const dueStage = options => dueAction(options)?.days
test('no reminder is due within 7 days of the last activity', () => {
assert.equal(dueReminder({ createdAt: daysAgo(6), timeline: [], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(30), timeline: [comment(human, 6)], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(6), timeline: [], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(30), timeline: [comment(human, 6)], now }), undefined)
})
test('the latest due stage is posted once after the last activity', () => {
assert.equal(dueReminder({ createdAt: daysAgo(7), timeline: [], now }), 7)
assert.equal(dueReminder({ createdAt: daysAgo(10), timeline: [reminder(3, 7)], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(14), timeline: [reminder(7, 7)], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [reminder(20, 14)], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(7), timeline: [], now }), 7)
assert.equal(dueStage({ createdAt: daysAgo(10), timeline: [reminder(3, 7)], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(14), timeline: [reminder(7, 7)], now }), 14)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [], now }), 14)
assert.equal(dueStage({ createdAt: daysAgo(17), timeline: [reminder(3, 14)], now }), undefined)
})
test('a pull request closes after 21 days without activity and 7 days after the 14-day reminder', () => {
assert.equal(dueStage({ createdAt: daysAgo(21), timeline: [reminder(14, 7), reminder(7, 14)], now }), 21)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [reminder(20, 14)], now }), 21)
// A pull request that was already inactive gets the 14-day reminder first and 7 days' notice.
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [reminder(6, 14)], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [reminder(30, 7)], now }), 14)
// A 14-day reminder from before the last activity gives no notice.
assert.equal(dueStage({ createdAt: daysAgo(60), timeline: [reminder(40, 14), comment(human, 25)], now }), 14)
// Reminders posted before closing existed announce no closing.
const legacy = comment(bot, 10, '<!-- stale-pr-reminder:14 -->\n@author This pull request has had no activity for 14 days.')
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [legacy], now }), 14)
})
test('a closing whose comment was posted retries the close without another comment', () => {
assert.deepEqual(dueAction({ createdAt: daysAgo(30), timeline: [reminder(9, 14)], now }), { days: 21, comment: true })
assert.deepEqual(dueAction({ createdAt: daysAgo(30), timeline: [reminder(9, 14), reminder(1, 21)], now }), { days: 21, comment: false })
})
test('human activity restarts the cycle and bot activity does not', () => {
const sentBefore = [reminder(30, 7), reminder(23, 14)]
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment(human, 8)], now }), 7)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'committed', committer: { date: daysAgo(3) } }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'reviewed', user: human, submitted_at: daysAgo(3) }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'line-commented', comments: [{ user: human, created_at: daysAgo(3) }] }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'head_ref_force_pushed', actor: human, created_at: daysAgo(3) }], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ci[bot]', type: 'Bot' }, 1)], now }), undefined)
assert.equal(dueReminder({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ds-review-bot', type: 'User' }, 1)], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, comment(human, 8)], now }), 7)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'committed', committer: { date: daysAgo(3) } }], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'reviewed', user: human, submitted_at: daysAgo(3) }], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'line-commented', comments: [{ user: human, created_at: daysAgo(3) }] }], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'head_ref_force_pushed', actor: human, created_at: daysAgo(3) }], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, { event: 'reopened', actor: human, created_at: daysAgo(3) }], now }), undefined)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ci[bot]', type: 'Bot' }, 1)], now }), 21)
assert.equal(dueStage({ createdAt: daysAgo(40), timeline: [...sentBefore, comment({ login: 'ds-review-bot', type: 'User' }, 1)], now }), 21)
})
test('mentions, labels and cross references are not activity', () => {
const at = (event, days) => ({ event, actor: human, created_at: daysAgo(days) })
// GitHub records a `mentioned` event for the author right after each reminder.
assert.equal(dueReminder({ createdAt: daysAgo(14), timeline: [reminder(7, 7), at('mentioned', 7 - 1e-5), at('subscribed', 7 - 1e-5)], now }), 14)
assert.equal(dueReminder({ createdAt: daysAgo(20), timeline: [at('labeled', 1), at('cross-referenced', 1), at('review_requested', 1)], now }), 14)
assert.equal(dueStage({ createdAt: daysAgo(14), timeline: [reminder(7, 7), at('mentioned', 7 - 1e-5), at('subscribed', 7 - 1e-5)], now }), 14)
assert.equal(dueStage({ createdAt: daysAgo(20), timeline: [at('labeled', 1), at('cross-referenced', 1), at('review_requested', 1)], now }), 14)
})
test('reminders mention the author and skip exempt and bot-authored pull requests', async () => {
test('reminders and closing mention the author and skip exempt and bot-authored pull requests', async () => {
const pull = (number, overrides = {}) => ({ number, user: human, labels: [], created_at: daysAgo(20), updated_at: daysAgo(20), ...overrides })
const pulls = [
pull(1),
@@ -51,12 +71,21 @@ test('reminders mention the author and skip exempt and bot-authored pull request
pull(4, { updated_at: daysAgo(1) }),
pull(6),
pull(5),
pull(7, { created_at: daysAgo(30) }),
pull(8, { created_at: daysAgo(30) }),
]
const comments = []
const closed = []
const timelines = []
const github = {
rest: {
pulls: { list: 'pulls' },
pulls: {
list: 'pulls',
update: async params => {
if (params.pull_number === 8) throw new Error('close failed')
closed.push(params)
},
},
issues: {
listEventsForTimeline: 'timeline',
createComment: async params => {
@@ -68,20 +97,23 @@ test('reminders mention the author and skip exempt and bot-authored pull request
paginate: async (method, params) => {
if (method === 'pulls') return pulls
timelines.push(params.issue_number)
return []
return [7, 8].includes(params.issue_number) ? [reminder(9, 14)] : []
},
}
const sleeps = []
const warnings = []
const failures = []
const core = { info() {}, warning: message => warnings.push(message), setFailed: message => failures.push(message) }
await remindStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core, now, sleep: async ms => sleeps.push(ms) })
assert.deepEqual(timelines, [1, 4, 6, 5])
assert.deepEqual(warnings, ['#6: locked'])
await processStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core, now, sleep: async ms => sleeps.push(ms) })
assert.deepEqual(timelines, [1, 4, 6, 5, 7, 8])
// A failed close after its comment is retried on the next run without another comment.
assert.deepEqual(warnings, ['#6: locked', '#8: close failed'])
assert.equal(failures.length, 1)
assert.deepEqual(comments.map(({ issue_number }) => issue_number), [1, 4, 5])
assert.match(comments[0].body, /^<!-- stale-pr-reminder:14 -->\n@author This pull request has had no activity for 14 days\./)
assert.deepEqual(sleeps, [1000, 1000, 1000])
assert.deepEqual(comments.map(({ issue_number }) => issue_number), [1, 4, 5, 7, 8])
assert.match(comments[0].body, /^<!-- stale-pr:14 -->\n@author This pull request has had no activity for 14 days\./)
assert.match(comments[3].body, /^<!-- stale-pr:21 -->\n@author This pull request has had no activity for 21 days and is now closed\./)
assert.deepEqual(closed, [{ owner: 'o', repo: 'r', pull_number: 7, state: 'closed' }])
assert.deepEqual(sleeps, [1000, 1000, 1000, 1000, 1000])
})
test('a run posts at most 100 reminders', async () => {
@@ -91,6 +123,6 @@ test('a run posts at most 100 reminders', async () => {
rest: { pulls: { list: 'pulls' }, issues: { listEventsForTimeline: 'timeline', createComment: async () => comments++ } },
paginate: async method => method === 'pulls' ? pulls : [],
}
await remindStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core: { info() {} }, now, sleep: async () => {} })
await processStalePullRequests({ github, context: { repo: { owner: 'o', repo: 'r' } }, core: { info() {} }, now, sleep: async () => {} })
assert.equal(comments, 100)
})
+5 -5
View File
@@ -1,4 +1,4 @@
# Reminds authors of open pull requests after 7 and 14 days without activity; never closes them.
# Reminds authors of open pull requests after 7 and 14 days without activity and closes them after 21 days.
# Rules: .github/stale-pull-requests/remind.mjs.
name: Stale pull requests
@@ -16,7 +16,7 @@ concurrency:
jobs:
remind:
name: Remind stale pull requests
name: Remind and close stale pull requests
runs-on: ubuntu-latest
permissions:
contents: read
@@ -27,9 +27,9 @@ jobs:
with:
sparse-checkout: .github/stale-pull-requests
persist-credentials: false
- name: Post due reminders
- name: Post due reminders and close stale pull requests
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
with:
script: |
const { remindStalePullRequests } = await import(`${process.env.GITHUB_WORKSPACE}/.github/stale-pull-requests/remind.mjs`)
await remindStalePullRequests({ github, context, core })
const { processStalePullRequests } = await import(`${process.env.GITHUB_WORKSPACE}/.github/stale-pull-requests/remind.mjs`)
await processStalePullRequests({ github, context, core })
@@ -31,10 +31,14 @@ Read getAccessibilityTree explicitly before using element ids. Selection and scr
- setValue(elementId: string, value: JsonValue) -> ActionResult — write a control value.
- selectText(elementId: string, text: string, options?: { prefix?: string, suffix?: string, selectionType?: 'text' | 'cursor_before' | 'cursor_after' }) -> ActionResult — select one literal occurrence or place the cursor beside it, using adjacent context to disambiguate.
## Simulated mouse
Use an explicit window for screenshots and pointer input. Before coordinate input, including relative coordinates, obtain a successful getAccessibilityTree observation covering that window or take its screenshot. Absolute pixel coordinates require a returned screenshot.
## Screenshots
Use an explicit window for screenshots.
- getScreenshot() -> Image — capture the selected window as a stored image with readonly attachmentId, path, width, and height. Pass selected screenshots to inspect(...values) to display them; read the window ID from window.windowId.
## Simulated mouse
Use an explicit window for pointer input. Before coordinate input, including relative coordinates, obtain a successful getAccessibilityTree observation covering that window or take its screenshot. Absolute pixel coordinates require a returned screenshot.
- mouseMove(target: string | [number, number], options?: { relative?: boolean }) -> { dispatched: boolean, foregroundChanged?: boolean | null, hoverRoute: 'accessibility' | 'system-pointer', systemPointerMoved: boolean } — request a mouse move to the target without pressing a button; inspect hoverRoute and systemPointerMoved, and expect no automatic pointer restoration.
- toggleMouse(mouseButton: 'left' | 'right' | 'middle', direction: 'down' | 'up') -> ActionResult — press or release the specified mouse button at the current pointer position without moving it. No coordinates are accepted. Release held buttons explicitly with 'up'; the opposite event is not sent automatically.
- click(target: string | [number, number], options?: { mouseButton?: 'left' | 'right' | 'middle', clickCount?: 1 | 2, modifiers?: Modifier[], holdMs?: number, relative?: boolean }) -> ActionResult — click an element id or point, or perform a left-button double-click; holdMs controls the press duration of each press.
- scroll(options: { x: number, y: number, deltaLinesX: number, deltaLinesY: number, relative?: boolean }) -> ActionResult — scroll at a point; deltas are integers from -10 to 10 with at least one nonzero, and positive values reveal content above or left.
- drag(from: [number, number], to: [number, number], options?: { mouseButton?: 'left' | 'right' | 'middle', modifiers?: Modifier[], relative?: boolean }) -> ActionResult — drag between two points of one window.
@@ -48,6 +52,8 @@ Available at app or window level depending on the platform.
- pressKey(key: string, modifiers?: Modifier[]) -> ActionResult — press and release one complete keystroke. For example pressKey('Tab', ['shift']) or pressKey('+'). Key names are platform-defined strings. Pass key and modifiers separately; do not pack them into a chord string.
- sendKeyEvent(key: string, direction: 'down' | 'up') -> ActionResult — send one key-down or key-up event; key accepts a single key name, including a modifier.
click, drag, and pressKey are convenience operations; sendKeyEvent, mouseMove, and toggleMouse are primitive operations. For complex action combinations, decompose convenience operations into sequences of primitive operations supported by the current platform.
Raw tools use { method, params }: include appHandle for app calls and windowId for window calls, and use snapshotId with elementId for element routes. getAccessibilityTree maps to getState; getWindow has no raw method; getWindows maps to listWindows; getScreenshot maps to screenshot; cua.getState maps to listApps; every other named operation uses the same method name.
AX read defaults: maxElements=2000, maxDepth=25.
@@ -8,7 +8,7 @@
{"type":"step/start","data":{"turn":1,"step":1}}
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{sessionId}}"}},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"Use the write tool exactly once with file_path set to exactly the relative path inherited.txt and content escaped. If the write is denied, reply with the single word CHILD_DENIED and the denial marker line; do not retry and do not request escalation. If it succeeds, reply CHILD_WROTE."},{"type":"text","text":"Your final answer is delivered automatically if your parent is still online. Include the result and relevant evidence in that answer; the parent does not receive your full transcript, tool output, or reasoning. If your last action is a message to your parent, the completion notice omits your final answer; include the result and relevant evidence in that message."}],"source":{"kind":"user"},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: read-only. Any available operation enforced by the DSH file sandbox cannot modify files in the standing mode. Do not refuse a required modification from this policy alone: try an available tool normally and follow any denial and escalation guidance it returns.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nDelegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: read-only. Any available operation enforced by the DSH file sandbox cannot modify files in the standing mode. Do not refuse a required modification from this policy alone: try an available tool normally and follow any denial and escalation guidance it returns."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:identity","text":"You are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"tool:subagent_fork:depth","text":"Delegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: read-only. Any available operation enforced by the DSH file sandbox cannot modify files in the standing mode. Do not refuse a required modification from this policy alone: try an available tool normally and follow any denial and escalation guidance it returns.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nWhen you finish, use send_message to send a self-contained result to the agent that delegated you. Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.\nUse list_agents({}) to find your collaborator agents and their names.\n\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nDelegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: read-only. Any available operation enforced by the DSH file sandbox cannot modify files in the standing mode. Do not refuse a required modification from this policy alone: try an available tool normally and follow any denial and escalation guidance it returns."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:identity","text":"You are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nWhen you finish, use send_message to send a self-contained result to the agent that delegated you. Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.\nUse list_agents({}) to find your collaborator agents and their names."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"tool:subagent_fork:depth","text":"Delegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash","reasoningEffort":"low"},"tools":"{{tools}}"},"reason":"initial"}}
{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}}
{"type":"session/title","data":{"title":"Use the write tool exactly","messageSeqs":[8],"source":{"kind":"fallback"}}}
@@ -8,7 +8,7 @@
{"type":"step/start","data":{"turn":1,"step":1}}
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{sessionId}}"}},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"Reply with exactly CHILD_RESULT and nothing else. Do not call send_message."},{"type":"text","text":"Your final answer is delivered automatically if your parent is still online. Include the result and relevant evidence in that answer; the parent does not receive your full transcript, tool output, or reasoning. If your last action is a message to your parent, the completion notice omits your final answer; include the result and relevant evidence in that message."}],"source":{"kind":"user"},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: workspace-write. Any available operation enforced by the DSH file sandbox may modify files under the session workspace: \"{{cwd}}\". Some platform temporary areas may also be writable.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nDelegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: workspace-write. Any available operation enforced by the DSH file sandbox may modify files under the session workspace: \"{{cwd}}\". Some platform temporary areas may also be writable."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:identity","text":"You are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"tool:subagent_fork:depth","text":"Delegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"<system-reminder>\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: workspace-write. Any available operation enforced by the DSH file sandbox may modify files under the session workspace: \"{{cwd}}\". Some platform temporary areas may also be writable.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nWhen you finish, use send_message to send a self-contained result to the agent that delegated you. Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.\nUse list_agents({}) to find your collaborator agents and their names.\n\nDelegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly.\n\nDelegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly.\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it.\n</system-reminder>"}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: workspace-write. Any available operation enforced by the DSH file sandbox may modify files under the session workspace: \"{{cwd}}\". Some platform temporary areas may also be writable."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:identity","text":"You are a subagent delegated by agent \"lead\".\nYour name is \"agent-1\".\nThe root agent of your collaboration tree is \"lead\".\n\nTo message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" }).\nWhen you finish, use send_message to send a self-contained result to the agent that delegated you. Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.\nUse list_agents({}) to find your collaborator agents and their names."},{"name":"tool:subagent:depth","text":"Delegation depth for `subagent`: current 1, maximum 1, remaining levels 0. Do not call `subagent` at this depth; carry out the work directly."},{"name":"tool:subagent_fork:depth","text":"Delegation depth for `subagent_fork`: current 1, maximum 1, remaining levels 0. Do not call `subagent_fork` at this depth; carry out the work directly."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{sessionId}}"},"surfaceOp":"append"}
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}}
{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}}
{"type":"session/title","data":{"title":"Reply with exactly CHILD_RESULT and","messageSeqs":[8],"source":{"kind":"fallback"}}}
@@ -0,0 +1,99 @@
// Web e2e scenario: a composer draft's pasted image survives a sidebar session
// switch. The reported defect spans the whole chain — sidebar row click, Session
// scope retirement, the input shell's teardown, and the rail's rebuild — so only
// the real composition can pin it. Units cover each link separately (hub/shell/
// service specs); this covers the assembled path and the rail the user sees.
//
// Zero model calls: a seeded session is non-blank (so the sidebar can create a
// second one instead of reusing it) and the scenario never submits.
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import {
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot } from './support.ts'
const MODE = webSnapshotMode()
const SEED_ID = 'draft-attachment-switch-a'
const PEER_ID = 'draft-attachment-switch-b'
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/live-interactions/session.v3.jsonl', import.meta.url))
const PNG = fileURLToPath(new URL('../../../snapshots/session/read-image/workspace/red.png', import.meta.url))
const DRAFT_TEXT = 'draft text that survives the switch'
/** The composer's pending-attachment rail, present only while it holds items. */
const RAIL = '[role="group"][aria-label="Pending attachments"]'
/**
* Paste one real PNG into the composer through a genuine clipboard event, the
* same intake a user's screenshot paste performs.
* @param page - page holding the composer.
* @param bytes - PNG bytes.
*/
async function pasteImage(page: Page, bytes: Uint8Array): Promise<void> {
await page.locator('[data-composer-input]').first().evaluate((surface, data) => {
const transfer = new DataTransfer()
transfer.items.add(new File([new Uint8Array(data)], 'draft.png', { type: 'image/png' }))
surface.dispatchEvent(new ClipboardEvent('paste', {
clipboardData: transfer, bubbles: true, cancelable: true,
}))
}, [...bytes])
}
describe.skipIf(MODE === 'record')('web e2e: draft attachment across a session switch', () => {
let scaffold: WebScaffold
let browser: Browser
let page: Page
let tripwire: ReturnType<typeof watchConsole>
beforeAll(async () => {
scaffold = await launchWebScaffold({})
const log = await readFile(FIXTURE, 'utf8')
await seedSession(scaffold, log, SEED_ID)
await seedSession(scaffold, log, PEER_ID)
browser = await chromium.launch()
page = await newEnglishPage(browser)
tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
// Expand the workspace group and open the seeded session.
const groupRow = page.locator('[role="treeitem"]').first()
await groupRow.waitFor({ timeout: 15_000 })
await groupRow.click()
const sessionRow = page.locator(`[data-row-key="session:${SEED_ID}"]`)
await sessionRow.waitFor({ timeout: 15_000 })
await sessionRow.click()
await page.locator('[data-composer-input]').first().waitFor({ timeout: 15_000 })
})
afterAll(async () => {
await browser?.close()
await scaffold?.close()
})
it('keeps the pasted image and the typed draft when the sidebar leaves and returns', async () => {
onTestFailed(() => saveFailureShot(page, 'draft-attachment-session-switch'))
// (a) paste an image, then type text into the seeded session's composer.
await pasteImage(page, await readFile(PNG))
await expect.poll(() => page.locator(`${RAIL} img`).count(), { timeout: 15_000 }).toBe(1)
await page.locator('[data-composer-input]').first().click()
await page.keyboard.type(DRAFT_TEXT, { delay: 5 })
await expect.poll(() => page.locator(RAIL).locator('img').count(), { timeout: 10_000 }).toBe(1)
// (b) leave through the sidebar: switching to another session retires this
// one's Session scope.
await page.locator(`[data-row-key="session:${PEER_ID}"]`).click()
await expect.poll(() => page.locator(RAIL).count(), { timeout: 15_000 }).toBe(0)
// (c) return: the rebuilt composer must show the image AND the text.
await page.locator(`[data-row-key="session:${SEED_ID}"]`).click()
await expect.poll(() => page.locator(`${RAIL} img`).count(), { timeout: 15_000 }).toBe(1)
await expect.poll(
() => page.locator('[data-composer-input]').first().innerText(),
{ timeout: 10_000 },
).toContain(DRAFT_TEXT)
expect(tripwire.pageErrors).toEqual([])
})
})
@@ -3,6 +3,8 @@
- list:
- listitem:
- button "Daily brief": Daily brief Recent changes in the workspace and what needs follow-up, with what to do first today. Weekdays at 9:00
- listitem:
- button "Weekly review": Weekly review Your work in the workspace this week, with loose ends and what to do first next week. Fridays at {{clock}}
- listitem:
- button "Issue scan": Issue scan Sort new issues into bugs, requests, and questions, and flag duplicates and ones that need a reply. Weekdays at {{clock}}
- listitem:
@@ -3,6 +3,8 @@
- list:
- listitem:
- button "每日简报": 每日简报 汇总工作区最近的变化和待跟进的事,列出今天先做什么。 工作日 9:00
- listitem:
- button "每周回顾": 每周回顾 回顾自己这周在工作区做的事,列出没收尾的事和下周先做什么。 周五 {{clock}}
- listitem:
- button "Issue 扫描": Issue 扫描 把新开的 issue 分成 bug、需求、提问,标出重复的和需要回复的。 工作日 {{clock}}
- listitem:
+1 -1
View File
@@ -71,7 +71,7 @@ it.each([
const recommendations = manager.getByRole('region', { name: copy.heading, exact: true })
const recommendation = recommendations.getByRole('button', { name: copy.title, exact: true })
await recommendation.waitFor()
expect(await recommendations.getByRole('button').count()).toBe(7)
expect(await recommendations.getByRole('button').count()).toBe(8)
if (draft === '') {
expect(await recommendationColumns(recommendations)).toBe(2)
await compareOrRefreshGolden(
+1
View File
@@ -184,6 +184,7 @@
"tests/present-after-closing-reply.e2e.ts",
"tests/autolink-cjk-punctuation.e2e.ts",
"tests/composer-draft-scroll.e2e.ts",
"tests/draft-attachment-session-switch.e2e.ts",
"tests/composer-focus.e2e.ts",
"tests/composer-placeholder.e2e.ts",
"tests/context-meter.e2e.ts",
+2 -2
View File
@@ -6,5 +6,5 @@
en: 41d772192075e133
zh: 5ef3da69b4de1d8a
/capability-seams-and-core-services:
en: 7372ec4217b1beb4
zh: 183ca2544b406d10
en: 15d626593d746219
zh: 332d2135597249b8
+4
View File
@@ -29,6 +29,8 @@ flowchart LR
svc_pluginRegistryProbe["ctx.pluginRegistryProbe<br/>Host registry response comparison"]
pkg_plugin_manager["plugin-manager"]
svc_pluginManager["ctx.pluginManager<br/>Current-profile plugin and bundle management"]
pkg_client_ui_connector_account["client-ui-connector-account"]
svc_connectorAccounts["ctx.connectorAccounts<br/>Connector accounts on the Plugins page"]
pkg_plugin_market["plugin-market"]
svc_pluginMarket["ctx.pluginMarket<br/>Plugin market index reader"]
pkg_client_ui_plugin_market["client-ui-plugin-market"]
@@ -355,6 +357,7 @@ flowchart LR
pkg_client_file_upload --> svc_fileUploads
pkg_client_modules --> svc_clientModules
pkg_client_product_analytics --> svc_productAnalytics
pkg_client_ui_connector_account --> svc_connectorAccounts
pkg_client_ui_plugin_manager --> svc_pluginRegistryProbe
pkg_client_ui_session_status --> svc_sessionStatus
pkg_command_feedback --> svc_sessionFeedback
@@ -683,6 +686,7 @@ flowchart LR
| `ctx.hmr` | `core` | [`hmr`](../packages/boot/hmr) | - | [`app-boot`](../packages/boot/app-boot) | - | Owns module and exact configuration watchers; application mutations share its queue and automatic reloads await the application file lock. |
| `ctx.pluginRegistryProbe` | `core` | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | Races public registry responses on the Host; the Client owns the initial registry recommendation. |
| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | Shares profile package operations with the CLI and reports persisted and running state to Web and agent callers. |
| `ctx.connectorAccounts` | `service` | [`client-ui-connector-account`](../packages/client/ui-connector-account) | - | - | - | Holds the accounts CLI app plugins and MCP connectors register and serves their Host-computed displays to the Plugins page through one Remote; authorization pages and notices stay in the browser that started the operation. |
| `ctx.pluginMarket` | `core` | [`plugin-market`](../packages/boot/plugin-market) | - | [`client-ui-plugin-market`](../packages/client/ui-plugin-market), [`plugin-market`](../packages/boot/plugin-market) | - | Fetches and validates the index sources the user configures; installation goes through the plugin manager. |
| `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | The dsh launcher supplies data-only profile locations and composition inputs; reload scheduling belongs to dsh-hmr. |
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | Applies source policy and shared HTTP request dispatch; credential verification belongs to ConnectionAuthentication, and API adapters register endpoints and streams. |
+4
View File
@@ -31,6 +31,8 @@ flowchart LR
svc_pluginRegistryProbe["ctx.pluginRegistryProbe<br/>Host registry response comparison"]
pkg_plugin_manager["plugin-manager"]
svc_pluginManager["ctx.pluginManager<br/>Current-profile plugin and bundle management"]
pkg_client_ui_connector_account["client-ui-connector-account"]
svc_connectorAccounts["ctx.connectorAccounts<br/>Connector accounts on the Plugins page"]
pkg_plugin_market["plugin-market"]
svc_pluginMarket["ctx.pluginMarket<br/>Plugin market index reader"]
pkg_client_ui_plugin_market["client-ui-plugin-market"]
@@ -357,6 +359,7 @@ flowchart LR
pkg_client_file_upload --> svc_fileUploads
pkg_client_modules --> svc_clientModules
pkg_client_product_analytics --> svc_productAnalytics
pkg_client_ui_connector_account --> svc_connectorAccounts
pkg_client_ui_plugin_manager --> svc_pluginRegistryProbe
pkg_client_ui_session_status --> svc_sessionStatus
pkg_command_feedback --> svc_sessionFeedback
@@ -685,6 +688,7 @@ flowchart LR
| `ctx.hmr` | `core` | [`hmr`](../packages/boot/hmr) | - | [`app-boot`](../packages/boot/app-boot) | - | 负责模块和精确配置监听;应用修改共用其队列,自动重载等待应用文件锁。 |
| `ctx.pluginRegistryProbe` | `core` | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | 在 Host 上并发比较公共安装源响应;初始安装源推荐由 Client 负责。 |
| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | 与 CLI 共享 profile 包操作,并向 Web 和 Agent 调用方分别报告持久状态与运行状态。 |
| `ctx.connectorAccounts` | `service` | [`client-ui-connector-account`](../packages/client/ui-connector-account) | - | - | - | 保存 CLI 应用插件和 MCP 连接器注册的账号,并通过一个 Remote 把 Host 算好的展示内容提供给插件页;授权页和提示只出现在发起操作的浏览器中。 |
| `ctx.pluginMarket` | `core` | [`plugin-market`](../packages/boot/plugin-market) | - | [`client-ui-plugin-market`](../packages/client/ui-plugin-market), [`plugin-market`](../packages/boot/plugin-market) | - | 获取并校验用户配置的索引源;安装通过插件管理器完成。 |
| `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | dsh launcher 提供纯数据形式的 profile 位置与组合输入;重载调度由 dsh-hmr 负责。 |
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | 执行来源策略与共享 HTTP 请求分发;凭据验证归 ConnectionAuthentication,API 适配器注册端点和流。 |
+13 -11
View File
@@ -1127,7 +1127,7 @@ export interface StagehandModelConfig {
## `@deepseek-ai/dsh-experimental-claude-code-mods`
- `inject`: `workingDirectory` · `agents`
- `source`: [`packages/experimental/claude-code-mods/src/index.ts:54`](../packages/experimental/claude-code-mods/src/index.ts)
- `source`: [`packages/experimental/claude-code-mods/src/index.ts:55`](../packages/experimental/claude-code-mods/src/index.ts)
```ts config-catalog
/** Plugin config: the limits mod hooks run under. */
@@ -1727,7 +1727,7 @@ export interface Config {
- `inject`: `agentDefaultModel` · `agents` · `sessions`
- `refs`: [`ApprovalPolicy`](subsystems/approval.md)
- `source`: [`packages/bundle/headless/src/index.ts:48`](../packages/bundle/headless/src/index.ts)
- `source`: [`packages/bundle/headless/src/index.ts:49`](../packages/bundle/headless/src/index.ts)
```ts config-catalog
/** Plugin config: the task and run options resolved from this app's injected provider service. */
@@ -1775,7 +1775,7 @@ export interface HmrConfig extends ChokidarOptions {
## `@deepseek-ai/dsh-hooks-claude-code`
- `inject`: `shell` · `agents` · `workingDirectory`
- `source`: [`packages/experimental/hooks-claude-code/src/index.ts:53`](../packages/experimental/hooks-claude-code/src/index.ts)
- `source`: [`packages/experimental/hooks-claude-code/src/index.ts:54`](../packages/experimental/hooks-claude-code/src/index.ts)
```ts config-catalog
/** Plugin config: where the CC hook config lives + substitution roots. */
@@ -1814,7 +1814,7 @@ export interface Config {
## `@deepseek-ai/dsh-hooks-codex`
- `inject`: `shell` · `agents` · `workingDirectory`
- `source`: [`packages/experimental/hooks-codex/src/index.ts:52`](../packages/experimental/hooks-codex/src/index.ts)
- `source`: [`packages/experimental/hooks-codex/src/index.ts:53`](../packages/experimental/hooks-codex/src/index.ts)
```ts config-catalog
/** Plugin config: where the Codex hooks.json lives + the model name for payloads. */
@@ -3327,7 +3327,7 @@ export interface Config {
## `@deepseek-ai/dsh-session-query-sqlite`
- `inject`: `sessions`
- `inject`: `sessions` · `sessionProjections`
- `refs`: [`SessionQueryConfig`](../packages/session-query/session-query/src/index.ts)
- `source`: [`packages/session-query/session-query-sqlite/src/index.ts:92`](../packages/session-query/session-query-sqlite/src/index.ts)
@@ -3375,7 +3375,7 @@ export type JournalMode = 'wal' | 'delete' | 'truncate' | 'persist'
## `@deepseek-ai/dsh-session-reference`
- `inject`: `sessionQuery`
- `inject`: `sessionQuery` · `sessions` · `sessionProjections`
- `source`: [`packages/context/session-reference/src/config.ts:11`](../packages/context/session-reference/src/config.ts)
```ts config-catalog
@@ -3446,7 +3446,7 @@ export enum SessionTelemetryMode {
## `@deepseek-ai/dsh-session-title`
- `inject`: `sessions` · `sessionProjections` · `agents`
- `source`: [`packages/session/session-title/src/index.ts:56`](../packages/session/session-title/src/index.ts)
- `source`: [`packages/session/session-title/src/index.ts:57`](../packages/session/session-title/src/index.ts)
```ts config-catalog
/** Required deterministic fallback and accepted-title limits. */
@@ -3468,7 +3468,7 @@ export interface Config {
- `inject`: `sessionTitle` · `llm` · `sessions`
- `refs`: [`SessionTitleLlmConfig`](../packages/session/session-title-llm/src/index.ts)
- `source`: [`packages/experimental/session-title-all-prompts-llm/src/index.ts:29`](../packages/experimental/session-title-all-prompts-llm/src/index.ts)
- `source`: [`packages/experimental/session-title-all-prompts-llm/src/index.ts:30`](../packages/experimental/session-title-all-prompts-llm/src/index.ts)
```ts config-catalog
/** Required execution controls plus this provider's title-length targets; no defaults. */
@@ -3488,7 +3488,7 @@ export interface Config extends SessionTitleLlmConfig {
- `inject`: `sessionTitle` · `llm` · `sessions`
- `refs`: [`SessionTitleLlmConfig`](../packages/session/session-title-llm/src/index.ts)
- `source`: [`packages/session/session-title-first-prompt-llm/src/index.ts:29`](../packages/session/session-title-first-prompt-llm/src/index.ts)
- `source`: [`packages/session/session-title-first-prompt-llm/src/index.ts:30`](../packages/session/session-title-first-prompt-llm/src/index.ts)
```ts config-catalog
/** Required execution controls plus this provider's title-length targets; no defaults. */
@@ -4774,7 +4774,7 @@ export interface PresetSelectionConfig {
## `@deepseek-ai/dsh-tool-subagent-control`
- `inject`: `tools` · `subagents` · `agents` · `systemPrompt`
- `source`: [`packages/subagent/tool-subagent-control/src/index.ts:24`](../packages/subagent/tool-subagent-control/src/index.ts)
- `source`: [`packages/subagent/tool-subagent-control/src/index.ts:25`](../packages/subagent/tool-subagent-control/src/index.ts)
```ts config-catalog
/** Optional subagent control tools. */
@@ -5024,7 +5024,7 @@ export interface Config {
- `inject`: `web`
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
- `source`: [`packages/web/web-deepseek-api/src/index.ts:56`](../packages/web/web-deepseek-api/src/index.ts)
- `source`: [`packages/web/web-deepseek-api/src/index.ts:57`](../packages/web/web-deepseek-api/src/index.ts)
```ts config-catalog
/**
@@ -5245,6 +5245,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
| `@deepseek-ai/dsh-client-ui-brand-official` | — | [`packages/client/ui-brand-official/src/index.ts`](../packages/client/ui-brand-official/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-chat` | — | [`packages/client/ui-chat/src/index.ts`](../packages/client/ui-chat/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-commands` | — | [`packages/client/ui-commands/src/index.ts`](../packages/client/ui-commands/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-connector-account` | — | [`packages/client/ui-connector-account/src/index.ts`](../packages/client/ui-connector-account/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-context-menu` | — | [`packages/client/ui-context-menu/src/index.ts`](../packages/client/ui-context-menu/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-conversation` | — | [`packages/client/ui-conversation/src/index.ts`](../packages/client/ui-conversation/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-cordis` | — | [`packages/extensions/ui-cordis/src/index.ts`](../packages/extensions/ui-cordis/src/index.ts) |
@@ -5340,6 +5341,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
| `@deepseek-ai/dsh-tool-cordis` | `tools` · `cordisInspect` | [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts) |
| `@deepseek-ai/dsh-tool-executor-native` | `tools` | [`packages/core/tool-executor-native/src/index.ts`](../packages/core/tool-executor-native/src/index.ts) |
| `@deepseek-ai/dsh-tool-schedule` | `tools` · `systemPrompt` | [`packages/schedule/tool-schedule/src/index.ts`](../packages/schedule/tool-schedule/src/index.ts) |
| `@deepseek-ai/dsh-tool-session-list` | `tools` · `sessions` · `sessionQuery` · `workspaceRegistry` · `sessionProjections` | [`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts) |
| `@deepseek-ai/dsh-tool-working-directory` | `tools` · `workingDirectory` | [`packages/session/tool-working-directory/src/index.ts`](../packages/session/tool-working-directory/src/index.ts) |
| `@deepseek-ai/dsh-tools` | `systemPrompt` | [`packages/core/tools/src/index.ts`](../packages/core/tools/src/index.ts) |
| `@deepseek-ai/dsh-user-questions` | — | [`packages/interaction/user-questions/src/index.ts`](../packages/interaction/user-questions/src/index.ts) |
+13 -11
View File
@@ -1129,7 +1129,7 @@ export interface StagehandModelConfig {
## `@deepseek-ai/dsh-experimental-claude-code-mods`
- `inject`: `workingDirectory` · `agents`
- `source`: [`packages/experimental/claude-code-mods/src/index.ts:54`](../packages/experimental/claude-code-mods/src/index.ts)
- `source`: [`packages/experimental/claude-code-mods/src/index.ts:55`](../packages/experimental/claude-code-mods/src/index.ts)
```ts config-catalog
/** Plugin config: the limits mod hooks run under. */
@@ -1729,7 +1729,7 @@ export interface Config {
- `inject`: `agentDefaultModel` · `agents` · `sessions`
- `refs`: [`ApprovalPolicy`](subsystems/approval.zh.md)
- `source`: [`packages/bundle/headless/src/index.ts:48`](../packages/bundle/headless/src/index.ts)
- `source`: [`packages/bundle/headless/src/index.ts:49`](../packages/bundle/headless/src/index.ts)
```ts config-catalog
/** Plugin config: the task and run options resolved from this app's injected provider service. */
@@ -1777,7 +1777,7 @@ export interface HmrConfig extends ChokidarOptions {
## `@deepseek-ai/dsh-hooks-claude-code`
- `inject`: `shell` · `agents` · `workingDirectory`
- `source`: [`packages/experimental/hooks-claude-code/src/index.ts:53`](../packages/experimental/hooks-claude-code/src/index.ts)
- `source`: [`packages/experimental/hooks-claude-code/src/index.ts:54`](../packages/experimental/hooks-claude-code/src/index.ts)
```ts config-catalog
/** Plugin config: where the CC hook config lives + substitution roots. */
@@ -1816,7 +1816,7 @@ export interface Config {
## `@deepseek-ai/dsh-hooks-codex`
- `inject`: `shell` · `agents` · `workingDirectory`
- `source`: [`packages/experimental/hooks-codex/src/index.ts:52`](../packages/experimental/hooks-codex/src/index.ts)
- `source`: [`packages/experimental/hooks-codex/src/index.ts:53`](../packages/experimental/hooks-codex/src/index.ts)
```ts config-catalog
/** Plugin config: where the Codex hooks.json lives + the model name for payloads. */
@@ -3329,7 +3329,7 @@ export interface Config {
## `@deepseek-ai/dsh-session-query-sqlite`
- `inject`: `sessions`
- `inject`: `sessions` · `sessionProjections`
- `refs`: [`SessionQueryConfig`](../packages/session-query/session-query/src/index.ts)
- `source`: [`packages/session-query/session-query-sqlite/src/index.ts:92`](../packages/session-query/session-query-sqlite/src/index.ts)
@@ -3377,7 +3377,7 @@ export type JournalMode = 'wal' | 'delete' | 'truncate' | 'persist'
## `@deepseek-ai/dsh-session-reference`
- `inject`: `sessionQuery`
- `inject`: `sessionQuery` · `sessions` · `sessionProjections`
- `source`: [`packages/context/session-reference/src/config.ts:11`](../packages/context/session-reference/src/config.ts)
```ts config-catalog
@@ -3448,7 +3448,7 @@ export enum SessionTelemetryMode {
## `@deepseek-ai/dsh-session-title`
- `inject`: `sessions` · `sessionProjections` · `agents`
- `source`: [`packages/session/session-title/src/index.ts:56`](../packages/session/session-title/src/index.ts)
- `source`: [`packages/session/session-title/src/index.ts:57`](../packages/session/session-title/src/index.ts)
```ts config-catalog
/** Required deterministic fallback and accepted-title limits. */
@@ -3470,7 +3470,7 @@ export interface Config {
- `inject`: `sessionTitle` · `llm` · `sessions`
- `refs`: [`SessionTitleLlmConfig`](../packages/session/session-title-llm/src/index.ts)
- `source`: [`packages/experimental/session-title-all-prompts-llm/src/index.ts:29`](../packages/experimental/session-title-all-prompts-llm/src/index.ts)
- `source`: [`packages/experimental/session-title-all-prompts-llm/src/index.ts:30`](../packages/experimental/session-title-all-prompts-llm/src/index.ts)
```ts config-catalog
/** Required execution controls plus this provider's title-length targets; no defaults. */
@@ -3490,7 +3490,7 @@ export interface Config extends SessionTitleLlmConfig {
- `inject`: `sessionTitle` · `llm` · `sessions`
- `refs`: [`SessionTitleLlmConfig`](../packages/session/session-title-llm/src/index.ts)
- `source`: [`packages/session/session-title-first-prompt-llm/src/index.ts:29`](../packages/session/session-title-first-prompt-llm/src/index.ts)
- `source`: [`packages/session/session-title-first-prompt-llm/src/index.ts:30`](../packages/session/session-title-first-prompt-llm/src/index.ts)
```ts config-catalog
/** Required execution controls plus this provider's title-length targets; no defaults. */
@@ -4776,7 +4776,7 @@ export interface PresetSelectionConfig {
## `@deepseek-ai/dsh-tool-subagent-control`
- `inject`: `tools` · `subagents` · `agents` · `systemPrompt`
- `source`: [`packages/subagent/tool-subagent-control/src/index.ts:24`](../packages/subagent/tool-subagent-control/src/index.ts)
- `source`: [`packages/subagent/tool-subagent-control/src/index.ts:25`](../packages/subagent/tool-subagent-control/src/index.ts)
```ts config-catalog
/** Optional subagent control tools. */
@@ -5026,7 +5026,7 @@ export interface Config {
- `inject`: `web`
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
- `source`: [`packages/web/web-deepseek-api/src/index.ts:56`](../packages/web/web-deepseek-api/src/index.ts)
- `source`: [`packages/web/web-deepseek-api/src/index.ts:57`](../packages/web/web-deepseek-api/src/index.ts)
```ts config-catalog
/**
@@ -5247,6 +5247,7 @@ export interface Config {
| `@deepseek-ai/dsh-client-ui-brand-official` | — | [`packages/client/ui-brand-official/src/index.ts`](../packages/client/ui-brand-official/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-chat` | — | [`packages/client/ui-chat/src/index.ts`](../packages/client/ui-chat/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-commands` | — | [`packages/client/ui-commands/src/index.ts`](../packages/client/ui-commands/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-connector-account` | — | [`packages/client/ui-connector-account/src/index.ts`](../packages/client/ui-connector-account/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-context-menu` | — | [`packages/client/ui-context-menu/src/index.ts`](../packages/client/ui-context-menu/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-conversation` | — | [`packages/client/ui-conversation/src/index.ts`](../packages/client/ui-conversation/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-cordis` | — | [`packages/extensions/ui-cordis/src/index.ts`](../packages/extensions/ui-cordis/src/index.ts) |
@@ -5342,6 +5343,7 @@ export interface Config {
| `@deepseek-ai/dsh-tool-cordis` | `tools` · `cordisInspect` | [`packages/extensions/tool-cordis/src/index.ts`](../packages/extensions/tool-cordis/src/index.ts) |
| `@deepseek-ai/dsh-tool-executor-native` | `tools` | [`packages/core/tool-executor-native/src/index.ts`](../packages/core/tool-executor-native/src/index.ts) |
| `@deepseek-ai/dsh-tool-schedule` | `tools` · `systemPrompt` | [`packages/schedule/tool-schedule/src/index.ts`](../packages/schedule/tool-schedule/src/index.ts) |
| `@deepseek-ai/dsh-tool-session-list` | `tools` · `sessions` · `sessionQuery` · `workspaceRegistry` · `sessionProjections` | [`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts) |
| `@deepseek-ai/dsh-tool-working-directory` | `tools` · `workingDirectory` | [`packages/session/tool-working-directory/src/index.ts`](../packages/session/tool-working-directory/src/index.ts) |
| `@deepseek-ai/dsh-tools` | `systemPrompt` | [`packages/core/tools/src/index.ts`](../packages/core/tools/src/index.ts) |
| `@deepseek-ai/dsh-user-questions` | — | [`packages/interaction/user-questions/src/index.ts`](../packages/interaction/user-questions/src/index.ts) |
+6 -6
View File
@@ -23,11 +23,11 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
| `agent/request-error` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:390`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`compaction-image-offload`](../packages/compaction/compaction-image-offload), [`llm-retry`](../packages/llm/llm-retry) |
| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) |
| `agent/turn-stopping` | `serial` | [`packages/core/agent/src/runtime-types.ts:418`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`serial`) | [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:705`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:685`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:697`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:677`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:704`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:683`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:690`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:56`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
@@ -60,7 +60,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
| `llm-pi-ai/request-headers` | `waterfall` | [`packages/llm/llm-pi-ai/src/index.ts:113`](../packages/llm/llm-pi-ai/src/index.ts) | [`llm-pi-ai`](../packages/llm/llm-pi-ai) (`waterfall`) | - |
| `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:24`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), `remotes` |
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:77`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:81`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
| `mcp-manager/status` | `parallel` | [`packages/mcp/mcp-manager/src/types.ts:46`](../packages/mcp/mcp-manager/src/types.ts) | [`mcp-manager`](../packages/mcp/mcp-manager) (`parallel`) | - |
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:62`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:455`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
+6 -6
View File
@@ -25,11 +25,11 @@
| `agent/request-error` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:390`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`compaction-image-offload`](../packages/compaction/compaction-image-offload), [`llm-retry`](../packages/llm/llm-retry) |
| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) |
| `agent/turn-stopping` | `serial` | [`packages/core/agent/src/runtime-types.ts:418`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`serial`) | [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:705`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:685`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:712`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:691`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:698`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:697`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:677`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/error` | `emit` | [`packages/api/session-controller/src/types.ts:704`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/removed` | `emit` | [`packages/api/session-controller/src/types.ts:683`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `api-session/status` | `emit` | [`packages/api/session-controller/src/types.ts:690`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` |
| `app-boot/config-reload` | `emit` | [`packages/boot/app-boot/src/index.ts:56`](../packages/boot/app-boot/src/index.ts) | [`app-boot`](../packages/boot/app-boot) (`emit`) | [`settings`](../packages/settings/settings) |
| `approval/request` | `waterfall` | [`packages/interaction/user-approval/src/types.ts:87`](../packages/interaction/user-approval/src/types.ts) | [`user-approval`](../packages/interaction/user-approval) (`waterfall`) | [`acp`](../packages/acp/acp), `remotes`, `server` |
| `authorization/settled` | `emit` | [`packages/credentials/authorization/src/index.ts:57`](../packages/credentials/authorization/src/index.ts) | [`authorization`](../packages/credentials/authorization) (`events.dispatch`) | - |
@@ -62,7 +62,7 @@
| `llm-pi-ai/request-headers` | `waterfall` | [`packages/llm/llm-pi-ai/src/index.ts:113`](../packages/llm/llm-pi-ai/src/index.ts) | [`llm-pi-ai`](../packages/llm/llm-pi-ai) (`waterfall`) | - |
| `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:24`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), `remotes` |
| `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:77`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:81`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title), [`timeline`](../packages/experimental/timeline) |
| `mcp-manager/status` | `parallel` | [`packages/mcp/mcp-manager/src/types.ts:46`](../packages/mcp/mcp-manager/src/types.ts) | [`mcp-manager`](../packages/mcp/mcp-manager) (`parallel`) | - |
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:62`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:455`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
+19 -7
View File
@@ -112,6 +112,7 @@ flowchart TD
pkg_session_log_export["session-log-export"]
pkg_session_query["session-query"]
pkg_session_query_sqlite["session-query-sqlite"]
pkg_tool_session_list["tool-session-list"]
end
subgraph group_acp["packages/acp"]
pkg_acp["acp"]
@@ -173,6 +174,7 @@ flowchart TD
pkg_client_ui_brand_official["client-ui-brand-official"]
pkg_client_ui_chat["client-ui-chat"]
pkg_client_ui_commands["client-ui-commands"]
pkg_client_ui_connector_account["client-ui-connector-account"]
pkg_client_ui_context_menu["client-ui-context-menu"]
pkg_client_ui_conversation["client-ui-conversation"]
pkg_client_ui_deliverables["client-ui-deliverables"]
@@ -1263,6 +1265,13 @@ flowchart TD
pkg_session_query_sqlite --> pkg_session
pkg_session_query_sqlite --> pkg_session_persistence
pkg_session_query_sqlite --> pkg_session_query
pkg_tool_session_list --> pkg_session
pkg_tool_session_list --> pkg_session_projection
pkg_tool_session_list --> pkg_session_projection_cache
pkg_tool_session_list --> pkg_session_query
pkg_tool_session_list --> pkg_session_title
pkg_tool_session_list --> pkg_tools
pkg_tool_session_list --> pkg_workspace
pkg_acp --> pkg_agent
pkg_acp --> pkg_attachment
pkg_acp --> pkg_llm
@@ -1373,12 +1382,6 @@ flowchart TD
pkg_tool_subagent --> pkg_subagent
pkg_tool_subagent --> pkg_system_prompt
pkg_tool_subagent --> pkg_tools
pkg_tool_subagent_control --> pkg_agent
pkg_tool_subagent_control --> pkg_llm
pkg_tool_subagent_control --> pkg_session
pkg_tool_subagent_control --> pkg_subagent
pkg_tool_subagent_control --> pkg_system_prompt
pkg_tool_subagent_control --> pkg_tools
pkg_api_session_controller --> pkg_agent
pkg_api_session_controller --> pkg_agent_default_model
pkg_api_session_controller --> pkg_agent_preset_registry
@@ -1506,6 +1509,13 @@ flowchart TD
pkg_workflow_ptc --> pkg_tools
pkg_workflow_ptc --> pkg_workflow
pkg_workflow_ptc --> pkg_working_directory
pkg_tool_subagent_control --> pkg_agent
pkg_tool_subagent_control --> pkg_agent_team
pkg_tool_subagent_control --> pkg_llm
pkg_tool_subagent_control --> pkg_session
pkg_tool_subagent_control --> pkg_subagent
pkg_tool_subagent_control --> pkg_system_prompt
pkg_tool_subagent_control --> pkg_tools
pkg_schedule --> pkg_agent
pkg_schedule --> pkg_api_session_controller
pkg_schedule --> pkg_llm
@@ -1632,6 +1642,7 @@ flowchart TD
| [`client-ui-brand-official`](../packages/client/ui-brand-official) | `client` | — |
| [`client-ui-chat`](../packages/client/ui-chat) | `client` | — |
| [`client-ui-commands`](../packages/client/ui-commands) | `client` | — |
| [`client-ui-connector-account`](../packages/client/ui-connector-account) | `client` | — |
| [`client-ui-context-menu`](../packages/client/ui-context-menu) | `client` | — |
| [`client-ui-conversation`](../packages/client/ui-conversation) | `client` | — |
| [`client-ui-deliverables`](../packages/client/ui-deliverables) | `client` | — |
@@ -1920,6 +1931,7 @@ flowchart TD
| [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval), [`util-time`](../packages/util/time), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`attachment`](../packages/attachment/attachment), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools) |
| [`session-query-sqlite`](../packages/session-query/session-query-sqlite) | `session-query` | [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query) |
| [`tool-session-list`](../packages/session-query/tool-session-list) | `session-query` | [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`tools`](../packages/core/tools), [`workspace`](../packages/workspace/workspace) |
| [`acp`](../packages/acp/acp) | `acp` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`mcp-client`](../packages/mcp/mcp-client), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`token-meter`](../packages/llm/token-meter), [`user-approval`](../packages/interaction/user-approval) |
| [`plugin-manager`](../packages/boot/plugin-manager) | `boot` | [`error`](../packages/util/error), [`hmr`](../packages/boot/hmr), [`host-plugin-inventory`](../packages/host/plugin-inventory), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`subprocess`](../packages/subprocess/subprocess), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval) |
| [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | `compaction` | [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) |
@@ -1938,7 +1950,6 @@ flowchart TD
| [`subagent-fork-in-process`](../packages/subagent/subagent-fork-in-process) | `subagent` | [`agent`](../packages/core/agent), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent) |
| [`subagent-spawn-in-process`](../packages/subagent/subagent-spawn-in-process) | `subagent` | [`subagent`](../packages/subagent/subagent) |
| [`tool-subagent`](../packages/subagent/tool-subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`api-session-controller`](../packages/api/session-controller) | `api` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`api-gateway`](../packages/api/gateway), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-file-upload`](../packages/client/file-upload), [`commands`](../packages/interaction/commands), [`credentials`](../packages/credentials/credentials), [`file-reference`](../packages/context/file-reference), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`native-command`](../packages/util/native-command), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`settings`](../packages/settings/settings), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol), [`typert-registry`](../packages/typert/registry), [`util-time`](../packages/util/time), [`util-values`](../packages/util/values), [`util-workspace-path`](../packages/util/workspace-path), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
| [`plugin-market`](../packages/boot/plugin-market) | `boot` | [`error`](../packages/util/error), [`plugin-manager`](../packages/boot/plugin-manager), [`settings`](../packages/settings/settings), [`subprocess`](../packages/subprocess/subprocess), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol) |
| [`headless`](../packages/bundle/headless) | `bundle` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval) |
@@ -1954,6 +1965,7 @@ flowchart TD
| [`sdk-protocol`](../packages/sdk/protocol) | `sdk` | [`commands`](../packages/interaction/commands), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) |
| [`agent-team`](../packages/team/agent-team) | `team` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
| [`workflow-ptc`](../packages/workflow/workflow-ptc) | `workflow` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`ptc-runtime`](../packages/ptc-runtime/ptc-runtime), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow), [`working-directory`](../packages/session/working-directory) |
| [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | `subagent` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
| [`tool-agent-team`](../packages/team/tool-agent-team) | `team` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
+19 -7
View File
@@ -114,6 +114,7 @@ flowchart TD
pkg_session_log_export["session-log-export"]
pkg_session_query["session-query"]
pkg_session_query_sqlite["session-query-sqlite"]
pkg_tool_session_list["tool-session-list"]
end
subgraph group_acp["packages/acp"]
pkg_acp["acp"]
@@ -175,6 +176,7 @@ flowchart TD
pkg_client_ui_brand_official["client-ui-brand-official"]
pkg_client_ui_chat["client-ui-chat"]
pkg_client_ui_commands["client-ui-commands"]
pkg_client_ui_connector_account["client-ui-connector-account"]
pkg_client_ui_context_menu["client-ui-context-menu"]
pkg_client_ui_conversation["client-ui-conversation"]
pkg_client_ui_deliverables["client-ui-deliverables"]
@@ -1265,6 +1267,13 @@ flowchart TD
pkg_session_query_sqlite --> pkg_session
pkg_session_query_sqlite --> pkg_session_persistence
pkg_session_query_sqlite --> pkg_session_query
pkg_tool_session_list --> pkg_session
pkg_tool_session_list --> pkg_session_projection
pkg_tool_session_list --> pkg_session_projection_cache
pkg_tool_session_list --> pkg_session_query
pkg_tool_session_list --> pkg_session_title
pkg_tool_session_list --> pkg_tools
pkg_tool_session_list --> pkg_workspace
pkg_acp --> pkg_agent
pkg_acp --> pkg_attachment
pkg_acp --> pkg_llm
@@ -1375,12 +1384,6 @@ flowchart TD
pkg_tool_subagent --> pkg_subagent
pkg_tool_subagent --> pkg_system_prompt
pkg_tool_subagent --> pkg_tools
pkg_tool_subagent_control --> pkg_agent
pkg_tool_subagent_control --> pkg_llm
pkg_tool_subagent_control --> pkg_session
pkg_tool_subagent_control --> pkg_subagent
pkg_tool_subagent_control --> pkg_system_prompt
pkg_tool_subagent_control --> pkg_tools
pkg_api_session_controller --> pkg_agent
pkg_api_session_controller --> pkg_agent_default_model
pkg_api_session_controller --> pkg_agent_preset_registry
@@ -1508,6 +1511,13 @@ flowchart TD
pkg_workflow_ptc --> pkg_tools
pkg_workflow_ptc --> pkg_workflow
pkg_workflow_ptc --> pkg_working_directory
pkg_tool_subagent_control --> pkg_agent
pkg_tool_subagent_control --> pkg_agent_team
pkg_tool_subagent_control --> pkg_llm
pkg_tool_subagent_control --> pkg_session
pkg_tool_subagent_control --> pkg_subagent
pkg_tool_subagent_control --> pkg_system_prompt
pkg_tool_subagent_control --> pkg_tools
pkg_schedule --> pkg_agent
pkg_schedule --> pkg_api_session_controller
pkg_schedule --> pkg_llm
@@ -1634,6 +1644,7 @@ flowchart TD
| [`client-ui-brand-official`](../packages/client/ui-brand-official) | `client` | — |
| [`client-ui-chat`](../packages/client/ui-chat) | `client` | — |
| [`client-ui-commands`](../packages/client/ui-commands) | `client` | — |
| [`client-ui-connector-account`](../packages/client/ui-connector-account) | `client` | — |
| [`client-ui-context-menu`](../packages/client/ui-context-menu) | `client` | — |
| [`client-ui-conversation`](../packages/client/ui-conversation) | `client` | — |
| [`client-ui-deliverables`](../packages/client/ui-deliverables) | `client` | — |
@@ -1922,6 +1933,7 @@ flowchart TD
| [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval), [`util-time`](../packages/util/time), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`attachment`](../packages/attachment/attachment), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools) |
| [`session-query-sqlite`](../packages/session-query/session-query-sqlite) | `session-query` | [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query) |
| [`tool-session-list`](../packages/session-query/tool-session-list) | `session-query` | [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`tools`](../packages/core/tools), [`workspace`](../packages/workspace/workspace) |
| [`acp`](../packages/acp/acp) | `acp` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`mcp-client`](../packages/mcp/mcp-client), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`token-meter`](../packages/llm/token-meter), [`user-approval`](../packages/interaction/user-approval) |
| [`plugin-manager`](../packages/boot/plugin-manager) | `boot` | [`error`](../packages/util/error), [`hmr`](../packages/boot/hmr), [`host-plugin-inventory`](../packages/host/plugin-inventory), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`subprocess`](../packages/subprocess/subprocess), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval) |
| [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | `compaction` | [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) |
@@ -1940,7 +1952,6 @@ flowchart TD
| [`subagent-fork-in-process`](../packages/subagent/subagent-fork-in-process) | `subagent` | [`agent`](../packages/core/agent), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent) |
| [`subagent-spawn-in-process`](../packages/subagent/subagent-spawn-in-process) | `subagent` | [`subagent`](../packages/subagent/subagent) |
| [`tool-subagent`](../packages/subagent/tool-subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`api-session-controller`](../packages/api/session-controller) | `api` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`api-gateway`](../packages/api/gateway), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-file-upload`](../packages/client/file-upload), [`commands`](../packages/interaction/commands), [`credentials`](../packages/credentials/credentials), [`file-reference`](../packages/context/file-reference), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`native-command`](../packages/util/native-command), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`settings`](../packages/settings/settings), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol), [`typert-registry`](../packages/typert/registry), [`util-time`](../packages/util/time), [`util-values`](../packages/util/values), [`util-workspace-path`](../packages/util/workspace-path), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
| [`plugin-market`](../packages/boot/plugin-market) | `boot` | [`error`](../packages/util/error), [`plugin-manager`](../packages/boot/plugin-manager), [`settings`](../packages/settings/settings), [`subprocess`](../packages/subprocess/subprocess), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol) |
| [`headless`](../packages/bundle/headless) | `bundle` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval) |
@@ -1956,6 +1967,7 @@ flowchart TD
| [`sdk-protocol`](../packages/sdk/protocol) | `sdk` | [`commands`](../packages/interaction/commands), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) |
| [`agent-team`](../packages/team/agent-team) | `team` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
| [`workflow-ptc`](../packages/workflow/workflow-ptc) | `workflow` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`ptc-runtime`](../packages/ptc-runtime/ptc-runtime), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow), [`working-directory`](../packages/session/working-directory) |
| [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | `subagent` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
| [`tool-agent-team`](../packages/team/tool-agent-team) | `team` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
+8 -8
View File
@@ -183,8 +183,8 @@
en: 20645a60e921f012
zh: 7141cafe3a0e71d7
/session-persistence-event-catalog/events/session/session-title-log-only:
en: 6c6a27578dff5828
zh: 9a5add2bc0df2d0a
en: 5775e52a72c0ce94
zh: fa211a35b4660c10
/session-persistence-event-catalog/events/session/session-title-llm-request-log-only:
en: 59b02baa2be32ca0
zh: 3637c99652ca89cf
@@ -1371,8 +1371,8 @@
en: 7660c41e4129b466
zh: bcbb1b15cb872214
/session-persistence-event-catalog/resolved-persistence-types/string:
en: 0bd8cec4019a5ad5
zh: c6cc79ce5aa844c4
en: 0c7d65a7628869fb
zh: be140c5bd89db538
/session-persistence-event-catalog/resolved-persistence-types/string~2:
en: 0089620bf4638263
zh: 1922bef1713094bb
@@ -1764,8 +1764,8 @@
en: f58bccca3df9c2ad
zh: 5c92b6edeb7ce020
/session-persistence-event-catalog/resolved-persistence-types/kind-retry:
en: c628d0575f81407a
zh: d9a70ce1e05dcce8
en: 898f27c058097895
zh: bbbcf08ad8ba3a32
/session-persistence-event-catalog/resolved-persistence-types/kind-runtime-context:
en: 68b5598e21cf8ba2
zh: 95ef1685af64a5f4
@@ -1905,8 +1905,8 @@
en: 4e102391d685eff5
zh: 9762243a13014f3d
/session-persistence-event-catalog/resolved-persistence-types/kind-user:
en: 808d28208287e843
zh: 18a8d63978c984a7
en: 156e57c019aa1b28
zh: a1629b267f7cc713
/session-persistence-event-catalog/resolved-persistence-types/kind-user-approval:
en: a52d2dfbaf844127
zh: 4c5306ca40f20873
+4 -4
View File
@@ -865,7 +865,7 @@ Source: [`packages/core/session/src/types.ts:435`](../packages/core/session/src/
Types: [SessionTitleEventData](subsystems/session-title.md)
Source: [`packages/session/session-title/src/index.ts:77`](../packages/session/session-title/src/index.ts)
Source: [`packages/session/session-title/src/index.ts:78`](../packages/session/session-title/src/index.ts)
<a id="sessiontitle-llm-request--log-only"></a>
@@ -5666,7 +5666,7 @@ Array of `number`.
SHA-256: `4cd48f3e5108bd6ebedf7301c3638839b8b2b9db8dbd493974177fbdeb91a01b`
Sources: [`packages/api/session-controller/src/types.ts:391`](../packages/api/session-controller/src/types.ts) · [`packages/attachment/attachment/src/brand.ts:6`](../packages/attachment/attachment/src/brand.ts) · [`packages/compaction/compaction/src/brand.ts:4`](../packages/compaction/compaction/src/brand.ts) · [`packages/core/session/src/types.ts:21`](../packages/core/session/src/types.ts) · [`packages/experimental/webhook/src/brand.ts:12`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:6`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:9`](../packages/experimental/webhook/src/brand.ts) · [`packages/feedback/message-feedback/src/types.ts:14`](../packages/feedback/message-feedback/src/types.ts) · [`packages/goal/goal/src/types.ts:17`](../packages/goal/goal/src/types.ts) · [`packages/interaction/commands/src/brand.ts:22`](../packages/interaction/commands/src/brand.ts) · [`packages/interaction/user-approval/src/types.ts:17`](../packages/interaction/user-approval/src/types.ts) · [`packages/jobs/jobs/src/brand.ts:9`](../packages/jobs/jobs/src/brand.ts) · [`packages/llm/llm-retry/src/brand.ts:4`](../packages/llm/llm-retry/src/brand.ts) · [`packages/llm/llm/src/brand.ts:16`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:31`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:43`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:67`](../packages/llm/llm/src/brand.ts) · [`packages/schedule/schedule/src/types.ts:14`](../packages/schedule/schedule/src/types.ts) · [`packages/session/session-title/src/types.ts:17`](../packages/session/session-title/src/types.ts) · [`packages/team/agent-team/src/types.ts:20`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:32`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:8`](../packages/team/agent-team/src/types.ts) · [`packages/workflow/workflow/src/types.ts:14`](../packages/workflow/workflow/src/types.ts)
Sources: [`packages/api/session-controller/src/types.ts:383`](../packages/api/session-controller/src/types.ts) · [`packages/attachment/attachment/src/brand.ts:6`](../packages/attachment/attachment/src/brand.ts) · [`packages/compaction/compaction/src/brand.ts:4`](../packages/compaction/compaction/src/brand.ts) · [`packages/core/session/src/types.ts:21`](../packages/core/session/src/types.ts) · [`packages/experimental/webhook/src/brand.ts:12`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:6`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:9`](../packages/experimental/webhook/src/brand.ts) · [`packages/feedback/message-feedback/src/types.ts:14`](../packages/feedback/message-feedback/src/types.ts) · [`packages/goal/goal/src/types.ts:17`](../packages/goal/goal/src/types.ts) · [`packages/interaction/commands/src/brand.ts:22`](../packages/interaction/commands/src/brand.ts) · [`packages/interaction/user-approval/src/types.ts:17`](../packages/interaction/user-approval/src/types.ts) · [`packages/jobs/jobs/src/brand.ts:9`](../packages/jobs/jobs/src/brand.ts) · [`packages/llm/llm-retry/src/brand.ts:4`](../packages/llm/llm-retry/src/brand.ts) · [`packages/llm/llm/src/brand.ts:16`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:31`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:43`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:67`](../packages/llm/llm/src/brand.ts) · [`packages/schedule/schedule/src/types.ts:14`](../packages/schedule/schedule/src/types.ts) · [`packages/session/session-title/src/types.ts:17`](../packages/session/session-title/src/types.ts) · [`packages/team/agent-team/src/types.ts:20`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:32`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:8`](../packages/team/agent-team/src/types.ts) · [`packages/workflow/workflow/src/types.ts:14`](../packages/workflow/workflow/src/types.ts)
`string`
@@ -7312,7 +7312,7 @@ SHA-256: `db06ef35b27a38425046b2228fa6bce9582abe140d781d363137eb2f4d233a1c`
SHA-256: `8f1062573ea9184129dfdec43df1e8136eb5808746fd809bf6b539f3fd11362e`
Sources: [`packages/api/session-controller/src/types.ts:402`](../packages/api/session-controller/src/types.ts)
Sources: [`packages/api/session-controller/src/types.ts:394`](../packages/api/session-controller/src/types.ts)
| Property | Presence | Type |
|---|---|---|
@@ -7845,7 +7845,7 @@ Sources: [`packages/core/tools/src/index.ts:28`](../packages/core/tools/src/inde
SHA-256: `a4afec59b75aad5d13ef82d6931f35cc2d98918503916cf069355b77c5e42302`
Sources: [`packages/api/session-controller/src/types.ts:400`](../packages/api/session-controller/src/types.ts)
Sources: [`packages/api/session-controller/src/types.ts:392`](../packages/api/session-controller/src/types.ts)
| Property | Presence | Type |
|---|---|---|
+4 -4
View File
@@ -867,7 +867,7 @@ export type SessionEvent<T extends SessionEventType = SessionEventType> = {
类型:[SessionTitleEventData](subsystems/session-title.zh.md)
来源:[`packages/session/session-title/src/index.ts:77`](../packages/session/session-title/src/index.ts)
来源:[`packages/session/session-title/src/index.ts:78`](../packages/session/session-title/src/index.ts)
<a id="sessiontitle-llm-request--log-only"></a>
@@ -5668,7 +5668,7 @@ SHA-256: `5d03ba38734809bcbd2a55221bd938b3b3fc34b49bb686c6113e9e4931e3aa78`
SHA-256: `4cd48f3e5108bd6ebedf7301c3638839b8b2b9db8dbd493974177fbdeb91a01b`
来源:[`packages/api/session-controller/src/types.ts:391`](../packages/api/session-controller/src/types.ts) · [`packages/attachment/attachment/src/brand.ts:6`](../packages/attachment/attachment/src/brand.ts) · [`packages/compaction/compaction/src/brand.ts:4`](../packages/compaction/compaction/src/brand.ts) · [`packages/core/session/src/types.ts:21`](../packages/core/session/src/types.ts) · [`packages/experimental/webhook/src/brand.ts:12`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:6`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:9`](../packages/experimental/webhook/src/brand.ts) · [`packages/feedback/message-feedback/src/types.ts:14`](../packages/feedback/message-feedback/src/types.ts) · [`packages/goal/goal/src/types.ts:17`](../packages/goal/goal/src/types.ts) · [`packages/interaction/commands/src/brand.ts:22`](../packages/interaction/commands/src/brand.ts) · [`packages/interaction/user-approval/src/types.ts:17`](../packages/interaction/user-approval/src/types.ts) · [`packages/jobs/jobs/src/brand.ts:9`](../packages/jobs/jobs/src/brand.ts) · [`packages/llm/llm-retry/src/brand.ts:4`](../packages/llm/llm-retry/src/brand.ts) · [`packages/llm/llm/src/brand.ts:16`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:31`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:43`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:67`](../packages/llm/llm/src/brand.ts) · [`packages/schedule/schedule/src/types.ts:14`](../packages/schedule/schedule/src/types.ts) · [`packages/session/session-title/src/types.ts:17`](../packages/session/session-title/src/types.ts) · [`packages/team/agent-team/src/types.ts:20`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:32`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:8`](../packages/team/agent-team/src/types.ts) · [`packages/workflow/workflow/src/types.ts:14`](../packages/workflow/workflow/src/types.ts)
来源:[`packages/api/session-controller/src/types.ts:383`](../packages/api/session-controller/src/types.ts) · [`packages/attachment/attachment/src/brand.ts:6`](../packages/attachment/attachment/src/brand.ts) · [`packages/compaction/compaction/src/brand.ts:4`](../packages/compaction/compaction/src/brand.ts) · [`packages/core/session/src/types.ts:21`](../packages/core/session/src/types.ts) · [`packages/experimental/webhook/src/brand.ts:12`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:6`](../packages/experimental/webhook/src/brand.ts) · [`packages/experimental/webhook/src/brand.ts:9`](../packages/experimental/webhook/src/brand.ts) · [`packages/feedback/message-feedback/src/types.ts:14`](../packages/feedback/message-feedback/src/types.ts) · [`packages/goal/goal/src/types.ts:17`](../packages/goal/goal/src/types.ts) · [`packages/interaction/commands/src/brand.ts:22`](../packages/interaction/commands/src/brand.ts) · [`packages/interaction/user-approval/src/types.ts:17`](../packages/interaction/user-approval/src/types.ts) · [`packages/jobs/jobs/src/brand.ts:9`](../packages/jobs/jobs/src/brand.ts) · [`packages/llm/llm-retry/src/brand.ts:4`](../packages/llm/llm-retry/src/brand.ts) · [`packages/llm/llm/src/brand.ts:16`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:31`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:43`](../packages/llm/llm/src/brand.ts) · [`packages/llm/llm/src/brand.ts:67`](../packages/llm/llm/src/brand.ts) · [`packages/schedule/schedule/src/types.ts:14`](../packages/schedule/schedule/src/types.ts) · [`packages/session/session-title/src/types.ts:17`](../packages/session/session-title/src/types.ts) · [`packages/team/agent-team/src/types.ts:20`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:32`](../packages/team/agent-team/src/types.ts) · [`packages/team/agent-team/src/types.ts:8`](../packages/team/agent-team/src/types.ts) · [`packages/workflow/workflow/src/types.ts:14`](../packages/workflow/workflow/src/types.ts)
`string`
@@ -7314,7 +7314,7 @@ SHA-256: `db06ef35b27a38425046b2228fa6bce9582abe140d781d363137eb2f4d233a1c`
SHA-256: `8f1062573ea9184129dfdec43df1e8136eb5808746fd809bf6b539f3fd11362e`
来源:[`packages/api/session-controller/src/types.ts:402`](../packages/api/session-controller/src/types.ts)
来源:[`packages/api/session-controller/src/types.ts:394`](../packages/api/session-controller/src/types.ts)
| 属性 | 存在性 | 类型 |
|---|---|---|
@@ -7847,7 +7847,7 @@ SHA-256: `8fcb0b44a575e998665c053643d1ab04c82f39253ebd190ac0c975b78e40b543`
SHA-256: `a4afec59b75aad5d13ef82d6931f35cc2d98918503916cf069355b77c5e42302`
来源:[`packages/api/session-controller/src/types.ts:400`](../packages/api/session-controller/src/types.ts)
来源:[`packages/api/session-controller/src/types.ts:392`](../packages/api/session-controller/src/types.ts)
| 属性 | 存在性 | 类型 |
|---|---|---|
+3 -3
View File
@@ -263,7 +263,7 @@
{"digest":"4b259f7f8f0a44ad5e90b70a73553ced1df27012d126921d397ff403b6c86731","names":["packages/llm/llm/src/message.ts#ToolResultMessage"],"sources":["packages/llm/llm/src/message.ts:172"]},
{"digest":"4b7ddaf3710b88ff9b8df66304f5f97bf03688fd19730eedc2e9535203c820ea","names":[],"sources":[]},
{"digest":"4bb451330ff699f36b45539ceb0eb2606ead72084e2c5bb637c36cc80e2252db","names":[],"sources":["packages/core/session/src/types.ts:198"]},
{"digest":"4cd48f3e5108bd6ebedf7301c3638839b8b2b9db8dbd493974177fbdeb91a01b","names":["packages/api/session-controller/src/types.ts#SessionRequestId","packages/attachment/attachment/src/brand.ts#AttachmentId","packages/compaction/compaction/src/brand.ts#CompactionId","packages/core/session/src/types.ts#SessionId","packages/experimental/webhook/src/brand.ts#WebhookDeliveryId","packages/experimental/webhook/src/brand.ts#WebhookRuleId","packages/experimental/webhook/src/brand.ts#WebhookSourceId","packages/feedback/message-feedback/src/types.ts#MessageFeedbackVersion","packages/goal/goal/src/types.ts#GoalId","packages/interaction/commands/src/brand.ts#CommandId","packages/interaction/user-approval/src/types.ts#ApprovalRequestId","packages/jobs/jobs/src/brand.ts#JobId","packages/llm/llm-retry/src/brand.ts#RetryId","packages/llm/llm/src/brand.ts#MessageId","packages/llm/llm/src/brand.ts#ProviderRequestId","packages/llm/llm/src/brand.ts#ReasoningEffortId","packages/llm/llm/src/brand.ts#ToolCallId","packages/schedule/schedule/src/types.ts#ScheduleId","packages/session/session-title/src/types.ts#SessionTitleProviderId","packages/team/agent-team/src/types.ts#TeamId","packages/team/agent-team/src/types.ts#TeamMessageId","packages/team/agent-team/src/types.ts#TeamTaskId","packages/workflow/workflow/src/types.ts#WorkflowRunId"],"sources":["packages/api/session-controller/src/types.ts:391","packages/attachment/attachment/src/brand.ts:6","packages/compaction/compaction/src/brand.ts:4","packages/core/session/src/types.ts:21","packages/experimental/webhook/src/brand.ts:12","packages/experimental/webhook/src/brand.ts:6","packages/experimental/webhook/src/brand.ts:9","packages/feedback/message-feedback/src/types.ts:14","packages/goal/goal/src/types.ts:17","packages/interaction/commands/src/brand.ts:22","packages/interaction/user-approval/src/types.ts:17","packages/jobs/jobs/src/brand.ts:9","packages/llm/llm-retry/src/brand.ts:4","packages/llm/llm/src/brand.ts:16","packages/llm/llm/src/brand.ts:31","packages/llm/llm/src/brand.ts:43","packages/llm/llm/src/brand.ts:67","packages/schedule/schedule/src/types.ts:14","packages/session/session-title/src/types.ts:17","packages/team/agent-team/src/types.ts:20","packages/team/agent-team/src/types.ts:32","packages/team/agent-team/src/types.ts:8","packages/workflow/workflow/src/types.ts:14"]},
{"digest":"4cd48f3e5108bd6ebedf7301c3638839b8b2b9db8dbd493974177fbdeb91a01b","names":["packages/api/session-controller/src/types.ts#SessionRequestId","packages/attachment/attachment/src/brand.ts#AttachmentId","packages/compaction/compaction/src/brand.ts#CompactionId","packages/core/session/src/types.ts#SessionId","packages/experimental/webhook/src/brand.ts#WebhookDeliveryId","packages/experimental/webhook/src/brand.ts#WebhookRuleId","packages/experimental/webhook/src/brand.ts#WebhookSourceId","packages/feedback/message-feedback/src/types.ts#MessageFeedbackVersion","packages/goal/goal/src/types.ts#GoalId","packages/interaction/commands/src/brand.ts#CommandId","packages/interaction/user-approval/src/types.ts#ApprovalRequestId","packages/jobs/jobs/src/brand.ts#JobId","packages/llm/llm-retry/src/brand.ts#RetryId","packages/llm/llm/src/brand.ts#MessageId","packages/llm/llm/src/brand.ts#ProviderRequestId","packages/llm/llm/src/brand.ts#ReasoningEffortId","packages/llm/llm/src/brand.ts#ToolCallId","packages/schedule/schedule/src/types.ts#ScheduleId","packages/session/session-title/src/types.ts#SessionTitleProviderId","packages/team/agent-team/src/types.ts#TeamId","packages/team/agent-team/src/types.ts#TeamMessageId","packages/team/agent-team/src/types.ts#TeamTaskId","packages/workflow/workflow/src/types.ts#WorkflowRunId"],"sources":["packages/api/session-controller/src/types.ts:383","packages/attachment/attachment/src/brand.ts:6","packages/compaction/compaction/src/brand.ts:4","packages/core/session/src/types.ts:21","packages/experimental/webhook/src/brand.ts:12","packages/experimental/webhook/src/brand.ts:6","packages/experimental/webhook/src/brand.ts:9","packages/feedback/message-feedback/src/types.ts:14","packages/goal/goal/src/types.ts:17","packages/interaction/commands/src/brand.ts:22","packages/interaction/user-approval/src/types.ts:17","packages/jobs/jobs/src/brand.ts:9","packages/llm/llm-retry/src/brand.ts:4","packages/llm/llm/src/brand.ts:16","packages/llm/llm/src/brand.ts:31","packages/llm/llm/src/brand.ts:43","packages/llm/llm/src/brand.ts:67","packages/schedule/schedule/src/types.ts:14","packages/session/session-title/src/types.ts:17","packages/team/agent-team/src/types.ts:20","packages/team/agent-team/src/types.ts:32","packages/team/agent-team/src/types.ts:8","packages/workflow/workflow/src/types.ts:14"]},
{"digest":"4d60dddaa65d3da8d4cd014d85ce3d2c2875664dd0433e331d8e9d395289686b","names":["packages/experimental/liveshare/src/host/viewer-principal.ts#ShareViewerPrincipal"],"sources":["packages/experimental/liveshare/src/host/viewer-principal.ts:24"]},
{"digest":"4e011753f8263f436efaabfbb3b4db53a98fc55342c5ded2daf7208b217be159","names":[],"sources":[]},
{"digest":"4e44c9118152f6829634bfd508e47669ab0497caffa380c94b4be91f9390d35d","names":[],"sources":[]},
@@ -427,7 +427,7 @@
{"digest":"8e611bf46821e5003a1605a73560a6f56388295149d449dfe2142d5ec335f29c","names":["packages/llm/llm/src/types.ts#ToolAdditionBlock"],"sources":["packages/llm/llm/src/types.ts:122"]},
{"digest":"8e8155594e07812356b67d732196dda894b0f9c91a5969d51612cf490b0a016d","names":[],"sources":[]},
{"digest":"8e8e91646a5cae3fc78f7532a0013ff2088ae47077642c2edd507a508209b8af","names":["packages/schedule/schedule/src/types.ts#OneShotScheduleDispatchChange"],"sources":["packages/schedule/schedule/src/types.ts:213"]},
{"digest":"8f1062573ea9184129dfdec43df1e8136eb5808746fd809bf6b539f3fd11362e","names":[],"sources":["packages/api/session-controller/src/types.ts:402"]},
{"digest":"8f1062573ea9184129dfdec43df1e8136eb5808746fd809bf6b539f3fd11362e","names":[],"sources":["packages/api/session-controller/src/types.ts:394"]},
{"digest":"8f324cea3916c0517261e88167def8efb3a9994c1135e23d40ed9fd48f8c7bd4","names":[],"sources":[]},
{"digest":"8f6d609794bf5afc01d7ccf3e03811d32f4b8047f58a2c9a98db0154c2ad7cb9","names":[],"sources":[]},
{"digest":"8faed5b52ab2d2df40b94a926d0f0faa75280bddcc4b17b6bdd9c8bfed7c34b5","names":[],"sources":[]},
@@ -481,7 +481,7 @@
{"digest":"a3c6f1ea38e9a61d7a9706057ba65aabe02dfe6d9dd90d4736aa62325d874531","names":[],"sources":[]},
{"digest":"a3edd1efd1fef21b72c55e213c8a8b24196b091abde2b89db52be0b2aaae3cfa","names":[],"sources":[]},
{"digest":"a43327a1739c3fa477f32981071fef7d8ba6ae5f32a84fd70f547b2eee59e93e","names":[],"sources":[]},
{"digest":"a4afec59b75aad5d13ef82d6931f35cc2d98918503916cf069355b77c5e42302","names":[],"sources":["packages/api/session-controller/src/types.ts:400"]},
{"digest":"a4afec59b75aad5d13ef82d6931f35cc2d98918503916cf069355b77c5e42302","names":[],"sources":["packages/api/session-controller/src/types.ts:392"]},
{"digest":"a6567ccb2e530606b775371eb4fa31468d72084339968e8b0440a516a23b39dc","names":[],"sources":[]},
{"digest":"a6b41f5bede8094d7bf635be5d69b1bd7a25e006ca9cf9415bceb9322f1a7feb","names":["packages/experimental/hook-protocol/src/types.ts#HookDialect"],"sources":["packages/experimental/hook-protocol/src/types.ts:48"]},
{"digest":"a6da9ad5d42ae83a6833a8288b076688e8e0801633ea36cbdd8a30a6d9f3160c","names":["packages/workflow/tool-workflow/src/types.ts#ToolWorkflowRunStartData"],"sources":["packages/workflow/tool-workflow/src/types.ts:14"]},
+44
View File
@@ -143,6 +143,50 @@ async edit( entry: Entry, change: (current: Record<string, unknown>, inherited:
Source: [`packages/boot/config-editor/src/index.ts`](../../packages/boot/config-editor/src/index.ts)
<a id="ctxconnectoraccounts--connectoraccounts"></a>
### `ctx.connectorAccounts` — `ConnectorAccounts`
Holds the registered accounts and serves them to the Plugins page.
```ts cordis-catalog
/**
* Show one account on the Plugins page for as long as the returned disposer has not run.
* @param registration - the account key, its bundle package, the account source, the page operations, and the
* presentation.
* @returns an idempotent disposer that withdraws the account.
* @throws when another account already uses the key or the package.
*/
register<View extends AnyConnectorAccountView>(registration: ConnectorAccountRegistration<View>): () => void
/**
* Follow every registered account; each new subscriber starts a check of each account that runs no operation.
* @param signal - the Client's observation lifetime; disposal also ends the stream.
* @returns the current accounts, then each changed set, coalescing changes that arrive before the next read.
*/
@Remote({ mode: 'stream' }) async *watch(signal: AbortSignal): AsyncIterable<ConnectorAccountsView>
/**
* Start one of the operations the account registered as page actions.
* @param key - the account key.
* @param operation - the operation kind.
* @returns the operation identity once the account's source has started it.
* @throws for an unknown account or operation, or whatever the account's source refuses, such as a second operation.
*/
@Remote async start(key: string, operation: string): Promise<ConnectorOperationId>
/**
* Cancel one operation while its phase is cancellable, and wait for it to settle.
* @param key - the account key.
* @param id - the operation to cancel; a finished one or a phase that is not cancellable is ignored.
* @returns after the operation settles, or at once when nothing is cancelled.
* @throws for an unknown account.
*/
@Remote cancel(key: string, id: ConnectorOperationId): Promise<void>
```
Source: [`packages/client/ui-connector-account/src/index.ts`](../../packages/client/ui-connector-account/src/index.ts)
<a id="ctxheadlessstartup--headlessstartupvalues"></a>
### `ctx.headlessStartup` — `HeadlessStartupValues`
+44
View File
@@ -143,6 +143,50 @@ async edit( entry: Entry, change: (current: Record<string, unknown>, inherited:
Source: [`packages/boot/config-editor/src/index.ts`](../../packages/boot/config-editor/src/index.ts)
<a id="ctxconnectoraccounts--connectoraccounts"></a>
### `ctx.connectorAccounts` — `ConnectorAccounts`
Holds the registered accounts and serves them to the Plugins page.
```ts cordis-catalog
/**
* Show one account on the Plugins page for as long as the returned disposer has not run.
* @param registration - the account key, its bundle package, the account source, the page operations, and the
* presentation.
* @returns an idempotent disposer that withdraws the account.
* @throws when another account already uses the key or the package.
*/
register<View extends AnyConnectorAccountView>(registration: ConnectorAccountRegistration<View>): () => void
/**
* Follow every registered account; each new subscriber starts a check of each account that runs no operation.
* @param signal - the Client's observation lifetime; disposal also ends the stream.
* @returns the current accounts, then each changed set, coalescing changes that arrive before the next read.
*/
@Remote({ mode: 'stream' }) async *watch(signal: AbortSignal): AsyncIterable<ConnectorAccountsView>
/**
* Start one of the operations the account registered as page actions.
* @param key - the account key.
* @param operation - the operation kind.
* @returns the operation identity once the account's source has started it.
* @throws for an unknown account or operation, or whatever the account's source refuses, such as a second operation.
*/
@Remote async start(key: string, operation: string): Promise<ConnectorOperationId>
/**
* Cancel one operation while its phase is cancellable, and wait for it to settle.
* @param key - the account key.
* @param id - the operation to cancel; a finished one or a phase that is not cancellable is ignored.
* @returns after the operation settles, or at once when nothing is cancelled.
* @throws for an unknown account.
*/
@Remote cancel(key: string, id: ConnectorOperationId): Promise<void>
```
Source: [`packages/client/ui-connector-account/src/index.ts`](../../packages/client/ui-connector-account/src/index.ts)
<a id="ctxheadlessstartup--headlessstartupvalues"></a>
### `ctx.headlessStartup` — `HeadlessStartupValues`
+7
View File
@@ -381,6 +381,13 @@ Unified live-preferred session query service.
Exact reads, filters, and traces are backend-independent concrete behavior. A backend implements full-text observation, reconciliation, ranking, cursor generations, and query execution on the same `ctx.sessionQuery` service.
```ts cordis-catalog
/**
* Read the metadata that summarizes one live or prepared Session in a Session list.
* @param session - live or prepared Session to summarize.
* @returns whether the Session has no turn, and its latest human-authored prompt time.
*/
getListMetadata(session: Session): SessionListMetadata
/**
* Observe one exact live or prepared Session without a persistence listing preflight.
* @param sessionId - logical Session identity.
+7
View File
@@ -381,6 +381,13 @@ Unified live-preferred session query service.
Exact reads, filters, and traces are backend-independent concrete behavior. A backend implements full-text observation, reconciliation, ranking, cursor generations, and query execution on the same `ctx.sessionQuery` service.
```ts cordis-catalog
/**
* Read the metadata that summarizes one live or prepared Session in a Session list.
* @param session - live or prepared Session to summarize.
* @returns whether the Session has no turn, and its latest human-authored prompt time.
*/
getListMetadata(session: Session): SessionListMetadata
/**
* Observe one exact live or prepared Session without a persistence listing preflight.
* @param sessionId - logical Session identity.
+2 -2
View File
@@ -3,8 +3,8 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/workspace.md
/workspaces:
en: 183fd2f466e3279c
zh: 6e79009b7294c240
en: 70865308120d0b14
zh: fe5d7406141657e1
/workspaces/identity:
en: d61a7e78bbc1fb56
zh: 8397869f70cd5b28
+7 -1
View File
@@ -2,7 +2,7 @@
English | [中文](workspace.zh.md)
A workspace is the persistent record of a directory the user works in: a stable id over a canonical path, a display title, and the ordered account of sessions that belong to it. The subsystem is one package ([dsh-workspace](../../packages/workspace/workspace), `ctx.workspaceRegistry`) — an optional host-side capability, not part of the agent-loop spine, and invisible to models (no tools, no prompt text, no session events). It stores its records through the [storage domain form](storage.md) and validates session membership against [`SessionHeader.cwd`](persistence.md#sessionheader--metadata-beside-the-log), so `storageDomain` and `sessionPersistence` are mandatory startup dependencies: an unavailable persistence peer leaves the plugin pending rather than being mistaken for an empty history. Design record: [domain KV storage Agent Note](../../.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.md); bootstrap and GUI ordering: [Workspace UI product-flow Agent Note](../../.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md).
A workspace is the persistent record of a directory the user works in: a stable id over a canonical path, a display title, and the ordered account of sessions that belong to it. The subsystem is one package ([dsh-workspace](../../packages/workspace/workspace), `ctx.workspaceRegistry`) — an optional host-side capability, not part of the agent-loop spine, and adds no model-visible surface of its own (no tools, no prompt text, no session events); the optional [listing tools](../../packages/session-query/tool-session-list) expose Workspace IDs, titles, and paths to models that are granted them. It stores its records through the [storage domain form](storage.md) and validates session membership against [`SessionHeader.cwd`](persistence.md#sessionheader--metadata-beside-the-log), so `storageDomain` and `sessionPersistence` are mandatory startup dependencies: an unavailable persistence peer leaves the plugin pending rather than being mistaken for an empty history. Design record: [domain KV storage Agent Note](../../.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.md); bootstrap and GUI ordering: [Workspace UI product-flow Agent Note](../../.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md).
Source: [`packages/workspace/workspace/src/types.ts`](../../packages/workspace/workspace/src/types.ts)
@@ -63,6 +63,12 @@ interface Workspace {
*/
readonly sessionIds: readonly SessionId[]
/**
* List the stored headers of the current members.
* @returns a new array with one header per entry of {@link sessionIds}, in the same order.
*/
getSessionHeaders(): readonly SessionHeader[]
/**
* Replace the display title durably.
* @param title - New title; any string, duplicates across workspaces allowed.
+7 -1
View File
@@ -2,7 +2,7 @@
[English](workspace.md) | 中文
工作区(workspace)是用户工作目录的持久记录:一个建立在规范路径之上的稳定 id、一个显示标题,以及归属于它的会话的有序账本。该子系统是单个包(package)([dsh-workspace](../../packages/workspace/workspace),`ctx.workspaceRegistry`)——一项宿主侧可选能力,不属于 agent loop(智能体循环)主干,并且对模型不可见(没有工具、没有提示词文本、没有会话事件)。它通过[存储领域数据形式](storage.zh.md)存储自己的记录,并对照 [`SessionHeader.cwd`](persistence.zh.md#sessionheader--metadata-beside-the-log) 校验会话成员资格,因此 `storageDomain` 与 `sessionPersistence` 是必需的启动依赖:持久化这一依赖不可用时,插件保持 pending,而不是把这种不可用误当作空历史。设计记录:[领域 KV 存储 Agent Note(agent 决策记录)](../../.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.zh.md);引导与 GUI 顺序:[Workspace UI 产品流程 Agent Note](../../.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md)。
工作区(workspace)是用户工作目录的持久记录:一个建立在规范路径之上的稳定 id、一个显示标题,以及归属于它的会话的有序账本。该子系统是单个包(package)([dsh-workspace](../../packages/workspace/workspace),`ctx.workspaceRegistry`)——一项宿主侧可选能力,不属于 agent loop(智能体循环)主干,并且自身不增加模型可见内容(没有工具、没有提示词文本、没有会话事件);可选的[列表工具](../../packages/session-query/tool-session-list)会把 Workspace ID、标题与路径提供给获准使用它们的模型。它通过[存储领域数据形式](storage.zh.md)存储自己的记录,并对照 [`SessionHeader.cwd`](persistence.zh.md#sessionheader--metadata-beside-the-log) 校验会话成员资格,因此 `storageDomain` 与 `sessionPersistence` 是必需的启动依赖:持久化这一依赖不可用时,插件保持 pending,而不是把这种不可用误当作空历史。设计记录:[领域 KV 存储 Agent Note(agent 决策记录)](../../.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.zh.md);引导与 GUI 顺序:[Workspace UI 产品流程 Agent Note](../../.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md)。
源码:[`packages/workspace/workspace/src/types.ts`](../../packages/workspace/workspace/src/types.ts)
@@ -63,6 +63,12 @@ interface Workspace {
*/
readonly sessionIds: readonly SessionId[]
/**
* List the stored headers of the current members.
* @returns a new array with one header per entry of {@link sessionIds}, in the same order.
*/
getSessionHeaders(): readonly SessionHeader[]
/**
* Replace the display title durably.
* @param title - New title; any string, duplicates across workspaces allowed.
+15 -6
View File
@@ -9,8 +9,8 @@
en: 6cc2cd9ced70bb09
zh: 1c0e6cb4ba2ed637
/tool-schema-catalog/tool-package-map:
en: 789c9c7932024257
zh: 6d0465e0463b321c
en: 9a75613dfc69ce8b
zh: 5f52b86658f1dff7
/tool-schema-catalog/deepseek-ai-dsh-plugin-manager:
en: e0143916bb634762
zh: e0143916bb634762
@@ -234,8 +234,17 @@
en: 927a5ac0974b7642
zh: 927a5ac0974b7642
/tool-schema-catalog/deepseek-ai-dsh-tool-skill/skill:
en: 9b159d5831855afb
zh: 275ee82af0e0f59a
en: c1124b6642c57712
zh: ede0a9f1479b4ecd
/tool-schema-catalog/deepseek-ai-dsh-tool-session-list:
en: 6d68942100dd76e7
zh: 6d68942100dd76e7
/tool-schema-catalog/deepseek-ai-dsh-tool-session-list/list-session:
en: 8a04c79a2d8ef256
zh: 06e93b69aa95c6e9
/tool-schema-catalog/deepseek-ai-dsh-tool-session-list/list-workspace:
en: 7b1f0bed364dfcd2
zh: c907d8ff78f54268
/tool-schema-catalog/deepseek-ai-dsh-tool-session-query:
en: eac1dff4b6d9e195
zh: eac1dff4b6d9e195
@@ -309,8 +318,8 @@
en: 8001eda7e9ff6a25
zh: 2414761029f21404
/tool-schema-catalog/deepseek-ai-dsh-tool-agent-team/team-task-update:
en: 9acd1c5b2fac9853
zh: 3bd81e9cd1f1c28d
en: 3c25013abbe19446
zh: 9552eaab1a25adb2
/tool-schema-catalog/deepseek-ai-dsh-tool-todo:
en: dea62d26fb18ff68
zh: dea62d26fb18ff68
+61 -2
View File
@@ -40,12 +40,13 @@ This table connects model-visible tool names to the plugin package and service s
| `@deepseek-ai/dsh-tool-lsp` | `lsp` | `ctx.workingDirectory`, `ctx.tools`, `ctx.lsp`, `ctx.systemPrompt` | `tool/call`, `tool/result` | - | The lsp tool keeps provider selection and language-server subprocesses behind ctx.lsp, so its model-visible schema stays stable across providers. Requires a registered provider (e.g. `@deepseek-ai/dsh-lsp-stdio`) at runtime; without one, a query returns the structured `LSP_UNAVAILABLE` error rather than changing the schema. |
| `@deepseek-ai/dsh-tool-ralph` | `ralph` | `ctx.tools`, `ctx.workflowEngine`, `ctx.subagents`, `ctx.systemPrompt`, `a calling Agent (exec.agent parents every fresh round)` | `tool/call`, `tool/result`, `workflow and child session events during execution` | - | A fixed foreground workflow starts one fresh structured child per round; the model selects only the immutable objective and an optional round cap. |
| `@deepseek-ai/dsh-tool-skill` | `skill` | `ctx.workingDirectory`, `ctx.tools`, `ctx.agents`, `ctx.skills` | `tool/call`, `tool/result`, `user/message replacement catalogs via agent.inject()` | - | - |
| `@deepseek-ai/dsh-tool-session-list` | `list_session`, `list_workspace` | `ctx.tools`, `ctx.sessions`, `ctx.sessionQuery`, `ctx.workspaceRegistry`, `ctx.sessionProjections` | `tool/call`, `tool/result` | - | Opt-in access to all Workspace and Session list metadata in the mounted runtime. Cold titles and activity use the optional projection cache; absent values become null titles and creation-time recency. No Agent is activated. |
| `@deepseek-ai/dsh-tool-session-query` | `session_event_read`, `session_event_search`, `session_event_trace`, `session_search`, `session_trace` | `ctx.tools`, `ctx.systemPrompt`, `ctx.sessionQuery`, `ctx.agents`, `a calling Agent for workspace authority` | `tool/call`, `tool/result` | - | The five read-only tools hide provider cursors and authorize every result from the immutable calling agent session. The package is opt-in; compositions that need enforced deadlines or bounded inline output also mount the generic timeout or spill policies. |
| `@deepseek-ai/dsh-experimental-tool-subagent-oar` | `subagent_oar` | `ctx.tools`, `ctx.subagents` | `tool/call`, `tool/result`, `parent subagent catalog and completion notices` | - | The subagent_oar tool selects among configured aliases for external providers. This catalog shows Codex and Claude Code aliases; each deployment chooses its providers. Native model and permission settings belong to the selected provider configuration. |
| `@deepseek-ai/dsh-tool-subagent` | `list_subagent_models`, `subagent` | `ctx.tools`, `ctx.subagents`, `ctx.systemPrompt`, `ctx.sessionProjections`, `ctx.llm for model discovery and selected-route validation` | `tool/call`, `tool/result`, `child session events through the chosen provider` | `subagent`, `subagent_fork` | The load-time `toolName` selects the delegation name (default `subagent`); `modelSelection` adds optional route fields. `modelDiscovery` defaults off and registers shared discovery on one instance per scope. Web and Desktop presets enable spawn discovery and route fields and leave `subagent_fork` route fields disabled. The Host settings service records authorization for each new top-level Session; child Sessions inherit it. Without a recorded policy, discovery and explicit selection permit only the current parent route. Every delegation returns the child's name promptly; local children accept follow-ups, while external backends report their single execution automatically. |
| `@deepseek-ai/dsh-tool-subagent-control` | `interrupt_agent`, `list_agents`, `send_message`, `wait_agent` | `ctx.tools`, `ctx.subagents`, `ctx.agents` | `tool/call`, `tool/result`, `child session events through ctx.subagents` | - | The shared control tools discover and contact agents in the subagent tree, interrupt owned descendants, and wait for input in the caller’s inbox. Provider-bound `tool-subagent` instances supply delegation tools. |
| `@deepseek-ai/dsh-tool-jobs` | `job_kill`, `job_list`, `job_output` | `ctx.tools`, `ctx.jobs`, `ctx.systemPrompt` | `tool/call`, `tool/result`, `user/message via agent.inject() for background completion notices` | - | The kind-agnostic background-job controller: background bash commands and PTY sends are read, listed, and killed through the same three tools. Loading the plugin attaches the controller that arms producers' `ctx.jobs.start()`. |
| `@deepseek-ai/dsh-tool-agent-team` | `team_task_create`, `team_task_get`, `team_task_list`, `team_task_update` | `ctx.tools`, `ctx.systemPrompt`, `ctx.agentTeams`, `ctx.subagents`, `an exact live Team member Agent` | `tool/call`, `team/task`, `tool/result` | - | Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode. |
| `@deepseek-ai/dsh-tool-agent-team` | `team_task_create`, `team_task_get`, `team_task_list`, `team_task_update` | `ctx.tools`, `ctx.systemPrompt`, `ctx.agentTeams`, `ctx.subagents`, `an exact live Team member Agent` | `tool/call`, `team/task`, `tool/result` | - | Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode; their result report instruction appears only while Team mode is off. |
| `@deepseek-ai/dsh-tool-todo` | `todo_write` | `ctx.tools`, `owning Agent session` | `tool/call`, `todo/write`, `tool/result` | - | todo_write is session-owned state; UIs render the latest todo/write event as a checklist. `allowParallelInProgress` is required with no default, so the catalog states its choice: `true`, whose description invites several `in_progress` items. A deployment choosing `false` receives the same tool with a description asking for exactly one active task. |
| `@deepseek-ai/dsh-tool-working-directory` | `working_directory` | `ctx.tools`, `ctx.workingDirectory` | `tool/call`, `working-directory/change`, `user context for directory changes`, `tool/result` | - | Reads or changes the calling Session directory. Existing shells and processes retain their own directories; origin metadata and permission roots stay fixed. |
| `@deepseek-ai/dsh-experimental-tool-worktree` | `create_worktree` | `ctx.tools`, `ctx.worktrees`, `a calling Agent` | `tool/call`, `Git branch and checkout`, `working-directory/change`, `tool/result` | - | Enabled through the Change requests & worktrees bundle on Web and Desktop; other profiles can select the standalone bundle. Creates a new branch and checkout from a pinned local commit under existing write permissions, then changes the Session directory. Leaving retains the branch and checkout. |
@@ -1909,6 +1910,64 @@ Load the full instructions for a skill. Call it before acting on a task that nam
Source: [`packages/skill/tool-skill/src/index.ts`](../packages/skill/tool-skill/src/index.ts)
<a id="deepseek-aidsh-tool-session-list"></a>
## `@deepseek-ai/dsh-tool-session-list`
### `list_session`
List non-subagent sessions by latest human prompt time, newest first, then by ID. Returns IDs, available titles, and ISO creation and update times. Missing activity metadata uses creation time; unavailable titles are null.
```json
{
"type": "object",
"properties": {
"workspace_id": {
"type": "string",
"description": "Workspace ID from list_workspace. Lists only its member sessions. Omit to list sessions in every workspace and outside all workspaces."
},
"archived": {
"type": "boolean",
"description": "Return only archived sessions when true, otherwise only unarchived sessions. Defaults to false."
},
"limit": {
"type": "integer",
"description": "Maximum entries to return, from 1 to 100. Defaults to 20."
},
"offset": {
"type": "integer",
"description": "Number of matching entries to skip. Defaults to 0."
}
}
}
```
Source: [`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts)
### `list_workspace`
List workspaces in registry order, including empty workspaces. Returns IDs, titles, paths, and creation and update times.
```json
{
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "Maximum entries to return, from 1 to 100. Defaults to 20."
},
"offset": {
"type": "integer",
"description": "Number of matching entries to skip. Defaults to 0."
}
}
}
```
Source: [`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts)
Opt-in access to all Workspace and Session list metadata in the mounted runtime. Cold titles and activity use the optional projection cache; absent values become null titles and creation-time recency. No Agent is activated.
<a id="deepseek-aidsh-tool-session-query"></a>
## `@deepseek-ai/dsh-tool-session-query`
@@ -2587,7 +2646,7 @@ Compare-and-set a shared task action using the latest revision from team_task_ge
Source: [`packages/team/tool-agent-team/src/index.ts`](../packages/team/tool-agent-team/src/index.ts)
Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode.
Four task-board tools share the subagent tree’s root Session. Enabling Team mode on the root Session adds task-board guidance alongside standard subagent delegation and control tools. Standard subagent controls provide required identity independently of Team mode; their result report instruction appears only while Team mode is off.
<a id="deepseek-aidsh-tool-todo"></a>
+61 -2
View File
@@ -44,12 +44,13 @@
| `@deepseek-ai/dsh-tool-lsp` | `lsp` | `ctx.workingDirectory`、`ctx.tools`、`ctx.lsp`、`ctx.systemPrompt` | `tool/call`、`tool/result` | - | lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,因此其模型可见 schema 在更换提供方时保持稳定。运行时要求已注册提供方,例如 `@deepseek-ai/dsh-lsp-stdio`;如果没有提供方,查询会返回结构化 `LSP_UNAVAILABLE` 错误,而不会改变 schema。 |
| `@deepseek-ai/dsh-tool-ralph` | `ralph` | `ctx.tools`、`ctx.workflowEngine`、`ctx.subagents`、`ctx.systemPrompt`、`a calling Agent (exec.agent parents every fresh round)` | `tool/call`、`tool/result`、`workflow and child session events during execution` | - | 固定的前台工作流会在每个 Round 启动一个全新的结构化子级;模型只能选择不可变目标和可选的 Round 上限。 |
| `@deepseek-ai/dsh-tool-skill` | `skill` | `ctx.workingDirectory`、`ctx.tools`、`ctx.agents`、`ctx.skills` | `tool/call`、`tool/result`、`user/message replacement catalogs via agent.inject()` | - | - |
| `@deepseek-ai/dsh-tool-session-list` | `list_session`、`list_workspace` | `ctx.tools`、`ctx.sessions`、`ctx.sessionQuery`、`ctx.workspaceRegistry`、`ctx.sessionProjections` | `tool/call`、`tool/result` | - | 选择启用后,可读取已挂载运行时中全部 Workspace 和 Session 的列表元数据。冷会话的标题和活动时间使用可选的投影缓存;值缺失时,标题为 null,最近活动时间取创建时间。不会激活 Agent。 |
| `@deepseek-ai/dsh-tool-session-query` | `session_event_read`、`session_event_search`、`session_event_trace`、`session_search`、`session_trace` | `ctx.tools`、`ctx.systemPrompt`、`ctx.sessionQuery`、`a calling Agent for workspace authority` | `tool/call`、`tool/result` | - | 这 5 个只读工具会隐藏提供方游标,并根据不可变的调用 agent 会话为每个结果授权。该包需要选择启用;需要强制截止时间或限制行内输出的组合还会挂载通用超时或 spill 策略。 |
| `@deepseek-ai/dsh-experimental-tool-subagent-oar` | `subagent_oar` | `ctx.tools`, `ctx.subagents` | `tool/call`, `tool/result`, `parent subagent catalog and completion notices` | - | subagent_oar 工具在为外部提供方配置的别名之间选择。本目录展示 Codex 和 Claude Code 别名;每个部署自行选择提供方。原生模型和权限设置由所选提供方的配置决定。 |
| `@deepseek-ai/dsh-tool-subagent` | `list_subagent_models`、`subagent` | `ctx.tools`、`ctx.subagents`、`ctx.systemPrompt`、`ctx.sessionProjections`、`用于模型发现和所选路由校验的 ctx.llm` | `tool/call`、`tool/result`、`child session events through the chosen provider` | `subagent`、`subagent_fork` | 加载时的 `toolName` 选择委派名称(默认为 `subagent`);`modelSelection` 增加可选路由字段。`modelDiscovery` 默认关闭,每个作用域由一个实例注册共享发现工具。Web 与 Desktop preset 启用 spawn 发现和路由字段,并为 `subagent_fork` 保持路由字段关闭。Host 设置服务为每个新顶层 Session 记录授权;子 Session 继承该授权。没有已记录策略时,发现和显式选择只允许当前父级路由。每次委派都会立即返回子代理的名称;本地子代理接受后续消息,外部后端自动汇报单次执行结果。 |
| `@deepseek-ai/dsh-tool-subagent-control` | `interrupt_agent`、`list_agents`、`send_message`、`wait_agent` | `ctx.tools`、`ctx.subagents`、`ctx.agents` | `tool/call`、`tool/result`、`child session events through ctx.subagents` | - | 共享控制工具发现并联系 subagent 树中的 Agent,中断有权控制的后代,并等待调用者收件箱中的输入。绑定提供方的 `tool-subagent` 实例提供委派工具。 |
| `@deepseek-ai/dsh-tool-jobs` | `job_kill`、`job_list`、`job_output` | `ctx.tools`、`ctx.jobs`、`ctx.systemPrompt` | `tool/call`、`tool/result`、`user/message via agent.inject() for background completion notices` | - | 与任务种类无关的后台任务控制器:后台 bash 命令与 PTY 发送 都通过相同的 3 个工具读取、列出和终止。加载该插件会挂接控制器,从而启用生产方的 `ctx.jobs.start()`。 |
| `@deepseek-ai/dsh-tool-agent-team` | `team_task_create`, `team_task_get`, `team_task_list`, `team_task_update` | `ctx.tools`, `ctx.systemPrompt`, `ctx.agentTeams`, `ctx.subagents`, `an exact live Team member Agent` | `tool/call`, `team/task`, `tool/result` | - | 四个任务板工具共享 subagent 树的根 Session。在根 Session 开启 Team 模式,会在标准 subagent 委派和控制工具之外增加任务板指导。标准 subagent 控制工具提供必需身份,不受 Team 模式影响。 |
| `@deepseek-ai/dsh-tool-agent-team` | `team_task_create`, `team_task_get`, `team_task_list`, `team_task_update` | `ctx.tools`, `ctx.systemPrompt`, `ctx.agentTeams`, `ctx.subagents`, `an exact live Team member Agent` | `tool/call`, `team/task`, `tool/result` | - | 四个任务板工具共享 subagent 树的根 Session。在根 Session 开启 Team 模式,会在标准 subagent 委派和控制工具之外增加任务板指导。标准 subagent 控制工具提供必需身份,不受 Team 模式影响;其结果汇报要求仅在 Team 模式关闭时出现。 |
| `@deepseek-ai/dsh-tool-todo` | `todo_write` | `ctx.tools`、`owning Agent session` | `tool/call`、`todo/write`、`tool/result` | - | todo_write 是会话所有的状态;UI 将最新的 todo/write 事件渲染为检查清单。`allowParallelInProgress` 是没有默认值的必填项,因此本目录明确选择 `true`,对应描述允许同时存在多个 `in_progress` 项。选择 `false` 的部署会获得同一工具,但描述会要求只能有 1 个活动任务。 |
| `@deepseek-ai/dsh-tool-working-directory` | `working_directory` | `ctx.tools`, `ctx.workingDirectory` | `tool/call`, `working-directory/change`, `user context for directory changes`, `tool/result` | - | 读取或改变调用方 Session 的目录。已有 shell 和进程保留自己的目录;原始元数据和权限根目录保持不变。 |
| `@deepseek-ai/dsh-experimental-tool-worktree` | `create_worktree` | `ctx.tools`, `ctx.worktrees`, `a calling Agent` | `tool/call`, `Git branch and checkout`, `working-directory/change`, `tool/result` | - | 在 Web 和 Desktop 上通过变更请求与工作树组合包启用;其他 profile 可以选择独立组合包。在现有写权限下从固定的本地提交创建新分支与检出目录,再改变 Session 工作目录。离开时保留分支与检出目录。 |
@@ -1915,6 +1916,64 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
来源:[`packages/skill/tool-skill/src/index.ts`](../packages/skill/tool-skill/src/index.ts)
<a id="deepseek-aidsh-tool-session-list"></a>
## `@deepseek-ai/dsh-tool-session-list`
### `list_session`
按最近人工提示词时间从新到旧列出非 subagent 会话,时间相同时按 ID 排列。返回 ID、可用标题以及 ISO 创建时间和更新时间。缺少活动元数据时使用创建时间;标题不可用时为 null。
```json
{
"type": "object",
"properties": {
"workspace_id": {
"type": "string",
"description": "Workspace ID from list_workspace. Lists only its member sessions. Omit to list sessions in every workspace and outside all workspaces."
},
"archived": {
"type": "boolean",
"description": "Return only archived sessions when true, otherwise only unarchived sessions. Defaults to false."
},
"limit": {
"type": "integer",
"description": "Maximum entries to return, from 1 to 100. Defaults to 20."
},
"offset": {
"type": "integer",
"description": "Number of matching entries to skip. Defaults to 0."
}
}
}
```
来源:[`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts)
### `list_workspace`
按注册表顺序列出工作区,包括空工作区。返回 ID、标题、路径以及创建时间和更新时间。
```json
{
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "Maximum entries to return, from 1 to 100. Defaults to 20."
},
"offset": {
"type": "integer",
"description": "Number of matching entries to skip. Defaults to 0."
}
}
}
```
来源:[`packages/session-query/tool-session-list/src/index.ts`](../packages/session-query/tool-session-list/src/index.ts)
选择启用后,可读取已挂载运行时中全部 Workspace 和 Session 的列表元数据。冷会话的标题和活动时间使用可选的投影缓存;值缺失时,标题为 null,最近活动时间取创建时间。不会激活 Agent。
<a id="deepseek-aidsh-tool-session-query"></a>
## `@deepseek-ai/dsh-tool-session-query`
@@ -2593,7 +2652,7 @@ subagent_oar 工具在为外部提供方配置的别名之间选择。本目录
来源:[`packages/team/tool-agent-team/src/index.ts`](../packages/team/tool-agent-team/src/index.ts)
四个任务板工具共享 subagent 树的根 Session。在根 Session 开启 Team 模式,会在标准子代理委派和控制工具之外增加任务板指导。标准子代理控制工具提供必需身份,不受 Team 模式影响。
四个任务板工具共享 subagent 树的根 Session。在根 Session 开启 Team 模式,会在标准子代理委派和控制工具之外增加任务板指导。标准子代理控制工具提供必需身份,不受 Team 模式影响;其结果汇报要求仅在 Team 模式关闭时出现。
<a id="deepseek-aidsh-tool-todo"></a>
+2 -1
View File
@@ -314,6 +314,7 @@
"@deepseek-ai/dsh-experimental-forge-github": "workspace:*",
"@deepseek-ai/dsh-forge-gitlab": "workspace:*",
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
"@deepseek-ai/dsh-action-cards": "workspace:*"
"@deepseek-ai/dsh-action-cards": "workspace:*",
"@deepseek-ai/dsh-tool-session-list": "workspace:*"
}
}
+2 -2
View File
@@ -15,8 +15,8 @@
en: a7a78c6d1aeebeb3
zh: 4bb69f32d8b05ba3
/deepseek-ai-dsh-api-remotes/use-this-package:
en: 5e5770cc1cbf49db
zh: b9ee3c309d0cd93c
en: d8622091b217f050
zh: c36cb87f10e7802a
/deepseek-ai-dsh-api-remotes/forwarded-host-events:
en: 1dea001229f8c06a
zh: 3acb1fa1c5d24f8c
+1 -1
View File
@@ -29,7 +29,7 @@ Two-sided BFF for Host Remote capabilities selected by this application. The Hos
[`@deepseek-ai/dsh-api-session-controller`](../session-controller/README.md) owns Agent and Session identity policy, including the Typert lookup resolvers used by other namespaces. This package selects and mounts that generated Session contribution without a direct runtime dependency on `@deepseek-ai/dsh-session`; activation policy stays with Session Controller.
The Client assembly mounts Office conversion, Commands, Agent Teams, credentials, settings, Goal, Schedule, dynamic Cordis, file and Session references, read-only Host plugin inventory, plugin-installation registry response comparison, message feedback, permission presets, Session Controller, subagents, web provider list, and Workspace Controller contributions. The `permissionPresets` namespace returns the complete process-level catalog used by current-session controls. Cordis effect ownership withdraws every contribution when this assembly unloads, while `@deepseek-ai/dsh-api-gateway/client` owns descriptor validation, traced namespace Services, direct and scoped methods, invocation, streams, and cancellation. The Client entry consumes the shared `TypertClientRemote` interface through Cordis and does not import the concrete Gateway. It re-exports the Gateway Client face's declaration merges type-only, so a consumer reaching the forwarded-event vocabulary through this facade gains no runtime edge to the Gateway implementation.
The Client assembly mounts Office conversion, Commands, Agent Teams, credentials, settings, Goal, Schedule, dynamic Cordis, file and Session references, read-only Host plugin inventory, plugin-installation registry response comparison, connector accounts, message feedback, permission presets, Session Controller, subagents, web provider list, and Workspace Controller contributions. The `permissionPresets` namespace returns the complete process-level catalog used by current-session controls. Cordis effect ownership withdraws every contribution when this assembly unloads, while `@deepseek-ai/dsh-api-gateway/client` owns descriptor validation, traced namespace Services, direct and scoped methods, invocation, streams, and cancellation. The Client entry consumes the shared `TypertClientRemote` interface through Cordis and does not import the concrete Gateway. It re-exports the Gateway Client face's declaration merges type-only, so a consumer reaching the forwarded-event vocabulary through this facade gains no runtime edge to the Gateway implementation.
This facade is also the front door for the wire type vocabulary a Client package names. It re-exports, type-only, the Remote failure vocabulary (`RemoteResult`, `RemoteFailure`, `RemoteErrorCode`, `RemoteErrorDetailsMap`), the Host facts (`RemoteHostFacts`), and each selected domain's client-safe payload types, so a Client feature package imports one specifier instead of reaching into `dsh-typert-protocol`, the Gateway, or an owner's Host entry. Two kinds of package deliberately skip this door: the API-layer packages this assembly itself selects — importing it back would close a dependency cycle — and their tests, which take the failure vocabulary from `dsh-typert-protocol` directly. A UI package's tests instead take the `RemoteError` constructor from [`dsh-client-test-runtime`](../../test-support/client-runtime/README.md).
+1 -1
View File
@@ -29,7 +29,7 @@ kind: "package-reference"
[`@deepseek-ai/dsh-api-session-controller`](../session-controller/README.zh.md) 拥有 agent(智能体)与会话身份策略,包括供其他 namespace 使用的 Typert lookup 解析器。本包选择并挂载生成的会话 contribution,无需直接依赖 `@deepseek-ai/dsh-session` 的运行时;激活策略由会话控制器负责。
Client 组合挂载 Office 转换、Commands、Agent Teams、凭据、settings、Goal、Schedule、动态 Cordis、文件与会话引用、只读 Host 插件清单、插件安装源响应比较、消息反馈、权限预设、会话控制器、subagents、Web 提供方列表和 Workspace 控制器 contribution。`permissionPresets` namespace 返回 current-session 控件使用的完整进程级目录。该组合卸载时,Cordis effect 的所有权机制会撤回所有贡献;`@deepseek-ai/dsh-api-gateway/client` 负责描述符校验、可追踪的 namespace 服务、直接与作用域方法、调用、流与取消。Client 入口通过 Cordis 消费共享的 `TypertClientRemote` 接口,不导入具体 Gateway;它只以 type-only 形式重新导出 Gateway Client face 的声明合并,因此消费端经由本外观取到转发事件词汇时,运行时不会多出一条通往 Gateway 实现的边。
Client 组合挂载 Office 转换、Commands、Agent Teams、凭据、settings、Goal、Schedule、动态 Cordis、文件与会话引用、只读 Host 插件清单、插件安装源响应比较、连接器账号、消息反馈、权限预设、会话控制器、subagents、Web 提供方列表和 Workspace 控制器 contribution。`permissionPresets` namespace 返回 current-session 控件使用的完整进程级目录。该组合卸载时,Cordis effect 的所有权机制会撤回所有贡献;`@deepseek-ai/dsh-api-gateway/client` 负责描述符校验、可追踪的 namespace 服务、直接与作用域方法、调用、流与取消。Client 入口通过 Cordis 消费共享的 `TypertClientRemote` 接口,不导入具体 Gateway;它只以 type-only 形式重新导出 Gateway Client face 的声明合并,因此消费端经由本外观取到转发事件词汇时,运行时不会多出一条通往 Gateway 实现的边。
本 facade 同时是 Client 包指称 wire 类型词汇的正门。它以 type-only 方式转出 Remote 失败词汇(`RemoteResult`、`RemoteFailure`、`RemoteErrorCode`、`RemoteErrorDetailsMap`)、Host 事实(`RemoteHostFacts`),以及各已选领域对 Client 安全的载荷类型,因此 Client 功能包只 import 一个 specifier,不必伸手进 `dsh-typert-protocol`、Gateway 或某个拥有方的 Host 入口。有两类包刻意不走这道门:本装配自己选中的 API 层包——反向 import 会形成依赖环——以及它们的测试,后者直接从 `dsh-typert-protocol` 取失败词汇。UI 包的测试则从 [`dsh-client-test-runtime`](../../test-support/client-runtime/README.zh.md) 取 `RemoteError` 构造器。
+1
View File
@@ -98,6 +98,7 @@
"@deepseek-ai/dsh-plugin-manager": "workspace:*",
"@deepseek-ai/dsh-mcp-manager": "workspace:*",
"@deepseek-ai/dsh-plugin-market": "workspace:*",
"@deepseek-ai/dsh-client-ui-connector-account": "workspace:*",
"@deepseek-ai/dsh-client-ui-plugin-manager": "workspace:*",
"@deepseek-ai/dsh-office-kit": "workspace:*",
"@deepseek-ai/dsh-deepseek-account": "workspace:*",
+3
View File
@@ -19,6 +19,7 @@ import pluginManagerRemote from '@deepseek-ai/dsh-plugin-manager/remote'
import mcpManagerRemote from '@deepseek-ai/dsh-mcp-manager/remote'
import toolResultsRemote from '@deepseek-ai/dsh-client-ui-trajectory/remote'
import pluginRegistryProbeRemote from '@deepseek-ai/dsh-client-ui-plugin-manager/remote'
import connectorAccountsRemote from '@deepseek-ai/dsh-client-ui-connector-account/remote'
import pluginMarketRemote from '@deepseek-ai/dsh-plugin-market/remote'
import pluginInventoryRemote from '@deepseek-ai/dsh-host-plugin-inventory/remote'
import messageFeedbackRemote from '@deepseek-ai/dsh-message-feedback/remote'
@@ -50,6 +51,7 @@ export type { McpManagedServerStatus, McpManagedServerView } from '@deepseek-ai/
export type {} from '@deepseek-ai/dsh-plugin-manager/remote'
export type {} from '@deepseek-ai/dsh-mcp-manager/remote'
export type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/remote'
export type {} from '@deepseek-ai/dsh-client-ui-connector-account/remote'
export type {} from '@deepseek-ai/dsh-client-ui-trajectory/remote'
export type {} from '@deepseek-ai/dsh-plugin-market/remote'
export type {
@@ -202,6 +204,7 @@ export async function apply(ctx: Context): Promise<() => Promise<void>> {
productAnalyticsRemote, agentPresetsRemote, commandsRemote, agentTeamsRemote, settingsControllerRemote, accountRemote,
goalsRemote, llmRemote, dynamicRemote, scheduleRemote,
pluginInventoryRemote, pluginManagerRemote, mcpManagerRemote, pluginMarketRemote, pluginRegistryProbeRemote,
connectorAccountsRemote,
toolResultsRemote,
messageFeedbackRemote, sessionFeedbackRemote,
fileUploadsRemote, sessionReferencesRemote,
@@ -15,8 +15,8 @@
en: 1fdf707322fb6996
zh: 0204f7e9d4aa3cce
/session-controller/use-this-package:
en: 50fa3dd0a2ce79c8
zh: 88bd7ea6058d2122
en: 15d6cb30e1e7f5e2
zh: 21fe7028a4ed4aef
/session-controller/client-references:
en: e8979a803ec3e194
zh: c567efcd971728ba
+1 -1
View File
@@ -43,7 +43,7 @@ Every Remote endpoint is access-controlled: a Peer whose principal is not the ow
List rows carry `formatStatus` when available, so Clients can identify migration-required Sessions without requesting their projections.
Host list generation yields between complete rows only when its configured work slice is exhausted; cheap remaining work returns without a forced yield. Request cancellation is checked per row and after each yield and rejects without partial results. Each row is synchronous; the list does not promise one cross-Session snapshot. A Session already queued as cold remains a cached row if it attaches during a yield: Client in-flight mutation replay corrects its availability, and sequenced projections supersede cached hints. An attached Session's summary reads its blankness and last-prompt recency through the `sessionListMetadata` projection handle, and its projection hints carry every summary key computed through `snapshot`. The first summary of an attached Session computes these projections over its whole in-memory log, and later summaries advance them incrementally; this computation runs inside one synchronous row, so `listWorkSliceMs` cannot split it.
Host list generation yields between complete rows only when its configured work slice is exhausted; cheap remaining work returns without a forced yield. Request cancellation is checked per row and after each yield and rejects without partial results. Each row is synchronous; the list does not promise one cross-Session snapshot. A Session already queued as cold remains a cached row if it attaches during a yield: Client in-flight mutation replay corrects its availability, and sequenced projections supersede cached hints. An attached Session's summary reads its blankness and last-prompt recency through [`sessionQuery.getListMetadata`](../../session-query/session-query/README.md#session-list-metadata), and its projection hints carry every summary key computed through `snapshot`. The first summary of an attached Session computes these projections over its whole in-memory log, and later summaries advance them incrementally; this computation runs inside one synchronous row, so `listWorkSliceMs` cannot split it.
Client list rows and resident Sessions use the current `sessionListMetadata` projection to reject stale blank-session hints; recency is the later of the summary timestamp and the projected last user prompt. When SessionManager creates an instance before its list row arrives, it reconciles blankness with metadata already retained for that Session. An opened conversation is therefore not reused by New Session even when an older list response still marks it blank.
+1 -1
View File
@@ -43,7 +43,7 @@ Client journal 在发布 follow 快照、live entry 或历史页之前验证当
列表行在状态可用时携带 `formatStatus`,Client 无需请求其投影即可识别需要迁移的 Session。
Host 仅在配置的工作时间片耗尽时,于完整条目之间让出事件循环;剩余工作较少时直接返回,不强制让出。每行及每次让出之后检查请求取消,取消时拒绝返回部分结果。每行同步计算;列表不承诺跨 Session 的统一快照。已经进入冷态队列的 Session 若在让出期间接入,仍返回缓存行:Client 对进行中请求的变更重放会纠正其可用性,带序号的投影会覆盖缓存提示。已接入 Session 的摘要通过 `sessionListMetadata` 投影句柄读取是否为空和最后一次提示词的最近活动时间,其投影提示携带通过 `snapshot` 计算的每个摘要 key。已接入 Session 的首次摘要在其完整内存日志上计算这些投影,之后的摘要增量推进;这次计算在单行的同步工作内进行,`listWorkSliceMs` 无法切分它。
Host 仅在配置的工作时间片耗尽时,于完整条目之间让出事件循环;剩余工作较少时直接返回,不强制让出。每行及每次让出之后检查请求取消,取消时拒绝返回部分结果。每行同步计算;列表不承诺跨 Session 的统一快照。已经进入冷态队列的 Session 若在让出期间接入,仍返回缓存行:Client 对进行中请求的变更重放会纠正其可用性,带序号的投影会覆盖缓存提示。已接入 Session 的摘要通过[`sessionQuery.getListMetadata`](../../session-query/session-query/README.zh.md#session-list-metadata)读取是否为空和最后一次提示词的最近活动时间,其投影提示携带通过 `snapshot` 计算的每个摘要 key。已接入 Session 的首次摘要在其完整内存日志上计算这些投影,之后的摘要增量推进;这次计算在单行的同步工作内进行,`listWorkSliceMs` 无法切分它。
Client 列表行和驻留 Session 使用当前 `sessionListMetadata` 投影纠正过期的空白会话提示;最近活动时间取摘要时间戳与投影中最后一次用户提示词时间的较晚值。当 SessionManager 在列表行到达前创建实例时,会使用已保留的该 Session 元数据对账空白状态。因此,即使旧列表响应仍将已有对话标为空白,新会话操作也不会复用已经打开过的对话。
+6 -40
View File
@@ -5,8 +5,8 @@ import { scheduler } from 'node:timers/promises'
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import type { ImageAttachmentLimits } from '@deepseek-ai/dsh-attachment'
import type { Session, SessionEvent, SessionHeader, SessionId } from '@deepseek-ai/dsh-session'
import type { ProjectionHandle, ProjectionSnapshot } from '@deepseek-ai/dsh-session-projection'
import type { Session, SessionHeader, SessionId } from '@deepseek-ai/dsh-session'
import type { ProjectionSnapshot } from '@deepseek-ai/dsh-session-projection'
import type {} from '@deepseek-ai/dsh-session-projection-cache'
import { SessionQueryError, type SessionRecord, type SessionSearchCursor } from '@deepseek-ai/dsh-session-query'
import { RemoteError } from '@deepseek-ai/dsh-typert-protocol'
@@ -24,11 +24,6 @@ const SEARCH_PROVIDER_CALL_LIMIT = 100
const SESSION_SEARCH_QUERY_MAX_CHARS = 500
const MESSAGE_TYPES = new Set(['user/message', 'assistant/message'])
const sessionListMetadataSchema: z.ZodType<SessionListMetadata> = z.object({
blank: z.boolean(),
lastPromptAt: z.number().nullable(),
})
const imageLimitsSchema = z.object({
maxImageBytes: z.number().int().positive(),
maxImagesPerMessage: z.number().int().positive(),
@@ -38,25 +33,6 @@ const imageLimitsSchema = z.object({
mediaTypes: z.array(z.string()),
}) as unknown as z.ZodType<ImageAttachmentLimits>
/**
* Advance the Session-list metadata projection by one committed event.
* @param state - metadata before the event.
* @param event - next committed Session event.
* @returns the original or advanced metadata value.
*/
export function applySessionListMetadata(
state: SessionListMetadata,
event: SessionEvent,
): SessionListMetadata {
const blank = state.blank && event.type !== 'turn/start'
const lastPromptAt = event.type === 'user/message' && event.data.source.kind === 'user'
? event.time
: state.lastPromptAt
return blank === state.blank && lastPromptAt === state.lastPromptAt
? state
: { blank, lastPromptAt }
}
/**
* Return the longest prefix containing at most `maximum` Unicode code points.
* @param value - source text.
@@ -76,8 +52,6 @@ export function truncateUnicodeCodePoints(value: string, maximum: number): strin
/** Owns list projection registration, bounded cold summaries, and authorized search. */
export class ApiSessionList {
private listMetadata!: ProjectionHandle<SessionListMetadata>
/**
* @param ctx - Host context carrying Session, query, persistence, and projection services.
* @param workSliceMs - Resolved positive integral list-work budget in milliseconds.
@@ -89,14 +63,6 @@ export class ApiSessionList {
* @returns when all required registrations are ready.
*/
async initialize(): Promise<void> {
this.listMetadata = await this.ctx.sessionProjections.register<'sessionListMetadata', SessionListMetadata>({
key: 'sessionListMetadata',
stateSchema: sessionListMetadataSchema,
init: () => ({ blank: true, lastPromptAt: null }),
apply: applySessionListMetadata,
wire: { viewSchema: sessionListMetadataSchema, view: state => state },
stateVersion: 1,
})
await this.ctx.sessionProjections.register<'imageLimits', null>({
key: 'imageLimits',
stateSchema: z.null(),
@@ -113,17 +79,17 @@ export class ApiSessionList {
/**
* Build one current attached-Session summary.
* Blankness and recency come from the `sessionListMetadata` handle; projection
* Blankness and recency come from `sessionQuery.getListMetadata`; projection
* hints carry every summary key computed through `snapshot`. The first call
* for a Session computes these projections over its whole in-memory log, and
* later calls advance them incrementally. The handle read and the hint with
* the same key come from one cell; the handle read does not depend on any
* later calls advance them incrementally. The metadata read and the hint with
* the same key come from one cell; the metadata read does not depend on any
* other unit's view.
* @param session - attached Session to summarize.
* @returns current list metadata and available projections.
*/
summaryFor(session: Session): SessionSummary {
const metadata = this.listMetadata.stateOf(session)
const metadata = this.ctx.sessionQuery.getListMetadata(session)
const projections = this.projectionsFor(session.header, session)
return {
sessionId: session.id,
+2 -10
View File
@@ -14,12 +14,12 @@ import type { Principal } from '@deepseek-ai/dsh-typert-protocol'
import type { JsonValue } from '@deepseek-ai/dsh-util-values'
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types'
export type { SessionListMetadata } from '@deepseek-ai/dsh-session-query/types'
declare module '@deepseek-ai/dsh-session-projection/types' {
interface SessionProjectionMap {
/** Eligible latest failed turn/end for an empty prompt, or null. */
conversationContinuation: SessionSeq | null
/** Persisted facts used to summarize a Session without activating it. */
sessionListMetadata: SessionListMetadata
/**
* Image-intake limits enforced by the Session prompt endpoint. Boot
* constant, excluded from Session summary payloads: every Session shares
@@ -29,14 +29,6 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
}
}
/** Persisted hints used to summarize a cold Session. */
export interface SessionListMetadata {
/** Whether the folded prefix contains no turn. */
readonly blank: boolean
/** Latest human-authored prompt time in the folded prefix. */
readonly lastPromptAt: number | null
}
/**
* Summary wire values a Session-list row carries. A `sequenced` block carries
* every summary key computed at its `asOfSeq`; a `cached` block carries the
@@ -36,7 +36,7 @@ async function harness(): Promise<{ ctx: Context; agents: ApiSessionAgentControl
await ctx.plugin(SessionStore)
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
await ctx.sessionProjections.register(agentPresetProjectionDefinition)
ctx.provide('agentDefaultModel', {
currentSelection: () => ({ provider: 'fixture', model: 'fixture-model' }),
@@ -51,7 +51,7 @@ async function baseContext(): Promise<Context> {
await ctx.plugin(SessionStore)
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
ctx.provide('agentDefaultModel', {
currentSelection: () => ({ provider: 'fixture', model: 'fixture-model' }),
saveSelection: () => Promise.resolve(),
@@ -44,7 +44,7 @@ async function commandHarness(
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
await ctx.plugin(TypertRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
await ctx.sessionProjections.register(subagentIdentityProjectionDefinition)
const sessionId = brandString<SessionId>('commands-session')
const ancestor = Session.create(brandString<SessionId>('ancestor'))
@@ -39,7 +39,7 @@ describe('SessionController facade', () => {
const original = ctx.sessionProjections.register.bind(ctx.sessionProjections)
let first = true
vi.spyOn(ctx.sessionProjections, 'register').mockImplementation(async (...args: Parameters<typeof original>) => {
if (first) {
if (first && args[0].key === 'imageLimits') {
first = false
entered.resolve(undefined)
await gate.promise
@@ -18,7 +18,7 @@ async function fixture() {
const ctx = new Context()
roots.push(ctx)
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
const history = new HistoryController(ctx)
const web = new WebController(ctx, history, (observation) => { observation[Symbol.dispose]() })
const session = ctx.sessions.create(brandString<SessionId>('history-target'), { meta: { cwd: '/history-test' } })
@@ -85,7 +85,8 @@ async function harness(rows: readonly Row[], summaryMs = 8, workSliceMs = 8) {
return { header: session.header, live: row.phase === 'live', persisted: true }
})
const listSessions = vi.fn(async (_signal?: AbortSignal) => records)
ctx.provide('sessionQuery', { listSessions } as never)
const getListMetadata = () => ({ blank: true, lastPromptAt: null })
ctx.provide('sessionQuery', { listSessions, getListMetadata } as never)
ctx.provide('sessionProjectionCache', {
cachedSnapshot: (header: SessionRecord['header']) => {
recordSummary('cold', header.id)
@@ -25,7 +25,7 @@ async function fixture() {
const ctx = new Context()
roots.push(ctx)
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
const session = ctx.sessions.create(brandString<SessionId>('listener-target'), { meta: { cwd: '/listeners' } })
const abort = cancellation()
const partial: Partial<Agent> = { id: session.id, session }
@@ -35,7 +35,7 @@ async function composed(workspaces: readonly Workspace[] = []): Promise<Context>
await ctx.plugin(SystemPrompt, { personaPrefix: '' })
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
ctx.provide('workspaceRegistry', { list: () => workspaces, archivedSessionIds: [] } as never)
ctx.agents.setFactory({
createAgent: async (ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle> => {
@@ -55,7 +55,7 @@ async function harness(): Promise<{ ctx: Context }> {
await ctx.plugin(SessionStore)
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
return { ctx }
}
@@ -541,7 +541,7 @@ describe('session.list projections column', () => {
const row = response.value.items.find(item => item.sessionId === session.id)
expect(row?.projections?.kind).toBe('sequenced')
expect(Object.keys(row?.projections?.values ?? {})).toEqual([...ctx.sessionProjections.summaryKeys()])
expect(Object.keys(row?.projections?.values ?? {})).toEqual(['conversationContinuation', 'sessionListMetadata'])
expect(Object.keys(row?.projections?.values ?? {})).toEqual(['sessionListMetadata', 'conversationContinuation'])
expect(row?.projections?.values.conversationContinuation).toBeNull()
})
@@ -797,8 +797,8 @@ describe('Session control projection frames', () => {
{
type: 'projection', sessionId: session.id, seq: 0, changes: [
{ key: 'test/last-user', val: { text: 'm0' } },
{ key: 'conversationContinuation', val: null },
{ key: 'sessionListMetadata', val: { blank: true, lastPromptAt: 100 } },
{ key: 'conversationContinuation', val: null },
],
},
{
@@ -838,8 +838,8 @@ describe('Session control projection frames', () => {
value: {
type: 'projection', seq: 0, changes: [
{ key: 'test/last-user', val: { text: 'm0' } },
{ key: 'conversationContinuation', val: null },
{ key: 'sessionListMetadata', val: { blank: true, lastPromptAt: 100 } },
{ key: 'conversationContinuation', val: null },
],
},
})
@@ -5,7 +5,7 @@
*/
import { describe, expect, it, vi } from 'vitest'
import { Context } from '@deepseek-ai/cordis'
import { Context, Service } from '@deepseek-ai/cordis'
import AgentRegistry from '@deepseek-ai/dsh-agent'
import { createUserMessage } from '@deepseek-ai/dsh-llm'
import SessionStore, { SESSION_FORMAT_VERSION, SessionSeq } from '@deepseek-ai/dsh-session'
@@ -73,6 +73,10 @@ class SearchSessionQuery extends SessionQueryEngine {
super(ctx)
}
initialize(): Promise<void> {
return this[Service.init]()
}
override searchSessions(
...args: Parameters<SessionQueryEngine['searchSessions']>
): ReturnType<SessionQueryEngine['searchSessions']> {
@@ -89,8 +93,8 @@ function installSearchQuery(
searchSessions: (
...args: Parameters<SessionQueryEngine['searchSessions']>
) => Promise<unknown>,
): void {
new SearchSessionQuery(ctx, searchSessions)
): Promise<void> {
return new SearchSessionQuery(ctx, searchSessions).initialize()
}
describe('session.search', () => {
@@ -152,7 +156,7 @@ describe('session.search', () => {
},
],
}))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const remote = await createSessionTestRemote(ctx, defaults)
const signal = new AbortController().signal
@@ -188,7 +192,7 @@ describe('session.search', () => {
const ctx = await baseContext()
ctx.sessions.create(sid('visible'), { meta: header('visible') })
const searchSessions = vi.fn()
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const remote = await createSessionTestRemote(ctx, defaults)
for (const query of ['', ' ', 'contains\0nul', 'x'.repeat(501)]) {
@@ -202,7 +206,7 @@ describe('session.search', () => {
it('returns an empty page without invoking the index when no session is visible', async () => {
const ctx = await baseContext()
const searchSessions = vi.fn()
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const remote = await createSessionTestRemote(ctx, defaults)
const response = await remote.search(
@@ -228,7 +232,7 @@ describe('session.search', () => {
const base = hit('visible', index)
return { ...base, bestMatch: { ...base.bestMatch, ...bestMatch } }
}
installSearchQuery(ctx, () => Promise.resolve({
await installSearchQuery(ctx, () => Promise.resolve({
items: [
withBestMatch(0, { sessionId: sid('hidden') }),
withBestMatch(1, { surface: 'shadowed' }),
@@ -263,7 +267,7 @@ describe('session.search', () => {
nextCursor: 'page-2',
})
.mockResolvedValueOnce({ items: items.slice(19) })
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('match'),
new AbortController().signal,
@@ -303,7 +307,7 @@ describe('session.search', () => {
...end < items.length ? { nextCursor: `offset-${end}` } : {},
})
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('adaptive-page-limit'),
@@ -346,7 +350,7 @@ describe('session.search', () => {
nextCursor: `page-${searchSessions.mock.calls.length}`,
})
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('endless-pages'),
@@ -411,7 +415,7 @@ describe('session.search', () => {
return Promise.reject(new Error('unexpected provider call'))
}
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('stale-restart'),
@@ -450,7 +454,7 @@ describe('session.search', () => {
nextCursor: `cursor-${searchSessions.mock.calls.length}`,
})
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('stale-churn'),
@@ -479,7 +483,7 @@ describe('session.search', () => {
controller.abort()
return Promise.reject(stale)
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('abort-stale'),
@@ -500,7 +504,7 @@ describe('session.search', () => {
'provider generation changed before paging',
'SESSION_QUERY_STALE_CURSOR',
)))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('first-page-stale'),
@@ -524,7 +528,7 @@ describe('session.search', () => {
'continuation limit is invalid',
'SESSION_QUERY_INVALID_LIMIT',
))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('continuation-invalid-limit'),
@@ -551,7 +555,7 @@ describe('session.search', () => {
'SESSION_QUERY_INVALID_LIMIT',
),
))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('minimum-page-limit'),
@@ -577,7 +581,7 @@ describe('session.search', () => {
'SESSION_QUERY_INVALID_LIMIT',
))
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('abort-invalid-limit'),
@@ -596,7 +600,7 @@ describe('session.search', () => {
ctx.sessions.create(sid('visible'), { meta: header('visible') })
const oversized = Array.from({ length: 21 }, (_, index) => hit(`oversized-${index}`))
const searchSessions = vi.fn(() => Promise.resolve({ items: oversized }))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('oversized-page'),
@@ -622,7 +626,7 @@ describe('session.search', () => {
}
return Promise.resolve({ items: oversized })
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('adapted-oversized-page'),
@@ -648,7 +652,7 @@ describe('session.search', () => {
snippet: `${expected}${'y'.repeat(10_000)}`,
},
}
installSearchQuery(ctx, () => Promise.resolve({ items: [overlong] }))
await installSearchQuery(ctx, () => Promise.resolve({ items: [overlong] }))
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('bounded-snippet'),
@@ -670,7 +674,7 @@ describe('session.search', () => {
const searchSessions = vi.fn()
.mockResolvedValueOnce({ items: [], nextCursor: 'repeated' })
.mockResolvedValueOnce({ items: [], nextCursor: 'repeated' })
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('repeated-cursor'),
@@ -693,7 +697,7 @@ describe('session.search', () => {
const searchSessions = vi.fn()
.mockResolvedValueOnce({ items: items.slice(0, 20), nextCursor: 'repeated' })
.mockResolvedValueOnce({ items: items.slice(20), nextCursor: 'repeated' })
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('repeated-lookahead-cursor'),
@@ -720,7 +724,7 @@ describe('session.search', () => {
.mockResolvedValueOnce({ items: items.slice(0, 20), nextCursor: 'page-2' })
.mockResolvedValueOnce({ items: items.slice(0, 20), nextCursor: 'page-3' })
.mockResolvedValueOnce({ items: items.slice(20) })
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('duplicate-pages'),
@@ -748,7 +752,7 @@ describe('session.search', () => {
controller.abort()
return Promise.resolve({ items: [] })
})
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('cancel-continuation'),
@@ -777,7 +781,7 @@ describe('session.search', () => {
const searchSessions = vi.fn((_request: SessionSearchRequest) => Promise.resolve({
items: [hit('cold-32750')],
}))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('large corpus'),
@@ -813,7 +817,7 @@ describe('session.search', () => {
},
}) as never)
const searchSessions = vi.fn()
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('cancel-during-visibility'),
@@ -840,7 +844,7 @@ describe('session.search', () => {
inspect,
}) as never)
const searchSessions = vi.fn(() => Promise.resolve({ items: [] }))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const response = await (await createSessionTestRemote(ctx, defaults)).search(
request('header-only-visibility'),
@@ -876,7 +880,7 @@ describe('session.search', () => {
const searchSessions = vi.fn()
.mockRejectedValueOnce(aborted)
.mockRejectedValueOnce(new Error('database unavailable'))
installSearchQuery(ctx, searchSessions)
await installSearchQuery(ctx, searchSessions)
const remote = await createSessionTestRemote(ctx, defaults)
const cancelled = await remote.search(
@@ -47,7 +47,7 @@ async function fixture() {
const ctx = new Context()
roots.push(ctx)
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
const session = ctx.sessions.create(brandString<SessionId>('state-target'), { meta: { cwd: '/state-test' } })
let agent: Agent | undefined
const get = vi.fn(() => agent)
@@ -59,7 +59,7 @@ async function bench() {
sessionId === PARENT ? { meta: header, events } : undefined,
),
}) as never)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
provideWorkingDirectoryFixture(ctx)
await ctx.plugin(SubagentRuntime)
const controller = await createSessionTestController(ctx, defaults)
@@ -201,7 +201,7 @@ describe('SessionController subagent catalog', () => {
await ctx.plugin(SessionStore)
await ctx.plugin(SessionProjectionRegistry)
await ctx.plugin(AgentRegistry)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
const controller = await createSessionTestController(ctx, defaults)
const session = ctx.sessions.create(PARENT, { meta: { cwd: '/workspace' } })
const expected = ctx.sessionProjections.snapshot(session)
@@ -222,6 +222,10 @@ export function testSessionPersistence(
/** Concrete point-read query used by Session Controller tests that do not exercise search. */
class TestSessionQuery extends SessionQueryEngine {
initialize(): Promise<void> {
return this[Service.init]()
}
override searchSessions(): Promise<never> {
return Promise.reject(new Error('session search is not configured in this test'))
}
@@ -231,10 +235,14 @@ class TestSessionQuery extends SessionQueryEngine {
}
}
/** Install the required projection and point-query services for direct controller tests. */
export function installSessionReadTestServices(ctx: Context): void {
/**
* Install the required projection and point-query services for direct controller tests.
* @param ctx - test context that receives missing services.
* @returns when the installed query service has registered its projections.
*/
export async function installSessionReadTestServices(ctx: Context): Promise<void> {
if (ctx.get('sessionProjections') === undefined) new SessionProjectionRegistry(ctx)
if (ctx.get('sessionQuery') === undefined) new TestSessionQuery(ctx)
if (ctx.get('sessionQuery') === undefined) await new TestSessionQuery(ctx).initialize()
}
async function installControllers(
@@ -295,7 +303,7 @@ async function installControllers(
retirePrompt: () => {},
} as never)
}
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
if (ctx.get('remoteAccess') === undefined) new RemoteAccessService(ctx)
const cwd = vi.spyOn(process, 'cwd').mockReturnValue(defaults.cwd)
class TestController extends SessionController {
@@ -87,7 +87,6 @@ function controllers(
web: WebController
} {
roots.add(ctx[Context.root])
installSessionReadTestServices(ctx)
const history = new HistoryController(ctx)
return { history, web: new WebController(ctx, history, promote) }
}
@@ -95,7 +94,7 @@ function controllers(
async function setup(): Promise<{ ctx: Context; history: HistoryController; web: WebController }> {
const ctx = new Context()
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
await ctx.sessionProjections.register(subagentIdentityProjectionDefinition)
return { ctx, ...controllers(ctx) }
}
@@ -131,7 +130,7 @@ describe('Session history and Web follow', () => {
it('ends active followers when the owning Controller unloads', async () => {
const ctx = new Context()
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
let web!: WebController
const owner = ctx.plugin(Object.assign(
(inner: Context) => {
@@ -274,7 +273,7 @@ describe('Session history and Web follow', () => {
it('bridges the unpublished end-seed boundary when a cold source attaches', async () => {
const ctx = new Context()
await ctx.plugin(SessionStore)
installSessionReadTestServices(ctx)
await installSessionReadTestServices(ctx)
let web!: WebController
let agentCtx!: Context
await ctx.plugin(Object.assign(
@@ -23,6 +23,7 @@
{ "path": "../../llm/llm" },
{ "path": "../../session/session-projection" },
{ "path": "../../session/session-title" },
{ "path": "../../session-query/session-query" },
{ "path": "../../subagent/subagent" },
{ "path": "../../util/brand" },
{ "path": "../../util/crypto" },
+2 -4
View File
@@ -18,6 +18,7 @@ import type { Agent, AgentOptions } from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-agent-default-model'
import { installModelSelection } from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-fs'
import { extractTextContent } from '@deepseek-ai/dsh-llm/message'
import { createUserMessage } from '@deepseek-ai/dsh-llm'
import { APPROVAL_POLICIES, setApprovalPolicy, type ApprovalPolicy } from '@deepseek-ai/dsh-user-approval'
import { assertNever } from '@deepseek-ai/dsh-util-values'
@@ -99,10 +100,7 @@ function summarize(session: Session, firstSeq: SessionLogOffset): RunOutcome {
}
if (!started) continue
if (event.type === 'assistant/message') {
const joined = event.data.message.content
.filter(block => block.type === 'text')
.map(block => block.text)
.join('')
const joined = extractTextContent(event.data.message.content)
if (joined !== '') text = joined
}
if (event.type === 'turn/end') reason = event.data.reason
+5
View File
@@ -348,6 +348,11 @@
- id: ui-plugin-manager
name: '@deepseek-ai/dsh-client-ui-plugin-manager'
# Connector account sections on the Plugins page; CLI app plugins and MCP
# connectors register their accounts with `ctx.connectorAccounts`.
- id: ui-connector-account
name: '@deepseek-ai/dsh-client-ui-connector-account'
- id: ui-conversation
name: '@deepseek-ai/dsh-client-ui-conversation'
+1
View File
@@ -87,6 +87,7 @@
"@deepseek-ai/dsh-client-ui-brand-official": "workspace:*",
"@deepseek-ai/dsh-client-ui-chat": "workspace:*",
"@deepseek-ai/dsh-client-ui-commands": "workspace:*",
"@deepseek-ai/dsh-client-ui-connector-account": "workspace:*",
"@deepseek-ai/dsh-client-ui-context-menu": "workspace:*",
"@deepseek-ai/dsh-client-ui-conversation": "workspace:*",
"@deepseek-ai/dsh-client-ui-cordis": "workspace:*",
+2 -2
View File
@@ -15,8 +15,8 @@
en: 1eb35b015a6c423f
zh: a8a3dceee2c9e943
/client-web-gui-browser-half/packages:
en: 77ed389434202e77
zh: b82d32cf95253760
en: d358ff0c7eb9d370
zh: 4eed67d9e3a5aef0
/client-web-gui-browser-half/related-documentation:
en: d1d506e68fab7333
zh: 1a90fe6f3f8f24a9
+1
View File
@@ -84,6 +84,7 @@ The kernel packages boot and serve the page; the UI feature packages present it.
| [`ui-settings-subagent/`](ui-settings-subagent/README.md) | Provides the Subagent settings page on the Plugins page | — |
| [`ui-settings-web-search/`](ui-settings-web-search/README.md) | Provides the web search and fetch settings page on the Plugins page | — |
| [`ui-plugin-manager/`](ui-plugin-manager/README.md) | Contributes the sidebar Plugins panel: install, enable, disable, retry, and compose installed packages | — |
| [`ui-connector-account/`](ui-connector-account/README.md) | Holds the accounts connector plugins register on the Host and shows each bundle's account section, tag, activation prompt, confirmations, and notices on the Plugins page | `ctx.connectorAccounts` |
| [`ui-entry-customization/`](ui-entry-customization/README.md) | Adds region-local More menus that pin or unpin plugin launchers and start a plugin draft | — |
| [`ui-plugin-market/`](ui-plugin-market/README.md) | Contributes the Discover tab to the Plugins page: browse market indexes and install their bundles | — |
| [`ui-deliverables/`](ui-deliverables/README.md) | Produces the changed-files card with its comparison tabs, delivery cards, and clickable final-response file references | — |
+1
View File
@@ -84,6 +84,7 @@ kind: "package-group"
| [`ui-settings-subagent/`](ui-settings-subagent/README.zh.md) | 在插件页提供子智能体设置页 | — |
| [`ui-settings-web-search/`](ui-settings-web-search/README.zh.md) | 在插件页提供网页搜索与获取设置页 | — |
| [`ui-plugin-manager/`](ui-plugin-manager/README.zh.md) | 贡献侧栏的“插件”面板:安装、启用、停用、重试与组合已安装的包 | — |
| [`ui-connector-account/`](ui-connector-account/README.zh.md) | 保存连接器插件在 Host 上注册的账号,并在插件页显示每个插件包的账号区块、标签、开启引导、确认和提示 | `ctx.connectorAccounts` |
| [`ui-entry-customization/`](ui-entry-customization/README.zh.md) | 添加分区域的“更多”菜单,固定或收起插件入口,并开始创建插件的草稿 | — |
| [`ui-plugin-market/`](ui-plugin-market/README.zh.md) | 为“插件”页面贡献“发现”标签页:浏览市场索引并安装其中的组合包 | — |
| [`ui-deliverables/`](ui-deliverables/README.zh.md) | 生成改动文件卡片及其对比 tab、交付文件卡片与可点击的最终响应文件引用 | — |
@@ -1,3 +1,4 @@
import { extractTextContent } from '@deepseek-ai/dsh-llm/message'
import type { Context } from '@deepseek-ai/cordis'
import type {
CommandNode, CompactionSummaryNode, ConversationMatch, ConversationNodeContext, ConversationNodeDefinition,
@@ -105,9 +106,7 @@ function compactSummary(match: ConversationMatch | undefined, checkpoint: Conver
if (match?.event.type === 'compaction/summary') {
const data = match.event.data
if (Array.isArray(data.summary)) {
const text = data.summary
.map(block => block.type === 'text' ? block.text : '')
.join('')
const text = extractTextContent(data.summary)
summary = text.trim() === '' ? null : text
}
shadowedItemCount = Array.isArray(data.shadowedSeqs)
@@ -0,0 +1,49 @@
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-connector-account/README.md
/:
en: f09638e4097c52fb
zh: 2fb344b05a189ad0
/deepseek-ai-dsh-client-ui-connector-account:
en: bdb528546ec26353
zh: 0dd55dbc0c8e837a
/deepseek-ai-dsh-client-ui-connector-account/summary:
en: b25fc16fb18a63c1
zh: 4508e8a44745b08d
/deepseek-ai-dsh-client-ui-connector-account/table-of-contents:
en: d152484eb41ac6b4
zh: 5b6bd00fce5371c3
/deepseek-ai-dsh-client-ui-connector-account/use-this-package:
en: 9d8d49a0b1b3ce24
zh: 8eba3710036afa00
/deepseek-ai-dsh-client-ui-connector-account/use-this-package/register-an-account:
en: e618281ea7721daf
zh: a5d5f5e307ea3435
/deepseek-ai-dsh-client-ui-connector-account/use-this-package/present-the-section:
en: fcbc46fc932ed5c8
zh: 2f1cce21453bced6
/deepseek-ai-dsh-client-ui-connector-account/use-this-package/following-operations:
en: 0f6140d7ed6427b9
zh: feadef500ee4fd98
/deepseek-ai-dsh-client-ui-connector-account/use-this-package/shared-copy:
en: 353a48db7e7dd0f7
zh: 653f3d983d3fd572
/deepseek-ai-dsh-client-ui-connector-account/understand-the-implementation:
en: 6bfc9077699bd3cd
zh: ead092e865285eee
/deepseek-ai-dsh-client-ui-connector-account/further-exploration:
en: 029949903a73d283
zh: 6f9a8c2f7620de69
/deepseek-ai-dsh-client-ui-connector-account/model-experience:
en: bdbc56a07884f8d6
zh: 22ca2ee613472c0b
/deepseek-ai-dsh-client-ui-connector-account/model-experience/kv-cache-effect:
en: 4cd0965a7997970e
zh: 690e5a9d945f7f6e
/deepseek-ai-dsh-client-ui-connector-account/known-limitations-and-deferred-work:
en: d2c5f54b80b86b15
zh: 8b637f97ac1d0223
/deepseek-ai-dsh-client-ui-connector-account/known-limitations-and-deferred-work/dev-note:
en: 2ab3c4acae06850c
zh: bd2093ba1fdd6860
@@ -0,0 +1,138 @@
---
description: "Register a connector plugin's account on the Host with `ctx.connectorAccounts` and show its section, title tag, activation prompt, confirmations, and notices on the Plugins page through one `connectorAccounts` Remote, with the registrant's own text and the shared copy of this package."
kind: "package-reference"
---
# @deepseek-ai/dsh-client-ui-connector-account
English | [中文](README.zh.md)
## Summary
Connector plugins register their account on the Host with `ctx.connectorAccounts` to show it on the Plugins page: CLI app plugins register the account their vendor CLI keeps, and MCP connectors their OAuth server's account. The Host decides what the page shows and does: each registrant maps its account to a display, and the registry starts or cancels only the operations the account lists. The browser half renders each bundle's section, title tag, and activation prompt, and opens authorization pages and reports notices only in the browser that started the operation. The Web and Desktop compositions load both halves through [`dsh-web-app`](../../bundle/web-app/README.md).
## Table of Contents
- [Use this package](#use-this-package)
- [Understand the implementation](#understand-the-implementation)
- [Further Exploration](#further-exploration)
- [Model Experience](#model-experience)
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
- [Dev Note](#dev-note)
-----
<a id="use-this-package"></a>
## Use this package
A registrant's Host row registers its account once; the registrant ships no browser code for the account.
### Register an account
The registrant's Host row registers its account source while the registry runs, so a composition without the registry, such as a headless profile, skips the registration:
```ts ignore-check
import type {} from '@deepseek-ai/dsh-client-ui-connector-account'
export function apply(ctx: Context): void {
const account = new AcmeAccount(options)
ctx.effect(() => () => account.dispose(), 'acme: account')
ctx.inject(['connectorAccounts'], (scope) => {
scope.effect(() => scope.connectorAccounts.register({
key: '@acme/cli', packageName: '@acme/cli', source: account, copy,
operations: [{ kind: 'check' }, { kind: 'connect', notice: { en: 'Acme connected', zh: 'Acme 已连接' } }],
present: presentAccount,
}), 'acme: Plugins page account')
})
}
```
- `key` identifies the account in the Remote; the page passes it back to start and cancel operations. A second registration with the same key throws.
- `packageName` is the npm package whose bundle page carries the section and tag; a package carries at most one account. An account without one, such as a server configured in Settings, appears on no bundle page.
- `source` is the account: its current view, change observation, a check, and starting and cancelling operations.
- `operations` lists the kinds a page button may start, each with the optional text its success reports in the browser that started it; the registry rejects any other kind.
- `copy` holds the section title, the hint under it, and the activation prompt's title, body, and Connect label.
The registrant imports the registry's types with `import type` from the package root or `./types`. The returned disposer withdraws the account from every page.
### Present the section
`present(view)` maps the account view to a `ConnectorAccountDisplay`: the phase, the status line, the optional title tag, buttons, the operation Connect starts in the activation prompt, detail, notes, and failure with its untranslated diagnostic items. The registry calls it for every stream on each change, so it only maps the view. Every string is `LocalizedText`, which each browser resolves in its active language. A button carries a command: `start` with one of the registered operation kinds, `cancel` for the operation in progress, which the source ignores in a phase that is not cancellable, or `open` to reopen its authorization page. A button with `confirm` asks first and runs only after the user accepts.
| Surface | Behavior |
|---|---|
| Section | Title, status, buttons, detail, notes, failure, and hint. Buttons, including a confirmation's, are disabled while a call the section made is pending or the Host stream is down. A failure shows the registrant's text, then its diagnostic items |
| Title tag | The display's `badge`, shown only on the enabled bundle's page or one of its row pages, and only while the display has one |
| Activation prompt | Open while the phase is `disconnected` after the bundle is switched on; Connect opens the bundle page and starts the display's `connect` operation, if it names one, and is disabled while the Host stream is down. It waits while the account is checking or connecting and dismisses itself once the account is connected or unavailable |
| Notice | The latest outcome in this browser, outside the Plugins panel's lifetime: the operation's success text, or the shared failure copy with a warning icon |
### Following operations
Each browser opens one stream when the Web app loads, and the Host checks every account that runs no operation for each new stream; an account registered while a stream is open is checked at once. A browser follows the operation its latest start returned, from that answer until the stream delivers the operation's result. Each page the followed operation offers opens once in a new tab, over HTTPS or over HTTP on a loopback address; other browsers show the same section but open no page and report no notice. A second click before the first call answers starts nothing. The stream reconnects after a lost connection; when it fails for good, the sections keep the last accounts with their buttons disabled until the page reloads. Unloading the browser half closes the stream; Host-owned operations keep running.
### Shared copy
The `connectorAccount` dictionary holds the copy every account shares: Close, Cancel, Later, the diagnostic label, and the failure notice. Every other string comes from the registrant.
-----
<a id="understand-the-implementation"></a>
## Understand the implementation
<details>
<summary>Implementation internals — click to expand</summary>
The Host half, `ConnectorAccounts`, is a Remote service. `register()` observes the account's source, and each `watch` stream reads every account's entry after each change, coalescing changes that arrive before the next read: the key and package, the copy, `present(view)`, the operation in progress, and the latest result with its success text. `start` and `cancel` route by key to the account's source.
[`dsh-api-remotes`](../../api/remotes/README.md) mounts the generated `connectorAccounts` Remote. The browser half opens one `watch` stream through `BrowserAccounts`, whose one store holds the Host's accounts by key, whether the stream is delivering, and the latest notice; it also remembers the operations this browser started. It registers one `plugins.detail.badge` entry and one `shell.overlay` notice for the page, and for each account with a package, `plugins.bundle.config` and `plugins.bundle.activation` keyed by the package name, all under the `connectorAccount` namespace. The surfaces receive `start` and `cancel` callbacks that call the Remote and return its result; the buttons report the operation of a successful start to `BrowserAccounts`, and a failed result or a rejected call as the failure notice. An account the Host drops loses its bundle entries, and unloading withdraws every entry and the stream.
| File | Role |
|---|---|
| [`src/index.ts`](src/index.ts) | The `ctx.connectorAccounts` registry and its Remote |
| [`src/types.ts`](src/types.ts) | Registration, source, view, display, and entry types |
| [`src/client/index.ts`](src/client/index.ts) | The browser entry: the dictionary and the slot registrations |
| [`src/client/state.ts`](src/client/state.ts) | The stream store, the operations this browser started, and their pages and notices |
| [`src/client/components.tsx`](src/client/components.tsx) | The slot entries of each surface and the buttons' Remote calls |
| [`src/client/locales.ts`](src/client/locales.ts) | The shared dictionary |
| [`src/client/types.ts`](src/client/types.ts) | Browser state, notice, and face types |
</details>
-----
<a id="further-exploration"></a>
## Further Exploration
- [Plugin manager page](../ui-plugin-manager/README.md) — the Plugins page and its bundle slots.
- [Client package map](../README.md) — adjacent browser UI packages.
-----
<a id="model-experience"></a>
## Model Experience
None, as the registry and its surfaces are Plugins page UI and add no model input. Each registrant documents the tools and skills its account enables.
#### KV Cache effect
None; registering or removing an account changes no model-visible text.
## Known Limitations and Deferred Work
<a id="known-limitations-and-deferred-work"></a>
- The five display phases are fixed; a registrant maps any further account state onto one of them.
- A registrant whose Host row fails to load shows no account section; the Plugins page still lists the bundle with its load failure.
- Each browser that loads the Web app starts a check of every idle account.
- The Web and Desktop compositions load the registry whether or not a connector plugin is installed.
- An authorization page that opens after the call answers can be blocked by the browser; the section's open button shows it again.
<a id="dev-note"></a>
### Dev Note
<details>
<summary>Working context for maintainers — click to expand</summary>
Host specs drive the registry with fake account sources. Client specs drive `BrowserAccounts` with a fake Remote stream, render the surfaces with the Chinese dictionary and a fake Remote, and mount the browser half against a real slot registry and locale runtime.
</details>
@@ -0,0 +1,138 @@
---
description: "通过 `ctx.connectorAccounts` 在 Host 上注册连接器插件的账号,并经由一个 `connectorAccounts` Remote 在插件页显示其区块、标题旁标签、开启引导、确认和提示,文案来自注册方自己的文本和本包的共用文案。"
kind: "package-reference"
---
# @deepseek-ai/dsh-client-ui-connector-account
[English](README.md) | 中文
## 概述
连接器插件在 Host 上通过 `ctx.connectorAccounts` 注册账号,在插件页显示账号:CLI 应用插件注册其厂商 CLI 保存的账号,MCP 连接器注册其 OAuth 服务器的账号。页面显示什么、能做什么由 Host 决定:每个注册方把自己的账号映射为展示内容,注册表只启动或取消该账号列出的操作。浏览器一半渲染每个插件包的区块、标题旁标签和开启引导,并且只在发起操作的浏览器中打开授权页、报告提示。Web 与桌面端组合通过 [`dsh-web-app`](../../bundle/web-app/README.zh.md) 加载这两半。
## 目录
- [使用此包](#use-this-package)
- [理解实现](#understand-the-implementation)
- [延伸阅读](#further-exploration)
- [模型体验](#model-experience)
- [已知限制与后续工作](#known-limitations-and-deferred-work)
- [开发备注](#dev-note)
-----
<a id="use-this-package"></a>
## 使用此包
注册方的 Host 行注册一次账号;注册方不为账号提供任何浏览器代码。
### 注册账号
注册方的 Host 行在注册表运行时注册其账号来源,因此没有注册表的组合(如 headless profile)会跳过注册:
```ts ignore-check
import type {} from '@deepseek-ai/dsh-client-ui-connector-account'
export function apply(ctx: Context): void {
const account = new AcmeAccount(options)
ctx.effect(() => () => account.dispose(), 'acme: account')
ctx.inject(['connectorAccounts'], (scope) => {
scope.effect(() => scope.connectorAccounts.register({
key: '@acme/cli', packageName: '@acme/cli', source: account, copy,
operations: [{ kind: 'check' }, { kind: 'connect', notice: { en: 'Acme connected', zh: 'Acme 已连接' } }],
present: presentAccount,
}), 'acme: Plugins page account')
})
}
```
- `key` 在 Remote 中标识该账号;页面启动和取消操作时把它传回。用同一个键再次注册会抛出异常。
- `packageName` 是其插件包页面承载区块和标签的 npm 包;一个包最多承载一个账号。没有包名的账号(如在 Settings 中配置的服务器)不出现在任何插件包页面上。
- `source` 是账号:其当前视图、变化观察、检查,以及启动和取消操作。
- `operations` 列出页面按钮可以启动的操作类型,每项可带该操作成功时在发起它的浏览器中报告的文本;注册表拒绝其他类型。
- `copy` 包含区块标题、区块下方的提示,以及开启引导的标题、正文和连接按钮文案。
注册方用 `import type` 从包根或 `./types` 导入注册表的类型。返回的销毁函数会把账号从所有页面撤下。
### 展示区块
`present(view)` 把账号视图映射为 `ConnectorAccountDisplay`:阶段、状态行、可选的标题旁标签、按钮、开启引导中“连接”启动的操作、说明、附加行,以及带不翻译诊断项的失败信息。注册表在每次变化时为每条流调用它,因此它只做视图映射。所有文案都是 `LocalizedText`,由各浏览器按当前语言解析。按钮携带一个命令:`start` 启动某个已注册的操作类型,`cancel` 取消进行中的操作(处于不可取消的阶段时来源会忽略),`open` 重新打开其授权页。带 `confirm` 的按钮会先询问,用户确认后才执行。
| 界面 | 行为 |
|---|---|
| 区块 | 标题、状态、按钮、说明、附加行、失败信息和提示。区块发起的调用未返回,或 Host 流中断时,按钮(包括确认框的按钮)不可用。失败时先显示注册方的文案,再显示其诊断项 |
| 标题旁标签 | 显示 display 的 `badge`,只出现在已启用插件包的页面或其某一行的页面上,且只在 display 带有标签时显示 |
| 开启引导 | 插件包开启后,阶段为 `disconnected` 时打开;“连接”会打开插件包页面,并在 display 给出 `connect` 时启动该操作;Host 流中断时它不可用。账号检查中或连接中时继续等待,已连接或不可用时自动关闭 |
| 提示 | 本浏览器的最新结果,不受插件面板生命周期限制:操作成功的文本,或带警告图标的共用失败文案 |
### 跟随操作
每个浏览器在 Web 应用加载时打开一条流,Host 为每条新流检查每个没有在运行操作的账号;流打开期间注册的账号会立即检查。浏览器跟随其最近一次启动返回的操作,从返回时起,直到流推送该操作的结果。被跟随的操作提供的每个页面只在新标签页中打开一次,只打开 HTTPS 页面或回环地址上的 HTTP 页面;其他浏览器显示同样的区块,但不打开页面,也不报告提示。第一次调用返回前的第二次点击不会启动任何操作。连接断开后流会自动重连;流永久失败时,区块保留最后的账号,按钮不可用,直到页面重新加载。卸载浏览器一半会关闭流;Host 持有的操作继续运行。
### 共用文案
`connectorAccount` 字典包含所有账号共用的文案:关闭、取消、稍后、排障信息标签和失败提示。其余文案都来自注册方。
-----
<a id="understand-the-implementation"></a>
## 理解实现
<details>
<summary>实现细节——点击展开</summary>
Host 一半 `ConnectorAccounts` 是一个 Remote 服务。`register()` 观察账号来源,每条 `watch` 流在每次变化后读取每个账号的条目,并合并在下一次读取前到达的变化:键和包、文案、`present(view)`、进行中的操作,以及带成功文本的最新结果。`start` 和 `cancel` 按键路由到该账号的来源。
[`dsh-api-remotes`](../../api/remotes/README.zh.md) 挂载生成的 `connectorAccounts` Remote。浏览器一半通过 `BrowserAccounts` 打开一条 `watch` 流;它的一个 store 保存按键索引的 Host 账号、流是否在推送,以及最新提示,同时记住本浏览器发起的操作。它为页面注册一个 `plugins.detail.badge` 条目和一个 `shell.overlay` 提示,并为每个带包名的账号注册以包名为键的 `plugins.bundle.config` 和 `plugins.bundle.activation`,全部使用 `connectorAccount` 命名空间。各界面收到 `start` 和 `cancel` 两个回调:它们调用 Remote 并返回其结果;按钮把启动成功时返回的操作报告给 `BrowserAccounts`,结果为失败或调用被 reject 时报告失败提示。Host 撤下的账号会失去其插件包条目;卸载时撤下所有条目和流。
| 文件 | 职责 |
|---|---|
| [`src/index.ts`](src/index.ts) | `ctx.connectorAccounts` 注册表及其 Remote |
| [`src/types.ts`](src/types.ts) | 注册、来源、视图、display 和条目类型 |
| [`src/client/index.ts`](src/client/index.ts) | 浏览器入口:字典和插槽注册 |
| [`src/client/state.ts`](src/client/state.ts) | 流的 store、本浏览器发起的操作,以及它们的页面和提示 |
| [`src/client/components.tsx`](src/client/components.tsx) | 各界面的插槽条目,以及按钮的 Remote 调用 |
| [`src/client/locales.ts`](src/client/locales.ts) | 共用字典 |
| [`src/client/types.ts`](src/client/types.ts) | 浏览器状态、提示和 face 类型 |
</details>
-----
<a id="further-exploration"></a>
## 延伸阅读
- [插件管理页](../ui-plugin-manager/README.zh.md)——插件页及其插件包插槽。
- [客户端包地图](../README.zh.md)——相邻的浏览器 UI 包。
-----
<a id="model-experience"></a>
## 模型体验
无,注册表及其界面属于插件页 UI,不增加模型输入。各注册方自行说明其账号启用的工具和技能。
#### KV Cache 影响
无;注册或移除账号不改变任何模型可见文本。
## 已知限制与后续工作
<a id="known-limitations-and-deferred-work"></a>
- 五个显示阶段固定不变;注册方需把其他账号状态映射到其中之一。
- Host 行加载失败的注册方不显示账号区块;插件页仍会列出该插件包及其加载失败。
- 每个加载 Web 应用的浏览器都会触发一次对所有空闲账号的检查。
- 无论是否安装了连接器插件,Web 与桌面端组合都会加载注册表。
- 调用返回后才打开的授权页可能被浏览器拦截;区块中的打开按钮可以再次打开它。
<a id="dev-note"></a>
### 开发备注
<details>
<summary>维护者工作上下文——点击展开</summary>
Host 测试用假的账号来源驱动注册表。客户端测试用假的 Remote 流驱动 `BrowserAccounts`,用中文字典和假的 Remote 渲染各界面,并在真实的插槽注册表和 locale 运行时上挂载浏览器一半。
</details>
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Connector-Kontoverbindung",
"description": "Kontobereich, Titel-Tag, Aktivierungshinweis und Benachrichtigungen auf der Seite „Plugins“ für Connector-Plugins."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Connector account connection",
"description": "Account section, title tag, activation prompt, and notices on the Plugins page for connector plugins."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Conexión de cuenta de conectores",
"description": "Sección de cuenta, etiqueta del título, aviso de activación y notificaciones en la página Complementos para los complementos de conectores."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Connexion de compte de connecteur",
"description": "Section de compte, étiquette de titre, invite d’activation et notifications sur la page Plugins pour les plugins de connecteur."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "コネクターアカウント接続",
"description": "コネクタープラグイン向けに、「プラグイン」ページでのアカウントセクション、タイトルタグ、有効化時の案内、通知を提供します。"
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Conexão de conta de conector",
"description": "Seção da conta, etiqueta do título, aviso de ativação e notificações na página Plug-ins para plugins de conector."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Подключение аккаунта коннектора",
"description": "Раздел аккаунта, метка у заголовка, подсказка при включении и уведомления на странице «Плагины» для плагинов-коннекторов."
}
}
@@ -0,0 +1,6 @@
{
"meta": {
"title": "连接器账号连接",
"description": "在插件页为连接器插件提供账号区块、标题标签、开启引导与提示。"
}
}
@@ -0,0 +1,96 @@
{
"name": "@deepseek-ai/dsh-client-ui-connector-account",
"description": "Connector account surfaces: the Host registry CLI app plugins and MCP connectors register their accounts with, and the Plugins page section, title tag, activation prompt, and notices it serves over one Remote",
"version": "0.2.2-rc.3",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
"directory": "packages/client/ui-connector-account"
},
"type": "module",
"main": "lib/index.js",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./client": {
"types": "./lib/types/client/index.d.ts",
"default": "./lib/client.js"
},
"./types": {
"types": "./lib/types/types.d.ts"
},
"./src/*": "./src/*",
"./package.json": "./package.json",
"./typert": {
"types": "./lib/typert.host.d.ts",
"default": "./lib/typert.host.js"
},
"./remote": {
"types": "./lib/typert.remote-client.d.ts",
"default": "./lib/typert.remote-client.js"
},
"./locale/*.json": "./locale/*.json"
},
"dsh": {
"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"
},
"license": "MIT",
"dependencies": {
"@deepseek-ai/dsh-typert-protocol": "workspace:*",
"zod": "4.6.6"
},
"peerDependencies": {
"@deepseek-ai/cordis": "workspace:~"
},
"devDependencies": {
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh-api-gateway": "workspace:*",
"@deepseek-ai/dsh-api-remotes": "workspace:*",
"@deepseek-ai/dsh-brand": "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-package-manifest": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@testing-library/react": "^16.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"files": [
"locale/*.json",
"lib/index.js",
"lib/client.js",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"lib/**/*.js.map",
"lib/typert.host.js",
"lib/typert.host.d.ts",
"lib/typert.remote-client.js",
"lib/typert.remote-client.d.ts",
"lib/typert.remote-client.d.ts.map",
"src"
]
}
@@ -0,0 +1,56 @@
.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;
flex-wrap: wrap;
align-items: center;
gap: 8px;
min-height: 28px;
}
.label {
flex: 1 1 auto;
min-width: 0;
overflow-wrap: anywhere;
font-size: 13px;
line-height: 20px;
color: var(--dsw-alias-label-primary);
}
.actions {
display: flex;
flex-wrap: wrap;
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);
}
@@ -0,0 +1,223 @@
/**
* The account surfaces the Plugins page shows for registered connector accounts: a bundle's section with the
* confirmation a button asks for, the title tag, the activation prompt, and the notice. Each is the slot entry that reads
* this browser's state and calls the Host through the injected callbacks.
*/
import { useEffect, useRef, 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, PropsRuntime, Translate } from '@deepseek-ai/dsh-client-ui-slots'
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
import { assertNever } from '@deepseek-ai/dsh-util-values'
import type { ConnectorAccountButton, ConnectorAccountCommand, ConnectorAccountEntry, ConnectorAccountPhase } from '../types.ts'
import css from './ConnectorAccount.module.css'
import type { ConnectorAccountKey } from './locales.ts'
import { openAuthorizationPage } from './state.ts'
import type { ConnectorAccountFace, ConnectorAccountsState, ConnectorBundleAccountFace } from './types.ts'
type FaceProps = InjectFace<ConnectorAccountFace> & { t: Translate<ConnectorAccountKey> }
type BundleFaceProps = InjectFace<ConnectorBundleAccountFace> & { t: Translate<ConnectorAccountKey> }
const TONE: Record<ConnectorAccountPhase, StateDotState> = {
checking: 'ongoing', connecting: 'ongoing', connected: 'done', disconnected: 'idle', unavailable: 'warning',
}
const BADGE_TONE: Record<ConnectorAccountPhase, TagTone> = {
checking: 'outline', connecting: 'info', connected: 'success', disconnected: 'outline', unavailable: 'warning',
}
/**
* Run a button's command against the Host: start and cancel call the face's callbacks, and open shows the
* operation's authorization page again in this browser.
* @param face - the Host callbacks and the browser state the commands read and report to.
* @returns whether a call this surface made has not answered, whether the Host stream is delivering, and the runner of
* one account's command.
*/
function useAccountCommand(
face: Pick<FaceProps, 'useConnectorAccounts' | 'start' | 'cancel' | 'follow' | 'failed'>,
): {
readonly busy: boolean
readonly linked: boolean
readonly run: (entry: ConnectorAccountEntry, command: ConnectorAccountCommand) => void
} {
const linked = face.useConnectorAccounts(state => state.linked)
const [busy, setBusy] = useState(false)
// A second click before the re-render still finds the first call pending.
const pending = useRef(false)
// `operation` resolves to whether the Host accepted the call.
const call = (operation: () => Promise<boolean>): void => {
if (pending.current) return
pending.current = true
setBusy(true)
// The Host keeps the diagnostic; the page reports one retryable outcome.
void operation()
.then((accepted) => { if (!accepted) face.failed() })
.catch(() => { face.failed() })
.finally(() => { pending.current = false; setBusy(false) })
}
const run = (entry: ConnectorAccountEntry, command: ConnectorAccountCommand): void => {
const { key } = entry
switch (command.kind) {
case 'start':
call(async () => {
const started = await face.start(key, command.operation)
if (started.ok) face.follow(key, started.value)
return started.ok
})
return
case 'cancel': {
const operation = entry.operation
if (operation !== undefined) call(async () => (await face.cancel(key, operation.id)).ok)
return
}
case 'open':
openAuthorizationPage(entry.operation?.authorizationUrl)
return
/* v8 ignore next -- closed command union */
default: assertNever(command)
}
}
return { busy, linked, run }
}
/** Ask before an action that changes the account outside DSH; the dialog closes before it confirms. */
function Confirm(props: {
readonly t: Translate<ConnectorAccountKey>
readonly title: string
readonly body: string
readonly label: string
readonly disabled: boolean
readonly onClose: () => void
readonly onConfirm: () => void
}): ReactNode {
const { t, title, body, label, disabled, onClose, onConfirm } = props
return (
<Modal open title={title} closeLabel={t('close')} onClose={onClose}
footer={<>
<Button variant="ghost" onClick={onClose}>{t('action.cancel')}</Button>
<Button variant="primary" data-modal-autofocus disabled={disabled} onClick={() => { onClose(); onConfirm() }}>{label}</Button>
</>}>
<p>{body}</p>
</Modal>
)
}
/**
* The `plugins.bundle.config` entry: the account section on its bundle's page.
* @param props - the bundle's face and the translator.
* @returns the title, status line, buttons, detail, notes, failure, hint, and the confirmation a button asked for, or
* null before the Host lists the account.
*/
export function ConnectorAccountSectionEntry(props: BundleFaceProps): ReactNode {
const { useConnectorAccounts, account, resolveText, t } = props
const entry = useConnectorAccounts(state => state.accounts.get(account))
const { busy, linked, run } = useAccountCommand(props)
const disabled = busy || !linked
const [confirming, setConfirming] = useState<ConnectorAccountButton>()
if (entry === undefined) return null
const { display } = entry
const button = (item: ConnectorAccountButton): ReactNode => {
const label = resolveText(item.label)
const onClick = item.confirm === undefined ? () => { run(entry, item.command) } : () => { setConfirming(item) }
return <Button key={label} variant={item.variant ?? 'outline'} size="sm" disabled={disabled} onClick={onClick}>{label}</Button>
}
const details = display.failure?.details ?? []
const confirm = confirming?.confirm
return (
<div className={css.section} data-connector-account={display.phase} data-connector-account-key={entry.key}>
<h4 className={css.title}>{resolveText(entry.copy.title)}</h4>
<div className={css.status}>
<StateDot state={TONE[display.phase]} />
<span className={css.label}>{resolveText(display.status)}</span>
<div className={css.actions}>{display.buttons.map(button)}</div>
</div>
{display.detail === undefined ? null : <p className={css.detail}>{resolveText(display.detail)}</p>}
{display.notes.map((note) => {
const text = resolveText(note.text)
return (
<div key={text} className={css.status}>
<span className={css.detail}>{text}</span>
{note.button === undefined ? null : <div className={css.actions}>{button(note.button)}</div>}
</div>
)
})}
{display.failure === undefined ? null : (
<p className={css.failure} role="alert">
{resolveText(display.failure.text)}
{details.length === 0 ? null : <> {t('failure.details', { details: details.join(' · ') })}</>}
</p>
)}
<p className={css.hint}>{resolveText(entry.copy.hint)}</p>
{confirming === undefined || confirm === undefined ? null : (
<Confirm t={t} title={resolveText(confirm.title)} body={resolveText(confirm.body)} label={resolveText(confirm.label)}
disabled={disabled} onClose={() => { setConfirming(undefined) }} onConfirm={() => { run(entry, confirming.command) }} />
)}
</div>
)
}
function accountOf(state: ConnectorAccountsState, packageName: string): ConnectorAccountEntry | undefined {
for (const entry of state.accounts.values()) if (entry.packageName === packageName) return entry
return undefined
}
/**
* The `plugins.detail.badge` entry shared by every bundle that owns an account.
* @param props - the open detail page's subject and the face.
* @returns the display's tag on the page of an enabled bundle that owns an account, or of one of its rows, or null.
*/
export function ConnectorAccountBadgeEntry(props: FaceProps & Pick<PropsRuntime<'plugins.detail.badge'>, 'subject'>): ReactNode {
const { useConnectorAccounts, resolveText, subject } = props
const packageName = subject.kind === 'item' || !subject.pkg.enabled ? undefined : subject.pkg.name
const entry = useConnectorAccounts(state => packageName === undefined ? undefined : accountOf(state, packageName))
const badge = entry?.display.badge
return entry === undefined || badge === undefined ? null : <Tag tone={BADGE_TONE[entry.display.phase]}>{resolveText(badge)}</Tag>
}
/**
* The `plugins.bundle.activation` entry: guidance after the user switches a bundle on while its account is not
* connected. Connect opens the bundle page and starts the display's `connect` command.
* @param props - activation callbacks, the bundle's face, and the translator.
* @returns a prompt shown while disconnected, or null before the Host lists the account. It waits while the account is
* checking or connecting, which may still end disconnected, and dismisses itself once the account is connected or
* unavailable.
*/
export function ConnectorAccountActivationEntry(
props: BundleFaceProps & Pick<PropsRuntime<'plugins.bundle.activation'>, 'onDismiss' | 'onOpenDetails'>,
): ReactNode {
const { useConnectorAccounts, account, resolveText, onDismiss, onOpenDetails, t } = props
const entry = useConnectorAccounts(state => state.accounts.get(account))
const { linked, run } = useAccountCommand(props)
const phase = entry?.display.phase
useEffect(() => {
if (phase === 'connected' || phase === 'unavailable') onDismiss()
}, [phase, onDismiss])
if (entry === undefined) return null
const { activation } = entry.copy
const { connect } = entry.display
const onConnect = (): void => {
onOpenDetails()
if (connect !== undefined) run(entry, connect)
}
return (
<Modal open={phase === 'disconnected'} title={resolveText(activation.title)} closeLabel={t('close')} onClose={onDismiss}
footer={<>
<Button variant="ghost" onClick={onDismiss}>{t('activation.later')}</Button>
<Button variant="primary" data-modal-autofocus disabled={!linked} onClick={onConnect}>{resolveText(activation.connect)}</Button>
</>}>
<p>{resolveText(activation.body)}</p>
</Modal>
)
}
/**
* The `shell.overlay` entry: account outcomes reported outside the Plugins panel's lifetime.
* @param props - the face and the translator.
* @returns the toast for the latest notice, or null.
*/
export function ConnectorAccountToastEntry({ useConnectorAccounts, resolveText, dismissNotice, t }: FaceProps): ReactNode {
const notice = useConnectorAccounts(state => state.notice)
if (notice === undefined) return null
return notice.kind === 'action-failed'
? <Toast key={notice.seq} text={t('notice.action-failed')} icon={<IconWarningOutlineRegular />} onDone={dismissNotice} />
: <Toast key={notice.seq} text={resolveText(notice.text)} tone="success" onDone={dismissNotice} />
}
@@ -0,0 +1,91 @@
/**
* Connector account surfaces, browser half: follows the accounts CLI app plugins and MCP connectors register on the Host,
* and shows each bundle's section, title tag, and activation prompt on its Plugins page, with the notices of the
* operations this browser started. The surfaces read the shared copy from this package's dictionary and each
* registrant's text from the Host.
*/
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-api-remotes/client'
import type {} from '@deepseek-ai/dsh-client-locale/client'
import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
import {
ConnectorAccountActivationEntry, ConnectorAccountBadgeEntry, ConnectorAccountSectionEntry, ConnectorAccountToastEntry,
} from './components.tsx'
import { de, en, es, fr, ja, NS, pt, ru, zh } from './locales.ts'
import { BrowserAccounts } from './state.ts'
import type { ConnectorAccountFace } from './types.ts'
export type { ConnectorAccountKey } from './locales.ts'
export type {
ConnectorAccountFace, ConnectorAccountNotice, ConnectorAccountsState, ConnectorBundleAccountFace,
} from './types.ts'
/** The `connectorAccounts` Remote that `dsh-api-remotes` mounts, and the services the slot registrations need. */
export const inject = ['remote', 'remote.connectorAccounts', 'slots', 'locale']
function registerBundle(ctx: Context, face: ConnectorAccountFace, packageName: string, account: string): () => void {
const bundle = { ...face, account }
const dispose = ctx.effect(function* () {
yield ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
name: 'plugins.bundle.config', key: packageName, locale: NS, inject: () => bundle,
}, ConnectorAccountSectionEntry))
yield ctx.slots.inject('plugins.bundle.activation', () => ctx.slots.register({
name: 'plugins.bundle.activation', key: packageName, locale: NS, inject: () => bundle,
}, ConnectorAccountActivationEntry))
}, `connector-account: ${packageName}`)
return () => void dispose()
}
/**
* Show the registered connector accounts for one plugin lifetime: one tag and one notice entry for the page, and a
* section and activation prompt for each bundle that owns an account.
* @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 }), 'connector-account: dictionaries')
const remote = ctx.remote.connectorAccounts
const browser = new BrowserAccounts(ctx, remote)
ctx.effect(() => async () => { await browser.dispose() }, 'connector-account: stream')
const face: ConnectorAccountFace = {
hooks: { connectorAccounts: browser.state },
start: (key, operation) => remote.start(key, operation),
cancel: (key, id) => remote.cancel(key, id),
resolveText: text => ctx.locale.resolveText(text),
follow: (key, id) => { browser.follow(key, id) },
failed: () => { browser.failed() },
dismissNotice: () => { browser.dismissNotice() },
}
ctx.effect(function* () {
yield ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
name: 'plugins.detail.badge', id: 'connector-account.badge', locale: NS, inject: () => face,
}, ConnectorAccountBadgeEntry))
yield ctx.slots.inject('shell.overlay', () => ctx.slots.register({
name: 'shell.overlay', id: 'connector-account.notice', locale: NS, inject: () => face,
}, ConnectorAccountToastEntry))
}, 'connector-account: page surfaces')
ctx.effect(() => {
const shown = new Map<string, { readonly account: string; readonly withdraw: () => void }>()
const sync = (): void => {
const owned = new Map<string, string>()
for (const entry of browser.state.getSnapshot().accounts.values()) {
if (entry.packageName !== undefined) owned.set(entry.packageName, entry.key)
}
for (const [packageName, surfaces] of shown) {
if (owned.get(packageName) === surfaces.account) continue
surfaces.withdraw()
shown.delete(packageName)
}
for (const [packageName, account] of owned) {
if (!shown.has(packageName)) shown.set(packageName, { account, withdraw: registerBundle(ctx, face, packageName, account) })
}
}
sync()
const stop = browser.state.subscribe(sync)
return () => {
stop()
for (const surfaces of shown.values()) surfaces.withdraw()
}
}, 'connector-account: bundle surfaces')
}
@@ -0,0 +1,86 @@
/** Locale-owned copy the connector account surfaces share; each registrant's own text arrives from the Host. */
import type {} from '@deepseek-ai/dsh-client-ui-slots'
/** Dictionary namespace of the shared account copy. */
export const NS = 'connectorAccount'
/** Chinese dictionary and key source. */
export const zh = {
close: '关闭',
'action.cancel': '取消',
'activation.later': '稍后',
'failure.details': '排障信息:{details}',
'notice.action-failed': '操作未完成,请重试',
}
/** Every key the shared account surfaces translate. */
export type ConnectorAccountKey = keyof typeof zh
/** English dictionary. */
export const en: Record<ConnectorAccountKey, string> = {
close: 'Close',
'action.cancel': 'Cancel',
'activation.later': 'Later',
'failure.details': 'Diagnostic: {details}',
'notice.action-failed': 'The action did not finish. Try again.',
}
/** Japanese dictionary. */
export const ja: Record<ConnectorAccountKey, string> = {
close: '閉じる',
'action.cancel': 'キャンセル',
'activation.later': '後で',
'failure.details': '診断情報:{details}',
'notice.action-failed': '操作が完了しませんでした。もう一度お試しください。',
}
/** Spanish dictionary. */
export const es: Record<ConnectorAccountKey, string> = {
close: 'Cerrar',
'action.cancel': 'Cancelar',
'activation.later': 'Más tarde',
'failure.details': 'Diagnóstico: {details}',
'notice.action-failed': 'La acción no se completó. Inténtelo de nuevo.',
}
/** French dictionary. */
export const fr: Record<ConnectorAccountKey, string> = {
close: 'Fermer',
'action.cancel': 'Annuler',
'activation.later': 'Plus tard',
'failure.details': 'Diagnostic : {details}',
'notice.action-failed': 'L’action n’a pas abouti. Réessayez.',
}
/** German dictionary. */
export const de: Record<ConnectorAccountKey, string> = {
close: 'Schließen',
'action.cancel': 'Abbrechen',
'activation.later': 'Später',
'failure.details': 'Diagnose: {details}',
'notice.action-failed': 'Die Aktion wurde nicht abgeschlossen. Versuchen Sie es erneut.',
}
/** Russian dictionary. */
export const ru: Record<ConnectorAccountKey, string> = {
close: 'Закрыть',
'action.cancel': 'Отмена',
'activation.later': 'Позже',
'failure.details': 'Диагностика: {details}',
'notice.action-failed': 'Действие не завершено. Повторите попытку.',
}
/** Portuguese dictionary. */
export const pt: Record<ConnectorAccountKey, string> = {
close: 'Fechar',
'action.cancel': 'Cancelar',
'activation.later': 'Mais tarde',
'failure.details': 'Diagnóstico: {details}',
'notice.action-failed': 'A ação não foi concluída. Tente novamente.',
}
declare module '@deepseek-ai/dsh-client-ui-slots' {
interface LocaleNamespaceMap {
connectorAccount: ConnectorAccountKey
}
}
@@ -0,0 +1,142 @@
/**
* The page's one subscription to the registered accounts, and what only this browser knows about them: the operations
* it started, whose authorization pages open here, and the notice to show.
*/
import type { Context } from '@deepseek-ai/cordis'
import type { RemoteStream } from '@deepseek-ai/dsh-api-gateway/client'
import type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client'
import { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
import type { ConnectorAccountEntry, ConnectorAccountsView, ConnectorOperationId } from '../types.ts'
import type { ConnectorAccountNotice, ConnectorAccountsState } from './types.ts'
const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]'])
/**
* Open an authorization page in a new tab when it is HTTPS, or HTTP on a loopback address such as a local
* authorization server.
* @param url - the page an operation waits on; other values open nothing.
*/
export function openAuthorizationPage(url: string | undefined): void {
if (url === undefined || !URL.canParse(url)) return
const parsed = new URL(url)
if (parsed.protocol === 'https:' || (parsed.protocol === 'http:' && LOOPBACK_HOSTS.has(parsed.hostname))) {
window.open(url, '_blank', 'noopener,noreferrer')
}
}
/** One Host subscription per browser, shared by every account surface on the page. */
export class BrowserAccounts {
/** The accounts, stream state, and notice every surface on the page reads. */
readonly state: SnapshotStore<ConnectorAccountsState> = createSnapshotStore<ConnectorAccountsState>({
accounts: new Map(), linked: true, notice: undefined,
})
/**
* The operation each account's latest start in this browser returned, with the pages already opened for it. It lasts
* until the stream delivers its result or the account leaves.
*/
private readonly followed = new Map<string, { readonly id: ConnectorOperationId; readonly opened: Set<string> }>()
private seq = 0
private disposed = false
private readonly stream: RemoteStream<ConnectorAccountsView>
private readonly observing: Promise<void>
/**
* @param ctx - the browser context carrying the Remote client.
* @param remote - the `connectorAccounts` Remote.
*/
constructor(private readonly ctx: Context, remote: Pick<ClientRemote['connectorAccounts'], 'watch'>) {
this.stream = ctx.remote.$stream<ConnectorAccountsView>({
name: 'Connector accounts', open: signal => remote.watch(signal),
ended: () => new Error('Connector accounts stream ended'),
carrierFailed: () => { this.patch({ linked: false }) },
})
this.observing = this.observe()
}
/**
* Follow an operation this browser started, replacing the account's previous one.
* @param key - the account key.
* @param id - the operation the Host started.
*/
follow(key: string, id: ConnectorOperationId): void {
if (this.disposed) return
this.followed.set(key, { id, opened: new Set() })
// The stream may have delivered the operation before the start call answered.
const entry = this.state.getSnapshot().accounts.get(key)
if (entry !== undefined) this.track(entry)
}
/** Report that a Remote call this browser made did not finish; the Host keeps the diagnostic. */
failed(): void {
this.notify({ kind: 'action-failed' })
}
/** Clear the notice once it has been shown. */
dismissNotice(): void {
this.patch({ notice: undefined })
}
/**
* Stop observing the Host; afterwards the page opens no page and reports nothing more. Host-owned operations keep
* running.
* @returns after the stream closes.
*/
async dispose(): Promise<void> {
this.disposed = true
await this.stream.dispose()
await this.observing
}
private async observe(): Promise<void> {
try {
for await (const item of this.stream) {
// An item the stream yielded just before disposal must not reach the disposed page.
if (this.disposed) return
this.show(item.value.accounts)
item.accept()
}
} catch (error) {
// A terminal failure, such as a Host without the registry, leaves the buttons disabled until the page reloads.
if (this.disposed) return
this.patch({ linked: false })
this.ctx.logger.warn('connector accounts stream failed; reload the page to reconnect: %s', error)
}
}
private show(entries: readonly ConnectorAccountEntry[]): void {
const accounts = new Map(entries.map(entry => [entry.key, entry]))
for (const key of [...this.followed.keys()]) if (!accounts.has(key)) this.followed.delete(key)
this.patch({ accounts, linked: true })
for (const entry of entries) this.track(entry)
}
/** Open each new page of the account's followed operation once, and report its success once its result arrives. */
private track(entry: ConnectorAccountEntry): void {
const followed = this.followed.get(entry.key)
if (followed === undefined) return
const url = entry.operation?.id === followed.id ? entry.operation.authorizationUrl : undefined
if (url !== undefined && !followed.opened.has(url)) {
followed.opened.add(url)
openAuthorizationPage(url)
}
const result = entry.result
if (result?.id !== followed.id) return
this.followed.delete(entry.key)
if (result.notice !== undefined) this.notify({ kind: 'succeeded', text: result.notice })
}
private notify(
notice: { readonly kind: 'succeeded'; readonly text: LocalizedText } | { readonly kind: 'action-failed' },
): void {
if (this.disposed) return
this.seq += 1
const next: ConnectorAccountNotice = { ...notice, seq: this.seq }
this.patch({ notice: next })
}
private patch(change: Partial<ConnectorAccountsState>): void {
this.state.set({ ...this.state.getSnapshot(), ...change })
}
}
@@ -0,0 +1,44 @@
/** Browser-side state and face of the accounts the Plugins page shows. */
import type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client'
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
import type { ConnectorAccountEntry, ConnectorOperationId } from '../types.ts'
/** A transient outcome the page reports outside its own lifetime; `seq` distinguishes repeats. */
export type ConnectorAccountNotice =
| { readonly seq: number; readonly kind: 'succeeded'; readonly text: LocalizedText }
| { readonly seq: number; readonly kind: 'action-failed' }
/** What this browser shows: the Host's accounts, the stream state, and the latest notice. */
export interface ConnectorAccountsState {
/** Registered accounts by key, as the Host last published them. */
readonly accounts: ReadonlyMap<string, ConnectorAccountEntry>
/** Whether the Host stream is delivering. */
readonly linked: boolean
readonly notice: ConnectorAccountNotice | undefined
}
/** The face every surface entry injects. */
export interface ConnectorAccountFace {
hooks: { connectorAccounts: HostObservable<ConnectorAccountsState> }
/**
* Start an operation of an account on the Host. The Remote result carries the operation the Host started, or the
* failure when the Host refuses or the call does not answer.
*/
readonly start: ClientRemote['connectorAccounts']['start']
/** Cancel an account's operation on the Host; the Remote result carries a failure like `start`. */
readonly cancel: ClientRemote['connectorAccounts']['cancel']
/** Pick the active language's entry of a registrant's text. */
readonly resolveText: (text: LocalizedText) => string
/** Remember an operation this browser started: its authorization page opens here, and its success is reported here. */
readonly follow: (key: string, id: ConnectorOperationId) => void
/** Report that a Remote call this browser made did not finish. */
readonly failed: () => void
readonly dismissNotice: () => void
}
/** The face of a bundle's own surfaces, which show the bundle's account. */
export interface ConnectorBundleAccountFace extends ConnectorAccountFace {
/** The key of the account the bundle owns. */
readonly account: string
}
@@ -0,0 +1,6 @@
declare module '*.module.css' {
const classes: Record<string, string>
export default classes
}
declare module '*.css'
@@ -0,0 +1,163 @@
/**
* Connector account surfaces, Host half. CLI app plugins and MCP connectors register their accounts with
* `ctx.connectorAccounts`; the Plugins page follows every registered account through the `connectorAccounts` Remote and
* starts or cancels operations through it, so the browser never learns how an account connects.
* @module @deepseek-ai/dsh-client-ui-connector-account
*/
import type { Context } from '@deepseek-ai/cordis'
import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
import type {
AnyConnectorAccountView, ConnectorAccountEntry, ConnectorAccountRegistration, ConnectorAccountsView, ConnectorOperationId,
} from './types.ts'
export type * from './types.ts'
declare module '@deepseek-ai/cordis' {
interface Context {
/** Connector accounts on the Plugins page. */
connectorAccounts: ConnectorAccounts
}
}
interface Registered {
readonly packageName: string | undefined
readonly entry: () => ConnectorAccountEntry
readonly refresh: () => void
readonly start: (operation: string) => ConnectorOperationId | Promise<ConnectorOperationId>
readonly cancel: (id: ConnectorOperationId) => Promise<void>
}
function registeredOf<View extends AnyConnectorAccountView>(registration: ConnectorAccountRegistration<View>): Registered {
const { key, packageName, source, operations, copy, present } = registration
return {
packageName,
entry: () => {
const view = source.snapshot()
const { operation, result } = view
const notice = result?.outcome === 'succeeded' ? operations.find(candidate => candidate.kind === result.kind)?.notice : undefined
return {
key, ...packageName === undefined ? {} : { packageName }, copy, display: present(view),
...operation === undefined ? {} : {
operation: {
id: operation.id, ...operation.authorizationUrl === undefined ? {} : { authorizationUrl: operation.authorizationUrl },
},
},
...result === undefined ? {} : { result: { id: result.id, ...notice === undefined ? {} : { notice } } },
}
},
refresh: () => { source.refresh() },
start: (operation) => {
const kind = operations.find(candidate => candidate.kind === operation)?.kind
if (kind === undefined) throw new Error(`connectorAccounts: ${key} has no page operation ${operation}`)
return source.start(kind)
},
cancel: id => source.cancel(id),
}
}
/** Holds the registered accounts and serves them to the Plugins page. */
export default class ConnectorAccounts extends TypertRemoteService {
private readonly accounts = new Map<string, Registered>()
private readonly listeners = new Set<() => void>()
private readonly lifetime = new AbortController()
private subscribers = 0
/** @param ctx - the Host context the registry serves the page from. */
constructor(ctx: Context) {
super(ctx, 'connectorAccounts')
ctx.effect(() => () => { this.lifetime.abort(new Error('connectorAccounts: registry disposed')) })
}
/**
* Show one account on the Plugins page for as long as the returned disposer has not run.
* @param registration - the account key, its bundle package, the account source, the page operations, and the
* presentation.
* @returns an idempotent disposer that withdraws the account.
* @throws when another account already uses the key or the package.
*/
register<View extends AnyConnectorAccountView>(registration: ConnectorAccountRegistration<View>): () => void {
const { key, packageName } = registration
if (this.accounts.has(key)) throw new Error(`connectorAccounts: ${key} is already registered`)
if (packageName !== undefined && [...this.accounts.values()].some(account => account.packageName === packageName)) {
throw new Error(`connectorAccounts: ${packageName} already has an account`)
}
this.accounts.set(key, registeredOf(registration))
const stop = registration.source.observe(() => { this.changed() })
// A page that already follows the accounts checks a newly registered one, as it checks each account it subscribes to.
if (this.subscribers > 0) registration.source.refresh()
this.changed()
let active = true
return () => {
if (!active) return
active = false
stop()
this.accounts.delete(key)
this.changed()
}
}
/**
* Follow every registered account; each new subscriber starts a check of each account that runs no operation.
* @param signal - the Client's observation lifetime; disposal also ends the stream.
* @returns the current accounts, then each changed set, coalescing changes that arrive before the next read.
*/
@Remote({ mode: 'stream' })
async *watch(signal: AbortSignal): AsyncIterable<ConnectorAccountsView> {
const combined = AbortSignal.any([signal, this.lifetime.signal])
let wake = Promise.withResolvers<void>()
let changed = true
const notify = (): void => { changed = true; wake.resolve() }
this.listeners.add(notify)
combined.addEventListener('abort', notify, { once: true })
this.subscribers += 1
try {
for (const account of this.accounts.values()) account.refresh()
for (;;) {
if (!changed) await wake.promise
if (combined.aborted) break
wake = Promise.withResolvers<void>()
changed = false
yield { accounts: [...this.accounts.values()].map(account => account.entry()) }
}
} finally {
this.subscribers -= 1
this.listeners.delete(notify)
combined.removeEventListener('abort', notify)
}
}
/**
* Start one of the operations the account registered as page actions.
* @param key - the account key.
* @param operation - the operation kind.
* @returns the operation identity once the account's source has started it.
* @throws for an unknown account or operation, or whatever the account's source refuses, such as a second operation.
*/
@Remote
async start(key: string, operation: string): Promise<ConnectorOperationId> {
return await this.account(key).start(operation)
}
/**
* Cancel one operation while its phase is cancellable, and wait for it to settle.
* @param key - the account key.
* @param id - the operation to cancel; a finished one or a phase that is not cancellable is ignored.
* @returns after the operation settles, or at once when nothing is cancelled.
* @throws for an unknown account.
*/
@Remote
cancel(key: string, id: ConnectorOperationId): Promise<void> {
return this.account(key).cancel(id)
}
private account(key: string): Registered {
const account = this.accounts.get(key)
if (account === undefined) throw new Error(`connectorAccounts: ${key} is not registered`)
return account
}
private changed(): void {
for (const notify of this.listeners) notify()
}
}
@@ -0,0 +1,164 @@
/**
* Credential-free account views of connector plugins, and what the Plugins page receives about them. Each registrant
* supplies its own account, operation, phase, and failure types and maps its views to the page's display, so CLI app
* plugins and MCP connectors share one registry and one page.
*/
import type { Branded } from '@deepseek-ai/dsh-brand'
import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
/** Identifies one Host-owned account operation across the browsers that show the account. */
export type ConnectorOperationId = Branded<'ConnectorOperationId'>
/** The account operation in progress; `Phase` names the registrant's own steps. */
export interface ConnectorOperation<Kind extends string, Phase extends string> {
readonly id: ConnectorOperationId
readonly kind: Kind
readonly phase: Phase
/** Whether the source cancels the operation in its current phase. */
readonly cancellable: boolean
/** The page the user authorizes in, while the operation waits for one; only the browser that started it opens it. */
readonly authorizationUrl?: string
}
/** The most recent finished operation, kept until another one starts. */
export interface ConnectorOperationResult<Kind extends string, Failure = unknown> {
readonly id: ConnectorOperationId
readonly kind: Kind
readonly outcome: 'succeeded' | 'cancelled' | 'failed'
/** The registrant's classified failure, for its own presentation; does not imply rollback or a safe retry. */
readonly failure?: Failure
}
/** The complete account view; observers reread it after each change. */
export interface ConnectorAccountView<Account, Kind extends string, Phase extends string, Failure = unknown> {
/** The account as the source last published it. */
readonly account: Account
readonly operation?: ConnectorOperation<Kind, Phase>
readonly result?: ConnectorOperationResult<Kind, Failure>
}
/** Any registrant's account view. */
export type AnyConnectorAccountView = ConnectorAccountView<unknown, string, string>
/** The operation kinds a view reports. */
export type ConnectorOperationKindOf<View extends AnyConnectorAccountView> = NonNullable<View['result']>['kind']
/** What the Plugins page shows about an account; each registrant maps its own account states onto these phases. */
export type ConnectorAccountPhase = 'checking' | 'connecting' | 'connected' | 'disconnected' | 'unavailable'
/** What a section button does. */
export type ConnectorAccountCommand =
/** Start one of the operations the account registered as page actions. */
| { readonly kind: 'start'; readonly operation: string }
/** Cancel the operation in progress when it is cancellable. */
| { readonly kind: 'cancel' }
/** Open the current operation's authorization page again in this browser. */
| { readonly kind: 'open' }
/** The question a button asks before it runs. */
export interface ConnectorAccountConfirmation {
readonly title: LocalizedText
readonly body: LocalizedText
/** The confirm button's label. */
readonly label: LocalizedText
}
/** One button in the section. */
export interface ConnectorAccountButton {
readonly label: LocalizedText
readonly command: ConnectorAccountCommand
/** Defaults to an outline button. */
readonly variant?: 'primary' | 'ghost'
/** Ask first, for an action that changes the account outside DSH, such as signing out. */
readonly confirm?: ConnectorAccountConfirmation
}
/** One extra row under the status line, such as the linked app, with an optional button. */
export interface ConnectorAccountNote {
readonly text: LocalizedText
readonly button?: ConnectorAccountButton
}
/** A failed operation as the section reports it. */
export interface ConnectorAccountFailure {
/** The registrant's recovery guidance. */
readonly text: LocalizedText
/** Untranslated diagnostic items shown after the guidance in order. */
readonly details?: readonly string[]
}
/** What the section shows for the current view; every text carries each shipped language. */
export interface ConnectorAccountDisplay {
readonly phase: ConnectorAccountPhase
readonly status: LocalizedText
/** The tag beside the bundle title; absent while nothing is settled. */
readonly badge?: LocalizedText
readonly buttons: readonly ConnectorAccountButton[]
/** What Connect in the activation prompt starts after opening the bundle page; absent, Connect only opens the page. */
readonly connect?: Extract<ConnectorAccountCommand, { readonly kind: 'start' }>
readonly detail?: LocalizedText
readonly notes: readonly ConnectorAccountNote[]
readonly failure?: ConnectorAccountFailure
}
/** The section's fixed text that names the service or uses its wording. */
export interface ConnectorAccountCopy {
readonly title: LocalizedText
/** The line under the section, such as where the account is shared or authorized. */
readonly hint: LocalizedText
/** The prompt after the bundle is switched on while the account is disconnected. */
readonly activation: { readonly title: LocalizedText; readonly body: LocalizedText; readonly connect: LocalizedText }
}
/** One registered account as the Plugins page receives it. */
export interface ConnectorAccountEntry {
/** The registrant's stable account key, which the page passes back to start and cancel operations. */
readonly key: string
/** npm package whose bundle page carries the section and tag; absent for an account no bundle owns. */
readonly packageName?: string
readonly copy: ConnectorAccountCopy
readonly display: ConnectorAccountDisplay
/** The operation in progress, which a browser follows when it started it. */
readonly operation?: { readonly id: ConnectorOperationId; readonly authorizationUrl?: string }
/** The most recent finished operation, with the registrant's text when it succeeded. */
readonly result?: { readonly id: ConnectorOperationId; readonly notice?: LocalizedText }
}
/** Every registered account, as each change publishes it. */
export interface ConnectorAccountsView {
readonly accounts: readonly ConnectorAccountEntry[]
}
/** The account a registration exposes to the page. */
export interface ConnectorAccountSource<View extends AnyConnectorAccountView> {
snapshot(): View
/** @returns a disposer; the listener runs after each change without starting a check. */
observe(listener: () => void): () => void
/** Start a check unless an operation runs; a source whose view is always current does nothing. */
refresh(): void
/** @returns the started operation's identity, at once or after the source has started the operation. */
start(kind: ConnectorOperationKindOf<View>): ConnectorOperationId | Promise<ConnectorOperationId>
/** @returns after the named operation settles, or at once when it is not cancellable. */
cancel(id: ConnectorOperationId): Promise<void>
}
/** One operation a page button may start, with the text its success reports in the browser that started it. */
export interface ConnectorAccountOperation<Kind extends string> {
readonly kind: Kind
readonly notice?: LocalizedText
}
/** One connector account, registered with the Host's `ctx.connectorAccounts`. */
export interface ConnectorAccountRegistration<View extends AnyConnectorAccountView> {
/** Stable key, unique among registered accounts, such as the bundle's package name. */
readonly key: string
/** npm package whose bundle page carries the section and tag; at most one account per package. */
readonly packageName?: string
readonly source: ConnectorAccountSource<View>
/** The operations a page button may start; the registry rejects any other. */
readonly operations: readonly ConnectorAccountOperation<ConnectorOperationKindOf<View>>[]
readonly copy: ConnectorAccountCopy
/** Map the current view to what the section shows; called on each change for each subscriber. */
readonly present: (view: View) => ConnectorAccountDisplay
}
@@ -0,0 +1,163 @@
/**
* The browser plugin shows one tag and one notice entry for the page, and a section and activation prompt for each bundle
* that owns an account, withdrawing them with the account or the plugin.
*/
import assert from 'node:assert/strict'
import { Context, Service } from '@deepseek-ai/cordis'
import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client'
import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client'
import { RemoteError, type RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
import { expect, it, onTestFinished, vi } from 'vitest'
import {
ConnectorAccountActivationEntry, ConnectorAccountBadgeEntry, ConnectorAccountSectionEntry, ConnectorAccountToastEntry,
} from '../src/client/components.tsx'
import { NS } from '../src/client/locales.ts'
import { apply, inject } from '../src/client/index.ts'
import type { ConnectorAccountFace, ConnectorBundleAccountFace } from '../src/client/types.ts'
import type { ConnectorAccountEntry, ConnectorAccountsView, ConnectorOperationId } from '../src/types.ts'
const FIXTURE = '@acme/fixture'
const OTHER = '@acme/other'
const OP = 'op-1' as ConnectorOperationId
function isFace(value: Record<string, unknown>): asserts value is Record<string, unknown> & ConnectorAccountFace {
assert(typeof value.resolveText === 'function' && typeof value.follow === 'function')
assert(typeof value.start === 'function' && typeof value.cancel === 'function')
assert(typeof value.hooks === 'object' && value.hooks !== null)
}
/** Read the face a slot entry injects. */
function faceOf(item: { readonly inject?: (() => Record<string, unknown>) | undefined }): ConnectorAccountFace {
assert(item.inject !== undefined)
const face = item.inject()
isFace(face)
return face
}
function bundleFaceOf(item: { readonly inject?: (() => Record<string, unknown>) | undefined }): ConnectorBundleAccountFace {
const face = faceOf(item)
assert('account' in face && typeof face.account === 'string')
return face as ConnectorBundleAccountFace
}
function entry(key: string, packageName: string | null = key): ConnectorAccountEntry {
return {
key, ...packageName === null ? {} : { packageName },
copy: { title: 'Fixture account', hint: 'Shared.', activation: { title: 'Connect', body: 'On.', connect: 'Connect' } },
display: { phase: 'disconnected', status: 'Not connected', buttons: [], notes: [] },
}
}
async function bench() {
const ctx = new Context()
onTestFinished(async () => { await ctx.fiber.dispose() })
const queue: ConnectorAccountsView[] = []
let wake: (() => void) | undefined, closed = false, accepted = 0
const closeStream = vi.fn(async () => { closed = true; wake?.() })
const start = vi.fn(async (_key: string, _operation: string): Promise<RemoteResult<ConnectorOperationId>> => ({ ok: true, value: OP }))
const cancel = vi.fn(async (_key: string, _id: ConnectorOperationId): Promise<RemoteResult<void>> => ({ ok: true, value: undefined }))
class Remote extends Service {
constructor() { super(ctx, 'remote') }
$stream() {
return {
async *[Symbol.asyncIterator]() {
for (;;) {
const next = queue.shift()
if (next !== undefined) { yield { value: next, accept: () => { accepted++ } }; continue }
if (closed) return
await new Promise<void>((resolve) => { wake = resolve })
}
},
dispose: closeStream,
}
}
}
new Remote()
ctx.provide('remote.connectorAccounts', { watch: vi.fn(), start, cancel })
const locale = new LocaleRuntime(ctx)
ctx.provide('locale', locale)
await ctx.plugin(SlotRegistry)
ctx.slots.register({ name: 'root', children: {
'plugins.bundle.activation': { kind: 'keyed', scope: 'root' },
'plugins.bundle.config': { kind: 'keyed', scope: 'root' },
'plugins.detail.badge': { kind: 'list', scope: 'root' },
'shell.overlay': { kind: 'list', scope: 'root' },
} } as never, () => null)
const bundles = (slot: 'plugins.bundle.config' | 'plugins.bundle.activation') =>
ctx.slots.entries(slot).map(item => [item.options.key, bundleFaceOf(item).account])
return {
ctx, locale, start, cancel, closeStream, bundles,
mount: () => ctx.plugin({ inject: [...inject], apply }),
async publish(...entries: ConnectorAccountEntry[]) {
const target = accepted + 1
queue.push({ accounts: entries })
wake?.()
await vi.waitFor(() => { expect(accepted).toBe(target) })
},
}
}
it('shows one tag and one notice entry for the page and each bundle\'s section and prompt under the shared dictionary', async () => {
const b = await bench()
await b.mount()
expect(b.locale.bind(NS)('action.cancel')).toBe('Cancel')
expect(b.ctx.slots.entries('plugins.detail.badge').map(item => [item.options.id, item.component])).toEqual([
['connector-account.badge', ConnectorAccountBadgeEntry],
])
expect(b.ctx.slots.entries('shell.overlay').map(item => [item.options.id, item.component])).toEqual([
['connector-account.notice', ConnectorAccountToastEntry],
])
expect(b.bundles('plugins.bundle.config')).toEqual([])
// An account no bundle owns gets no bundle surfaces.
await b.publish(entry(FIXTURE), entry(OTHER), entry('mcp:custom', null))
expect(b.bundles('plugins.bundle.config')).toEqual([[FIXTURE, FIXTURE], [OTHER, OTHER]])
expect(b.bundles('plugins.bundle.activation')).toEqual([[FIXTURE, FIXTURE], [OTHER, OTHER]])
const [section] = b.ctx.slots.entries('plugins.bundle.config')
assert(section !== undefined)
expect(section).toMatchObject({ locale: NS, component: ConnectorAccountSectionEntry })
expect(b.ctx.slots.entries('plugins.bundle.activation')[0]).toMatchObject({ locale: NS, component: ConnectorAccountActivationEntry })
const face = bundleFaceOf(section)
const [badge] = b.ctx.slots.entries('plugins.detail.badge')
assert(badge !== undefined)
const [toast] = b.ctx.slots.entries('shell.overlay')
assert(toast !== undefined)
expect(faceOf(badge).hooks.connectorAccounts).toBe(face.hooks.connectorAccounts)
expect(faceOf(toast).hooks.connectorAccounts).toBe(face.hooks.connectorAccounts)
expect([...face.hooks.connectorAccounts.getSnapshot().accounts.keys()]).toEqual([FIXTURE, OTHER, 'mcp:custom'])
expect(face.resolveText({ en: 'Connected', zh: '已连接' })).toBe('Connected')
expect(await face.start(FIXTURE, 'connect')).toEqual({ ok: true, value: OP })
expect(b.start).toHaveBeenCalledWith(FIXTURE, 'connect')
expect(await face.cancel(FIXTURE, OP)).toEqual({ ok: true, value: undefined })
expect(b.cancel).toHaveBeenCalledWith(FIXTURE, OP)
// A refusal reaches the buttons as the Remote's result.
const refused: RemoteResult<ConnectorOperationId> = { ok: false, error: new RemoteError('gateway/internal', 'offline', {}) }
b.start.mockResolvedValueOnce(refused)
expect(await face.start(FIXTURE, 'connect')).toBe(refused)
face.follow(FIXTURE, OP)
face.failed()
expect(face.hooks.connectorAccounts.getSnapshot().notice).toEqual({ seq: 1, kind: 'action-failed' })
face.dismissNotice()
expect(face.hooks.connectorAccounts.getSnapshot().notice).toBeUndefined()
// A dropped account withdraws its bundle's surfaces, and a bundle whose account changed key shows the new one.
await b.publish(entry(OTHER))
expect(b.bundles('plugins.bundle.config')).toEqual([[OTHER, OTHER]])
await b.publish(entry('mcp:other', OTHER))
expect(b.bundles('plugins.bundle.config')).toEqual([[OTHER, 'mcp:other']])
expect(b.bundles('plugins.bundle.activation')).toEqual([[OTHER, 'mcp:other']])
})
it('withdraws every surface, the dictionaries, and the stream when the plugin unloads', async () => {
const b = await bench()
const fiber = b.mount()
await fiber
await b.publish(entry(FIXTURE), entry(OTHER))
expect(b.bundles('plugins.bundle.config')).toHaveLength(2)
await fiber.dispose()
for (const slot of ['plugins.bundle.config', 'plugins.bundle.activation', 'plugins.detail.badge', 'shell.overlay'] as const) {
expect(b.ctx.slots.entries(slot)).toEqual([])
}
expect(b.locale.bind(NS)('action.cancel')).toBe('action.cancel')
expect(b.closeStream).toHaveBeenCalledOnce()
})
@@ -0,0 +1,246 @@
// @vitest-environment jsdom
/** The slot entries render each registrant's display from the Host with the shared copy, and buttons call the Host callbacks. */
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
import type { PluginsSubject } from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
import { RemoteError, type RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
import { afterEach, expect, it, onTestFinished, vi } from 'vitest'
import {
ConnectorAccountActivationEntry, ConnectorAccountBadgeEntry, ConnectorAccountSectionEntry, ConnectorAccountToastEntry,
} from '../src/client/components.tsx'
import { zh } from '../src/client/locales.ts'
import type { ConnectorAccountFace, ConnectorAccountsState } from '../src/client/types.ts'
import type { ConnectorAccountDisplay, ConnectorAccountEntry, ConnectorOperationId } from '../src/types.ts'
afterEach(cleanup)
const KEY = '@acme/fixture'
const OP = 'op-1' as ConnectorOperationId
const STARTED: RemoteResult<ConnectorOperationId> = { ok: true, value: OP }
const REFUSED: RemoteResult<never> = { ok: false, error: new RemoteError('gateway/internal', 'offline', {}) }
const t = makeTranslate(zh)
const resolveText = (text: LocalizedText): string => typeof text === 'string' ? text : text.zh ?? text.en
const button = (name: string) => screen.getByRole('button', { name })
const disabled = (): boolean[] => screen.getAllByRole('button').map(element => (element as HTMLButtonElement).disabled)
const click = async (name: string) => { await act(async () => { fireEvent.click(button(name)) }) }
const DISCONNECTED: ConnectorAccountDisplay = {
phase: 'disconnected', status: { en: 'Not connected', zh: '未连接' }, badge: '未连接',
buttons: [{ label: '连接演示', command: { kind: 'start', operation: 'connect' }, variant: 'primary' }], notes: [],
}
function entry(display: ConnectorAccountDisplay = DISCONNECTED, extra: Partial<ConnectorAccountEntry> = {}): ConnectorAccountEntry {
return {
key: KEY, packageName: KEY, display,
copy: { title: { en: 'Fixture account', zh: '演示账号' }, hint: '与终端共用。', activation: { title: '连接演示', body: '插件已开启。', connect: '连接演示' } },
...extra,
}
}
function face(change: Partial<ConnectorAccountsState> = {}, accounts: readonly ConnectorAccountEntry[] = [entry()]) {
const current: ConnectorAccountsState = {
accounts: new Map(accounts.map(item => [item.key, item])), linked: true, notice: undefined, ...change,
}
return {
useConnectorAccounts: <R,>(selector: (value: ConnectorAccountsState) => R): R => selector(current),
start: vi.fn<ConnectorAccountFace['start']>(async () => STARTED),
cancel: vi.fn<ConnectorAccountFace['cancel']>(async () => ({ ok: true, value: undefined })),
account: KEY, resolveText, follow: vi.fn(), failed: vi.fn(), dismissNotice: vi.fn(), t,
}
}
const sectionOf = (display: ConnectorAccountDisplay, change: Partial<ConnectorAccountsState> = {}) => face(change, [entry(display)])
const prompt = (props: ReturnType<typeof face>, onDismiss = vi.fn(), onOpenDetails = vi.fn()) =>
<ConnectorAccountActivationEntry {...props} onDismiss={onDismiss} onOpenDetails={onOpenDetails} />
it('shows the registrant title, status, detail, notes, and hint, and starts each button\'s operation on the Host', async () => {
const props = sectionOf({
...DISCONNECTED, detail: '先关联一个应用。',
notes: [{ text: '应用:cli_a', button: { label: '更换', command: { kind: 'start', operation: 'link-app' }, variant: 'ghost' } }, { text: '普通说明' }],
})
const { container } = render(<ConnectorAccountSectionEntry {...props} />)
for (const text of ['演示账号', '未连接', '先关联一个应用。', '普通说明', '与终端共用。']) expect(screen.getByText(text)).toBeTruthy()
expect(container.querySelector('[data-connector-account="disconnected"][data-connector-account-key="@acme/fixture"]')).toBeTruthy()
await click('连接演示')
await click('更换')
expect(props.start.mock.calls).toEqual([[KEY, 'connect'], [KEY, 'link-app']])
expect(props.follow.mock.calls).toEqual([[KEY, OP], [KEY, OP]])
})
it('disables the buttons while a call is pending or the Host stream is down', async () => {
const props = face()
const answer = Promise.withResolvers<RemoteResult<ConnectorOperationId>>()
props.start.mockReturnValueOnce(answer.promise)
render(<ConnectorAccountSectionEntry {...props} />)
fireEvent.click(button('连接演示'))
expect(disabled()).toEqual([true])
await act(async () => { answer.resolve(STARTED) })
expect(disabled()).toEqual([false])
expect(props.failed).not.toHaveBeenCalled()
cleanup()
render(<ConnectorAccountSectionEntry {...face({ linked: false })} />)
expect(disabled()).toEqual([true])
})
it('asks before a button that changes the account outside DSH and starts it only after the user accepts', async () => {
const props = sectionOf({
phase: 'connected', status: '已连接', notes: [],
buttons: [{ label: '退出登录', command: { kind: 'start', operation: 'sign-out' }, confirm: { title: '退出演示?', body: '终端也会退出。', label: '确认退出' } }],
})
render(<ConnectorAccountSectionEntry {...props} />)
fireEvent.click(button('退出登录'))
expect(screen.getByRole('dialog', { name: '退出演示?' })).toBeTruthy()
expect(screen.getByText('终端也会退出。')).toBeTruthy()
fireEvent.click(button(zh['action.cancel']))
expect(screen.queryByRole('dialog')).toBeNull()
fireEvent.click(button('退出登录'))
await click('确认退出')
expect(screen.queryByRole('dialog')).toBeNull()
expect(props.start.mock.calls).toEqual([[KEY, 'sign-out']])
})
it('disables an open confirmation and the activation prompt\'s Connect while the Host stream is down', () => {
const display: ConnectorAccountDisplay = {
phase: 'connected', status: '已连接', notes: [],
buttons: [{ label: '退出登录', command: { kind: 'start', operation: 'sign-out' }, confirm: { title: '退出演示?', body: '终端也会退出。', label: '确认退出' } }],
}
const { rerender } = render(<ConnectorAccountSectionEntry {...sectionOf(display)} />)
fireEvent.click(button('退出登录'))
// The stream drops while the confirmation is open.
const down = sectionOf(display, { linked: false })
rerender(<ConnectorAccountSectionEntry {...down} />)
fireEvent.click(button('确认退出'))
expect((button('确认退出') as HTMLButtonElement).disabled).toBe(true)
expect(down.start).not.toHaveBeenCalled()
cleanup()
const offline = sectionOf({ ...DISCONNECTED, connect: { kind: 'start', operation: 'connect' } }, { linked: false })
render(prompt(offline))
fireEvent.click(button('连接演示'))
expect((button('连接演示') as HTMLButtonElement).disabled).toBe(true)
expect(offline.start).not.toHaveBeenCalled()
})
it.each<[string, ConnectorAccountDisplay['failure'], string]>([
['the guidance, then its diagnostic items', { text: '失败。', details: ['login', 'exit 3', 'internal'] }, '失败。 排障信息:login · exit 3 · internal'],
['the guidance alone without diagnostic items', { text: '失败。' }, '失败。'],
['the guidance alone for an empty diagnostic list', { text: '失败。', details: [] }, '失败。'],
])('reports %s', (_name, failure, expected) => {
render(<ConnectorAccountSectionEntry {...sectionOf({ ...DISCONNECTED, ...failure === undefined ? {} : { failure } })} />)
expect(screen.getByRole('alert').textContent).toBe(expected)
})
it('reports a start whose result is a failure or whose call rejected, without following it', async () => {
const props = face()
props.start.mockResolvedValueOnce(REFUSED).mockRejectedValueOnce(new Error('Remote method is no longer mounted'))
render(<ConnectorAccountSectionEntry {...props} />)
await click('连接演示')
expect(props.failed).toHaveBeenCalledOnce()
expect(disabled()).toEqual([false])
await click('连接演示')
expect(props.failed).toHaveBeenCalledTimes(2)
expect(props.follow).not.toHaveBeenCalled()
})
it('cancels the operation in progress and opens its authorization page again on request', async () => {
const windowOpen = vi.spyOn(window, 'open').mockReturnValue(null)
onTestFinished(() => { windowOpen.mockRestore() })
const display: ConnectorAccountDisplay = {
phase: 'connecting', status: '等待浏览器', notes: [],
buttons: [{ label: '打开授权页', command: { kind: 'open' } }, { label: '取消', command: { kind: 'cancel' }, variant: 'ghost' }],
}
const props = face({}, [entry(display, { operation: { id: OP, authorizationUrl: 'https://example.com/a' } })])
render(<ConnectorAccountSectionEntry {...props} />)
fireEvent.click(button('打开授权页'))
expect(windowOpen).toHaveBeenCalledWith('https://example.com/a', '_blank', 'noopener,noreferrer')
await click('取消')
expect(props.cancel).toHaveBeenCalledWith(KEY, OP)
expect(props.failed).not.toHaveBeenCalled()
props.cancel.mockResolvedValueOnce(REFUSED)
await click('取消')
expect(props.failed).toHaveBeenCalledOnce()
// A cancel button with no operation in progress calls nothing.
cleanup()
const idle = sectionOf(display)
render(<ConnectorAccountSectionEntry {...idle} />)
await click('取消')
expect(idle.cancel).not.toHaveBeenCalled()
})
it('renders nothing for a bundle whose account the Host has not listed', () => {
render(<ConnectorAccountSectionEntry {...face({}, [])} />)
render(prompt(face({}, [])))
expect(document.body.textContent).toBe('')
})
it('tags only the enabled bundle that owns an account, with the display\'s tag', () => {
const pkg = (name: string, enabled = true) => ({ name, installed: true, availability: 'profile', official: false, enabled, rows: [] } as const)
const page = (name: string, enabled = true): PluginsSubject => ({ kind: 'bundle', pkg: pkg(name, enabled) })
const row: PluginsSubject = { kind: 'row', pkg: pkg(KEY), row: { rowId: 'fixture', moduleName: '@acme/fixture-row', enabled: true } }
const tag = (props: ReturnType<typeof face>, subject: PluginsSubject) => <ConnectorAccountBadgeEntry {...props} subject={subject} />
const { rerender } = render(tag(face(), page(KEY)))
expect(screen.getByText('未连接')).toBeTruthy()
rerender(tag(face(), row))
expect(screen.getByText('未连接')).toBeTruthy()
for (const [props, subject] of [
[face(), page(KEY, false)], [face(), page('@acme/other')], [face(), { kind: 'item', id: 'fixture-item' }],
[sectionOf({ phase: 'checking', status: '检查中', buttons: [], notes: [] }), page(KEY)],
] as const) {
rerender(tag(props, subject))
expect(document.body.textContent).toBe('')
}
})
it('prompts to connect only while disconnected, waits while checking or connecting, and dismisses itself once settled', () => {
const onDismiss = vi.fn()
const at = (phase: ConnectorAccountDisplay['phase']) => prompt(sectionOf({ phase, status: phase, buttons: [], notes: [] }), onDismiss)
const { rerender } = render(at('checking'))
// An account still connecting after the bundle is switched on may end disconnected.
rerender(at('connecting'))
expect(screen.queryByRole('dialog')).toBeNull()
expect(onDismiss).not.toHaveBeenCalled()
rerender(at('disconnected'))
expect(screen.getByRole('dialog', { name: '连接演示' })).toBeTruthy()
expect(screen.getByText('插件已开启。')).toBeTruthy()
fireEvent.click(button(zh['activation.later']))
expect(onDismiss).toHaveBeenCalledOnce()
rerender(at('connected'))
rerender(at('unavailable'))
expect(onDismiss).toHaveBeenCalledTimes(3)
})
it('connects from the prompt through the operation the display names, or only opens the page', async () => {
const onOpenDetails = vi.fn()
const named = sectionOf({ ...DISCONNECTED, connect: { kind: 'start', operation: 'link-app' } })
const { rerender } = render(prompt(named, vi.fn(), onOpenDetails))
await click('连接演示')
expect(onOpenDetails).toHaveBeenCalledOnce()
expect(named.start).toHaveBeenCalledWith(KEY, 'link-app')
const bare = face()
rerender(prompt(bare, vi.fn(), onOpenDetails))
fireEvent.click(button('连接演示'))
expect(onOpenDetails).toHaveBeenCalledTimes(2)
expect(bare.start).not.toHaveBeenCalled()
})
it('starts once for a second click before the first call answers', async () => {
const props = sectionOf({ ...DISCONNECTED, connect: { kind: 'start', operation: 'connect' } })
const answer = Promise.withResolvers<RemoteResult<ConnectorOperationId>>()
props.start.mockReturnValueOnce(answer.promise)
render(prompt(props))
fireEvent.click(button('连接演示'))
fireEvent.click(button('连接演示'))
await act(async () => { answer.resolve(STARTED) })
expect(props.start).toHaveBeenCalledOnce()
expect(props.follow).toHaveBeenCalledOnce()
})
it('shows the latest notice with the registrant text or the shared failure copy', () => {
const toast = (notice: ConnectorAccountsState['notice']) => <ConnectorAccountToastEntry {...face({ notice })} />
const { rerender } = render(toast(undefined))
expect(document.body.textContent).toBe('')
rerender(toast({ seq: 1, kind: 'succeeded', text: { en: 'Connected', zh: '演示已连接' } }))
expect(screen.getByText('演示已连接')).toBeTruthy()
rerender(toast({ seq: 2, kind: 'action-failed' }))
expect(screen.getByText(zh['notice.action-failed'])).toBeTruthy()
})
@@ -0,0 +1,170 @@
/** The registry serves every registered account to the Plugins page and routes page operations to the account that owns them. */
import { Context } from '@deepseek-ai/cordis'
import { expect, it, onTestFinished, vi } from 'vitest'
import ConnectorAccounts from '../src/index.ts'
import type {
ConnectorAccountDisplay, ConnectorAccountRegistration, ConnectorAccountSource, ConnectorAccountsView, ConnectorAccountView,
ConnectorOperationId,
} from '../src/types.ts'
type View = ConnectorAccountView<{ readonly state: 'out' | 'in' }, 'check' | 'connect', 'authorizing'>
const OP = 'op-1' as ConnectorOperationId
const NEXT = 'op-2' as ConnectorOperationId
const COPY = {
title: { en: 'Fixture account', zh: '演示账号' },
hint: 'Shared with the terminal.',
activation: { title: 'Connect Fixture', body: 'The plugin is on.', connect: 'Connect' },
}
function source(initial: View = { account: { state: 'out' } }) {
let view = initial
const listeners = new Set<() => void>()
const fake = {
snapshot: () => view,
observe: vi.fn((listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener) } }),
refresh: vi.fn(),
start: vi.fn((_kind: 'check' | 'connect'): ConnectorOperationId | Promise<ConnectorOperationId> => OP),
cancel: vi.fn(async (_id: ConnectorOperationId) => {}),
} satisfies ConnectorAccountSource<View>
return { fake, listeners, publish: (next: View) => { view = next; for (const listener of listeners) listener() } }
}
function display(view: View): ConnectorAccountDisplay {
return view.account.state === 'in'
? { phase: 'connected', status: 'Connected', badge: 'Connected', buttons: [], notes: [] }
: { phase: 'disconnected', status: 'Not connected', buttons: [{ label: 'Connect', command: { kind: 'start', operation: 'connect' }, variant: 'primary' }], notes: [] }
}
/** A registration whose bundle package defaults to its key; `null` registers an account no bundle owns. */
function registration(key: string, account = source(), packageName: string | null = key): ConnectorAccountRegistration<View> {
return {
key, ...packageName === null ? {} : { packageName }, source: account.fake, copy: COPY, present: display,
operations: [{ kind: 'check' }, { kind: 'connect', notice: { en: 'Fixture connected', zh: '演示已连接' } }],
}
}
async function registry() {
const ctx = new Context()
onTestFinished(async () => { await ctx.fiber.dispose() })
await ctx.plugin(ConnectorAccounts)
return ctx
}
/** Read the stream until a view satisfies the predicate. */
async function until(
stream: AsyncIterator<ConnectorAccountsView>, predicate: (view: ConnectorAccountsView) => boolean,
): Promise<ConnectorAccountsView> {
for (;;) {
const next = await stream.next()
if (next.done === true) throw new Error('stream ended')
if (predicate(next.value)) return next.value
}
}
it('publishes each account with its key, package, copy, display, operation, and result, and checks it for each new subscriber', async () => {
const ctx = await registry()
const account = source()
const withdraw = ctx.connectorAccounts.register(registration('@acme/fixture', account))
expect(account.fake.refresh).not.toHaveBeenCalled()
const controller = new AbortController()
const stream = ctx.connectorAccounts.watch(controller.signal)[Symbol.asyncIterator]()
const first = await until(stream, () => true)
expect(account.fake.refresh).toHaveBeenCalledOnce()
expect(first.accounts).toEqual([
{ key: '@acme/fixture', packageName: '@acme/fixture', copy: COPY, display: display({ account: { state: 'out' } }) },
])
account.publish({ account: { state: 'out' }, operation: { id: OP, kind: 'connect', phase: 'authorizing', cancellable: true, authorizationUrl: 'https://example.com/a' } })
const waiting = await until(stream, view => view.accounts[0]?.operation !== undefined)
expect(waiting.accounts[0]?.operation).toEqual({ id: OP, authorizationUrl: 'https://example.com/a' })
account.publish({ account: { state: 'out' }, operation: { id: OP, kind: 'connect', phase: 'authorizing', cancellable: false } })
const checking = await until(stream, (view) => {
const operation = view.accounts[0]?.operation
return operation !== undefined && operation.authorizationUrl === undefined
})
expect(checking.accounts[0]?.operation).toEqual({ id: OP })
account.publish({ account: { state: 'in' }, result: { id: OP, kind: 'connect', outcome: 'succeeded' } })
const connected = await until(stream, view => view.accounts[0]?.result !== undefined)
expect(connected.accounts[0]).toMatchObject({
display: { phase: 'connected' }, result: { id: OP, notice: { en: 'Fixture connected', zh: '演示已连接' } },
})
// Only a success reports a notice, and only for an operation that registered one.
account.publish({ account: { state: 'out' }, result: { id: OP, kind: 'connect', outcome: 'failed' } })
expect((await until(stream, view => view.accounts[0]?.display.phase === 'disconnected')).accounts[0]?.result).toEqual({ id: OP })
account.publish({ account: { state: 'in' }, result: { id: OP, kind: 'check', outcome: 'succeeded' } })
expect((await until(stream, view => view.accounts[0]?.display.phase === 'connected')).accounts[0]?.result).toEqual({ id: OP })
withdraw()
expect((await until(stream, view => view.accounts.length === 0)).accounts).toEqual([])
withdraw()
expect(account.listeners.size).toBe(0)
controller.abort()
expect((await stream.next()).done).toBe(true)
})
it('publishes an account that no bundle owns without a package', async () => {
const ctx = await registry()
ctx.connectorAccounts.register(registration('mcp:custom', source(), null))
const stream = ctx.connectorAccounts.watch(new AbortController().signal)[Symbol.asyncIterator]()
const [entry] = (await until(stream, () => true)).accounts
expect(entry).toEqual({ key: 'mcp:custom', copy: COPY, display: display({ account: { state: 'out' } }) })
})
it('checks an account registered while the page follows, and none registered while nobody follows', async () => {
const ctx = await registry()
const idle = source()
ctx.connectorAccounts.register(registration('@acme/idle', idle))
const controller = new AbortController()
const stream = ctx.connectorAccounts.watch(controller.signal)[Symbol.asyncIterator]()
await until(stream, view => view.accounts.length === 1)
const late = source()
ctx.connectorAccounts.register(registration('@acme/late', late))
expect(late.fake.refresh).toHaveBeenCalledOnce()
expect((await until(stream, view => view.accounts.length === 2)).accounts.map(entry => entry.key)).toEqual(['@acme/idle', '@acme/late'])
controller.abort()
await stream.next()
const after = source()
ctx.connectorAccounts.register(registration('@acme/after', after))
expect(after.fake.refresh).not.toHaveBeenCalled()
})
it('starts only the operations an account registered and cancels through its source', async () => {
const ctx = await registry()
const account = source()
ctx.connectorAccounts.register(registration('@acme/fixture', account))
await expect(ctx.connectorAccounts.start('@acme/fixture', 'connect')).resolves.toBe(OP)
expect(account.fake.start).toHaveBeenCalledWith('connect')
// A source that starts its operation asynchronously answers once it has the identity.
account.fake.start.mockImplementationOnce(async () => NEXT)
await expect(ctx.connectorAccounts.start('@acme/fixture', 'connect')).resolves.toBe(NEXT)
await expect(ctx.connectorAccounts.start('@acme/fixture', 'sign-out')).rejects.toThrow('@acme/fixture has no page operation sign-out')
await expect(ctx.connectorAccounts.start('@acme/other', 'connect')).rejects.toThrow('@acme/other is not registered')
await ctx.connectorAccounts.cancel('@acme/fixture', OP)
expect(account.fake.cancel).toHaveBeenCalledWith(OP)
expect(() => ctx.connectorAccounts.cancel('@acme/other', OP)).toThrow('@acme/other is not registered')
})
it('refuses a second account for a key or for a package', async () => {
const ctx = await registry()
ctx.connectorAccounts.register(registration('@acme/fixture'))
expect(() => ctx.connectorAccounts.register(registration('@acme/fixture'))).toThrow('@acme/fixture is already registered')
expect(() => ctx.connectorAccounts.register(registration('mcp:fixture', source(), '@acme/fixture')))
.toThrow('@acme/fixture already has an account')
expect(() => ctx.connectorAccounts.register(registration('mcp:custom', source(), null))).not.toThrow()
})
it('ends every stream when the registry unloads', async () => {
const ctx = new Context()
const fiber = ctx.plugin(ConnectorAccounts)
await fiber
const stream = ctx.connectorAccounts.watch(new AbortController().signal)[Symbol.asyncIterator]()
await until(stream, () => true)
const pending = stream.next()
await fiber.dispose()
expect((await pending).done).toBe(true)
await ctx.fiber.dispose()
})
@@ -0,0 +1,179 @@
// @vitest-environment jsdom
/** The browser follows every registered account through one Host stream and keeps only what this browser started. */
import { Context } from '@deepseek-ai/cordis'
import { RemoteStreamCarrierError, type RemoteStreamOptions } from '@deepseek-ai/dsh-api-gateway/client'
import { expect, it, onTestFinished, vi } from 'vitest'
import { BrowserAccounts, openAuthorizationPage } from '../src/client/state.ts'
import type { ConnectorAccountEntry, ConnectorAccountsView, ConnectorOperationId } from '../src/types.ts'
const OP = 'op-1' as ConnectorOperationId
const NEXT = 'op-2' as ConnectorOperationId
const FIXTURE = '@acme/fixture'
const OTHER = 'mcp:other'
const COPY = { title: 'Fixture account', hint: 'Shared.', activation: { title: 'Connect', body: 'On.', connect: 'Connect' } }
function entry(key: string, extra: Partial<ConnectorAccountEntry> = {}): ConnectorAccountEntry {
return { key, copy: COPY, display: { phase: 'disconnected', status: 'Not connected', buttons: [], notes: [] }, ...extra }
}
const waiting = (url?: string, id = OP): Partial<ConnectorAccountEntry> =>
({ operation: { id, ...url === undefined ? {} : { authorizationUrl: url } } })
function fixture() {
const queue: ConnectorAccountsView[] = []
let wake: (() => void) | undefined, closed = false, failure: Error | undefined, accepted = 0
let options!: RemoteStreamOptions<ConnectorAccountsView>
const open = () => ({
async *[Symbol.asyncIterator]() {
for (;;) {
if (failure !== undefined) throw failure
// A queued item still arrives after close, as an item the stream yielded just before disposal does.
const next = queue.shift()
if (next !== undefined) { yield { value: next, accept: () => { accepted++ } }; continue }
if (closed) return
await new Promise<void>((resolve) => { wake = resolve })
}
},
dispose: vi.fn(async () => { closed = true; wake?.() }),
})
const streams: Array<ReturnType<typeof open>> = []
const remote = { watch: vi.fn() }
const ctx = new Context()
ctx.provide('remote', {
$stream: (value: typeof options) => {
options = value
closed = false
failure = undefined
streams.push(open())
return streams.at(-1)
},
})
const windowOpen = vi.spyOn(window, 'open').mockReturnValue(null)
const browser = new BrowserAccounts(ctx, remote)
onTestFinished(async () => { await browser.dispose(); windowOpen.mockRestore(); await ctx.fiber.dispose() })
return {
ctx, browser, remote, open: windowOpen, streams, options: () => options,
state: () => browser.state.getSnapshot(),
deliver(view: ConnectorAccountsView) { queue.push(view); wake?.() },
async publish(...entries: ConnectorAccountEntry[]) {
const target = accepted + 1
this.deliver({ accounts: entries })
await vi.waitFor(() => { expect(accepted).toBe(target) })
},
fail(error: Error) { failure = error; wake?.() },
}
}
it('mirrors the Host accounts by key and reports carrier loss until the next item', async () => {
const b = fixture()
expect(b.state()).toEqual({ accounts: new Map(), linked: true, notice: undefined })
const open = b.options().open(new AbortController().signal)
expect(b.remote.watch).toHaveBeenCalledOnce()
expect(open).toBe(b.remote.watch.mock.results[0]?.value)
await b.publish(entry(FIXTURE), entry(OTHER))
expect([...b.state().accounts.keys()]).toEqual([FIXTURE, OTHER])
b.options().carrierFailed?.(new RemoteStreamCarrierError('offline'))
expect(b.state().linked).toBe(false)
await b.publish(entry(FIXTURE))
expect(b.state().linked).toBe(true)
expect([...b.state().accounts.keys()]).toEqual([FIXTURE])
expect(b.options().ended(true).message).toBe('Connector accounts stream ended')
})
it('opens each new authorization page of an operation this browser started once, and no other account\'s', async () => {
const b = fixture()
b.browser.follow(FIXTURE, OP)
await b.publish(entry(FIXTURE, waiting('https://example.com/a')), entry(OTHER, waiting('https://example.com/other')))
expect(b.open.mock.calls).toEqual([['https://example.com/a', '_blank', 'noopener,noreferrer']])
await b.publish(entry(FIXTURE, waiting('https://example.com/a')))
await b.publish(entry(FIXTURE, waiting('http://127.0.0.1:8123/authorize')))
// Another browser's operation on the same account opens nothing here.
await b.publish(entry(FIXTURE, waiting('https://example.com/b', NEXT)))
expect(b.open.mock.calls.map(([url]) => url)).toEqual(['https://example.com/a', 'http://127.0.0.1:8123/authorize'])
})
it('opens the page at once when the stream delivered the operation before the start call answered', async () => {
const b = fixture()
await b.publish(entry(FIXTURE, waiting('https://example.com/a')))
expect(b.open).not.toHaveBeenCalled()
b.browser.follow(FIXTURE, OP)
expect(b.open).toHaveBeenCalledWith('https://example.com/a', '_blank', 'noopener,noreferrer')
})
it('reports the success of an operation this browser started once, and stops following it', async () => {
const b = fixture()
b.browser.follow(FIXTURE, OP)
await b.publish(entry(FIXTURE, { result: { id: NEXT, notice: 'Other browser connected' } }))
expect(b.state().notice).toBeUndefined()
await b.publish(entry(FIXTURE, { result: { id: OP, notice: 'Fixture connected' } }))
expect(b.state().notice).toEqual({ seq: 1, kind: 'succeeded', text: 'Fixture connected' })
b.browser.dismissNotice()
await b.publish(entry(FIXTURE, { result: { id: OP, notice: 'Fixture connected' } }))
expect(b.state().notice).toBeUndefined()
// A result without the registrant's text, or a cancelled or failed one, reports nothing.
b.browser.follow(FIXTURE, NEXT)
await b.publish(entry(FIXTURE, { result: { id: NEXT } }))
expect(b.state().notice).toBeUndefined()
})
it('forgets the operation of an account the Host withdrew', async () => {
const b = fixture()
b.browser.follow(FIXTURE, OP)
await b.publish(entry(OTHER))
await b.publish(entry(FIXTURE, waiting('https://example.com/a')))
expect(b.open).not.toHaveBeenCalled()
})
it('reports a call that did not finish with a fresh notice each time', () => {
const b = fixture()
b.browser.failed()
b.browser.failed()
expect(b.state().notice).toEqual({ seq: 2, kind: 'action-failed' })
})
it('keeps the buttons disabled and logs a terminal stream failure, opening no second stream', async () => {
const b = fixture()
const warn = vi.spyOn(b.ctx.logger, 'warn').mockImplementation(() => {})
await b.publish(entry(FIXTURE))
b.fail(new Error('Host without the registry'))
await vi.waitFor(() => { expect(b.state().linked).toBe(false) })
expect(warn).toHaveBeenCalledWith(expect.stringContaining('connector accounts stream failed'), expect.any(Error))
expect(b.streams).toHaveLength(1)
expect([...b.state().accounts.keys()]).toEqual([FIXTURE])
})
it('opens nothing and reports nothing after disposal', async () => {
const b = fixture()
await b.browser.dispose()
b.browser.follow(FIXTURE, OP)
b.browser.failed()
expect(b.state().notice).toBeUndefined()
})
it('shows nothing for a stream that fails while the page disposes it', async () => {
const b = fixture()
const disposing = b.browser.dispose()
b.fail(new Error('carrier lost'))
await disposing
expect(b.state().linked).toBe(true)
})
it('ignores an item the stream yielded just before disposal', async () => {
const b = fixture()
const disposing = b.browser.dispose()
b.deliver({ accounts: [entry(FIXTURE)] })
await disposing
expect(b.state().accounts.size).toBe(0)
})
it('opens only HTTPS pages and HTTP pages on loopback addresses', () => {
const windowOpen = vi.spyOn(window, 'open').mockReturnValue(null)
onTestFinished(() => { windowOpen.mockRestore() })
for (const url of [undefined, 'not a url', 'http://example.com/a', 'javascript:alert(1)']) openAuthorizationPage(url)
expect(windowOpen).not.toHaveBeenCalled()
for (const url of ['https://example.com/a', 'http://localhost:1/a', 'http://[::1]:1/a', 'http://127.0.0.1:1/a']) openAuthorizationPage(url)
expect(windowOpen.mock.calls.map(([url]) => url)).toEqual([
'https://example.com/a', 'http://localhost:1/a', 'http://[::1]:1/a', 'http://127.0.0.1:1/a',
])
})
@@ -0,0 +1,57 @@
{
"extends": "../../../tsconfig.base.client.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/types",
"tsBuildInfoFile": "lib/tsconfig.client.tsbuildinfo"
},
"include": [
"src/client",
"src/css-modules.d.ts",
"src/types.ts"
],
"references": [
{
"path": "../../../vendor/cordis"
},
{
"path": "../../api/gateway/tsconfig.client.json"
},
{
"path": "../../api/remotes/tsconfig.client.json"
},
{
"path": "../store"
},
{
"path": "../ui-layout"
},
{
"path": "../ui-plugin-manager/tsconfig.client.json"
},
{
"path": "../ui-primitives"
},
{
"path": "../ui-renderer"
},
{
"path": "../ui-slots"
},
{
"path": "../../typert/protocol"
},
{
"path": "../locale/tsconfig.client.json"
},
{
"path": "../../util/brand"
},
{
"path": "../../util/package-manifest"
},
{
"path": "../../util/values"
}
]
}
Loaded 100 of 277 files, more files were not shown because too many files have changed in this diff. Show more