Merge remote-tracking branch 'origin/master' into feat/cua-mcp

master renamed the macOS Computer Use provider to @deepseek-ai/dsh-cua-macos
(#8284) and moved identity construction to brandString (#8214).

Adapted to master:
- The cua-mcp profile mounts @deepseek-ai/dsh-cua-macos and declares it as the
  optional dependency; the bundle test follows the new name.
- The MCP adapter builds its Session and tool-call ids with brandString, so
  @deepseek-ai/dsh-brand becomes a runtime dependency of the package.

Conflicts:
- scripts/experimental-package-policy.ts and scripts/release/families.spec.ts:
  both sides added a row; the cua-macos, cua-mcp, and cua-windows rows coexist.
- scripts/package-dependency-policy.ts: took master's removal of the SessionId
  safe entry. longEdgeDimensions no longer sits in the safe-export list; it
  joins the existing peer-required @deepseek-ai/dsh-attachment entry, so this
  branch adds no safe-export exception.
- Generated catalogs, module graphs, and the dsh-doc package reference: took
  master and regenerated.
- Four translation pairing records: took master and re-recorded after
  reviewing both language diffs.
This commit is contained in:
Yichen Jiang committed 2026-11-11 16:31:58 +08:00
commit 94d7eb2045
1453 files changed
+14836 -9308

No files matched your search

@@ -18,17 +18,17 @@
en: 821989170ad76994
zh: 0ed142bea166fc3a
/agent-note-client-session-conversation-and-ui-ownership-layers/layering-principles/ui-adapters-own-react-integration:
en: 4d032e048364fb97
zh: 82a435531efdaa78
en: 4caab5487c8545f8
zh: 77fa93f76b6fb65f
/agent-note-client-session-conversation-and-ui-ownership-layers/layering-principles/slot-scopes-and-standard-props-are-separate:
en: b6f585ca87e1fc6f
zh: 53fd58c3e93cf17c
/agent-note-client-session-conversation-and-ui-ownership-layers/package-ownership:
en: 2fc4b50a651b1847
zh: 7dceeecb9c58e838
en: 89f75f7cc2fe0e6c
zh: e50974fad3baf69c
/agent-note-client-session-conversation-and-ui-ownership-layers/overall-data-flow:
en: e7c11e82db080dd4
zh: 5a8a501a128366d6
en: 002d9f406580684b
zh: a86742c6c943ac85
/agent-note-client-session-conversation-and-ui-ownership-layers/session-controller-client:
en: b88f651b1bfb8b5e
zh: b88f651b1bfb8b5e
@@ -48,8 +48,8 @@
en: 860315b96703371d
zh: 860315b96703371d
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/service-responsibilities:
en: d075ba28fd37bff2
zh: e2d430d1f3e89b15
en: 40e598676f2d7f46
zh: acc8e028978a5419
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/standard-source-registration:
en: e4be6d4b1d79b342
zh: 7cb0e8c0f6358b50
@@ -60,8 +60,8 @@
en: 5d9bdb1f784f97f2
zh: a4b3de7a21b84fce
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/pending-interactions:
en: 85e358a03ffac4ba
zh: 54b1d5ed6197f2c2
en: 54b65fef1667278f
zh: cf46a8ad738a0a55
/agent-note-client-session-conversation-and-ui-ownership-layers/workspace-controller-and-ui-workspace:
en: 45e5f41550e62a3d
zh: d4e6d8f5b397bb51
@@ -57,7 +57,7 @@ Each standard hook belongs to the `ui-*` package closest to its data semantics.
| `useSessions` | `client/ui-session` | Session Controller global list |
| `useSession` | `client/ui-session` | Bound Session snapshot |
| `useProjection` | `client/ui-session` | Bound Session keyed projection |
| `useSessionStatus` | `client/ui-session` | Running, effective pending request, and unread completion |
| `useSessionStatus` | `client/ui-session-status` | Running, effective pending request, and unread completion |
| `useSessionRetainInfo` | `client/ui-session` | Read-only Controller reference-source counts |
| `useWorkspaces` | `client/ui-workspace` | Workspace Controller list |
| `useConversation` | `client/ui-conversation` | Conversation binding snapshot |
@@ -80,7 +80,8 @@ Adding a target does not add a branch to the renderer or Session Controller. The
| --- | --- | --- |
| `api/session-controller/client` | Session objects, catalog, references, source counts, commands, projections, event windows, and Agent Contexts | Navigation, completion reminders, Conversation targets, React, Slots, Workspace |
| `api/workspace-controller/client` | Workspace objects, ordering, archive state, commands, and snapshots | React, Session navigation policy, directory UI |
| `client/ui-session` | Explicit Session scope, standard sources, `SessionProvider`, and unified UI status | Session transport, reference ownership, Conversation assembly, Approval/Question results |
| `client/ui-session` | Explicit Session scope, standard sources, `SessionProvider`, and effective pending interactions | Session transport, reference ownership, Conversation assembly, Approval/Question results, unified UI status |
| `client/ui-session-status` | Unified UI status: running state, effective pending request, and completion reminders | Pending-interaction registration, Session transport, React |
| `client/ui-workspace` | Workspace hook, browser UI, main-area reference, and cross-Controller navigation policy | Workspace transport, copies of Session data |
| `client/ui-conversation` | Conversation core, registries, bindings, shell, input, composer, queue, and View navigation | Session transport, Chat/Trajectory snapshots |
| `client/ui-chat` | Chat target, Node definitions, renderers, selection, details, and locale | Session lifecycle, generic View navigation, Trajectory, historical-image cache |
@@ -120,7 +121,7 @@ Session data reaches the UI through this path:
Workspace data enters the Workspace Controller from `ctx.remote.workspace`, then `ui-workspace` exposes it as `useWorkspaces`. `ui-workspace` reads explicit targets for cross-domain navigation and owns the main-area reference without making it a default business Context.
Approval and Question arrive from the Host waterfall through `ctx.remote.$on` at their respective UI owners. Each owner publishes a Pending object; `ui-session.sessionStatus` supplies the same effective object to Workspace indicators and Conversation composer selection.
Approval and Question arrive from the Host waterfall through `ctx.remote.$on` at their respective UI owners. Each owner publishes a Pending object through `ui-session`; `ctx.uiSession.sessionStatus` from `ui-session-status` supplies the same effective object to Workspace indicators and Conversation composer selection.
## Session Controller Client
@@ -178,9 +179,9 @@ This cleanup does not require the Session Controller to know the roster of upper
- supplies `SessionProvider` rendering semantics;
- supplies built-in Session snapshot, projection, and sessionId sources;
- accepts Session-scoped source contributions from other domain packages;
- aggregates domain-owned pending interactions with running and completion-reminder facts in `sessionStatus`.
- selects each Session's effective domain-owned pending interaction and publishes it read-only as `pendingInteractions`.
It does not own Session transport, event folding, Conversation targets, or concrete business results.
It does not own Session transport, event folding, Conversation targets, or concrete business results. `client/ui-session-status` combines the effective pending interactions with running and completion-reminder facts in the `uiSession.sessionStatus` service, read as `ctx.uiSession.sessionStatus`.
### Standard source registration
@@ -221,7 +222,7 @@ Concurrent objects with the same key are rejected; replacement requests use a ne
`ui-session` selects each Session's effective object using domain precedence. Higher precedence wins; at equal precedence, the later valid object in traversal order wins.
The pending aggregate is private to `ui-session`; its effective request appears unchanged as `sessionStatus.getSnapshot().get(id)?.pendingInteraction`. `useSessionStatus` is the public UI read face.
The pending aggregate is private to `ui-session`; `pendingInteractions` exposes each Session's effective request read-only, and the same object appears as `ctx.uiSession.sessionStatus.getSnapshot().get(id)?.pendingInteraction`. `useSessionStatus` is the public UI read face.
Session navigation state and composer takeover read the same effective object. They do not maintain separate status maps or takeover rosters.
@@ -57,7 +57,7 @@ UI 层可以同时读取多个 Controller 做一次导航决定,但不得把
| `useSessions` | `client/ui-session` | Session Controller 全局列表 |
| `useSession` | `client/ui-session` | 已绑定会话快照 |
| `useProjection` | `client/ui-session` | 已绑定会话的键控投影 |
| `useSessionStatus` | `client/ui-session` | 运行状态、有效待处理请求和未读完成提醒 |
| `useSessionStatus` | `client/ui-session-status` | 运行状态、有效待处理请求和未读完成提醒 |
| `useSessionRetainInfo` | `client/ui-session` | 控制器的只读引用来源计数 |
| `useWorkspaces` | `client/ui-workspace` | Workspace Controller 列表 |
| `useConversation` | `client/ui-conversation` | Conversation binding snapshot |
@@ -80,7 +80,8 @@ UI 层可以同时读取多个 Controller 做一次导航决定,但不得把
| --- | --- | --- |
| `api/session-controller/client` | 会话对象、目录、引用、来源计数、命令、投影、事件窗口与 Agent Context | 导航、完成提醒、Conversation target、React、Slot、Workspace |
| `api/workspace-controller/client` | Workspace 对象、顺序、归档、命令和 snapshot | React、Session 导航策略、目录 UI |
| `client/ui-session` | 显式会话作用域、标准数据源、`SessionProvider` 与统一 UI 状态 | 会话传输、引用所有权、Conversation 组装、Approval/Question 结果 |
| `client/ui-session` | 显式会话作用域、标准数据源、`SessionProvider` 与有效待处理交互 | 会话传输、引用所有权、Conversation 组装、Approval/Question 结果、统一 UI 状态 |
| `client/ui-session-status` | 统一 UI 状态:运行状态、有效待处理请求与完成提醒 | 待处理交互登记、会话传输、React |
| `client/ui-workspace` | Workspace 钩子、浏览器 UI、主区域引用与跨控制器导航策略 | Workspace 传输、会话数据副本 |
| `client/ui-conversation` | Conversation core、registry、binding、shell、input、composer、queue 和 View 导航 | Session transport、Chat/Trajectory snapshot |
| `client/ui-chat` | Chat target、Node definitions、renderer、selection、details 和 locale | Session 生命周期、通用 View 导航、Trajectory、历史图片 cache |
@@ -120,7 +121,7 @@ Session 数据按以下路径进入 UI:
Workspace 数据由 `ctx.remote.workspace` 进入 Workspace 控制器,再由 `ui-workspace` 通过 `useWorkspaces` 提供。`ui-workspace` 为跨领域导航读取显式目标并持有主区域引用,不把它变为默认业务 Context。
Approval 与 Question 通过 `ctx.remote.$on` 从 Host waterfall 到达各自的 UI owner。各 owner 发布 Pending 对象;`ui-session.sessionStatus` 向 Workspace 标识和 Conversation composer 选择提供同一个有效对象。
Approval 与 Question 通过 `ctx.remote.$on` 从 Host waterfall 到达各自的 UI owner。各 owner 通过 `ui-session` 发布 Pending 对象;`ui-session-status` 提供的 `ctx.uiSession.sessionStatus` 向 Workspace 标识和 Conversation composer 选择提供同一个有效对象。
## Session Controller Client
@@ -178,9 +179,9 @@ Session Controller 对外提供三个互不替代的读取面:
- 提供 `SessionProvider` 的呈现语义;
- 内建 session snapshot、projection 和 sessionId source;
- 接收其他领域 package 的 Session-scoped source contribution;
- 在 `sessionStatus` 中组合领域持有的待处理交互、运行事实和完成提醒。
- 为每个会话选出领域持有的有效待处理交互,并以只读的 `pendingInteractions` 发布。
它不拥有 Session transport、event folding、Conversation target 或具体业务结果。
它不拥有 Session transport、event folding、Conversation target 或具体业务结果。`client/ui-session-status` 在 `uiSession.sessionStatus` 服务中把有效待处理交互与运行事实、完成提醒组合起来,以 `ctx.uiSession.sessionStatus` 读取。
### 标准 source 注册
@@ -221,7 +222,7 @@ Contribution roster 变化会重建已 materialize 的 binding 并发布新的 s
`ui-session` 使用各 domain 的 precedence 选出每个 Session 当前生效的对象。较高 precedence 胜出,相同 precedence 下后遍历到的有效对象胜出。
待处理聚合是 `ui-session` 的私有实现;其有效请求原样出现在 `sessionStatus.getSnapshot().get(id)?.pendingInteraction` 中。`useSessionStatus` 是公开 UI 读取接口。
待处理聚合是 `ui-session` 的私有实现;`pendingInteractions` 以只读方式提供每个会话的有效请求,同一个对象原样出现在 `ctx.uiSession.sessionStatus.getSnapshot().get(id)?.pendingInteraction` 中。`useSessionStatus` 是公开 UI 读取接口。
Session 导航状态和 composer takeover 必须读取同一个 effective object,不得分别维护 status map 或 takeover roster。
@@ -9,8 +9,8 @@
en: 990d46f713fb6303
zh: 592cd6128a9640b1
/agent-note-one-remote-failure-vocabulary-for-ctx-remote/decision:
en: 120e2fb97ac765d8
zh: 5d5f110db4a9b717
en: b54b9d98a34eeaa1
zh: ac8e3d493b554c2d
/agent-note-one-remote-failure-vocabulary-for-ctx-remote/code-ownership:
en: cc1d8b88f7349b77
zh: 70f010e3310e2667
@@ -16,12 +16,12 @@ Fixed Host facts bypassed `ctx.remote` too: the Host home came from `(ctx.get('c
## Decision
`@deepseek-ai/dsh-typert-protocol` exports one failure class, `RemoteError<Code>`: a real `Error` carrying readonly `code` and `details`, the structural marker `isDSHRemoteError`, and standard `ErrorOptions` (`cause` holds in-process only). The correspondence between codes and details lives in one merge-extensible `RemoteErrorDetailsMap`; `RemoteFailure` is the code-distributed union of instances, and `RemoteResult<T>` keeps its shape.
`@deepseek-ai/dsh-typert-protocol` exports one failure class, `RemoteError<Code>`: a `HarnessError` from the dependency-free `@deepseek-ai/dsh-error` carrying readonly `code` and `details`, the structural marker `isDSHRemoteError`, and standard `ErrorOptions` (`cause` holds in-process only). The correspondence between codes and details lives in one merge-extensible `RemoteErrorDetailsMap`; `RemoteFailure` is the code-distributed union of instances, and `RemoteResult<T>` keeps its shape.
```text
export class RemoteError<Code extends RemoteErrorCode = RemoteErrorCode> extends Error {
export class RemoteError<Code extends RemoteErrorCode = RemoteErrorCode> extends HarnessError {
readonly isDSHRemoteError: true = true
constructor(readonly code: Code, message: string,
constructor(override readonly code: Code, message: string,
readonly details: RemoteErrorDetailsMap[Code], options?: ErrorOptions)
}
export type RemoteFailure = { [C in RemoteErrorCode]: RemoteError<C> }[RemoteErrorCode]
@@ -16,12 +16,12 @@ Host 固定事实同样绕过了 `ctx.remote`:Host home 取自 `(ctx.get('conn
## Decision
`@deepseek-ai/dsh-typert-protocol` 导出唯一的失败类 `RemoteError<Code>`:一个真 `Error`,带只读 `code` 与 `details`、结构标记 `isDSHRemoteError`,以及标准 `ErrorOptions`(`cause` 只在进程内有效)。码与 details 的对应关系收进一张 merge-extensible 的 `RemoteErrorDetailsMap`;`RemoteFailure` 是按码分布的实例 union,`RemoteResult<T>` 形状不变。
`@deepseek-ai/dsh-typert-protocol` 导出唯一的失败类 `RemoteError<Code>`:一个继承无依赖包 `@deepseek-ai/dsh-error` 中 `HarnessError` 的错误,带只读 `code` 与 `details`、结构标记 `isDSHRemoteError`,以及标准 `ErrorOptions`(`cause` 只在进程内有效)。码与 details 的对应关系收进一张 merge-extensible 的 `RemoteErrorDetailsMap`;`RemoteFailure` 是按码分布的实例 union,`RemoteResult<T>` 形状不变。
```text
export class RemoteError<Code extends RemoteErrorCode = RemoteErrorCode> extends Error {
export class RemoteError<Code extends RemoteErrorCode = RemoteErrorCode> extends HarnessError {
readonly isDSHRemoteError: true = true
constructor(readonly code: Code, message: string,
constructor(override readonly code: Code, message: string,
readonly details: RemoteErrorDetailsMap[Code], options?: ErrorOptions)
}
export type RemoteFailure = { [C in RemoteErrorCode]: RemoteError<C> }[RemoteErrorCode]
@@ -12,8 +12,8 @@
en: a15c7c13f167e5ac
zh: 63bcc2ef60c2f344
/agent-note-client-session-references-reference-sources-and-ui-status/decision/scope-and-ownership:
en: 3f04f9c2b7b0fc2b
zh: ebfcbac3de8463a3
en: 9ff7f15985d06986
zh: fe27ef687594c124
/agent-note-client-session-references-reference-sources-and-ui-status/decision/addresses-bindings-and-references:
en: 3743abc8bca00348
zh: d79e6a9311f0a2fe
@@ -24,8 +24,8 @@
en: e2de83d10542f93b
zh: 3855b38fc8c48ea3
/agent-note-client-session-references-reference-sources-and-ui-status/decision/unified-ui-session-status:
en: 2d75aef5cf5f1fc8
zh: 87a7051f24f9871a
en: 07ea04b9ca50dd8f
zh: e025fcea4c9f0fb9
/agent-note-client-session-references-reference-sources-and-ui-status/decision/explicit-providers-and-consumer-lifetimes:
en: 04802baa0147fec1
zh: b86037bf2e4bc936
@@ -21,7 +21,8 @@ Client Session objects, Agent-scoped Client Contexts, references, consumer-sourc
| Owner | Responsibility |
| --- | --- |
| Client Session Controller | Catalog, live generations, references, source counts, bindings, history windows, and existing Session control state |
| `ui-session` | Explicit Session Provider integration and the unified UI status source |
| `ui-session` | Explicit Session Provider integration and the effective pending-interaction source |
| `ui-session-status` | The unified UI status source |
| View or operation | Its own reference, target, source identifier, and release point |
| Workspace UI | Main-area target and reference, navigation, persisted target, and creation flow |
| UI composition boundary | Supplies an owner-provided reference to one explicit `SessionProvider` |
@@ -89,7 +90,7 @@ Window-level consumers may inspect source markers. Session business operations s
### Unified UI Session status
`ui-session` owns a React-free `sessionStatus` source and exposes it through the standard `useSessionStatus` hook. The snapshot is indexed by Session identity and supplies one UI status record per known Session. It combines these independent facts rather than reducing them to one mutually exclusive phase:
`ui-session-status` owns the React-free `uiSession.sessionStatus` service, read as `ctx.uiSession.sessionStatus`, and exposes it through the standard `useSessionStatus` hook. The snapshot is indexed by Session identity and supplies one UI status record per known Session. It combines these independent facts rather than reducing them to one mutually exclusive phase:
| Field | Value | Meaning and owner |
| --- | --- | --- |
@@ -99,7 +100,7 @@ Window-level consumers may inspect source markers. Session business operations s
Source counts remain authoritative in `SessionListState.byId[id].retainedBy`; UI status reads them for acknowledgement policy without owning another reference registry. Titles, Workspace associations, history, queues, and projection data remain with their existing owners.
Pending domains retain `SessionPendingInteractionMap`, request identities, precedence, publication disposers, and teardown delegation. The unified status includes the same effective request object; it does not copy requests or create a second pending registry. Workspace status indicators and Conversation composer selection read `useSessionStatus` instead of separate `useSessionPendingInteraction` and `useCompletedSessionIds` hooks.
Pending domains retain `SessionPendingInteractionMap`, request identities, precedence, publication disposers, and teardown delegation in `ui-session`, which publishes each Session's effective request read-only as `ctx.uiSession.pendingInteractions`. The unified status includes the same effective request object; it does not copy requests or create a second pending registry. Workspace status indicators and Conversation composer selection read `useSessionStatus` instead of separate `useSessionPendingInteraction` and `useCompletedSessionIds` hooks.
Completion tracking subscribes to the existing `api-session/status` events so a running-to-idle transition is not lost in batched catalog snapshots. Host-list rows (`ids`) establish initial and reconnect running baselines; synthetic catalog and retained rows preserve independently observed status. A pending empty catalog is not evidence that Sessions disappeared. The update rules are:
@@ -21,7 +21,8 @@ Client Session 对象、Agent 作用域的 Client Context、引用、使用方
| 所有者 | 职责 |
| --- | --- |
| Client Session Controller | 目录、活跃代、引用、来源计数、binding、历史窗口与既有 Session 控制状态 |
| `ui-session` | 显式 Session Provider 集成与统一 UI 状态来源 |
| `ui-session` | 显式 Session Provider 集成与有效待处理交互来源 |
| `ui-session-status` | 统一 UI 状态来源 |
| 视图或操作 | 自己的引用、目标、来源标识与释放时机 |
| Workspace UI | 主区域目标与引用、导航、持久目标及创建流程 |
| UI 组合边界 | 将所有者提供的引用交给一个明确的 `SessionProvider` |
@@ -89,7 +90,7 @@ Controller 将来源计数与每个活跃代的引用共同管理。每个来源
### 统一的 UI Session 状态
`ui-session` 拥有不依赖 React 的 `sessionStatus` 来源,通过标准 `useSessionStatus` 钩子公开。快照按 Session 身份索引,为每个已知 Session 提供一条 UI 状态记录。它组合下列独立事实,不将它们压缩成互斥的单一阶段:
`ui-session-status` 拥有不依赖 React 的 `uiSession.sessionStatus` 服务,以 `ctx.uiSession.sessionStatus` 读取,并通过标准 `useSessionStatus` 钩子公开。快照按 Session 身份索引,为每个已知 Session 提供一条 UI 状态记录。它组合下列独立事实,不将它们压缩成互斥的单一阶段:
| 字段 | 取值 | 含义与所有者 |
| --- | --- | --- |
@@ -99,7 +100,7 @@ Controller 将来源计数与每个活跃代的引用共同管理。每个来源
来源计数以 `SessionListState.byId[id].retainedBy` 为准;UI 状态读取它以执行确认策略,不维护另一套引用注册表。标题、Workspace 关联、历史、队列和投影数据保留在各自的既有所有者中。
待处理领域保留 `SessionPendingInteractionMap`、请求身份、优先级、发布清理函数与卸载委托。统一状态包含同一个有效请求对象,不复制请求,也不创建第二套待处理注册表。Workspace 状态指示器与 Conversation composer 选择读取 `useSessionStatus`,不再分别读取 `useSessionPendingInteraction` 和 `useCompletedSessionIds` 钩子。
待处理领域在 `ui-session` 中保留 `SessionPendingInteractionMap`、请求身份、优先级、发布清理函数与卸载委托,`ui-session` 以只读的 `ctx.uiSession.pendingInteractions` 发布每个 Session 的有效请求。统一状态包含同一个有效请求对象,不复制请求,也不创建第二套待处理注册表。Workspace 状态指示器与 Conversation composer 选择读取 `useSessionStatus`,不再分别读取 `useSessionPendingInteraction` 和 `useCompletedSessionIds` 钩子。
完成跟踪订阅已有 `api-session/status` 事件,避免 running 到 idle 的变化在合批目录快照中丢失。Host 列表行(`ids`)建立初始与重连的 running 基线;目录合成行与 retained 行保留独立观察到的状态。pending 状态下的空目录不能证明 Session 已消失。更新规则如下:
@@ -0,0 +1,19 @@
# Bilingual-pair consistency record for 2026-09-21-reject-silent-empty-catch.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/process/2026-09-21-reject-silent-empty-catch.md
/agent-note-reject-silent-empty-catch-clauses:
en: b058c52537202c50
zh: f48d8847967a31a8
/agent-note-reject-silent-empty-catch-clauses/problem:
en: a89b84c7052329b4
zh: 9c511a0b4ee3f1ef
/agent-note-reject-silent-empty-catch-clauses/decision:
en: 0392fb5d5cc3b387
zh: c4219e43bded8ce6
/agent-note-reject-silent-empty-catch-clauses/alternatives-considered:
en: 65d05680072f8797
zh: e160d37d8ece30ad
/agent-note-reject-silent-empty-catch-clauses/consequences:
en: 88a4796188c31922
zh: bfa8efc7944ea12a
@@ -0,0 +1,33 @@
# Agent Note: Reject silent empty catch clauses
Status: implemented
English | [中文](2026-09-21-reject-silent-empty-catch.zh.md)
## Problem
An empty `catch` discards every failure of its `try`, including defects the author did not expect. The root rule requires such a clause to name the error, state why discarding it is safe, and keep its `try` to one statement, so that the clause discards only the failure its author considered. Without a check, new clauses drifted from the rule, and existing clauses broke it across many unrelated package and test owners.
## Decision
The [checker](../../../../scripts/verify-empty-catch.ts), exposed as `pnpm run verify-empty-catch`, parses first-party JavaScript and TypeScript with the TypeScript syntax tree and reports an empty clause, one whose body holds no statement other than `;`, that is unnamed, unexplained, or wraps a multi-statement `try`. A bare `_` counts as unnamed; lint requires an unused binding to start with `_`, so a conforming name such as `_alreadyGone` states the expected failure. A clause body with any other statement is out of scope because syntax cannot show whether it handles the error. The checker establishes the form; review establishes that the name and the reason are true, using the guidance in [dsh-error-handling](../../../skills/dsh-error-handling/SKILL.md#empty-catch-clauses).
Existing clauses have an exact baseline keyed by repository-relative path, a SHA-256 digest of the clause's syntax tokens together with its broken conditions, and occurrence count. Including the broken conditions makes turning a recorded one-statement `try` into a wider one, or deleting a recorded reason, a new finding, while edits inside the `try` that keep its conditions keep the clause's identity. The baseline follows the [unknown-cast inventory](2026-09-19-no-unknown-casts.md), and both checkers share [the inventory module](../../../../scripts/baseline-inventory.ts): baseline edits only delete entries or decrease counts, `--prune` removes retired entries and refuses to write while new findings exist, and no command adds an allowance. Unlike the unknown-cast inventory, which requires resolving an assertion before moving it to an unlisted file, moving a file that holds recorded clauses renames its baseline key in the same change, because narrowing a recorded `try` belongs to its owner rather than to the change that moves the file.
The checker runs in the `hygiene` and `check-all` profiles and the CI static and primary modes of [the gate runner](../../../../scripts/run-gates.ts). Empty Promise rejection handlers such as `.catch(() => {})` are outside this rule and tracked separately in issue #8033.
## Alternatives considered
**Fix every existing clause before enforcing the rule.** Rejected because narrowing a multi-statement `try` changes which failures the clause discards, which only each owner can judge. The baseline lets enforcement start while the existing clauses remain recorded findings for their owners to fix.
**Fingerprint the whole `try` statement.** Rejected because every edit inside a recorded `try` would become a new finding and force its owner to fix the clause during unrelated work. Fingerprinting the clause with its broken conditions rejects a new broken condition on a recorded clause without tying its identity to the statements inside the `try`; a `try` that is already wide can gain statements without a new finding.
**A command that records clauses from a named revision.** Rejected because a local command cannot prove that the revision is the target branch: naming the current branch would record the branch's own clauses. Once the target branch carries the checker, merging it brings that branch's baseline along, so no command is needed.
**Search text for `catch {}`.** Rejected because comments, strings, whitespace, and binding patterns defeat a text pattern, and the rule's conditions depend on the syntax tree.
## Consequences
New and changed empty clauses must conform, and fixing a recorded clause requires pruning its baseline entry. A partial fix, such as adding a name while the `try` stays wide, changes the clause's identity and therefore fails; the owner fixes the clause completely before pruning. The baseline key carries no line number, so a recorded clause can move within its file; identical clauses in one file share one fingerprint whose count covers each of them.
Passing the checker establishes the form of every unrecorded empty clause. It does not establish that a reason is true, that a non-empty handler handles its error, or that a `try` holding one block or compound statement discards only one operation's failures.
@@ -0,0 +1,33 @@
# Agent Note: 拒绝静默的空 catch 子句
Status: implemented
[English](2026-09-21-reject-silent-empty-catch.md) | 中文
## 问题
空 `catch` 会丢弃其 `try` 的所有失败,包括作者未预料到的缺陷。根规则要求此类子句命名错误、说明丢弃该错误为何安全,并将其 `try` 限制为一条语句,使子句只丢弃作者考虑过的失败。没有检查时,新增子句逐渐偏离该规则,而违反规则的现有子句分布在许多互不相关的包和测试所属模块中。
## 决策
[检查器](../../../../scripts/verify-empty-catch.ts)通过 `pnpm run verify-empty-catch` 运行,使用 TypeScript 语法树解析第一方 JavaScript 和 TypeScript,并报告未命名、未说明原因或包裹多语句 `try` 的空子句;空子句指主体中除 `;` 外不含任何语句的子句。单独的 `_` 视为未命名;lint 要求未使用的绑定以 `_` 开头,因此 `_alreadyGone` 这类符合要求的名称可以说明预期的失败。主体含有其他语句的子句不属于此规则的范围,因为语法无法表明它是否处理了错误。检查器确认形式;审查依据 [dsh-error-handling](../../../skills/dsh-error-handling/SKILL.md#empty-catch-clauses) 中的指引确认名称和原因属实。
现有子句使用精确基线记录,键由仓库相对路径、子句语法 token 连同其违反条件的 SHA-256 摘要及出现次数组成。摘要包含违反条件,因此把已记录的单语句 `try` 扩大为多语句 `try`,或删除已记录的原因,都会产生新的检查发现;而在 `try` 内部进行不改变其违反条件的修改,不改变子句的标识。基线沿用 [unknown 类型断言清单](2026-09-19-no-unknown-casts.zh.md)的做法,两个检查器共用[清单模块](../../../../scripts/baseline-inventory.ts):基线修改只能删除条目或减少次数,`--prune` 删除已失效的条目并在存在新发现时拒绝写入,且没有任何命令可以添加放行。unknown 类型断言清单要求先解决断言,才能将其移至未登记的文件;与之不同,移动包含已记录子句的文件时,须在同一变更中重命名其基线键,因为收窄已记录的 `try` 由其所属模块负责,而不属于移动文件的变更。
检查器在[门禁运行器](../../../../scripts/run-gates.ts)的 `hygiene` 和 `check-all` 配置以及 CI 静态模式和主模式中运行。`.catch(() => {})` 等空的 Promise 拒绝处理函数不属于此规则,另由 issue #8033 跟踪。
## 考虑过的替代方案
**先修复所有现有子句,再执行规则。** 不采用,因为收窄多语句 `try` 会改变子句丢弃哪些失败,只有各所属模块才能判断。基线使规则可以立即开始执行,同时现有子句仍作为已记录的检查发现,由其所属模块修复。
**对整个 `try` 语句计算指纹。** 不采用,因为已记录 `try` 内部的每次修改都会产生新的检查发现,迫使所属模块在无关工作中修复该子句。对子句连同其违反条件计算指纹,可以拒绝已记录子句上新增的违反条件,同时不让子句的标识依赖 `try` 内部的语句;已经过宽的 `try` 可以增加语句而不产生新的检查发现。
**提供从指定修订版本记录子句的命令。** 不采用,因为本地命令无法证明该修订版本就是目标分支:指定当前分支会记录该分支自身的子句。目标分支包含检查器后,合并目标分支会一并带入其基线,因此不需要这样的命令。
**在文本中搜索 `catch {}`。** 不采用,因为注释、字符串、空白和绑定模式都会使文本模式失效,而且规则的条件依赖语法树。
## 影响
新增和修改的空子句必须符合规则,修复已记录的子句时须清理其基线条目。部分修复,例如添加名称但 `try` 仍然过宽,会改变子句的标识,因此检查失败;所属模块须先完整修复子句,再清理基线条目。基线键不含行号,因此已记录的子句可以在所在文件内移动;同一文件中相同的子句共用一个指纹,其计数涵盖其中每一个子句。
通过检查器说明每个未记录的空子句都符合规定形式。它不证明原因属实,不证明非空处理代码处理了其错误,也不证明包含一个代码块或复合语句的 `try` 只丢弃一个操作的失败。
@@ -6,38 +6,38 @@
en: fe57a78907eab083
zh: 4ac96eeb365ac012
/agent-note-event-triggered-automation-tasks/problem:
en: 491a791a201d0b2c
zh: 5a98f693ac4b5e77
en: d447fec320c63e96
zh: 01e026939933c10a
/agent-note-event-triggered-automation-tasks/proposal:
en: 7906d9f791e0ba02
zh: 3a083d451344f072
en: 4cf9612456ff71c8
zh: 4e5c1113e034425b
/agent-note-event-triggered-automation-tasks/proposal/layers:
en: 8bf2fc8ccb162c59
zh: e993b9ae72f8d9a2
en: 9782ed5704aaf99a
zh: b0759dac7c55afde
/agent-note-event-triggered-automation-tasks/proposal/sessions:
en: 7ec83684c8c19e31
zh: 27df2725836e5f7b
en: 6854e9fce47f0f90
zh: f81ed1dff88902df
/agent-note-event-triggered-automation-tasks/proposal/configuration:
en: 21be7e27081aff54
zh: 7973f7f0d064db35
/agent-note-event-triggered-automation-tasks/proposal/mechanisms:
en: 2403ec84b12279ec
zh: 7e245af54dcf4a1a
en: e5cc1e6c1065e33d
zh: e1c1e20ee0873ad3
/agent-note-event-triggered-automation-tasks/proposal/product-scope:
en: c003c908f407ccb2
zh: 6113569a44d52202
en: 66a513c9dd8ec459
zh: 25be2ee31dc7ba2a
/agent-note-event-triggered-automation-tasks/proposal/event-triggers-as-infrastructure:
en: 4c62e16718896e9b
zh: 9c61ea9b6e1f4f22
en: b4d70a3dd67ac4f8
zh: ff3c85caf63930f5
/agent-note-event-triggered-automation-tasks/proposal/delivery-order:
en: 79cf498bf3566051
zh: 4537f1bd3df527b4
en: 8b181877cc83a7c2
zh: e8e7695c832a2bc5
/agent-note-event-triggered-automation-tasks/alternatives-considered:
en: 21df079f7d7c3f4d
zh: 67f4ab221aacf2cf
en: c8deb1f69853f19b
zh: 0ac27b2d59398d53
/agent-note-event-triggered-automation-tasks/acceptance-criteria:
en: 504feb2cc59f4457
zh: c78cd50f2f336562
en: 175b07c090098482
zh: f17779e363f8b899
/agent-note-event-triggered-automation-tasks/risks:
en: 35edb8d5b6a1cfa4
zh: cb8dbc339c6055be
en: 8e1baba10ef46925
zh: b38ab076fa053de4
@@ -11,11 +11,11 @@ Automation tasks run only on time rules today. The Host stores each rule, and ev
Reacting to changes brings two problems that time rules do not have.
- **Cost and noise.** Most observations of a source contain nothing worth a model turn. If every observation reaches the model and silence depends on the model replying with a marker, each poll costs a full turn, and a model that holds a messaging tool reports "nothing new" anyway.
- **Untrusted input.** Event content is written by other people: comments, reviews, messages. A turn started by that content must not edit, push, or send anything before the user has seen it.
- **Untrusted input.** Event content is written by other people: comments, reviews, messages. A turn started by that content runs with the permissions of the Session it reaches, so the content must reach the model apart from the user's instruction, and the Session's sandbox and approval settings must still apply.
## Proposal
An automation task becomes an instruction, a source with parameters, and a Session mode. Time is one source among several, so a scheduled task is an automation task whose source is time. Each observation passes three layers, and only the last one calls a model: a source event passes the trigger's filter and becomes a candidate, the candidate is delivered to a Session where the model judges it, and only a notify call produces a notice for the user. This partially supersedes the two notes linked above: tasks stop being bound to their original Session, and task records stop meaning inbox delivery only.
An automation task becomes an instruction, a source with parameters, and a Session mode. Time is one source among several, so a scheduled task is an automation task whose source is time. Each observation passes three layers, and only the last one calls a model: a source event passes the trigger's filter and becomes a candidate, and the candidate is delivered to the task's target Session, where the model runs the instruction against it. Every source takes the same path after the trigger. This partially supersedes the two notes linked above: tasks stop being bound to their original Session, and task records stop meaning inbox delivery only.
```mermaid
flowchart TD
@@ -23,28 +23,18 @@ flowchart TD
Prov["Source providers: plugins, code<br/>time, GitHub; later mail, IM, memory"]
Trig["Event trigger: shared code, state per task<br/>compare with stored state, match parameters, merge"]
Rec[("Run records")]
Src{"Source"}
Exec["Run the instruction in the target Session<br/>with its permissions"]
RO["Read-only turn in the task's own Session<br/>the model judges the candidate"]
Note["Notice: action card, unread mark,<br/>system notification"]
Quiet["No notice"]
Acc["User accepts: the action runs in the Session<br/>that created the task, with its permissions"]
Task --> Trig
Prov -- "source events" --> Trig
Trig -- "each change or failure" --> Rec
Trig -- candidate --> Src
Src -- time --> Exec
Src -- "other sources" --> RO
RO -- notify --> Note
RO -- "no notify call" --> Quiet
Note --> Acc
Trig -- candidate --> Exec
```
| Layer | Decides | Model call | Output |
|---|---|---|---|
| Source provider | What changed in the source | No | Events |
| Event trigger | Whether the change matters to this task | No | A run record; a candidate or nothing |
| Agent | Whether the user needs to act, and what to propose | Only for delivered candidates | A notice through notify, or nothing |
| Agent | What the instruction requires for this candidate | Only for delivered candidates | The turn's work and reply in the target Session |
### Layers
@@ -52,14 +42,11 @@ flowchart TD
**The event trigger** is shared code, registered per source kind and version; each task holds only its parameters and the source state it last observed. For each observation it compares the new state with the stored one, and an observation without a change only updates the last-checked time. A check that turns from passing to failing is a change, a check that stays failing is not, and a pass followed by a new failure is a change again. For a change, the trigger matches the task's conditions, which are parameter fields such as conclusion is failure, author is the user, or commenter is not a bot; merges changes to the same subject inside the provider's merge window, so one push that fails three checks becomes one event; stores the new state with the task; and either delivers a candidate to the Session or drops the change. Each change and each failure writes a run record, listed in the task's Records tab next to today's delivery records: candidate delivered, filtered with its reason, or failed. Consecutive failures with the same cause share one record with a count. Delivery ends the trigger's work: it does not wait for the turn or read a receipt. One queue per task orders its evaluations.
**The agent** receives the candidate as a message in the target Session, together with the task's instruction in the user's words. What the turn may do depends on the source.
- **Time**: the turn runs the instruction with the Session's permissions, and its reply is the result, as scheduled tasks behave today.
- **Other sources**: the turn gets the read-only tool set described under Mechanisms. It can read files and the source's state, such as check logs and pull request diffs, but has no tool that edits, pushes, or sends. One new tool, **notify** (`automation_notify`), takes a title, a summary, and a proposed action and produces a notice: an [action card](../../../../packages/experimental/action-cards/README.md) with the proposed action in the Session, the Session's unread mark, and a desktop system notification. The model decides whether to call it. A turn without notify produces no notice; there is no end tool, and nothing checks how the turn ended. When the user accepts the card, the Host sends a follow-up to the Session that handles the task, as described under Sessions; the follow-up names the task and the event and quotes the proposed action as the automation's proposal, not as the user's words, and that turn runs with that Session's permissions.
**The agent** receives the candidate as a message in the target Session, together with the task's instruction in the user's words. The turn runs the instruction with that Session's tools and permissions, and its reply is the result, as scheduled tasks behave today. The source decides only what the candidate contains, not how the turn runs. The message quotes the event's subject, summary, detail, and links as event data from the source, not as the user's words. No step waits for the user to confirm before the turn acts; an approval the turn itself requests waits for the user as in any turn. The turn needs no automation-specific tool.
### Sessions
A task delivers to its target Session in one of three modes: a specified Session, a new Session per trigger, or a new Session on the first trigger that later triggers reuse. Time tasks keep today's target, the Session they were created in. Event tasks separate judging from handling. The read-only turn runs in the task's own Session, created on the first trigger and reused afterwards, because it needs the instruction, the event, and the task's earlier decisions rather than the long history of the conversation the task came from. When the model creates a task in a conversation, it writes the facts the judgment needs into the instruction, such as which check is known to be flaky. When the user accepts a card, the proposed action goes to the Session the task was created in, where the code and its history are. The automation page's New action already creates tasks in a new Session, which then handles them; a task enabled from an official template, which a later step adds, continues in its own Session. The user can change the mode on the task.
A task delivers to its target Session in one of three modes: a specified Session, a new Session per trigger, or a new Session on the first trigger that later triggers reuse. A task created in a conversation defaults to a specified Session, the one it was created in, whatever its source; this keeps today's target for scheduled tasks, and the code and its history are there. The model, when the user asks for it, or the user on the task can choose a new-Session mode for a task whose candidates need no history, so its turns do not add to a long conversation; the model then writes the facts the work needs into the instruction, such as which check is known to be flaky. The automation page's New action already creates tasks in a new Session, which then handles them; a task enabled from an official template, which a later step adds, continues in its own Session. The user can change the mode on the task.
No task runs while the Host is stopped. On restart, each task compares the current source state with its stored state once and does not replay intermediate changes. Time keeps today's rule: a recurring task runs its latest missed occurrence once.
@@ -69,10 +56,8 @@ Configuration has two layers. Provider code decides what can be observed and how
### Mechanisms
- **Event-turn tool set.** Sandbox read-only mode limits only the filesystem, so it cannot stop a push or an outbound request. An event turn is offered a fixed tool set instead of the Session's: file reads and searches, the source provider's read operations, and `automation_notify`. Shell, file writes, web fetch, and MCP tools are absent. The tool set is recorded in the Session log, and a user message queued during the turn starts a normal turn after it ends.
- **Notify card.** The automation package registers an action-card kind, and `automation_notify` creates its card through the action-card service; the tool exists only in event turns, so no skill load precedes it. Accepting runs the kind's handler, which queues the follow-up through the Host, so the handling Session need not be open. A newer card replaces an unanswered older one in the same Session, as the service does today; the older card is in that Session's history, so the newer turn sees it and carries over what is still open. A refused card returns an error to the turn.
- **Unread mark.** The client derives the unread mark from turn completion. A task's own Session is marked as an automation Session, and for such a Session the client shows the mark only for notices, so a turn without notify leaves no mark.
- **Logging.** The delivered candidate, the turn's tool set, and the notify call are Session events, so replay rebuilds the turn; the TypeScript and Python SDK expected outputs and a recorded-session snapshot cover them.
- **Delivery.** The Host queues the candidate as a follow-up message through the same path scheduled tasks use today, so the target Session need not be open, and a turn already running there finishes first.
- **Logging.** The delivered candidate is a Session event that keeps the event data apart from the instruction, so replay rebuilds the turn's input; the TypeScript and Python SDK expected outputs and a recorded-session snapshot cover it.
- **Storage.** Source, parameters, Session mode, trigger state, and run records extend the Host task domain in a new record version with an adjacent migration. A version-1 task reads as a time task, is not rewritten until it changes, and gets no invented records. Run records have their own count and age bounds, separate from delivery records.
- **Provider configuration.** Polling intervals and request budgets are validated Config fields of each provider in cordis.yml.
@@ -82,47 +67,39 @@ Configuration has two layers. Provider code decides what can be observed and how
- The task list adds a source-type filter next to the status filter.
- Task details add the source with its parameters, read-only, and the Session mode, editable.
- A task's Records tab also lists filtered and failed evaluations.
- Notifications reuse the Session unread mark and action cards; the desktop app adds a system notification.
- A turn started by an event shows up like any other turn in its Session; no new notification surface is added.
### Event triggers as infrastructure
The trigger layer is shared infrastructure for DSH, not a feature of the automation page. A feature that watches something and hands changes to an agent becomes a task on this layer instead of building its own polling, state, records, and notifications.
The trigger layer is shared infrastructure for DSH, not a feature of the automation page. A feature that watches something and hands changes to an agent becomes a task on this layer instead of building its own polling, state, and records.
- **DSH's own state as sources**: a Session turn ending in an error, a background job settling, and, once memory lands, a memory consolidation pass finishing or memory entries changing.
- **Features on those sources**: plugin recommendations, where a workflow the user repeats by hand shows up after consolidation and the agent proposes a plugin on an action card, and task recommendations, where a review of the day's Sessions proposes follow-up work. Each is a template task with a DSH source, an instruction, and the same notify step. The plugin recommendations package, which proposes cards from conversation turns today, can move onto such a source once consolidation lands.
- **What every consumer keeps**: change detection and condition matching in code, run records, Session modes, read-only event turns, and notify as the only way a task reaches the user.
- **Features on those sources**: plugin recommendations, where a workflow the user repeats by hand shows up after consolidation and the agent proposes a plugin, and task recommendations, where a review of the day's Sessions proposes follow-up work. Each is a template task with a DSH source and an instruction. The plugin recommendations package, which proposes cards from conversation turns today, can move onto such a source once consolidation lands.
- **What every consumer keeps**: change detection and condition matching in code, run records, Session modes, and one delivery path for every source.
### Delivery order
1. Task–Session decoupling with the three Session modes.
2. The trigger layer with time as its first provider and the task-domain migration; existing scheduled tasks behave as before.
3. The GitHub provider for pull request checks, reviews, and comments; the event-turn tool set and `automation_notify`; action cards leave experimental status or ship with the automation bundle.
3. The GitHub provider for pull request checks, reviews, and comments.
4. Mail and IM providers and official templates, then DSH's own sources.
## Alternatives considered
**Judge every observation in a resident Session.** The model reads each poll and replies with a silence marker when nothing changed. It lost because each observation costs a full turn over the Session's context, polls spaced beyond the prefix cache lifetime read that context uncached, and silence depends on the model following an instruction while it holds a messaging tool. Here code drops unchanged and unmatched observations, and only a notify call reaches the user.
**Judge every observation in a resident Session.** The model reads each poll and replies with a silence marker when nothing changed. It lost because each observation costs a full turn over the Session's context, polls spaced beyond the prefix cache lifetime read that context uncached, and silence depends on the model following an instruction while it holds a messaging tool. Here code drops unchanged and unmatched observations, so only matched changes start a turn.
**Judge in the Session that created the task.** That conversation already holds the code and its history, so the instruction would need no extra facts. It lost because most candidates produce no notice, and each of them would add a turn over the conversation's whole context, read uncached once the prefix cache has expired, and queue behind or interrupt the user's own work there. Only accepted work goes to that Session.
**Let the agent choose the Session for each event.** The choice could differ from one event to the next, so the user could not predict where a notification appears, and deciding whether the history is needed requires reading it first.
**Let the agent choose the Session for each event.** The choice could differ from one event to the next, so the user could not predict where the work appears, and deciding whether the history is needed requires reading it first.
**Condition scripts per task.** A task would carry a script that fetches and decides. It lost because the script runs with the user's credentials without the review a plugin installation gets, and each task would carry its own fetch logic instead of sharing a provider.
**Notify from code when code can decide.** A failed check could notify without a model. It lost because the notification would carry only the raw status. With one path, the agent reads the logs first and the notification states the cause; change-only delivery keeps these turns rare.
**One model call outside any Session.** A single call per event costs less and leaves no Session record. It lost because the call cannot read files or logs before deciding, and acting on its result needs a Session anyway.
**Event turns with the Session's permissions.** Acting directly would save one click. It lost because event content comes from other people, and a read-only turn keeps that text from driving edits, pushes, or messages before the user accepts.
**Read-only judging turns with a notify tool and user acceptance.** Non-time sources would get a read-only turn in the task's own Session; an `automation_notify` tool would raise an action card, an unread mark, and a system notification; and the proposed action would run only after the user accepted the card. It lost because work that waits for the user to confirm each event does not fit how automations are used, such as fixing a failed check without anyone watching, and a dedicated notify tool with its card kind and unread rules would be one more model-facing interface that every later source and delivery change must keep compatible.
**A read-only sandbox for event turns.** It lost because sandbox read-only mode limits only the filesystem, and a turn in it can still push or send requests.
**An end tool and a check on how the turn ended.** A second tool would record why a turn produced no notice, and the trigger would wait for that outcome. It lost because nothing acts on that reason: delivery ends the trigger's work, and a turn without notify is already silent.
**Branch delivery by source.** Time would run the instruction with the Session's permissions while other sources take a separate path. It lost because the source says what changed, not what work the instruction asks for, and two paths would double the turn setup, logging, and tests that every source shares.
**Parameter forms on the automation page.** Each provider would need its own form, validation, and display. Parameters written by the model and shown read-only cover creation and change through conversation, and the provider schema keeps a generated form possible later.
**A separate notification entry.** An inbox page or tab would separate the notification from the Session that holds its context. The unread mark and the system notification lead to that Session, and the automation page keeps the records.
## Acceptance criteria
- Existing scheduled tasks behave the same after time becomes a provider: the same due times, the same catch-up rule, and the same delivery into the Session.
@@ -131,23 +108,19 @@ The trigger layer is shared infrastructure for DSH, not a feature of the automat
- One push that fails three checks produces one candidate.
- An observation without a change writes no record and starts no turn; a change that fails the conditions writes a filtered record and starts no turn; consecutive failures with the same cause write one record with a count.
- A run record ends at delivery: it records the candidate, not what the turn did.
- An event turn is offered no shell, file-write, web-fetch, or MCP tool, and its tool set appears in the Session log; after the user accepts its card, the next turn runs with the Session's permissions.
- A notify call produces the card, the unread mark, and the desktop system notification together.
- An event turn without a notify call leaves no unread mark and sends no system notification.
- An event task's read-only turns run in the task's own Session, and accepting its card sends the proposed action to the Session the task was created in.
- A delivered candidate starts a turn in the target Session with that Session's tools and permissions, whatever the source, without waiting for user confirmation.
- The candidate message presents the event content as event data, separate from the instruction.
- A task created in a conversation delivers to that Session by default, whatever its source.
- Each Session mode delivers as defined: a specified Session receives every trigger, a new Session opens per trigger, or one Session opens on the first trigger and is reused.
- Replaying the Session log rebuilds an event turn's candidate, tool set, and notify call.
- Replaying the Session log rebuilds an event turn's candidate and instruction.
- After a restart, a task compares the current source state with its stored state once and does not replay intermediate changes.
- The task list filters by source type, task details show source parameters read-only, and the Session mode can be changed.
## Risks
- The read-only turn sees the instruction, the event, and the task's earlier decisions, not the conversation the task came from. Facts the judgment needs from that conversation must be written into the instruction when the task is created; a user who switches the task to its original Session gets the history back at the cost of reading the long context on each delivery.
- A notification appears in the task's own Session, not in the conversation that created the task; accepting its card moves the work to that conversation.
- The agent may notify too often or stay silent when it should not. Accepted and dismissed cards show over-notification, but a missed notice leaves no trace in the run records, which end at delivery.
- Event content written by other people reaches a turn that runs with the Session's permissions. Marking it as event data does not stop a model from following text inside it; the Session's sandbox and approval settings and the task's conditions, such as commenter is not a bot, bound what such a turn can do.
- A task delivered to the Session it was created in adds a turn over that conversation's whole context on each candidate, read uncached once the prefix cache has expired, and queues behind the user's own work there; a new-Session mode avoids this but loses the history unless the instruction carries the needed facts.
- The run records end at delivery, so what a turn did is visible only in its Session. A task delivered to a new Session reports only there, and the user sees its result only after opening that Session.
- Source parameters cannot be edited by hand; every change goes through the model.
- A fix on an event waits for the user to accept the card instead of running unattended.
- A source without a provider plugin cannot be watched.
- Tasks run only while the Host runs: nothing runs while the app is closed or the machine sleeps.
- Event tasks depend on action cards, which are experimental and mounted only by the Personalized recommendations bundle today.
- The read-only tool set limits judgment to what files and the provider's read operations show; for a source whose provider offers no read operations, the agent judges from the event alone.
@@ -11,11 +11,11 @@ Status: proposed
响应变化会带来两个时间规则没有的问题。
- **成本和噪音。** 对来源的大多数观察里,没有值得花一个模型轮次处理的内容。如果每次观察都交给模型,并依靠模型回复一个标记来保持安静,每次轮询都要花一个完整轮次;手里有发消息工具的模型仍然会报告“没有新情况”。
- **不可信的输入。** 事件内容由其他人写成:评论、评审、消息。由这类内容启动的轮次,在用户看到之前不能修改、推送或发送任何东西。
- **不可信的输入。** 事件内容由其他人写成:评论、评审、消息。由这类内容启动的轮次按其所在会话的权限运行,因此这类内容必须与用户的指令分开交给模型,会话的沙箱和审批设置也必须照常生效。
## 提案
自动化任务改为由指令、带参数的来源和会话模式组成。时间是多种来源中的一种,因此定时任务就是来源为时间的自动化任务。每次观察依次经过三层,只有最后一层调用模型:来源事件经过触发器过滤成为候选事件(candidate),候选事件投递到会话,由模型在会话中判断,只有调用通知工具才会为用户产生一条通知(notice)。本提案部分取代上面链接的两篇笔记:任务不再绑定原会话,任务记录也不再只表示收件箱投递。
自动化任务改为由指令、带参数的来源和会话模式组成。时间是多种来源中的一种,因此定时任务就是来源为时间的自动化任务。每次观察依次经过三层,只有最后一层调用模型:来源事件经过触发器过滤成为候选事件(candidate),候选事件投递到任务的目标会话,由模型在该会话中针对它执行指令。所有来源在触发器之后走同一条路径。本提案部分取代上面链接的两篇笔记:任务不再绑定原会话,任务记录也不再只表示收件箱投递。
```mermaid
flowchart TD
@@ -23,28 +23,18 @@ flowchart TD
Prov["Source providers: plugins, code<br/>time, GitHub; later mail, IM, memory"]
Trig["Event trigger: shared code, state per task<br/>compare with stored state, match parameters, merge"]
Rec[("Run records")]
Src{"Source"}
Exec["Run the instruction in the target Session<br/>with its permissions"]
RO["Read-only turn in the task's own Session<br/>the model judges the candidate"]
Note["Notice: action card, unread mark,<br/>system notification"]
Quiet["No notice"]
Acc["User accepts: the action runs in the Session<br/>that created the task, with its permissions"]
Task --> Trig
Prov -- "source events" --> Trig
Trig -- "each change or failure" --> Rec
Trig -- candidate --> Src
Src -- time --> Exec
Src -- "other sources" --> RO
RO -- notify --> Note
RO -- "no notify call" --> Quiet
Note --> Acc
Trig -- candidate --> Exec
```
| 层 | 判断什么 | 是否调用模型 | 输出 |
|---|---|---|---|
| 来源提供方(source provider) | 来源里发生了什么变化 | 否 | 事件 |
| 事件触发器(event trigger) | 这个变化与本任务是否相关 | 否 | 一条运行记录;一个候选事件,或者没有 |
| agent(智能体) | 用户是否需要处理,以及建议怎么处理 | 只对已投递的候选事件 | 通过通知工具产生通知,或者没有 |
| agent(智能体) | 对这个候选事件,指令要求做什么 | 只对已投递的候选事件 | 该轮次在目标会话中完成的工作和回复 |
### 分层
@@ -52,14 +42,11 @@ flowchart TD
**事件触发器**是共享的代码,按来源类型和版本注册;每个任务只保存自己的参数和上次观察到的来源状态。每次观察时,它把新状态与保存的状态比较;没有变化的观察只更新最近检查时间。检查从通过变为失败算一次变化,持续失败不算,通过之后再次失败又算一次变化。对一次变化,触发器先匹配任务的条件(参数中的字段,例如结论为失败、作者是用户本人、评论者不是 bot),再在来源提供方的合并窗口内合并同一对象的多次变化(一次推送导致三项检查失败,只算一个事件),然后把新状态和任务一起保存,向会话投递一个候选事件,或者丢弃这次变化。每次变化和每次失败都写一条运行记录,列在任务的运行记录页签中,与现有的投递记录并列:已投递候选事件、已过滤(附原因)或失败。同一原因的连续失败共用一条记录并计数。投递之后触发器的工作就结束了,不等待该轮次,也不读取回执。每个任务用一个队列排定自己的判定顺序。
**agent** 在目标会话中以一条消息收到候选事件,消息附带以用户原话写成的任务指令。轮次能做什么取决于来源。
- **时间**:轮次按会话的权限执行指令,回复就是结果,与现在的定时任务一致。
- **其他来源**:轮次使用“机制”一节所述的只读工具集。它可以读文件和来源的状态,例如检查日志和 PR diff,但没有修改、推送或发送的工具。新增一个工具 **通知**(`automation_notify`),接收标题、摘要和建议的操作,产生一条通知:会话中出现带有建议操作的[操作卡片](../../../../packages/experimental/action-cards/README.zh.md)、会话显示未读标记、桌面端发送系统通知。是否调用由模型决定。没有调用通知的轮次不产生通知;没有结束工具,也不检查轮次如何结束。用户接受卡片后,Host 向处理该任务的会话(见“会话”一节)发送一条后续消息:消息写明任务和事件,并把建议的操作作为自动化提出的建议引用,而不是作为用户的话;该轮次按该会话的权限执行。
**agent** 在目标会话中以一条消息收到候选事件,消息附带以用户原话写成的任务指令。轮次使用该会话的工具和权限执行指令,回复就是结果,与现在的定时任务一致。来源只决定候选事件包含什么,不决定轮次如何运行。消息把事件的对象、摘要、详细内容和链接作为来自来源的事件数据引用,而不是作为用户的话。轮次行动前没有任何步骤等待用户确认;轮次自己发起的审批请求与任何轮次一样等待用户处理。轮次不需要自动化专用的工具。
### 会话
任务按三种模式之一投递到目标会话:指定的会话、每次触发新建会话、首次触发时新建会话并在之后的触发中复用。定时任务沿用现在的目标,即创建它的会话。事件任务把判断和处理分开。只读轮次在任务自己的会话中运行,首次触发时新建,之后复用,因为它需要的是指令、本次事件和该任务之前的判断,而不是任务来源会话的长历史。模型在会话中创建任务时,把判断需要的事实写进指令,例如哪项检查已知不稳定。用户接受卡片后,建议的操作发往创建任务的会话,代码和相关历史都在那里。自动化页的“新建”本来就在一个新会话中创建任务,之后由该会话处理;从官方模板启用的任务(后续步骤加入)在自己的会话中继续执行。用户可以在任务上修改模式。
任务按三种模式之一投递到目标会话:指定的会话、每次触发新建会话、首次触发时新建会话并在之后的触发中复用。在会话中创建的任务,无论来源是什么,默认投递到指定的会话,即创建它的会话;这样定时任务沿用现在的目标,代码和相关历史也都在那里。对候选事件不需要历史的任务,模型可以按用户的要求、用户也可以在任务上改用一种新建会话的模式,这样它的轮次不会继续加长一个很长的会话;这时模型把工作需要的事实写进指令,例如哪项检查已知不稳定。自动化页的“新建”本来就在一个新会话中创建任务,之后由该会话处理;从官方模板启用的任务(后续步骤加入)在自己的会话中继续执行。用户可以在任务上修改模式。
Host 停止期间不运行任何任务。重启后,每个任务把当前来源状态与保存的状态比较一次,不重放中间的变化。时间沿用现有规则:周期任务只补跑最近一次错过的时间点。
@@ -69,10 +56,8 @@ Host 停止期间不运行任何任务。重启后,每个任务把当前来源
### 机制
- **事件轮次的工具集。** 沙箱的只读模式只限制文件系统,挡不住推送或外发请求。因此事件轮次使用固定的工具集,而不是会话的工具集:读文件和搜索、来源提供方的读取操作,以及 `automation_notify`。没有 shell、写文件、网页抓取和 MCP 工具。工具集记录在会话日志中;轮次进行中排队的用户消息,在该轮次结束后作为普通轮次执行。
- **通知卡片。** 自动化包注册一种操作卡片类型,`automation_notify` 通过操作卡片服务创建这类卡片;该工具只在事件轮次中提供,因此调用前不需要加载 Skill。接受卡片时执行该类型的处理器,由处理器通过 Host 排入后续消息,所以处理任务的会话不必处于打开状态。同一会话中,新卡片会替换尚未处理的旧卡片,与操作卡片服务现在的行为一致;旧卡片在该会话的历史中,新的轮次能看到它,并把仍未处理的内容带到新卡片里。被拒绝的卡片会把错误返回给该轮次。
- **未读标记。** 客户端根据轮次完成推导未读标记。任务自己的会话标记为自动化会话,对这类会话,客户端只为通知显示未读标记,因此没有调用通知的轮次不留下标记。
- **日志。** 已投递的候选事件、轮次的工具集和通知调用都是会话事件,回放可以重建该轮次;TypeScript 和 Python SDK 的期望输出以及一个录制会话快照覆盖这些内容。
- **投递。** Host 通过现在定时任务使用的同一条路径,把候选事件作为一条后续消息排入队列,所以目标会话不必处于打开状态;该会话中正在运行的轮次会先结束。
- **日志。** 已投递的候选事件是一个会话事件,其中事件数据与指令分开,回放可以重建该轮次的输入;TypeScript 和 Python SDK 的期望输出以及一个录制会话快照覆盖该事件。
- **存储。** 来源、参数、会话模式、触发器状态和运行记录以新的记录版本扩展 Host 任务域,并提供相邻迁移。版本 1 的任务按时间任务读取,在发生修改前不重写,也不补造记录。运行记录有自己的数量和时长上限,与投递记录分开。
- **来源提供方配置。** 轮询间隔和请求额度是每个来源提供方在 cordis.yml 中经过校验的 Config 字段。
@@ -82,47 +67,39 @@ Host 停止期间不运行任何任务。重启后,每个任务把当前来源
- 任务列表在状态筛选旁增加来源类型筛选。
- 任务详情增加来源及其参数(只读)和会话模式(可修改)。
- 任务运行记录同时列出已过滤和失败的判定。
- 通知复用会话的未读标记和操作卡片;桌面端新增系统通知。
- 由事件启动的轮次在所在会话中与其他轮次一样显示;不新增通知界面。
### 事件触发作为基础设施
触发层是 DSH 共用的基础设施,而不是自动化页的一项功能。需要观察某样东西并把变化交给 agent 的功能,都作为这一层上的任务实现,不再各自实现轮询、状态、记录和通知。
触发层是 DSH 共用的基础设施,而不是自动化页的一项功能。需要观察某样东西并把变化交给 agent 的功能,都作为这一层上的任务实现,不再各自实现轮询、状态和记录。
- **DSH 自身状态作为来源**:会话轮次以错误结束、后台作业结束;memory 落地后,还包括一次 memory 整理完成,或 memory 条目发生变化。
- **基于这些来源的功能**:插件推荐,即 memory 整理后发现用户反复手动执行的流程,由 agent 在操作卡片上推荐插件;任务推荐,即回顾当天的会话,提出后续要做的事。每一项都是一个模板任务,由一个 DSH 来源、一条指令和同样的通知步骤组成。插件推荐包现在从对话轮次中提出卡片,memory 整理落地后可以改为基于这类来源。
- **每个使用方都保留的规则**:变化检测和条件匹配由代码完成、运行记录、会话模式、只读的事件轮次,以及只有通知能让任务触达用户。
- **基于这些来源的功能**:插件推荐,即 memory 整理后发现用户反复手动执行的流程,由 agent 推荐插件;任务推荐,即回顾当天的会话,提出后续要做的事。每一项都是一个模板任务,由一个 DSH 来源和一条指令组成。插件推荐包现在从对话轮次中提出卡片,memory 整理落地后可以改为基于这类来源。
- **每个使用方都保留的规则**:变化检测和条件匹配由代码完成、运行记录、会话模式,以及所有来源共用的一条投递路径。
### 交付顺序
1. 任务与会话解耦,支持三种会话模式。
2. 上线触发层和任务域迁移,以时间作为第一个来源提供方;现有定时任务行为不变。
3. GitHub 来源提供方,覆盖 PR 的检查、评审和评论;事件轮次工具集和 `automation_notify`;操作卡片结束实验状态,或随自动化 bundle 一起提供。
3. GitHub 来源提供方,覆盖 PR 的检查、评审和评论。
4. 邮件和 IM 来源提供方以及官方模板,然后是 DSH 自身的来源。
## 考虑过的替代方案
**在常驻会话中判断每次观察。** 模型读取每次轮询的结果,没有变化时回复一个静默标记。没有采用,原因是:每次观察都要在会话的完整上下文上花一个轮次;轮询间隔超过前缀缓存的有效期时,每次都要在没有缓存的情况下读取整个上下文;而且模型手里有发消息工具时,能否保持安静取决于它是否遵守指令。本方案由代码丢弃没有变化和不匹配的观察,只有调用通知才会触达用户。
**在常驻会话中判断每次观察。** 模型读取每次轮询的结果,没有变化时回复一个静默标记。没有采用,原因是:每次观察都要在会话的完整上下文上花一个轮次;轮询间隔超过前缀缓存的有效期时,每次都要在没有缓存的情况下读取整个上下文;而且模型手里有发消息工具时,能否保持安静取决于它是否遵守指令。本方案由代码丢弃没有变化和不匹配的观察,因此只有匹配的变化才会启动轮次。
**在创建任务的会话中判断。** 该会话已经有代码和相关历史,指令里不需要额外写事实。没有采用,原因是大多数候选事件不产生通知,每一次都会在该会话的完整上下文上增加一个轮次,前缀缓存过期后要在没有缓存的情况下读取整个上下文,用户正在那里工作时还要排队或打断。只有被接受的工作才会进入该会话。
**由 agent 为每个事件选择会话。** 每次的选择可能不同,用户无法预料通知出现在哪里;而且要判断是否需要历史,得先读取历史。
**由 agent 为每个事件选择会话。** 每次的选择可能不同,用户无法预料工作出现在哪里;而且要判断是否需要历史,得先读取历史。
**每个任务自带条件脚本。** 任务携带一个脚本,由脚本获取数据并作出判断。没有采用,原因是脚本以用户的凭据运行,却没有经过安装插件时的审查;而且每个任务都要自带获取逻辑,无法共用来源提供方。
**代码能判断时由代码直接通知。** 检查失败可以不经模型直接通知。没有采用,原因是这样的通知只包含原始状态。只保留一条路径时,agent 会先读日志,通知中写明失败原因;只在变化时投递,这类轮次很少。
**在会话之外调用一次模型。** 每个事件调用一次模型,成本更低,也不留下会话记录。没有采用,原因是这次调用在判断前无法读取文件或日志,而且要根据结果采取行动仍然需要会话。
**事件轮次沿用会话的权限。** 直接行动可以省去一次点击。没有采用,原因是事件内容来自其他人,只读轮次能防止这些文字在用户接受之前驱动修改、推送或发消息。
**只读判断轮次加通知工具和用户接受。** 非时间来源在任务自己的会话中运行只读轮次;`automation_notify` 工具产生操作卡片、未读标记和系统通知;建议的操作只在用户接受卡片后执行。没有采用,原因是每个事件都要等用户确认的工作不符合自动化的使用方式,例如在无人值守时修复失败的检查;而且专用的通知工具及其卡片类型和未读规则,会多出一个面向模型的接口,之后每次增加来源或修改投递都必须与它保持兼容。
**事件轮次使用只读沙箱。** 没有采用,原因是沙箱的只读模式只限制文件系统,处于该模式的轮次仍然可以推送或发出请求。
**结束工具和对轮次结束方式的检查。** 第二个工具可以记录某一轮为什么没有产生通知,触发器则要等待这个结果。没有采用,原因是没有任何环节会使用这个原因:投递之后触发器的工作就结束了,而没有调用通知的轮次本来就是静默的。
**按来源分支投递。** 时间按会话的权限执行指令,其他来源走另一条路径。没有采用,原因是来源说明的是发生了什么变化,而不是指令要求做什么工作;两条路径会让所有来源共用的轮次准备、日志和测试都变成两份。
**在自动化页提供参数表单。** 每个来源提供方都需要各自的表单、校验和展示。由模型写入参数并以只读方式展示,已经覆盖通过对话创建和修改;来源提供方的 schema 让以后生成表单仍然可行。
**单独的通知入口。** 收件箱页面或标签页会把通知与持有其上下文的会话分开。未读标记和系统通知都指向该会话,自动化页保留记录。
## 验收标准
- 时间改为来源提供方后,现有定时任务行为不变:到期时间相同、补跑规则相同、投递到会话的方式相同。
@@ -131,23 +108,19 @@ Host 停止期间不运行任何任务。重启后,每个任务把当前来源
- 一次推送导致三项检查失败,只产生一个候选事件。
- 没有变化的观察不写记录,也不启动轮次;不满足条件的变化写一条已过滤记录,不启动轮次;同一原因的连续失败只写一条带计数的记录。
- 运行记录到投递为止:记录候选事件,不记录该轮次做了什么。
- 事件轮次不提供 shell、写文件、网页抓取或 MCP 工具,其工具集出现在会话日志中;用户接受卡片后,下一轮次按会话的权限执行。
- 一次通知调用同时产生卡片、未读标记和桌面端系统通知。
- 没有调用通知的事件轮次不留下未读标记,也不发送系统通知。
- 事件任务的只读轮次在任务自己的会话中运行;接受卡片后,建议的操作发往创建任务的会话。
- 已投递的候选事件在目标会话中启动一个轮次,使用该会话的工具和权限,与来源无关,也不等待用户确认。
- 候选事件消息把事件内容作为事件数据呈现,与指令分开。
- 在会话中创建的任务默认投递到该会话,与来源无关。
- 每种会话模式按定义投递:指定的会话接收每次触发,或每次触发新建一个会话,或首次触发时新建一个会话并在之后复用。
- 回放会话日志可以重建事件轮次的候选事件、工具集和通知调用。
- 回放会话日志可以重建事件轮次的候选事件和指令。
- 重启后,任务把当前来源状态与保存的状态比较一次,不重放中间的变化。
- 任务列表可以按来源类型筛选,任务详情以只读方式显示来源参数,会话模式可以修改。
## 风险
- 只读轮次看到的是指令、本次事件和该任务之前的判断,看不到任务来源的会话。判断需要的、来自那个会话的事实,必须在创建任务时写进指令;用户把任务改成投回原会话,就能拿回历史,代价是每次投递都要读取很长的上下文。
- 通知出现在任务自己的会话里,而不是创建任务的对话里;接受卡片后,工作转到那个对话。
- agent 可能通知过于频繁,或者在应该提醒时保持静默。被接受和被忽略的卡片能看出通知过多,但漏掉的通知不会在运行记录中留下痕迹,因为运行记录到投递为止。
- 由其他人写成的事件内容会进入按会话权限运行的轮次。把它标为事件数据,并不能阻止模型照着其中的文字去做;这类轮次能做什么,由会话的沙箱和审批设置以及任务的条件(例如评论者不是 bot)限定。
- 投递到创建它的会话的任务,每个候选事件都会在该会话的完整上下文上增加一个轮次,前缀缓存过期后要在没有缓存的情况下读取整个上下文,并且要排在用户在那里的工作之后;新建会话的模式可以避免这一点,但除非指令带上所需的事实,否则会失去历史。
- 运行记录到投递为止,因此轮次做了什么只能在它所在的会话中看到。投递到新建会话的任务只在那里报告结果,用户打开该会话后才能看到。
- 来源参数不能手动编辑,每次修改都要经过模型。
- 针对事件的修复要等用户接受卡片,不会在无人值守时执行。
- 没有来源提供方插件的来源无法观察。
- 任务只在 Host 运行时执行:应用关闭或机器休眠期间不运行任何任务。
- 事件任务依赖操作卡片,而它目前是实验包,只由个性化推荐 Bundle 装入。
- 只读工具集把判断限制在文件和来源提供方读取操作能看到的内容;来源提供方不提供读取操作时,agent 只能根据事件本身判断。
@@ -21,5 +21,5 @@
en: 21838e31d29b87fb
zh: c72c81ef53b090e0
/agent-note-api-extractor-reports/why-deferred:
en: e2a8a7c13f4db704
zh: aeae101a9a77d677
en: 7e8a1bd17832ec5c
zh: 3ea8dea04965f676
@@ -30,3 +30,5 @@ The dependency is heavy and finicky — the reason this was deferred — and the
## Why deferred
Deferred when doc-sync landed: low value for an internal monorepo where reviewers already see the source diff, and a heavy, finicky dependency. Revisit if the packages are ever published externally — at that point a stable, diffable public API earns its keep.
The packages are now published to npm, so the revisit condition holds. The [stable API policy](2026-11-05-stable-api-policy.md) proposal replaces the per-package reports with one report covering exports, services, and events, and adds stability levels and per-seam versions; its acceptance criteria apply if it is accepted.
@@ -30,3 +30,5 @@ Status: proposed
## 推迟原因
在 doc-sync 落地时被推迟:对于一个内部 monorepo,评审者已经能看到源码 diff,价值不高;且依赖笨重、难以调教。如果各包将来对外发布,再重新评估——届时一份稳定、可 diff 的公开接口报告才值得其维护成本。
各包现已发布到 npm,重新评估的条件已经满足。[稳定 API 规范](2026-11-05-stable-api-policy.zh.md)提案用一份覆盖导出、服务和事件的报告取代每个包一份的报告,并加入稳定级别和按 seam 划分的版本;该提案被接受后,以其验收标准为准。
@@ -0,0 +1,49 @@
# Bilingual-pair consistency record for 2026-11-05-stable-api-policy.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/proposed/process/2026-11-05-stable-api-policy.md
/agent-note-stable-api-policy:
en: efcff6bc65d1ae54
zh: 2b32885373cb788d
/agent-note-stable-api-policy/problem:
en: b6492a320d28ff1c
zh: 0105277d71fe43ab
/agent-note-stable-api-policy/proposal:
en: 88384462c8232e93
zh: 355ad48f96efc95e
/agent-note-stable-api-policy/proposal/stability-levels:
en: ad9ea5e151e05ac2
zh: baa08299dac43ee4
/agent-note-stable-api-policy/proposal/unit-one-capability-seam:
en: 2d33b23a61c8dae4
zh: 4d781899433069d5
/agent-note-stable-api-policy/proposal/what-stable-covers:
en: 0a637e21cfbabeb3
zh: 76078282bf686e17
/agent-note-stable-api-policy/proposal/api-report-and-ci:
en: 772026ec3f2512b0
zh: d6cf271248e85a0e
/agent-note-stable-api-policy/proposal/plugin-author-warnings:
en: e9bdb925a73e14e4
zh: e04aa39a43407070
/agent-note-stable-api-policy/proposal/plugin-requirements:
en: cce626a0c5dff76f
zh: d85d04d33ddcff48
/agent-note-stable-api-policy/proposal/compatibility-layer:
en: 40445e93d1bb8561
zh: 05a845c5093f4abd
/agent-note-stable-api-policy/proposal/rollout:
en: 16e88b03b3f1bc38
zh: 5628adf979269b92
/agent-note-stable-api-policy/proposal/open-questions:
en: b33cf00ac8a10a94
zh: e0a041a07879d2d5
/agent-note-stable-api-policy/alternatives-considered:
en: 4154f0aadc2f0017
zh: cc1e120f80e7fbb8
/agent-note-stable-api-policy/acceptance-criteria:
en: a858ac77edabe3d3
zh: 63f0872b73eef7f3
/agent-note-stable-api-policy/risks:
en: 16693acc4f57df3a
zh: 96b056ba83bf3c38
@@ -0,0 +1,121 @@
# Agent Note: Stable API policy
Status: proposed
English | [中文](2026-11-05-stable-api-policy.zh.md)
## Problem
Every public DSH API is pre-stable: root `AGENTS.md` tells contributors to update every consumer when an API changes. That rule works inside the repository, but external plugins now install from npm and the plugin market, and their authors cannot tell which APIs they can rely on. All released packages share one lockstep version, so a package version says nothing about which API changed. The only compatibility check, `evaluatePluginCompatibility` in [plugin-compatibility.ts](../../../../packages/boot/app-boot/src/plugin-compatibility.ts), compares a plugin's `engines.dsh` range, or else its `@deepseek-ai/dsh` and `@deepseek-ai/dsh-*` peer ranges, with the whole runtime version; `workspace:` peer ranges count as the running version.
No source marker distinguishes stable from unstable APIs. Exports carry no `@public`, `@beta`, `@stable`, or `@since` tags; `@internal` appears about ten times with differing meanings, and undated `@deprecated` about a dozen times. The only rigorous compatibility rules cover data formats ([Session format status](../../../../docs/session-format-status.md), SQLite schema versions, persistence type acknowledgements) and [upgrade guides](../../../skills/dsh-create-upgrade-guide/SKILL.md).
The policy must start from this state. Contributors must not have to classify every API before the policy takes effect, and code that nobody marks must keep today's workflow.
## Proposal
Stability markers in source are the only input. A generated API report turns them into a versioned list of stable APIs for each release. The unit of versioning is the [capability seam](../../../../docs/glossary.md#capability-seam). Anything not marked stays unstable, so adoption proceeds one member at a time.
### Stability levels
| Level | Marker | Change rule |
|---|---|---|
| unstable (default) | None | Change freely, update every consumer, and record externally perceptible breaks in an upgrade guide |
| stable | `@stable <seam>@<version>`, the seam version that added the member | Backward-compatible additions only; a removal or incompatible change requires a completed deprecation period and a major seam version |
| internal | `@internal` | Used only inside this repository; omitted from the API report; change freely |
Deprecation is a state of a stable member, not a fourth level: a member tagged `@deprecated <replacement or "no replacement">` stays stable until its deprecation period ends. `@internal` and `@deprecated` tags on unstable members keep their current meaning; the policy assigns no new meaning to existing tags.
Packages under [`packages/experimental/`](../../../../packages/experimental/README.md#status) cannot contain stable members; a package is promoted out of the experimental group before any of its members are promoted.
### Unit: one capability seam
Each capability seam has its own API version, independent of the lockstep package version. A stable member belongs to the seam of the Service Definition package that declares it; a member of a declaration-merged interface such as `Context` or `SessionEventMap` belongs to the seam of the package that adds it. Exports that belong to no seam, such as utilities, CLI options, and the SDK wire protocol, stay unstable until a later proposal assigns them. Members reachable only through `./src/*` export subpaths are unstable.
The package that declares a Service Definition records its seam version in the existing `package.json` `dsh` declaration, owned by the [public package manifest](../../implemented/architecture/2026-09-10-public-package-manifest.md) decision. One package can declare several seams, so the member is a list:
```json
{ "dsh": { "apis": [{ "name": "agent", "version": "1.0.0" }] } }
```
The new members are optional and do not change `manifestVersion`; their names are not settled. As that decision requires, the report generator and the compatibility check each validate the members they read.
### What stable covers
Stable covers type signatures, event order, and waterfall calling conventions, including whether a listener must call `next()`. Default config values and config fields are not covered in this proposal. CI detects signature changes from the generated report. Behavior changes cannot be detected reliably; the author declares them in the PR description, and ordinary review checks the declaration. Tests that pin stable event order and waterfall conventions belong to the Service Definition package and run against the shipped Service Provider.
A stable signature can reference types from other seams, such as `SessionId` or `Scoped`. Those referenced types become part of the referencing seam's promise: the report lists them under that seam, and an incompatible change to them fails the same checks as a change to the seam's own members.
### API report and CI
A script generates one checked-in API report covering exports, Cordis services, and events, with each entry's seam, level, and version; it replaces the per-package reports of the deferred [API extractor reports](2026-06-11-api-extractor-reports.md) proposal. Each release archives its report. CI compares stable entries, including referenced types, with the latest released report and fails when:
- a stable entry is removed or changed incompatibly without a major seam version bump and an upgrade guide;
- a removed entry was not deprecated in a released report, or its deprecation period has not elapsed since the first release whose report recorded the deprecation;
- a stable entry is added without a minor seam version bump;
- a stable signature references a member marked `@internal` or an unstable member of its own seam.
Measuring the period from the first release that recorded the deprecation keeps it independent of dates authors write. Changes to unstable entries appear in the report diff without failing CI. CI also posts a summary of stable API changes to the PR. Promotion and breaking changes are approved in ordinary PR review; no dedicated API owner or committee is named.
### Plugin author warnings
A type-aware lint rule reports uses of unstable members by resolving each used symbol and reading its level from the published declarations. Event and waterfall names are string literals passed to `ctx.on()` and similar calls, so the rule resolves them against the event map; `typescript/no-deprecated` in [.oxlintrc.json](../../../../.oxlintrc.json) does not cover this case. Oxlint offers no custom type-aware rules, so the rule ships as a published tool that plugin authors run in their own builds; the repository runs it on stable Service Definition packages. Subpath export isolation (`…/unstable` entry points) was rejected; see [Alternatives considered](#alternatives-considered).
### Plugin requirements
A plugin may declare the seam versions it needs, for example `"dsh": { "requires": { "agent": "^1.0.0" } }`. The seam check is additive: `evaluatePluginCompatibility` still evaluates `engines.dsh` or the DSH peer ranges, and also compares each listed seam range with the seam versions recorded in the running Host's API report. A plugin that declares seam ranges can widen its `engines.dsh` range to every runtime it supports. Plugin market index entries and registry update checks read the same declaration, so discovery, installation, and update reach the same result. By convention the plugin also lists the unstable seams it uses; the Host cannot verify that list, and the plugin manager shows it as a risk. The declaration does not restrict what a plugin can import or access: Cordis plugins run in the Host process and can import any package or reach any service on `ctx`.
### Compatibility layer
Serving an old major seam version to old plugins is deferred. It becomes worthwhile once a stable seam takes a major version bump while external plugins still require the previous major. The Host then keeps one current implementation, and an adapter plugin provides the old Service Definition on top of it for a fixed support period.
### Rollout
1. Policy only: land this note and define the deprecation period. Replace the pre-stable statement with "unmarked APIs are unstable" in root `AGENTS.md`, [packages/README.md](../../../../packages/README.md), [packages/experimental/README.md](../../../../packages/experimental/README.md), [apps/cli/reference/README.md](../../../../apps/cli/reference/README.md), and the generated package reference from [gen-plugin-packages.ts](../../../../scripts/gen-plugin-packages.ts). No code changes.
2. Baseline report: generate and check in the first API report; CI only checks that it is current.
3. Pilot: promote members of the agent seam declared by `dsh-agent`: `ctx.agents`, `AgentHandle`, `Agent`, the `agent/*` events other than the deprecated `agent/request`, and the `agent/pre-step` waterfall. Types they reference from session, scope, and llm packages join the promise as described above. The `dsh-agent-loop` Service Provider and its config stay unstable, so the pilot stabilizes no configuration. The lint tool and the `requires` check ship in this phase; [package-manifest README](../../../../packages/util/package-manifest/README.md) and the public package manifest note are updated to describe the enforced check.
4. Promote further members and seams when the maintainers of a seam choose to; publish the stable API list on the documentation website.
5. Add compatibility adapters for specific seams when the condition above holds.
### Open questions
- Names of the `dsh.apis` and `dsh.requires` members.
- Length of the time-based deprecation period before DSH 1.0.
- Whether the Python SDK methods, the SDK JSON-RPC protocol, and `cordis.yml` config fields join the same levels, and whether the protocol needs its own version.
- Report generator: API Extractor or a dump built on the export walker in [scripts/verify-export-jsdoc.ts](../../../../scripts/verify-export-jsdoc.ts) and the tag parser in [scripts/jsdoc.ts](../../../../scripts/jsdoc.ts).
- Lint tool form: a standalone published checker built on the same export walker, a non-type-aware approximation, or an upstream oxlint rule.
## Alternatives considered
**`@stable` markers without versions.** Cheapest and incremental, but a plugin cannot state which stable API it was built against, the Host cannot check it, and the report cannot tell additions from existing members. Kept as the input format with the adding seam version attached; the generated report supplies the list.
**A hand-maintained versioned list per release.** Gives plugin authors a clear reference, but maintaining it by hand for over a thousand export subpaths and more than a hundred services is not practical, and one version for the whole list forces every plugin to react to any seam's break. Kept as the generated report rather than a maintained artifact.
**One API version for the whole platform** (Android API level, VS Code `engines`). Simplest for plugin authors, but DSH releases often and its seams evolve independently; a single number would either grow with every break or discourage necessary breaks.
**Independent semver per npm package, dropping the lockstep version.** The [npm release sequences](../../implemented/process/2026-08-10-npm-release-sequences.md) decision keeps all DSH packages on one version so releases and peer ranges stay consistent. Package versions would also change for internal refactors that do not touch any API a plugin uses. Seam versions describe API compatibility without changing how packages are released.
**Grouping by package directory instead of seam.** Groups such as `fs/` mix Service Definitions, providers, and tools that evolve separately. The seam is already the unit the architecture uses, so it costs the least to maintain.
**Subpath export isolation for unstable APIs.** Making the import path the opt-in is more explicit than a lint warning, but it restructures the exports of every package and breaks every current consumer at once, which contradicts incremental adoption.
**Shipping a compatibility layer from the start.** Each retained old version needs its own conversion code and tests. Before any seam is stable and before external plugins depend on an old major, that cost buys nothing.
**Counting the deprecation period in releases.** DSH release frequency varies, so a release count gives plugin authors an unpredictable amount of time. Measuring time from the first release that recorded the deprecation is predictable and can be computed from archived reports.
## Acceptance criteria
- Root `AGENTS.md` and the package documentation listed in rollout step 1 state that unmarked APIs are unstable, and the deprecation period is defined.
- A checked-in API report covers exports, services, and events; CI fails when it is stale.
- The pilot members of the agent seam carry `@stable [email protected]`; CI rejects an incompatible change to them or to a type they reference, and posts a stable API change summary on PRs that touch them.
- The lint tool reports a plugin's use of an unstable member, including an unstable event name passed to `ctx.on()`.
- A plugin that declares `requires` is accepted or rejected per seam range in installation, update, and market discovery; a plugin without it behaves as it does today.
## Risks
- Referenced types from other seams join the promise of the referencing seam; promoting the agent seam therefore freezes parts of the session, scope, and llm types before those seams are promoted.
- Behavior changes rely on author declarations, which review can miss.
- Seam versions and the lockstep package version are two numbering systems, which plugin authors may confuse.
- Promoting the agent seam constrains a core part of the loop that still changes often; promotion trades that flexibility for plugin stability.
- The lint tool is new published tooling that the project must maintain alongside the oxlint configuration.
- The manifest declaration cannot stop a plugin from using undeclared APIs; it informs checks and users, not enforcement.
@@ -0,0 +1,121 @@
# Agent Note: 稳定 API 规范
Status: proposed
[English](2026-11-05-stable-api-policy.md) | 中文
## Problem
DSH 的所有公开 API 都处于预稳定(pre-stable)阶段:根目录 `AGENTS.md` 要求 API 变化时同步更新每个消费方。这条规则在仓库内部可行,但外部插件现在从 npm 和插件市场安装,作者无法判断哪些 API 可以依赖。所有发布的包共用一个锁步版本,包版本无法说明哪个 API 变了。唯一的兼容检查是 [plugin-compatibility.ts](../../../../packages/boot/app-boot/src/plugin-compatibility.ts) 中的 `evaluatePluginCompatibility`,它把插件的 `engines.dsh` 范围(没有时改用 `@deepseek-ai/dsh` 和 `@deepseek-ai/dsh-*` peer 范围)与整个运行时版本比较;`workspace:` peer 范围视为当前运行版本。
源码中没有区分 stable 与 unstable API 的标记。导出不带 `@public`、`@beta`、`@stable` 或 `@since` 标签;`@internal` 出现约十次且含义不一,不带日期的 `@deprecated` 出现约十几次。唯一严格的兼容规则针对数据格式([Session 格式状态](../../../../docs/session-format-status.zh.md)、SQLite schema 版本、持久化类型变更确认)和 [upgrade guide](../../../skills/dsh-create-upgrade-guide/SKILL.md)。
规范必须从这一现状起步。贡献者不需要先给所有 API 定级,规范才能生效;没有人标记的代码保持现有工作方式。
## Proposal
源码中的稳定性标记是唯一输入。生成的 API 报告把标记转换为每次发布的带版本稳定 API 列表。版本单位是[能力 seam](../../../../docs/glossary.zh.md#capability-seam)。未标记的内容一律保持 unstable,因此可以逐个成员推进。
### 稳定级别
| 级别 | 标记 | 变更规则 |
|---|---|---|
| unstable(默认) | 无 | 随时修改,更新每个消费方,外部可感知的破坏性变更写入 upgrade guide |
| stable | `@stable <seam>@<version>`,即加入该成员的 seam 版本 | 只允许向后兼容的新增;删除或不兼容修改需要弃用期已满,并升级 seam 主版本 |
| internal | `@internal` | 仅在本仓库内部使用;不进入 API 报告;随时修改 |
弃用是 stable 成员的一种状态,不是第四个级别:带 `@deprecated <替代项或“无替代”>` 的成员在弃用期结束前仍是 stable。unstable 成员上的 `@internal` 和 `@deprecated` 标签保持现有含义;本规范不给现有标签赋予新含义。
[`packages/experimental/`](../../../../packages/experimental/README.zh.md#status) 下的包不能包含 stable 成员;包须先移出 experimental 分组,其中的成员才能晋升。
### 单位:一个能力 seam
每个能力 seam 有自己的 API 版本,与锁步的包版本无关。stable 成员属于声明它的 Service Definition 包所在的 seam;`Context`、`SessionEventMap` 等声明合并接口的成员属于添加该成员的包所在的 seam。不属于任何 seam 的导出(如工具函数、CLI 选项、SDK wire 协议)保持 unstable,留待后续提案归属。只能通过 `./src/*` 导出子路径访问的成员是 unstable。
声明 Service Definition 的包在现有的 `package.json` `dsh` 声明中登记 seam 版本,该声明由[公开包 manifest](../../implemented/architecture/2026-09-10-public-package-manifest.zh.md) 决策负责。一个包可以声明多个 seam,因此该成员是列表:
```json
{ "dsh": { "apis": [{ "name": "agent", "version": "1.0.0" }] } }
```
新成员是可选的,不改变 `manifestVersion`;成员名称尚未确定。按该决策的要求,报告生成器和兼容检查各自校验自己读取的成员。
### stable 覆盖的范围
stable 覆盖类型签名、事件顺序和 waterfall 调用约定(包括 listener 是否必须调用 `next()`)。本提案不覆盖默认配置值和配置字段。CI 根据生成的报告检测签名变化。行为变化无法可靠地自动检测;作者在 PR 描述中声明,由正常评审核对。锁定 stable 事件顺序和 waterfall 约定的测试属于 Service Definition 包,针对随产品发布的 Service Provider 运行。
stable 签名可以引用其他 seam 的类型,例如 `SessionId` 或 `Scoped`。这些被引用的类型成为引用方 seam 承诺的一部分:报告把它们列在该 seam 下,对它们的不兼容修改与修改该 seam 自身成员一样触发检查失败。
### API 报告与 CI
一个脚本生成并提交一份 API 报告,覆盖导出、Cordis 服务和事件,每个条目带有所属 seam、级别和版本;它取代已推迟的 [API extractor 报告](2026-06-11-api-extractor-reports.zh.md)提案中每个包一份的报告。每次发布归档当次报告。CI 把 stable 条目(包括被引用的类型)与最近一次发布的报告比较,以下情况失败:
- stable 条目被删除或不兼容修改,但没有升级 seam 主版本并写 upgrade guide;
- 被删除的条目没有在已发布的报告中标为弃用,或自首次记录该弃用的发布起弃用期未满;
- 新增 stable 条目,但没有升级 seam 次版本;
- stable 签名引用了标为 `@internal` 的成员,或本 seam 的 unstable 成员。
从首次记录弃用的发布开始计算弃用期,使其不依赖作者填写的日期。unstable 条目的变化只出现在报告 diff 中,不会让 CI 失败。CI 还会在 PR 中发布 stable API 变更摘要。晋升和破坏性变更在正常 PR 评审中批准,不指定专门的 API owner 或委员会。
### 插件作者告警
一条类型感知的 lint 规则报告对 unstable 成员的使用:解析每个被使用的符号,并从发布的类型声明中读取其级别。事件和 waterfall 名称是传给 `ctx.on()` 等调用的字符串字面量,因此规则要把它们与事件映射对应起来;[.oxlintrc.json](../../../../.oxlintrc.json) 中的 `typescript/no-deprecated` 不覆盖这种情况。oxlint 不支持自定义的类型感知规则,因此该规则以发布的工具形式提供,插件作者在自己的构建中运行;仓库对 stable 的 Service Definition 包运行该规则。子路径导出隔离(`…/unstable` 入口)已否决,见 [Alternatives considered](#alternatives-considered)。
### 插件依赖声明
插件可以声明所需的 seam 版本,例如 `"dsh": { "requires": { "agent": "^1.0.0" } }`。seam 检查是附加的:`evaluatePluginCompatibility` 仍然检查 `engines.dsh` 或 DSH peer 范围,同时把列出的每个 seam 范围与当前 Host 的 API 报告中记录的 seam 版本比较。声明了 seam 范围的插件可以把 `engines.dsh` 放宽到它支持的所有运行时。插件市场索引条目和 registry 更新检查读取同一声明,使发现、安装和更新得出相同结论。按约定,插件还列出它使用的 unstable seam;Host 无法验证这份列表,插件管理页把它显示为风险。该声明不限制插件能导入或访问什么:Cordis 插件在 Host 进程内运行,可以导入任意包或访问 `ctx` 上的任意服务。
### 兼容层
为旧插件提供旧的 seam 主版本暂缓实现。当某个 stable seam 升级主版本、而外部插件仍依赖上一个主版本时,兼容层才有价值。届时 Host 只保留一份当前实现,由适配插件在其上提供旧的 Service Definition,并设定固定支持期限。
### 落地步骤
1. 仅规范:合入本 Agent Note 并确定弃用期。把根目录 `AGENTS.md`、[packages/README.md](../../../../packages/README.zh.md)、[packages/experimental/README.md](../../../../packages/experimental/README.zh.md)、[apps/cli/reference/README.md](../../../../apps/cli/reference/README.zh.md) 以及由 [gen-plugin-packages.ts](../../../../scripts/gen-plugin-packages.ts) 生成的包参考中的预稳定表述改为“未标记的 API 为 unstable”。不改代码。
2. 基线报告:生成并提交第一份 API 报告;CI 只检查报告是否最新。
3. 试点:晋升 `dsh-agent` 声明的 agent seam 成员:`ctx.agents`、`AgentHandle`、`Agent`、除已弃用的 `agent/request` 之外的 `agent/*` 事件,以及 `agent/pre-step` waterfall。它们引用的 session、scope 和 llm 包类型按上文加入承诺。Service Provider `dsh-agent-loop` 及其配置保持 unstable,因此试点不稳定任何配置。lint 工具和 `requires` 检查在这一阶段交付;同时更新 [package-manifest README](../../../../packages/util/package-manifest/README.zh.md) 和公开包 manifest 决策记录,说明已强制执行的检查。
4. 由各 seam 的维护者按需晋升更多成员和 seam;在文档站发布稳定 API 列表。
5. 满足上述条件时,为特定 seam 增加兼容适配插件。
### 待决问题
- `dsh.apis` 和 `dsh.requires` 成员的名称。
- DSH 1.0 之前按时间计算的弃用期长度。
- Python SDK 方法、SDK JSON-RPC 协议和 `cordis.yml` 配置字段是否纳入同一套级别,以及协议是否需要独立版本。
- 报告生成方式:API Extractor,还是基于 [scripts/verify-export-jsdoc.ts](../../../../scripts/verify-export-jsdoc.ts) 的导出遍历和 [scripts/jsdoc.ts](../../../../scripts/jsdoc.ts) 的标签解析生成的转储。
- lint 工具形式:基于同一导出遍历的独立发布检查器、非类型感知的近似实现,或上游 oxlint 规则。
## Alternatives considered
**不带版本的 `@stable` 标记。** 成本最低且可渐进,但插件无法说明自己基于哪个稳定 API 构建,Host 也无法检查,报告也无法区分新增成员和已有成员。保留为输入格式,并附上加入该成员的 seam 版本;列表由生成的报告提供。
**每次发布手工维护带版本的列表。** 插件作者有明确的参考,但为一千多个导出子路径和一百多个服务手工维护不现实,而且整个列表只有一个版本,任何 seam 的破坏性变更都会波及所有插件。保留为生成的报告,而不是手工维护的产物。
**整个平台一个 API 版本**(Android API level、VS Code `engines`)。对插件作者最简单,但 DSH 发布频繁,各 seam 独立演进;单一版本号要么随每次破坏性变更增长,要么抑制必要的破坏性变更。
**每个 npm 包独立 semver,取消锁步版本。** [npm 发布序列](../../implemented/process/2026-08-10-npm-release-sequences.zh.md)决策让所有 DSH 包使用同一版本,以保持发布和 peer 范围一致。包版本还会因不涉及任何插件所用 API 的内部重构而变化。seam 版本描述 API 兼容性,不改变包的发布方式。
**按包目录而不是 seam 分组。** `fs/` 等分组混合了独立演进的 Service Definition、provider 和工具。seam 本来就是架构使用的单位,维护成本最低。
**用子路径导出隔离 unstable API。** 让导入路径本身成为 opt-in,比 lint 告警更明确,但需要重组每个包的导出,并一次性破坏所有现有消费方,与渐进推进相矛盾。
**一开始就提供兼容层。** 每保留一个旧版本,都需要单独的转换代码和测试。在任何 seam 稳定、且外部插件依赖旧主版本之前,这项成本没有收益。
**按发布次数计算弃用期。** DSH 发布频率不固定,按次数计算给插件作者的时间不可预测。从首次记录弃用的发布开始按时间计算,结果可预测,并且可以从归档的报告中算出。
## Acceptance criteria
- 根目录 `AGENTS.md` 和落地步骤 1 列出的包文档写明未标记的 API 为 unstable,且弃用期已确定。
- 已提交的 API 报告覆盖导出、服务和事件;报告过期时 CI 失败。
- agent seam 的试点成员带有 `@stable [email protected]`;CI 拒绝对它们或它们引用的类型的不兼容修改,并在涉及它们的 PR 中发布 stable API 变更摘要。
- lint 工具报告插件对 unstable 成员的使用,包括传给 `ctx.on()` 的 unstable 事件名。
- 声明了 `requires` 的插件在安装、更新和市场发现中按 seam 范围被接受或拒绝;未声明的插件行为与现在相同。
## Risks
- 其他 seam 中被引用的类型会加入引用方 seam 的承诺;晋升 agent seam 因而会在 session、scope 和 llm 等 seam 晋升之前冻结其部分类型。
- 行为变化依赖作者声明,评审可能遗漏。
- seam 版本与锁步包版本是两套编号,插件作者可能混淆。
- 晋升 agent seam 会约束仍在频繁变化的 loop 核心部分;晋升以这部分灵活性换取插件稳定性。
- lint 工具是新的发布工具,项目需要与 oxlint 配置一起维护。
- manifest 声明无法阻止插件使用未声明的 API;它只为检查和用户提供信息,不是强制手段。
@@ -39,10 +39,10 @@ If an existing record is damaged or its keychain/certificate is missing, setup s
## Configure the source build
Resolve the DSH home used by the developer (`DSH_HOME`, otherwise `~/.dsh`). Merge the two printed values into its `cordis.patch.yml`, targeting the entry that loads `@deepseek-ai/dsh-experimental-cua-macos`. The shipped entry ID is `cua`:
Resolve the DSH home used by the developer (`DSH_HOME`, otherwise `~/.dsh`). Merge the two printed values into its `cordis.patch.yml`, targeting the entry that loads `@deepseek-ai/dsh-cua-macos`. The shipped entry ID is `cua-macos`:
```yaml
- id: cua
- id: cua-macos
config:
sourceSigning:
identity: "<fingerprint printed by setup>"
@@ -34,6 +34,48 @@ For each failure, define handling and reporting owners, containment, and guarant
Catching limits exception propagation, not mutations. Only the affected state's owner can establish safe continuation. Otherwise stop dependent work, discard invalid state or instances, or escalate. Logging alone is not recovery. Retries require safe repetition, cancellation, and an explicit owner; finite operations need budgets, while continuing supervision needs lifecycle ownership and observable degradation.
### Empty catch clauses
An empty `catch` has no statement other than `;` in its block, and it discards every failure its `try` raises. Use one only when every such failure leaves the owner's state valid and no caller could act on it, such as failing to remove a temporary file that nothing reads. A `catch` that logs, reports, rethrows, or returns a fallback is not empty, and the rules below do not apply to it. [`verify-empty-catch`](../../../scripts/verify-empty-catch.ts) checks every `try`/`catch` statement in first-party JavaScript and TypeScript, including tests; it does not check `promise.catch()` callbacks. The checker checks the form; review checks that the name and the reason are true.
**The `try` holds one statement.** One statement means one syntactic statement, such as one call or one assignment, however many lines it spans; it does not mean one line. With several statements, the reason covers one expected failure while the clause also discards the others, including defects such as a `TypeError`, and a failure in an early statement skips the later ones while the caller sees success:
```ts
// Rejected: three statements in one try.
try {
await unlink(tempFile)
registry.delete(id)
emit('removed', id)
} catch (_cleanupFailed) {
// A leftover temporary file holds no state anything reads.
}
// Accepted: only the unlink failure is discarded.
try {
await unlink(tempFile)
} catch (_cleanupFailed) {
// A leftover temporary file holds no state anything reads.
}
registry.delete(id)
emit('removed', id)
```
When several statements each tolerate a failure, give each its own `try` and reason. The checker counts one block or one compound statement, such as one `if`, as one statement; review rejects such a `try` when it contains several operations.
**The binding names the expected failure.** Write `catch (_cleanupFailed)`, not `catch {}` or `catch (_)`. Lint requires an unused binding to start with `_`, and a bare `_` names nothing.
**A comment states why discarding the failure is safe.** Put it in the `catch` block or after the clause's closing `}` on the same line. A comment inside the `try` block or above `try` does not count. `// ignore` and `// expected` restate the empty block; say which failure is expected and why the state stays valid.
**Accept only some failures by testing them.** When only some failures are safe, such as a missing file while a permission error must still surface, write a non-empty `catch` that tests `code` or `name` and rethrows the rest; the checker does not check such a clause.
```ts
try {
await unlink(tempFile)
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
}
```
## Localized, actionable, visible reports
Every final report needs a readable summary, affected operation, and safe next action. Localize through the receiving application's locale mechanism where one exists; other diagnostics use their existing output language. Keep sensitive internal details out of user-facing text.
+2 -2
View File
@@ -15,8 +15,8 @@
en: 2374f332d040ece2
zh: 7f914fb83cfb5caa
/pr-preview-runner-sizing/publication-semantics:
en: 25ee2f4b26ef7770
zh: 788b7fb4bee6e159
en: 0d86702bcbbe23f4
zh: cd0041c917ac8c55
/pr-preview-runner-sizing/dev-note:
en: c3e8959997c4d5d0
zh: 109a391915c2bdfb
+1 -1
View File
@@ -26,7 +26,7 @@ A build-only benchmark does not deploy, access Cloudflare credentials, or post p
## Publication semantics
Runner selection does not alter pull-request events, per-PR cancellation, immutable installation, restore-only dependency caching, full workspace build, preview packing, sourcemap removal, or the preview page copied to the deployment root. Cloudflare uploads only the built site to the PR branch alias. The protected-image check requires HTTP 200, no transport content encoding, and gzip magic bytes; the URL comment remains idempotent. Dependabot and other PR authors remain on GitHub-hosted machines.
Runner selection does not alter pull-request events, per-PR cancellation, immutable installation, restore-only dependency caching, full workspace build, preview packing, sourcemap removal, or the preview page copied to the deployment root. Cloudflare uploads only the built site and the snapshot diff page to the PR branch alias; that page embeds committed `snapshots/` diff text, never package sources. The protected-image check requires HTTP 200, no transport content encoding, and gzip magic bytes; the URL comment remains idempotent. Dependabot and other PR authors remain on GitHub-hosted machines.
<a id="dev-note"></a>
+1 -1
View File
@@ -26,7 +26,7 @@
## 发布语义
运行器选择不改变 PR 事件、按 PR 取消、不可变安装、只恢复的依赖缓存、完整工作区构建、预览打包、sourcemap 删除,以及复制到部署根目录的预览页面。Cloudflare 仅将构建站点上传至 PR 分支别名。受保护镜像检查要求 HTTP 200、无传输内容编码及 gzip 魔数字节;URL 评论保持幂等。Dependabot 与其他 PR 作者仍使用 GitHub 托管机器。
运行器选择不改变 PR 事件、按 PR 取消、不可变安装、只恢复的依赖缓存、完整工作区构建、预览打包、sourcemap 删除,以及复制到部署根目录的预览页面。Cloudflare 仅将构建站点和 snapshot diff 页面上传至 PR 分支别名;该页面嵌入已提交的 `snapshots/` diff 文本,不含包源码。受保护镜像检查要求 HTTP 200、无传输内容编码及 gzip 魔数字节;URL 评论保持幂等。Dependabot 与其他 PR 作者仍使用 GitHub 托管机器。
<a id="dev-note"></a>
+40 -16
View File
@@ -2,7 +2,8 @@ name: Build PR preview
# Every push to a pull request publishes that pull request's preview to
# Cloudflare Pages under its own branch alias, behind Cloudflare Access. The
# upload carries build products only: the workflow never grants the deployment
# upload carries build products plus the snapshot diff page, which embeds
# committed `snapshots/` diff text: the workflow never grants the deployment
# platform access to this repository's sources. This lane also owns the
# aggregate test and script type checks that the required Linux consumers no
# longer repeat on every pull request.
@@ -43,9 +44,12 @@ jobs:
|| 'ubuntu-24.04' }}
name: cloudflare pages preview
steps:
# The pull_request checkout is the merge commit; depth 2 brings its first
# parent, the base branch tip, for the snapshot diff page.
- uses: actions/[email protected]
with:
persist-credentials: false
fetch-depth: 2
- uses: pnpm/[email protected]
with:
@@ -98,6 +102,18 @@ jobs:
find apps/web/dist -name '*.map' -delete
cp apps/web/dist/preview.html apps/web/dist/index.html
# Reviewers read snapshot changes at /snapshot-diff/, which opens on the
# SDK blank-Session catalog (system prompt and tool schemas); the source
# chooser links to it. The page serves review only, so a failure warns
# like publication instead of failing the build.
- name: Render the snapshot diff page
id: snapshot-diff
continue-on-error: true
run: >-
pnpm exec tsx scripts/snapshot-diff-page.ts --base HEAD^1 --head HEAD
--out apps/web/dist/snapshot-diff
--preview-manifest apps/web/dist/preview/fixtures.json
- name: Upload to Cloudflare Pages
id: upload
continue-on-error: true
@@ -164,33 +180,41 @@ jobs:
# The alias URL follows from the pull request number, so it is stable
# across redeploys and worth stating once. The marker makes the comment
# idempotent: a pull request opened before this workflow existed never
# sees an `opened` event, and every later push must not restate the URL.
# sees an `opened` event, and every later push must not restate the URL;
# an existing comment with older text is edited in place.
- name: Comment the preview URL
id: comment
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.number }}
SNAPSHOT_DIFF: ${{ steps.snapshot-diff.outcome }}
run: |
marker='<!-- dsh-preview-url -->'
existing=$(gh pr view "$PR" --json comments \
--jq "[.comments[] | select(.body | contains(\"$marker\")) | .url] | first // empty")
if [ -n "$existing" ]; then
echo "preview URL already commented: $existing"
exit 0
fi
url="https://pr-$PR.${CF_PROJECT}.pages.dev"
links="[Preview for #$PR]($url)"
if [ "$SNAPSHOT_DIFF" = success ]; then links="$links · [snapshot changes]($url/snapshot-diff/)"; fi
# The marker sits on its own line: markdown renders no link on a
# line that opens with a raw HTML comment.
printf '%s\n\n%s\n' \
"$marker" \
"[Preview for #$PR](https://pr-$PR.${CF_PROJECT}.pages.dev) (requires Cloudflare Access sign-in)" \
| gh pr comment "$PR" --body-file -
body=$(printf '%s\n\n%s\n' "$marker" "$links (requires Cloudflare Access sign-in)")
existing=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" --paginate \
--jq "[.[] | select(.user.login == \"github-actions[bot]\" and (.body | contains(\"$marker\")))] | first // empty | [.id, .body] | @json")
if [ -z "$existing" ]; then
printf '%s' "$body" | gh pr comment "$PR" --body-file -
elif [ "$(jq -r '.[1]' <<< "$existing")" != "$body" ]; then
gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$(jq -r '.[0]' <<< "$existing")" -f body="$body" > /dev/null
else
echo "preview URL already commented"
fi
# Publishing stays outside the required verdict: a Cloudflare, Access, or
# comment failure warns, while a build failure still fails this check.
# Publishing stays outside the required verdict: a snapshot diff page,
# Cloudflare, Access, or comment failure warns, while a build failure
# still fails this check.
- name: Report preview publication failures
if: steps.upload.outcome == 'failure' || steps.verify.outcome == 'failure' || steps.comment.outcome == 'failure'
if: >-
steps.snapshot-diff.outcome == 'failure' || steps.upload.outcome == 'failure'
|| steps.verify.outcome == 'failure' || steps.comment.outcome == 'failure'
run: |
message='preview publication failed; the build passed, see the upload, verify, and comment steps'
message='preview publication failed; the build passed, see the snapshot diff, upload, verify, and comment steps'
echo "::warning::$message"
echo "$message" >> "$GITHUB_STEP_SUMMARY"
@@ -1,4 +1,4 @@
name: Package CUA helper · macOS
name: Package CUA helper · macOS · arm64 + x64
on:
workflow_dispatch:
@@ -14,7 +14,7 @@ on:
reuse:
type: boolean
default: false
cua_run_id:
cua_macos_run_id:
type: string
default: ''
preset:
@@ -75,7 +75,7 @@ jobs:
id: retained
env:
GH_TOKEN: ${{ github.token }}
CUA_RUN_ID: ${{ inputs.cua_run_id }}
CUA_MACOS_RUN_ID: ${{ inputs.cua_macos_run_id }}
CUA_BUILD_KEY: ${{ steps.build-inputs.outputs.build-key }}
run: node scripts/cua-helper/select-artifact.ts
- uses: pnpm/[email protected]
@@ -96,7 +96,7 @@ jobs:
if: steps.retained.outputs.artifact-id == ''
id: upload
with:
name: cua-helper-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.build-inputs.outputs.build-key }}
name: cua-helper-macos-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.build-inputs.outputs.build-key }}
path: dist/cua-helper/*
if-no-files-found: error
compression-level: 0
@@ -100,7 +100,7 @@ jobs:
- uses: actions/[email protected]
id: upload
with:
name: cua-helper-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.metadata.outputs.build-key }}
name: cua-helper-windows-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.metadata.outputs.build-key }}
path: dist/cua-helper-win-x64.zip
if-no-files-found: error
compression-level: 0
+16 -16
View File
@@ -8,8 +8,8 @@ name: Release publish (dsh)
on:
workflow_dispatch:
inputs:
cua_run_id:
description: 'CUA helper run ID,留空复用源码逐字节一致的产物,无匹配则构建'
cua_macos_run_id:
description: 'macOS CUA helper run ID,留空复用源码逐字节一致的产物,无匹配则构建'
type: string
required: false
default: ''
@@ -28,17 +28,17 @@ env:
DSH_TELEMETRY_DISABLED: '1'
jobs:
cua-helper:
cua-helper-macos:
if: startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check
uses: ./.github/workflows/cua-helper-package.yml
uses: ./.github/workflows/cua-helper-package-macos.yml
with:
reuse: true
preset: production
cua_run_id: ${{ inputs.cua_run_id }}
cua_macos_run_id: ${{ inputs.cua_macos_run_id }}
pack:
name: Pack npm tarballs
needs: cua-helper
needs: cua-helper-macos
runs-on: ubuntu-24.04
permissions:
contents: read
@@ -81,34 +81,34 @@ jobs:
RELEASE_PUBLISH: 'true'
run: pnpm run release:verify --family dsh ${{ inputs.skip-tag-check && '--skip-tag-check' || '' }}
- name: Download selected CUA helper
- name: Download selected macOS CUA helper
uses: actions/[email protected]
with:
artifact-ids: ${{ needs.cua-helper.outputs.artifact-id }}
run-id: ${{ needs.cua-helper.outputs.run-id }}
artifact-ids: ${{ needs.cua-helper-macos.outputs.artifact-id }}
run-id: ${{ needs.cua-helper-macos.outputs.run-id }}
github-token: ${{ github.token }}
path: dist/cua-helper
- name: Build
run: pnpm run build:official --serial
- name: Stage verified native helper applications
- name: Stage verified macOS helper applications
env:
CUA_EXPECTED_BUILD_KEY: ${{ needs.cua-helper.outputs.build-key }}
CUA_EXPECTED_BUILD_KEY: ${{ needs.cua-helper-macos.outputs.build-key }}
run: |
mkdir dist/cua-helper/extracted
tar -xzf dist/cua-helper/cua-helper.tgz -C dist/cua-helper/extracted
pnpm exec tsx scripts/cua-helper/stage.ts --from dist/cua-helper/extracted
- name: Record CUA source and publication retry instructions
- name: Record macOS CUA source and publication retry instructions
env:
CUA_RUN_ID: ${{ needs.cua-helper.outputs.run-id }}
CUA_ARTIFACT_ID: ${{ needs.cua-helper.outputs.artifact-id }}
CUA_MACOS_RUN_ID: ${{ needs.cua-helper-macos.outputs.run-id }}
CUA_ARTIFACT_ID: ${{ needs.cua-helper-macos.outputs.artifact-id }}
run: |
{
printf '采用 CUA helper 构建 run ID `%s`,artifact ID `%s`。\n\n' "$CUA_RUN_ID" "$CUA_ARTIFACT_ID"
printf '采用 macOS CUA helper 构建 run ID `%s`,artifact ID `%s`。\n\n' "$CUA_MACOS_RUN_ID" "$CUA_ARTIFACT_ID"
printf '%s\n\n' 'npm 部分发布失败时,只重跑 Publish to npm job,复用原 dsh-npm-tarballs;不要重跑全部 job。'
printf '需要重新打包时,可留空自动查找,或填写 `cua_run_id=%s` 指定该 helper;源码和构建配置必须匹配。\n' "$CUA_RUN_ID"
printf '需要重新打包时,可留空自动查找,或填写 `cua_macos_run_id=%s` 指定该 helper;源码和构建配置必须匹配。\n' "$CUA_MACOS_RUN_ID"
} >> "$GITHUB_STEP_SUMMARY"
- name: Pack release tarballs
+1 -1
View File
@@ -149,7 +149,7 @@ Real-API tests/demos read `DEEPSEEK_API_KEY`, optional `DEEPSEEK_BASE_URL`, and
- **Source plane vs artifact plane, never mixed.** Static gates and tests resolve workspace imports through tsconfig `paths` to `src` and pass on a clean tree; gates consuming built `lib/` declare that dependency ([layout](docs/development.md#typescript-project-layout)).
- **Keep compiler faces explicit.** A package with both Host and Client programs exposes face-specific leaf configs and a solution-only root; repo-wide programs seed a face config, never the root solution ([layout](docs/development.md#typescript-project-layout)).
- **Error handling:** use typed, structured failures and localized, actionable reports. Coded errors and expected tool failures use `HarnessError`. Define handling ownership, containment, and failure guarantees; stop dependent work and visibly report untrusted state or unknown outcomes. Follow [dsh-error-handling](.agents/skills/dsh-error-handling/SKILL.md).
- **An empty `catch` names the error** and why; keep its `try` to one statement.
- **An empty `catch` names the error** and why; keep its `try` to one statement ([checker](scripts/verify-empty-catch.ts)).
- **Keep comments local.** Do not restate code, expand unrelated comments, or explain distant behavior without local need ([rationale](.agents/skills/dsh-prose-standard/SKILL.md)).
- **Ban `prove` + `nance`** ([rule](.agents/notes/implemented/process/2026-08-26-ban-ambiguous-origin-label.md)).
- **Prefer symmetry for parallel values**; unexplained asymmetry usually signals a missed extraction.
+1
View File
@@ -121,6 +121,7 @@
"@deepseek-ai/dsh-experimental-forge-bundle": "workspace:*"
},
"devDependencies": {
"@deepseek-ai/dsh-brand": "workspace:*",
"@deepseek-ai/dsh-skill-badge": "workspace:*",
"@deepseek-ai/dsh-webhook-github": "workspace:*",
"@deepseek-ai/dsh-webhook": "workspace:*",
+5 -4
View File
@@ -1,9 +1,10 @@
import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit'
import { fileURLToPath } from 'node:url'
import { agentEvents, type Agent } from '@deepseek-ai/dsh-agent'
import { ToolCallId } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { ToolCallId } from '@deepseek-ai/dsh-llm'
import { boot, loadOverlayPatches } from '@deepseek-ai/dsh-app-boot'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-skill'
import type {} from '@deepseek-ai/dsh-tools'
import { unsupportedModel, unsupportedInbox } from '@deepseek-ai/dsh-agent-loop-testkit'
@@ -25,7 +26,7 @@ const ctx = await boot('dsh-badge-snapshot', rootConfigPath, [
])
try {
const agentId = SessionId('dsh-badge-snapshot')
const agentId = brandString<SessionId>('dsh-badge-snapshot')
const session = ctx.sessions.create(agentId, { meta: { cwd: process.cwd() } })
const agent: Agent = {
ctx,
@@ -54,7 +55,7 @@ try {
: undefined
const summary = (await ctx.skills.list()).find(skill => skill.name === 'dsh-badge')
const result = await executeToolFixture(ctx, {
callId: ToolCallId('dsh-badge-snapshot'),
callId: brandString<ToolCallId>('dsh-badge-snapshot'),
name: 'skill',
arguments: { name: 'dsh-badge' },
signal: new AbortController().signal,
@@ -1,5 +1,5 @@
import z from '@deepseek-ai/schemastery'
import { WebhookRuleId } from '@deepseek-ai/dsh-webhook'
import { brandString } from '@deepseek-ai/dsh-brand'
export const name = 'github-webhook-real-e2e-rule'
export const inject = ['webhookRuntime']
@@ -14,8 +14,10 @@ export const Config = z.object({
})
export function apply(ctx, config) {
/** @type {import('@deepseek-ai/dsh-webhook/types').WebhookRuleId} */
const id = brandString('github-real-e2e')
ctx.effect(() => ctx.webhookRuntime.register({
id: WebhookRuleId('github-real-e2e'),
id,
kind: 'github',
run(delivery, signal) {
+3 -2
View File
@@ -6,7 +6,8 @@ import type {} from '@deepseek-ai/cordis-plugin-loader'
import type {} from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-cmdline'
import { createUserMessage } from '@deepseek-ai/dsh-llm'
import { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'
import type { SessionId, SessionEvent } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
/** Observations from one isolated Agent's run through the shipped headless profile. */
export interface SourceToolEvidence {
@@ -37,7 +38,7 @@ export function apply(ctx: Context, config: { cwd: string }): void {
const run = async (): Promise<void> => {
const handle = await ctx.agents.create({
sessionId: SessionId(randomUUID()),
sessionId: brandString<SessionId>(randomUUID()),
meta: { cwd: config.cwd },
agentOptions: { provider: 'cli-mock', model: 'cli-mock' },
})
@@ -10,9 +10,10 @@ import { fileURLToPath } from 'node:url'
import type { Context } from '@deepseek-ai/cordis'
import type { Agent, AgentHandle } from '@deepseek-ai/dsh-agent'
import type { ProfileContext } from '@deepseek-ai/dsh-app-boot'
import { LlmAdapter, ToolCallId, createUserMessage } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { LlmAdapter, type ToolCallId, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions, LlmResolvedModelInfo, StreamChunk } from '@deepseek-ai/dsh-llm'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import type {} from '@deepseek-ai/dsh-hmr'
import type {} from '@deepseek-ai/dsh-plugin-manager'
@@ -140,7 +141,7 @@ describe.skipIf(!existsSync(join(root, 'apps/cli/lib/bin.js')))('Official option
async function agent(preset = 'standard', cwd = workspace): Promise<AgentHandle> {
const handle = await ctx.agents.create({
sessionId: SessionId(`optional-${preset}-${randomUUID()}`), meta: { cwd, agentPreset: preset },
sessionId: brandString<SessionId>(`optional-${preset}-${randomUUID()}`), meta: { cwd, agentPreset: preset },
agentOptions: { provider: 'bundle-test', model: 'scripted' },
setup: scoped => ctx.agentPresets.mount(scoped, preset).then(() => undefined),
})
@@ -234,7 +235,7 @@ describe.skipIf(!existsSync(join(root, 'apps/cli/lib/bin.js')))('Official option
it('loads the actual badge asset only while its bundle is selected', async () => {
const owner = await agent()
const load = (callId: string) => executeToolFixture(ctx, {
callId: ToolCallId(callId), name: 'skill', arguments: { name: 'dsh-badge' },
callId: brandString<ToolCallId>(callId), name: 'skill', arguments: { name: 'dsh-badge' },
agent: owner.agent, signal: new AbortController().signal,
})
expect((await load('badge-before')).isError).toBe(true)
@@ -1,10 +1,11 @@
/** Keyless two-model adapter for the generic ACP control-surface conformance test. */
import type { Context } from '@deepseek-ai/cordis'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
ToolCallId,
type ToolCallId,
LlmAdapter,
ReasoningEffortId,
type ReasoningEffortId,
type GenerateOptions,
type LlmResolvedModelInfo,
type StreamChunk,
@@ -34,10 +35,10 @@ class ControlSurfaceAdapter extends LlmAdapter {
context: { contextWindow: 2_048 },
reasoning: {
efforts: [
{ id: ReasoningEffortId('low'), name: 'Low' },
{ id: ReasoningEffortId('high'), name: 'High' },
{ id: brandString<ReasoningEffortId>('low'), name: 'Low' },
{ id: brandString<ReasoningEffortId>('high'), name: 'High' },
],
defaultEffort: ReasoningEffortId('high'),
defaultEffort: brandString<ReasoningEffortId>('high'),
},
})
}
@@ -50,7 +51,7 @@ class ControlSurfaceAdapter extends LlmAdapter {
.join('')
const hasToolResult = current.some(message => message.role === 'tool')
if (!hasToolResult) {
const callId = ToolCallId(userText.includes('cancel') ? 'control-cancel-add' : 'control-add')
const callId = brandString<ToolCallId>(userText.includes('cancel') ? 'control-cancel-add' : 'control-add')
yield { type: 'block-start', index: 0, blockType: 'reasoning' }
yield { type: 'reasoning-delta', index: 0, text: 'checking the attached tool' }
yield { type: 'block-end', index: 0, block: { type: 'reasoning', text: 'checking the attached tool' } }
@@ -6,7 +6,8 @@ import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from '@deepseek-ai/cordis'
import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.ts'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
/**
* The swebench-style smoke test: a real model fixes a real bug in a temp
@@ -55,7 +56,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('coding task: fix a failing test
expect(before.status).not.toBe(0)
ctx = await codingHarness(workdir, { personaPrefix: SYSTEM_PROMPT })
const agent = await ctx.agentLoop.create(SessionId('e2e-task'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
const agent = await ctx.agentLoop.create(brandString<SessionId>('e2e-task'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
agent.followup(createUserMessage({
content: [{
@@ -5,7 +5,8 @@ import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from '@deepseek-ai/cordis'
import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.ts'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
/**
* Key-gated smoke for mid-session compaction. It verifies the compact event
@@ -49,7 +50,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('compaction: a long session compa
},
persistenceRoot: join(workdir, '.sessions'),
})
const agent = await ctx.agentLoop.create(SessionId('e2e-compaction'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
const agent = await ctx.agentLoop.create(brandString<SessionId>('e2e-compaction'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
// Completed read turns cannot collapse into one retained parallel tool group.
for (let i = 1; i <= 4; i++) {
@@ -1,6 +1,7 @@
/** Deterministic keyless Agent Teams adapter shared by profile snapshot and CLI e2e. */
import { ToolCallId, LlmAdapter } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { LlmAdapter } from '@deepseek-ai/dsh-llm'
let nextCall = 0
@@ -42,7 +43,8 @@ function latestToolText(messages) {
function toolChunks(specs) {
const chunks = []
for (const [index, spec] of specs.entries()) {
const id = ToolCallId(`team-fixture-${++nextCall}`)
/** @type {import('@deepseek-ai/dsh-llm/types').ToolCallId} */
const id = brandString(`team-fixture-${++nextCall}`)
const args = JSON.stringify(spec.args)
chunks.push(
{ type: 'block-start', index, blockType: 'tool-call' },
@@ -5,7 +5,8 @@ import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from '@deepseek-ai/cordis'
import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.ts'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
/**
* The first place a REAL model meets the REAL bash tool: the cheap canary
@@ -29,7 +30,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('full loop: real model + real bas
it('runs a bash command on request and reports its output', async () => {
workdir = await mkdtemp(join(tmpdir(), 'dsh-full-loop-e2e-'))
ctx = await codingHarness(workdir, { personaPrefix: SYSTEM_PROMPT })
const agent = await ctx.agentLoop.create(SessionId('e2e-loop'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
const agent = await ctx.agentLoop.create(brandString<SessionId>('e2e-loop'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
agent.followup(createUserMessage({ content: [{ type: 'text', text: 'Run `echo e2e-ok` with the bash tool and tell me its exact output.' }], source: { kind: 'user' } }))
await waitForIdle(ctx, agent)
@@ -4,8 +4,9 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest'
import { Context } from '@deepseek-ai/cordis'
import { createUserMessage, ToolCallId, HarnessError } from '@deepseek-ai/dsh-llm'
import SessionStore, { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { createUserMessage, type ToolCallId, HarnessError } from '@deepseek-ai/dsh-llm'
import SessionStore, { type SessionId } from '@deepseek-ai/dsh-session'
import type { SessionEvent } from '@deepseek-ai/dsh-session'
import { RUN_CODE_NAME, defineTool } from '@deepseek-ai/dsh-tools'
import type { ToolExecutionResult } from '@deepseek-ai/dsh-tools'
@@ -98,7 +99,7 @@ function runCode(
agent?: Agent,
): Promise<ToolExecutionResult> {
return executeModelToolFixture(harness, {
callId: ToolCallId(`keyless-code-${++keylessCall}`),
callId: brandString<ToolCallId>(`keyless-code-${++keylessCall}`),
name: RUN_CODE_NAME,
arguments: { code, description: 'Run the e2e program' },
signal,
@@ -299,8 +300,8 @@ describe('PTC mode typed values: keyless real-process contracts', () => {
await ctx.plugin(ToolCordis)
const agent = {
ctx,
id: SessionId('ptc-cordis'),
session: ctx.sessions.create(SessionId('ptc-cordis'), { meta: { cwd: process.cwd() } }),
id: brandString<SessionId>('ptc-cordis'),
session: ctx.sessions.create(brandString<SessionId>('ptc-cordis'), { meta: { cwd: process.cwd() } }),
} as Agent
const value = completion(await runCode(ctx, `
@@ -331,7 +332,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('PTC mode: real model writes a pr
it('collapses the wire tool list to [run_code], bridges sub-calls, and returns curated output', async () => {
workdir = await mkdtemp(join(tmpdir(), 'dsh-ptc-e2e-'))
ctx = await ptcModeHarness(workdir)
const agent = await ctx.agentLoop.create(SessionId('e2e-ptc'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
const agent = await ctx.agentLoop.create(brandString<SessionId>('e2e-ptc'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
agent.followup(createUserMessage({
content: [{
@@ -381,7 +382,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('PTC mode: real model writes a pr
await writeFile(join(workdir, 'pkg/deep/task.txt'), 'Touch this file to discover the nested instructions.\n')
ctx = await workspacePtcModeHarness()
const handle = await ctx.agents.create({
sessionId: SessionId('e2e-ptc-workspace-session'),
sessionId: brandString<SessionId>('e2e-ptc-workspace-session'),
meta: { cwd: workdir },
agentOptions: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
})
@@ -4,8 +4,9 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from '@deepseek-ai/cordis'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
/**
* Proves durable conversation continuity end-to-end: run 1 tells the REAL model
@@ -16,7 +17,7 @@ import { codingHarness, finalText, SYSTEM_PROMPT, waitForIdle } from './harness.
*/
const SECRET = 'plum-galaxy-1791'
const SESSION_ID = SessionId('resume-e2e-session')
const SESSION_ID = brandString<SessionId>('resume-e2e-session')
let ctx: Context | undefined
let root: string | undefined
@@ -9,8 +9,9 @@ import {
type NormalizeContext,
} from '@deepseek-ai/dsh-session-snapshot'
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
import { createUserMessage, ToolCallId, createMessage } from '@deepseek-ai/dsh-llm'
import { SessionSeq, SESSION_FORMAT_VERSION, SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { createUserMessage, type ToolCallId, createMessage } from '@deepseek-ai/dsh-llm'
import { SessionSeq, SESSION_FORMAT_VERSION, type SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import * as JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl'
import { logPath } from '../../../../../../packages/session/session-persistence-jsonl/src/format.ts'
import { describe, expect, it } from 'vitest'
@@ -22,7 +23,7 @@ const sessionExpected = join(fixtureDir, 'session.expected.jsonl')
const configPath = fileURLToPath(new URL('../semantic-checkpoint-snapshot.patch.yml', import.meta.url))
const binScript = fileURLToPath(new URL('../../../../../../packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', import.meta.url))
const tsconfigPath = fileURLToPath(new URL('../../../../../../tsconfig.json', import.meta.url))
const sessionId = SessionId('semantic-checkpoint-unknown-outcome')
const sessionId = brandString<SessionId>('semantic-checkpoint-unknown-outcome')
const refreshing = process.env.DSH_SNAPSHOT === 'refresh'
const task = 'Continue safely from the interrupted operation.'
@@ -68,7 +69,7 @@ async function seedInterruptedSession(root: string, cwd: string): Promise<string
stream: [],
message: createMessage({
role: 'assistant',
content: [{ type: 'tool-call', id: ToolCallId('unknown-outcome-call'), name: 'write_remote', arguments: '{"value":1}' }],
content: [{ type: 'tool-call', id: brandString<ToolCallId>('unknown-outcome-call'), name: 'write_remote', arguments: '{"value":1}' }],
source: {
kind: 'model',
...{ provider: 'deepseek-official', model: 'deepseek-v4-flash' },
@@ -84,7 +85,7 @@ async function seedInterruptedSession(root: string, cwd: string): Promise<string
data: {
turn: 1,
step: 1,
callId: ToolCallId('unknown-outcome-call'),
callId: brandString<ToolCallId>('unknown-outcome-call'),
name: 'write_remote',
arguments: '{"value":1}',
},
@@ -12,7 +12,7 @@ import { Context } from '@deepseek-ai/cordis'
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
import {
SESSION_FORMAT_VERSION,
SessionId,
type SessionId,
SessionSeq,
type SessionEvent,
type SessionHeader,
@@ -24,6 +24,7 @@ import {
logPath,
} from '../../../../../../packages/session/session-persistence-jsonl/src/format.ts'
import { describe, expect, it } from 'vitest'
import { brandString } from '@deepseek-ai/dsh-brand'
const fixtureDir = join(dirname(fileURLToPath(import.meta.url)), 'expected/workspace-context-resume/offline-edit')
const replayFixture = join(fixtureDir, 'replay.jsonl')
@@ -31,7 +32,7 @@ const configPath = fileURLToPath(new URL('../workspace-context-resume-snapshot.p
const binScript = fileURLToPath(new URL('../../../../../../packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', import.meta.url))
const tsconfigPath = fileURLToPath(new URL('../../../../../../tsconfig.json', import.meta.url))
// The resumed-agent fixture in the shared config resumes exactly this id.
const sessionId = SessionId('workspace-context-resume')
const sessionId = brandString<SessionId>('workspace-context-resume')
const fixtureEnv = {
DSH_SNAPSHOT_FILE: replayFixture,
DSH_LOADER_SMOKE_REQUIRED_ENTRY_ID: 'resumed-agent',
@@ -15,9 +15,10 @@ import {
} from '@deepseek-ai/dsh-session-snapshot'
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SessionSeq, SESSION_FORMAT_VERSION, SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import { SessionSeq, SESSION_FORMAT_VERSION, type SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import * as JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl'
import { describe, expect, it } from 'vitest'
import { brandString } from '@deepseek-ai/dsh-brand'
const fixtureDir = fileURLToPath(new URL('./expected/subagent-diagnostic', import.meta.url))
const replayOverride = join(fixtureDir, 'replay.override.json')
@@ -25,8 +26,8 @@ const parentExpected = join(fixtureDir, 'parent.expected.jsonl')
const configPath = fileURLToPath(new URL('../subagent-diagnostic-snapshot.patch.yml', import.meta.url))
const binScript = fileURLToPath(new URL('../../../../../../packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', import.meta.url))
const tsconfigPath = fileURLToPath(new URL('../../../../../../tsconfig.json', import.meta.url))
const parentId = SessionId('subagent-diagnostic-parent')
const childId = SessionId('subagent-diagnostic-child')
const parentId = brandString<SessionId>('subagent-diagnostic-parent')
const childId = brandString<SessionId>('subagent-diagnostic-child')
const refreshing = process.env.DSH_SNAPSHOT === 'refresh'
const task = 'Call list_agents once and report what it shows.'
@@ -15,8 +15,9 @@ import {
type NormalizeContext,
} from '@deepseek-ai/dsh-session-snapshot'
import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-loader-smoke'
import { createMessage, createUserMessage, ReasoningEffortId } from '@deepseek-ai/dsh-llm'
import { SessionSeq, SESSION_FORMAT_VERSION, SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { createMessage, createUserMessage, type ReasoningEffortId } from '@deepseek-ai/dsh-llm'
import { SessionSeq, SESSION_FORMAT_VERSION, type SessionId, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session'
import * as JsonlSessionPersistence from '@deepseek-ai/dsh-session-persistence-jsonl'
import { describe, expect, it } from 'vitest'
@@ -30,7 +31,7 @@ const childExpected = join(fixtureDir, 'child.expected.jsonl')
const configPath = fileURLToPath(new URL('../subagent-inheritance-snapshot.patch.yml', import.meta.url))
const binScript = fileURLToPath(new URL('../../../../../../packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', import.meta.url))
const tsconfigPath = fileURLToPath(new URL('../../../../../../tsconfig.json', import.meta.url))
const sessionId = SessionId('subagent-inheritance-parent')
const sessionId = brandString<SessionId>('subagent-inheritance-parent')
const refreshing = process.env.DSH_SNAPSHOT === 'refresh'
const task = 'Delegate the write probe to a subagent.'
@@ -75,7 +76,7 @@ async function seedReadOnlyParent(root: string, cwd: string): Promise<void> {
config: {
provider: 'deepseek-official',
model: 'deepseek-v4-flash',
reasoningEffort: ReasoningEffortId('low'),
reasoningEffort: brandString<ReasoningEffortId>('low'),
},
},
reason: 'initial',
@@ -5,7 +5,8 @@ import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from '@deepseek-ai/cordis'
import { codingHarness, TODO_SYSTEM_PROMPT, waitForIdle } from './harness.ts'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
/**
* A REAL model drives the REAL todo_write tool: verify the WORLD (the session
@@ -27,7 +28,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('todo_write: real model records a
it('appends a todo/write event with the model-produced task list', async () => {
workdir = await mkdtemp(join(tmpdir(), 'dsh-todo-write-e2e-'))
ctx = await codingHarness(workdir, { personaPrefix: TODO_SYSTEM_PROMPT })
const agent = await ctx.agentLoop.create(SessionId('e2e-todo'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
const agent = await ctx.agentLoop.create(brandString<SessionId>('e2e-todo'), { provider: 'deepseek-official', model: 'deepseek-v4-flash' }, { cwd: workdir })
agent.followup(createUserMessage({
content: [{ type: 'text', text:
@@ -18,7 +18,7 @@ import { LOADER_SMOKE_TEST_TIMEOUT_MS, runLoaderSmoke } from '@deepseek-ai/dsh-l
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import {
SESSION_FORMAT_VERSION,
SessionId,
type SessionId,
SessionSeq,
type SessionEvent,
type SessionHeader,
@@ -28,6 +28,7 @@ import { logPath } from '../../../../../../packages/session/session-persistence-
import { renderAgentInstructions } from '@deepseek-ai/dsh-agent-instructions'
import { resolveConfig, workspaceBaselineIdentity } from '@deepseek-ai/dsh-agent-instructions/src/config.ts'
import { describe, expect, it } from 'vitest'
import { brandString } from '@deepseek-ai/dsh-brand'
const fixtureDir = join(dirname(fileURLToPath(import.meta.url)), 'expected/workspace-context-resume/offline-edit')
const replayFixture = join(fixtureDir, 'replay.jsonl')
@@ -37,7 +38,7 @@ const precedenceExpected = join(dirname(fixtureDir), 'precedence-change/session.
const configPath = fileURLToPath(new URL('../workspace-context-resume-snapshot.patch.yml', import.meta.url))
const binScript = fileURLToPath(new URL('../../../../../../packages/test-support/loader-smoke/tests/fixtures/headless-driver.ts', import.meta.url))
const tsconfigPath = fileURLToPath(new URL('../../../../../../tsconfig.json', import.meta.url))
const sessionId = SessionId('workspace-context-resume')
const sessionId = brandString<SessionId>('workspace-context-resume')
const refreshing = process.env.DSH_SNAPSHOT === 'refresh'
const oldInstruction = 'Old workspace instruction.'
const newInstruction = 'New workspace instruction after offline edit.'
+56 -55
View File
@@ -18,7 +18,7 @@ import {
type Profile,
} from '@deepseek-ai/dsh-app-boot'
import { provideCmdline } from '@deepseek-ai/dsh-cmdline'
import { SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session'
import { type SessionId, SessionLogOffset } from '@deepseek-ai/dsh-session'
import type { Agent } from '@deepseek-ai/dsh-agent'
import type { PatchOptions } from '@deepseek-ai/cordis-plugin-include'
import { afterAll, beforeAll, describe, expect, it, onTestFinished, vi } from 'vitest'
@@ -28,7 +28,8 @@ import { createPluginProfile } from '../../desktop/src/project-manager.ts'
const SETTINGS_NAMESPACE = 'agent-preset-registry'
const SUBAGENT_MODEL_SELECTION_SETTINGS_NAMESPACE = 'subagent-model-selection-settings'
import { applyChildComposition, childSessionMeta } from '@deepseek-ai/dsh-subagent'
import { ToolCallId, LlmAdapter, createUserMessage } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, LlmAdapter, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions, LlmResolvedModelInfo, StreamChunk } from '@deepseek-ai/dsh-llm'
import type {} from '@deepseek-ai/dsh-compaction-basic'
import { codePointLength } from '@deepseek-ai/dsh-compaction-tool-result-pruner'
@@ -87,7 +88,7 @@ class MinimalImageAdapter extends LlmAdapter {
const first = this.requests.length === 1
yield { type: 'block-start', index: 0, blockType: first ? 'tool-call' : 'text' }
yield { type: 'block-end', index: 0, block: first
? { type: 'tool-call', id: ToolCallId('minimal-image-read'), name: 'read_image', arguments: '{"file_path":"red.png"}' }
? { type: 'tool-call', id: brandString<ToolCallId>('minimal-image-read'), name: 'read_image', arguments: '{"file_path":"red.png"}' }
: { type: 'text', text: 'Image inspected.' } }
yield { type: 'finish', reason: { kind: first ? 'tool-calls' : 'stop' } }
}
@@ -268,7 +269,7 @@ describe('the shipped Web composition', () => {
const projections = ctx.get('sessionProjections')
if (projections === undefined) throw new Error('the Web composition must compose a projection registry')
const handle = await ctx.agents.create({
sessionId: SessionId('preset-minimal-meter'),
sessionId: brandString<SessionId>('preset-minimal-meter'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
try {
@@ -291,7 +292,7 @@ describe('the shipped Web composition', () => {
it.each(['standard', 'cordis', 'ptc'] as const)('keeps interruption disabled in %s with Team mode off or on', async (preset) => {
const handle = await ctx.agents.create({
sessionId: SessionId(`preset-interrupt-${preset}`),
sessionId: brandString<SessionId>(`preset-interrupt-${preset}`),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, preset).then(() => undefined),
})
try {
@@ -326,7 +327,7 @@ describe('the shipped Web composition', () => {
}])
try {
const handle = await configured.agents.create({
sessionId: SessionId(`preset-interrupt-enabled-${preset}`),
sessionId: brandString<SessionId>(`preset-interrupt-enabled-${preset}`),
setup: agentCtx => configured.agentPresets.mount(agentCtx, preset).then(() => undefined),
})
try {
@@ -340,7 +341,7 @@ describe('the shipped Web composition', () => {
it('composes the full agent from `standard`', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-standard'),
sessionId: brandString<SessionId>('preset-standard'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
try {
@@ -369,7 +370,7 @@ describe('the shipped Web composition', () => {
allowedModels: [],
})
const disabled = await ctx.agents.create({
sessionId: SessionId('preset-model-selection-disabled'),
sessionId: brandString<SessionId>('preset-model-selection-disabled'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
await ctx.settings.update(SUBAGENT_MODEL_SELECTION_SETTINGS_NAMESPACE, {
@@ -377,7 +378,7 @@ describe('the shipped Web composition', () => {
allowedModels: [{ provider: 'deepseek-official', model: 'deepseek-v4-flash' }],
})
const enabled = await ctx.agents.create({
sessionId: SessionId('preset-model-selection-enabled'),
sessionId: brandString<SessionId>('preset-model-selection-enabled'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
const policy = await ctx.sessionProjections.register(subagentModelSelectionProjectionDefinition)
@@ -410,13 +411,13 @@ describe('the shipped Web composition', () => {
const unregister = ctx.llm.registerAdapter(['preset-round-trip'], adapter)
onTestFinished(unregister)
const direct = await ctx.agents.create({
sessionId: SessionId(`preset-direct-${target}-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-direct-${target}-${randomUUID()}`),
agentOptions: { provider: 'preset-round-trip', model: 'preset-round-trip' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, target).then(() => undefined),
})
onTestFinished(() => direct.dispose())
const handle = await ctx.agents.create({
sessionId: SessionId(`preset-round-trip-${target}-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-round-trip-${target}-${randomUUID()}`),
agentOptions: { provider: 'preset-round-trip', model: 'preset-round-trip' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, target).then(() => undefined),
})
@@ -450,7 +451,7 @@ describe('the shipped Web composition', () => {
it('composes the exact RL prompt and persistent shell from `minimal`', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-minimal'),
sessionId: brandString<SessionId>('preset-minimal'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
try {
@@ -484,7 +485,7 @@ describe('the shipped Web composition', () => {
const unregister = ctx.llm.registerAdapter(['minimal-image-test'], adapter)
onTestFinished(unregister)
const handle = await ctx.agents.create({
sessionId: SessionId('preset-minimal-image'), meta: { cwd },
sessionId: brandString<SessionId>('preset-minimal-image'), meta: { cwd },
agentOptions: { provider: 'minimal-image-test', model: 'minimal-image-test' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
@@ -512,7 +513,7 @@ describe('the shipped Web composition', () => {
const unregister = ctx.llm.registerAdapter(['minimal-compaction-test'], adapter)
onTestFinished(unregister)
const handle = await ctx.agents.create({
sessionId: SessionId('preset-minimal-compaction'),
sessionId: brandString<SessionId>('preset-minimal-compaction'),
agentOptions: { provider: 'minimal-compaction-test', model: 'minimal-compaction-test' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
@@ -546,7 +547,7 @@ describe('the shipped Web composition', () => {
const unregister = ctx.llm.registerAdapter(['minimal-pressure-test'], adapter)
onTestFinished(unregister)
const handle = await ctx.agents.create({
sessionId: SessionId('preset-minimal-pressure'),
sessionId: brandString<SessionId>('preset-minimal-pressure'),
agentOptions: { provider: 'minimal-pressure-test', model: 'minimal-pressure-test' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
@@ -571,11 +572,11 @@ describe('the shipped Web composition', () => {
it('keeps two differently composed sessions independent', async () => {
const full = await ctx.agents.create({
sessionId: SessionId('preset-both-full'),
sessionId: brandString<SessionId>('preset-both-full'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
const minimal = await ctx.agents.create({
sessionId: SessionId('preset-both-minimal'),
sessionId: brandString<SessionId>('preset-both-minimal'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
try {
@@ -596,7 +597,7 @@ describe('the shipped Web composition', () => {
it('composes the cordis agent with its own toolset', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-cordis'),
sessionId: brandString<SessionId>('preset-cordis'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'cordis').then(() => undefined),
})
try {
@@ -619,7 +620,7 @@ describe('the shipped Web composition', () => {
expect(shipped).toEqual(['dsh-doc'])
expect((await ctx.skills.list()).map(skill => skill.name)).not.toContain('dsh-doc')
const loaded = await executeToolFixture(ctx, {
callId: ToolCallId('preset-cordis-dsh-doc'),
callId: brandString<ToolCallId>('preset-cordis-dsh-doc'),
name: 'skill',
arguments: { name: 'dsh-doc' },
signal: new AbortController().signal,
@@ -636,7 +637,7 @@ describe('the shipped Web composition', () => {
for (const file of readdirSync(references).filter(entry => entry !== 'packages.md')) {
const path = join(references, file)
const result = await executeToolFixture(ctx, {
callId: ToolCallId(`preset-cordis-dsh-doc-${file}`),
callId: brandString<ToolCallId>(`preset-cordis-dsh-doc-${file}`),
name: 'read',
arguments: { file_path: path },
signal: new AbortController().signal,
@@ -650,7 +651,7 @@ describe('the shipped Web composition', () => {
// Creator adds its DSH customization intent to the shared coding persona.
const standard = await ctx.agents.create({
sessionId: SessionId('preset-cordis-standard-persona'),
sessionId: brandString<SessionId>('preset-cordis-standard-persona'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
try {
@@ -674,7 +675,7 @@ describe('the shipped Web composition', () => {
})
try {
const codingOnly = await ctx.agents.create({
sessionId: SessionId('preset-cordis-coding-only'),
sessionId: brandString<SessionId>('preset-cordis-coding-only'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'cordis-coding-only').then(() => undefined),
})
try {
@@ -692,11 +693,11 @@ describe('the shipped Web composition', () => {
it('presents `ptc` as PTC mode without disturbing a native session beside it', async () => {
const coded = await ctx.agents.create({
sessionId: SessionId('preset-ptc'),
sessionId: brandString<SessionId>('preset-ptc'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'ptc').then(() => undefined),
})
const native = await ctx.agents.create({
sessionId: SessionId('preset-ptc-native'),
sessionId: brandString<SessionId>('preset-ptc-native'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
try {
@@ -725,7 +726,7 @@ describe('the shipped Web composition', () => {
it('keeps the self-referential toolset out of every other preset', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-no-cordis'),
sessionId: brandString<SessionId>('preset-no-cordis'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
try {
@@ -758,7 +759,7 @@ describe('the shipped Web composition', () => {
const handle = await ctx.agents.create({
// Unique per run: the composition persists into the ambient DSH home,
// and a fixed id would collide with a log an earlier run left there.
sessionId: SessionId(`preset-skills-standard-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-skills-standard-${randomUUID()}`),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
try {
@@ -776,7 +777,7 @@ describe('the shipped Web composition', () => {
// The preset's own loader tool resolves the global-layer skill.
const loaded = await executeToolFixture(ctx, {
callId: ToolCallId('preset-skills-load'),
callId: brandString<ToolCallId>('preset-skills-load'),
name: 'skill',
arguments: { name: 'dsh-badge' },
signal: new AbortController().signal,
@@ -791,7 +792,7 @@ describe('the shipped Web composition', () => {
it('shows a minimal agent the global layer but no loader tool', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId(`preset-skills-minimal-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-skills-minimal-${randomUUID()}`),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
try {
@@ -813,7 +814,7 @@ describe('the shipped Web composition', () => {
const before = await Promise.all(WEB_PATCHES.map(file => readFile(file, 'utf8')))
const handle = await ctx.agents.create({
sessionId: SessionId('preset-readonly'),
sessionId: brandString<SessionId>('preset-readonly'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
await handle.dispose()
@@ -838,7 +839,7 @@ describe('preset-selected delegation through the Web Loader', () => {
const adapter = new MinimalCompactionAdapter()
configured.llm.registerAdapter(['preset-switch'], adapter)
const { agent } = await configured.agents.create({
sessionId: SessionId(`configured-switch-${randomUUID()}`),
sessionId: brandString<SessionId>(`configured-switch-${randomUUID()}`),
agentOptions: { provider: 'preset-switch', model: 'preset-switch' },
setup: owner => configured.agentPresets.mount(owner, 'delegate-a').then(() => undefined),
})
@@ -879,7 +880,7 @@ describe.each(['web', 'desktop'] as const)('%s native subagent bundles', (surfac
async function presetTools(productCtx: Context, preset: string): Promise<string[]> {
const handle = await productCtx.agents.create({
sessionId: SessionId(`native-${surface}-${preset}-${randomUUID()}`),
sessionId: brandString<SessionId>(`native-${surface}-${preset}-${randomUUID()}`),
setup: owner => productCtx.agentPresets.mount(owner, preset).then(() => undefined),
})
try {
@@ -899,7 +900,7 @@ describe.each(['web', 'desktop'] as const)('%s native subagent bundles', (surfac
expect(await presetTools(productCtx, preset)).toEqual(expected)
}
const handle = await productCtx.agents.create({
sessionId: SessionId(`native-${surface}-params-${randomUUID()}`),
sessionId: brandString<SessionId>(`native-${surface}-params-${randomUUID()}`),
setup: owner => productCtx.agentPresets.mount(owner, 'standard').then(() => undefined),
})
try {
@@ -961,12 +962,12 @@ describe('the standard preset documentation skill', () => {
const adapter = new MinimalCompactionAdapter()
testCtx.llm.registerAdapter(['standard-doc-test'], adapter)
const baseline = await testCtx.agents.create({
sessionId: SessionId('standard-doc-baseline'), meta: { cwd: root },
sessionId: brandString<SessionId>('standard-doc-baseline'), meta: { cwd: root },
agentOptions: { provider: 'standard-doc-test', model: 'standard-doc-test' },
setup: agentCtx => testCtx.agentPresets.mount(agentCtx, 'standard-without-doc').then(() => undefined),
})
const standardAgent = await testCtx.agents.create({
sessionId: SessionId('standard-doc-current'), meta: { cwd: root },
sessionId: brandString<SessionId>('standard-doc-current'), meta: { cwd: root },
agentOptions: { provider: 'standard-doc-test', model: 'standard-doc-test' },
setup: agentCtx => testCtx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
@@ -978,7 +979,7 @@ describe('the standard preset documentation skill', () => {
expect(definition?.path).toBe(await realpath(join(REPO_ROOT, 'packages/preset/agent-preset/skills/dsh-doc/SKILL.md')))
if (definition === undefined) throw new Error('standard has no packaged dsh-doc skill')
const creator = await testCtx.agents.create({
sessionId: SessionId('standard-doc-creator'), meta: { cwd: root },
sessionId: brandString<SessionId>('standard-doc-creator'), meta: { cwd: root },
setup: agentCtx => testCtx.agentPresets.mount(agentCtx, 'cordis').then(() => undefined),
})
expect((await testCtx.skills.get('dsh-doc', { cwd: root, scope: creator.agent }))?.path).toBe(definition.path)
@@ -1023,7 +1024,7 @@ describe('the standard preset documentation skill', () => {
const profileManifest = join(root, 'profiles/spec/package.json')
const before = await readFile(profileManifest, 'utf8')
const loaded = await executeToolFixture(testCtx, {
agent: standardAgent.agent, callId: ToolCallId('standard-doc-load'),
agent: standardAgent.agent, callId: brandString<ToolCallId>('standard-doc-load'),
name: 'skill', arguments: { name: 'dsh-doc' }, signal: new AbortController().signal,
})
expect(loaded.isError).toBe(false)
@@ -1065,7 +1066,7 @@ describe('the standard preset documentation skill', () => {
priorityCtx = await bootWeb(root)
const testCtx = priorityCtx
const handle = await testCtx.agents.create({
sessionId: SessionId('standard-doc-priority'), meta: { cwd: workspace },
sessionId: brandString<SessionId>('standard-doc-priority'), meta: { cwd: workspace },
setup: agentCtx => testCtx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
for (const [cwd, path] of [
@@ -1105,11 +1106,11 @@ describe('a user preset declared from the shipped cordis rows', () => {
}] }])
try {
const shipped = await copyCtx.agents.create({
sessionId: SessionId(`preset-cordis-shipped-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-cordis-shipped-${randomUUID()}`),
setup: agentCtx => copyCtx.agentPresets.mount(agentCtx, 'cordis').then(() => undefined),
})
const copied = await copyCtx.agents.create({
sessionId: SessionId(`preset-cordis-copy-${randomUUID()}`),
sessionId: brandString<SessionId>(`preset-cordis-copy-${randomUUID()}`),
setup: agentCtx => copyCtx.agentPresets.mount(agentCtx, 'cordis-copy').then(() => undefined),
})
try {
@@ -1120,7 +1121,7 @@ describe('a user preset declared from the shipped cordis rows', () => {
}
const signal = new AbortController().signal
const listed = await executeToolFixture(copyCtx, {
callId: ToolCallId('copied-preset-inspect-list'),
callId: brandString<ToolCallId>('copied-preset-inspect-list'),
name: 'cordis_inspect_list',
arguments: {},
signal,
@@ -1137,7 +1138,7 @@ describe('a user preset declared from the shipped cordis rows', () => {
const spills = vi.spyOn(copyCtx.spillStore, 'saveText')
onTestFinished(() => { spills.mockRestore() })
const queried = await executeToolFixture(copyCtx, {
callId: ToolCallId('copied-preset-inspect-tools'),
callId: brandString<ToolCallId>('copied-preset-inspect-tools'),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Tool', method: 'listTools' },
signal,
@@ -1156,7 +1157,7 @@ describe('a user preset declared from the shipped cordis rows', () => {
type ConfigPage = { data: { entries: ConfigRow[]; total: number; nextOffset: number | null } }
const listConfigs = async (input: Record<string, string | number>, callId: string): Promise<ConfigPage['data']> => {
const page = await executeToolFixture(copyCtx, {
callId: ToolCallId(callId),
callId: brandString<ToolCallId>(callId),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input },
signal,
@@ -1175,7 +1176,7 @@ describe('a user preset declared from the shipped cordis rows', () => {
expect(firstPage.entries).toHaveLength(5)
expect(firstPage.nextOffset).toBe(5)
const projected = await executeToolFixture(copyCtx, {
callId: ToolCallId('copied-preset-inspect-config'),
callId: brandString<ToolCallId>('copied-preset-inspect-config'),
name: 'cordis_inspect_query',
arguments: { platform: 'host', provider: 'Config', method: 'listConfigs', input: { entry: toolsRow!.id } },
signal,
@@ -1201,7 +1202,7 @@ describe('a user preset declared from the shipped cordis rows', () => {
describe('a switch survives the session', () => {
it('records the choice so the log states what the agent runs', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-switch-logged'),
sessionId: brandString<SessionId>('preset-switch-logged'),
meta: { agentPreset: 'standard' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
@@ -1225,18 +1226,18 @@ describe('a switch survives the session', () => {
describe('a forked session', () => {
it('inherits the composition its seeded history was produced under', async () => {
const parent = await ctx.agents.create({
sessionId: SessionId('preset-fork-parent'),
sessionId: brandString<SessionId>('preset-fork-parent'),
meta: { agentPreset: 'minimal' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
const projection = await ctx.sessionProjections.register(agentPresetProjectionDefinition)
const inherited = projection.stateOf(parent.agent.session) ?? undefined
const child = await ctx.agents.create({
sessionId: SessionId('preset-fork-child'),
sessionId: brandString<SessionId>('preset-fork-child'),
seed: [],
inheritedEventCount: SessionLogOffset(0),
meta: {
parentSession: SessionId('preset-fork-parent'),
parentSession: brandString<SessionId>('preset-fork-parent'),
isSeeded: true,
...inherited === undefined ? {} : { agentPreset: inherited },
},
@@ -1258,13 +1259,13 @@ describe('a forked session', () => {
describe('a delegated child', () => {
it.each([false, true])('inherits preset tools with seeded=%s and refuses child scheduled tasks', async (seeded) => {
const parent = await ctx.agents.create({
sessionId: SessionId(`preset-child-parent-${seeded}`),
sessionId: brandString<SessionId>(`preset-child-parent-${seeded}`),
meta: { agentPreset: 'standard' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
// Exactly what an in-process subagent driver's creation window does.
const child = await parent.agent.ctx.agents.create({
sessionId: SessionId(`preset-child-${seeded}`),
sessionId: brandString<SessionId>(`preset-child-${seeded}`),
meta: childSessionMeta(parent.agent, 1, seeded),
...(seeded ? { seed: [], inheritedEventCount: SessionLogOffset(0) } : {}),
setup: (agentCtx) => {
@@ -1288,7 +1289,7 @@ describe('a delegated child', () => {
for (const [name, args] of calls) {
expect(toolNames(ctx, child.agent)).toContain(name)
const result = await executeToolFixture(ctx, {
callId: ToolCallId(`child-${name}`), signal: new AbortController().signal,
callId: brandString<ToolCallId>(`child-${name}`), signal: new AbortController().signal,
name, arguments: args, agent: child.agent,
})
expect(result.value).toEqual({ code: 'subagent_session', message: 'A delegated subagent cannot use scheduled tasks.' })
@@ -1302,13 +1303,13 @@ describe('a delegated child', () => {
it('follows a parent that switched preset while blank', async () => {
const parent = await ctx.agents.create({
sessionId: SessionId('preset-child-switch-parent'),
sessionId: brandString<SessionId>('preset-child-switch-parent'),
meta: { agentPreset: 'standard' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'standard').then(() => undefined),
})
await ctx.agentPresets.recompose(parent.agent.ctx, 'minimal')
const child = await parent.agent.ctx.agents.create({
sessionId: SessionId('preset-child-switch'),
sessionId: brandString<SessionId>('preset-child-switch'),
meta: childSessionMeta(parent.agent, 1, false),
setup: (agentCtx) => {
return applyChildComposition(agentCtx, parent.agent, {})
@@ -1335,7 +1336,7 @@ describe('the default preset as a user setting', () => {
expect(ctx.agentPresets.defaultId).toBe('minimal')
const handle = await ctx.agents.create({
sessionId: SessionId('preset-user-default'),
sessionId: brandString<SessionId>('preset-user-default'),
setup: agentCtx => ctx.agentPresets.mount(agentCtx).then(() => undefined),
})
try {
@@ -1382,7 +1383,7 @@ describe('a profile patch stored before Developer tools owned preset selection',
.toEqual({ selectedDefault: 'minimal' })
const handle = await legacy.agents.create({
sessionId: SessionId('preset-legacy-patch'),
sessionId: brandString<SessionId>('preset-legacy-patch'),
setup: agentCtx => legacy.agentPresets.mount(agentCtx).then(() => undefined),
})
try {
@@ -1396,7 +1397,7 @@ describe('a profile patch stored before Developer tools owned preset selection',
describe('a session keeps the preset it was created with', () => {
it('refuses to adopt a live session under a different preset', async () => {
const handle = await ctx.agents.create({
sessionId: SessionId('preset-locked'),
sessionId: brandString<SessionId>('preset-locked'),
meta: { agentPreset: 'minimal' },
setup: agentCtx => ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
})
+3 -2
View File
@@ -5,10 +5,11 @@ import { join } from 'node:path'
import { Context } from '@deepseek-ai/cordis'
import { LocalFileSystem } from '@deepseek-ai/dsh-fs-local'
import SessionStore from '@deepseek-ai/dsh-session'
import { SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import { sessionFileAddress } from '@deepseek-ai/dsh-util-workspace-path'
import { expect, it, onTestFinished, vi } from 'vitest'
import { localDragResource } from '../src/file-drag.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
async function fixture() {
const root = await mkdtemp(join(tmpdir(), 'dsh-host-drag-'))
@@ -17,7 +18,7 @@ async function fixture() {
await ctx.plugin(LocalFileSystem, { cwd: root })
await ctx.plugin(SessionStore)
ctx.provide('sandboxPolicy', { workspaceRoot: root } as never)
const id = SessionId('file-drag-test')
const id = brandString<SessionId>('file-drag-test')
ctx.sessions.create(id, { meta: { cwd: root, origin: 'subagent' } })
const path = join(root, '报告.pdf')
const bytes = Buffer.from('%PDF-1.4\n原始内容\n%%EOF')
@@ -1,7 +1,8 @@
import { Context } from '@deepseek-ai/cordis'
import { JobId, JobRegistry } from '@deepseek-ai/dsh-jobs'
import { type JobId, JobRegistry } from '@deepseek-ai/dsh-jobs'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { JobStatus, JobView } from '@deepseek-ai/dsh-jobs'
import { SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionActivity } from '@deepseek-ai/dsh-workspace'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { installDesktopQuitInspection } from '../src/quit-inspection.ts'
@@ -21,7 +22,7 @@ class RosterOnlyJobRegistry extends JobRegistry {
start(): never { throw new Error('unsupported') }
list(caller?: SessionId): JobView[] {
return (jobs.get(caller) ?? []).map((status, index) => ({
id: JobId(`bash-${index + 1}`),
id: brandString<JobId>(`bash-${index + 1}`),
kind: 'bash',
label: 'sleep 60',
...caller === undefined ? {} : { owner: caller },
@@ -40,7 +41,7 @@ class RosterOnlyJobRegistry extends JobRegistry {
}
function agent(id: string, status: 'idle' | 'running' = 'idle'): AgentState {
return { id: SessionId(id), status, inbox: { nextTurn: [], nextStep: [] } }
return { id: brandString<SessionId>(id), status, inbox: { nextTurn: [], nextStep: [] } }
}
beforeEach(() => {
@@ -60,7 +61,7 @@ afterEach(async () => { await ctx.fiber.dispose() })
describe('Desktop Host quit inspection', () => {
it('reports neither active nor scheduled work for idle loaded sessions', async () => {
agents.push(agent('quiet'))
activity.set(SessionId('quiet'), [{ kind: 'turn' }])
activity.set(brandString<SessionId>('quiet'), [{ kind: 'turn' }])
expect(await inspect()).toEqual({ activeTasks: false, scheduledTasks: false })
})
@@ -77,14 +78,14 @@ describe('Desktop Host quit inspection', () => {
const asked: SessionId[] = []
ctx.on('workspace/session-activity', async ({ sessionId }, next) => { asked.push(sessionId); return next() })
agents.push(agent('first'), agent('second'), agent('third'))
activity.set(SessionId('second'), [{ kind: 'schedule', items: [{ id: 'reminder-1', label: 'stand-up' }] }])
activity.set(brandString<SessionId>('second'), [{ kind: 'schedule', items: [{ id: 'reminder-1', label: 'stand-up' }] }])
expect(await inspect()).toEqual({ activeTasks: false, scheduledTasks: true })
expect(asked).toEqual([SessionId('first'), SessionId('second')])
expect(asked).toEqual([brandString<SessionId>('first'), brandString<SessionId>('second')])
})
it('reports both when a running session also holds a reminder', async () => {
agents.push(agent('both', 'running'))
activity.set(SessionId('both'), [{ kind: 'job', items: [{ id: 'bash-1' }] }, { kind: 'schedule', items: [{ id: 'reminder-2' }] }])
activity.set(brandString<SessionId>('both'), [{ kind: 'job', items: [{ id: 'bash-1' }] }, { kind: 'schedule', items: [{ id: 'reminder-2' }] }])
expect(await inspect()).toEqual({ activeTasks: true, scheduledTasks: true })
})
+1
View File
@@ -55,6 +55,7 @@
"@deepseek-ai/cordis": "workspace:~"
},
"devDependencies": {
"@deepseek-ai/dsh-brand": "workspace:*",
"@deepseek-ai/dsh-app-boot": "workspace:*",
"@deepseek-ai/dsh-client-ui-settings-general": "workspace:*",
"@deepseek-ai/dsh-client-ui-sidebar-browser": "workspace:*",
+2 -2
View File
@@ -45,8 +45,8 @@
en: b42f103358d0dfd7
zh: a534164ad9eb00da
/desktop-packaging/runtime-file-selection-and-installation-checks:
en: a92b8fda03ae3f19
zh: 5b2f0b4e1cad1745
en: da4669b98c79ee48
zh: d007e87f13ff54d3
/desktop-packaging/desktop-runtime-preparation:
en: 84be38ab3136fff7
zh: bb4ed12ee0e1dfa0
+1 -1
View File
@@ -252,7 +252,7 @@ Desktop packs workspace packages locally and installs external dependencies thro
The [Electron shell file list](../scripts/electron-builder-config.mjs) excludes recognized JavaScript/CSS/TypeScript source maps and TypeScript build caches from the separate `resources/app.asar/node_modules` dependency collection. These exclusions preserve runtime code, native modules, WASM, data files (including ordinary `.map` assets), licenses, and notices; [shell archive tests](../tests/shell-file-selection.spec.ts) check retained bytes and exclusions.
The [Office conversion provider](../../../packages/document/office-kit/README.md) is a Host service mounted by web-app, so every application that loads web-app, including `dsh web` and Desktop, provides it together with the [Office tools](../../../packages/document/tool-office/README.md). The provider [resolves the Kit's engine itself](../../../packages/document/office-kit/README.md#understand-the-implementation), including the mapping of native engine manifests to unpacked physical directories. Desktop packaging only carries and unpacks the engine: it carries the target’s declared native engine, or WASM when the kit declares no matching native target, and preparation rejects a missing target engine before packaging. The complete Office dependencies, including the JavaScript libraries and the selected engine’s executables, data, licenses, and notices, are unpacked under `resources/app.asar.unpacked/dsh/node_modules/`. The Desktop shell passes the primary runtime location to the Host in [main.ts](../src/main.ts), and the Host sets it as `DSH_PRIMARY_RUNTIME`; neither passes a Kit location. Office skills are available in every application that loads web-app, and Desktop reads them from the skill package inside `resources/app.asar`; only Desktop mounts the bundled Python environment (`workspace-dependencies`). On macOS, the native helper receives the JIT entitlement required by [LibreOffice’s UNO bridge](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in). The Computer Use helper applications under `@deepseek-ai/dsh-experimental-cua-macos/native/bin` are also unpacked whole under `resources/app.asar.unpacked/dsh/node_modules/`, and the provider opens that copy.
The [Office conversion provider](../../../packages/document/office-kit/README.md) is a Host service mounted by web-app, so every application that loads web-app, including `dsh web` and Desktop, provides it together with the [Office tools](../../../packages/document/tool-office/README.md). The provider [resolves the Kit's engine itself](../../../packages/document/office-kit/README.md#understand-the-implementation), including the mapping of native engine manifests to unpacked physical directories. Desktop packaging only carries and unpacks the engine: it carries the target’s declared native engine, or WASM when the kit declares no matching native target, and preparation rejects a missing target engine before packaging. The complete Office dependencies, including the JavaScript libraries and the selected engine’s executables, data, licenses, and notices, are unpacked under `resources/app.asar.unpacked/dsh/node_modules/`. The Desktop shell passes the primary runtime location to the Host in [main.ts](../src/main.ts), and the Host sets it as `DSH_PRIMARY_RUNTIME`; neither passes a Kit location. Office skills are available in every application that loads web-app, and Desktop reads them from the skill package inside `resources/app.asar`; only Desktop mounts the bundled Python environment (`workspace-dependencies`). On macOS, the native helper receives the JIT entitlement required by [LibreOffice’s UNO bridge](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in). The Computer Use helper applications under `@deepseek-ai/dsh-cua-macos/native/bin` are also unpacked whole under `resources/app.asar.unpacked/dsh/node_modules/`, and the provider opens that copy.
The packaged application runs compiled JavaScript and pre-generated Typert metadata; it does not compile TypeScript plugins. Source-level debugger navigation and editor declarations remain available in development packages. [Copy-policy tests](../tests/runtime-file-policy.spec.ts) cover exclusions and retained assets; The [payload smoke](../tests/fixtures/runtime-payload-smoke.mjs) runs under Electron RunAsNode before the Host smoke and final inventory verification. The payload smoke resolves the search tool’s ripgrep executable and verifies text search and file enumeration. Signed Windows builds run these checks after dependency signing; other builds run them during `prepare:dsh`. The [Host smoke](../scripts/smoke-runtime.ts) creates DOCX, XLSX, and PPTX inputs with bundled Python and runs each through the real Office provider: PDF conversion, PNG rendering, conversion to the matching OpenDocument format, and, for XLSX, recalculation, checking each output's signature. Every assembled application, including directory and unsigned builds, repeats the payload and Host checks against ASAR. Archive integrity checks compare the complete archived descriptor with preparation, file bytes and membership in both archive and unpacked trees, recorded executable flags for archived files, and physical permissions for unpacked files. Conversion failures stop packaging before a release record is written; macOS DMG/ZIP builds run these checks before notarization.
+1 -1
View File
@@ -252,7 +252,7 @@ Desktop 在本地打包工作区包,并通过目标捆绑的 Node 和 pnpm 安
[Electron 外壳文件清单](../scripts/electron-builder-config.mjs)从单独收集的 `resources/app.asar/node_modules` 依赖中排除已识别的 JavaScript/CSS/TypeScript source map 和 TypeScript 构建缓存。这些排除规则保留运行时代码、原生模块、WASM、数据文件(包括普通 `.map` 资源)、许可证和 notices;[外壳归档测试](../tests/shell-file-selection.spec.ts)检查保留文件的字节和排除项。
[Office 转换提供方](../../../packages/document/office-kit/README.zh.md)是 web-app 挂载的 Host 服务,因此所有加载 web-app 的应用(包括 `dsh web` 和 Desktop)都提供它以及 [Office 工具](../../../packages/document/tool-office/README.zh.md)。该提供方[自行解析 Kit 的引擎](../../../packages/document/office-kit/README.zh.md#understand-the-implementation),包括把原生引擎清单映射到解包后的实体目录。Desktop 打包只负责携带和解包引擎:携带目标声明的原生引擎;kit 未声明匹配的原生目标时携带 WASM;目标引擎缺失时,准备阶段在打包前拒绝。完整的 Office 依赖(包括 JavaScript 库以及所选引擎的可执行文件、数据、许可证和声明)解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下。Desktop 壳在 [main.ts](../src/main.ts) 中把主运行时位置传给 Host,由 Host 设为 `DSH_PRIMARY_RUNTIME`;两者都不传 Kit 位置。所有加载 web-app 的应用都提供 Office 技能,Desktop 从 `resources/app.asar` 内的技能包读取它们;只有 Desktop 挂载内置 Python 环境(`workspace-dependencies`)。在 macOS 上,原生 helper 获得 [LibreOffice UNO 桥](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in)所需的 JIT 权限。`@deepseek-ai/dsh-experimental-cua-macos/native/bin` 下的 Computer Use helper 应用也整体解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下,提供方打开该副本。
[Office 转换提供方](../../../packages/document/office-kit/README.zh.md)是 web-app 挂载的 Host 服务,因此所有加载 web-app 的应用(包括 `dsh web` 和 Desktop)都提供它以及 [Office 工具](../../../packages/document/tool-office/README.zh.md)。该提供方[自行解析 Kit 的引擎](../../../packages/document/office-kit/README.zh.md#understand-the-implementation),包括把原生引擎清单映射到解包后的实体目录。Desktop 打包只负责携带和解包引擎:携带目标声明的原生引擎;kit 未声明匹配的原生目标时携带 WASM;目标引擎缺失时,准备阶段在打包前拒绝。完整的 Office 依赖(包括 JavaScript 库以及所选引擎的可执行文件、数据、许可证和声明)解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下。Desktop 壳在 [main.ts](../src/main.ts) 中把主运行时位置传给 Host,由 Host 设为 `DSH_PRIMARY_RUNTIME`;两者都不传 Kit 位置。所有加载 web-app 的应用都提供 Office 技能,Desktop 从 `resources/app.asar` 内的技能包读取它们;只有 Desktop 挂载内置 Python 环境(`workspace-dependencies`)。在 macOS 上,原生 helper 获得 [LibreOffice UNO 桥](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in)所需的 JIT 权限。`@deepseek-ai/dsh-cua-macos/native/bin` 下的 Computer Use helper 应用也整体解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下,提供方打开该副本。
打包应用运行编译后的 JavaScript 和预生成的 Typert 元数据,不编译 TypeScript 插件。源码级调试导航和编辑器声明仍可从开发包中获取。[复制规则测试](../tests/runtime-file-policy.spec.ts)覆盖排除项和保留资源;[产物 smoke](../tests/fixtures/runtime-payload-smoke.mjs) 在 Host smoke 和最终清单验证之前,使用 Electron RunAsNode 执行。产物 smoke 解析搜索工具使用的 ripgrep 可执行文件,并验证文本搜索和文件枚举。Windows 签名构建在依赖签名后运行这些检查;其他构建在 `prepare:dsh` 中运行。[Host smoke](../scripts/smoke-runtime.ts) 使用捆绑的 Python 创建 DOCX、XLSX 和 PPTX 输入,并通过真实 Office 提供方逐一执行:PDF 转换、PNG 渲染、转换为对应的 OpenDocument 格式,以及针对 XLSX 的重算,检查每个输出的签名。每个组装后的应用(包括目录包和未签名构建)都会针对 ASAR 重复产物和 Host 检查。归档完整性检查将归档内完整描述符与准备结果比对,并核对归档和解包目录中的文件内容与清单、归档内文件记录的执行标志,以及解包文件的物理权限。转换失败会在写入发布记录前终止打包;macOS DMG/ZIP 构建在公证前执行这些检查。
@@ -79,7 +79,7 @@ export function createElectronBuilderConfig(
`**/node_modules/@deepseek-ai/libreoffice-kit-${resolvedPlatform}-${resolvedArch}/**/*`,
// LaunchServices opens the Computer Use helper as an application, so every file of its bundles stays on disk.
// Both architectures ship: they form one notarized payload whose manifest staging verifies as a whole.
'**/node_modules/@deepseek-ai/dsh-experimental-cua-macos/native/bin/**/*']
'**/node_modules/@deepseek-ai/dsh-cua-macos/native/bin/**/*']
const windowsSigner = packagesWindows && !unsigned
? createWindowsTokenSigner({
certificateFile: env.DSH_DESKTOP_WINDOWS_CER_FILE,
+1 -1
View File
@@ -16,7 +16,7 @@ const MACH_O_MAGICS = new Set(['cafebabe', 'cafebabf', 'cefaedfe', 'cffaedfe', '
* `native/bin/darwin-<arch>/<generation>/<name>.app`. Other bundles, such as LibreOffice's unsigned application,
* are not matched and keep per-file runtime signing.
*/
const CUA_HELPER_BUNDLE = /^(node_modules\/@deepseek-ai\/dsh-experimental-cua-macos\/native\/bin\/darwin-[^/]+\/[^/]+\/[^/]+\.app)\//u
const CUA_HELPER_BUNDLE = /^(node_modules\/@deepseek-ai\/dsh-cua-macos\/native\/bin\/darwin-[^/]+\/[^/]+\/[^/]+\.app)\//u
function magic(path: string): string {
const descriptor = openSync(path, 'r')
@@ -9,7 +9,7 @@ import { expect, it, onTestFinished } from 'vitest'
import { pnpmCommand } from '../../../scripts/release/process.ts'
const repository = resolve(import.meta.dirname, '../../..')
const providerName = '@deepseek-ai/dsh-experimental-cua-macos'
const providerName = '@deepseek-ai/dsh-cua-macos'
const windowsProvider = '@deepseek-ai/dsh-cua-windows'
const bundleName = '@deepseek-ai/dsh-cua-bundle'
const readManifest = async (path: string): Promise<Record<string, unknown>> =>
+5 -4
View File
@@ -1,7 +1,8 @@
import { Context } from '@deepseek-ai/cordis'
import { JobId, JobRegistry } from '@deepseek-ai/dsh-jobs'
import { type JobId, JobRegistry } from '@deepseek-ai/dsh-jobs'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { JobStatus, JobView } from '@deepseek-ai/dsh-jobs'
import { SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import { Readable } from 'node:stream'
import type { IncomingMessage, ServerResponse } from 'node:http'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -20,7 +21,7 @@ class RosterOnlyJobRegistry extends JobRegistry {
start(): never { throw new Error('unsupported') }
list(caller?: SessionId): JobView[] {
return (jobs.get(caller) ?? []).map((status, index) => ({
id: JobId(`bash-${index + 1}`),
id: brandString<JobId>(`bash-${index + 1}`),
kind: 'bash',
label: 'sleep 60',
...caller === undefined ? {} : { owner: caller },
@@ -50,7 +51,7 @@ beforeEach(() => {
afterEach(async () => { await ctx.fiber.dispose() })
function idleAgent(): AgentState { return { id: SessionId('update-task-owner'), status: 'idle', inbox: { nextTurn: [], nextStep: [] } } }
function idleAgent(): AgentState { return { id: brandString<SessionId>('update-task-owner'), status: 'idle', inbox: { nextTurn: [], nextStep: [] } } }
function request(next: () => Promise<void>) {
const incoming = Readable.from([]) as IncomingMessage
+1 -1
View File
@@ -28,7 +28,7 @@ it('signs Mach-O files in their final locations and verifies each signature', as
expect(verifyMacOSRuntimeCode).toHaveBeenCalledWith(join(path, 'addon.node'), identity)
})
const helperBundle = 'node_modules/@deepseek-ai/dsh-experimental-cua-macos/native/bin/darwin-arm64/generation/DSH Computer Use.app'
const helperBundle = 'node_modules/@deepseek-ai/dsh-cua-macos/native/bin/darwin-arm64/generation/DSH Computer Use.app'
function machO(path: string): void {
mkdirSync(join(path, '..'), { recursive: true })
writeFileSync(path, Buffer.from('cffaedfe00000000', 'hex'))
+1 -1
View File
@@ -73,7 +73,7 @@ describe('desktop macOS release signature', () => {
expect(config.asarUnpack).toEqual(expect.arrayContaining([
'**/*.{node,dylib,dll,so,exe}',
'**/@vscode/ripgrep-*/bin/rg',
'**/node_modules/@deepseek-ai/dsh-experimental-cua-macos/native/bin/**/*',
'**/node_modules/@deepseek-ai/dsh-cua-macos/native/bin/**/*',
]))
expect(config).toMatchObject({
appId: RELEASE_ENVIRONMENT.DSH_DESKTOP_APP_ID,
@@ -99,7 +99,7 @@ describe('desktop package-set selection', () => {
})
})
const macProvider = '@deepseek-ai/dsh-experimental-cua-macos'
const macProvider = '@deepseek-ai/dsh-cua-macos'
const cuaBundle = '@deepseek-ai/dsh-cua-bundle'
const targetManifests = () => new Map<string, PackedDesktopPackage>([
['@deepseek-ai/dsh', packed('@deepseek-ai/dsh', { dependencies: { [cuaBundle]: '1.0.0' } })],
@@ -157,8 +157,8 @@ it('copies no macOS tarball into the Windows package set', () => {
}
const output = join(root, 'output')
prepareDesktopPackageSet([inputs], output, { platform: 'win32', arch: 'x64' })
expect(readdirSync(join(output, DESKTOP_PACKAGES_DIR))).not.toContain('dsh-experimental-cua-macos.tgz')
expect(readdirSync(join(output, DESKTOP_PACKAGES_DIR))).not.toContain('dsh-cua-macos.tgz')
prepareDesktopPackageSet([inputs], output, { platform: 'darwin', arch: 'arm64' })
expect(readFileSync(join(output, DESKTOP_PACKAGES_DIR, 'dsh-experimental-cua-macos.tgz')))
.toEqual(readFileSync(join(inputs, 'dsh-experimental-cua-macos.tgz')))
expect(readFileSync(join(output, DESKTOP_PACKAGES_DIR, 'dsh-cua-macos.tgz')))
.toEqual(readFileSync(join(inputs, 'dsh-cua-macos.tgz')))
})
+1
View File
@@ -31,6 +31,7 @@
},
"license": "MIT",
"devDependencies": {
"@deepseek-ai/dsh-brand": "workspace:*",
"@deepseek-ai/cordis-plugin-group": "workspace:~",
"@deepseek-ai/dsh-client-modules": "workspace:*",
"@deepseek-ai/dsh-client-store": "workspace:*",
+3 -2
View File
@@ -16,7 +16,7 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import {
SESSION_FORMAT_VERSION, SessionId as sessionId, type SessionEvent, type SessionHeader, type SessionId,
SESSION_FORMAT_VERSION, type SessionId as sessionId, type SessionEvent, type SessionHeader, type SessionId,
} from '@deepseek-ai/dsh-session'
import { SUBAGENT_DESCRIPTOR_VERSION } from '@deepseek-ai/dsh-subagent'
import { createSystemMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
@@ -27,6 +27,7 @@ import {
import { openSettings,
connectFreshWorkspace, newEnglishPage, saveFailureShot, writeComposerDraft,
} from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/agent-preset-selection', import.meta.url))
const HERO_EXPECTED = join(SNAPSHOT_DIR, 'hero.expected.md')
@@ -35,7 +36,7 @@ const HEADER_EXPECTED = join(SNAPSHOT_DIR, 'header.expected.md')
const MODE = webSnapshotMode()
const SEED_ID = 'agent-preset-selection-web-e2e'
const SEED_TIME = 1784974100000
const SEEDED_CHILD_ID = sessionId('agent-preset-selection-child')
const SEEDED_CHILD_ID = brandString<sessionId>('agent-preset-selection-child')
const SEEDED_CHILD_CREATED_AT = 1784974100100
/** A project skill only a preset that mounts `skill-filesystem` can discover. */
const SKILL_NAME = 'preset-catalog-demo'
+8 -7
View File
@@ -6,8 +6,9 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished, vi } from 'vitest'
import type {} from '@deepseek-ai/dsh-agent-team'
import { SessionId } from '@deepseek-ai/dsh-session'
import { CommandId } from '@deepseek-ai/dsh-commands/brand'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { CommandId } from '@deepseek-ai/dsh-commands/brand'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import {
acknowledgeReloadConnectionLoss, assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
@@ -193,7 +194,7 @@ describe('web e2e: agent teamwork panel', () => {
const agent = scaffold.ctx.agents.list()[0]!
expect(scaffold.ctx.commands.list(agent).some(command => command.name === 'team')).toBe(false)
expect(agent.session.ownEvents().filter(event => event.type === 'command/run' || event.type === 'command/done')).toEqual([])
const other = await scaffold.ctx.agents.create({ sessionId: SessionId('other-team-mode'), agentOptions: agent.options })
const other = await scaffold.ctx.agents.create({ sessionId: brandString<SessionId>('other-team-mode'), agentOptions: agent.options })
expect(scaffold.ctx.agentTeams.isEnabled(other.agent)).toBe(false)
await other.dispose()
const beforeReload = tripwire.warnings.length
@@ -268,7 +269,7 @@ describe('web e2e: agent teamwork panel', () => {
const projectionReads = vi.spyOn(scaffold.ctx.sessionController, 'projections')
onTestFinished(() => { projectionReads.mockRestore() })
const agent = scaffold.ctx.agents.list()[0]!
const memberId = SessionId('team-panel-researcher')
const memberId = brandString<SessionId>('team-panel-researcher')
agent.session.append('subagent/catalog', {
version: 2, childId: memberId, childCreatedAt: Date.now(), mode: 'external',
label: RESEARCHER_DESCRIPTION,
@@ -913,12 +914,12 @@ it.each(RECEIPT_LOCALES)('toggles teamwork in $language without command records
// Historical receipts are read-only fixtures, not invocations of a registered command.
for (const args of [' on', ' off']) {
const commandId = CommandId(`historical-team-${args.trim()}`)
const commandId = brandString<CommandId>(`historical-team-${args.trim()}`)
agent.session.append('command/run', { commandId, name: 'team', args, source: { kind: 'user' } })
agent.session.append('command/done', { commandId, kind: 'success', text: 'Team mode saved.' })
}
agent.session.append('command/run', {
commandId: CommandId('historical-team-pending'), name: 'team', args: ' on', source: { kind: 'user' },
commandId: brandString<CommandId>('historical-team-pending'), name: 'team', args: ' on', source: { kind: 'user' },
})
await scaffold.ctx.sessions.flush(agent.session)
const historicalCommands = commandEvents()
@@ -938,7 +939,7 @@ it.each(RECEIPT_LOCALES)('renders historical Team failures in $language without
await withTeamReceiptPage(locale, async (page, scaffold, tripwire) => {
const agent = scaffold.ctx.agents.list()[0]
if (agent === undefined) throw new Error('Team failure fixture has no Agent')
const commandId = CommandId('historical-team-error')
const commandId = brandString<CommandId>('historical-team-error')
agent.session.append('command/run', { commandId, name: 'team', args: ' invalid', source: { kind: 'user' } })
agent.session.append('command/done', { commandId, kind: 'error', text: 'Use /team on or /team off.' })
await scaffold.ctx.sessions.flush(agent.session)
+7 -6
View File
@@ -8,9 +8,10 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { Agent } from '@deepseek-ai/dsh-agent'
import { ToolCallId } from '@deepseek-ai/dsh-llm'
import { SessionId } from '@deepseek-ai/dsh-session'
import { JobId } from '@deepseek-ai/dsh-jobs'
import type { ToolCallId } from '@deepseek-ai/dsh-llm'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { JobId } from '@deepseek-ai/dsh-jobs'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
@@ -72,7 +73,7 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
// Opening the session drives the Host's ordinary Agent resolution; the
// job owner must be that exact live instance, never a second one.
// `expect.poll` is test-scoped, so this hook polls by hand.
agent = await liveAgent(scaffold, SessionId(SEED_ID))
agent = await liveAgent(scaffold, brandString<SessionId>(SEED_ID))
}, 120_000)
afterAll(async () => {
@@ -90,7 +91,7 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
const started = await executeToolFixture(scaffold.ctx, {
signal: new AbortController().signal,
callId: ToolCallId('background-job-list-e2e'),
callId: brandString<ToolCallId>('background-job-list-e2e'),
name: 'bash',
arguments: { command: COMMAND, description: 'Hold a background slot open', run_in_background: true },
agent,
@@ -98,7 +99,7 @@ describe.skipIf(MODE === 'record')('web e2e: background job list', () => {
const reported = started.content.map(block => block.type === 'text' ? block.text : '').join('')
const matched = /\bbash-[0-9a-f]{16}\b/.exec(reported)
if (matched === null) throw new Error(`background bash reported no job id: ${reported}`)
const jobId = JobId(matched[0])
const jobId = brandString<JobId>(matched[0])
await trigger.waitFor({ timeout: 15_000 })
expect(await trigger.locator('[data-state="ongoing"]').count()).toBe(1)
+5 -4
View File
@@ -4,10 +4,11 @@ import { mkdir } from 'node:fs/promises'
import { join } from 'node:path'
import { chromium, type Browser, type Page } from 'playwright'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionEvent } from '@deepseek-ai/dsh-session'
import { launchWebScaffold, watchConsole, type WebScaffold } from './scaffold.ts'
import { newEnglishPage } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
/** A preset these blank Sessions recorded that the deployment no longer declares. */
const UNDECLARED = 'liangshen'
@@ -91,7 +92,7 @@ describe('web e2e: blank Session reuse under the requested preset', () => {
}
it('reuses a blank recorded under an undeclared preset under the default when startup connects its Workspace', async () => {
const stale = SessionId('blank-undeclared')
const stale = brandString<SessionId>('blank-undeclared')
await storeBlank(stale, 'undeclared', UNDECLARED)
const page = await openPage()
@@ -105,7 +106,7 @@ describe('web e2e: blank Session reuse under the requested preset', () => {
})
it('restores a saved blank under the preset it recorded', async () => {
const picked = SessionId('blank-picked')
const picked = brandString<SessionId>('blank-picked')
await storeBlank(picked, 'picked', 'minimal')
const page = await openPage(picked)
@@ -115,7 +116,7 @@ describe('web e2e: blank Session reuse under the requested preset', () => {
})
it('restores a saved blank under the default once its recorded preset is undeclared', async () => {
const saved = SessionId('saved-undeclared')
const saved = brandString<SessionId>('saved-undeclared')
await storeBlank(saved, 'saved-undeclared', UNDECLARED)
const page = await openPage(saved)
+5 -4
View File
@@ -2,13 +2,14 @@
import { chromium, type Browser, type Page } from 'playwright'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionHandle } from '@deepseek-ai/dsh-session-persistence'
import { launchWebScaffold, watchConsole, type WebScaffold } from './scaffold.ts'
import { newEnglishPage } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const HELD = SessionId('blank-held')
const FREE = SessionId('blank-free')
const HELD = brandString<SessionId>('blank-held')
const FREE = brandString<SessionId>('blank-free')
describe.each([false, true])('web e2e: selected blank writer held: %s', (held) => {
let scaffold: WebScaffold
@@ -66,7 +67,7 @@ describe.each([false, true])('web e2e: selected blank writer held: %s', (held) =
const id = await selected(first)
return id !== undefined && (!held || id !== HELD)
}).toBe(true)
const selectedId = SessionId((await selected(first))!)
const selectedId = brandString<SessionId>((await selected(first))!)
expect(selectedId).not.toBe(FREE)
await expect.poll(() => scaffold.ctx.agents.get(selectedId)).toBeDefined()
if (!held) {
@@ -9,7 +9,8 @@ import { join } from 'node:path'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { ToolCallId, expandAssistantStream, type StreamChunk } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, expandAssistantStream, type StreamChunk } from '@deepseek-ai/dsh-llm'
import type { ReplayEntry, ReplayOverrideDoc } from '@deepseek-ai/dsh-llm-replay'
import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session'
import {
@@ -34,7 +35,7 @@ interface TurnSpec {
readonly firstMarker: string
readonly doneMarker: string
readonly deltas: readonly string[]
readonly callId?: ReturnType<typeof ToolCallId>
readonly callId?: ToolCallId
readonly toolResultMarker?: string
}
@@ -83,7 +84,7 @@ function turnSpec(index: number): TurnSpec {
firstMarker,
doneMarker,
deltas,
callId: ToolCallId(`continuous-chat-tool-${id}`),
callId: brandString<ToolCallId>(`continuous-chat-tool-${id}`),
toolResultMarker: `CONTINUOUS_CHAT_TOOL_RESULT_${id}`,
}
}
+3 -2
View File
@@ -19,10 +19,11 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import { createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { ReplayEntry } from '@deepseek-ai/dsh-llm-replay'
import { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'
import type { SessionId, SessionEvent } from '@deepseek-ai/dsh-session'
import { createChatScrollFixture } from './chat-scroll-fixture.ts'
import { launchWebScaffold, parseSeedFixture, seedSession, watchConsole, webSnapshotMode, type WebScaffold } from './scaffold.ts'
import { newEnglishPage, openSettings } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
declare global {
interface Window {
@@ -248,7 +249,7 @@ async function sendFromOpenedGroup(browser: Browser, id: string, answerParagraph
const tripwire = watchConsole(page)
await page.setViewportSize({ width: 1170, height: 826 })
await page.emulateMedia({ reducedMotion: 'no-preference' })
const session = SessionId(`open-fold-${id}`)
const session = brandString<SessionId>(`open-fold-${id}`)
const { log, search } = seededLog(id, answerParagraphs)
await seedSession(scaffold, log, session)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
+4 -3
View File
@@ -10,7 +10,7 @@ import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import type { ReplayEntry, ReplayOverrideDoc } from '@deepseek-ai/dsh-llm-replay'
import { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'
import type { SessionId, SessionEvent } from '@deepseek-ai/dsh-session'
import { createChatScrollFixture } from './chat-scroll-fixture.ts'
import {
launchWebScaffold,
@@ -20,6 +20,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { conversationContextKey, expandOwningTurnProcess, loadEarlierChatPage, newEnglishPage, saveFailureShot } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const MODE = webSnapshotMode()
const SESSION_ID = 'chat-long-interactions-e2e'
@@ -174,10 +175,10 @@ describe('web e2e: long Chat interaction contract', () => {
it.skipIf(MODE === 'record')('keeps heterogeneous rows and their actions bound to exact semantic identities', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-chat-long-interactions'))
await expect.poll(
() => scaffold.ctx.agents.get(SessionId(SESSION_ID)) !== undefined,
() => scaffold.ctx.agents.get(brandString<SessionId>(SESSION_ID)) !== undefined,
{ timeout: 10_000 },
).toBe(true)
const source = scaffold.ctx.agents.get(SessionId(SESSION_ID))
const source = scaffold.ctx.agents.get(brandString<SessionId>(SESSION_ID))
if (source === undefined) throw new Error('seeded long-history agent is not attached')
const toolUserMarker = FIXTURE.markers.user(TOOL_TURN)
+7 -6
View File
@@ -10,11 +10,12 @@ import type { Browser, Page, Route } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import { ToolCallId, createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { AssistantStreamFrame } from '@deepseek-ai/dsh-agent'
import type { ReplayEntry, ReplayOverrideDoc } from '@deepseek-ai/dsh-llm-replay'
import type { SessionEvent } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, type SessionId } from '@deepseek-ai/dsh-session'
import { createChatScrollFixture, type ChatScrollFixture } from './chat-scroll-fixture.ts'
import {
launchWebScaffold,
@@ -28,7 +29,7 @@ import { expandOwningTurnProcess, newEnglishPage, openSettings, saveFailureShot
const MODE = webSnapshotMode()
const HISTORY_SESSION_ID = 'chat-scroll-history-e2e'
const TOOL_SESSION_ID = SessionId('chat-scroll-tool-e2e')
const TOOL_SESSION_ID = brandString<SessionId>('chat-scroll-tool-e2e')
const RESTORE_SESSION_A_ID = 'chat-scroll-restore-a-e2e'
const RESTORE_SESSION_B_ID = 'chat-scroll-restore-b-e2e'
const REPLAY_CONTEXT_WINDOW = 10_000_000
@@ -39,7 +40,7 @@ const LIVE_TEXT_PROMPT = 'CHAT_SCROLL_LIVE_USER Continue this long conversation
const LIVE_TEXT_FIRST = 'CHAT_SCROLL_LIVE_FIRST'
const LIVE_TEXT_DONE = 'CHAT_SCROLL_LIVE_DONE'
const LIVE_TOOL_PROMPT = 'CHAT_SCROLL_TOOL_USER Run the requested diagnostic and then summarize it.'
const LIVE_TOOL_CALL_ID = ToolCallId('chat-scroll-live-tool-call')
const LIVE_TOOL_CALL_ID = brandString<ToolCallId>('chat-scroll-live-tool-call')
const LIVE_TOOL_RESULT = 'CHAT_SCROLL_LIVE_TOOL_RESULT'
const LIVE_TOOL_FIRST = 'CHAT_SCROLL_TOOL_STREAM_FIRST'
const LIVE_TOOL_DONE = 'CHAT_SCROLL_TOOL_STREAM_DONE'
@@ -47,7 +48,7 @@ const TOOL_READY_FILE = '.chat-scroll-tool-ready'
const TOOL_RELEASE_FILE = '.chat-scroll-tool-release'
const INPUTS_SESSION_ID = 'chat-scroll-inputs-e2e'
const RAIL_SESSION_ID = 'chat-scroll-rail-e2e'
const FLING_SESSION_ID = SessionId('chat-scroll-fling-e2e')
const FLING_SESSION_ID = brandString<SessionId>('chat-scroll-fling-e2e')
const LIVE_FLING_PROMPT = 'CHAT_SCROLL_FLING_USER Keep streaming while I fling back through older output.'
const LIVE_FLING_FIRST = 'CHAT_SCROLL_FLING_STREAM_FIRST'
const LIVE_FLING_DONE = 'CHAT_SCROLL_FLING_STREAM_DONE'
@@ -749,7 +750,7 @@ describe('web e2e: long Chat scroll contract', () => {
yield chunk
}
})
const resolved = await world.scaffold.ctx.sessionController.resolveAgent(SessionId(`visible-fold-${scenario.name}`))
const resolved = await world.scaffold.ctx.sessionController.resolveAgent(brandString<SessionId>(`visible-fold-${scenario.name}`))
if ('error' in resolved) throw resolved.error
// Maintenance keeps the accepted message in the inbox, so its echo folds the earlier work before the Turn starts.
const promptGate = Promise.withResolvers<undefined>()
+5 -4
View File
@@ -2,8 +2,9 @@
// generated through Session so pagination exercises the same event shapes as
// persisted conversations, while unique markers identify semantic rows
// without depending on CSS-module names or virtualizer DOM positions.
import { brandString } from '@deepseek-ai/dsh-brand'
import {
ToolCallId,
type ToolCallId,
createAssistantMessage,
createSystemMessage,
createToolResultMessage,
@@ -12,7 +13,7 @@ import {
import {
SESSION_FORMAT_VERSION,
Session,
SessionId,
type SessionId,
} from '@deepseek-ai/dsh-session'
// Carries the session/title event declaration into this fixture builder.
import type {} from '@deepseek-ai/dsh-session-title'
@@ -114,7 +115,7 @@ function appendToolStep(
): void {
const calls = [1, 2].map((index) => {
const marker = markers.tool(turn, index)
const callId = ToolCallId(`chat-scroll-${suffix(turn)}-${String(index)}`)
const callId = brandString<ToolCallId>(`chat-scroll-${suffix(turn)}-${String(index)}`)
const args = JSON.stringify({
command: `printf '${marker}\\n'`,
description: marker,
@@ -190,7 +191,7 @@ function fixtureLog(session: Session): string {
export function createChatScrollFixture(options: ChatScrollFixtureOptions): ChatScrollFixture {
const turns = options.turns ?? DEFAULT_TURNS
const markers = markerHelpers(options.markerPrefix)
const session = Session.create(SessionId(`chat-scroll-${options.markerPrefix.toLowerCase()}-template`))
const session = Session.create(brandString<SessionId>(`chat-scroll-${options.markerPrefix.toLowerCase()}-template`))
for (let turn = 1; turn <= turns; turn += 1) {
session.append('turn/start', {
@@ -21,8 +21,9 @@ 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 { ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type { JsonValue } from '@deepseek-ai/dsh-util-values'
import type {} from '@deepseek-ai/dsh-session-title'
import {
@@ -210,7 +211,7 @@ const CALLS: GalleryCall[] = [
* the tripwire stays clean; the varying origin is tokenized in the golden).
*/
function galleryFixture(imageUrl: string): string {
const session = Session.create(SessionId('clickable-links-gallery-source'))
const session = Session.create(brandString<SessionId>('clickable-links-gallery-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: text('Assemble the link gallery: write the report and styles, inspect the sources, and summarize.'),
@@ -224,7 +225,7 @@ function galleryFixture(imageUrl: string): string {
session.append('step/start', { turn: 1, step: 1 })
const calls = CALLS.map((call, index) => ({
...call,
callId: ToolCallId(`gallery-${String(index)}`),
callId: brandString<ToolCallId>(`gallery-${String(index)}`),
argsJson: JSON.stringify(call.args),
}))
session.append('assistant/message', {
+5 -4
View File
@@ -9,8 +9,9 @@ import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import * as yaml from 'js-yaml'
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
createAssistantMessage, createMessage, createUserMessage, ToolCallId,
createAssistantMessage, createMessage, createUserMessage, type ToolCallId,
type AssistantStreamRecord, type TokenUsage,
} from '@deepseek-ai/dsh-llm'
import {
@@ -100,7 +101,7 @@ describe('web e2e: Statistics view', () => {
agent.session.append('tool/call', {
turn: 1,
step: 1,
callId: ToolCallId('call-1'),
callId: brandString<ToolCallId>('call-1'),
name: 'read',
arguments: JSON.stringify({ file_path: '/work/notes.md' }),
})
@@ -110,8 +111,8 @@ describe('web e2e: Statistics view', () => {
message: createMessage({
role: 'tool',
content: [{ type: 'text', text: 'one\ntwo' }],
source: { kind: 'tool', callId: ToolCallId('call-1') },
toolCallId: ToolCallId('call-1'),
source: { kind: 'tool', callId: brandString<ToolCallId>('call-1') },
toolCallId: brandString<ToolCallId>('call-1'),
}),
}, { surfaceOp: 'append' })
agent.session.append('step/end', { turn: 1, step: 1 })
+5 -4
View File
@@ -2,8 +2,9 @@
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type { JsonValue } from '@deepseek-ai/dsh-util-values'
import { launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
import { expandTurnProcesses, newEnglishPage, saveFailureShot } from './support.ts'
@@ -28,13 +29,13 @@ function layoutFixture(): string {
name: 'edit', args: { file_path: 'long.txt', old_string: oldText, new_string: newText },
result: 'Edited long.txt', meta: { diffs: [{ path: 'long.txt', oldText, newText }] },
})
const session = Session.create(SessionId('code-card-layout-source'))
const session = Session.create(brandString<SessionId>('code-card-layout-source'))
session.append('turn/start', { turn: 1 })
session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Inspect the source windows and edit the long lines.' }], source: { kind: 'user' },
}), { surfaceOp: 'append' })
session.append('step/start', { turn: 1, step: 1 })
const namedCalls = calls.map((call, index) => ({ ...call, id: ToolCallId(`layout-${index}`), arguments: JSON.stringify(call.args) }))
const namedCalls = calls.map((call, index) => ({ ...call, id: brandString<ToolCallId>(`layout-${index}`), arguments: JSON.stringify(call.args) }))
session.append('assistant/message', {
stream: [], turn: 1, step: 1,
message: createAssistantMessage({
+3 -2
View File
@@ -4,14 +4,15 @@ import { fileURLToPath } from 'node:url'
import { chromium, type Browser, type Page } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, SessionId, SessionSeq } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, type SessionId, SessionSeq } from '@deepseek-ai/dsh-session'
import {
captureStableAria, compareOrRefreshGolden, launchWebScaffold,
watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SESSION_ID = SessionId('cold-inbox-web-e2e')
const SESSION_ID = brandString<SessionId>('cold-inbox-web-e2e')
const PENDING_TEXT = 'Accepted before the Host restarted'
const EXPECTED = fileURLToPath(new URL('./expected/cold-blank-session/queue.expected.md', import.meta.url))
+4 -3
View File
@@ -7,12 +7,13 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { deriveReplayScript } from '@deepseek-ai/dsh-llm-replay'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden, fixtureUserPrompts,
launchWebScaffold, parseSeedFixture, readPersistedEvents, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, openSettings, pinBrowserClock, pinHostClock, saveFailureShot, WEB_FIXTURE_TIME, writeComposerDraft } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/collapse-timing', import.meta.url))
const SEED = fileURLToPath(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url))
@@ -146,7 +147,7 @@ describe.skipIf(MODE === 'record')('web e2e: recorded collapse timing', () => {
const input = page.locator('[data-composer-input]').last()
await writeComposerDraft(page, input, prompt)
await expectProcess(1, true)
const resolved = await scaffold.ctx.sessionController.resolveAgent(SessionId(SEED_ID))
const resolved = await scaffold.ctx.sessionController.resolveAgent(brandString<SessionId>(SEED_ID))
if ('error' in resolved) throw resolved.error
// Maintenance keeps the accepted message in the inbox, so its echo stays before the Turn starts.
const release = Promise.withResolvers<undefined>()
@@ -168,7 +169,7 @@ describe.skipIf(MODE === 'record')('web e2e: recorded collapse timing', () => {
await expect.poll(() => page.locator('[data-streaming="true"]').count(), UI_WAIT).toBe(0)
await expectProcess(1, false)
await expectProcess(2, true)
const persisted = await readPersistedEvents(scaffold, SessionId(SEED_ID))
const persisted = await readPersistedEvents(scaffold, brandString<SessionId>(SEED_ID))
expect(persisted.filter(event => event.type === 'turn/end').map(event => event.data)).toEqual([
{ turn: 1, reason: { kind: 'completed' } },
{ turn: 2, reason: { kind: 'completed' } },
+9 -8
View File
@@ -10,8 +10,9 @@ import type { Browser, CDPSession, Locator, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
ToolCallId,
type ToolCallId,
createAssistantMessage,
createSystemMessage,
createToolResultMessage,
@@ -23,7 +24,7 @@ import type { SessionEvent, SessionSeq } from '@deepseek-ai/dsh-session'
import {
SESSION_FORMAT_VERSION,
Session,
SessionId,
type SessionId,
} from '@deepseek-ai/dsh-session'
// Carries the session/title event declaration into the fixture builder.
import type {} from '@deepseek-ai/dsh-session-title'
@@ -243,7 +244,7 @@ function appendToolStep(
toolCount: number,
): void {
const calls = Array.from({ length: toolCount }, (_, index) => {
const callId = ToolCallId(`perf-call-${String(turn)}-${String(index)}`)
const callId = brandString<ToolCallId>(`perf-call-${String(turn)}-${String(index)}`)
const args = JSON.stringify({
turn,
index,
@@ -332,7 +333,7 @@ function fixtureLog(session: Session): string {
}
function smallSidebarFixture(): string {
const session = Session.create(SessionId('perf-small-template'))
const session = Session.create(brandString<SessionId>('perf-small-template'))
session.append('turn/start', {
turn: 1,
})
@@ -355,7 +356,7 @@ function smallSidebarFixture(): string {
}
function longHistoryFixture(): string {
const session = Session.create(SessionId(LONG_SESSION_ID))
const session = Session.create(brandString<SessionId>(LONG_SESSION_ID))
for (let turn = 1; turn <= LONG_HISTORY_TURNS; turn += 1) {
session.append('turn/start', {
turn,
@@ -482,7 +483,7 @@ function soakTurn(index: number): ConversationTurnSpec {
}
function toolStream(index: number, marker: string): StreamChunk[] {
const callId = ToolCallId(`performance-tool-${marker.toLowerCase()}-${String(index)}`)
const callId = brandString<ToolCallId>(`performance-tool-${marker.toLowerCase()}-${String(index)}`)
const args = JSON.stringify({
command: `printf '${marker}\\n'`,
description: `Emit performance marker ${String(index)}`,
@@ -1342,7 +1343,7 @@ describe('manual web performance: complex workspace and history', () => {
startingTurns: DEFAULT_HISTORY_TURNS,
turnCount: COMPARISON_TURNS,
turnSpec: comparisonTurn,
expectedSessionId: SessionId(LONG_SESSION_ID),
expectedSessionId: brandString<SessionId>(LONG_SESSION_ID),
})
expect(conversation.toolTurns).toBe(2)
console.info(`WEB_PERF_RESULT ${JSON.stringify({
@@ -1388,7 +1389,7 @@ describe('manual web performance: complex workspace and history', () => {
startingTurns: LONG_HISTORY_TURNS,
turnCount: COMPARISON_TURNS,
turnSpec: comparisonTurn,
expectedSessionId: SessionId(LONG_SESSION_ID),
expectedSessionId: brandString<SessionId>(LONG_SESSION_ID),
})
expect(conversation.toolTurns).toBe(2)
console.info(`WEB_PERF_RESULT ${JSON.stringify({
+3 -2
View File
@@ -6,10 +6,11 @@ import { chromium, type Browser, type Locator, type Page } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed, vi } from 'vitest'
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
import { createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import { launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
import { saveFailureShot } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const GIF = Buffer.from('R0lGODdhMAAgAIEAAEtu5gAAAAAAAAAAACwAAAAAMAAgAEAIQQABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bNmQEBADs=', 'base64')
async function menuLabels(menu: Locator): Promise<string[]> {
@@ -20,7 +21,7 @@ async function menuLabels(menu: Locator): Promise<string[]> {
}))
}
function fixture(title: string): string {
const session = Session.create(SessionId('context-menus-source'))
const session = Session.create(brandString<SessionId>('context-menus-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({ content: [{ type: 'text', text: 'Show the output.' }], source: { kind: 'user' } }), { surfaceOp: 'append' })
session.append('session/title', { title, messageSeqs: [user.seq], source: { kind: 'fallback' } })
+3 -2
View File
@@ -3,13 +3,14 @@ import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionId } from '@deepseek-ai/dsh-session/types'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import {
captureStableAria, compareOrRefreshGolden, launchWebScaffold, seedSession, readPersistedEvents, parseSeedFixture, realizeSeedFixture,
watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { expandOwningTurnProcess, newEnglishPage } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/cordis-tool-round/session.v3.jsonl', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/cordis-history/ui.expected.md', import.meta.url))
@@ -39,7 +40,7 @@ describe.skipIf(MODE === 'record')('web e2e: historical Cordis cards', () => {
})
it('renders recorded definition source and lifecycle results without registering retired tools', async () => {
const persisted = await readPersistedEvents(scaffold, SessionId(SEED_ID))
const persisted = await readPersistedEvents(scaffold, brandString<SessionId>(SEED_ID))
const expected = parseSeedFixture(realizeSeedFixture(scaffold, await readFile(FIXTURE, 'utf8'), SEED_ID)).events
const tools = (events: typeof persisted) => events.filter(event => event.type === 'tool/call' || event.type === 'tool/result')
.map(event => ({ type: event.type, data: event.data }))
+8 -7
View File
@@ -5,13 +5,14 @@ import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { chromium, type Browser } from 'playwright'
import { readProfileManifest } from '@deepseek-ai/dsh-app-boot'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-ptc-runtime'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import { load } from 'js-yaml'
import { expect, it, vi } from 'vitest'
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, webSnapshotMode, type WebScaffold } from './scaffold.ts'
import { connectFreshWorkspaceZh, ZH_BROWSER_LOCALE } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
// This fixture exercises the macOS provider’s permission setup.
it.skipIf(process.platform !== 'darwin').each([
@@ -26,7 +27,7 @@ it.skipIf(process.platform !== 'darwin').each([
try {
const patch = join(directory, 'native-fixture.yml')
// Permission inspection fails against this non-helper executable; activation still permits dismissing setup.
await writeFile(patch, JSON.stringify([{ id: 'cua', config: { helperPath: process.execPath } }]))
await writeFile(patch, JSON.stringify([{ id: 'cua-macos', config: { helperPath: process.execPath } }]))
const defaults = join(directory, 'script-defaults')
if (script) {
await mkdir(defaults)
@@ -62,7 +63,7 @@ it.skipIf(process.platform !== 'darwin').each([
let toggle = card.getByRole('switch', { name: '启用 Computer Use', exact: true })
const originalAgent = scaffold.ctx.agents.list()[0]!
const ptcAgent = (await scaffold.ctx.agents.create({
sessionId: SessionId('cua-existing-ptc'),
sessionId: brandString<SessionId>('cua-existing-ptc'),
setup: async (ctx) => { await scaffold.ctx.agentPresets.mount(ctx, 'ptc') },
})).agent
expect(scaffold.ctx.tools.schemas(ptcAgent).some(tool => tool.name === 'cua')).toBe(false)
@@ -136,7 +137,7 @@ it.skipIf(process.platform !== 'darwin').each([
expect(scaffold.ctx.tools.schemas(originalAgent).some(tool => tool.name === 'cua_run_code')).toBe(preset !== 'ptc')
}
const child = await scaffold.ctx.agents.create({
sessionId: SessionId('cua-child'),
sessionId: brandString<SessionId>('cua-child'),
setup: (ctx) => { scaffold.ctx.agentPresets.composeFrom(ctx, ptcAgent.ctx) },
})
expect(scaffold.ctx.tools.schemas(child.agent).some(tool => tool.name === 'cua')).toBe(true)
@@ -161,14 +162,14 @@ it.skipIf(process.platform !== 'darwin').each([
]))
}
const freshDefault = (await scaffold.ctx.agents.create({
sessionId: SessionId('cua-new-default'),
sessionId: brandString<SessionId>('cua-new-default'),
setup: async (ctx) => { await scaffold.ctx.agentPresets.mount(ctx) },
})).agent
expect(scaffold.ctx.agentPresets.composedPreset(freshDefault.ctx)).toBe(initialDefault)
expect(scaffold.ctx.tools.schemas(freshDefault).some(tool => tool.name === 'cua')).toBe(false)
expect(scaffold.ctx.tools.schemas(freshDefault).some(tool => tool.name === 'cua_run_code')).toBe(true)
const fresh = (await scaffold.ctx.agents.create({
sessionId: SessionId('cua-new-ptc'),
sessionId: brandString<SessionId>('cua-new-ptc'),
setup: async (ctx) => { await scaffold.ctx.agentPresets.mount(ctx, 'ptc') },
})).agent
expect(scaffold.ctx.agentPresets.composedPreset(fresh.ctx)).toBe('ptc')
@@ -253,7 +254,7 @@ it.skipIf(process.platform !== 'darwin').each([
expect(scaffold.ctx.agentPresets.composedPreset(originalAgent.ctx)).toBe(initialDefault)
expect(scaffold.ctx.agentPresets.composedPreset(freshDefault.ctx)).toBe(initialDefault)
const confirmed = (await scaffold.ctx.agents.create({
sessionId: SessionId('cua-confirmed-default'),
sessionId: brandString<SessionId>('cua-confirmed-default'),
setup: async (ctx) => { await scaffold.ctx.agentPresets.mount(ctx) },
})).agent
expect(scaffold.ctx.agentPresets.composedPreset(confirmed.ctx)).toBe('ptc')
+4 -3
View File
@@ -3,7 +3,8 @@ import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promis
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { ToolCallId } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { ToolCallId } from '@deepseek-ai/dsh-llm'
import type {} from '@deepseek-ai/dsh-user-approval'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import { chromium, type Browser } from 'playwright'
@@ -35,7 +36,7 @@ it.skipIf(process.platform !== 'darwin')('keeps system requests pending until fr
await writeFile(join(root, 'observe-helper'), '')
const fixturePatch = join(root, 'native-fixture.yml')
// Keep the external helper override above bundle order changes when CUA is re-enabled.
await writeFile(fixturePatch, JSON.stringify([{ id: 'cua', config: { helperPath: helper } }]))
await writeFile(fixturePatch, JSON.stringify([{ id: 'cua-macos', config: { helperPath: helper } }]))
const scaffold = await launchWebScaffold({
profile: { packages: [{ dir: bundle, enabled: true }] },
extraOverlayPath: fixturePatch,
@@ -54,7 +55,7 @@ it.skipIf(process.platform !== 'darwin')('keeps system requests pending until fr
scaffold.ctx.approval.setPolicy(agent, 'never')
// Application consent remains independent of the session's tool-approval policy.
const grant = scaffold.ctx.tools.execute({ agent, signal: new AbortController().signal,
calls: [{ type: 'tool-call', id: ToolCallId('cua-app-approval'), name: 'run_code',
calls: [{ type: 'tool-call', id: brandString<ToolCallId>('cua-app-approval'), name: 'run_code',
arguments: JSON.stringify({ code: 'return await tools.cua({ method: "getApp", params: { selector: "Fixture" } })',
description: 'Request application access' }) }] })
const approval = page.locator('[data-approval-key]')
+5 -4
View File
@@ -16,9 +16,10 @@ import { join } from 'node:path'
import type { Browser, Locator, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { launchWebScaffold, watchConsole, captureStableAria, compareOrRefreshGolden, webSnapshotMode, type WebScaffold } from './scaffold.ts'
import { ZH_BROWSER_LOCALE, connectFreshWorkspaceZh, saveFailureShot } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
/** Points the shipped shared Agent default at this scenario's own route. */
const OVERLAY = fileURLToPath(new URL('./default-model.overlay.yml', import.meta.url))
@@ -39,7 +40,7 @@ describe('web e2e: the composer model switch is the default for later sessions',
/** Create one session and its agent through the same wire face the browser uses. */
const createSession = async (sessionId: string): Promise<string> => {
const response = await scaffold.ctx.sessionController.create({
sessionId: SessionId(sessionId),
sessionId: brandString<SessionId>(sessionId),
cwd: scaffold.workspaceCwd,
})
return response.sessionId
@@ -47,7 +48,7 @@ describe('web e2e: the composer model switch is the default for later sessions',
/** The route the Client derives from the Session projection and Host default. */
const currentOf = (sessionId: string): Promise<unknown> => {
const session = scaffold.ctx.sessions.get(SessionId(sessionId))
const session = scaffold.ctx.sessions.get(brandString<SessionId>(sessionId))
if (session === undefined) throw new Error(`session "${sessionId}" is not live`)
return Promise.resolve(
scaffold.ctx.sessionProjections.snapshot(session).values.modelSelection?.next
@@ -473,7 +474,7 @@ describe('web e2e: the composer model switch is the default for later sessions',
// A session that has already run a turn, spelled as the fact a turn
// leaves behind: its own logged route.
const loggedId = await createSession('default-model-logged')
scaffold.ctx.sessions.get(SessionId(loggedId))?.append('request/header', {
scaffold.ctx.sessions.get(brandString<SessionId>(loggedId))?.append('request/header', {
header: { config: { provider: START_ROUTE, model: START_MODEL } },
reason: 'initial',
})
@@ -2,6 +2,7 @@
- button "Copy"
- status: Completed
- button "Completed in {{duration}}"
- separator "Inherited history above"
- text: FORK_BRANCH_USER Summarize what this branch knows about the reads. {{clock}}
- button "Copy"
- status: Completed
+6 -5
View File
@@ -14,10 +14,11 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import { ToolCallId, createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createAssistantMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { ReplayEntry } from '@deepseek-ai/dsh-llm-replay'
import {
SESSION_FORMAT_VERSION, SessionId, SessionLogOffset, SessionSeq, type SessionEvent, type SessionHeader,
SESSION_FORMAT_VERSION, type SessionId, SessionLogOffset, SessionSeq, type SessionEvent, type SessionHeader,
} from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-system-prompt'
import { sessionFixtureName } from '@deepseek-ai/dsh-session-snapshot'
@@ -277,7 +278,7 @@ function replyEntry(marker: string): ReplayEntry {
function liveLongTurn(prefix: string): ReplayEntry[] {
const entries: ReplayEntry[] = []
for (let step = 1; step <= LIVE_STEPS; step++) {
const id = ToolCallId(`${prefix.toLowerCase()}-read-${step}`)
const id = brandString<ToolCallId>(`${prefix.toLowerCase()}-read-${step}`)
const args = JSON.stringify({ file_path: READ_FILE })
entries.push({ kind: 'chunks', chunks: [
...textChunks(paragraphs(`${prefix}_STEP_${step}`, 10, `${prefix} narration for step ${step}, paragraph`)),
@@ -525,7 +526,7 @@ function sessionKey(scenario: Case): string {
}
async function createChild(scaffold: WebScaffold, parentId: SessionId, scenario: Case): Promise<SessionId> {
const childId = SessionId(`${sessionKey(scenario)}-child`)
const childId = brandString<SessionId>(`${sessionKey(scenario)}-child`)
const createdAt = Date.now() - 30_000
const header: SessionHeader = {
version: SESSION_FORMAT_VERSION, id: childId, createdAt, isSeeded: false, cwd: scaffold.workspaceCwd,
@@ -598,7 +599,7 @@ async function prepareWorld(browser: Browser, scenario: Case, scaffold: WebScaff
await page.addInitScript(installMeasure)
await page.setViewportSize(scenario.surface === 'main' ? { width: 1280, height: 720 } : { width: 1680, height: 900 })
await page.emulateMedia({ reducedMotion: 'no-preference' })
const sessionId = SessionId(sessionKey(scenario))
const sessionId = brandString<SessionId>(sessionKey(scenario))
if (scenario.surface === 'main') {
const fixture = seededFixture(scenario.id, scenario.bodyParagraphs)
await seedSession(scaffold, fixture.log, sessionId)
+3 -2
View File
@@ -9,13 +9,14 @@ import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { StreamChunk } from '@deepseek-ai/dsh-llm'
import type { ReplayEntry } from '@deepseek-ai/dsh-llm-replay'
import { SessionId, type SessionEvent } from '@deepseek-ai/dsh-session'
import type { SessionId, SessionEvent } from '@deepseek-ai/dsh-session'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
launchWebScaffold, parseSeedFixture, seedSession,
watchConsole, webSnapshotMode, selectedSessionFixture, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot, writeComposerDraft } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/fork-mid-turn', import.meta.url))
// Borrowed read-only from its recorded-session owner.
@@ -110,7 +111,7 @@ describe('web e2e: exact-boundary fork seeds branch closers and continues', () =
expect(response.ok).toBe(true)
const body = await response.json() as { result: { ok: boolean; value?: { sessionId: string } } }
expect(body.result.ok).toBe(true)
childId = SessionId(body.result.value!.sessionId)
childId = brandString<SessionId>(body.result.value!.sessionId)
const child = scaffold.ctx.sessions.get(childId)
if (child === undefined) throw new Error('fork did not publish a live child session')
+7 -6
View File
@@ -7,9 +7,10 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { Agent } from '@deepseek-ai/dsh-agent'
import { ToolCallId } from '@deepseek-ai/dsh-llm'
import { SessionId } from '@deepseek-ai/dsh-session'
import { JobId } from '@deepseek-ai/dsh-jobs'
import type { ToolCallId } from '@deepseek-ai/dsh-llm'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { JobId } from '@deepseek-ai/dsh-jobs'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
assertFixtureInventory, compareOrRefreshGolden, launchWebScaffold, seedSession,
watchConsole, webSnapshotMode, type WebScaffold,
@@ -19,7 +20,7 @@ import { newEnglishPage, saveFailureShot } from './support.ts'
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/fresh-round-trip/session.v3.jsonl', import.meta.url))
const EXPECTED_DIR = fileURLToPath(new URL('./expected/jobs-menu-layering', import.meta.url))
const MODE = webSnapshotMode()
const SEED_ID = SessionId('jobs-menu-layering-web-e2e')
const SEED_ID = brandString<SessionId>('jobs-menu-layering-web-e2e')
// The private scaffold cwd owns the barrier; the loop bounds an orphan's lifetime.
const RELEASE = '.jobs-menu-layering.release'
const COMMAND = `printf 'jobs-menu-%s\\n' output; for _ in $(seq 1 3000); do [ -e ${RELEASE} ] && break; sleep 0.2; done`
@@ -120,7 +121,7 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
agent = opened
const started = await executeToolFixture(scaffold.ctx, {
signal: new AbortController().signal,
callId: ToolCallId('jobs-menu-layering-e2e'),
callId: brandString<ToolCallId>('jobs-menu-layering-e2e'),
name: 'bash',
arguments: { command: COMMAND, description: 'Emit output and hold the jobs menu fixture', run_in_background: true },
agent,
@@ -128,7 +129,7 @@ describe.skipIf(MODE === 'record')('web e2e: jobs menu layering', () => {
const reported = started.content.map(block => block.type === 'text' ? block.text : '').join('')
const matched = /\bbash-[0-9a-f]{16}\b/.exec(reported)
if (matched === null) throw new Error(`background bash reported no job id: ${reported}`)
const startedJobId = JobId(matched[0])
const startedJobId = brandString<JobId>(matched[0])
jobId = startedJobId
// Registration precedes shell startup; inspect its output before depending on a live row.
await expect.poll(() => {
+7 -6
View File
@@ -10,9 +10,10 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { Agent } from '@deepseek-ai/dsh-agent'
import { ToolCallId } from '@deepseek-ai/dsh-llm'
import { SessionId } from '@deepseek-ai/dsh-session'
import { JobId } from '@deepseek-ai/dsh-jobs'
import type { ToolCallId } from '@deepseek-ai/dsh-llm'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { JobId } from '@deepseek-ai/dsh-jobs'
import { brandString } from '@deepseek-ai/dsh-brand'
import {
assertFixtureInventory, captureStableAria, compareOrRefreshGolden,
launchWebScaffold, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
@@ -73,7 +74,7 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
// Opening the session drives the Host's ordinary Agent resolution; the
// job owner must be that exact live instance, never a second one.
agent = await liveAgent(scaffold, SessionId(SEED_ID))
agent = await liveAgent(scaffold, brandString<SessionId>(SEED_ID))
}, 120_000)
afterAll(async () => {
@@ -90,7 +91,7 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
const started = await executeToolFixture(scaffold.ctx, {
signal: new AbortController().signal,
callId: ToolCallId('live-job-stream-e2e'),
callId: brandString<ToolCallId>('live-job-stream-e2e'),
name: 'bash',
arguments: { command: COMMAND, description: 'Emit one live line then hold', run_in_background: true },
agent,
@@ -98,7 +99,7 @@ describe.skipIf(MODE === 'record')('web e2e: live job stream', () => {
const reported = started.content.map(block => block.type === 'text' ? block.text : '').join('')
const matched = /\bbash-[0-9a-f]{16}\b/.exec(reported)
if (matched === null) throw new Error(`background bash reported no job id: ${reported}`)
const jobId = JobId(matched[0])
const jobId = brandString<JobId>(matched[0])
await expect.poll(() => {
const job = scaffold.ctx.jobs.get(jobId, agent.id)
const output = scaffold.ctx.jobs.readAt(jobId, 0, agent.id).chunks.map(chunk => chunk.text).join('')
+3 -2
View File
@@ -3,7 +3,7 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import {
assertFixtureInventory,
@@ -16,6 +16,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/markdown-cjk-strong', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/markdown-cjk-strong/ui.expected.md', import.meta.url))
@@ -35,7 +36,7 @@ const CASES = [
/** Build one settled assistant reply covering CJK-adjacent strong punctuation boundaries. */
function markdownFixture(): string {
const session = Session.create(SessionId('markdown-cjk-strong-source'))
const session = Session.create(brandString<SessionId>('markdown-cjk-strong-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Render adjacent CJK strong emphasis.' }],
+6 -5
View File
@@ -4,8 +4,9 @@ import { basename, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { chromium, type Browser, type Locator, type Page } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createAssistantMessage, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import { sessionFileAddress } from '@deepseek-ai/dsh-util-workspace-path'
import type {} from '@deepseek-ai/dsh-session-title'
import {
@@ -26,14 +27,14 @@ async function reloadPreview(page: Page, column: Locator, absolutePath: string):
/** Build live test input with a parent-path link and a read result naming the same Host file. */
function parentPathFixture(path: string): string {
const session = Session.create(SessionId('parent-file-links-source'))
const session = Session.create(brandString<SessionId>('parent-file-links-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Read the parent-path file and link lines 24 and 30.' }], source: { kind: 'user' },
}), { surfaceOp: 'append' })
session.append('session/title', { title: 'Parent file links', messageSeqs: [user.seq], source: { kind: 'fallback' } })
session.append('step/start', { turn: 1, step: 1 })
const callId = ToolCallId('parent-file-read')
const callId = brandString<ToolCallId>('parent-file-read')
const args = JSON.stringify({ file_path: path, offset: 24, limit: 7 })
session.append('assistant/message', {
turn: 1, step: 1, stream: [],
@@ -70,7 +71,7 @@ function parentPathFixture(path: string): string {
/** Build a settled turn whose relative link follows a directory change into a nested checkout. */
function changedDirectoryFixture(path: string): string {
const session = Session.create(SessionId('changed-directory-links-source'))
const session = Session.create(brandString<SessionId>('changed-directory-links-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Enter the worktree and link its notes.' }], source: { kind: 'user' },
+3 -2
View File
@@ -6,10 +6,11 @@ import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { createLaunchEnvironmentSnapshot } from '@deepseek-ai/dsh-launch-environment'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import { launchWebScaffold, seedSession, watchConsole, type WebScaffold } from './scaffold.ts'
import { newEnglishPage, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const ALT = 'Rewritten chart'
const chart = (width: number, color: string): string =>
@@ -17,7 +18,7 @@ const chart = (width: number, color: string): string =>
/** Build one closed session whose reply shows `{{cwd}}/chart.svg`. */
function chartFixture(title: string): string {
const session = Session.create(SessionId('markdown-image-refresh-source'))
const session = Session.create(brandString<SessionId>('markdown-image-refresh-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Draw the chart.' }],
+3 -2
View File
@@ -10,7 +10,7 @@ import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import {
SESSION_FORMAT_VERSION,
Session,
SessionId,
type SessionId,
} from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import {
@@ -24,6 +24,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, pinBrowserClock, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/markdown-images', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/markdown-images/ui.expected.md', import.meta.url))
@@ -82,7 +83,7 @@ async function stopServer(server: Server): Promise<void> {
/** Build one closed session fixture with remote and local image Markdown. */
function markdownImageFixture(remoteUrl: string, outsidePath: string): string {
const session = Session.create(SessionId('markdown-image-source'))
const session = Session.create(brandString<SessionId>('markdown-image-source'))
const eventTimeOrigin = new Date().setHours(12, 0, 0, 0)
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
@@ -3,7 +3,7 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import {
assertFixtureInventory,
@@ -16,6 +16,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/markdown-inline-code-links', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/markdown-inline-code-links/ui.expected.md', import.meta.url))
@@ -26,7 +27,7 @@ const LINK_URL = 'http://127.0.0.1:3199/?demo=1'
/** Build a settled assistant reply with linkable URL code and inert code controls. */
function markdownFixture(linkUrl: string): string {
const session = Session.create(SessionId('markdown-inline-code-links-source'))
const session = Session.create(brandString<SessionId>('markdown-inline-code-links-source'))
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
content: [{ type: 'text', text: 'Show the local preview URL.' }],
+3 -2
View File
@@ -26,7 +26,7 @@ import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import {
SESSION_FORMAT_VERSION,
Session,
SessionId,
type SessionId,
} from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import {
@@ -39,6 +39,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/markdown-wide-table', import.meta.url))
const GEOMETRY_EXPECTED = fileURLToPath(
@@ -113,7 +114,7 @@ function tablesMarkdown(): string {
/** Build one closed session fixture carrying the tables. */
function wideTableFixture(): string {
const session = Session.create(SessionId('markdown-wide-table-source'))
const session = Session.create(brandString<SessionId>('markdown-wide-table-source'))
const eventTimeOrigin = new Date().setHours(12, 0, 0, 0)
session.append('turn/start', { turn: 1 })
const user = session.append('user/message', createUserMessage({
+3 -2
View File
@@ -3,7 +3,7 @@ import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { createMessage, createUserMessage } from '@deepseek-ai/dsh-llm'
import { SESSION_FORMAT_VERSION, Session, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-title'
import {
assertFixtureInventory,
@@ -16,6 +16,7 @@ import {
type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/math-rendering', import.meta.url))
const UI_EXPECTED = fileURLToPath(new URL('./expected/math-rendering/ui.expected.md', import.meta.url))
@@ -25,7 +26,7 @@ const DONE = 'MATH_RENDERING_DONE'
/** Build a settled assistant reply that exercises every supported math delimiter. */
function mathFixture(): string {
const session = Session.create(SessionId('math-rendering-source'))
const session = Session.create(brandString<SessionId>('math-rendering-source'))
session.append('turn/start', {
turn: 1,
})
+4 -3
View File
@@ -10,12 +10,13 @@ import { zstdCompressSync } from 'node:zlib'
import type { Browser, Page, Request as BrowserRequest } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { SESSION_FORMAT_VERSION, SessionId } from '@deepseek-ai/dsh-session'
import { SESSION_FORMAT_VERSION, type SessionId } from '@deepseek-ai/dsh-session'
import {
acknowledgeReloadConnectionLoss, assertFixtureInventory, captureStableAria, compareOrRefreshGolden, fixtureUserPrompts,
launchWebScaffold, parseSeedFixture, realizeSeedFixture, renderSeedFixture, seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { openSettings, newEnglishPage, pinBrowserClock, pinHostClock, saveFailureShot, WEB_FIXTURE_TIME } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
const SNAPSHOT_DIR = fileURLToPath(new URL('../../../snapshots/web/message-actions', import.meta.url))
// Borrowed read-only: this scenario needs any settled user+assistant pair, not
@@ -439,7 +440,7 @@ describe('web e2e: message IconActions and clocks on settled history', () => {
it.skipIf(MODE === 'record')('forks an unopened current-format Session from its sidebar row', async () => {
onTestFailed(() => saveFailureShot(page, 'screenshots/non-migrating-session-reads/current-cold-fork'))
const id = SessionId('message-actions-current-cold')
const id = brandString<SessionId>('message-actions-current-cold')
await seedSession(scaffold, completedTailFixture(await readFile(SEED, 'utf8')), id)
const warningStart = tripwire.warnings.length
await page.reload({ waitUntil: 'load' })
@@ -459,7 +460,7 @@ describe('web e2e: message IconActions and clocks on settled history', () => {
it.skipIf(MODE === 'record')('guides only a migration-required sidebar fork to opening its source', async () => {
onTestFailed(() => saveFailureShot(page, 'screenshots/non-migrating-session-reads/migration-required-fork'))
const id = SessionId('message-actions-needs-migration')
const id = brandString<SessionId>('message-actions-needs-migration')
const [header, ...events] = realizeSeedFixture(scaffold, await readFile(SEED, 'utf8'), id).trimEnd().split('\n')
.map((line): Record<string, unknown> => JSON.parse(line) as Record<string, unknown>)
expect(header?.version).toBe(3)
+4 -3
View File
@@ -5,13 +5,14 @@ import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import type { Browser, Page } from 'playwright'
import { chromium } from 'playwright'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import {
acknowledgeReloadConnectionLoss, launchWebScaffold,
seedSession, watchConsole, webSnapshotMode, type WebScaffold,
} from './scaffold.ts'
import { newEnglishPage, saveFailureShot, scrollIntoView } from './support.ts'
import { brandString } from '@deepseek-ai/dsh-brand'
// Borrowed read-only: this scenario needs any settled assistant message to
// address, not a new recording (message-actions / sidebar-scrollbar pattern).
@@ -121,7 +122,7 @@ describe('web e2e: durable per-message feedback', () => {
await expect.poll(() => restored.getAttribute('aria-pressed'), { timeout: 15_000 }).toBe('true')
// The retract label sits on the Dislike side: the Like stays unpressed.
await expect.poll(() => cold.getAttribute('aria-pressed'), { timeout: 10_000 }).toBe('false')
const agent = scaffold.ctx.agents.get(SessionId(SEED_ID))
const agent = scaffold.ctx.agents.get(brandString<SessionId>(SEED_ID))
if (agent === undefined) throw new Error('seeded session did not attach an agent')
const puts = agent.session.snapshotEvents().filter(event => event.type === 'feedback/message-put')
expect(puts.map(event => event.type === 'feedback/message-put' ? event.data.item : undefined)).toMatchObject([
@@ -148,7 +149,7 @@ describe('web e2e: durable per-message feedback', () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-header-feedback'))
await openSeededSession()
await page.getByText('DONE', { exact: true }).waitFor({ timeout: 30_000 })
const agent = scaffold.ctx.agents.get(SessionId(SEED_ID))
const agent = scaffold.ctx.agents.get(brandString<SessionId>(SEED_ID))
if (agent === undefined) throw new Error('seeded session did not attach an agent')
const feedbackEvents = () => agent.session.snapshotEvents().filter(event => event.type.startsWith('feedback/'))
const before = feedbackEvents().length
+11 -10
View File
@@ -7,9 +7,10 @@ import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import type { AgentHandle } from '@deepseek-ai/dsh-agent'
import type { SessionAttachmentValue } from '@deepseek-ai/dsh-api-session-controller'
import { ToolCallId, createUserMessage } from '@deepseek-ai/dsh-llm'
import { brandString } from '@deepseek-ai/dsh-brand'
import { type ToolCallId, createUserMessage } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions } from '@deepseek-ai/dsh-llm'
import { SessionId } from '@deepseek-ai/dsh-session'
import type { SessionId } from '@deepseek-ai/dsh-session'
import type { Session } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import type {} from '@deepseek-ai/dsh-system-prompt'
@@ -57,7 +58,7 @@ describe('minimal agent preset', () => {
text: 'THIS TEXT MUST NOT REACH THE MODEL.',
})
agentHandle = await scaffold.ctx.agents.create({
sessionId: SessionId('minimal-preset-smoke'),
sessionId: brandString<SessionId>('minimal-preset-smoke'),
meta: { cwd: scaffold.workspaceCwd, agentPreset: 'minimal' },
agentOptions: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
setup: agentCtx => scaffold.ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
@@ -105,14 +106,14 @@ describe('minimal agent preset', () => {
const signal = new AbortController().signal
await executeToolFixture(scaffold.ctx, {
signal,
callId: ToolCallId('minimal-bash-state-setup'),
callId: brandString<ToolCallId>('minimal-bash-state-setup'),
name: 'bash',
arguments: { command: `cd ${JSON.stringify(stateDir)} && export DSH_MINIMAL_STATE=PERSISTED` },
agent: agentHandle.agent,
})
const bash = await executeToolFixture(scaffold.ctx, {
signal,
callId: ToolCallId('minimal-bash-state-read'),
callId: brandString<ToolCallId>('minimal-bash-state-read'),
name: 'bash',
arguments: { command: 'printf \'%s:%s\n\' "$DSH_MINIMAL_STATE" "$PWD"' },
agent: agentHandle.agent,
@@ -226,7 +227,7 @@ describe('minimal manual compaction', () => {
yield* next()
})
handle = await scaffold.ctx.agents.create({
sessionId: SessionId('minimal-compact-smoke'),
sessionId: brandString<SessionId>('minimal-compact-smoke'),
meta: { cwd: scaffold.workspaceCwd, agentPreset: 'minimal' },
agentOptions: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
setup: agentCtx => scaffold.ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
@@ -370,7 +371,7 @@ describe('minimal image reading', () => {
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC', 'base64',
))
handle = await scaffold.ctx.agents.create({
sessionId: SessionId('minimal-image-smoke'),
sessionId: brandString<SessionId>('minimal-image-smoke'),
meta: { cwd: scaffold.workspaceCwd, agentPreset: 'minimal' },
agentOptions: { provider: 'deepseek-official', model: 'deepseek-v4-flash-vision-exp' },
setup: agentCtx => scaffold.ctx.agentPresets.mount(agentCtx, 'minimal').then(() => undefined),
@@ -420,7 +421,7 @@ describe('minimal image reading', () => {
it.skipIf(MODE === 'record')('reads image bytes and preserves the supplied reference with another Session as the gateway scope', async () => {
const image = handle.agent.session.deriveMessages().flatMap(message => message.content).find(block => block.type === 'image')
if (image?.type !== 'image') throw new Error('minimal read_image produced no durable image')
const unrelated = await scaffold.ctx.agents.create({ sessionId: SessionId('minimal-image-unrelated') })
const unrelated = await scaffold.ctx.agents.create({ sessionId: brandString<SessionId>('minimal-image-unrelated') })
try {
expect(unrelated.agent.session.deriveMessages().flatMap(message => message.content).some(block => block.type === 'image')).toBe(false)
const read = async (attachment: unknown, rpcId: string) => {
@@ -473,7 +474,7 @@ describe('minimal image reading', () => {
// User-only interrupted turns move the recorded image beyond the 50-message initial page without inventing model output.
const laterTurns = Array.from({ length: 52 }, (_, index) =>
interruptedTurn(index + 2, `Later image-history message ${index + 2}`))
const historicalId = SessionId('minimal-image-cold')
const historicalId = brandString<SessionId>('minimal-image-cold')
await seedSession(scaffold, `${recorded}${laterTurns[0]}\n`, historicalId, 'minimal')
expect(scaffold.ctx.agents.get(historicalId)).toBeUndefined()
page = await openSession(historicalId)
@@ -500,7 +501,7 @@ describe('minimal image reading', () => {
const body = await response.json() as { result: { ok: boolean; value?: { sessionId: string } } }
expect(body.result.ok).toBe(true)
if (body.result.value === undefined) throw new Error('image fork did not return a Session ID')
page = await openSession(SessionId(body.result.value.sessionId))
page = await openSession(brandString<SessionId>(body.result.value.sessionId))
card = await imageCard(page)
await expect.poll(() => card.locator('img').first().evaluate(img => img instanceof HTMLImageElement && img.naturalWidth)).toBe(1)
})
Loaded 100 of 1453 files, more files were not shown because too many files have changed in this diff. Show more