Merge remote-tracking branch 'origin/master' into refactor/llm-route-credential
master moved internal identity construction to brandString (#8214) and added the empty-catch gate with its recorded baseline (#4862); both touch files this branch changes or moves. Conflicts: - packages/llm/llm-deepseek/tests/adapter.spec.ts, packages/llm/llm-deepseek-account/tests/provider.spec.ts, packages/experimental/translator/tests/paid-fixture.ts, and packages/web/web-search-deepseek/tests/deepseek.spec.ts: master rewrote the id constructor calls to brandString<T>() with type-only imports, while this branch replaced the hand-built account stand-ins with accountStub. The result keeps master's id construction and imports and this branch's stand-ins; the one Session this branch's own search test creates follows master's construction. - packages/web/web-deepseek-api/package.json and packages/web/web-search-deepseek/package.json: this branch's sorted devDependencies plus master's dsh-brand entry. - docs/capability-seams.md and docs/capability-seams.zh.md: master's cuaPrograms consumer edge and this branch's deepseekAccount consumer edges coexist; the pairing record is recorded again from the merged pair. - docs/module-graph.md, docs/module-graph.zh.md, docs/persistence-schema.json, and pnpm-lock.yaml: regenerated from the merged sources. Beyond the conflicts: - scripts/empty-catch.baseline.json: master recorded two clauses under packages/credentials/deepseek-account, which this branch moves to packages/account/deepseek-account. The two keys are renamed with the files, as the gate requires for a moved file. - AGENTS.md: master's checker link and this branch's account/ layout row together exceeded the frozen 2,080-word ceiling by one word, so the row reads "account/ DeepSeek".
This commit is contained in:
commit
f4ac78bb34
1923 files changed
+22997
-25323
No files matched your search
+6
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/archived/architecture/2026-07-31-ptc-runtime-python-fd3-protocol.md
|
||||
2026-07-31-ptc-runtime-python-fd3-protocol.md: 514f4dd7c7b214e95474e9f5d9c7ba6af4bfeb8b
|
||||
2026-07-31-ptc-runtime-python-fd3-protocol.zh.md: e959dd75491ed1dd1e66f9ca4de856712054e31c
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
# Agent Note: the ptc-runtime-python fd-3 frame protocol
|
||||
|
||||
Status: implemented
|
||||
Archived: 2026-11-11
|
||||
|
||||
The CPython PTC runtime lives at `packages/experimental/ptc-runtime-python` and publishes as `@deepseek-ai/dsh-experimental-ptc-runtime-python`; the [publication policy](../../../../packages/experimental/README.md) preserves its experimental status.
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
# Agent Note: the ptc-runtime-python fd-3 frame protocol
|
||||
|
||||
Status: implemented
|
||||
Archived: 2026-11-11
|
||||
|
||||
CPython PTC 运行时位于 `packages/experimental/ptc-runtime-python`,以 `@deepseek-ai/dsh-experimental-ptc-runtime-python` 名称发布;[发布策略](../../../../packages/experimental/README.zh.md)保留其实验性状态。
|
||||
|
||||
@@ -220,6 +220,9 @@
|
||||
"architecture/2026-07-31-code-runtime-portable-identifier-seam.i18n.yaml": "sha256:e243a62d3b468b6a65c80b284fe934fad09099a42d33c1dca47f435427a851b7",
|
||||
"architecture/2026-07-31-code-runtime-portable-identifier-seam.md": "sha256:d7a050d3a654b7b0445b8dbe6e87331bbd91ce0bf6ad23c6d83ee32ada85fc2f",
|
||||
"architecture/2026-07-31-code-runtime-portable-identifier-seam.zh.md": "sha256:286c53e0000bd0a109b67bf3ce5f190197fa674f103075461168768d78ea6770",
|
||||
"architecture/2026-07-31-ptc-runtime-python-fd3-protocol.i18n.yaml": "sha256:dc4a9f7f26a6cc8d27499f6bc4da505a5be72c5c1d2ded93adcbbbfe818860d7",
|
||||
"architecture/2026-07-31-ptc-runtime-python-fd3-protocol.md": "sha256:a6525121a528190309ad1da498f919676355d7bbff90875800c6f33c31ff93fa",
|
||||
"architecture/2026-07-31-ptc-runtime-python-fd3-protocol.zh.md": "sha256:fa381eb718c9c4c78e40be9b1930a9b0b6571bf0be446bcc4f784228c0ef32b8",
|
||||
"architecture/2026-08-01-packaged-ripgrep-search.i18n.yaml": "sha256:43c9128079955e974fe1da3ce1a10779b4f5a25ac3629f92e3b1de847ad45050",
|
||||
"architecture/2026-08-01-packaged-ripgrep-search.md": "sha256:36cf2d6daa654abced690965338aec4628069dc77be3a1da6368a9b097a59ff4",
|
||||
"architecture/2026-08-01-packaged-ripgrep-search.zh.md": "sha256:45b2fe8e0d492eeff313d2ef3c98fd69761b3257eee3476b8bf53312e8b6095f",
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
# Bilingual-pair consistency record for 2026-07-31-ptc-runtime-python-fd3-protocol.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-07-31-ptc-runtime-python-fd3-protocol.md
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol:
|
||||
en: 0130850e16ce6f60
|
||||
zh: 7b70b03b5019277f
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/problem:
|
||||
en: 2c36946bbff637b7
|
||||
zh: f290de0866ba7caa
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/decision:
|
||||
en: f0d0d5ba5a9066ad
|
||||
zh: fbdab3731c33eb26
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/wire-contract:
|
||||
en: 1225a32af91fcf84
|
||||
zh: 1dab4ecbd9ff7e34
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/mirror-alignment:
|
||||
en: 26128b65f2763920
|
||||
zh: df24359faebcbfed
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/alternatives-considered:
|
||||
en: 2f52b91980d013ed
|
||||
zh: 12dc9a24c03c3c68
|
||||
/agent-note-the-ptc-runtime-python-fd-3-frame-protocol/consequences:
|
||||
en: 16df6efd46d71e85
|
||||
zh: 4062475bec04ab5f
|
||||
+10
-10
@@ -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
|
||||
|
||||
+7
-6
@@ -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.
|
||||
|
||||
|
||||
+7
-6
@@ -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。
|
||||
|
||||
|
||||
+2
-2
@@ -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]
|
||||
|
||||
+3
-3
@@ -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]
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
en: d6b9c22603a4f933
|
||||
zh: f324b91830078d9a
|
||||
/agent-note-sandboxed-node-execution-for-ptc/decision/resolved-inputs-and-policy:
|
||||
en: 3aef37bb4f8a8e53
|
||||
zh: a7b477324d486ab3
|
||||
en: e544f1a5b7f5b0ec
|
||||
zh: 3195e0008313a5c6
|
||||
/agent-note-sandboxed-node-execution-for-ptc/decision/control-and-lifetime:
|
||||
en: a8897bae00f5f674
|
||||
zh: 2c959353c5a885a4
|
||||
|
||||
@@ -22,8 +22,6 @@ The host preserves `ELECTRON_RUN_AS_NODE` for child startup; the bootstrap remov
|
||||
|
||||
File mode, observed denial and enforcement completeness travel in `PtcRunResult.sandbox` separately from the program outcome. Restricted execution fails if the required sandbox backend cannot launch. Full access is an explicit policy mode. Program success does not prove full enforcement, and neither the `process` descriptor nor the extra control pipe claims multi-tenant isolation.
|
||||
|
||||
The [experimental Python provider](../../../../packages/experimental/ptc-runtime-python/README.md) shares the resolved file policy and sandbox diagnostics while retaining its local Unix execution and configured wall deadline. Per-call timeout overrides remain unsupported.
|
||||
|
||||
### Control and lifetime
|
||||
|
||||
The subprocess owner supplies a dedicated inherited binary control channel, separate from program stdout/stderr and launcher lifecycle IPC. The host bounds frames, queued writes, pending calls and outstanding argument bytes, then validates call identity and the binding allowlist before dispatch. Model code can write to that channel, so its bytes remain untrusted.
|
||||
|
||||
@@ -22,8 +22,6 @@ Host 在子进程启动时保留 `ELECTRON_RUN_AS_NODE`;bootstrap 在求值前
|
||||
|
||||
文件模式、观察到的拒绝与强制完整性通过 `PtcRunResult.sandbox` 独立于程序结果传递。所需沙箱后端无法启动时,受限执行失败。完整访问是显式策略模式。程序成功不证明完整强制能力,`process` 描述符与额外控制管道也不声明多租户隔离。
|
||||
|
||||
[实验性 Python 提供方](../../../../packages/experimental/ptc-runtime-python/README.zh.md)共享已解析文件策略与沙箱诊断,同时保留本地 Unix 执行和配置的经过时间截止。仍不支持单次 timeout 覆盖。
|
||||
|
||||
### 控制与生命周期
|
||||
|
||||
子进程所有者提供专用的继承式二进制控制通道,与程序 stdout/stderr 及 launcher 生命周期 IPC 分开。Host 限制帧、排队写入、待处理调用和未完成参数字节,然后在分派前验证调用身份与绑定允许列表。模型代码可以写入该通道,因此其中字节仍不可信。
|
||||
|
||||
+4
-4
@@ -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 已消失。更新规则如下:
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@
|
||||
en: 2ba6c43b20a3d347
|
||||
zh: 5647179ddaa38ad9
|
||||
/agent-note-ship-experimental-capabilities-as-optional-bundles/decision:
|
||||
en: 191ca8bffb101db2
|
||||
zh: 1365bef5cd830a5c
|
||||
en: b11a4c9cb060d4bb
|
||||
zh: a5250cfaba937e71
|
||||
/agent-note-ship-experimental-capabilities-as-optional-bundles/alternatives-considered:
|
||||
en: d6f40bf02df37ab7
|
||||
zh: e5b85ce9d41e8754
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ The Web plugin page offered two optional bundles, Agent Teams and voice input. A
|
||||
|
||||
`OPTIONAL_BUNDLES` owns the installation's default-off selections, including maintained optional capabilities and experimental capabilities. Every bundle declares `icon` and exports `./locale/*.json` with `meta.title` and `meta.description`; the [plugin manager page](../../../../packages/client/ui-plugin-manager/README.md#use-this-package) displays that metadata for eligible bundles and retains explicit activation for default-hidden ones. A bundle's presentation does not determine its [experimental status](../../../../packages/experimental/README.md#status). The isolation check validates admission and still rejects experimental dependencies of nonexperimental bundles.
|
||||
|
||||
An optional bundle's dependencies are downloaded with every `dsh` installation. [Reasoning translation](2026-10-05-anonymous-reasoning-translation.md) uses three experimental packages without adding third-party runtime dependencies. Admission therefore considers installation cost and whether a switch supplies a usable composition without an additional configuration form. External browser and Cua Driver providers remain explicit compositions because they add substantial runtimes or require an external executable. Stagehand requires model credentials; Python PTC replaces a core provider and conflicts with TypeScript workflow consumers. Demonstrative hooks, webhooks, and mods stay outside the list. [Session Inspector](../feature/2026-09-24-session-inspector.md) owns the Inspector's distinct activation behavior.
|
||||
An optional bundle's dependencies are downloaded with every `dsh` installation. [Reasoning translation](2026-10-05-anonymous-reasoning-translation.md) uses three experimental packages without adding third-party runtime dependencies. Admission therefore considers installation cost and whether a switch supplies a usable composition without an additional configuration form. External browser and Cua Driver providers remain explicit compositions because they add substantial runtimes or require an external executable. Stagehand requires model credentials. Demonstrative hooks, webhooks, and mods stay outside the list. [Session Inspector](../feature/2026-09-24-session-inspector.md) owns the Inspector's distinct activation behavior.
|
||||
|
||||
Bundles insert ordinary Host rows; optional model tools register in the global tool layer, so every preset, including minimal, receives them. Plugin management, profile composition, and reload need no bundle-specific behavior. Search, Ralph, and terminals supply their own isolated services in a Host group. Search opens one in-memory index on demand; the Host search policy stays unchanged. Badge skills and title providers act on the Host. Switching a bundle registers or removes its tools for live Agents, and later user patch layers retain precedence. A replacement title provider may register once the previous provider's disposal starts; the previous provider's late results never commit.
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ Web 插件页只提供两个可选 bundle:Agent Teams 与语音输入。Auto r
|
||||
|
||||
`OPTIONAL_BUNDLES` 管理安装随附且默认关闭的选项,包括维护中的可选能力与实验性能力。每个 bundle 声明 `icon`,并导出带 `meta.title` 与 `meta.description` 的 `./locale/*.json`;[插件管理页](../../../../packages/client/ui-plugin-manager/README.zh.md#use-this-package)为符合展示条件的组合包显示这些元数据,并保留默认隐藏项的显式启用入口。Bundle 的展示方式不决定其[实验性状态](../../../../packages/experimental/README.zh.md#status)。隔离检查校验准入,并继续拒绝非实验 bundle 的实验性依赖。
|
||||
|
||||
可选 bundle 的依赖随每次 `dsh` 安装下载。[思考过程翻译](2026-10-05-anonymous-reasoning-translation.zh.md)使用三个实验包,不增加第三方运行时依赖。因此准入需要考虑安装成本,以及开关能否在不增加配置表单的情况下提供可用组合。外部浏览器与 Cua Driver 提供方仍使用显式组合,因为它们会增加较大的运行时或要求外部可执行文件。Stagehand 需要模型凭据;Python PTC 替换核心提供方,并与 TypeScript workflow 消费方冲突。演示性钩子、webhook 与模组不进入名单。[Session Inspector](../feature/2026-09-24-session-inspector.zh.md) 管理 Inspector 特有的激活行为。
|
||||
可选 bundle 的依赖随每次 `dsh` 安装下载。[思考过程翻译](2026-10-05-anonymous-reasoning-translation.zh.md)使用三个实验包,不增加第三方运行时依赖。因此准入需要考虑安装成本,以及开关能否在不增加配置表单的情况下提供可用组合。外部浏览器与 Cua Driver 提供方仍使用显式组合,因为它们会增加较大的运行时或要求外部可执行文件。Stagehand 需要模型凭据。演示性钩子、webhook 与模组不进入名单。[Session Inspector](../feature/2026-09-24-session-inspector.zh.md) 管理 Inspector 特有的激活行为。
|
||||
|
||||
Bundle 插入普通 Host 行;可选模型工具注册到全局工具层,因此包括 minimal 在内的所有预设都会获得它们。插件管理、profile 组合与重载无需针对 bundle 的特殊行为。搜索、Ralph 与终端在 Host 组内提供自己的隔离服务。搜索按需打开一个内存索引;Host 搜索策略保持不变。徽章技能与标题提供方作用于 Host。切换 bundle 会为运行中的 Agent 注册或移除其工具,后续用户 patch 层继续优先。前一个标题提供方开始清理后,替代提供方即可注册;前一个提供方的迟到结果不会提交。
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Bilingual-pair consistency record for 2026-11-09-computer-use-mcp-server.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-11-09-computer-use-mcp-server.md
|
||||
/agent-note-serve-computer-use-to-other-harnesses-as-an-mcp-server:
|
||||
en: 1e4562a8dd533e1f
|
||||
zh: 4e41a369a3a88f02
|
||||
/agent-note-serve-computer-use-to-other-harnesses-as-an-mcp-server/problem:
|
||||
en: 6050884223e0e491
|
||||
zh: eb808c298c9fb652
|
||||
/agent-note-serve-computer-use-to-other-harnesses-as-an-mcp-server/decision:
|
||||
en: ab004152e8a43f7d
|
||||
zh: 2eb2de8b91d8c405
|
||||
/agent-note-serve-computer-use-to-other-harnesses-as-an-mcp-server/alternatives-considered:
|
||||
en: 7bba46bed1b1baa3
|
||||
zh: 54f31bd327ee222d
|
||||
/agent-note-serve-computer-use-to-other-harnesses-as-an-mcp-server/consequences:
|
||||
en: 74494a208b1909f9
|
||||
zh: 0e4378667c751f54
|
||||
@@ -0,0 +1,55 @@
|
||||
# Agent Note: Serve Computer Use to other harnesses as an MCP server
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-11-09-computer-use-mcp-server.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
Computer Use training data should come from several agent harnesses, not only from DSH sessions. Codex, Claude Code, and in-house harnesses connect to capabilities through MCP stdio servers; Codex's own Computer Use is a stdio server with a persistent JavaScript REPL. DSH's `cua_run_code` already composes a retained program environment, consent, screenshots, and native connections per Agent, but only a DSH model turn could call it. The MCP form must keep those owners, persist program state across calls, and start from one documented command on every DSH distribution.
|
||||
|
||||
## Decision
|
||||
|
||||
`@deepseek-ai/dsh-cua-mcp` is an experimental bundle in `OPTIONAL_BUNDLES` that composes the standalone `cua-mcp` profile from one insert over the empty root. A profile manifest that selects it as the only bundle is the whole installation step: the launcher loads an existing manifest without consulting `PROFILE_TEMPLATES`, and the installation already ships the bundle, so no pnpm or registry access is involved. It is the only MCP application path; no package bin or SDK escape exists, and the bundle stays out of `PROFILE_TEMPLATES` because templates cannot name experimental packages.
|
||||
|
||||
The server runs inside the profile process and calls `ctx.tools.execute` with the connection's Agent and no model step. One stdio connection owns one Agent: creation before the stdio transport opens, disposal at stdin EOF. Each program call runs as that Agent's maintenance activity, so Agent disposal cancels an in-flight call and waits for it and its nested calls before the Session closes. Agent ownership already selects the retained program process, native connection, and session-scoped grants, so connection lifetime and state lifetime coincide. The empty default preset `cua-mcp` gives that Agent `cua_run_code` and nothing else, because the provider registers program tools only for composed presets. The Agent works in a dedicated workspace, `DSH_CUA_WORKSPACE` or `cua-mcp/workspace` under the Harness home: an Agent's working directory is the `workspace-write` root of its programs, and the directory a client launches the server from can be `/`.
|
||||
|
||||
Three tools form the surface. `cua_run_code` is the Agent's DSH registration served through the protocol server's low-level `tools/list` and `tools/call` handlers: each listing projects name, description, and parameters from the tool registry, and a call passes its arguments to the tool executor unchanged inside the Agent's initiator scope, so the provider's definition is the only schema, `description` is required as that definition declares, and validation and unknown names are answered by DSH; the one trim is the registration's sandbox-escalation fields, which the projection omits and a call may not name. `cua_get_api_reference` returns the `cua` API reference, the provider's guidance registered for the Agent, and keeps no state, so any conversation on the connection can read it at any time. `cua_reset` ends the Agent's program environment and keeps the Agent: the frontend cancels the running program and calls `ctx.cuaPrograms.release`, with which the provider's program runtime releases the environment of that state owner and which the CUA provider exposes beside `screenshotRequestTarget`; the next program starts a fresh process, while the native connection and the session's consent decisions stay. The frontend orders its own calls around the release: a reset answers after the cancelled program has settled, and programs wait for a release in progress. The projection delivers each inspected screenshot as the request version the program observed, so coordinates in program text match the delivered image. The provider's new `screenshotTarget` configuration replaces the model-route lookup that a profile without a model cannot satisfy.
|
||||
|
||||
Consent has two modes. `DSH_CUA_CONSENT=allow` answers every approval question of the connection's Agent with its approving label for the session. The default `elicit` forwards each question to the client as a form elicitation whose enum is the question's labels. No Session event is added: the training side consumes MCP tool results, and the connected harness's transcript records calls; DSH retains nested `tool/ptc-dispatch` events for diagnosis.
|
||||
|
||||
The composition lists its dependency closure, twenty-six rows, instead of layering on `dsh-base`: no model adapter, prompt-side tool, telemetry, or session-management row loads. `cua-mcp` is not a required startup entry, so a row that cannot activate is reported by the launcher on stderr: an inactive provider leaves `cua_run_code` out of the listing, and an inactive frontend serves nothing. Client entries are documented in the README instead of generated.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**An MCP server that launches `dsh --profile sdk` through the TypeScript SDK.** The SDK protocol has no request that runs a tool without a model turn; adding one changes the protocol and both SDK clients, and screenshots would cross a second process boundary.
|
||||
|
||||
**A standalone CUA server outside the harness, like Codex's REPL.** Consent, sandboxing, logging, screenshot admission, and helper lifecycle would be rewritten. The in-profile server reuses those owners and remains the basis for a later extraction.
|
||||
|
||||
**A `turn_ended` hidden tool with client hooks.** Its only use would be writing the client's turn boundaries into a log nobody consumes; held keys already release when a program settles.
|
||||
|
||||
**Session events for root MCP calls.** The data consumers need only MCP results; a `tool/call` without a model step would invent a step the Session never ran.
|
||||
|
||||
**Exposing the raw `cua` tool or program sandbox escalation.** Raw operations need per-method schemas the external model would relearn, and escalation needs an approval answerer the profile does not have.
|
||||
|
||||
**A profile frontend layered on `dsh-base` with model rows disabled.** The composed profile carried about a hundred rows without a consumer: model adapters, web tools, subagents, compaction, telemetry, and session management. The explicit closure is a quarter of that and fails loud on drift.
|
||||
|
||||
**A `dsh plugin enable|disable` subcommand that selects the shipped bundle.** It duplicated the plugin manager's manifest-only selection inside the launcher and still produced a base-backed profile; the documented manifest is three lines and needs no launcher change.
|
||||
|
||||
**A `dsh.bundle.profile` declaration that app-boot initializes on the first `dsh --profile cua-mcp`.** It made the first start zero-step, at the price of a new manifest field and a `shippedProfileTemplate` lookup in app-boot, the CLI `dsh plugin` command, and the plugin manager for one experimental bundle; the plain manifest costs one documented step and leaves those packages untouched. Once CUA graduates from experimental, a `PROFILE_TEMPLATES` entry gives the same zero-step start.
|
||||
|
||||
**A hand-written MCP schema and description for `cua_run_code`.** The second copy drifted within days: 663 against 2,164 characters of description and an optional against a required `description`. Projecting the registration removes the copy; the SDK's `registerTool` accepts only Standard Schema values and refuses to share `tools/list` and `tools/call` with custom handlers, so both tools use the low-level handlers.
|
||||
|
||||
**The `cua` API reference inside the tool description or the server instructions.** Claude Code 2.1.309 forwards the first 4,096 characters of an MCP tool description, and of the server instructions, and appends `… [truncated]`, measured on 2026-11-10 with 20,000-character probe texts; `dsh-mcp-client` forwards the same description intact. The reference is about 13,000 characters, so it travels as a tool result, and the registration's 3,200-character description stays within the budget.
|
||||
|
||||
**The reference at the head of the first program result of each environment.** The server cannot observe which results a model keeps: a client such as `dsh-mcp-client` holds one connection for several conversations, a cancelled or failed first call discards its result, and context compaction drops the text later. The flag that recorded delivery was written by program calls and by resets without a common ordering point. A read tool without state lets the model that lacks the reference ask for it; in fifteen probe conversations on 2026-11-11, through `dsh-mcp-client` with a DeepSeek model and through Claude Code 2.1.309, every model called it before its first program.
|
||||
|
||||
**A reset operation on the PTC program-tool factory.** A factory handle with `reset(agent)` made the tool executor a second owner of environment recovery, with its own blocked state after a failed cleanup. The program runtime's owner release already ends an environment, and the next run for the same owner starts a new one; the frontend serializes the connection's calls, so it is the caller that orders them around the release.
|
||||
|
||||
**Replacing the connection's Agent on reset.** A new Agent has a new Session: the native connection closes, session consent is asked again, and a refusal is forgotten, which is what reconnecting does. A reset discards what programs hold; consent and the native connection belong to the connection and are no part of the program environment. Disposing an Agent also waits for the runtime's stop grace, three seconds by default, when the running program cannot be interrupted.
|
||||
|
||||
**A `--print-client-config codex|claude-code|json` option.** Rendering the exact command of an installation needs `node:sea` to tell a single-file executable from a script launch, and the browser worker image, which packs every optional bundle, registers no `node:sea`; the documented entries carry the same timeouts and output budget without that dependency.
|
||||
|
||||
## Consequences
|
||||
|
||||
Every installation carries the bundle; its native providers, macOS and Windows, are optional dependencies, each mounted by a row that loads only on its own Host, and `verify-default-product-isolation` keeps the bundle out of default templates. A profile that layers the bundle over `dsh-base` duplicates row ids and is unsupported; the Web plugin page hides the bundle through `HIDDEN_BUNDLES` while the Host inventory still reports it as optional. Hosts without a provider list `cua_get_api_reference` and `cua_reset`, which both name the missing provider, and a `cua_run_code` call fails as `unknown tool`. Clients see state loss on process exit, `cua_reset`, or Agent disposal and recreate objects. Consent elicitation depends on the 2025 MCP request model; clients on the 2026-07-28 revision use `allow`. The tool descriptions, the server instructions, and the reference text are pinned by the profile's expected-output test; the program description and the reference change with the installed CUA packages. A model receives the reference only by calling `cua_get_api_reference`, so a client that withholds that tool leaves it with the execution rules alone. A provider description longer than 4,096 characters reaches Claude Code models cut.
|
||||
@@ -0,0 +1,55 @@
|
||||
# Agent Note: 以 MCP 服务器向其他 harness 提供 Computer Use
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-11-09-computer-use-mcp-server.md) | 中文
|
||||
|
||||
## 问题
|
||||
|
||||
Computer Use 的训练数据应来自多个 agent harness,而不只是 DSH 会话。Codex、Claude Code 以及内部 harness 通过 MCP stdio 服务器接入能力;Codex 自己的 Computer Use 就是一个带持久 JavaScript REPL 的 stdio 服务器。DSH 的 `cua_run_code` 已经按 Agent 组合了保留的程序环境、授权、截图和本机连接,但只有 DSH 的模型回合能调用它。MCP 形态必须保留这些所有者,在多次调用间持久化程序状态,并且在每种 DSH 分发中都能从一条有文档的命令启动。
|
||||
|
||||
## 决策
|
||||
|
||||
`@deepseek-ai/dsh-cua-mcp` 是 `OPTIONAL_BUNDLES` 中的实验性组合包:它在空 profile 根上用一次 insert 组成独立的 `cua-mcp` profile。只选它这一个组合包的 profile manifest 就是全部安装步骤:启动器加载已存在的 manifest 时不查 `PROFILE_TEMPLATES`,而安装本身已自带该组合包,因此不涉及 pnpm 或 registry。这是唯一的 MCP 应用路径;没有包 bin 或 SDK 逃逸,该组合包不进入 `PROFILE_TEMPLATES`,因为模板不能引用实验包。
|
||||
|
||||
服务器运行在 profile 进程内,带着连接的 Agent、不经模型步骤地调用 `ctx.tools.execute`。一个 stdio 连接拥有一个 Agent:在 stdio 传输打开之前创建,stdin EOF 时销毁。每次程序调用都作为该 Agent 的维护活动运行,因此 Agent 销毁时会取消进行中的调用,并等它及其嵌套调用结算之后才关闭 Session。Agent 归属已经决定了保留的程序进程、本机连接和会话级授权,因此连接生命周期与状态生命周期重合。空的默认 preset `cua-mcp` 让该 Agent 只获得 `cua_run_code`,因为提供方只为已组合 preset 注册程序工具。该 Agent 在专用工作区中工作,即 `DSH_CUA_WORKSPACE`,未设置时为 Harness home 下的 `cua-mcp/workspace`:Agent 的工作目录就是其程序的 `workspace-write` 根,而客户端启动服务器的目录可能是 `/`。
|
||||
|
||||
工具面由三个工具构成。`cua_run_code` 就是该 Agent 的 DSH 注册项,经协议服务器的低层 `tools/list` 与 `tools/call` handler 提供:每次列表都从工具注册表投影名称、描述和参数,调用则在 Agent 的 initiator 作用域内把参数原样交给工具执行器,因此提供方的定义是唯一 schema,`description` 按该定义必填,校验与未知名称由 DSH 回答;唯一的剪裁是注册项中的沙箱提权字段,投影省略它们,调用也不得指定。`cua_get_api_reference` 返回 `cua` API 参考,即提供方为该 Agent 注册的指引;它不保存状态,因此连接上的任何对话随时都能读取。`cua_reset` 结束该 Agent 的程序环境并保留 Agent:前端取消正在运行的程序,再调用 `ctx.cuaPrograms.release`,由提供方的程序运行时释放该 state owner 的环境,CUA 提供方把它与 `screenshotRequestTarget` 一起暴露;下一个程序在新进程中启动,本机连接和本会话的授权决定保留。前端围绕这次释放安排自己的调用:reset 在被取消的程序结算之后才返回,程序则等待进行中的释放。投影把每张被 inspect 的截图按程序观察到的请求版本交付,使程序文本中的坐标与交付的图片一致。提供方新增的 `screenshotTarget` 配置取代了没有模型的 profile 无法满足的模型路由查询。
|
||||
|
||||
授权有两种模式。`DSH_CUA_CONSENT=allow` 以批准标签为本会话回答连接 Agent 的每个审批问题。默认的 `elicit` 把每个问题作为表单 elicitation 转发给客户端,枚举即问题的选项标签。不新增任何 Session 事件:训练侧只消费 MCP 工具结果,接入 harness 的 transcript 记录调用;DSH 保留嵌套的 `tool/ptc-dispatch` 事件以供诊断。
|
||||
|
||||
组合列出自己的依赖闭包(26 行),而不是叠在 `dsh-base` 之上:不加载任何模型适配器、提示侧工具、遥测或会话管理行。`cua-mcp` 不是启动必需条目,无法激活的行由启动器在 stderr 上报告:提供方行未激活时列表里没有 `cua_run_code`,前端未激活时不提供任何服务。客户端配置项由 README 给出,而不是由程序生成。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**通过 TypeScript SDK 启动 `dsh --profile sdk` 的 MCP 服务器。** SDK 协议没有不经模型回合直接运行工具的请求;补上它要改协议和两个 SDK 客户端,截图还要再跨一次进程边界。
|
||||
|
||||
**像 Codex 的 REPL 那样在 harness 之外的独立 CUA 服务器。** 授权、沙箱、日志、截图接入和 helper 生命周期都要重写。profile 内的服务器复用这些所有者,并仍是日后剥离的基础。
|
||||
|
||||
**带客户端 hook 的隐藏工具 `turn_ended`。** 它唯一的用途是把客户端的回合边界写进无人消费的日志;按键在程序结束时已经释放。
|
||||
|
||||
**为根 MCP 调用写 Session 事件。** 数据消费方只需要 MCP 结果;没有模型步骤的 `tool/call` 会虚构一个 Session 从未运行的步骤。
|
||||
|
||||
**暴露原始 `cua` 工具或程序沙箱提权。** 原始操作需要外部模型重新学习的逐方法 schema,提权需要该 profile 不具备的审批应答者。
|
||||
|
||||
**叠在 `dsh-base` 之上、禁用模型行的 profile 前端。** 组合出的 profile 带着约一百行没有消费者的插件:模型适配器、web 工具、子代理、压缩、遥测和会话管理。显式闭包只有四分之一,且在漂移时大声失败。
|
||||
|
||||
**用 `dsh plugin enable|disable` 子命令选中随附组合包。** 它在启动器里重复了插件管理器的仅改 manifest 选择,而且仍然产生以 base 为底的 profile;文档给出的 manifest 只有三行,不需要改启动器。
|
||||
|
||||
**由 app-boot 在首次 `dsh --profile cua-mcp` 时初始化的 `dsh.bundle.profile` 声明。** 它让首次启动零步可用,代价是为一个实验组合包在 manifest 新增字段,并在 app-boot、CLI `dsh plugin` 命令和插件管理器里加入 `shippedProfileTemplate` 查找;普通 manifest 只多一个有文档的步骤,且不触碰这些包。CUA 从实验状态毕业后,一条 `PROFILE_TEMPLATES` 条目就能得到同样的零步启动。
|
||||
|
||||
**为 `cua_run_code` 手写 MCP schema 与描述。** 第二份定义几天内就漂移了:描述 663 对 2,164 个字符,`description` 可选对必填。投影注册项去掉了这份副本;SDK 的 `registerTool` 只接受 Standard Schema 值,且不允许 `tools/list`、`tools/call` 与自定义 handler 混用,所以两个工具都走低层 handler。
|
||||
|
||||
**把 `cua` API 参考放进工具描述或服务器说明。** Claude Code 2.1.309 对 MCP 工具描述和服务器说明都只转发前 4,096 个字符并追加 `… [truncated]`,2026-11-10 用 20,000 个字符的探针文本测得;`dsh-mcp-client` 原样转发同一描述。参考约 13,000 个字符,因此作为工具结果传递,注册项 3,200 个字符的描述留在预算之内。
|
||||
|
||||
**把参考放在每个环境首个程序结果的开头。** 服务器观察不到模型保留了哪些结果:`dsh-mcp-client` 这类客户端用一个连接承载多次对话,被取消或失败的首次调用会丢弃其结果,上下文压缩之后这段文本也会消失。记录已交付的标志由程序调用和重置两处写入,二者没有共同的排序点。无状态的只读工具让缺少参考的模型自己去取;2026-11-11 的十五次探针对话中,经 `dsh-mcp-client` 的 DeepSeek 模型与 Claude Code 2.1.309 都在首个程序之前调用了它。
|
||||
|
||||
**在 PTC 程序工具工厂上提供 reset 操作。** 带 `reset(agent)` 的工厂句柄让工具执行器成为环境恢复的第二个所有者,清理失败后还带着自己的阻塞状态。程序运行时的 owner release 本来就能结束一个环境,同一所有者的下一次运行会启动新环境;前端串行化该连接的调用,因此由它这个调用方围绕释放来安排这些调用。
|
||||
|
||||
**reset 时更换连接的 Agent。** 新 Agent 意味着新 Session:本机连接关闭,会话授权要重新询问,拒绝记录也被遗忘,这正是重新连接的效果。reset 丢弃的是程序持有的东西;授权和本机连接属于连接,不是程序环境的一部分。销毁 Agent 时,如果正在运行的程序无法被中断,还要等待运行时的停止宽限期,默认三秒。
|
||||
|
||||
**`--print-client-config codex|claude-code|json` 选项。** 为当前安装渲染准确命令需要 `node:sea` 来区分单文件可执行程序与脚本启动,而打包全部可选组合包的浏览器 worker 镜像没有注册 `node:sea`;文档给出的配置项带有同样的超时与输出预算,不需要这项依赖。
|
||||
|
||||
## 后果
|
||||
|
||||
每个安装都携带该组合包;macOS 与 Windows 两个原生提供方是它的可选依赖,各由一行挂载,且只在对应的 Host 上加载,`verify-default-product-isolation` 让该组合包留在默认模板之外。把组合包叠在 `dsh-base` 之上的 profile 会出现重复的行 id,不受支持;Web 插件页通过 `HIDDEN_BUNDLES` 隐藏该组合包,而 Host 清单仍把它报告为可选组合包。没有提供方的 Host 列出 `cua_get_api_reference` 与 `cua_reset`,二者都指出缺少提供方,调用 `cua_run_code` 以 `unknown tool` 失败。客户端会在进程退出、`cua_reset` 或 Agent 销毁时看到状态丢失并重新创建对象。授权 elicitation 依赖 2025 版 MCP 请求模型;使用 2026-07-28 修订版的客户端改用 `allow`。工具描述、服务器说明与参考文本由 profile 的期望输出测试固定;程序工具的描述和参考随已安装的 CUA 包变化。模型只有调用 `cua_get_api_reference` 才能得到参考,因此不放行该工具的客户端,其模型只有执行规则可用。提供方描述超过 4,096 个字符时,Claude Code 的模型只看到被截断的部分。
|
||||
+4
-4
@@ -9,11 +9,11 @@
|
||||
en: e736740546fb8219
|
||||
zh: 46a16a7a633716ec
|
||||
/agent-note-session-change-request-bindings/decision:
|
||||
en: 2bbd058f4edc8bb5
|
||||
zh: 5cc12bb0aa0864e2
|
||||
en: 9aa6d0c9c1177aeb
|
||||
zh: 0f0604176b02e82c
|
||||
/agent-note-session-change-request-bindings/alternatives-considered:
|
||||
en: 15fdaef4e432fc72
|
||||
zh: 8d36c859bd89f403
|
||||
en: 1e2239783738cec2
|
||||
zh: 5f248eee47de376e
|
||||
/agent-note-session-change-request-bindings/consequences:
|
||||
en: a2960e50ec52c9b6
|
||||
zh: fd23f4fe1137787d
|
||||
@@ -12,7 +12,7 @@ A Session that opens or updates pull requests leaves them only in its shell outp
|
||||
|
||||
The experimental forge capability seam has three roles. [`dsh-experimental-forge`](../../../../packages/experimental/forge/README.md) defines provider-neutral repository and change request references, a provider registry, and shared polling: watchers of one change request share one loop, each forge has one batched fetch in flight, and the cadence follows check, mergeability, and lifecycle state. [`dsh-experimental-forge-github`](../../../../packages/experimental/forge-github/README.md) is the first provider; it reads GitHub through the GitHub CLI on the host, so credentials stay in that tool's own store and never enter Session execution worlds. [`dsh-experimental-forge-session`](../../../../packages/experimental/forge-session/README.md) binds change requests to Sessions.
|
||||
|
||||
Bindings derive from the Session log instead of a separate store. A Session projection reads `bash` and `pwsh` calls: `gh pr create` results bind the URLs they print, `gh pr view`, `gh pr edit`, and `gh pr checkout` calls bind the change request they act on, and `git push` results record the branches they updated. Those three commands act on one change request, so only the URL given as their first argument and the URL their output prints for that change request count; links in a description name other change requests. Caller actions and discovery results are `plugin:forge-session/binding` records. Because every input is a log event, fork and resume carry bindings without new persistence, and the projection rebuilds them from any checkpoint. The printed URL or ref line is the evidence, not the exit status: an existing pull request reported by a failing `gh pr create` still binds, and a partially rejected push still records the branches it updated.
|
||||
Bindings derive from the Session log instead of a separate store. A Session projection reads `bash` and `pwsh` calls, including calls a PTC program dispatches, whose `tool/ptc-dispatch` events log the arguments with the settled outcome: `gh pr create` results bind the URLs they print, `gh pr view`, `gh pr edit`, and `gh pr checkout` calls bind the change request they act on, and `git push` results record the branches they updated. Those three commands act on one change request, so only the URL given as their first argument and the URL their output prints for that change request count; links in a description name other change requests. Caller actions and discovery results are `plugin:forge-session/binding` records. Because every input is a log event, fork and resume carry bindings without new persistence, and the projection rebuilds them from any checkpoint. The printed URL or ref line is the evidence, not the exit status: an existing pull request reported by a failing `gh pr create` still binds, and a partially rejected push still records the branches it updated.
|
||||
|
||||
After each push result, and when a caller such as the forge panel reports the branch a Session's checkout tracks, the service looks up open change requests for that branch through the provider and records the unbound ones. A dismissed binding stays hidden from discovery and returns only through `track`. Polled status is not logged; it is process-local state that exists while a watcher displays the Session. The projection's client view therefore carries bindings without status.
|
||||
|
||||
@@ -24,6 +24,8 @@ After each push result, and when a caller such as the forge panel reports the br
|
||||
|
||||
**Logging polled status in the Session.** Status changes independently of the conversation. Logging it would grow the log with every poll and expose stale snapshots to later readers.
|
||||
|
||||
**Recording PTC shell calls as `tool/call` and `tool/result` events, or observing the shell service.** Those events feed model history, so program sub-calls would re-enter model context; a shell-service hook would also see host lookups that no tool call made and would leave earlier PTC Sessions without bindings on replay. The dispatch events already log every sub-call outside model history.
|
||||
|
||||
**Running `gh` through the Session's subprocess provider.** Remote and sandboxed execution worlds would need GitHub credentials, and status would depend on the world a Session uses. The host CLI keeps one credential owner.
|
||||
|
||||
## Consequences
|
||||
|
||||
@@ -12,7 +12,7 @@ Status: implemented
|
||||
|
||||
实验性的 forge 能力 seam 由三个角色组成。[`dsh-experimental-forge`](../../../../packages/experimental/forge/README.zh.md) 定义提供方无关的仓库与变更请求引用、提供方注册表与共享轮询:同一变更请求的监听方共享一个循环,每个 forge 同时只有一次批量读取,轮询节奏随检查、可合并性与生命周期状态变化。[`dsh-experimental-forge-github`](../../../../packages/experimental/forge-github/README.zh.md) 是第一个提供方;它通过宿主上的 GitHub CLI 读取 GitHub,因此凭据保留在该工具自己的存储中,从不进入 Session 的执行环境。[`dsh-experimental-forge-session`](../../../../packages/experimental/forge-session/README.zh.md) 把变更请求绑定到 Session。
|
||||
|
||||
绑定从 Session 日志派生,而不是存放在单独的存储中。一个 Session 投影读取 `bash` 与 `pwsh` 调用:`gh pr create` 的结果绑定其输出的 URL,`gh pr view`、`gh pr edit` 与 `gh pr checkout` 调用绑定它们所操作的变更请求,`git push` 的结果记录其更新的分支。这三个命令只操作一个变更请求,因此只计入作为第一个参数给出的 URL 和输出为该变更请求打印的 URL;描述正文里的链接指向的是其他变更请求。调用方操作与发现结果是 `plugin:forge-session/binding` 插件记录。由于所有输入都是日志事件,fork 与恢复无需新的持久化即可带上绑定,投影也能从任意检查点重建它们。证据是输出中的 URL 或 ref 行,而不是退出状态:失败的 `gh pr create` 报告的已有 pull request 仍会绑定,部分被拒绝的推送仍会记录它已更新的分支。
|
||||
绑定从 Session 日志派生,而不是存放在单独的存储中。一个 Session 投影读取 `bash` 与 `pwsh` 调用,包括 PTC 程序分派的调用,其 `tool/ptc-dispatch` 事件记录参数与结算结果:`gh pr create` 的结果绑定其输出的 URL,`gh pr view`、`gh pr edit` 与 `gh pr checkout` 调用绑定它们所操作的变更请求,`git push` 的结果记录其更新的分支。这三个命令只操作一个变更请求,因此只计入作为第一个参数给出的 URL 和输出为该变更请求打印的 URL;描述正文里的链接指向的是其他变更请求。调用方操作与发现结果是 `plugin:forge-session/binding` 插件记录。由于所有输入都是日志事件,fork 与恢复无需新的持久化即可带上绑定,投影也能从任意检查点重建它们。证据是输出中的 URL 或 ref 行,而不是退出状态:失败的 `gh pr create` 报告的已有 pull request 仍会绑定,部分被拒绝的推送仍会记录它已更新的分支。
|
||||
|
||||
每次推送结果之后,以及 forge 面板等调用方报告 Session 检出所跟踪的分支时,服务通过提供方为该分支查找打开状态的变更请求,并记录尚未绑定的那些。被隐藏的绑定不会被发现逻辑恢复,只能通过 `track` 恢复。轮询到的状态不写入日志;它是进程内状态,仅在有监听方展示该 Session 时存在。因此投影的客户端视图只带绑定,不带状态。
|
||||
|
||||
@@ -24,6 +24,8 @@ Status: implemented
|
||||
|
||||
**把轮询状态写入 Session 日志。** 状态的变化独立于对话。写入日志会让日志随每次轮询增长,并把过期快照暴露给后续读取方。
|
||||
|
||||
**把 PTC 内的 shell 调用记录为 `tool/call` 与 `tool/result` 事件,或观察 shell 服务。** 这两种事件会进入模型历史,程序的子调用将重新进入模型上下文;shell 服务钩子还会看到并非由工具调用发起的宿主查询,而且重放早先的 PTC Session 时仍没有绑定。分派事件已经在模型历史之外记录了每个子调用。
|
||||
|
||||
**通过 Session 的子进程提供方运行 `gh`。** 远端与沙箱执行环境将需要 GitHub 凭据,状态也会取决于 Session 使用的执行环境。宿主 CLI 让凭据只有一个所有者。
|
||||
|
||||
## Consequences
|
||||
|
||||
@@ -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` 只丢弃一个操作的失败。
|
||||
+22
-22
@@ -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.
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ The merge checks run from three workflows named `Policy`, which run on `pull_req
|
||||
|
||||
The manual Desktop publication workflow selects the original successful `package` job attempt independently of `upload-artifact` archival status, then routes each retained build through `DESKTOP_PUBLISH_RUNNERS` to its original machine's unique label. Keep Windows run steps on native PowerShell and Mac run steps on the default POSIX shell; shared entrypoints are Node scripts. Test and production jobs use separate `desktop-test` and `desktop-production` approval Environments after a credential-free preparation job.
|
||||
|
||||
`Publish Desktop · Rollout & Website` reuses the same original-machine routing and approval Environments. Its preparation reads retained metadata and initial publication evidence without revalidating package binaries; it does not create release tags. Cache-only recovery uses the existing website approval and upload journal.
|
||||
`Publish Desktop · Rollout & Website` reuses the same original-machine routing and approval Environments. Its preparation reads retained metadata and initial publication evidence without revalidating package binaries; it does not create release tags. Cache-only recovery uses the existing website approval and upload journal. Rollout installs only publisher production dependencies in `desktop-rollout` and `website-rollout` checkouts; do not reuse the full-install publication checkouts. Both publication workflows run dependency-free preflights from `apps/desktop-publisher/src`. The required CI verdicts include isolated publisher installation checks: Linux/macOS in `ci.yml`, native Windows in `ci-windows.yml`.
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -495,6 +495,9 @@ jobs:
|
||||
console.log(JSON.stringify({ arch: process.arch, cpus: os.cpus().length,
|
||||
memoryGiB: Math.round(os.totalmem() / 2 ** 30) }))"
|
||||
|
||||
# No archive cache: this manual matrix includes the persistent 64/96-core
|
||||
# fleet rows, and a `~` cache written by an ephemeral runner does not
|
||||
# restore into the preparation directory there.
|
||||
- name: Install and prepare Linux
|
||||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
|
||||
@@ -23,6 +23,39 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
windows-publisher:
|
||||
runs-on: >-
|
||||
${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-2vcpu-windows-2025'
|
||||
|| vars.DSH_CI_FAILOVER_WINDOWS == 'selfhosted'
|
||||
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
||||
&& fromJSON('["self-hosted", "dsh-win-ci", "windows"]')
|
||||
|| 'dsh-windows-2025-16core' }}
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
persist-credentials: false
|
||||
path: publisher-isolated
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check preflights before dependency installation
|
||||
working-directory: publisher-isolated
|
||||
run: node apps/desktop-publisher/tests/preinstall.mjs
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: publisher-isolated/package.json
|
||||
dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
|
||||
- name: Install only publisher production dependencies
|
||||
working-directory: publisher-isolated
|
||||
run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
- name: Load publisher without Desktop or root development dependencies
|
||||
working-directory: publisher-isolated/apps/desktop-publisher
|
||||
run: node --import tsx tests/isolated-install.mjs
|
||||
|
||||
# Native builds and process tests block pull requests independently of coverage.
|
||||
# Observational checks reuse the successful build and remain non-blocking.
|
||||
# Dependabot PRs are excluded from the self-hosted pool and stay queued for
|
||||
@@ -30,6 +63,7 @@ jobs:
|
||||
# Blacksmith uses 2 vCPU for file-serial native tests and 16 for coverage
|
||||
# and the shared build/observational workspace.
|
||||
windows-build:
|
||||
needs: windows-publisher
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: >-
|
||||
${{ vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-16vcpu-windows-2025'
|
||||
@@ -258,7 +292,7 @@ jobs:
|
||||
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
||||
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
||||
|| 'ubuntu-latest' }}
|
||||
needs: [windows-build, windows-native-tests]
|
||||
needs: [windows-publisher, windows-build, windows-native-tests]
|
||||
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
||||
steps:
|
||||
- name: Fail if any needed job did not succeed
|
||||
|
||||
@@ -19,6 +19,42 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
publisher-isolated:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [linux, macos]
|
||||
runs-on: >-
|
||||
${{ matrix.os == 'macos' && 'macos-latest'
|
||||
|| vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404'
|
||||
|| vars.DSH_CI_FAILOVER_LINUX == 'selfhosted'
|
||||
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
||||
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
||||
|| 'ubuntu-latest' }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
persist-credentials: false
|
||||
path: publisher-isolated
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check preflights before dependency installation
|
||||
working-directory: publisher-isolated
|
||||
run: node apps/desktop-publisher/tests/preinstall.mjs
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: publisher-isolated/package.json
|
||||
dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- name: Install only publisher production dependencies
|
||||
working-directory: publisher-isolated
|
||||
run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
- name: Load publisher without Desktop or root development dependencies
|
||||
working-directory: publisher-isolated/apps/desktop-publisher
|
||||
run: node --import tsx tests/isolated-install.mjs
|
||||
|
||||
|
||||
# Three enterprise jobs isolate coverage, static analysis, and the
|
||||
# build-backed consumer tail. The consumer job owns the only Linux build so
|
||||
@@ -179,6 +215,16 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-
|
||||
|
||||
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
||||
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
||||
- name: Restore verified bubblewrap archive
|
||||
id: bubblewrap-cache
|
||||
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
- name: Install dependencies and prepare bubblewrap
|
||||
run: |
|
||||
pnpm install --frozen-lockfile &
|
||||
@@ -192,6 +238,16 @@ jobs:
|
||||
if (( install_status != 0 )); then exit "$install_status"; fi
|
||||
exit "$sandbox_status"
|
||||
|
||||
# The save step is skipped on a hit. A restored archive whose digest fails
|
||||
# is re-downloaded but not re-saved (the key already exists), so a tampered
|
||||
# entry survives until eviction; that needs deliberate cache poisoning.
|
||||
- name: Save verified bubblewrap archive
|
||||
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
- name: Run exhaustive coverage
|
||||
run: pnpm run check:ci:coverage
|
||||
|
||||
@@ -406,6 +462,16 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-playwright-
|
||||
|
||||
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
||||
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
||||
- name: Restore verified bubblewrap archive
|
||||
id: bubblewrap-cache
|
||||
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
- name: Install dependencies and prepare bubblewrap
|
||||
run: |
|
||||
pnpm install --frozen-lockfile &
|
||||
@@ -419,6 +485,13 @@ jobs:
|
||||
if (( install_status != 0 )); then exit "$install_status"; fi
|
||||
exit "$sandbox_status"
|
||||
|
||||
- name: Save verified bubblewrap archive
|
||||
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
# Blacksmith's Ubuntu HTTP archive endpoints can be unreachable while HTTPS works.
|
||||
- name: Use HTTPS for Ubuntu archives on Blacksmith
|
||||
if: vars.DSH_CI_FAILOVER_LINUX == 'blacksmith'
|
||||
@@ -459,6 +532,7 @@ jobs:
|
||||
|
||||
|
||||
node-compat:
|
||||
needs: publisher-isolated
|
||||
if: github.event_name == 'pull_request'
|
||||
# Under the selfhosted leg this job admits only repository-owned PR code
|
||||
# to the persistent shared VM; the blacksmith branch targets ephemeral
|
||||
@@ -532,9 +606,26 @@ jobs:
|
||||
- name: Install (immutable)
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
# The persistent self-hosted pool keeps ~/.cache between jobs on its own
|
||||
# layout, so the archive cache follows the hosted-only pnpm store guard.
|
||||
- name: Restore verified bubblewrap archive
|
||||
id: bubblewrap-cache
|
||||
if: vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
- name: Prepare bubblewrap (unrestrict userns)
|
||||
run: bash scripts/prepare-ci-bubblewrap.sh
|
||||
|
||||
- name: Save verified bubblewrap archive
|
||||
if: (vars.DSH_CI_FAILOVER_LINUX != 'selfhosted' || github.event.pull_request.user.login == 'dependabot[bot]') && steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
- name: Run compatibility smokes
|
||||
env:
|
||||
DSH_BUILD_CLIENT_PROFILE: official
|
||||
@@ -572,7 +663,7 @@ jobs:
|
||||
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
||||
&& fromJSON('["self-hosted", "linux", "x64", "vm-backup"]')
|
||||
|| 'ubuntu-latest' }}
|
||||
needs: [node-24, node-24-coverage, node-24-lint, node-24-bench, node-24-consumers, node-compat]
|
||||
needs: [publisher-isolated, node-24, node-24-coverage, node-24-lint, node-24-bench, node-24-consumers, node-compat]
|
||||
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
|
||||
steps:
|
||||
- name: Fail if any needed job did not succeed
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
id: preflight
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish.mjs
|
||||
- uses: pnpm/[email protected]
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }}
|
||||
DESKTOP_PACKAGE_ATTEMPT: ${{ steps.preflight.outputs.attempt }}
|
||||
run: node --import tsx apps/desktop/scripts/resolve-desktop-publish-ci.ts
|
||||
run: node --import tsx apps/desktop-publisher/src/resolve-desktop-publish-ci.ts
|
||||
|
||||
prepare:
|
||||
needs: route
|
||||
@@ -91,7 +91,7 @@ jobs:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration before dependency installation
|
||||
working-directory: desktop-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: desktop-publisher
|
||||
- name: Resolve retained package and approval environment
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
working-directory: desktop-publisher
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: node --import tsx apps/desktop/scripts/resolve-retained-desktop-publish-ci.ts
|
||||
run: node --import tsx apps/desktop-publisher/src/resolve-retained-desktop-publish-ci.ts
|
||||
- name: Verify local package without upload credentials
|
||||
id: check
|
||||
working-directory: desktop-publisher
|
||||
@@ -136,7 +136,7 @@ jobs:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration before dependency installation
|
||||
working-directory: desktop-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: desktop-publisher
|
||||
- name: Verify local package without upload credentials
|
||||
@@ -204,13 +204,13 @@ jobs:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration
|
||||
working-directory: website-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: website-publisher
|
||||
- name: Upload website installer
|
||||
id: website
|
||||
working-directory: website-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-website-ci.ts upload
|
||||
run: node --import tsx apps/desktop-publisher/src/publish-website-ci.ts upload
|
||||
- name: Archive website publication diagnostics
|
||||
if: always() && steps.website.outputs.record != ''
|
||||
continue-on-error: true
|
||||
@@ -249,13 +249,13 @@ jobs:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration
|
||||
working-directory: website-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: website-publisher
|
||||
- name: Recover and observe website cache purge
|
||||
id: website
|
||||
working-directory: website-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-website-ci.ts purge
|
||||
run: node --import tsx apps/desktop-publisher/src/publish-website-ci.ts purge
|
||||
- name: Archive website publication diagnostics
|
||||
if: always() && steps.website.outputs.record != ''
|
||||
continue-on-error: true
|
||||
|
||||
@@ -45,19 +45,20 @@ jobs:
|
||||
id: preflight
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish.mjs
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish.mjs
|
||||
- uses: pnpm/[email protected]
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
- name: Resolve original package and machine
|
||||
id: route
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }}
|
||||
DESKTOP_PACKAGE_ATTEMPT: ${{ steps.preflight.outputs.attempt }}
|
||||
run: node --import tsx apps/desktop/scripts/resolve-desktop-publish-ci.ts
|
||||
working-directory: apps/desktop-publisher
|
||||
run: node --import tsx src/resolve-desktop-publish-ci.ts
|
||||
|
||||
prepare:
|
||||
needs: route
|
||||
@@ -81,31 +82,31 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
clean: false
|
||||
path: desktop-publisher
|
||||
path: desktop-rollout
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: desktop-publisher/package.json
|
||||
package_json_file: desktop-rollout/package.json
|
||||
dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration before dependency installation
|
||||
working-directory: desktop-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: desktop-publisher
|
||||
working-directory: desktop-rollout
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
working-directory: desktop-rollout
|
||||
- name: Resolve retained package and approval environment
|
||||
id: local
|
||||
working-directory: desktop-publisher
|
||||
working-directory: desktop-rollout/apps/desktop-publisher
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts route
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts route
|
||||
- name: Verify initial publication and metadata without upload credentials
|
||||
id: check
|
||||
working-directory: desktop-publisher
|
||||
working-directory: desktop-rollout/apps/desktop-publisher
|
||||
env:
|
||||
DESKTOP_PUBLISH_ROUTE: ${{ steps.local.outputs.route }}
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts check
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts check
|
||||
|
||||
publish:
|
||||
name: Approve ${{ needs.prepare.outputs.label }}
|
||||
@@ -128,27 +129,27 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
clean: false
|
||||
path: desktop-publisher
|
||||
path: desktop-rollout
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: desktop-publisher/package.json
|
||||
package_json_file: desktop-rollout/package.json
|
||||
dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration before dependency installation
|
||||
working-directory: desktop-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: desktop-publisher
|
||||
working-directory: desktop-rollout
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
working-directory: desktop-rollout
|
||||
- name: Verify initial publication and metadata without upload credentials
|
||||
id: check
|
||||
working-directory: desktop-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts check
|
||||
working-directory: desktop-rollout/apps/desktop-publisher
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts check
|
||||
- name: Apply rollout to the published feed
|
||||
id: publish
|
||||
working-directory: desktop-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts apply
|
||||
working-directory: desktop-rollout/apps/desktop-publisher
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts apply
|
||||
- name: Retain publication audit
|
||||
continue-on-error: true
|
||||
if: always() && steps.publish.outputs.record != ''
|
||||
@@ -180,23 +181,23 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
clean: false
|
||||
path: website-publisher
|
||||
path: website-rollout
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: website-publisher/package.json
|
||||
package_json_file: website-rollout/package.json
|
||||
dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration
|
||||
working-directory: website-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: website-publisher
|
||||
working-directory: website-rollout
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
working-directory: website-rollout
|
||||
- name: Upload website installer
|
||||
id: website
|
||||
working-directory: website-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts website-upload
|
||||
working-directory: website-rollout/apps/desktop-publisher
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts website-upload
|
||||
- name: Archive website feed verification
|
||||
if: always() && steps.website.outputs.rollout-record != ''
|
||||
continue-on-error: true
|
||||
@@ -235,23 +236,23 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
clean: false
|
||||
path: website-publisher
|
||||
path: website-rollout
|
||||
- uses: pnpm/[email protected]
|
||||
with:
|
||||
package_json_file: website-publisher/package.json
|
||||
package_json_file: website-rollout/package.json
|
||||
dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- uses: actions/[email protected]
|
||||
with:
|
||||
node-version: '24'
|
||||
- name: Check local publication configuration
|
||||
working-directory: website-publisher
|
||||
run: node apps/desktop/scripts/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm install --frozen-lockfile
|
||||
working-directory: website-publisher
|
||||
working-directory: website-rollout
|
||||
run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs
|
||||
- run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts
|
||||
working-directory: website-rollout
|
||||
- name: Recover and observe website cache purge
|
||||
id: website
|
||||
working-directory: website-publisher
|
||||
run: node --import tsx apps/desktop/scripts/publish-desktop-rollout-ci.ts website-purge
|
||||
working-directory: website-rollout/apps/desktop-publisher
|
||||
run: node --import tsx src/publish-desktop-rollout-ci.ts website-purge
|
||||
- name: Archive website publication diagnostics
|
||||
if: always() && steps.website.outputs.record != ''
|
||||
continue-on-error: true
|
||||
|
||||
@@ -79,12 +79,29 @@ jobs:
|
||||
- name: Install (immutable)
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Restore verified bubblewrap archive
|
||||
id: bubblewrap-cache
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
# The with-key escalation e2e self-skips without a usable runner. Prepare
|
||||
# bwrap so trusted CI exercises it; the functional probe remains the
|
||||
# authority on whether the runner can use the sandbox.
|
||||
- name: Prepare bubblewrap (unrestrict userns)
|
||||
run: bash scripts/prepare-ci-bubblewrap.sh
|
||||
|
||||
# A restored archive whose digest fails is re-downloaded but not re-saved
|
||||
# (the hit key already exists), so a tampered entry survives until
|
||||
# eviction; that needs deliberate cache poisoning.
|
||||
- name: Save verified bubblewrap archive
|
||||
if: steps.bubblewrap-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/[email protected]
|
||||
with:
|
||||
path: ~/.cache/dsh-ci/bubblewrap
|
||||
key: bubblewrap-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/prepare-ci-bubblewrap.sh') }}
|
||||
|
||||
# Guard against a false green: the e2e suites self-skip when the key is
|
||||
# absent, so a missing/misconfigured secret would otherwise pass as
|
||||
# "all skipped". This job only runs on trusted events (the `if:` above
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -58,7 +58,7 @@ packages/ @deepseek-ai/dsh-<pkg> workspaces at packages/<group>/<pkg>/
|
||||
identity/ anonymous identity
|
||||
settings/ user settings
|
||||
credentials/ credentials/authorization
|
||||
account/ DeepSeek account
|
||||
account/ DeepSeek
|
||||
acp/ automation-only ACP
|
||||
interaction/ human interaction
|
||||
boot/ application boot
|
||||
@@ -150,7 +150,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.
|
||||
|
||||
@@ -52,6 +52,7 @@ External packages installed for runtime use or embedded in distributed Host or b
|
||||
| [`@lexical/utils`](https://github.com/facebook/lexical) | MIT |
|
||||
| [`@modelcontextprotocol/client`](https://github.com/modelcontextprotocol/typescript-sdk) | MIT |
|
||||
| [`@modelcontextprotocol/sdk`](https://github.com/modelcontextprotocol/typescript-sdk) | MIT |
|
||||
| [`@modelcontextprotocol/server`](https://github.com/modelcontextprotocol/typescript-sdk) | MIT |
|
||||
| [`@noble/hashes`](https://github.com/paulmillr/noble-hashes) | MIT |
|
||||
| [`@octokit/webhooks`](https://github.com/octokit/webhooks.js) | MIT |
|
||||
| [`@openai/codex`](https://github.com/openai/codex) | Apache-2.0 |
|
||||
@@ -87,6 +88,7 @@ External packages installed for runtime use or embedded in distributed Host or b
|
||||
| [`clsx`](https://github.com/lukeed/clsx) | MIT |
|
||||
| [`commander`](https://github.com/tj/commander.js) | MIT |
|
||||
| [`compression`](https://github.com/expressjs/compression) | MIT |
|
||||
| [`cos-nodejs-sdk-v5`](https://github.com/tencentyun/cos-nodejs-sdk-v5) | ISC |
|
||||
| [`cross-spawn`](https://github.com/moxystudio/node-cross-spawn) | MIT |
|
||||
| [`diff`](https://github.com/kpdecker/jsdiff) | BSD-3-Clause |
|
||||
| [`dompurify`](https://github.com/cure53/DOMPurify) | (MPL-2.0 OR Apache-2.0) |
|
||||
@@ -144,6 +146,7 @@ External packages installed for runtime use or embedded in distributed Host or b
|
||||
| [`string_decoder`](https://github.com/nodejs/string_decoder) | MIT |
|
||||
| [`supports-color`](https://github.com/chalk/supports-color) | MIT |
|
||||
| [`tar`](https://github.com/isaacs/node-tar) | BlueOak-1.0.0 |
|
||||
| [`tencentcloud-sdk-nodejs-teo`](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) | Apache-2.0 |
|
||||
| [`tsx`](https://github.com/privatenumber/tsx) | MIT |
|
||||
| [`turndown`](https://github.com/mixmark-io/turndown) | MIT |
|
||||
| [`typescript`](https://github.com/microsoft/TypeScript) | Apache-2.0 |
|
||||
@@ -212,7 +215,6 @@ External packages **directly declared** for development, tests, types, or toolin
|
||||
| [`@electron/notarize`](https://github.com/electron/notarize) | MIT |
|
||||
| [`@lexical/headless`](https://github.com/facebook/lexical) | MIT |
|
||||
| [`@modelcontextprotocol/node`](https://github.com/modelcontextprotocol/typescript-sdk) | MIT |
|
||||
| [`@modelcontextprotocol/server`](https://github.com/modelcontextprotocol/typescript-sdk) | MIT |
|
||||
| [`@modelcontextprotocol/server-everything`](https://github.com/modelcontextprotocol/servers) | MIT / Apache-2.0 |
|
||||
| [`@modelcontextprotocol/server-filesystem`](https://github.com/modelcontextprotocol/servers) | MIT / Apache-2.0 |
|
||||
| [`@panzoom/panzoom`](https://github.com/timmywil/panzoom) | MIT |
|
||||
@@ -247,7 +249,6 @@ External packages **directly declared** for development, tests, types, or toolin
|
||||
| [`@yao-pkg/pkg`](https://github.com/yao-pkg/pkg) | MIT |
|
||||
| [`@yarnpkg/cli-dist`](https://github.com/yarnpkg/berry) | BSD-2-Clause |
|
||||
| [`app-builder-lib`](https://github.com/electron-userland/electron-builder) | MIT |
|
||||
| [`cos-nodejs-sdk-v5`](https://github.com/tencentyun/cos-nodejs-sdk-v5) | ISC |
|
||||
| [`cytoscape`](https://github.com/cytoscape/cytoscape.js) | MIT |
|
||||
| [`cytoscape-cose-bilkent`](https://github.com/cytoscape/cytoscape.js-cose-bilkent) | MIT |
|
||||
| [`dayjs`](https://github.com/iamkun/dayjs) | MIT |
|
||||
@@ -274,7 +275,6 @@ External packages **directly declared** for development, tests, types, or toolin
|
||||
| [`selfsigned`](https://github.com/jfromaniello/selfsigned) | MIT |
|
||||
| [`smol-toml`](https://github.com/squirrelchat/smol-toml) | BSD-3-Clause |
|
||||
| [`spdx-expression-parse`](https://github.com/jslicense/spdx-expression-parse.js) | MIT |
|
||||
| [`tencentcloud-sdk-nodejs-teo`](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) | Apache-2.0 |
|
||||
| [`tsdown`](https://github.com/rolldown/tsdown) | MIT |
|
||||
| [`typescript-language-server`](https://github.com/typescript-language-server/typescript-language-server) | Apache-2.0 |
|
||||
| [`vite`](https://github.com/vitejs/vite) | MIT |
|
||||
|
||||
@@ -115,11 +115,13 @@
|
||||
"@deepseek-ai/dsh-experimental-session-search": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-tool-worktree": "workspace:*",
|
||||
"@deepseek-ai/dsh-cua-bundle": "workspace:*",
|
||||
"@deepseek-ai/dsh-cua-mcp": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-plugin-market-bundle": "workspace:*",
|
||||
"@deepseek-ai/dsh-personalized-recommendations": "workspace:*",
|
||||
"@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:*",
|
||||
@@ -136,7 +138,6 @@
|
||||
"@deepseek-ai/dsh-credentials-local": "workspace:*",
|
||||
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "workspace:*",
|
||||
"@deepseek-ai/dsh-agent-team": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-ptc-runtime-python": "workspace:*",
|
||||
"@deepseek-ai/dsh-tool-agent-team": "workspace:*",
|
||||
"@deepseek-ai/dsh-fs-observation-policy": "workspace:*",
|
||||
"@deepseek-ai/dsh-fs-sandbox": "workspace:*",
|
||||
|
||||
@@ -43,6 +43,10 @@ describe('dsh badge assembled snapshot', () => {
|
||||
},
|
||||
],
|
||||
"error": {
|
||||
"info": {
|
||||
"code": "SKILL_NOT_FOUND",
|
||||
"name": "SkillError",
|
||||
},
|
||||
"message": "skill "dsh-badge" is unknown or no longer available",
|
||||
},
|
||||
"isError": true,
|
||||
|
||||
+5
-4
@@ -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
@@ -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)
|
||||
|
||||
+7
-6
@@ -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' } }
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/** The shipped cua-mcp bundle: the real CLI loads a profile that selects only this bundle and serves Computer Use programs over stdio. */
|
||||
import { execFile } from 'node:child_process'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { promisify } from 'node:util'
|
||||
import { describe, expect, it, onTestFinished } from 'vitest'
|
||||
import { clearAmbientProxyEnv } from '../../../../../scripts/test-proxy-environment.ts'
|
||||
import { startProbe, type McpProbe } from './probe.ts'
|
||||
|
||||
const root = fileURLToPath(new URL('../../../../../', import.meta.url))
|
||||
const bin = join(root, 'apps/cli/lib/bin.js')
|
||||
const fixturePatch = fileURLToPath(new URL('./fixture.patch.yml', import.meta.url))
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
interface CallResult {
|
||||
content: Array<{ type: 'text'; text: string } | { type: 'image'; data: string; mimeType: string }>
|
||||
isError?: boolean
|
||||
}
|
||||
|
||||
function textOf(block: CallResult['content'][number] | undefined): string {
|
||||
if (block?.type !== 'text') throw new Error(`expected a text block, got ${JSON.stringify(block)}`)
|
||||
return block.text
|
||||
}
|
||||
|
||||
describe.skipIf(!existsSync(bin))('cua-mcp profile', { retry: 0 }, () => {
|
||||
it('serves programs over stdio from a profile that selects only this bundle, and exits on EOF', async () => {
|
||||
const temporary = await mkdtemp(join(tmpdir(), 'dsh-cua-mcp-profile-'))
|
||||
const home = join(temporary, 'home')
|
||||
// The directory the client launches the server from; programs must not start there.
|
||||
const launch = join(temporary, 'launch')
|
||||
const owned: { probe?: McpProbe } = {}
|
||||
onTestFinished(async () => {
|
||||
try { await owned.probe?.terminate() } finally { await rm(temporary, { recursive: true, force: true }) }
|
||||
})
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
...process.env, DSH_HOME: home, DSH_TELEMETRY_DISABLED: '1', DSH_PERMISSION_MODE: 'danger-full-access', DSH_CUA_CONSENT: 'allow',
|
||||
}
|
||||
clearAmbientProxyEnv(env)
|
||||
// The default workspace is under test, whatever the developer's shell exports.
|
||||
delete env.DSH_CUA_WORKSPACE
|
||||
await execFileAsync(process.execPath, ['-e', 'require("node:fs").mkdirSync(process.argv[1], { recursive: true })', launch])
|
||||
// The profile manifest the README documents: the installation's shipped bundle as the only layer, no pnpm step.
|
||||
const profileDir = join(home, 'profiles', 'cua-mcp')
|
||||
await mkdir(profileDir, { recursive: true })
|
||||
await writeFile(join(profileDir, 'package.json'), `${JSON.stringify({
|
||||
name: 'dsh-profile-cua-mcp', private: true, dependencies: {}, dsh: { profile: { bundles: ['@deepseek-ai/dsh-cua-mcp'] } },
|
||||
}, null, 2)}\n`)
|
||||
|
||||
const probe = owned.probe = startProbe({ args: [bin, '--profile', 'cua-mcp', '--patch', fixturePatch], cwd: launch, env })
|
||||
const initialized = await probe.request('initialize', {
|
||||
protocolVersion: '2025-06-18', capabilities: {}, clientInfo: { name: 'cua-mcp-e2e', version: '1' },
|
||||
}) as { serverInfo: { name: string; version: string }; instructions: string; capabilities: object }
|
||||
probe.notify('notifications/initialized')
|
||||
expect(initialized.serverInfo.name).toBe('dsh_cua')
|
||||
expect(initialized.capabilities).toMatchObject({ tools: { listChanged: false } })
|
||||
await expect(`${initialized.instructions}\n`).toMatchFileSnapshot('./expected/instructions.txt')
|
||||
const listed = await probe.request('tools/list') as { tools: { name: string }[] }
|
||||
await expect(`${JSON.stringify(listed.tools, null, 2)}\n`).toMatchFileSnapshot('./expected/tools.json')
|
||||
|
||||
const reference = await probe.request('tools/call', { name: 'cua_get_api_reference', arguments: {} }) as CallResult
|
||||
expect(reference.isError).toBeUndefined()
|
||||
expect(reference.content).toHaveLength(1)
|
||||
await expect(`${textOf(reference.content[0])}\n`).toMatchFileSnapshot('./expected/reference.md')
|
||||
|
||||
const first = await probe.request('tools/call', { name: 'cua_run_code', arguments: {
|
||||
code: 'globalThis.visits = 1; var app = await cua.getApp("test.fixture"); var win = await app.getWindow("7"); '
|
||||
+ 'await win.getAccessibilityTree(); await win.click("0"); '
|
||||
+ 'inspect(JSON.stringify({ visits, window: win.windowId, pid: process.pid, cwd: process.cwd() }), await win.getScreenshot())',
|
||||
description: 'Open the fixture window',
|
||||
} }) as CallResult
|
||||
expect(first.isError).toBeUndefined()
|
||||
expect(first.content.map(block => block.type)).toEqual(['text', 'image'])
|
||||
const state = JSON.parse(textOf(first.content[0])) as { visits: number; window: string; pid: number; cwd: string }
|
||||
expect(state).toMatchObject({ visits: 1, window: '7' })
|
||||
// Without DSH_CUA_WORKSPACE the profile creates its workspace inside the Harness home and starts programs there.
|
||||
// Both spellings are resolved: the temporary directory is a symlink on macOS and an 8.3 short name on Windows.
|
||||
const programDirectory = await realpath(state.cwd)
|
||||
expect(programDirectory).toBe(await realpath(join(home, 'cua-mcp', 'workspace')))
|
||||
expect(programDirectory).not.toBe(await realpath(launch))
|
||||
const image = first.content[1]
|
||||
if (image?.type !== 'image') throw new Error('expected an image block')
|
||||
expect(image.mimeType).toMatch(/^image\//)
|
||||
expect(Buffer.from(image.data, 'base64').length).toBeGreaterThan(0)
|
||||
|
||||
const second = await probe.request('tools/call', { name: 'cua_run_code', arguments: {
|
||||
code: 'globalThis.visits++; inspect(JSON.stringify({ visits, sameWindow: win.windowId === "7", pid: process.pid }))', description: 'Count another visit',
|
||||
} }) as CallResult
|
||||
expect(second.content).toHaveLength(1)
|
||||
expect(JSON.parse(textOf(second.content[0]))).toEqual({ visits: 2, sameWindow: true, pid: state.pid })
|
||||
|
||||
const reset = await probe.request('tools/call', { name: 'cua_reset', arguments: {} }) as CallResult
|
||||
expect(reset.isError).toBeUndefined()
|
||||
expect(textOf(reset.content[0])).toContain('Program environment cleared')
|
||||
const third = await probe.request('tools/call', { name: 'cua_run_code', arguments: {
|
||||
code: 'inspect(JSON.stringify({ visits: globalThis.visits ?? null, hasWindow: typeof win !== "undefined", pid: process.pid }))', description: 'Inspect the fresh environment',
|
||||
} }) as CallResult
|
||||
expect(third.content).toHaveLength(1)
|
||||
const afterReset = JSON.parse(textOf(third.content[0])) as { visits: null; hasWindow: boolean; pid: number }
|
||||
expect(afterReset).toMatchObject({ visits: null, hasWindow: false })
|
||||
expect(afterReset.pid).not.toBe(state.pid)
|
||||
|
||||
expect(await probe.close()).toEqual({ code: 0, signal: null })
|
||||
expect(probe.stderr()).not.toContain('MCP startup failed')
|
||||
expect(() => process.kill(afterReset.pid, 0)).toThrow()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
DeepSeek Harness Computer Use: observe and operate desktop applications on this machine. Start every conversation by calling cua_get_api_reference: it returns the complete cua API reference, and programs written without it guess the API wrong. Then call cua_run_code with a TypeScript program that uses the global cua object; program state persists across calls on this connection. A call may ask the user for application or pointer consent before it proceeds. Call cua_reset to discard program state.
|
||||
@@ -0,0 +1,54 @@
|
||||
## cua API reference
|
||||
|
||||
Use cua to observe and operate native applications. Always use cua.getCapabilities() to confirm whether a specific API is available on the current platform; its reported capabilities take precedence over availability statements in these instructions. All methods are async. Actions report dispatch evidence, not verified completion. If sessionLocked is true or an operation reports SESSION_LOCKED, stop UI actions and ask the user to unlock the desktop session; null or unknown means verify a usable unlocked desktop session first. cua.getApp requests user consent; if access is denied or revoked, stop using that application until the user explicitly permits another request, and never bypass a refusal or switch tools to avoid it. Never replay uncertain input without a fresh observation.
|
||||
|
||||
Call inspect(...values) to display selected observation results.
|
||||
|
||||
Signatures show resolved return values after await. ActionResult = { dispatched: boolean, foregroundChanged?: boolean | null }; foregroundChanged is omitted when not sampled and null when the sample is unavailable. JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue }; numbers must be finite. App is the application object with readonly app.appHandle: string (opaque) and the methods listed below for app level. Window is the window object with readonly window.windowId: string and the methods listed below for window level. Window IDs are opaque provider-issued strings; preserve them verbatim.
|
||||
|
||||
Supported modifier names depend on the platform and the operation; see the platform guidance.
|
||||
|
||||
Setup and discovery:
|
||||
- cua.getCapabilities() -> { platform: string, permissions: { accessibility: boolean, screenRecording: boolean }, appLevelAccessibility: boolean, systemPointer: boolean, keyboard: ('app' | 'window')[], sessionLocked: boolean | null, methods: string[], coordinateSpace: 'screenshot-pixels', browser: false } — inspect reported permissions, sessionLocked, methods, and keyboard scopes without requesting permissions.
|
||||
- cua.listApps() -> { id: string, displayName: string, isRunning: boolean, pid?: number }[] — list applications the provider exposes for selection with their current running state; pass the returned id unchanged to cua.getApp.
|
||||
- cua.findApps(query: string) -> { id: string, displayName: string, path: string, isRunning: boolean, pid?: number }[] — search installed applications, including stopped matches.
|
||||
- cua.getState() -> { apps: { id: string, displayName: string, isRunning: boolean, pid?: number }[], browsers: [] } — summarize the same provider discovery; this is not an accessibility observation.
|
||||
- cua.getApp(selector: string) -> App — select an application by provider-issued discovery ID, name, bundle ID, or absolute path where supported, obtain consent, start a stopped application in the background only where the provider supports launch, and return without reading AX or activating the app.
|
||||
- app.getWindows() -> { windowId: string, appName: string, title: string, bounds: { x: number, y: number, width: number, height: number }, isOnScreen: boolean, onCurrentSpace: boolean | null }[] — enumerate windows with global native bounds; null onCurrentSpace means unknown Space membership.
|
||||
- app.getWindow(windowId: string) -> Window — select a window by an ID from getWindows without reading AX. Providers reject closed or foreign windows when operating on them.
|
||||
- app.activate() -> ActionResult — request explicit foreground activation; use only when foreground access is required.
|
||||
- app.show() -> { dispatched: boolean, windowId: string | null, foregroundChanged: boolean | null } — unhide the app and restore its selected, focused, main, or sole window without activation.
|
||||
- window.show() -> { dispatched: boolean, windowId: string | null, foregroundChanged: boolean | null } — unhide and restore that explicit window without activation.
|
||||
|
||||
## Accessibility tree
|
||||
Available at app or window level depending on the platform.
|
||||
|
||||
Read getAccessibilityTree explicitly before using element ids. Selection and screenshots do not read or replace the current AX snapshot. Element ids are opaque strings from the latest successful tree; the object facade keeps one current snapshot per app across its repeated app and window objects, a new read replaces it, and a failed read invalidates the previous one. Repeated strings can appear for different elements, so do not reuse an old id blindly, and element operations do not fall back to pointer input or typing.
|
||||
- getAccessibilityTree(options?: { includeMenus?: boolean, details?: boolean, maxElements?: number, maxDepth?: number }) -> string — set the node count or depth for one read. Omitted limits use the provider settings. includeMenus expands menu contents and details adds identifiers, native bounds, and complete action names.
|
||||
- listActions(elementId: string) -> string[] — list the actions an element advertises.
|
||||
- invoke(elementId: string) -> ActionResult — invoke the element's default action; dispatched is false when it has none.
|
||||
- performAction(elementId: string, action: string, argument?: JsonValue) -> ActionResult — perform an observed action with an optional direct JSON argument.
|
||||
- setValue(elementId: string, value: JsonValue) -> ActionResult — write a control value.
|
||||
- selectText(elementId: string, text: string, options?: { prefix?: string, suffix?: string, selectionType?: 'text' | 'cursor_before' | 'cursor_after' }) -> ActionResult — select one literal occurrence or place the cursor beside it, using adjacent context to disambiguate.
|
||||
|
||||
## Simulated mouse
|
||||
Use an explicit window for screenshots and pointer input. Before coordinate input, including relative coordinates, obtain a successful getAccessibilityTree observation covering that window or take its screenshot. Absolute pixel coordinates require a returned screenshot.
|
||||
- getScreenshot() -> Image — capture the selected window as a stored image with readonly attachmentId, path, width, and height. Pass selected screenshots to inspect(...values) to display them; read the window ID from window.windowId.
|
||||
- mouseMove(target: string | [number, number], options?: { relative?: boolean }) -> { dispatched: boolean, foregroundChanged?: boolean | null, hoverRoute: 'accessibility' | 'system-pointer', systemPointerMoved: boolean } — request a mouse move to the target without pressing a button; inspect hoverRoute and systemPointerMoved, and expect no automatic pointer restoration.
|
||||
- click(target: string | [number, number], options?: { mouseButton?: 'left' | 'right' | 'middle', clickCount?: 1 | 2, modifiers?: Modifier[], holdMs?: number, relative?: boolean }) -> ActionResult — click an element id or point, or perform a left-button double-click; holdMs controls the press duration of each press.
|
||||
- scroll(options: { x: number, y: number, deltaLinesX: number, deltaLinesY: number, relative?: boolean }) -> ActionResult — scroll at a point; deltas are integers from -10 to 10 with at least one nonzero, and positive values reveal content above or left.
|
||||
- drag(from: [number, number], to: [number, number], options?: { mouseButton?: 'left' | 'right' | 'middle', modifiers?: Modifier[], relative?: boolean }) -> ActionResult — drag between two points of one window.
|
||||
|
||||
A string target is an element id; coordinate targets are [x, y] and are pixels in the latest returned screenshot by default. With relative: true they are integer thousandths of the window width and height from 0 to 999, based on the current AX observation or screenshot. Left clicks support one or two presses; right and middle clicks support one. FOREGROUND_REQUIRED means explain the need, then explicitly activate the target and observe again; activation is never automatic. Read fresh state after actions, and treat WINDOW_CHANGED, STALE_SNAPSHOT, and SCREENSHOT_REQUIRED as requiring the stated fresh observation or capture before any retry.
|
||||
|
||||
## Simulated keyboard
|
||||
Available at app or window level depending on the platform.
|
||||
- typeText(text: string) -> ActionResult — type literal text at the app's current focus; line endings send Return and tabs send Tab.
|
||||
- paste(text: string, options?: { format?: 'text' | 'html' }) -> ActionResult — deliver text or HTML through the app's Paste command, restoring prior clipboard contents unless another writer changes them; a Paste failure is surfaced without substituting typeText, and PASTE_NOT_CONSUMED means inspect before any retry.
|
||||
- pressKey(key: string, modifiers?: Modifier[]) -> ActionResult — press and release one complete keystroke. For example pressKey('Tab', ['shift']) or pressKey('+'). Key names are platform-defined strings. Pass key and modifiers separately; do not pack them into a chord string.
|
||||
|
||||
Raw tools use { method, params }: include appHandle for app calls and windowId for window calls, and use snapshotId with elementId for element routes. getAccessibilityTree maps to getState; getWindow has no raw method; getWindows maps to listWindows; getScreenshot maps to screenshot; cua.getState maps to listApps; every other named operation uses the same method name.
|
||||
|
||||
AX read defaults: maxElements=2000, maxDepth=25.
|
||||
|
||||
Maximum click holdMs: 5000 ms.
|
||||
@@ -0,0 +1,64 @@
|
||||
[
|
||||
{
|
||||
"name": "cua_get_api_reference",
|
||||
"title": "Computer use API reference",
|
||||
"description": "Return the complete `cua` API reference that every cua_run_code program must follow: methods, signatures, and operating rules. Call it before the first cua_run_code program of a conversation, and again whenever the reference is no longer in your context or a program fails on an unknown `cua` method. It only reads: nothing on the desktop or in the program environment changes.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"annotations": {
|
||||
"readOnlyHint": true,
|
||||
"destructiveHint": false,
|
||||
"idempotentHint": true,
|
||||
"openWorldHint": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "cua_run_code",
|
||||
"title": "Computer use program",
|
||||
"description": "Run a TypeScript program to observe and operate desktop applications. The global cua object is ready to use; retain application and window objects across calls. Only tools.cua is available inside the program. Call other session tools directly. Use inspect(...values) to display selected text and images. The program contains TypeScript REPL statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. The program runs in strict mode: assigning an undeclared name throws, so use globalThis for intentional globals; eval and new Function are unavailable. Variables, functions, and imported modules remain in memory for this Agent across calls. Each call starts with copies of the top-level bindings left by earlier calls and may declare any of those names again with any keyword. A new declaration applies to this and later calls; functions and still-running code from earlier calls keep the values they captured. Assigning to an earlier name without declaring it, even one declared with const, changes only the copy seen by this and later calls. A let, const, or class declaration cannot read the earlier value of its own name, so let total = total + 1 throws; assign to the name or use a new name instead. A var declaration of an earlier name starts from the earlier value. var declarations become top-level names of the call even inside blocks; other declarations inside blocks stay in their block. Assignments that earlier code makes later, such as from timers, are not visible to later calls; keep shared mutable state in objects. If a call fails before a let, const, class, or var declaration of an existing name finishes, later calls keep that name's earlier value. Use await import(...) for modules; require is unavailable, and relative specifiers resolve from the working directory of this environment's first call. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Await tools and cleanup before returning; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before returning; raw output belongs to the active evaluation. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string",
|
||||
"description": "The TypeScript program to execute, following this tool's execution instructions."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Clear, concise description of what this program does in active voice, 5-10 words (shown in the UI). Examples: \"Count TODO markers across packages\"; \"Read failing test and its fixture\"; \"Rename config key in every cordis.yml\"."
|
||||
},
|
||||
"timeoutMs": {
|
||||
"type": "number",
|
||||
"description": "Positive elapsed-time budget in milliseconds, including nested tool and approval waits. Default 120000; capped at 600000. Zero does not disable the deadline."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"code",
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"annotations": {
|
||||
"readOnlyHint": false,
|
||||
"destructiveHint": true,
|
||||
"idempotentHint": false,
|
||||
"openWorldHint": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "cua_reset",
|
||||
"title": "Reset computer use program state",
|
||||
"description": "Discard the program environment of this connection: every variable, import, and application or window object held by earlier cua_run_code calls. A running cua_run_code program is cancelled. Application access grants and the desktop applications themselves are unaffected; the next cua_run_code call starts a fresh environment. Use it when the environment has become unusable or its retained state must not carry into the next task.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"annotations": {
|
||||
"readOnlyHint": false,
|
||||
"destructiveHint": false,
|
||||
"idempotentHint": true,
|
||||
"openWorldHint": false
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Replace both native providers with the recorded desktop fixture so the profile serves on every Host.
|
||||
- id: cua-mcp-provider
|
||||
disabled: true
|
||||
|
||||
- id: cua-mcp-provider-windows
|
||||
disabled: true
|
||||
|
||||
- insert:
|
||||
- id: cua-mcp-fixture-provider
|
||||
name: '../../../../../snapshots/session/cua-run-code/provider.mjs'
|
||||
config:
|
||||
screenshotTarget:
|
||||
longEdge: 1
|
||||
maxBytes: 100000
|
||||
allowedApps:
|
||||
- id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
name: Fixture
|
||||
executablePath: /fixture/app
|
||||
@@ -0,0 +1,102 @@
|
||||
/** Raw JSON-RPC probe over the profile's stdio: every stdout line must be a protocol frame. */
|
||||
import { spawn } from 'node:child_process'
|
||||
import { createInterface } from 'node:readline'
|
||||
|
||||
/** One observed child exit; a graceful EOF exit carries code zero and no signal. */
|
||||
export interface ProbeExit {
|
||||
readonly code: number | null
|
||||
readonly signal: NodeJS.Signals | null
|
||||
}
|
||||
|
||||
/** Test-side requests and explicit process ownership. */
|
||||
export interface McpProbe {
|
||||
/**
|
||||
* @param method - JSON-RPC method.
|
||||
* @param params - JSON params.
|
||||
* @returns The matching result; a protocol error or a non-protocol stdout line rejects pending and later requests.
|
||||
*/
|
||||
request(method: string, params?: object): Promise<unknown>
|
||||
/** @param method - Notification method. @param params - JSON params. */
|
||||
notify(method: string, params?: object): void
|
||||
/** @returns Captured stderr, which the protocol never uses. */
|
||||
stderr(): string
|
||||
/** @returns The exit observed after stdin EOF. */
|
||||
close(): Promise<ProbeExit>
|
||||
/** Stop a failed fixture and await its exit. */
|
||||
terminate(): Promise<void>
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the built CLI with the given arguments and hold its stdio.
|
||||
* @param options - Executable arguments, working directory, and environment.
|
||||
* @returns The probe; `terminate` must run even after a failed assertion.
|
||||
*/
|
||||
export function startProbe(options: { readonly args: readonly string[]; readonly cwd: string; readonly env: NodeJS.ProcessEnv }): McpProbe {
|
||||
const child = spawn(process.execPath, [...options.args], { cwd: options.cwd, env: options.env, stdio: 'pipe' })
|
||||
let stderr = ''
|
||||
child.stderr.on('data', (chunk: Buffer) => { stderr += chunk.toString('utf8') })
|
||||
let nextId = 0
|
||||
let ended = false
|
||||
let failure: Error | undefined
|
||||
const pending = new Map<number, { resolve(value: unknown): void; reject(error: Error): void }>()
|
||||
const fail = (error: Error): void => {
|
||||
failure ??= error
|
||||
for (const request of pending.values()) request.reject(error)
|
||||
pending.clear()
|
||||
}
|
||||
child.on('error', fail)
|
||||
child.stdin.on('error', fail)
|
||||
const closed = new Promise<ProbeExit>((resolve) => {
|
||||
child.once('close', (code, signal) => {
|
||||
ended = true
|
||||
fail(new Error(`cua-mcp exited before replying (${String(code)}, ${String(signal)}): ${stderr}`))
|
||||
resolve({ code, signal })
|
||||
})
|
||||
})
|
||||
const reading = (async () => {
|
||||
for await (const line of createInterface({ input: child.stdout })) {
|
||||
let parsed: unknown
|
||||
try { parsed = JSON.parse(line) } catch { parsed = undefined }
|
||||
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed) || Reflect.get(parsed, 'jsonrpc') !== '2.0') {
|
||||
throw new Error(`cua-mcp wrote a non-protocol line to stdout: ${line}`)
|
||||
}
|
||||
const frame = parsed as { id?: number; method?: string; result?: unknown; error?: unknown }
|
||||
if (frame.id === undefined) continue
|
||||
const request = pending.get(frame.id)
|
||||
if (request === undefined) throw new Error(`cua-mcp replied to an unknown request ${String(frame.id)}`)
|
||||
pending.delete(frame.id)
|
||||
if (frame.error === undefined) request.resolve(frame.result)
|
||||
else request.reject(new Error(`MCP request failed: ${JSON.stringify(frame.error)}`))
|
||||
}
|
||||
})().catch((error: unknown) => { fail(error instanceof Error ? error : new Error(String(error))) })
|
||||
const write = (message: object): void => { child.stdin.write(`${JSON.stringify({ jsonrpc: '2.0', ...message })}\n`) }
|
||||
return {
|
||||
async request(method, params) {
|
||||
if (failure !== undefined) throw failure
|
||||
if (ended) throw new Error('cua-mcp is closed')
|
||||
const id = ++nextId
|
||||
const response = Promise.withResolvers<unknown>()
|
||||
const timer = setTimeout(() => {
|
||||
pending.delete(id)
|
||||
response.reject(new Error(`MCP ${method} did not reply: ${stderr}`))
|
||||
}, 90_000)
|
||||
pending.set(id, { resolve: response.resolve, reject: response.reject })
|
||||
write({ id, method, ...params === undefined ? {} : { params } })
|
||||
try { return await response.promise } finally { clearTimeout(timer) }
|
||||
},
|
||||
notify(method, params) { write({ method, ...params === undefined ? {} : { params } }) },
|
||||
stderr: () => stderr,
|
||||
async close() {
|
||||
child.stdin.end()
|
||||
const exit = await closed
|
||||
await reading
|
||||
if (failure !== undefined && !failure.message.startsWith('cua-mcp exited before replying')) throw failure
|
||||
return exit
|
||||
},
|
||||
async terminate() {
|
||||
if (!ended) child.kill('SIGKILL')
|
||||
await closed
|
||||
await reading
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -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.'
|
||||
|
||||
@@ -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),
|
||||
})
|
||||
|
||||
@@ -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 })
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write apps/desktop-publisher/README.md
|
||||
/:
|
||||
en: b6cea27035a6acd8
|
||||
zh: c8484ea772e48b76
|
||||
/desktop-publisher:
|
||||
en: 2f3214a4c5f468bd
|
||||
zh: 0344414f601ce5da
|
||||
/desktop-publisher/summary:
|
||||
en: 96e01061bb58ef81
|
||||
zh: 34e3e9da3adbdfef
|
||||
/desktop-publisher/table-of-contents:
|
||||
en: c910eb62c99ebaae
|
||||
zh: a39d3e1344eb1b3d
|
||||
/desktop-publisher/use-this-package:
|
||||
en: 9678d489d32b9e7b
|
||||
zh: 6d0ddae4cf96db94
|
||||
/desktop-publisher/implementation:
|
||||
en: 62a7d718a25d4ea4
|
||||
zh: 10c8e93749810a15
|
||||
/desktop-publisher/limitations:
|
||||
en: cc71e293492ce240
|
||||
zh: 1b9388bf9b108274
|
||||
/desktop-publisher/limitations/dev-note:
|
||||
en: 0a1253c6f7b5e8b9
|
||||
zh: 9f56528562c7c914
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
description: "Run Desktop publication and staged rollout from retained packages without installing Desktop build dependencies."
|
||||
kind: "package-library"
|
||||
---
|
||||
# Desktop publisher
|
||||
|
||||
English | [中文](README.zh.md)
|
||||
|
||||
## Summary
|
||||
|
||||
Publish retained Desktop packages, change an existing release's rollout percentage, and refresh website installers. The manual GitHub workflows select the original packaging machine and require the configured environment approvals. This private workspace shares the repository lockfile and runs TypeScript source directly with Node 24 and tsx.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Use this package](#use-this-package)
|
||||
- [Implementation](#implementation)
|
||||
- [Limitations](#limitations)
|
||||
|
||||
## Use this package
|
||||
|
||||
Use [Publish Desktop](../../.github/workflows/desktop-publish.yml) for initial publication and [Rollout & Website](../../.github/workflows/desktop-rollout.yml) for an already published version. The workflows own operator inputs, runner routing, credentials, and approval steps. Rollout installs only this workspace's production dependencies with lifecycle scripts disabled; invoke its entrypoints with Node from this package directory to avoid pnpm's automatic dependency repair.
|
||||
|
||||
The dependency-free preflights run before installation. Their executable regression check is:
|
||||
|
||||
```sh
|
||||
node apps/desktop-publisher/tests/preinstall.mjs
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
<details>
|
||||
<summary>Maintainer details</summary>
|
||||
|
||||
Desktop build and signing scripts stay in `apps/desktop`; publishing code imports no Desktop implementation. Desktop consumes publisher helpers through the workspace package exports. Runtime dependencies belong in this package's `dependencies`; tests and type checking use repository development tools. The root host TypeScript project checks this source, so there is no separate emitted package or package-local tsconfig.
|
||||
|
||||
Full-install publication and filtered-install rollout use different checkout directories. Changing install modes in one checkout removes development dependency links and can retain stale Desktop directories. Release records live outside these checkouts and remain owned by the existing retained-release configuration.
|
||||
|
||||
Tests under `apps/desktop` may reuse the publisher's loopback COS fixture. Publisher failure tests also exercise the Desktop rollback and archival CLIs as repository integration tests; these test-only paths are not runtime dependencies. The isolated-install CI checks load publisher source without Desktop or root development dependencies on Linux, macOS, and Windows, and contribute to required CI verdicts.
|
||||
|
||||
</details>
|
||||
|
||||
## Limitations
|
||||
|
||||
- This private tool is not published to npm and does not generate a standalone artifact. Workflow checkouts must contain the shared lockfile and workspace metadata.
|
||||
- Isolated-install and preflight tests do not authorize a production write or prove that an installer upgrades a real client.
|
||||
|
||||
### Dev Note
|
||||
|
||||
None.
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
description: "从保留的安装包执行 Desktop 发布和灰度放量,无需安装 Desktop 构建依赖。"
|
||||
kind: "package-library"
|
||||
---
|
||||
# Desktop 发布工具
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
## 概述
|
||||
|
||||
发布保留的 Desktop 安装包、调整已发布版本的放量比例,以及刷新官网安装包。手动 GitHub 工作流选择原始打包机器,并要求通过配置的环境审批。此私有 workspace 共用仓库锁文件,通过 Node 24 和 tsx 直接执行 TypeScript 源码。
|
||||
|
||||
## 目录
|
||||
|
||||
- [使用此包](#use-this-package)
|
||||
- [实现](#implementation)
|
||||
- [限制](#limitations)
|
||||
|
||||
## 使用此包
|
||||
|
||||
首次发布使用 [Publish Desktop](../../.github/workflows/desktop-publish.yml),已发布版本使用 [Rollout & Website](../../.github/workflows/desktop-rollout.yml)。工作流负责操作输入、运行器路由、凭据和审批步骤。放量仅安装此 workspace 的生产依赖,并禁用生命周期脚本;从此包目录使用 Node 调用入口,避免 pnpm 自动修复依赖。
|
||||
|
||||
无依赖预检在安装之前运行,其可执行回归检查为:
|
||||
|
||||
```sh
|
||||
node apps/desktop-publisher/tests/preinstall.mjs
|
||||
```
|
||||
|
||||
## 实现
|
||||
|
||||
<details>
|
||||
<summary>维护者说明</summary>
|
||||
|
||||
Desktop 构建和签名脚本保留在 `apps/desktop`;发布代码不导入 Desktop 实现。Desktop 通过 workspace 包导出使用发布辅助函数。运行时依赖归此包的 `dependencies` 所有;测试和类型检查使用仓库开发工具。根目录的 host TypeScript 项目检查这些源码,因此没有独立的编译产物或包级 tsconfig。
|
||||
|
||||
完整安装的发布与筛选安装的放量使用不同 checkout 目录。在同一 checkout 切换安装模式会移除开发依赖链接,也可能保留旧 Desktop 目录。发布记录位于这些 checkout 之外,仍由现有保留版本配置管理。
|
||||
|
||||
`apps/desktop` 下的测试可以复用发布工具的 loopback COS fixture。发布失败测试还将 Desktop 回滚和归档 CLI 作为仓库集成测试执行;这些测试路径不是运行时依赖。隔离安装 CI 在 Linux、macOS 和 Windows 上验证发布源码无需 Desktop 或根目录开发依赖即可加载,结果纳入必需的 CI 汇总检查。
|
||||
|
||||
</details>
|
||||
|
||||
## 限制
|
||||
|
||||
- 此私有工具不发布到 npm,也不生成独立产物。工作流 checkout 必须包含共用锁文件和 workspace 元数据。
|
||||
- 隔离安装和预检测试不授权生产写入,也不能证明安装包能升级真实客户端。
|
||||
|
||||
### 开发备注
|
||||
|
||||
无。
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@deepseek-ai/dsh-desktop-publisher",
|
||||
"version": "0.2.2-rc.2",
|
||||
"description": "Private Desktop release metadata, rollout and website publisher",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
"./*": "./src/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "4.6.6",
|
||||
"js-yaml": "^4.3.2",
|
||||
"semver": "^7.8.5",
|
||||
"cos-nodejs-sdk-v5": "3.0.0",
|
||||
"tencentcloud-sdk-nodejs-teo": "4.1.330",
|
||||
"tsx": "^4.23.13"
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -47,7 +47,7 @@ export function createDesktopCos(credentials: DesktopCosCredentials, timeoutMs:
|
||||
})
|
||||
cos.on('before-send', (options: CosRequestOptions) => {
|
||||
for (const name of Object.keys(options.headers)) {
|
||||
if (name.toLowerCase() === 'cache-control' && options.headers[name] === '') delete options.headers[name]
|
||||
if (name.toLowerCase() === 'cache-control' && options.headers[name] === '') Reflect.deleteProperty(options.headers, name)
|
||||
}
|
||||
})
|
||||
return cos
|
||||
File renamed without changes.
File renamed without changes.
+3
-2
@@ -5,7 +5,7 @@ import { Readable, Writable } from 'node:stream'
|
||||
import type COS from 'cos-nodejs-sdk-v5'
|
||||
import { createDesktopCos, DESKTOP_COS_REGION, type DesktopCosCredentials } from './desktop-cos.ts'
|
||||
import { cosOperation } from './cos-operation.ts'
|
||||
import type { DesktopUploadPlan } from './desktop-upload-plan.ts'
|
||||
import type { DesktopUploadPlan } from './desktop-upload-types.ts'
|
||||
import { desktopArtifactDigest, type DesktopPublishTransport } from './desktop-publish.ts'
|
||||
import { DesktopCosOperationError } from './desktop-publication-failure.ts'
|
||||
|
||||
@@ -66,7 +66,8 @@ export function desktopPublishCos(
|
||||
if (actual.size !== digest.size || actual.sha512 !== digest.sha512) throw new Error('desktop publish: local input changed')
|
||||
const cos = client()
|
||||
const md5 = createHash('md5')
|
||||
const bytes = artifact.contents === undefined ? createReadStream(artifact.path) : [Buffer.from(artifact.contents)]
|
||||
const bytes = artifact.contents === undefined
|
||||
? createReadStream(artifact.path) as AsyncIterable<Buffer> : [Buffer.from(artifact.contents)]
|
||||
for await (const chunk of bytes) md5.update(chunk)
|
||||
const body = artifact.contents === undefined ? createReadStream(artifact.path) : Readable.from([Buffer.from(artifact.contents)])
|
||||
try {
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -108,7 +108,7 @@ export async function findDesktopPublication(root: string, expected: {
|
||||
for (const entry of entries) {
|
||||
if (!entry.isDirectory() || !entry.name.startsWith('publish-')) continue
|
||||
const directory = join(root, entry.name)
|
||||
let operation
|
||||
let operation: unknown
|
||||
try { operation = JSON.parse(await readFile(join(directory, 'operation.json'), 'utf8')) } catch (error) {
|
||||
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') continue
|
||||
throw error
|
||||
File renamed without changes.
File renamed without changes.
Loaded 100 of 1923 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user