Merge branch 'feat/cli-account' into feat/dingtalk-plugin

This commit is contained in:
gengruilin committed 2026-10-29 16:01:16 +08:00
commit ad4d3040b2
1751 files changed
+99378 -6473

No files matched your search

+2 -2
View File
@@ -3,5 +3,5 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/README.md
/subsystems:
en: dcbb2f834453e166
zh: d73f32a7baeec42d
en: 81b2c48d922de5a9
zh: cf0db50b34d2feb3
+1
View File
@@ -52,6 +52,7 @@ One page per subsystem of the DeepSeek Harness: what it is, the data structures
| [voice-input.md](voice-input.md) | experimental named recognizers, transient audio and revision-guarded draft insertion |
| [translation.md](translation.md) | experimental anonymous text translation and explicit provider requests |
| [agent-team.md](agent-team.md) | Agent Teams: implicit Lead identity, named continuable teammates, direct peer inbox delivery, and shared task DAG |
| [liveshare.md](liveshare.md) | the opt-in LiveShare bundle: nested share modes, a fork's ceiling and durability, enforcement installation, and the constraint a shared Session's externally driven turns run under |
| [claude-code-mods.md](claude-code-mods.md) | Claude Code mods through the experimental bridge: every event, `$` member, chain rule, drawing feature, and example mod that differs from Claude Code |
| [web.md](web.md) | the web access seam: `WebSearchRequest`/`Result`, `WebFetchRequest`/`Result`, `WebFetchBody`, provider availability, `WebError` |
| [spill.md](spill.md) | the spill storage seam: `SaveTextSpill`, `SpillOwner`/`SpillSource`, `SpillRef`, the branded `SpillLocator` |
+1
View File
@@ -52,6 +52,7 @@
| [voice-input.md](voice-input.zh.md) | 实验性具名语音识别、临时音频和受版本保护的草稿插入 |
| [translation.md](translation.zh.md) | 实验性免登录文本翻译与显式 Provider 请求 |
| [agent-team.md](agent-team.zh.md) | Agent Teams:隐式 Lead 身份、具名 continuable teammate、直接 peer inbox 投递 与共享任务 DAG |
| [liveshare.md](liveshare.zh.md) | 可选的 LiveShare bundle:嵌套分享模式、fork 的上限与持久性、上限安装,以及共享会话外部驱动轮次所受的约束 |
| [claude-code-mods.md](claude-code-mods.zh.md) | 经实验性桥接运行的 Claude Code 模组:与 Claude Code 不同的每个事件、`$` 成员、链规则、绘制特性与示例模组 |
| [web.md](web.zh.md) | Web 访问 seam:`WebSearchRequest`/`Result`、`WebFetchRequest`/`Result`、`WebFetchBody`、提供方可用性、`WebError` |
| [spill.md](spill.zh.md) | spill 存储 seam:`SaveTextSpill`、`SpillOwner`/`SpillSource`、`SpillRef`、品牌类型 `SpillLocator` |
+2 -2
View File
@@ -6,8 +6,8 @@
en: 962b4398c9052959
zh: 14471c340a9f6e60
/profile-management/management-records:
en: 8813788cd8a86903
zh: 3c30cb180fc1a33d
en: 2cf6a1f62dcc1de6
zh: b6d519b60f6f5c79
/profile-management/market-records:
en: 3dfc62d837d61b9b
zh: ec223be315f3dc62
+5 -4
View File
@@ -18,7 +18,7 @@ The [boot package group](../../packages/boot/README.md) owns launcher-provided p
`PluginRegistries` carries the configured first registry, `null` for the one pnpm's own configuration names, the fallbacks asked after it, and `resolved`, the URL pnpm's own configuration names or `null` while unread. `InspectOptions.registry` names the registry a lookup asks first.
`ChangeResult.changed` reports a disk edit independently of `application`: `applied`, `restart-required`, `overridden` or `failed`. Optional `error` carries a localizable code and external diagnostic. `packageResult` records the pnpm exit code, bounded output, truncation flag and complete diagnostic log path, plus `timedOut` when the manager terminated a run that stopped printing. A terminated run is classified `timeout` whatever exit status the signal left behind, so installation and removal report failure instead of success and no further registry is asked. `pendingBuilds` lists undecided packages across the profile; `approvedBuilds` records the names granted permission by this operation; `registries` lists the registries an installation asked, in order; `bundle` and `version` name the package a finished installation added and its manifest version; `failedAt` says whether the last failed run could not reach the registry it asked or the host a git or tarball spec is fetched from.
`ChangeResult.changed` reports a disk edit independently of `application`: `applied`, `restart-required`, `overridden` or `failed`. Optional `error` carries a localizable code and external diagnostic. `packageResult` records the run's exit status, bounded output, truncation flag and complete diagnostic log path, plus `timedOut` when the manager terminated a run that stopped printing or the GitHub connection check hit its deadline; a terminated run records the coerced status 1 because its process returned none. A terminated run is classified `timeout` whatever exit status the signal left behind, so installation and removal report failure instead of success and no further registry is asked. `pendingBuilds` lists undecided packages across the profile; `approvedBuilds` records the names granted permission by this operation; `registries` lists the registries an installation asked, in order; `bundle` and `version` name the package a finished installation added and its manifest version; `failedAt` says whether the last failed run could not reach the registry it asked or the host a git or tarball spec is fetched from.
## Market records
@@ -297,7 +297,8 @@ Manage profile files and apply their declared reload lifecycle.
/**
* Install a package using the same pnpm implementation as dsh plugin. GitHub
* repositories get a connection check bounded by githubConnectionTimeoutMs before pnpm starts;
* only network failures or timeouts stop installation, while pnpm owns authentication and transport fallback. An
* only network failures or timeouts stop installation, and a stop streams the check's diagnostic
* as the installation's install-log run under its request id, while pnpm owns authentication and transport fallback. An
* HTTP(S) Git URL on another host is installed over SSH instead when access probes bounded by gitTransportTimeoutMs
* find that only SSH can read it. A run
* that fails, is cancelled, or adds a package without a bundle patch restores
@@ -532,11 +533,11 @@ Source: [`packages/boot/plugin-manager/src/types.ts`](../../packages/boot/plugin
#### `plugin-manager/install-log` — emit
One chunk of a pnpm run's output, streamed as the run produces it.
One chunk of an installation run's output, streamed as the run produces it.
```ts cordis-catalog
/**
* One chunk of a pnpm run's output, streamed as the run produces it.
* One chunk of an installation run's output, streamed as the run produces it.
* @mode emit
* @param chunk - the chunk and the run it belongs to.
*/
+5 -4
View File
@@ -18,7 +18,7 @@
`PluginRegistries` 携带配置的第一个注册表(`null` 即 pnpm 自身配置指定的那个)、随后依次询问的备选注册表,以及 `resolved`——pnpm 自身配置指向的 URL,未读到时为 `null`。`InspectOptions.registry` 指定一次查询首先询问的注册表。
`ChangeResult.changed` 报告磁盘修改,独立于 `application`:`applied`、`restart-required`、`overridden` 或 `failed`。可选的 `error` 包含可本地化的错误码和外部诊断。`packageResult` 记录 pnpm 退出码、有界输出、截断标志及完整诊断日志路径;当管理器终止了一个停止打印的运行,还记录 `timedOut`。被终止的运行不论信号留下什么退出状态都归类为 `timeout`,因此安装与删除都报告失败而非成功,也不会再询问下一个注册表。`pendingBuilds` 列出整个 profile 尚未决定的包;`approvedBuilds` 记录本次操作授予权限的包名;`registries` 按顺序列出一次安装问过的注册表;`bundle` 与 `version` 给出完成的安装新增的包及其清单版本;`failedAt` 说明最后一次失败的运行连不上的是所问的注册表,还是 git 或 tarball spec 自身拉取的主机。
`ChangeResult.changed` 报告磁盘修改,独立于 `application`:`applied`、`restart-required`、`overridden` 或 `failed`。可选的 `error` 包含可本地化的错误码和外部诊断。`packageResult` 记录运行的退出状态、有界输出、截断标志及完整诊断日志路径;当管理器终止了一个停止打印的运行,或 GitHub 连接检查到达期限,还记录 `timedOut`;被终止的运行记录强制填入的状态 1,因为它的进程没有返回任何状态。被终止的运行不论信号留下什么退出状态都归类为 `timeout`,因此安装与删除都报告失败而非成功,也不会再询问下一个注册表。`pendingBuilds` 列出整个 profile 尚未决定的包;`approvedBuilds` 记录本次操作授予权限的包名;`registries` 按顺序列出一次安装问过的注册表;`bundle` 与 `version` 给出完成的安装新增的包及其清单版本;`failedAt` 说明最后一次失败的运行连不上的是所问的注册表,还是 git 或 tarball spec 自身拉取的主机。
## 市场记录
@@ -297,7 +297,8 @@ Manage profile files and apply their declared reload lifecycle.
/**
* Install a package using the same pnpm implementation as dsh plugin. GitHub
* repositories get a connection check bounded by githubConnectionTimeoutMs before pnpm starts;
* only network failures or timeouts stop installation, while pnpm owns authentication and transport fallback. An
* only network failures or timeouts stop installation, and a stop streams the check's diagnostic
* as the installation's install-log run under its request id, while pnpm owns authentication and transport fallback. An
* HTTP(S) Git URL on another host is installed over SSH instead when access probes bounded by gitTransportTimeoutMs
* find that only SSH can read it. A run
* that fails, is cancelled, or adds a package without a bundle patch restores
@@ -532,11 +533,11 @@ Source: [`packages/boot/plugin-manager/src/types.ts`](../../packages/boot/plugin
#### `plugin-manager/install-log` — emit
One chunk of a pnpm run's output, streamed as the run produces it.
One chunk of an installation run's output, streamed as the run produces it.
```ts cordis-catalog
/**
* One chunk of a pnpm run's output, streamed as the run produces it.
* One chunk of an installation run's output, streamed as the run produces it.
* @mode emit
* @param chunk - the chunk and the run it belongs to.
*/
+2 -2
View File
@@ -30,8 +30,8 @@
en: 057db6d8bf356c0f
zh: 1441b39e5142b0bf
/core/repo-wide-type-patterns/the-map-derived-union-pattern:
en: 84c039e929edb897
zh: 84241bb993f23ef2
en: 87a19311e2a97270
zh: 8df92c72793e8275
/core/repo-wide-type-patterns/branded-ids:
en: 10f8ac0f97e7c54a
zh: 75cd2311aabfe464
+2 -1
View File
@@ -450,12 +450,13 @@ declare module '@deepseek-ai/dsh-llm' {
}
```
Five canonical maps use this pattern; a plugin author extends these:
Six canonical maps use this pattern; a plugin author extends these:
| Map | Package | Derives | Catalog |
|---|---|---|---|
| `ContentBlockMap` | dsh-llm | `ContentBlock` | [llm-streaming.md](llm-streaming.md#content-blocks-and-messages) |
| `MessageSourceMap` | dsh-llm | `MessageSource` | [llm-streaming.md](llm-streaming.md#content-blocks-and-messages) |
| `LlmRequestPurposeMap` | dsh-llm | `LlmRequestPurpose` | [llm-streaming.md](llm-streaming.md#the-model-request-and-result) |
| `FinishReasonMap` | dsh-llm | `FinishReason` | [llm-streaming.md](llm-streaming.md#the-model-request-and-result) |
| `TurnEndReasonMap` | dsh-session | `TurnEndReason` | [session.md](session.md) |
| `SessionEventMap` | dsh-session | `SessionEvent` | [session.md](session.md) |
+2 -1
View File
@@ -460,12 +460,13 @@ declare module '@deepseek-ai/dsh-llm' {
}
```
五个规范 map 使用此模式;插件作者扩展它们:
六个规范 map 使用此模式;插件作者扩展它们:
| Map | 包 | 派生 | 目录 |
|---|---|---|---|
| `ContentBlockMap` | dsh-llm | `ContentBlock` | [llm-streaming.md](llm-streaming.zh.md#content-blocks-and-messages) |
| `MessageSourceMap` | dsh-llm | `MessageSource` | [llm-streaming.md](llm-streaming.zh.md#content-blocks-and-messages) |
| `LlmRequestPurposeMap` | dsh-llm | `LlmRequestPurpose` | [llm-streaming.zh.md](llm-streaming.zh.md#the-model-request-and-result) |
| `FinishReasonMap` | dsh-llm | `FinishReason` | [llm-streaming.md](llm-streaming.zh.md#the-model-request-and-result) |
| `TurnEndReasonMap` | dsh-session | `TurnEndReason` | [session.md](session.zh.md) |
| `SessionEventMap` | dsh-session | `SessionEvent` | [session.md](session.zh.md) |
+2 -2
View File
@@ -12,8 +12,8 @@
en: 26ccfa2e342e3e67
zh: fe6cc2a622757c48
/forges/change-request-actions:
en: 00e4490e416099d2
zh: 5724d08b6ae230f7
en: 87d2c81d9514267f
zh: 1daf31c5b0127a1c
/forges/session-bindings:
en: 13dfd36f2166bba0
zh: a369434f52f04d57
+79 -3
View File
@@ -45,6 +45,8 @@ type ChangeRequestKey = Branded<'ChangeRequestKey'>
interface ForgeProvider {
/** Forge family name stored in every repository this provider returns. */
readonly forge: string
/** Publish a comment or completed review. Omission declares that this provider cannot write reviews. */
submitReview?(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/** Map a Git remote URL to its repository, or undefined when this provider does not serve it. */
repositoryFromRemote(url: string): ForgeRepository | undefined
/** Map a change request web URL to its reference, or undefined when this provider does not serve it. */
@@ -56,6 +58,8 @@ interface ForgeProvider {
refs: readonly ChangeRequestRef[],
signal: AbortSignal,
): Promise<ReadonlyMap<ChangeRequestKey, ChangeRequestSnapshot | ForgeFailure>>
/** Read all checks for one change request on demand; omission declares that only the polling preview is available. */
fetchChecks?(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
/** Find open change requests whose head is `branch` in `repository`, excluding the default branch and forks. */
findByHead(repository: ForgeRepository, branch: string, signal: AbortSignal): Promise<readonly ChangeRequestRef[]>
/** Report whether the provider can reach `host` with current credentials. */
@@ -246,6 +250,37 @@ interface ForgeActionFailure {
}
```
`ctx.forge.submitReview` delegates an explicit comment or completed review to the provider. A provider that omits this capability returns unsupported. Consumers retain pending drafts and reconcile unknown write outcomes before resubmitting.
```ts type-equiv
/** One inline comment addressed to the old or new side of a pull request diff. */
interface ForgeLineComment {
readonly path: string
readonly side: 'L' | 'R'
readonly startLine: number
readonly endLine: number
readonly body: string
}
```
```ts type-equiv
/** A single published comment or one completed review containing all pending comments. */
type ForgeReviewRequest = {
/** Commit the user reviewed; providers must check it before writing and address that commit explicitly. */
readonly headSha: string
} & (
| { readonly kind: 'comment'; readonly comment: ForgeLineComment }
| { readonly kind: 'review'; readonly event: 'comment' | 'approve' | 'request-changes'; readonly body: string; readonly comments: readonly ForgeLineComment[] }
)
```
```ts type-equiv
/** Result of a review write; unknown outcomes must be checked on the host before another submission. */
type ForgeReviewResult =
| { readonly ok: true; readonly url: string }
| { readonly ok: false; readonly code: 'unsupported' | 'stale' | 'failed' | 'unknown'; readonly message: string }
```
## Session bindings
`ctx.forgeSession` derives each Session's bindings from its own log: `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 trigger head-branch discovery through `ctx.forge`; the panel also reports the branch its checkout tracks for the same discovery. Track, dismiss, and discovery actions are `plugin:forge-session/binding` records, which stay outside the model-visible conversation. The `forgeChangeRequests` projection's client view, which the Session summary carries, lists the bindings without their status. The [Session binding README](../../packages/experimental/forge-session/README.md#use-this-package) owns the recognition and discovery rules.
@@ -735,6 +770,15 @@ async markReady(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeAction
*/
async merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
/**
* Read complete check details independently of periodic polling.
* @param ref - change request served by a registered provider.
* @param signal - cancellation of the detail view.
* @returns a complete snapshot or the provider's failure; unsupported providers return unavailable.
* @throws on cancellation, provider disposal, or expiry of this read's own `fetchTimeoutMs` deadline.
*/
async fetchChecks(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
/**
* Read the changes of a change request as its host computes them.
* @param ref - change request served by a registered provider.
@@ -744,6 +788,15 @@ async merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal):
*/
async diff(ref: ChangeRequestRef, signal: AbortSignal): Promise<string | ForgeFailure>
/**
* Publish one comment or a completed review, then refresh the watched status.
* @param ref - change request served by a registered provider.
* @param request - explicitly selected commit, comments, and review decision.
* @param signal - request cancellation.
* @returns a publication URL or a failure, including an unknown write outcome.
*/
async submitReview(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/**
* Read the text of one file at a commit of a change request's repository.
* @param ref - change request served by a registered provider.
@@ -798,7 +851,7 @@ Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental
### `ctx.forgePanel` — `ForgePanelController`
Serves the forge panel. Following a Session inspects the checkout of its current directory read-only in the Session's execution world, recognizes the code host of the upstream remote or `origin`, probes sign-in for that host, and polls the Session's bound change requests through `ctx.forge` until the last follower of that Session leaves. A worktree request makes the panel create a branch and checkout through an optional `ctx.worktrees` and enter it while the Session's first message waits in the inbox, or at the first step proposal of a message no wait took. After a failed or stopped attempt the message keeps waiting for another attempt or for the request to be withdrawn. A message also waits while the worktree the Session works in is gone, until that worktree is checked out again or left for the source checkout. Changes to a Session's checkout run as Agent maintenance, so a message that arrives meanwhile waits for them.
Serves the forge panel. Following a Session inspects the checkout of its current directory using the Session's permissions and execution world, recognizes the code host of the upstream remote or `origin`, probes sign-in for that host, and polls the Session's bound change requests through `ctx.forge` until the last follower of that Session leaves. A worktree request makes the panel create a branch and checkout through an optional `ctx.worktrees` and enter it while the Session's first message waits in the inbox, or at the first step proposal of a message no wait took. After a failed or stopped attempt the message keeps waiting for another attempt or for the request to be withdrawn. A message also waits while the worktree the Session works in is gone, until that worktree is checked out again or left for the source checkout. Changes to a Session's checkout run as Agent maintenance, so a message that arrives meanwhile waits for them.
```ts cordis-catalog
/**
@@ -862,13 +915,14 @@ Serves the forge panel. Following a Session inspects the checkout of its current
/**
* Read the changes one scope covers in the checkout of the Session's
* current directory, with Git confined to the Session's read-only sandbox.
* current directory, with Git using the Session's sandbox policy.
* @param session - Session whose checkout is read.
* @param scope - which changes to read.
* @param signal - request cancellation.
* @returns the files, the base of the `branch` scope, and the untracked files left out.
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/no-fork-point` for the `branch`
* scope of a checkout without one; `forgePanel/diff-too-large` over `maxDiffBytes`; the Git error when Git fails.
* scope of a checkout without one; `forgePanel/filter-config-failed` when filter configuration cannot be read
* completely, before any comparison; `forgePanel/diff-too-large` over `maxDiffBytes`; the Git error when Git fails.
*/
@Remote async localDiff(session: Session, scope: ForgeLocalScope, signal: AbortSignal): Promise<ForgeLocalDiff>
@@ -885,6 +939,18 @@ Serves the forge panel. Following a Session inspects the checkout of its current
*/
@Remote async localText(session: Session, scope: ForgeLocalScope, path: string, signal: AbortSignal): Promise<string>
/**
* Load complete checks for the change request whose list the user opened.
* @param session - Session retaining the visible binding.
* @param url - binding URL.
* @param headSha - commit displayed by the card; a different head rejects the result.
* @param signal - cancellation when the list closes.
* @returns the complete snapshot at the displayed head.
* @throws `forgePanel/not-bound` for an invisible binding, `forgePanel/stale-head` for a moved head,
* or `forgePanel/checks-failed` when the provider cannot complete the read.
*/
@Remote async changeRequestChecks(session: Session, url: string, headSha: string, signal: AbortSignal): Promise<ChangeRequestSnapshot>
/**
* Read the changes of a change request of a Session as its code host
* computes them, at the head commit of its latest status. A patch already
@@ -915,6 +981,16 @@ Serves the forge panel. Following a Session inspects the checkout of its current
*/
@Remote async changeRequestText(session: Session, url: string, commit: string, path: string, signal: AbortSignal): Promise<string>
/**
* Publish a line comment or completed review for a visible Session binding.
* @param session - Session retaining the change request.
* @param url - visible binding URL.
* @param request - reviewed head, ranges, plain text, and explicit review decision.
* @param signal - request cancellation.
* @returns confirmed publication or a typed failure; unknown outcomes require reconciliation on the host.
*/
@Remote async submitReview(session: Session, url: string, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/**
* Mark a draft change request of a Session ready for review; the change
* request is polled again once the host answers.
+79 -3
View File
@@ -45,6 +45,8 @@ type ChangeRequestKey = Branded<'ChangeRequestKey'>
interface ForgeProvider {
/** Forge family name stored in every repository this provider returns. */
readonly forge: string
/** Publish a comment or completed review. Omission declares that this provider cannot write reviews. */
submitReview?(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/** Map a Git remote URL to its repository, or undefined when this provider does not serve it. */
repositoryFromRemote(url: string): ForgeRepository | undefined
/** Map a change request web URL to its reference, or undefined when this provider does not serve it. */
@@ -56,6 +58,8 @@ interface ForgeProvider {
refs: readonly ChangeRequestRef[],
signal: AbortSignal,
): Promise<ReadonlyMap<ChangeRequestKey, ChangeRequestSnapshot | ForgeFailure>>
/** Read all checks for one change request on demand; omission declares that only the polling preview is available. */
fetchChecks?(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
/** Find open change requests whose head is `branch` in `repository`, excluding the default branch and forks. */
findByHead(repository: ForgeRepository, branch: string, signal: AbortSignal): Promise<readonly ChangeRequestRef[]>
/** Report whether the provider can reach `host` with current credentials. */
@@ -246,6 +250,37 @@ interface ForgeActionFailure {
}
```
`ctx.forge.submitReview` 将明确指定的评论或完整评审交给 provider;未实现此能力的 provider 返回不支持。消费者保存待提交草稿,并在再次提交前核对结果不明的写操作。
```ts type-equiv
/** One inline comment addressed to the old or new side of a pull request diff. */
interface ForgeLineComment {
readonly path: string
readonly side: 'L' | 'R'
readonly startLine: number
readonly endLine: number
readonly body: string
}
```
```ts type-equiv
/** A single published comment or one completed review containing all pending comments. */
type ForgeReviewRequest = {
/** Commit the user reviewed; providers must check it before writing and address that commit explicitly. */
readonly headSha: string
} & (
| { readonly kind: 'comment'; readonly comment: ForgeLineComment }
| { readonly kind: 'review'; readonly event: 'comment' | 'approve' | 'request-changes'; readonly body: string; readonly comments: readonly ForgeLineComment[] }
)
```
```ts type-equiv
/** Result of a review write; unknown outcomes must be checked on the host before another submission. */
type ForgeReviewResult =
| { readonly ok: true; readonly url: string }
| { readonly ok: false; readonly code: 'unsupported' | 'stale' | 'failed' | 'unknown'; readonly message: string }
```
## Session 绑定
`ctx.forgeSession` 从每个 Session 自己的日志派生其绑定:`gh pr create` 的结果绑定其输出的 URL,`gh pr view`、`gh pr edit` 与 `gh pr checkout` 调用绑定它们所操作的变更请求,`git push` 的结果通过 `ctx.forge` 触发按 head 分支的发现;面板也会报告其检出所跟踪的分支,触发同样的发现。track、dismiss 与发现操作都是 `plugin:forge-session/binding` 插件记录,位于模型可见对话之外。`forgeChangeRequests` 投影的客户端视图随 Session 摘要下发,列出绑定但不含其状态。识别与发现规则见 [Session 绑定 README](../../packages/experimental/forge-session/README.zh.md#use-this-package)。
@@ -735,6 +770,15 @@ async markReady(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeAction
*/
async merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal): Promise<ForgeActionFailure | undefined>
/**
* Read complete check details independently of periodic polling.
* @param ref - change request served by a registered provider.
* @param signal - cancellation of the detail view.
* @returns a complete snapshot or the provider's failure; unsupported providers return unavailable.
* @throws on cancellation, provider disposal, or expiry of this read's own `fetchTimeoutMs` deadline.
*/
async fetchChecks(ref: ChangeRequestRef, signal: AbortSignal): Promise<ChangeRequestSnapshot | ForgeFailure>
/**
* Read the changes of a change request as its host computes them.
* @param ref - change request served by a registered provider.
@@ -744,6 +788,15 @@ async merge(ref: ChangeRequestRef, request: MergeRequest, signal: AbortSignal):
*/
async diff(ref: ChangeRequestRef, signal: AbortSignal): Promise<string | ForgeFailure>
/**
* Publish one comment or a completed review, then refresh the watched status.
* @param ref - change request served by a registered provider.
* @param request - explicitly selected commit, comments, and review decision.
* @param signal - request cancellation.
* @returns a publication URL or a failure, including an unknown write outcome.
*/
async submitReview(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/**
* Read the text of one file at a commit of a change request's repository.
* @param ref - change request served by a registered provider.
@@ -798,7 +851,7 @@ Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental
### `ctx.forgePanel` — `ForgePanelController`
Serves the forge panel. Following a Session inspects the checkout of its current directory read-only in the Session's execution world, recognizes the code host of the upstream remote or `origin`, probes sign-in for that host, and polls the Session's bound change requests through `ctx.forge` until the last follower of that Session leaves. A worktree request makes the panel create a branch and checkout through an optional `ctx.worktrees` and enter it while the Session's first message waits in the inbox, or at the first step proposal of a message no wait took. After a failed or stopped attempt the message keeps waiting for another attempt or for the request to be withdrawn. A message also waits while the worktree the Session works in is gone, until that worktree is checked out again or left for the source checkout. Changes to a Session's checkout run as Agent maintenance, so a message that arrives meanwhile waits for them.
Serves the forge panel. Following a Session inspects the checkout of its current directory using the Session's permissions and execution world, recognizes the code host of the upstream remote or `origin`, probes sign-in for that host, and polls the Session's bound change requests through `ctx.forge` until the last follower of that Session leaves. A worktree request makes the panel create a branch and checkout through an optional `ctx.worktrees` and enter it while the Session's first message waits in the inbox, or at the first step proposal of a message no wait took. After a failed or stopped attempt the message keeps waiting for another attempt or for the request to be withdrawn. A message also waits while the worktree the Session works in is gone, until that worktree is checked out again or left for the source checkout. Changes to a Session's checkout run as Agent maintenance, so a message that arrives meanwhile waits for them.
```ts cordis-catalog
/**
@@ -862,13 +915,14 @@ Serves the forge panel. Following a Session inspects the checkout of its current
/**
* Read the changes one scope covers in the checkout of the Session's
* current directory, with Git confined to the Session's read-only sandbox.
* current directory, with Git using the Session's sandbox policy.
* @param session - Session whose checkout is read.
* @param scope - which changes to read.
* @param signal - request cancellation.
* @returns the files, the base of the `branch` scope, and the untracked files left out.
* @throws `forgePanel/not-a-checkout` outside a checkout; `forgePanel/no-fork-point` for the `branch`
* scope of a checkout without one; `forgePanel/diff-too-large` over `maxDiffBytes`; the Git error when Git fails.
* scope of a checkout without one; `forgePanel/filter-config-failed` when filter configuration cannot be read
* completely, before any comparison; `forgePanel/diff-too-large` over `maxDiffBytes`; the Git error when Git fails.
*/
@Remote async localDiff(session: Session, scope: ForgeLocalScope, signal: AbortSignal): Promise<ForgeLocalDiff>
@@ -885,6 +939,18 @@ Serves the forge panel. Following a Session inspects the checkout of its current
*/
@Remote async localText(session: Session, scope: ForgeLocalScope, path: string, signal: AbortSignal): Promise<string>
/**
* Load complete checks for the change request whose list the user opened.
* @param session - Session retaining the visible binding.
* @param url - binding URL.
* @param headSha - commit displayed by the card; a different head rejects the result.
* @param signal - cancellation when the list closes.
* @returns the complete snapshot at the displayed head.
* @throws `forgePanel/not-bound` for an invisible binding, `forgePanel/stale-head` for a moved head,
* or `forgePanel/checks-failed` when the provider cannot complete the read.
*/
@Remote async changeRequestChecks(session: Session, url: string, headSha: string, signal: AbortSignal): Promise<ChangeRequestSnapshot>
/**
* Read the changes of a change request of a Session as its code host
* computes them, at the head commit of its latest status. A patch already
@@ -915,6 +981,16 @@ Serves the forge panel. Following a Session inspects the checkout of its current
*/
@Remote async changeRequestText(session: Session, url: string, commit: string, path: string, signal: AbortSignal): Promise<string>
/**
* Publish a line comment or completed review for a visible Session binding.
* @param session - Session retaining the change request.
* @param url - visible binding URL.
* @param request - reviewed head, ranges, plain text, and explicit review decision.
* @param signal - request cancellation.
* @returns confirmed publication or a typed failure; unknown outcomes require reconciliation on the host.
*/
@Remote async submitReview(session: Session, url: string, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult>
/**
* Mark a draft change request of a Session ready for review; the change
* request is polled again once the host answers.
+25
View File
@@ -0,0 +1,25 @@
# Bilingual-pair consistency record for liveshare.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 docs/subsystems/liveshare.md
/liveshare:
en: 196b06ffccedbdef
zh: 0ca8df19400afc40
/liveshare/enabling-and-visibility:
en: f6144f8e81359a9c
zh: 1924869ac7475b59
/liveshare/share-modes:
en: 985cb7a5c20c1cbd
zh: a5f5372dddfefaa3
/liveshare/forks-and-their-ceiling:
en: 357a2147f48f5bac
zh: a8a297603f984ede
/liveshare/retries-recovery-and-revocation:
en: 6b1346e73ab6eab9
zh: 888cfc08c6bc8522
/liveshare/constraining-a-shared-session:
en: 289e8955320935f6
zh: 7038c4283a4f33c6
/liveshare/viewer-states:
en: b5b4d4d83dbb58c2
zh: 498f26938dc872df
+158
View File
@@ -0,0 +1,158 @@
# LiveShare
English | [中文](liveshare.zh.md)
The opt-in LiveShare bundle (`@deepseek-ai/dsh-experimental-liveshare`) lets one owner share a single Session with an external viewer through the separate Liveshare server. A viewer never receives the owner's tools: the owner host reads each viewer request itself, dispatches it as that viewer's own Peer, whose `share-viewer` principal the Gateway decides through the [remote access](../../packages/api/remote-access/README.md) policy this package registers, and constrains everything a shared Session runs on the viewer's behalf to the workspace the share granted. The [package README](../../packages/experimental/liveshare/README.md) owns configuration, the client faces, and the limitations; the [Owner note](../../.agents/notes/implemented/feature/2026-09-13-liveshare-protocol-and-owner-surfaces.md) owns the security posture behind them.
Source: [`packages/experimental/liveshare/src/host/fork-enforcement.ts`](../../packages/experimental/liveshare/src/host/fork-enforcement.ts)
<a id="enabling-and-visibility"></a>
## Enabling and visibility
The package ships with dsh but stays out of the plugin manager's lists until a profile enables it. A profile either inserts the two rows the bundle declares into its own `cordis.patch.yml`, which keeps the bundle unselected while its plugins run, or selects the bundle in `dsh.profile.bundles`. The [package README](../../packages/experimental/liveshare/README.md#default-visibility-and-enabling) owns the exact entries and the placeholders a deployment replaces.
The plugin manager lists the card under **Experimental plugins** only while at least one row the bundle declares runs, and removing the rows, disabling them, or deselecting the bundle takes it out of both that list and **More** again. Both routes apply on the profile's next recomposition rather than mid-task: with HMR enabled the profile is re-read, and without it the change waits for the next start.
## Share modes
`ViewerSessionMode` has two tiers, and both name a sandbox: `view` reads the shared Session and drives its loop inside a read-only sandbox in the granted workspace, so it never writes a file; it may use the read and search surface (`read`, `read_image`, `glob`, `grep`, `present`) and the tools with no local file effect (`todo_write`, `skill`, `web_search`, `web_fetch`), with every declared path checked against the grant. `write` runs in a bounded writable sandbox that also modifies files inside that workspace by adding bounded `edit` and `write`, under the Host's write ceiling. Forking is not a tier: the share carries its own `allowsFork` switch, independent of the tier. Attachment upload is not a tier either: every Session a share serves the reader accepts files, whatever the tier and the fork switch. The withdrawn `fork-readonly` name is not read back as `view`: a persisted owner record that names it is rejected when the owner state loads. Nothing infers `write`, and a share whose mode the host cannot establish stays readable but is never driven.
## Forks and their ceiling
A fork creates a new Session the viewer owns and leaves the source untouched. Fork authorization checks the share, its fork switch, expiry, viewer admission, source identity, and the requested boundary. `READ_ONLY_FORK_CEILING` permits the view surface — `read`, `read_image`, `glob`, `grep`, `present`, `todo_write`, `skill`, `web_search`, `web_fetch` — and `WRITE_FORK_CEILING` adds the Host’s bounded `edit` and `write`. Each path-bearing tool gets a confined replacement that resolves every declared path against the granted root and delegates with its canonical form; `bash`, `pwsh`, `cua`, `plugin_manager`, the `schedule_*` tools, and every name the surface does not list are refused.
Each child is recorded with the share that authorized it, the trusted viewer the Liveshare server asserted, and the boundary it started from, so a viewer's list shows only its own children and a removed share stops them. A child is driven only after its ceiling is installed on its own scope: `ForkRegistry` refuses every prompt for a child whose guard is not installed (`fork-ceiling-uninstalled`), and installation is verified per child rather than per host. A child whose scope refuses the confined replacement or the limit is refused instead of being published with the deployment's own tools.
Cold source and child activation uses the Host’s ordinary Agent lookup, not a Remote `session/prepare` endpoint. Serial `agent/created` listeners install scoped enforcement before queued work is released; an already live Agent needs its own installation check. `forkLineage` is a LiveShare-owned, per-viewer UI projection, not a Session-summary field, durable log event, or permission grant.
## Retries, recovery, and revocation
One logical fork request may be sent more than once. Its identity binds the trusted viewer, the share, the source, and the caller's operation id; the boundary is compared against that identity rather than folded into it, so a retry repeats the child it already produced, an identity naming another boundary conflicts instead of silently receiving the earlier child, and the reservation is durable before any child exists. The host records the child the owner's fork answer returned, and a retry of a recorded operation replays that answer. The owner's `SessionForkRequest` mints the child id, so a host that dies between creating the child and recording it cannot name that child on retry and creates a second one; closing that window needs a Session Controller request that accepts a caller-supplied child identity.
Child tool guards recheck the share’s current mode, expiry, viewer admission, and revocation record. Viewer withdrawal cancels affected child work and pending calls. A `write` to `view` downgrade denies later writes through the write guard without granting any new tool, and does not promise immediate cancellation of a running turn. Removing a share revokes recorded children and stops the Session's running turn; the source enforcement layer is released once no share over the Session is left, and with Agent disposal. Revoked children retain their logs, and the source’s owner-visible history is never rewritten.
## Constraining a shared Session
Every share lets its viewer drive the *source* Session through the normal prompt path, and any share at either tier installs the bounded sandbox while it is active. `installSourceSessionAccess` registers a confined replacement for every view-surface tool the deployment ships in that Session's own scope, and bounded `edit` and `write` replacements whenever any share over the Session allows writing. The layer is mounted on the Session, but it confines only the turns a share viewer starts: `agent/pre-step` records, in Host memory, whether a turn's admitted input names a share viewer, and the guard and the replacements read that answer for every execution of that turn. A viewer-started turn runs those replacements and nothing else; a turn the owner starts keeps the Session's own tools, including `bash` and its unrestricted filesystem tools. The answer is decided when the turn is admitted and never written to the Session log; a restart recomputes it from the next admitted step. An owner's steering input inside a viewer's turn stays confined with it. Stopping every share over the Session disposes the layer, which restores the Session's own tools; narrowing the last write share to `view` re-installs the read-only layer.
The installation reports whether the source Session is actually confined. A deployment without the `read` tool, or a scope that refuses that replacement's registration, leaves the guard in place and reports the refusal; a tool whose own replacement failed stays refused while the rest of the surface runs, and the reader refuses the prompt with `source-write-unavailable`: no viewer-started turn of a shared Session is driven against the owner's own tools because a limit could not be installed.
Each operation re-reads the Relay grants of the shares that keep the Session drivable, and each reading is synchronous with the tool call it authorizes, so input queued past the grant that admitted it cannot act on that stale admission. The layer is per Session: several shares over one Session share the one installation, and a share that narrows or ends changes what the layer permits — its bounded write is refused once no active share may write, and the layer is released once no share is left. The Host does not attribute a running turn to the viewer that admitted it, so ending one share's grant stops the Session's running turn rather than singling out that viewer's work; the in-memory viewer-start marker only decides which tool surface that turn runs.
Confined file tools resolve every path their own arguments declare, check that the granted root contains each result, and delegate with the target’s canonical path. A pathless `glob` or `grep` searches the Session’s working directory, which the replacement supplies and checks like a named path; a `present` call checks every file it lists; the tools with no local file effect are delegated unchanged. Bounded edits run the same containment check, use `fs/edit-intent`, and publish the version `editText` returns; bounded writes use `fs/write-intent` and publish the version `writeText` returns. After the asynchronous intent wait, the Host resolves the current Session sandbox policy and rechecks share authority. It passes that policy as the fifth `editText` or `writeText` argument, after `signal`, so the sandboxing backend fences the mutation by it. Containment is checked by path, so a directory inside the grant that a local process replaces with a symlink between the check and the open can redirect the operation; anchoring operations to a directory handle is deferred to a separate change.
A viewer's source prompt and source stop both travel the standard Gateway dispatch under the `share-viewer` policy's source-write role: the policy admits them while the share's tier is established and its Session is confined, and the owner's own Session controller then stops whatever turn the Session is running. Cancellation performs no per-viewer comparison, so a reader's stop of the shared Session also ends a turn the owner started. The [Session Controller](../../packages/api/session-controller/README.md) reads `remoteAccess.allows()` again inside `prompt` immediately before delivery and in the same synchronous step as a `cancel`, so a viewer whose access ends after the Gateway admitted its call delivers or cancels nothing. Queued external source input refreshes Liveshare server authority in `agent/pre-step`; missing authority rejects the step before a model request.
<a id="viewer-states"></a>
## Viewer states
A viewer read that ends in a refusal names its own condition rather than one failure for every cause: the Liveshare server answers a missing link, a share the owner stopped, an expired share, an owner whose machine holds no route, an expired sign-in, a reader who has not asked, a request still waiting, a request the owner refused, and a notification the owner never received each with their own status and code, and a page that cannot reach the Liveshare server states that itself. `VIEWER_STATE_ANSWERS` in `@deepseek-ai/dsh-experimental-liveshare-protocol` is the whole vocabulary, and the [shared protocol](../../packages/experimental/liveshare-protocol/README.md) owns the answer each condition carries. No answer widens what a viewer may read: an offline owner, a stopped share, and a refused request all deny.
The workspace feed a viewer's page renders is filtered through the same policy as its session list: a workspace is delivered while it holds the shared Session or a branch that viewer made from it, and its membership and its manual order keep only those. A workspace that loses them leaves the feed when that workspace or the workspace order next changes, and the stream then replaces the reader's baseline; an access change alone sends no frame. A reader therefore sees the owner's workspace names and grouping around the one Session it was granted, never the rest of the owner's workspaces.
Viewer streams bind the opening actor across polling, replacement, and cancellation. Session notifications, control baselines, and workspace membership expose only the source and that actor’s children: the Gateway forwards a reader only the `api-session/*` notifications the policy allows on those Sessions, and the Session and Workspace controllers filter their lists and streams through the same policy; interactive approvals and questions stay on the Host. Refused reads open no upstream subscription. Expiry and revocation cancel affected pending calls and streams; unpolled streams are reclaimed after 120 seconds. Worker IPC responses and cancellations must match the request’s token, share id, Liveshare server id, and original socket or worker generation; late answers cannot settle a replacement request.
The Liveshare server’s optional `share-access-state` capability publishes a complete, versioned authority snapshot on connection and committed mutations, including mutations on another Liveshare server instance. Authenticated `GET /__liveshare/requests` returns the same fields. The Host clears cached authority on connection loss, rejects stale revisions within a generation, and fences asynchronous refreshes against generation changes. Missing complete authority refuses admission; this does not establish immediate distributed stop semantics.
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
<a id="cordis-surface"></a>
## Cordis API
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxliveshareshares--liveshareshares"></a>
### `ctx.liveshareShares` — `LiveshareShares`
Owner-only Remote surface over the share-management operations.
The Gateway decides each call through remote access, so a `share-viewer` Peer is refused before a method runs; the owner Peer reaches the one implementation that owns each share-management side effect. `create` takes its Session as the `sessionId` of its single request object, so the Session resource kind's default resolver names that Session for the call without a reader declared here.
```ts cordis-catalog
/**
* Publish one Session and store the share.
* @param request - Session, title, access, lifetime, and both switches the owner chose.
* @returns The created share's link and stored values.
*/
@Remote('create') create(request: CreateShareRequest): Promise<CreatedShare>
/**
* Refresh titles and Liveshare server authority, then list this host's shares.
* @returns Every share this host publishes.
*/
@Remote('list') list(): Promise<OwnerShareList>
/**
* Stop one share locally, revoke its forks, and delete its row on the Liveshare server when reachable.
* @param request - Share to stop.
* @returns Whether the row on the Liveshare server still needs a retry.
*/
@Remote('stop') stop(request: StopShareRequest): Promise<StopShareResult>
/**
* Change one share's tier, fork switch, or both.
* @param request - Share and the switches to change.
* @returns The permissions the share now carries.
*/
@Remote('updatePermissions') updatePermissions(request: UpdateSharePermissionsRequest): Promise<SharePermissions>
/**
* Replace one share's exposed plugin endpoints.
* @param request - Share and the selection to store.
* @returns The capability selection the share now carries.
*/
@Remote('setCapabilities') setCapabilities(request: SetShareCapabilitiesRequest): Promise<ShareCapabilities>
/**
* Read the endpoints plugins currently offer.
* @returns The live offer list.
*/
@Remote('capabilities') capabilities(): ShareCapabilityOffers
/**
* Read the Liveshare server address the owner saved.
* @returns The current Liveshare server state, with both address fields absent while none is saved.
*/
@Remote('relay') relay(): OwnerRelayState
/**
* Choose the Liveshare server address later shares publish to.
* @param request - Normalized address or null to clear the saved one.
* @returns The Liveshare server state after the change.
*/
@Remote('setRelay') setRelay(request: SetRelayRequest): Promise<OwnerRelayState>
/**
* Report this host's owner identity for one Liveshare server address.
* @param request - Address to report, or the effective one when absent.
* @returns The owner identity status, without the credential.
*/
@Remote('identity') identity(request: OwnerIdentityRequest): Promise<OwnerIdentityStatus>
/**
* Read the Liveshare server's durable audit trail for one share.
* @param request - Share whose audit is read.
* @returns The audit events, or a structured failure when the Liveshare server cannot answer.
*/
@Remote('audit') audit(request: ShareAuditRequest): Promise<ShareAudit>
/**
* Check that the effective Liveshare server answers at all.
* @returns The anonymous connectivity result.
*/
@Remote('testRelay') testRelay(): Promise<RelayConnectivityView>
/**
* Register one throwaway share to check whether this host may publish.
* @param request - Session the throwaway registration names.
* @returns The Liveshare server's decision about this host's credential.
*/
@Remote('testPublish') testPublish(request: TestPublishRequest): Promise<RelayPublishView>
```
Source: [`packages/experimental/liveshare/src/host/share-remote.ts`](../../packages/experimental/liveshare/src/host/share-remote.ts)
<!-- END GENERATED cordis-surface -->
+158
View File
@@ -0,0 +1,158 @@
# LiveShare
[English](liveshare.md) | 中文
可选的 LiveShare bundle(`@deepseek-ai/dsh-experimental-liveshare`)让一位所有者通过独立的 Liveshare 服务端 把一个会话分享给外部 viewer。viewer 永远拿不到所有者的工具:所有者宿主机自己读取 viewer 的每个请求,以该 viewer 自己的 Peer 分派它,Gateway 依据本包注册的 [remote access](../../packages/api/remote-access/README.zh.md) 策略判定该 Peer 的 `share-viewer` principal,并把共享会话代表 viewer 运行的一切限制在分享所授予的工作区内。[包 README](../../packages/experimental/liveshare/README.zh.md)负责配置、客户端界面与限制;[Owner 说明](../../.agents/notes/implemented/feature/2026-09-13-liveshare-protocol-and-owner-surfaces.zh.md)负责其背后的安全姿态。
源码:[`packages/experimental/liveshare/src/host/fork-enforcement.ts`](../../packages/experimental/liveshare/src/host/fork-enforcement.ts)
<a id="enabling-and-visibility"></a>
## 启用与可见性
本包随 dsh 一同交付,但在 profile 启用它之前不会出现在插件管理器的任何列表中。profile 可以把自己的 `cordis.patch.yml` 插入组合包声明的两条行,这样组合包本身保持未选中而插件照常运行;也可以改在 `dsh.profile.bundles` 中选中该组合包。[包 README](../../packages/experimental/liveshare/README.zh.md#default-visibility-and-enabling)负责具体条目和部署需要替换的占位符。
插件管理器只有在组合包声明的行至少有一条在运行时才把卡片列在**实验性插件**下;删除这些行、把它们置为 disabled,或取消选中组合包,卡片会再次从该列表和**更多**页消失。两条路线都在 profile 下一次重新组合时生效,而不是在当前任务中途:启用 HMR 时会重新读取 profile,未启用时则等下一次启动。
## 分享模式
`ViewerSessionMode` 只有两档,两档都对应一个沙箱:`view` 读取共享会话,并在授予工作区的只读沙箱里驱动它的 loop,绝不写文件;它可以使用读取与检索面(`read`、`read_image`、`glob`、`grep`、`present`)和无本地文件副作用的工具(`todo_write`、`skill`、`web_search`、`web_fetch`),每个声明路径都按授予范围检查。`write` 在受宿主写入上限约束的可写沙箱里运行,通过有界 `edit` 与 `write` 修改该工作区内的文件。fork 不是一档:分享自带独立的 `allowsFork` 开关,与档位无关。附件上传也不是一档:分享向读者提供的每条会话都接受文件,与档位和分叉开关无关。已退场的 `fork-readonly` 名称不会读回为 `view`:持久化的 owner 记录若写有该值,owner 状态加载时会直接拒绝。任何环节都不会推断出 `write`,而宿主机无法确定模式的分享仍可读取,但绝不会被驱动。
## fork 与其上限
fork 创建查看者拥有的新会话,源会话保持不变。Fork 授权检查分享、其 fork 开关、有效期、查看者准入、源身份与请求的边界。`READ_ONLY_FORK_CEILING` 允许读取与检索面——`read`、`read_image`、`glob`、`grep`、`present`、`todo_write`、`skill`、`web_search`、`web_fetch`——,`WRITE_FORK_CEILING` 增加 Host 的有界 `edit` 与 `write`。每个带路径的工具都有受限替代定义:解析它声明的所有路径并按授予根目录检查,再以规范路径委托;`bash`、`pwsh`、`cua`、`plugin_manager`、`schedule_*` 及工具面未列出的名字一律拒绝。
每个分叉会话都会记录授权它的分享、Liveshare 服务端断言的可信 viewer,以及它起始的边界,因此 viewer 的列表只显示它自己的分叉会话,被移除的分享会终止它们。只有在分叉会话自身作用域上安装好上限之后它才会被驱动:`ForkRegistry` 会拒绝每个上限未安装的分叉会话的 prompt(`fork-ceiling-uninstalled`),且安装是按分叉会话逐个验证,而非按宿主机验证。若分叉会话作用域拒绝注册受限替换或上限,就拒绝该分叉会话,而不是让它带着部署自身的工具发布。
冷态源会话与分叉会话通过 Host 常规 Agent lookup 激活,而非 Remote `session/prepare` 端点。串行 `agent/created` 监听器在排队工作放行前安装作用域执行限制;已经在线的 Agent 仍需检查自身安装。`forkLineage` 是 LiveShare 自有的按查看者 UI 投影,不是会话摘要字段、持久日志事件或权限授予。
## 重试、恢复与撤销
同一个逻辑 fork 请求可能被发送多次。其身份绑定可信 viewer、分享、源会话与调用方的操作 id;边界是与该身份比较而非折入其中,因此重试会重复它已经产生的分叉会话,同一身份指向另一个边界会冲突而不是悄悄拿到更早的分叉会话,且预留在任何分叉会话存在之前就已持久化。宿主机记录 owner 的 fork 应答返回的分叉会话,重试已记录的操作会重放该应答。owner 的 `SessionForkRequest` 自己生成分叉会话 id,因此在创建分叉会话与记录它之间崩溃的宿主机重试时无法指名该分叉会话,会再创建一个;要关闭这一窗口,需要 Session Controller 的请求接受调用方提供的分叉会话身份。
分叉会话工具守卫重新检查分享当前模式、有效期、查看者准入与撤销记录。撤回查看者会取消受影响的分叉会话工作与未决调用。`write` 降级为 `view` 后,写入守卫拒绝后续写入,不授予任何新工具,也不承诺立即取消正在运行的轮次。移除分享撤销已记录分叉会话并停止该会话正在运行的轮次;源执行层在该会话不再有任何分享时释放,并随 Agent 释放。已撤销分叉会话保留日志,源会话所有者可见历史绝不改写。
## 约束共享会话
每个分享都让它的 viewer 通过正常 prompt 路径驱动*源*会话,任一档位的分享在活跃期间都会安装有界沙箱。`installSourceSessionAccess` 在该会话自身作用域中为部署提供的每个读取与检索面工具注册受限替代,并在任一同会话分享允许写入时再注册有界 `edit` 与 `write` 替代。执行层挂在会话上,但只约束分享查看者发起的轮次:`agent/pre-step` 在 Host 内存中记录一个轮次的已准入输入是否带有 share-viewer principal,守卫与替代定义对该轮次的每次执行读取这一结论。查看者发起的轮次只能运行这些替代定义;所有者自己发起的轮次保留会话原生工具,包括 `bash` 与不受限的文件工具。该结论在轮次准入时确定,不写入会话日志;重启后从下一个准入步骤重新计算。所有者在查看者轮次中追加的输入仍留在该受限轮次内。该会话的所有分享停止后执行层被释放,会话恢复自己的工具;最后一个可写分享降为 `view` 时重装只读层。
安装结果报告源会话是否真正受到限制。没有 `read` 工具的部署或拒绝该替代注册的作用域会保留守卫并报告失败;某个工具自己的替代注册失败时,该工具保持拒绝,其余工具面照常运行。读取处理器以 `source-write-unavailable` 拒绝消息:限制未安装时,共享会话中查看者发起的轮次不会用所有者工具驱动。
每次操作都会重新读取维持该会话可驱动的分享的 Relay 授权,且读取与其授权的工具调用在同一同步步骤内完成,因此排队超过其准入授权的输入无法凭过期准入行动。执行层按会话安装:同一会话的多个分享共用一个安装;分享收窄或结束时改变该层允许的操作——没有任何活跃分享可写时拒绝有界写入,会话不再有分享时释放执行层。Host 不把正在运行的轮次归属给准入它的查看者,因此结束某个分享的授权会停止该会话正在运行的轮次,而不是只挑出该查看者的工作;内存中的查看者轮次标记只决定该轮次运行哪套工具面。
受限文件工具解析其自身参数声明的每个路径,检查获授根目录包含每个目标,再以目标的规范路径委托。无路径的 `glob` 或 `grep` 搜索会话的工作目录,由替代定义补齐并按命名路径一样检查;`present` 调用检查它列出的每个文件;无本地文件副作用的工具原样委托。有界编辑执行同样的包含检查,使用 `fs/edit-intent`,并发布 `editText` 返回的版本;有界写入使用 `fs/write-intent`,并发布 `writeText` 返回的版本。异步意图等待后,Host 解析当前会话沙箱策略并重新检查分享授权。该策略作为 `editText` 或 `writeText` 的第五个参数,位于 `signal` 之后,由沙箱后端据此限制变更。包含关系按路径检查,若本地进程在检查与打开之间把获授范围内的目录换成符号链接,操作可能被改指别处;基于目录句柄锚定操作留待单独变更引入。
查看者对源会话的提示词与停止都按标准 Gateway 分派走 `share-viewer` 策略的源会话写入角色:分享档位已确立且其会话受沙箱限制时策略放行,随后由所有者自己的会话控制器停止该会话当前运行的轮次。取消不按查看者比对,因此读者对共享会话的停止也会结束所有者发起的轮次。[Session Controller](../../packages/api/session-controller/README.zh.md) 在 `prompt` 投递前、以及与 `cancel` 同一同步步骤内再次读取 `remoteAccess.allows()`,因此 Gateway 放行调用之后访问权才结束的查看者不会投递或取消任何内容。排队的外部源输入在 `agent/pre-step` 刷新 Liveshare 服务端授权;缺少授权时在模型请求之前拒绝步骤。
<a id="viewer-states"></a>
## viewer 状态
一次以拒绝结束的 viewer 读取会指明它自己的状态,而不是让所有原因共用一种失败:链接不存在、owner 已停止分享、分享已过期、owner 的机器没有路由、登录已过期、读者尚未申请、申请仍在等待、申请被 owner 拒绝、owner 从未收到通知,每种都有各自的 HTTP 状态与错误码;页面联系不上 Liveshare 服务端时由页面自己陈述。`@deepseek-ai/dsh-experimental-liveshare-protocol` 中的 `VIEWER_STATE_ANSWERS` 就是这份词汇表,每种状态对应的答案由 [共享协议](../../packages/experimental/liveshare-protocol/README.zh.md) 维护。没有任何一种答案会扩大 viewer 能读到的内容:owner 离线、分享已停止、申请被拒,三者都是拒绝。
viewer 页面渲染所用的工作区流与会话列表经同一策略过滤:只要工作区还持有共享会话或该 viewer 自己创建的分支就会下发,其成员与手工顺序只保留这些。失去它们的工作区要到该工作区或工作区顺序下次变化时才离开工作区流,届时流替换读者的基线;仅访问变化不会发送帧。因此读者看到的是围绕它被授予的那一个会话的 owner 工作区名称与分组,而不是 owner 其余的工作区。
查看流在轮询、替换与取消时均绑定打开它的主体。会话通知、控制基线与工作区成员只暴露源会话及该主体的分叉会话:Gateway 只向读者转发策略在这些会话上允许的 `api-session/*` 通知,Session 与 Workspace 控制器也经同一策略过滤其列表和流;交互审批与提问保留在 Host。被拒绝的读取不创建上游订阅。过期与撤权取消受影响的未决调用和流;120 秒未轮询的流被回收。Worker IPC 响应与取消必须匹配请求 token、分享 ID、Liveshare 服务端 ID 及原始 socket 或 worker generation;迟到响应不能结算替换请求。
Liveshare 服务端可选的 `share-access-state` 能力在连接和已提交变更时发布完整、带版本的授权快照,包括其他 Liveshare 服务端实例提交的变更。鉴权 `GET /__liveshare/requests` 返回同一组字段。Host 在连接丢失时清空缓存授权,在同一 generation 内拒绝过期修订,并对异步刷新检查 generation。缺少完整授权时拒绝准入;这不构成立即的分布式停止语义保证。
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
<a id="cordis-surface"></a>
## Cordis API
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxliveshareshares--liveshareshares"></a>
### `ctx.liveshareShares` — `LiveshareShares`
Owner-only Remote surface over the share-management operations.
The Gateway decides each call through remote access, so a `share-viewer` Peer is refused before a method runs; the owner Peer reaches the one implementation that owns each share-management side effect. `create` takes its Session as the `sessionId` of its single request object, so the Session resource kind's default resolver names that Session for the call without a reader declared here.
```ts cordis-catalog
/**
* Publish one Session and store the share.
* @param request - Session, title, access, lifetime, and both switches the owner chose.
* @returns The created share's link and stored values.
*/
@Remote('create') create(request: CreateShareRequest): Promise<CreatedShare>
/**
* Refresh titles and Liveshare server authority, then list this host's shares.
* @returns Every share this host publishes.
*/
@Remote('list') list(): Promise<OwnerShareList>
/**
* Stop one share locally, revoke its forks, and delete its row on the Liveshare server when reachable.
* @param request - Share to stop.
* @returns Whether the row on the Liveshare server still needs a retry.
*/
@Remote('stop') stop(request: StopShareRequest): Promise<StopShareResult>
/**
* Change one share's tier, fork switch, or both.
* @param request - Share and the switches to change.
* @returns The permissions the share now carries.
*/
@Remote('updatePermissions') updatePermissions(request: UpdateSharePermissionsRequest): Promise<SharePermissions>
/**
* Replace one share's exposed plugin endpoints.
* @param request - Share and the selection to store.
* @returns The capability selection the share now carries.
*/
@Remote('setCapabilities') setCapabilities(request: SetShareCapabilitiesRequest): Promise<ShareCapabilities>
/**
* Read the endpoints plugins currently offer.
* @returns The live offer list.
*/
@Remote('capabilities') capabilities(): ShareCapabilityOffers
/**
* Read the Liveshare server address the owner saved.
* @returns The current Liveshare server state, with both address fields absent while none is saved.
*/
@Remote('relay') relay(): OwnerRelayState
/**
* Choose the Liveshare server address later shares publish to.
* @param request - Normalized address or null to clear the saved one.
* @returns The Liveshare server state after the change.
*/
@Remote('setRelay') setRelay(request: SetRelayRequest): Promise<OwnerRelayState>
/**
* Report this host's owner identity for one Liveshare server address.
* @param request - Address to report, or the effective one when absent.
* @returns The owner identity status, without the credential.
*/
@Remote('identity') identity(request: OwnerIdentityRequest): Promise<OwnerIdentityStatus>
/**
* Read the Liveshare server's durable audit trail for one share.
* @param request - Share whose audit is read.
* @returns The audit events, or a structured failure when the Liveshare server cannot answer.
*/
@Remote('audit') audit(request: ShareAuditRequest): Promise<ShareAudit>
/**
* Check that the effective Liveshare server answers at all.
* @returns The anonymous connectivity result.
*/
@Remote('testRelay') testRelay(): Promise<RelayConnectivityView>
/**
* Register one throwaway share to check whether this host may publish.
* @param request - Session the throwaway registration names.
* @returns The Liveshare server's decision about this host's credential.
*/
@Remote('testPublish') testPublish(request: TestPublishRequest): Promise<RelayPublishView>
```
Source: [`packages/experimental/liveshare/src/host/share-remote.ts`](../../packages/experimental/liveshare/src/host/share-remote.ts)
<!-- END GENERATED cordis-surface -->
+2 -2
View File
@@ -36,8 +36,8 @@
en: 58dec2259b0b1c6f
zh: fc99fe965acaabf3
/llm-streaming/the-model-request:
en: 2b0831aaae8e1cdf
zh: f669d93d1b9d6025
en: 834d3d8d6b5871ab
zh: 393889ec6075f622
/llm-streaming/the-model-request/the-request-envelope-llmcallconfig-and-the-logged-header:
en: b0eb4620c6953646
zh: fabf51c7245a4855
+58 -3
View File
@@ -525,6 +525,26 @@ interface LlmNativeAuth {
}
```
A catalog entry may carry a provider-authored `badge` that selectors show beside the model name. It is display data: `resolveModelInfo` omits it, and no model request carries it.
```ts type-equiv
/**
* Emphasis of a model badge: `neutral` states a plain fact, `info` highlights
* the model, `success` marks a benefit, and `warning` asks for attention.
*/
type LlmModelBadgeTone = 'neutral' | 'info' | 'success' | 'warning'
```
```ts type-equiv
/** Short provider-authored label a selector shows beside one advertised model name. */
interface LlmModelBadge {
/** One literal, or translations keyed by lowercase language id with a required English entry. */
text: LocalizedText
/** Emphasis of the label. */
tone: LlmModelBadgeTone
}
```
```ts type-equiv
/** One adapter-discovered model; catalog membership is advisory, not request validation. */
interface LlmModelInfo {
@@ -538,6 +558,11 @@ interface LlmModelInfo {
description?: string
/** Accepted request modalities; absent means unknown, while an explicit omission is negative capability. */
inputModalities?: readonly ModelModality[]
/**
* Selector label advertised by catalog discovery; exact-route resolution
* omits it, and no model request or Session event carries it.
*/
badge?: LlmModelBadge
}
```
@@ -617,8 +642,21 @@ type RequestMessage = Message | RequestUserInput
```
```ts type-equiv
/** A single model request, fully assembled. */
interface GenerateOptions {
/** Auxiliary request purposes declared by their producer packages. */
interface LlmRequestPurposeMap {}
```
```ts type-equiv
/** Declared auxiliary request purpose; ordinary conversation requests leave it absent. */
type LlmRequestPurpose = Extract<keyof LlmRequestPurposeMap, string>
```
```ts type-equiv
/**
* A single model request, fully assembled.
* @typeParam Purpose - declared purpose keys for callers; forwarding adapters may accept `string`.
*/
interface GenerateOptions<Purpose extends string = LlmRequestPurpose> {
/** Registered provider route selecting the adapter instance. */
provider: string
model: string
@@ -659,7 +697,7 @@ interface GenerateOptions {
* map the purpose to model-hidden transport metadata. Ordinary conversation
* requests leave it unset.
*/
purpose?: 'compaction' | 'session-title'
purpose?: Purpose
}
```
@@ -1170,6 +1208,23 @@ The provider topology changed: an adapter registered or unregistered routes, or
Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
<a id="llmmodels-updated--emit"></a>
#### `llm/models-updated` — emit
A provider's advertised models or display metadata changed; consumers reload `listModels()`.
```ts cordis-catalog
/**
* A provider's advertised models or display metadata changed; consumers reload `listModels()`.
* @mode emit
* @param provider - route whose model catalog changed.
*/
'llm/models-updated'(provider: string): void
```
Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
<a id="llmstream--waterfall"></a>
#### `llm/stream` — waterfall
+58 -3
View File
@@ -531,6 +531,26 @@ interface LlmNativeAuth {
}
```
目录条目可以携带提供方编写的 `badge`,供选择器显示在模型名称旁。它只是展示数据:`resolveModelInfo` 不返回它,模型请求也不携带它。
```ts type-equiv
/**
* Emphasis of a model badge: `neutral` states a plain fact, `info` highlights
* the model, `success` marks a benefit, and `warning` asks for attention.
*/
type LlmModelBadgeTone = 'neutral' | 'info' | 'success' | 'warning'
```
```ts type-equiv
/** Short provider-authored label a selector shows beside one advertised model name. */
interface LlmModelBadge {
/** One literal, or translations keyed by lowercase language id with a required English entry. */
text: LocalizedText
/** Emphasis of the label. */
tone: LlmModelBadgeTone
}
```
```ts type-equiv
/** One adapter-discovered model; catalog membership is advisory, not request validation. */
interface LlmModelInfo {
@@ -544,6 +564,11 @@ interface LlmModelInfo {
description?: string
/** Accepted request modalities; absent means unknown, while an explicit omission is negative capability. */
inputModalities?: readonly ModelModality[]
/**
* Selector label advertised by catalog discovery; exact-route resolution
* omits it, and no model request or Session event carries it.
*/
badge?: LlmModelBadge
}
```
@@ -623,8 +648,21 @@ type RequestMessage = Message | RequestUserInput
```
```ts type-equiv
/** A single model request, fully assembled. */
interface GenerateOptions {
/** Auxiliary request purposes declared by their producer packages. */
interface LlmRequestPurposeMap {}
```
```ts type-equiv
/** Declared auxiliary request purpose; ordinary conversation requests leave it absent. */
type LlmRequestPurpose = Extract<keyof LlmRequestPurposeMap, string>
```
```ts type-equiv
/**
* A single model request, fully assembled.
* @typeParam Purpose - declared purpose keys for callers; forwarding adapters may accept `string`.
*/
interface GenerateOptions<Purpose extends string = LlmRequestPurpose> {
/** Registered provider route selecting the adapter instance. */
provider: string
model: string
@@ -665,7 +703,7 @@ interface GenerateOptions {
* map the purpose to model-hidden transport metadata. Ordinary conversation
* requests leave it unset.
*/
purpose?: 'compaction' | 'session-title'
purpose?: Purpose
}
```
@@ -1176,6 +1214,23 @@ The provider topology changed: an adapter registered or unregistered routes, or
Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
<a id="llmmodels-updated--emit"></a>
#### `llm/models-updated` — emit
A provider's advertised models or display metadata changed; consumers reload `listModels()`.
```ts cordis-catalog
/**
* A provider's advertised models or display metadata changed; consumers reload `listModels()`.
* @mode emit
* @param provider - route whose model catalog changed.
*/
'llm/models-updated'(provider: string): void
```
Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
<a id="llmstream--waterfall"></a>
#### `llm/stream` — waterfall
+2 -2
View File
@@ -3,8 +3,8 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/session-projection.md
/session-projections:
en: 45e5f8cb8ca18d6b
zh: 4ecfad40ec9e221c
en: b2789f5257a935c5
zh: 12d430a9cd454592
/session-projections/the-unit:
en: d48814d3ab0e997f
zh: d0337d8eba097a63
+9
View File
@@ -18,6 +18,13 @@ interface ProjectionHandle<S> {
* @returns the projection state at the Session's current cursor.
*/
stateOf(session: Session): S
/**
* Create a reader for one exact Session without reading state or preparing it.
* The reader retains this unit after unregistration and owns no disposal.
* @param session - Session whose committed events the bound reader folds.
* @returns a synchronous callback with the same state and failures as `stateOf(session)`.
*/
readerFor(session: Session): () => S
/**
* Unregister from global drives and snapshots without invalidating this reader.
* @returns a promise that resolves when this registration is released.
@@ -28,6 +35,8 @@ interface ProjectionHandle<S> {
The [compatibility rules](../../packages/session/session-projection/README.md#deprecated-plugin-compatibility) define legacy disposal, keyed reads, and their once-per-key deprecation warnings.
`ProjectionHandle.readerFor(session)` returns a `() => S` callback for one exact Session. Calling it reads the original unit and preserves borrowed state, readiness requirements and synchronous failures. Owners can compose several readers in a typed object; domain services keep them private. See [binding several states](../../packages/session/session-projection/README.md#bind-several-states-to-one-session).
## The unit
`ProjectionDefinition<K, S>` carries each unit's host state type locally; registration infers `S` from `stateSchema` and returns `ProjectionHandle<S>`. Only client-visible keys merge into `SessionProjectionMap`, which types their whole values. A `wire` block makes a unit client-visible, and rendering belongs to the slot system, never this layer:
+9
View File
@@ -18,6 +18,13 @@ interface ProjectionHandle<S> {
* @returns the projection state at the Session's current cursor.
*/
stateOf(session: Session): S
/**
* Create a reader for one exact Session without reading state or preparing it.
* The reader retains this unit after unregistration and owns no disposal.
* @param session - Session whose committed events the bound reader folds.
* @returns a synchronous callback with the same state and failures as `stateOf(session)`.
*/
readerFor(session: Session): () => S
/**
* Unregister from global drives and snapshots without invalidating this reader.
* @returns a promise that resolves when this registration is released.
@@ -28,6 +35,8 @@ interface ProjectionHandle<S> {
[兼容规则](../../packages/session/session-projection/README.zh.md#deprecated-plugin-compatibility)规定旧释放操作、按键读取及其每个键一次的弃用警告。
`ProjectionHandle.readerFor(session)` 为一个确切的 Session 返回 `() => S` 回调。调用它会读取原有单元,保留借用状态、就绪要求和同步失败。所有者可将多个读取函数组合成一个类型化对象;领域服务将它们保留在内部。参见[绑定多个状态](../../packages/session/session-projection/README.zh.md#bind-several-states-to-one-session)。
## 投影单元
`ProjectionDefinition<K, S>` 在各单元内部携带宿主状态类型;注册从 `stateSchema` 推导 `S`,并返回 `ProjectionHandle<S>`。只有客户端可见的 key 合并到 `SessionProjectionMap`,由它约束对应的全量值。`wire` 块使单元对客户端可见,渲染归 slot 体系管,永远不归本层:
+3
View File
@@ -68,3 +68,6 @@
/sessions/remote-catalog-and-workspace-opening:
en: dd27307e0d7c893c
zh: b77d2a749b7b641c
/sessions/session-log-upload-exclusions:
en: cfe3323aade972be
zh: 8423b490c47c5013
+43
View File
@@ -817,6 +817,29 @@ The backends that consume this contract are on [persistence.md](persistence.md).
The optional `application` selects a registered file handler without changing the system default; `workspacePathApplications({ path })` returns current handlers, names, icons, and default selection after Host path verification.
## Session-log upload exclusions
`ctx.sessionLogDeepSeek.registerExclusion()` registers a caller-owned predicate over `SessionLogUploadRequest`. Any match omits the log contribution and its acceptance callback before reading Session events. No match preserves normal upload eligibility. The [package README](../../packages/session/session-log-deepseek/README.md#upload-exclusions) defines failure and disposal behavior.
```ts type-equiv
/** Request identity inspected before preparing a Session-log contribution. */
interface SessionLogUploadRequest {
/** Live Session whose canonical log would be contributed. */
readonly sessionId: SessionId
/** Auxiliary request classification; absent for ordinary conversation requests. */
readonly purpose?: string
}
```
```ts type-equiv
/**
* Synchronous, side-effect-free upload exclusion owned by its registering plugin.
* @param request - request identity; the predicate must not mutate it.
* @returns `true` to omit the log field and acceptance callback, or `false` to keep checking eligibility.
*/
type SessionLogUploadExclusion = (request: SessionLogUploadRequest) => boolean
```
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
<a id="cordis-surface"></a>
@@ -1035,6 +1058,26 @@ Types: [SessionId](core.md) · [SessionSearchRequest](session-query.md)
Source: [`packages/api/session-controller/src/index.ts`](../../packages/api/session-controller/src/index.ts)
<a id="ctxsessionlogdeepseek--sessionlogdeepseekservice"></a>
### `ctx.sessionLogDeepSeek` — `SessionLogDeepSeekService`
Incremental Session-log contributor with caller-owned upload exclusions.
```ts cordis-catalog
/**
* Exclude matching requests before reading or preparing their log contribution.
* Any matching rule suppresses both the field and its acceptance callback. With
* no matching rules, normal upload eligibility applies. A throwing rule fails
* this contribution; the request-extension registry omits it and reports the error.
* @param exclude - synchronous, side-effect-free predicate; `true` skips this upload.
* @returns effect disposer that removes this registration when called or when the caller unloads.
*/
registerExclusion(exclude: SessionLogUploadExclusion): () => Promise<void>
```
Source: [`packages/session/session-log-deepseek/src/index.ts`](../../packages/session/session-log-deepseek/src/index.ts)
<a id="ctxsessions--sessionstore"></a>
### `ctx.sessions` — `SessionStore`
+43
View File
@@ -821,6 +821,29 @@ interface PluginRecord {
可选的 `application` 指定文件关联应用,不修改系统默认值;`workspacePathApplications({ path })` 在校验 Host 路径后返回当前关联应用、名称、图标和默认项。
## Session 日志上传排除条件
`ctx.sessionLogDeepSeek.registerExclusion()` 注册归调用方所有的判断函数,输入为 `SessionLogUploadRequest`。任意条件匹配时,在读取 Session 事件前省略日志贡献与接受回调。没有条件匹配时保留普通上传资格判断。[包 README](../../packages/session/session-log-deepseek/README.zh.md#upload-exclusions) 定义失败与释放行为。
```ts type-equiv
/** Request identity inspected before preparing a Session-log contribution. */
interface SessionLogUploadRequest {
/** Live Session whose canonical log would be contributed. */
readonly sessionId: SessionId
/** Auxiliary request classification; absent for ordinary conversation requests. */
readonly purpose?: string
}
```
```ts type-equiv
/**
* Synchronous, side-effect-free upload exclusion owned by its registering plugin.
* @param request - request identity; the predicate must not mutate it.
* @returns `true` to omit the log field and acceptance callback, or `false` to keep checking eligibility.
*/
type SessionLogUploadExclusion = (request: SessionLogUploadRequest) => boolean
```
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
<a id="cordis-surface"></a>
@@ -1039,6 +1062,26 @@ Types: [SessionId](core.zh.md) · [SessionSearchRequest](session-query.zh.md)
Source: [`packages/api/session-controller/src/index.ts`](../../packages/api/session-controller/src/index.ts)
<a id="ctxsessionlogdeepseek--sessionlogdeepseekservice"></a>
### `ctx.sessionLogDeepSeek` — `SessionLogDeepSeekService`
Incremental Session-log contributor with caller-owned upload exclusions.
```ts cordis-catalog
/**
* Exclude matching requests before reading or preparing their log contribution.
* Any matching rule suppresses both the field and its acceptance callback. With
* no matching rules, normal upload eligibility applies. A throwing rule fails
* this contribution; the request-extension registry omits it and reports the error.
* @param exclude - synchronous, side-effect-free predicate; `true` skips this upload.
* @returns effect disposer that removes this registration when called or when the caller unloads.
*/
registerExclusion(exclude: SessionLogUploadExclusion): () => Promise<void>
```
Source: [`packages/session/session-log-deepseek/src/index.ts`](../../packages/session/session-log-deepseek/src/index.ts)
<a id="ctxsessions--sessionstore"></a>
### `ctx.sessions` — `SessionStore`
+2 -2
View File
@@ -9,8 +9,8 @@
en: f2d2c0d3b8f14ec7
zh: 441ed13ff3f81d2a
/web-client-slots/cardinality-and-scope:
en: 5b0ada069239576b
zh: 84e1e6b253d1461e
en: cd17e3e0ff6e62ff
zh: 6e0db2cb16c41b73
/web-client-slots/component-inputs:
en: 9cb70abb2e39b958
zh: cd4b6f1705d90e17
+6 -1
View File
@@ -65,6 +65,8 @@ The slot declaration fixes two independent axes.
`priority` is a shadowing rank for `single`, `list`, and `keyed` cells and an election order for `chain`. Lower values run or render first. Ordinary additive contributions should choose a fresh list `id` or keyed `key`; intentionally reusing a shipped cell replaces its presentation.
The [context-menu plugin](../../packages/client/ui-context-menu/README.md) contributes `useContextMenu` through `provideRoot`; every scope receives the same plugin-owned trigger factory. Its prop and retained handlers retire when the provider unloads. Its root-scoped keyed `contextMenu.icon` Slot renders business-owned icons from action metadata.
## Component inputs
A registered component receives inputs assembled at its binding site. Components derive these types rather than copying their members.
@@ -140,7 +142,10 @@ Factory: conversation.content [ConversationContent]
│ │ ├─ conversation.chat.text-interaction [list]
│ │ └─ conversation.chat.flow [ChatFlow]
│ │ └─ conversation.chat.node [ChatNodeSeat dispatch]
│ │ ├─ key=user,steering [UserMessageNodeView]
│ │ ├─ key=user [UserMessageNodeView]
│ │ │ ├─ conversation.chat.user.before [chain]
│ │ │ └─ calls Factory: conversation.chat.user.content
│ │ ├─ key=steering [UserMessageNodeView]
│ │ │ └─ calls Factory: conversation.chat.user.content
│ │ ├─ key=assistant-step [AssistantNodeView / AssistantMarkdown]
│ │ │ ├─ conversation.chat.message.images [MessageImages]
+6 -1
View File
@@ -67,6 +67,8 @@ Slot 声明固定两个相互独立的维度。
<a id="component-inputs"></a>
[右键菜单插件](../../packages/client/ui-context-menu/README.zh.md) 通过 `provideRoot` 贡献 `useContextMenu`;每个作用域接收同一个由插件拥有的触发器工厂。提供方卸载时,注入属性与保留的处理器一并失效。其根作用域 keyed Slot `contextMenu.icon` 根据操作元数据渲染业务方提供的图标。
## 组件输入
注册组件会在 binding 位置收到组装后的输入。组件应从这些类型推导 props,不要重新抄写成员。
@@ -142,7 +144,10 @@ Factory: conversation.content [ConversationContent]
│ │ ├─ conversation.chat.text-interaction [list]
│ │ └─ conversation.chat.flow [ChatFlow]
│ │ └─ conversation.chat.node [ChatNodeSeat dispatch]
│ │ ├─ key=user,steering [UserMessageNodeView]
│ │ ├─ key=user [UserMessageNodeView]
│ │ │ ├─ conversation.chat.user.before [chain]
│ │ │ └─ calls Factory: conversation.chat.user.content
│ │ ├─ key=steering [UserMessageNodeView]
│ │ │ └─ calls Factory: conversation.chat.user.content
│ │ ├─ key=assistant-step [AssistantNodeView / AssistantMarkdown]
│ │ │ ├─ conversation.chat.message.images [MessageImages]