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:
LegGasai committed 2026-11-12 13:53:45 +08:00
commit f4ac78bb34
1923 files changed
+22997 -25323

No files matched your search

+4
View File
@@ -233,6 +233,8 @@ Manage profile files and apply their declared reload lifecycle.
/** Read current plugins, including why a row cannot be changed through the profile patch.
* @returns Current runtime entries with persistent patch targets.
* @throws {PluginManagerError} `PLUGIN_MANAGER_PROFILE_READ_FAILED` to in-process callers when the profile patches
* cannot be read; Remote callers receive `gateway/internal`.
*/
@Remote async listPlugins(): Promise<PluginInfo[]>
@@ -240,6 +242,8 @@ Manage profile files and apply their declared reload lifecycle.
* A dependency without a bundle patch is listed, as a `not-bundle` problem, only while it is selected.
* @returns Package versions, manifest descriptions, the installable spec of profile dependencies, rows, optional
* display metadata, activation selections, whether the installation offers the bundle, and removal availability.
* @throws {PluginManagerError} `PLUGIN_MANAGER_PROFILE_READ_FAILED` to in-process callers when a profile or
* installation manifest cannot be read; Remote callers receive `gateway/internal`.
*/
@Remote listBundles(): Promise<BundleInfo[]>
+4
View File
@@ -233,6 +233,8 @@ Manage profile files and apply their declared reload lifecycle.
/** Read current plugins, including why a row cannot be changed through the profile patch.
* @returns Current runtime entries with persistent patch targets.
* @throws {PluginManagerError} `PLUGIN_MANAGER_PROFILE_READ_FAILED` to in-process callers when the profile patches
* cannot be read; Remote callers receive `gateway/internal`.
*/
@Remote async listPlugins(): Promise<PluginInfo[]>
@@ -240,6 +242,8 @@ Manage profile files and apply their declared reload lifecycle.
* A dependency without a bundle patch is listed, as a `not-bundle` problem, only while it is selected.
* @returns Package versions, manifest descriptions, the installable spec of profile dependencies, rows, optional
* display metadata, activation selections, whether the installation offers the bundle, and removal availability.
* @throws {PluginManagerError} `PLUGIN_MANAGER_PROFILE_READ_FAILED` to in-process callers when a profile or
* installation manifest cannot be read; Remote callers receive `gateway/internal`.
*/
@Remote listBundles(): Promise<BundleInfo[]>
+7 -4
View File
@@ -3,11 +3,14 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/computer-use.md
/computer-use:
en: bf7dcc9124e8bce2
zh: 4199c51e21dc9b0a
en: 45a0f430190937de
zh: 7b48603bebfcd1c6
/computer-use/serve-computer-use-to-another-harness:
en: 6424dd8388f342fb
zh: c5ecebb60ab1f50f
/computer-use/choose-a-provider:
en: fa2e0d7b41c0450b
zh: af9a799711f901e6
en: 4a72c1987678a47b
zh: b039d15b4e782cc4
/computer-use/lifetime-and-desktop-sharing:
en: 08ff155ad3d75953
zh: 48821856b6dff051
+44 -4
View File
@@ -4,9 +4,9 @@ English | [中文](computer-use.zh.md)
Computer use lets a model observe and operate the local desktop through a configured provider. The shared DSH capability is called **computer use**; **Cua Driver** names the upstream implementation.
[Computer Use](../../packages/experimental/cua-bundle/README.md) provides an optional experimental switch for macOS CUA permission setup.
[Computer Use](../../packages/experimental/cua-bundle/README.md) is an optional experimental bundle for macOS and Windows.
The [`macOS CUA provider`](../../packages/experimental/cua-macos/README.md) uses the [shared CUA objects and executor](../../packages/experimental/cua/README.md), which enforce application consent through User Questions and profile configuration.
Both native providers use the [shared CUA library](../../packages/experimental/cua/README.md#use-this-package) to check configured and saved application grants. When a decision is needed, the library asks the user through User Questions.
The CUA provider owns `ctx.cuaAccess` for system-permission status, explicit system requests, and application revocation. Its [permission page](../../packages/experimental/cua/README.md) projects these controls; app/window operations enforce the provider's consent policy before dispatch.
@@ -19,16 +19,22 @@ The CUA provider owns `ctx.cuaAccess` for system-permission status, explicit sys
The [shared object API](../../packages/experimental/cua/README.md) uses `connectCua` to select an application, then `app.getWindows()` and `app.getWindow(windowId)` to select a window for screenshots and pointer input. Accessibility operations use element IDs from the latest tree for that application handle. Providers declare keyboard scopes and application-level accessibility in `getCapabilities()`.
## Serve Computer Use to another harness
[Computer use MCP server](../../packages/experimental/cua-mcp/README.md) is a shipped optional bundle that composes the standalone `cua-mcp` profile; a profile manifest that selects it alone is the whole setup. `dsh --profile cua-mcp` serves `cua_get_api_reference`, `cua_run_code`, and `cua_reset` to one MCP client such as Codex or Claude Code; each connection owns one Agent whose programs retain application and window objects, and consent is granted unattended or forwarded to the client as an elicitation. The profile runs no model turn and records no root tool calls in its Session.
## Choose a provider
Mount [`dsh-computer-use`](../../packages/computer-use/computer-use/README.md) and one provider in the same composition. Both Cua Driver providers are experimental public npm packages and require explicit activation.
Mount [`dsh-computer-use`](../../packages/computer-use/computer-use/README.md) and one provider in the same composition. The Computer Use bundle selects the native provider for the host platform. Custom compositions can also mount a provider directly.
| Provider | Runtime |
|---|---|
| [macOS CUA](../../packages/experimental/cua-macos/README.md) | Swift helper using macOS Accessibility |
| [Windows CUA](../../packages/experimental/cua-windows/README.md) | .NET helper using Windows UI Automation |
| [Cua Driver MCP](../../packages/experimental/computer-use-cua-driver-mcp/README.md) | An already installed `cua-driver` executable connected through MCP |
| [Cua Driver native](../../packages/experimental/computer-use-cua-driver-native/README.md) | The platform-native runtime installed with the npm dependency |
Each provider supplies its upstream tool catalog. The shared service registers only a name and rejects any second provider, including another instance with the same name. It has no common desktop-operation methods or model-controlled selector.
The two Cua Driver providers are public experimental npm packages. Mount one explicitly to expose its upstream tool catalog. The shared service registers only a name and rejects any second provider, including another instance with the same name. It has no common desktop-operation methods or model-controlled selector.
## Lifetime and desktop sharing
@@ -136,4 +142,38 @@ Browser controls for provider-owned native permission and application decisions.
```
Source: [`packages/experimental/cua/src/access.ts`](../../packages/experimental/cua/src/access.ts)
<a id="ctxcuaprograms--cuaprograms"></a>
### `ctx.cuaPrograms` — `CuaPrograms`
Host control over the dedicated `cua_run_code` environments; registered as `ctx.cuaPrograms`.
```ts cordis-catalog
/**
* Release one Agent's retained program environment with the dedicated runtime's owner release. The program
* process exits, a program of that Agent that is still running fails as aborted, and the next `cua_run_code`
* call starts a fresh process that re-creates the `cua` global. The Agent, its application grants and native
* connection, and the desktop applications themselves are unaffected. The runtime rejects that Agent's
* programs until the release settles, so the caller holds them back; after a failed release it rejects them
* until a later release succeeds. Resolves when no environment exists.
* @param agent - Agent whose `cua_run_code` state owner is released.
* @returns Completion after the process has exited and its output has drained.
* @throws When the process cleanup fails.
*/
release(agent: Agent): Promise<void>
/**
* Request-image target the provider delivered for a stored screenshot when `screenshotTarget` is configured.
* A host that forwards screenshots outside a model request reads the same request version with it, so the
* image a caller sees matches the coordinate space the provider mapped.
* @param image - Durable screenshot attachment from a `cua` result.
* @returns The fixed target, or undefined when the Agent's model route selects the delivered version.
*/
screenshotRequestTarget(image: ImageAttachmentRef): ImageRequestTarget | undefined
```
Types: [Agent](core.md) · [ImageAttachmentRef](attachment.md) · [ImageRequestTarget](attachment.md)
Source: [`packages/experimental/cua/src/tool-registration.ts`](../../packages/experimental/cua/src/tool-registration.ts)
<!-- END GENERATED cordis-surface -->
+44 -4
View File
@@ -4,9 +4,9 @@
计算机操作让模型通过配置的提供方观察并操作本地桌面。DSH 的共享能力称为 **computer use(计算机操作)**;**Cua Driver** 是上游实现的名称。
[Computer Use](../../packages/experimental/cua-bundle/README.zh.md) 提供 macOS CUA 及权限设置 的可选实验性开关。
[Computer Use](../../packages/experimental/cua-bundle/README.zh.md) 是适用于 macOS 和 Windows 的可选实验性插件组合。
[macOS CUA 提供方](../../packages/experimental/cua-macos/README.zh.md)使用[共享 CUA 对象与执行器](../../packages/experimental/cua/README.zh.md),通过 User Questions 和配置档设置执行应用授权。
两个原生提供方都通过[共享 CUA 库](../../packages/experimental/cua/README.zh.md#use-this-package)检查配置中指定或已保存的应用授权。需要用户决定时,共享库通过 User Questions 询问用户。
CUA provider 通过 `ctx.cuaAccess` 提供系统权限状态、用户主动申请和应用授权撤销。[权限页面](../../packages/experimental/cua/README.zh.md)投影这些控件;app/window 操作在分派前执行 provider 的授权检查。
@@ -19,16 +19,22 @@ CUA provider 通过 `ctx.cuaAccess` 提供系统权限状态、用户主动申
调用[共享对象 API](../../packages/experimental/cua/README.zh.md) 时,通过 `connectCua` 连接,选择应用后用 `app.getWindows()` 和 `app.getWindow(windowId)` 选择要截图或进行鼠标操作的窗口。辅助功能操作使用该应用句柄最近一次读取的树中的元素 ID。提供方通过 `getCapabilities()` 声明键盘输入支持的范围,以及是否支持应用级辅助功能。
## 向其他 harness 提供 Computer Use
[Computer Use MCP 服务器](../../packages/experimental/cua-mcp/README.zh.md)是随安装提供的可选组合包,独立组成 `cua-mcp` profile;只选它的 profile manifest 就是全部设置。`dsh --profile cua-mcp` 向一个 MCP 客户端(如 Codex 或 Claude Code)提供 `cua_get_api_reference`、`cua_run_code` 和 `cua_reset`;每个连接拥有一个 Agent,其程序保留应用与窗口对象,授权可无人值守放行或作为 elicitation 转发给客户端。该 profile 不运行模型回合,其 Session 中不记录根工具调用。
## 选择提供方
在同一组合中挂载 [`dsh-computer-use`](../../packages/computer-use/computer-use/README.zh.md) 和一个提供方。两个 Cua Driver 提供方都是公开发布到 npm 的实验性包,均需显式启用。
在同一组合中挂载 [`dsh-computer-use`](../../packages/computer-use/computer-use/README.zh.md) 和一个提供方。Computer Use 组合会按宿主平台选择原生提供方。自定义组合也可以直接挂载提供方。
| 提供方 | 运行时 |
|---|---|
| [macOS CUA](../../packages/experimental/cua-macos/README.zh.md) | 使用 macOS 辅助功能的 Swift helper |
| [Windows CUA](../../packages/experimental/cua-windows/README.zh.md) | 使用 Windows UI Automation 的 .NET helper |
| [Cua Driver MCP](../../packages/experimental/computer-use-cua-driver-mcp/README.zh.md) | 通过 MCP 连接已安装的 `cua-driver` 可执行文件 |
| [Cua Driver 原生](../../packages/experimental/computer-use-cua-driver-native/README.zh.md) | 随 npm 依赖安装的平台原生运行时 |
各提供方提供上游工具目录。共享服务只注册名称,并拒绝任何第二个提供方,包括使用相同名称的另一个实例。服务不包含通用桌面操作方法或模型控制的选择器。
两个 Cua Driver 提供方都是公开发布到 npm 的实验性包。显式挂载其中一个即可使用它的上游工具目录。共享服务只注册名称,并拒绝任何第二个提供方,包括使用相同名称的另一个实例。服务不包含通用桌面操作方法或模型控制的选择器。
## 生命周期和桌面共享
@@ -136,4 +142,38 @@ Browser controls for provider-owned native permission and application decisions.
```
Source: [`packages/experimental/cua/src/access.ts`](../../packages/experimental/cua/src/access.ts)
<a id="ctxcuaprograms--cuaprograms"></a>
### `ctx.cuaPrograms` — `CuaPrograms`
Host control over the dedicated `cua_run_code` environments; registered as `ctx.cuaPrograms`.
```ts cordis-catalog
/**
* Release one Agent's retained program environment with the dedicated runtime's owner release. The program
* process exits, a program of that Agent that is still running fails as aborted, and the next `cua_run_code`
* call starts a fresh process that re-creates the `cua` global. The Agent, its application grants and native
* connection, and the desktop applications themselves are unaffected. The runtime rejects that Agent's
* programs until the release settles, so the caller holds them back; after a failed release it rejects them
* until a later release succeeds. Resolves when no environment exists.
* @param agent - Agent whose `cua_run_code` state owner is released.
* @returns Completion after the process has exited and its output has drained.
* @throws When the process cleanup fails.
*/
release(agent: Agent): Promise<void>
/**
* Request-image target the provider delivered for a stored screenshot when `screenshotTarget` is configured.
* A host that forwards screenshots outside a model request reads the same request version with it, so the
* image a caller sees matches the coordinate space the provider mapped.
* @param image - Durable screenshot attachment from a `cua` result.
* @returns The fixed target, or undefined when the Agent's model route selects the delivered version.
*/
screenshotRequestTarget(image: ImageAttachmentRef): ImageRequestTarget | undefined
```
Types: [Agent](core.zh.md) · [ImageAttachmentRef](attachment.zh.md) · [ImageRequestTarget](attachment.zh.md)
Source: [`packages/experimental/cua/src/tool-registration.ts`](../../packages/experimental/cua/src/tool-registration.ts)
<!-- END GENERATED cordis-surface -->
+3
View File
@@ -48,6 +48,9 @@ list(): CordisInspectProviderView[]
* @param signal - tool-call cancellation.
* @returns provider JSON data; Client queries fail fast when Gateway has no live Client
* and retain only the first observed failure diagnostic for timeout reporting.
* @throws {InspectError} for an unknown provider or method, invalid input or output, a missing
* Client, a Client timeout, or a Host provider failure without its own `HarnessError`; cancellation
* rethrows the signal's reason.
*/
async query( platform: CordisInspectPlatform, providerId: string, methodName: string, input: JsonValue | undefined, agent: Agent, signal: AbortSignal, ): Promise<JsonValue>
+3
View File
@@ -48,6 +48,9 @@ list(): CordisInspectProviderView[]
* @param signal - tool-call cancellation.
* @returns provider JSON data; Client queries fail fast when Gateway has no live Client
* and retain only the first observed failure diagnostic for timeout reporting.
* @throws {InspectError} for an unknown provider or method, invalid input or output, a missing
* Client, a Client timeout, or a Host provider failure without its own `HarnessError`; cancellation
* rethrows the signal's reason.
*/
async query( platform: CordisInspectPlatform, providerId: string, methodName: string, input: JsonValue | undefined, agent: Agent, signal: AbortSignal, ): Promise<JsonValue>
+1 -1
View File
@@ -2066,7 +2066,7 @@ Source: [`packages/experimental/client-ui-forge/src/index.ts`](../../packages/ex
### `ctx.forgeSession` — `ForgeSessionService`
Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` results and from `plugin:forge-session/binding` records. After each push result, and when a caller reports the branch a Session works on, the service looks up open change requests whose head is that branch and records the unbound ones as discovered. Watching a Session polls its visible change requests through `ctx.forge`.
Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` results, including those of shell calls inside PTC programs, and from `plugin:forge-session/binding` records. After each push result, and when a caller reports the branch a Session works on, the service looks up open change requests whose head is that branch and records the unbound ones as discovered. Watching a Session polls its visible change requests through `ctx.forge`.
```ts cordis-catalog
/**
+1 -1
View File
@@ -2068,7 +2068,7 @@ Source: [`packages/experimental/client-ui-forge/src/index.ts`](../../packages/ex
### `ctx.forgeSession` — `ForgeSessionService`
Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` results and from `plugin:forge-session/binding` records. After each push result, and when a caller reports the branch a Session works on, the service looks up open change requests whose head is that branch and records the unbound ones as discovered. Watching a Session polls its visible change requests through `ctx.forge`.
Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` results, including those of shell calls inside PTC programs, and from `plugin:forge-session/binding` records. After each push result, and when a caller reports the branch a Session works on, the service looks up open change requests whose head is that branch and records the unbound ones as discovered. Watching a Session polls its visible change requests through `ctx.forge`.
```ts cordis-catalog
/**
+4 -4
View File
@@ -18,8 +18,8 @@
en: 9aa0df86a35e1a0e
zh: 58f5382ef3f11f06
/mcp/protocol-and-results:
en: 46e9b914f016b636
zh: e1e9ee92a22f2562
en: e935c5aaa53e0e81
zh: c86cea6be89bb1db
/mcp/resources-and-instructions:
en: df9cc13a5d6eb923
zh: 3276d65c19d4c446
@@ -30,5 +30,5 @@
en: 27a59706525c88ed
zh: 1fb1684bc03bb6ae
/mcp/further-reading:
en: 1d24646cc4174154
zh: 3cb4253d39402451
en: b2642914c5a9def4
zh: eb1f739949e040b0
+2 -1
View File
@@ -55,7 +55,7 @@ The [native Cua Driver provider](../../packages/experimental/computer-use-cua-dr
Both stdio and Streamable HTTP use the official SDK's negotiation, discovery, protocol validation, and cancellation. Tool-list changes trigger discovery through legacy notifications or a modern subscription. A failed refresh retains the previous tool generation; connection recovery follows the [client lifecycle](../../packages/mcp/mcp-client/README.md#use-this-package).
The result adapter retains canonical MCP JSON for programmatic callers and prepares ordinary tool content. Supported images use the attachment system; unsupported rich content produces explicit text diagnostics. The tool registry remains authoritative for policy failures and replaced results. The [tool contracts](tools.md) own recording and final presentation; the [client result reference](../../packages/mcp/mcp-client/README.md#use-this-package) owns MCP-specific projection details.
The result adapter retains canonical MCP JSON for programmatic callers and prepares ordinary tool content. Supported images use the attachment system; unsupported rich content produces explicit text diagnostics. Server `isError` results and request failures throw `McpToolError` with a code that tells the caller whether the request's outcome is known, such as `MCP_TOOL_ERROR`, `MCP_CONNECTION_CLOSED`, or `MCP_TIMEOUT`; the client README lists every code. The tool registry remains authoritative for policy failures and replaced results. The [tool contracts](tools.md) own recording and final presentation; the [client result reference](../../packages/mcp/mcp-client/README.md#use-this-package) owns MCP-specific projection details.
-----
@@ -115,6 +115,7 @@ MCP prompt templates, human-input elicitation, task-based execution, and resourc
- [Resource visibility reference](../../packages/mcp/mcp-resources/README.md) — shared profile mounting and visibility from configured servers.
- [Third-party memory servers](../user/guide/mcp-memory.md) — product configuration guide.
- [Protocol negotiation reference](../../packages/mcp/mcp-client/README.md) — SDK ownership and compatibility decisions.
- [Computer use MCP server](../../packages/experimental/cua-mcp/README.md) — DSH as an MCP stdio server that serves Computer Use programs to other harnesses.
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
+2 -1
View File
@@ -55,7 +55,7 @@ Web 与 Desktop profile 还统一挂载一次 [MCP 服务器管理器](../../pac
stdio 和 Streamable HTTP 都使用官方 SDK 的协商、发现、协议校验和取消机制。工具列表变化通过旧版通知或现代订阅触发发现。刷新失败时保留上一代工具;连接恢复遵循[客户端生命周期](../../packages/mcp/mcp-client/README.zh.md#use-this-package)。
结果适配器为程序化调用方保留规范 MCP JSON,并准备普通工具内容。受支持的图像使用附件系统;不受支持的富内容产生明确的文本诊断。工具注册表仍决定策略失败和结果替换。[工具契约](tools.zh.md) 维护记录和最终呈现规则;[客户端结果参考](../../packages/mcp/mcp-client/README.zh.md#use-this-package) 维护 MCP 特有的投影细节。
结果适配器为程序化调用方保留规范 MCP JSON,并准备普通工具内容。受支持的图像使用附件系统;不受支持的富内容产生明确的文本诊断。服务器 `isError` 结果与请求失败抛出 `McpToolError`,其 code 告诉调用方请求结果是否已知,例如 `MCP_TOOL_ERROR`、`MCP_CONNECTION_CLOSED` 或 `MCP_TIMEOUT`;客户端 README 列出全部 code。工具注册表仍决定策略失败和结果替换。[工具契约](tools.zh.md) 维护记录和最终呈现规则;[客户端结果参考](../../packages/mcp/mcp-client/README.zh.md#use-this-package) 维护 MCP 特有的投影细节。
-----
@@ -115,6 +115,7 @@ interface McpResourceProvider {
- [资源可见性参考](../../packages/mcp/mcp-resources/README.zh.md) — profile 统一挂载及由已配置服务器决定的可见性。
- [第三方记忆服务器](../user/guide/mcp-memory.zh.md) — 产品配置指南。
- [协议协商参考](../../packages/mcp/mcp-client/README.zh.md) — SDK 职责与兼容性决策。
- [Computer Use MCP 服务器](../../packages/experimental/cua-mcp/README.zh.md) — DSH 作为 MCP stdio 服务器向其他 harness 提供 Computer Use 程序。
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
+2 -2
View File
@@ -15,8 +15,8 @@
en: ee04468005fae8e1
zh: 1347d554102951f2
/plan-mode/the-exit-tool-and-the-plan-command:
en: 32ecfb7086dd1578
zh: 0aaeaa69bb63f255
en: c9e86f6312dab80f
zh: 41b763216d6b1a54
/plan-mode/the-service:
en: f3e6d5a7fe0b67f0
zh: 774cc97e493991fa
+1 -1
View File
@@ -30,7 +30,7 @@ A missing, blank, or non-string `section` and any unknown key fail at plugin loa
## The exit tool and the `/plan` command
[`exit_plan_mode`](../tool-catalog.md#deepseek-aidsh-plan-mode) is disclosed progressively: it is admitted from the first step whose selected plan state is active and stays admitted for the rest of the Session, so the first plan-mode entry adds it to the request tool declarations and later transitions change only the plan guidance. Native and PTC execution use the same admitted set; a call before the first entry returns `UNKNOWN_TOOL`, and a call while plan mode is not committed fails. In plan mode it requires a complete markdown plan starting with a `#` heading and presents it for review through the [user-questions seam](user-questions.md). Approval returns `{ approved: true }` and records a silent (non-narrated) pending exit that is appended at the next accepted in-turn pre-step. Plan guidance therefore remains active for the rest of the assistant's current tool batch, and the tool result itself reports the transition. Keep-planning is a failed call carrying the user's feedback, so the model revises and presents again. A dismissed review returns `{ approved: false }` and concludes the turn, so plan mode stays active until the user's next message. A missing interaction channel and a service reload during review also fail the call rather than silently leaving plan mode.
[`exit_plan_mode`](../tool-catalog.md#deepseek-aidsh-plan-mode) is disclosed progressively: it is admitted from the first step whose selected plan state is active and stays admitted for the rest of the Session, so the first plan-mode entry adds it to the request tool declarations and later transitions change only the plan guidance. Native and PTC execution use the same admitted set; a call before the first entry returns `UNKNOWN_TOOL`, and a call while plan mode is not committed fails with `PlanModeError` `PLAN_NOT_ACTIVE`. In plan mode it requires a complete markdown plan starting with a `#` heading, rejecting any other plan with `ToolArgsError`, and presents it for review through the [user-questions seam](user-questions.md). Approval returns `{ approved: true }` and records a silent (non-narrated) pending exit that is appended at the next accepted in-turn pre-step. Plan guidance therefore remains active for the rest of the assistant's current tool batch, and the tool result itself reports the transition. Keep-planning is a failed call with `PlanModeError` `PLAN_REVISION_REQUESTED` carrying the user's feedback, so the model revises and presents again. A dismissed review returns `{ approved: false }` and concludes the turn, so plan mode stays active until the user's next message. A missing interaction channel (`ToolContextUnavailableError`) and a service reload during review (`PLAN_REVIEW_INTERRUPTED`) also fail the call rather than silently leaving plan mode.
When [`ctx.commands`](commands.md) is composed, the plugin registers `/plan [off|message]`: bare `/plan` selects plan mode, any other non-empty message selects it and then submits the text through `agent.steer()` so it becomes the next step's ordinary logged user message under plan guidance, and the exact argument `off` selects inactive, which also cancels a pending entry before it is appended and becomes visible to a request.
+1 -1
View File
@@ -30,7 +30,7 @@ interface PlanModeConfig {
## 退出工具与 `/plan` 命令
[`exit_plan_mode`](../tool-catalog.zh.md#deepseek-aidsh-plan-mode) 采用渐进式披露:从已选计划状态首次为激活的步骤起准入,并在会话剩余部分保持准入,因此首次进入计划模式时它进入请求的工具声明,之后的切换只改变计划指引。原生与 PTC 执行使用同一准入集合;首次进入之前调用返回 `UNKNOWN_TOOL`,计划模式未提交时调用会失败。在计划模式中,它要求一份以 `#` 标题开头的完整 markdown 计划,并通过[用户交互 seam](user-questions.zh.md) 呈交评审。批准返回 `{ approved: true }`,并记录一个静默(不叙述)的待生效退出,由下一个被接受的轮内 pre-step 追加。因此,计划指引在 assistant 当前这批工具调用的剩余部分继续生效,而工具结果本身会报告这次转换。「继续规划」则是一次携带用户反馈的失败调用,模型据此修订并再次呈交。放弃评审返回 `{ approved: false }` 并结束当前轮次,计划模式保持激活,直到用户发出下一条消息。评审期间交互通道缺失或服务重载同样使调用失败,而不是静默离开计划模式。
[`exit_plan_mode`](../tool-catalog.zh.md#deepseek-aidsh-plan-mode) 采用渐进式披露:从已选计划状态首次为激活的步骤起准入,并在会话剩余部分保持准入,因此首次进入计划模式时它进入请求的工具声明,之后的切换只改变计划指引。原生与 PTC 执行使用同一准入集合;首次进入之前调用返回 `UNKNOWN_TOOL`,计划模式未提交时调用以 `PlanModeError` `PLAN_NOT_ACTIVE` 失败。在计划模式中,它要求一份以 `#` 标题开头的完整 markdown 计划,其他计划以 `ToolArgsError` 拒绝,并通过[用户交互 seam](user-questions.zh.md) 呈交评审。批准返回 `{ approved: true }`,并记录一个静默(不叙述)的待生效退出,由下一个被接受的轮内 pre-step 追加。因此,计划指引在 assistant 当前这批工具调用的剩余部分继续生效,而工具结果本身会报告这次转换。「继续规划」则是一次以 `PlanModeError` `PLAN_REVISION_REQUESTED` 失败并携带用户反馈的调用,模型据此修订并再次呈交。放弃评审返回 `{ approved: false }` 并结束当前轮次,计划模式保持激活,直到用户发出下一条消息。交互通道缺失(`ToolContextUnavailableError`)或评审期间服务重载(`PLAN_REVIEW_INTERRUPTED`)同样使调用失败,而不是静默离开计划模式。
当 [`ctx.commands`](commands.zh.md) 被组合时,插件注册 `/plan [off|message]`:单独的 `/plan` 选择计划模式;任何其他非空消息先选择计划模式,再通过 `agent.steer()` 提交该文本,使其在计划指引下成为下一步骤的普通已记录用户消息;确切参数 `off` 选择未激活,这还会在待生效条目被追加并对请求可见之前将其取消。
+4 -4
View File
@@ -151,8 +151,8 @@ interface PtcBindingNamespace {
* The global identifier the program sees. Must match the LANGUAGE-PORTABLE
* identifier subset `[A-Za-z_][A-Za-z0-9_]*` and no language's reserved
* words, so the same namespace list works against every backend regardless
* of `language` — a JS-only spelling like `$tools` is rejected by design,
* not just by the Python backend. Names that satisfy the identifier rule but
* of `language` — a JS-only spelling like `$tools` is always rejected.
* Names that satisfy the identifier rule but
* name a backend-owned slot (`RESERVED_BINDING_GLOBALS`, e.g. `inspect`, `console`, `Image`,
* `__dsh_main__`) are also refused everywhere; see its declaration for the
* exact set and why each entry is reserved.
@@ -250,7 +250,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
### `ctx.ptcRuntime` — `PtcRuntime` (abstract seam)
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects, with PtcRuntimeError. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
```ts cordis-catalog
/**
@@ -281,7 +281,7 @@ registerEnvironmentInitializer(program: string): () => Promise<void>
* Resolve supported options and provider defaults before execution.
* @param request - Program, bindings, cancellation and optional execution choices.
* @returns Complete directory, deadline and supported authority for run.
* @throws When an explicit choice is invalid or unsupported by this provider.
* @throws When an explicit choice is invalid or unsupported by this provider; contract misuse throws {@link PtcRuntimeError}.
*/
abstract resolve(request: PtcRunRequest): PtcRunSpec
+4 -4
View File
@@ -151,8 +151,8 @@ interface PtcBindingNamespace {
* The global identifier the program sees. Must match the LANGUAGE-PORTABLE
* identifier subset `[A-Za-z_][A-Za-z0-9_]*` and no language's reserved
* words, so the same namespace list works against every backend regardless
* of `language` — a JS-only spelling like `$tools` is rejected by design,
* not just by the Python backend. Names that satisfy the identifier rule but
* of `language` — a JS-only spelling like `$tools` is always rejected.
* Names that satisfy the identifier rule but
* name a backend-owned slot (`RESERVED_BINDING_GLOBALS`, e.g. `inspect`, `console`, `Image`,
* `__dsh_main__`) are also refused everywhere; see its declaration for the
* exact set and why each entry is reserved.
@@ -250,7 +250,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
### `ctx.ptcRuntime` — `PtcRuntime` (abstract seam)
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects, with PtcRuntimeError. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
```ts cordis-catalog
/**
@@ -281,7 +281,7 @@ registerEnvironmentInitializer(program: string): () => Promise<void>
* Resolve supported options and provider defaults before execution.
* @param request - Program, bindings, cancellation and optional execution choices.
* @returns Complete directory, deadline and supported authority for run.
* @throws When an explicit choice is invalid or unsupported by this provider.
* @throws When an explicit choice is invalid or unsupported by this provider; contract misuse throws {@link PtcRuntimeError}.
*/
abstract resolve(request: PtcRunRequest): PtcRunSpec
+2 -2
View File
@@ -6,8 +6,8 @@
en: ad77015352a17ed6
zh: 5c84933161845393
/skills/provider-registry:
en: abe338b6c6d1ebd1
zh: c604db2de10a23c4
en: 3fe1dff933bdb3f4
zh: b3f21b85a38bfaef
/skills/local-discovery-priority:
en: 390fc00bbccfb777
zh: 96ff7abfbd4b911b
+1 -1
View File
@@ -12,7 +12,7 @@ Source: [`packages/skill/skill/src/index.ts`](../../packages/skill/skill/src/ind
The registry is host+per-scope layered, the shape the [tools registry](tools.md) established over [dsh-scope](../../packages/core/scope): a registration files into the layer of its calling context's scope, so host rows and repository plugins land in the global layer while a plugin mounted by an agent preset's standing composition lands in that preset's layer, and provider names are unique per layer rather than process-wide. A read merges the global layer with the viewing scope's chain — the nearest layer's entry wins a duplicate skill name outright, and the rank order below decides duplicates only within one layer. Discovery caches are keyed by the resolved scope chain, so re-parenting a scope (a blank-session recompose) is visible to the next read without a registry mutation.
Within one layer, duplicate names resolve by rank, provider order, then local order; summaries sort by name. A rejected `list()` is logged and omitted from an incomplete observation, while an explicit incomplete observation contributes usable candidates without making the result cacheable; malformed candidates fail fast. Each provider factory receives a registration-scoped control whose `invalidate()` clears completed catalogs only while that exact registration remains active and whose signal aborts on failed registration or disposal. An in-flight discovery retries once when its provider generation changes; a second change returns the latest candidates incomplete and uncached. Provider and runtime mutations emit the unfiltered `skills/change` invalidation event; it carries no diff, so consumers refetch `snapshot()` with their own lookup options.
Within one layer, duplicate names resolve by rank, provider order, then local order; summaries sort by name. A rejected `list()` is logged and omitted from an incomplete observation, while an explicit incomplete observation contributes usable candidates without making the result cacheable; malformed candidates fail fast as `SkillError` with `SKILL_INVALID_DEFINITION`. Each provider factory receives a registration-scoped control whose `invalidate()` clears completed catalogs only while that exact registration remains active and whose signal aborts on failed registration or disposal. An in-flight discovery retries once when its provider generation changes; a second change returns the latest candidates incomplete and uncached. Provider and runtime mutations emit the unfiltered `skills/change` invalidation event; it carries no diff, so consumers refetch `snapshot()` with their own lookup options.
An array returned by `SkillProvider.list()` is complete-discovery shorthand. `SkillProviderObservation` lets a provider expose candidates that remain directly loadable while reporting that the observation is not authoritative.
+1 -1
View File
@@ -12,7 +12,7 @@
注册表采用宿主 + 按 scope 的分层结构,即[工具注册表](tools.zh.md)在 [dsh-scope](../../packages/core/scope) 之上确立的形态:注册会落入调用方上下文 scope 对应的层——宿主行与 repository 插件落入全局层,由 agent(智能体) preset 常驻组合挂载的插件落入该 preset 的层——提供方名称在每层内唯一,而非进程级唯一。读取时将全局层与观察 scope 的链合并:最近层的条目直接赢得重名 skill,下文的 rank 顺序只在单层内裁决重名。发现缓存以解析后的 scope 链为键,因此重设 scope 父级(空会话重组)无需注册表变更即可被下一次读取看到。
在单层内,重名项依次按 rank、提供方顺序和本地顺序确定优先级;摘要按名称排序。提供方的 `list()` 被拒绝时,系统会记录日志,并从不完整观测中省略该提供方的结果;显式的不完整观测会提供可用候选项,但不会使结果变得可缓存;格式错误的候选项快速失败。每个提供方工厂都会接收一项注册作用域内的控制能力;仅当该精确注册仍处于活动状态时,其 `invalidate()` 才会清除已完成目录;注册失败或 dispose(资源释放)时,其信号会中止。若提供方代次在发现进行期间发生变化,该发现会重试一次;若再次变化,则返回最新候选项,并将结果标为不完整且不予缓存。提供方和运行时变更会发出不带过滤条件的 `skills/change` 失效事件;该事件不携带 diff,因此消费方会使用自身的查找选项重新获取 `snapshot()`。
在单层内,重名项依次按 rank、提供方顺序和本地顺序确定优先级;摘要按名称排序。提供方的 `list()` 被拒绝时,系统会记录日志,并从不完整观测中省略该提供方的结果;显式的不完整观测会提供可用候选项,但不会使结果变得可缓存;格式错误的候选项以带 `SKILL_INVALID_DEFINITION` 的 `SkillError` 快速失败。每个提供方工厂都会接收一项注册作用域内的控制能力;仅当该精确注册仍处于活动状态时,其 `invalidate()` 才会清除已完成目录;注册失败或 dispose(资源释放)时,其信号会中止。若提供方代次在发现进行期间发生变化,该发现会重试一次;若再次变化,则返回最新候选项,并将结果标为不完整且不予缓存。提供方和运行时变更会发出不带过滤条件的 `skills/change` 失效事件;该事件不携带 diff,因此消费方会使用自身的查找选项重新获取 `snapshot()`。
`SkillProvider.list()` 返回的数组是完整发现的简写形式。`SkillProviderObservation` 允许提供方公开仍可直接加载的候选项,同时报告该观测不具权威性。
+2 -2
View File
@@ -18,8 +18,8 @@
en: 278b2eee160be413
zh: d6e0fd1e9f4a4b27
/web-client-slots/framework-provided-hooks:
en: c9f8d836214623ae
zh: 76dec55006396535
en: e1090f50013a2483
zh: fd8db6ff6d4d0936
/web-client-slots/developer-provided-injection:
en: 3481dfa6cd3097da
zh: acbd6f06a7da1752
+2 -1
View File
@@ -106,7 +106,8 @@ The shipped adapters add these standard props. They are available according to t
| Availability | Props | Owner |
|---|---|---|
| every scope | `useSessions`, `useSessionStatus`, `useSessionRetainInfo`, `useSessionAccess` | `ui-session` |
| every scope | `useSessions`, `useSessionRetainInfo`, `useSessionAccess` | `ui-session` |
| every scope | `useSessionStatus` | `ui-session-status` |
| every scope | `useWorkspaces`, `useWorkspaceAccess` | `ui-workspace` |
| every scope | `useRemoteAccess` (the `global` resource) | `api-remote-access` |
| every scope | `usePanelInfo` | `ui-layout` |
+2 -1
View File
@@ -108,7 +108,8 @@ hoc entry 是以必填 `id` 和可选 `key` 寻址的一层。不带 `key` 的
| 可用范围 | Props | Owner |
|---|---|---|
| 所有 scope | `useSessions`、`useSessionStatus`、`useSessionRetainInfo`、`useSessionAccess` | `ui-session` |
| 所有 scope | `useSessions`、`useSessionRetainInfo`、`useSessionAccess` | `ui-session` |
| 所有 scope | `useSessionStatus` | `ui-session-status` |
| 所有 scope | `useWorkspaces`、`useWorkspaceAccess` | `ui-workspace` |
| 所有 scope | `useRemoteAccess`(`global` 资源) | `api-remote-access` |
| 所有作用域 | `usePanelInfo` | `ui-layout` |
+2 -2
View File
@@ -24,5 +24,5 @@
en: 74fa698d4a115e80
zh: 4e9b03b5eab2ae5e
/user-interaction/errors:
en: 5762b1498a426ab6
zh: bb9987ec82103620
en: 832b165cfa48839d
zh: 6989f734b373c1f9
+6 -3
View File
@@ -209,7 +209,7 @@ After a Host restart, the Remote layer resumes the root agent when the Session r
## Errors
`UserQuestionError` extends `HarnessError`, so `ctx.tools.execute()` preserves `{ name, code }` for model-facing tool failures such as `EMPTY_QUESTIONS`, `BAD_INTENT`, `NO_PROVIDER`, `ASK_ABORTED`, or UI-side cancellation.
`UserQuestionError` extends `HarnessError`, so `ctx.tools.execute()` preserves `{ name, code }` for model-facing tool failures such as `EMPTY_QUESTIONS`, `BAD_INTENT`, `NO_PROVIDER`, `ASK_ABORTED`, or UI-side cancellation. An answerer failure that is not a `HarnessError` becomes `PROVIDER_ERROR` with the original message and the original as `cause`; another `HarnessError` keeps its own `name` and `code`.
```ts type-equiv
/** Stable error taxonomy for user-questions failures. */
@@ -286,8 +286,11 @@ async askTimed( request: AskUserQuestionRequest & { agent: Agent }, callId: Tool
* @returns The answer chosen or typed by the human.
* @throws {UserQuestionError} code `ASK_ABORTED` when the supplied signal
* is already or becomes aborted, `CALLER_NOT_LIVE` when a supplied agent
* is not the registry's exact live instance, or `DELEGATED_CALLER` when
* that live agent has subagent origin.
* is not the registry's exact live instance, `DELEGATED_CALLER` when
* that live agent has subagent origin, or `PROVIDER_ERROR`, keeping the
* original message, when an answerer fails with a value that is not a
* `HarnessError`; a coded `HarnessError` from an answerer keeps its `name`
* and `code`.
*/
async ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>
```
+6 -3
View File
@@ -209,7 +209,7 @@ Host 重启后,Session 重开时 Remote 层会恢复根 agent。之后的迟
## 错误
`UserQuestionError` 继承 `HarnessError`,因此 `ctx.tools.execute()` 会保留 `{ name, code }`,用于面向模型的工具失败,如 `EMPTY_QUESTIONS`、`BAD_INTENT`、`NO_PROVIDER`、`ASK_ABORTED` 或 UI 侧取消。
`UserQuestionError` 继承 `HarnessError`,因此 `ctx.tools.execute()` 会保留 `{ name, code }`,用于面向模型的工具失败,如 `EMPTY_QUESTIONS`、`BAD_INTENT`、`NO_PROVIDER`、`ASK_ABORTED` 或 UI 侧取消。不是 `HarnessError` 的应答方失败会变为 `PROVIDER_ERROR`,保留原 message,原错误作为 `cause`;其他 `HarnessError` 保留自身的 `name` 与 `code`。
```ts type-equiv
/** Stable error taxonomy for user-questions failures. */
@@ -286,8 +286,11 @@ async askTimed( request: AskUserQuestionRequest & { agent: Agent }, callId: Tool
* @returns The answer chosen or typed by the human.
* @throws {UserQuestionError} code `ASK_ABORTED` when the supplied signal
* is already or becomes aborted, `CALLER_NOT_LIVE` when a supplied agent
* is not the registry's exact live instance, or `DELEGATED_CALLER` when
* that live agent has subagent origin.
* is not the registry's exact live instance, `DELEGATED_CALLER` when
* that live agent has subagent origin, or `PROVIDER_ERROR`, keeping the
* original message, when an answerer fails with a value that is not a
* `HarnessError`; a coded `HarnessError` from an answerer keeps its `name`
* and `code`.
*/
async ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>
```
+2 -2
View File
@@ -24,8 +24,8 @@
en: c063711f8247c240
zh: 5e54758bbaf1670c
/web-client-architecture/conversation-and-presentation:
en: 9a22492f0d4359c6
zh: 55d449e383e88f62
en: f37ba948a8838fb0
zh: df19542d87860221
/web-client-architecture/data-paths:
en: a254278432416473
zh: 567c2d3c6a20b304
+1 -1
View File
@@ -57,7 +57,7 @@ This pairing is not a second source of business truth. Host controllers decide d
Web and desktop share the [Coding Tools preference](../../packages/client/ui-settings/README.md#use-this-package). It controls diagnostic Views, [available preset choices](../../packages/client/ui-agent-preset/README.md), changed-file cards, and the builtin HTML preview policy without changing Session records.
`ui-session` installs the Session scope adapter and publishes `useSessions`, `useSessionStatus`, `useSessionRetainInfo`, `useSessionAccess`, `useSession`, `sessionId`, `useProjection`, and the Session-scope `useAccess` over the [remote-access](../../packages/api/remote-access/README.md) Client service. `SessionProvider` inherits an outer binding or binds an explicit `SessionReference`, so concurrent subtrees can target different Sessions. Domain adapters add further standard sources without putting React hooks on the model objects.
`ui-session` installs the Session scope adapter and publishes `useSessions`, `useSessionRetainInfo`, `useSessionAccess`, `useSession`, `sessionId`, `useProjection`, and the Session-scope `useAccess` over the [remote-access](../../packages/api/remote-access/README.md) Client service. `SessionProvider` inherits an outer binding or binds an explicit `SessionReference`, so concurrent subtrees can target different Sessions. [`ui-session-status`](../../packages/client/ui-session-status/README.md) publishes `useSessionStatus` from the `ctx.uiSession.sessionStatus` table of running state, the effective pending interaction, and completion reminders. Domain adapters add further standard sources without putting React hooks on the model objects.
`ui-conversation` binds once to each `SessionBinding.eventSource`. Its event registry correlates durable Session events and Client-only `assistant/live-chunk` updates into stable business Contexts, and its view registry materializes target snapshots. Chat Assistant, Trajectory Assistant, and Turn Tail interpret both live chunks and the compact streams embedded in durable settlements, so reconnect and paged history reproduce the same Assistant state without durable token rows. `ui-chat` and `ui-trajectory` register separate Definitions and builders: they may interpret the same event family, but they do not import or share each other's final display model. The shell selects a registered view and passes its snapshot through standard hooks and Slots. [Conversation](conversation.md) defines Context identity, replay, Location data, target builders, and keyed renderers.
+1 -1
View File
@@ -57,7 +57,7 @@ Connection 拥有请求 URL 解析、request correlation、`/api` carrier、trus
Web 和桌面端共享[代码工作工具偏好](../../packages/client/ui-settings/README.zh.md#use-this-package)。它控制诊断 View、[可用的预设选项](../../packages/client/ui-agent-preset/README.zh.md)、改动文件卡片和内置 HTML 预览策略,不改变 Session 记录。
`ui-session` 安装 Session scope adapter,并在 [remote-access](../../packages/api/remote-access/README.zh.md) Client 服务之上提供 `useSessions`、`useSessionStatus`、`useSessionRetainInfo`、`useSessionAccess`、`useSession`、`sessionId`、`useProjection` 和会话作用域的 `useAccess`。`SessionProvider` 可以继承外围 binding,也可以绑定显式 `SessionReference`,因此并存子树可以指向不同 Session。领域 adapter 可以继续添加标准 source,但不会把 React hook 放进 model object。
`ui-session` 安装 Session scope adapter,并在 [remote-access](../../packages/api/remote-access/README.zh.md) Client 服务之上提供 `useSessions`、`useSessionRetainInfo`、`useSessionAccess`、`useSession`、`sessionId`、`useProjection` 和会话作用域的 `useAccess`。`SessionProvider` 可以继承外围 binding,也可以绑定显式 `SessionReference`,因此并存子树可以指向不同 Session。[`ui-session-status`](../../packages/client/ui-session-status/README.zh.md) 从 `ctx.uiSession.sessionStatus` 状态表提供 `useSessionStatus`,该表汇总运行状态、生效的待交互请求和完成提醒。领域 adapter 可以继续添加标准 source,但不会把 React hook 放进 model object。
`ui-conversation` 对每个 `SessionBinding.eventSource` 只绑定一次。它的 event registry 把持久 Session event 与 Client-only `assistant/live-chunk` update 关联成稳定的业务 Context,view registry 则 materialize target snapshot。Chat Assistant、Trajectory Assistant 与 Turn Tail 同时解释 live chunk 和持久 settlement 中嵌入的紧凑 stream,因此重连与分页历史无需持久 token 行即可复现相同 Assistant 状态。`ui-chat` 与 `ui-trajectory` 分别注册自己的 Definition 和 builder:它们可以解释同一 event family,但不会导入或共享彼此的最终 display model。Shell 选择一个已注册 view,再通过标准 hook 与 Slot 交付其 snapshot。[Conversation](conversation.zh.md)定义 Context identity、replay、Location data、target builder 与 keyed renderer。
+2 -2
View File
@@ -18,8 +18,8 @@
en: a86b204323005042
zh: 82b691e28ed4dcd3
/workflow/failure-discipline-workflowerror-fatal:
en: 4d390801bb07374c
zh: 1099f053c2ee26ec
en: 4a66b379e32c2583
zh: 9745625863b836a8
/workflow/events:
en: de123821a128c1d1
zh: e50bcaea2812575a
+6 -1
View File
@@ -79,6 +79,11 @@ interface WorkflowResult {
stopReason: WorkflowStopReason
/** The failure message (present iff `stopReason` is not `completed`). */
error?: string
/**
* The code of the fatal {@link WorkflowError} that ended an `error` run;
* absent when the script's own exception or the engine runtime ended it.
*/
errorCode?: WorkflowErrorCode
/**
* How many `agent()` calls the run accepted over its whole lifetime. On a
* graceful settlement this is the script-side count (calls still queued for
@@ -113,7 +118,7 @@ interface WorkflowRun {
## Failure discipline: `WorkflowError.fatal`
Hook misuse inside a script — bad arguments, unknown/deferred `agent()` options, a schema outside the [structured-output subset](../../packages/core/tools/README.md), a tripped cap, a seam start failure, cancellation — throws a `WorkflowError` with `fatal: true`. The `parallel()`/`pipeline()` combinators RE-THROW fatal errors instead of mapping the item to `null`: a typo'd option must kill the script loudly, never dissolve into something that reads as an ordinary child failure. The per-item `null` is reserved for child-run failures (a non-`completed` stop reason) and ordinary in-stage script errors.
Hook misuse inside a script — bad arguments, unknown/deferred `agent()` options, a schema outside the [structured-output subset](../../packages/core/tools/README.md), a tripped cap, a seam start failure, cancellation — throws a `WorkflowError` with `fatal: true`. The `parallel()`/`pipeline()` combinators RE-THROW fatal errors instead of mapping the item to `null`: a typo'd option must kill the script loudly, never dissolve into something that reads as an ordinary child failure. The per-item `null` is reserved for child-run failures (a non-`completed` stop reason) and ordinary in-stage script errors. When a fatal error ends a run, the engine reports its code as `WorkflowResult.errorCode`, and the `workflow` tool fails with that code, such as `AGENT_CAP`; a run that settled as `error` without one (the script's own exception or an engine runtime failure) fails with `RUN_FAILED`, and one that settled as `cancelled` with `CANCELLED`; when the calling step itself was aborted, the tool runtime's `AbortError` `ABORTED` result applies instead.
## Events
+6 -1
View File
@@ -79,6 +79,11 @@ interface WorkflowResult {
stopReason: WorkflowStopReason
/** The failure message (present iff `stopReason` is not `completed`). */
error?: string
/**
* The code of the fatal {@link WorkflowError} that ended an `error` run;
* absent when the script's own exception or the engine runtime ended it.
*/
errorCode?: WorkflowErrorCode
/**
* How many `agent()` calls the run accepted over its whole lifetime. On a
* graceful settlement this is the script-side count (calls still queued for
@@ -113,7 +118,7 @@ interface WorkflowRun {
## 失败纪律:`WorkflowError.fatal`
脚本内部的钩子误用:错误参数、未知或延迟的 `agent()` 选项、超出[结构化输出子集](../../packages/core/tools/README.zh.md)的 schema、超出上限、seam 启动失败、取消,都会抛出 `fatal: true` 的 `WorkflowError`。`parallel()`/`pipeline()` 组合器对 fatal 错误直接重新抛出,而非将该项映射为 `null`:一个拼写错误的选项必须明确报错并终止脚本,绝不能消融为看似普通子 agent 失败的结果。逐项的 `null` 保留给子运行失败(非 `completed` 的 stop reason)和阶段内的普通脚本错误。
脚本内部的钩子误用:错误参数、未知或延迟的 `agent()` 选项、超出[结构化输出子集](../../packages/core/tools/README.zh.md)的 schema、超出上限、seam 启动失败、取消,都会抛出 `fatal: true` 的 `WorkflowError`。`parallel()`/`pipeline()` 组合器对 fatal 错误直接重新抛出,而非将该项映射为 `null`:一个拼写错误的选项必须明确报错并终止脚本,绝不能消融为看似普通子 agent 失败的结果。逐项的 `null` 保留给子运行失败(非 `completed` 的 stop reason)和阶段内的普通脚本错误。致命错误结束运行时,引擎把其 code 报告为 `WorkflowResult.errorCode`,`workflow` 工具以该 code(如 `AGENT_CAP`)失败;以 `error` 结束但没有该 code 的运行(脚本自身抛出的异常或引擎运行时失败)以 `RUN_FAILED` 失败,以 `cancelled` 结束的运行以 `CANCELLED` 失败;调用方步骤本身被中止时,改为使用工具运行时的 `AbortError` `ABORTED` 结果。
## 事件