diff --git a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.i18n.yaml b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.i18n.yaml
index ef48218d09..166fc3aab2 100644
--- a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.i18n.yaml
+++ b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.i18n.yaml
@@ -15,5 +15,5 @@
en: 1e2239783738cec2
zh: 5f248eee47de376e
/agent-note-session-change-request-bindings/consequences:
- en: a2960e50ec52c9b6
- zh: fd23f4fe1137787d
+ en: 2786b1dffa995c14
+ zh: c124420915da5aae
diff --git a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.md b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.md
index cec7b0e81b..a7177b9acf 100644
--- a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.md
+++ b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.md
@@ -30,4 +30,4 @@ After each push result, and when a caller such as the forge panel reports the br
## Consequences
-Bindings appear without model cooperation for the common `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` flows and add no model tokens. Commands run through scripts, aliases, or other command-line tools are not recognized, and a change request opened elsewhere for a branch appears only after another push, another report of that branch, or a `track`. Another provider adds its own access and URL forms behind the same provider contract without changing the binding rules or the polling. The host needs `gh` signed in for each GitHub host.
+Bindings appear without model cooperation for the common `gh pr create`, `gh pr view`, `gh pr edit`, `gh pr checkout`, and `git push` flows and add no model tokens. Commands run through scripts, aliases, or other command-line tools are not recognized, and a change request opened elsewhere for a branch appears only after another push, another report of that branch, or a `track`. Another provider adds its own access and URL forms behind the same provider contract and registers its CLI's commands as a [command rule](2026-11-11-forge-provider-command-rules.md), without changing the polling. The host needs `gh` signed in for each GitHub host.
diff --git a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.zh.md b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.zh.md
index e422428a20..e170f35117 100644
--- a/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.zh.md
+++ b/.agents/notes/implemented/feature/2026-10-09-session-change-request-bindings.zh.md
@@ -30,4 +30,4 @@ Status: implemented
## Consequences
-在常见的 `gh pr create`、`gh pr view`、`gh pr edit`、`gh pr checkout` 与 `git push` 流程中,绑定无需模型配合即可出现,且不增加模型 token。通过脚本、别名或其他命令行工具运行的命令无法识别;在别处为某个分支打开的变更请求,要等到下一次推送、再次报告该分支或 `track` 之后才会出现。新的提供方在同一提供方契约之后加入自己的访问方式与 URL 形式,无需改变绑定规则或轮询。宿主需要为每个 GitHub 主机登录 `gh`。
+在常见的 `gh pr create`、`gh pr view`、`gh pr edit`、`gh pr checkout` 与 `git push` 流程中,绑定无需模型配合即可出现,且不增加模型 token。通过脚本、别名或其他命令行工具运行的命令无法识别;在别处为某个分支打开的变更请求,要等到下一次推送、再次报告该分支或 `track` 之后才会出现。新的提供方在同一提供方契约之后加入自己的访问方式与 URL 形式,并把其 CLI 的命令注册为[命令规则](2026-11-11-forge-provider-command-rules.zh.md),无需改变轮询。宿主需要为每个 GitHub 主机登录 `gh`。
diff --git a/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.i18n.yaml b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.i18n.yaml
new file mode 100644
index 0000000000..df13f53679
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.i18n.yaml
@@ -0,0 +1,19 @@
+# Bilingual-pair consistency record for 2026-11-11-forge-provider-command-rules.md (docs/i18n/README.md): per heading
+# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
+# After editing either side, bring the other along and re-record with:
+# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.md
+/agent-note-forge-provider-command-rules:
+ en: 1b602c42430a77b4
+ zh: 8109a6a56901fb89
+/agent-note-forge-provider-command-rules/problem:
+ en: 29def264f0ee5401
+ zh: 829cdb87861757f5
+/agent-note-forge-provider-command-rules/decision:
+ en: 17e84e777b0d7380
+ zh: 2cc4720c9437a839
+/agent-note-forge-provider-command-rules/alternatives-considered:
+ en: a5bdd96f8e814246
+ zh: 29a4f0026cd9abaf
+/agent-note-forge-provider-command-rules/consequences:
+ en: 506047cfeb4645d3
+ zh: b587240a69b46b8a
diff --git a/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.md b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.md
new file mode 100644
index 0000000000..86e647a4ce
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.md
@@ -0,0 +1,33 @@
+# Agent Note: Forge provider command rules
+
+Status: implemented
+
+English | [中文](2026-11-11-forge-provider-command-rules.zh.md)
+
+## Problem
+
+[Session change request bindings](2026-10-09-session-change-request-bindings.md) recognized `gh` commands inside forge-session, so every new code host's CLI, such as `glab`, meant editing forge-session, and numeric selectors such as `glab mr view 7 -R group/app` need knowledge of that CLI's options and URL forms. Recognition feeds a Session projection, so it must stay deterministic for replay and checkpoints, and a provider enabled after a Session ran its commands should still bind them.
+
+## Decision
+
+Each provider registers a declarative `ForgeCommandRule` with `ctx.forgeSession.registerCommands`: its executable, creation subcommands, reference and raw API request subcommand groups with their own options, change request page path, JSON URL members, and a pure `select` that maps one parsed command to a URL or a read-only lookup. An API request, such as `glab api`, binds only the change request its path names, since its output can list many. [forge-github](../../../../packages/experimental/forge-github/src/commands.ts) registers `gh` and [forge-gitlab](../../../../packages/experimental/forge-gitlab/src/commands.ts) registers `glab`. forge-session keeps the shared parts: the literal shell tokenizer, option parsing, output reading, lookups in the call's shell, and the projection.
+
+The `forgeChangeRequests` state version derives from the recognized rules, `5 × 2^32` plus a hash of the sorted `id@version` pairs, so a checkpoint folded under another rule set is discarded and the log folds again. A registration that changes the set releases the projection and registers it at the new version, then refreshes watchers; the released handle stays readable during the swap. Ending a registration keeps its rule recognized until the service restarts or another rule replaces its id or executable.
+
+## Alternatives considered
+
+**Recognition per CLI inside forge-session.** Every provider change would edit forge-session, and its tests would own other CLIs' option sets.
+
+**Rules on `ForgeProvider`.** forge-session could read rules from `ctx.forge`, but the forge Service Definition would carry a field that only one Consumer uses.
+
+**Rules for later events only.** Folding only events after a registration skips the commands a Session ran before the provider loaded.
+
+**A fixed state version.** Folding with whatever rules are loaded breaks the rule that a restored checkpoint plus suffix replay equals full replay once the rules change.
+
+**Rebuilding on unregistration.** Providers unload before forge-session at shutdown, so every exit would checkpoint a smaller rule set and every start would refold every Session.
+
+**Option parsing in each provider.** The token walk would repeat in every provider.
+
+## Consequences
+
+A new provider rule or a raised rule version refolds every Session once; until a Session is opened again, the Session list shows no cached bindings for it, and re-registration emits no projection change event, so an open Session's summary shows the refolded bindings after a later event. Providers own their rule versions. Unloading a provider at runtime leaves its commands recognized until restart, though they run no lookup; starting without it removes the bindings that only its commands made, while binding records stay. Each start registers the projection without rules and once more after the providers register theirs. The [forge-session README](../../../../packages/experimental/forge-session/README.md#use-this-package) owns the recognition rules.
diff --git a/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.zh.md b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.zh.md
new file mode 100644
index 0000000000..e91f7c5398
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-11-forge-provider-command-rules.zh.md
@@ -0,0 +1,33 @@
+# Agent Note: Forge 提供方命令规则
+
+Status: implemented
+
+[English](2026-11-11-forge-provider-command-rules.md) | 中文
+
+## Problem
+
+[Session 变更请求绑定](2026-10-09-session-change-request-bindings.zh.md)在 forge-session 内部识别 `gh` 命令,因此每接入一个代码托管平台的 CLI(如 `glab`)都要修改 forge-session;而 `glab mr view 7 -R group/app` 这类数字编号需要了解该 CLI 的选项与 URL 形式。识别结果供 Session 投影使用,因此必须在重放与检查点下保持确定;提供方在 Session 执行过命令之后才启用时,也应能绑定这些命令。
+
+## Decision
+
+每个提供方通过 `ctx.forgeSession.registerCommands` 注册一条声明式的 `ForgeCommandRule`:其可执行文件、创建子命令、各带选项的引用子命令组与原始 API 请求子命令组、变更请求页面路径、JSON URL 成员,以及一个纯函数 `select`,把一条解析后的命令映射为 URL 或只读查询。API 请求(如 `glab api`)只绑定其路径指向的变更请求,因为其输出可能列出许多变更请求。[forge-github](../../../../packages/experimental/forge-github/src/commands.ts) 注册 `gh`,[forge-gitlab](../../../../packages/experimental/forge-gitlab/src/commands.ts) 注册 `glab`。forge-session 保留共用部分:字面量 shell 拆词、选项解析、输出读取、在调用所在 shell 中的查询,以及投影。
+
+`forgeChangeRequests` 的状态版本由已识别规则派生,即 `5 × 2^32` 加上排序后 `id@version` 对的哈希,因此按其他规则集折叠的检查点会被丢弃,日志重新折叠。改变规则集的注册会释放投影并以新版本重新注册,再刷新监听方;切换期间已释放的句柄仍可读取。注册结束后,其规则仍被识别,直到服务重启或另一条规则替换其 id 或可执行文件。
+
+## Alternatives considered
+
+**在 forge-session 内按 CLI 识别。**每次提供方变化都要修改 forge-session,其测试还要承担其他 CLI 的选项集。
+
+**把规则放在 `ForgeProvider` 上。**forge-session 可以从 `ctx.forge` 读取规则,但 forge 的 Service Definition 就会带上只有一个 Consumer 使用的字段。
+
+**规则只作用于之后的事件。**只折叠注册之后的事件,会漏掉 Session 在提供方加载之前执行的命令。
+
+**固定的状态版本。**按当前加载的规则折叠,一旦规则变化,就违背了"恢复的检查点加后缀重放等于完整重放"这一规则。
+
+**注销时重建。**关闭时提供方先于 forge-session 卸载,因此每次退出都会按更小的规则集写入检查点,每次启动都要重新折叠所有 Session。
+
+**由各提供方解析选项。**逐词解析会在每个提供方中重复。
+
+## Consequences
+
+新增提供方规则或提高规则版本,会使每个 Session 重新折叠一次;Session 再次打开之前,Session 列表不显示它的缓存绑定;重新注册不发出投影变化事件,因此已打开 Session 的摘要要在后续事件之后才显示重新折叠的绑定。规则版本由提供方负责。运行时卸载提供方后,其命令仍被识别,直到重启,但不再执行反查;不加载该提供方启动时,只由其命令产生的绑定会消失,绑定记录保留。每次启动时投影先在没有规则的情况下注册,提供方注册规则后再注册一次。识别规则见 [forge-session README](../../../../packages/experimental/forge-session/README.zh.md#use-this-package)。
diff --git a/apps/web/tests/expected/plugin-config/official.expected.md b/apps/web/tests/expected/plugin-config/official.expected.md
index 0d4f6919d6..f58f046386 100644
--- a/apps/web/tests/expected/plugin-config/official.expected.md
+++ b/apps/web/tests/expected/plugin-config/official.expected.md
@@ -39,7 +39,7 @@
- switch "启用 自动授权审查"
- listitem:
- button "查看 变更请求与工作树": 变更请求与工作树
- - text: 实验性 在会话侧栏集中跟踪关联的 GitHub PR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。
+ - text: 实验性 在会话侧栏集中跟踪关联的代码变更请求,支持 GitHub PR 以及 GitLab MR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。GitLab 合并请求需要本机安装 glab 并登录。
- status
- switch "启用 变更请求与工作树"
- heading "已安装插件" [level=3]
diff --git a/apps/web/tests/expected/plugin-manager/forge-preview.expected.md b/apps/web/tests/expected/plugin-manager/forge-preview.expected.md
index 39e77db44b..5d9cf750a1 100644
--- a/apps/web/tests/expected/plugin-manager/forge-preview.expected.md
+++ b/apps/web/tests/expected/plugin-manager/forge-preview.expected.md
@@ -5,12 +5,12 @@
- text: v{{version}} 实验性
- paragraph:
- code: "@deepseek-ai/dsh-experimental-forge-bundle"
-- paragraph: 在会话侧栏集中跟踪关联的 GitHub PR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。
+- paragraph: 在会话侧栏集中跟踪关联的代码变更请求,支持 GitHub PR 以及 GitLab MR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。GitLab 合并请求需要本机安装 glab 并登录。
- region "详细介绍":
- paragraph:
- img "会话关联 GitHub PR,跟踪检查、评审与代码差异,并用工作树隔离任务改动"
- heading "包含的组件" [level=4]
-- text: 共 6 个 · 6 已停用
+- text: 共 7 个 · 7 已停用
- list:
- listitem:
- text: 工作树服务 创建命名的 Git 工作树,并切换当前会话的工作目录。
@@ -32,6 +32,11 @@
- code: forge-github
- code: "@deepseek-ai/dsh-experimental-forge-github"
- text: 已关闭
+ - listitem:
+ - text: GitLab 变更请求 通过宿主上的 GitLab CLI 为 forge 注册表读写 GitLab 合并请求。
+ - code: forge-gitlab
+ - code: "@deepseek-ai/dsh-forge-gitlab"
+ - text: 已关闭
- listitem:
- text: 会话变更请求 把变更请求绑定到创建、推送或跟踪它们的会话,并监听其状态。
- code: forge-session
diff --git a/apps/web/tests/expected/plugin-manager/live-enabled.expected.md b/apps/web/tests/expected/plugin-manager/live-enabled.expected.md
index b425c381c9..e2cc9d3809 100644
--- a/apps/web/tests/expected/plugin-manager/live-enabled.expected.md
+++ b/apps/web/tests/expected/plugin-manager/live-enabled.expected.md
@@ -39,7 +39,7 @@
- switch "启用 自动授权审查"
- listitem:
- button "查看 变更请求与工作树": 变更请求与工作树
- - text: 实验性 在会话侧栏集中跟踪关联的 GitHub PR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。
+ - text: 实验性 在会话侧栏集中跟踪关联的代码变更请求,支持 GitHub PR 以及 GitLab MR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。GitLab 合并请求需要本机安装 glab 并登录。
- status
- switch "启用 变更请求与工作树"
- heading "已安装插件" [level=3]
diff --git a/apps/web/tests/expected/plugin-manager/manager.expected.md b/apps/web/tests/expected/plugin-manager/manager.expected.md
index aa7d31a43b..236b381763 100644
--- a/apps/web/tests/expected/plugin-manager/manager.expected.md
+++ b/apps/web/tests/expected/plugin-manager/manager.expected.md
@@ -39,7 +39,7 @@
- switch "启用 自动授权审查"
- listitem:
- button "查看 变更请求与工作树": 变更请求与工作树
- - text: 实验性 在会话侧栏集中跟踪关联的 GitHub PR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。
+ - text: 实验性 在会话侧栏集中跟踪关联的代码变更请求,支持 GitHub PR 以及 GitLab MR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。GitLab 合并请求需要本机安装 glab 并登录。
- status
- switch "启用 变更请求与工作树"
- heading "已安装插件" [level=3]
diff --git a/apps/web/tests/forge-panel.e2e.ts b/apps/web/tests/forge-panel.e2e.ts
index 138ca12506..f84c79925a 100644
--- a/apps/web/tests/forge-panel.e2e.ts
+++ b/apps/web/tests/forge-panel.e2e.ts
@@ -77,9 +77,9 @@ const state = existsSync(statePath) ? JSON.parse(readFileSync(statePath, 'utf8')
const save = () => { writeFileSync(statePath, JSON.stringify(state)) }
if (args[0] === 'pr' && args[1] === 'view' && args[2] === '7') {
const fields = args[args.indexOf('--json') + 1]
- process.stdout.write(JSON.stringify(fields === 'url'
- ? { url: 'https://github.com/octo/demo/pull/7' }
- : { number: 7, title: 'Add the pull request panel' }))
+ const url = 'https://github.com/octo/demo/pull/7'
+ process.stdout.write(fields !== 'url' ? JSON.stringify({ number: 7, title: 'Add the pull request panel' })
+ : args.includes('--jq') ? url + '\\n' : JSON.stringify({ url }))
process.exit(0)
}
if (args[0] === 'pr' && args[1] === 'ready' && args[2] === '9') {
@@ -319,7 +319,7 @@ if (args[0] === 'api' && args[1] === 'graphql') {
}).filter(thread => thread.comments.nodes.length > 0)
const pendingComments = threads.flatMap(thread => thread.comments.nodes).filter(comment => comment.state === 'PENDING').length
process.stdout.write(JSON.stringify({ data: { viewer: { login: VIEWER }, repository: { isArchived: false, viewerPermission: 'WRITE',
- pullRequest: { id: 'pull-' + number, headRefOid: pulls[number].headRefOid, locked: false,
+ pullRequest: { id: 'pull-' + number, headRefOid: pulls[number].headRefOid, locked: false, viewerDidAuthor: false,
reviews: { nodes: current.pending === null ? [] : [{ id: current.pending.id, viewerDidAuthor: true, comments: { totalCount: pendingComments } }] },
reviewThreads: page(threads) } } } }))
process.exit(0)
@@ -733,7 +733,7 @@ async function expectNumberedReference({ scaffold, page, project, tripwire }: Pa
})
}).toEqual([{ action: 'reference', url: PULL }])
const calls = (await readFile(join(project, '.fixture-bin', 'calls.jsonl'), 'utf8')).trim().split('\n').map(line => JSON.parse(line) as string[])
- expect(calls).toContainEqual(['pr', 'view', '7', '--repo', 'octo/demo', '--json', 'url'])
+ expect(calls).toContainEqual(['pr', 'view', '7', '--repo', 'octo/demo', '--json', 'url', '--jq', '.url'])
expect(tripwire.pageErrors).toEqual([])
expect(tripwire.warnings).toEqual([])
}
diff --git a/docs/capability-seams.i18n.yaml b/docs/capability-seams.i18n.yaml
index 228fbfa50d..55afd2897b 100644
--- a/docs/capability-seams.i18n.yaml
+++ b/docs/capability-seams.i18n.yaml
@@ -6,5 +6,5 @@
en: 41d772192075e133
zh: 5ef3da69b4de1d8a
/capability-seams-and-core-services:
- en: e55823589627cda5
- zh: 2e82c1116fcdb9f8
+ en: 377f8f047b34cfde
+ zh: be08abadad0beb93
diff --git a/docs/capability-seams.md b/docs/capability-seams.md
index 72350dd53e..6058d17b22 100644
--- a/docs/capability-seams.md
+++ b/docs/capability-seams.md
@@ -44,6 +44,7 @@ flowchart LR
pkg_experimental_forge["experimental-forge"]
svc_forge["ctx.forge Code host change requests"]
pkg_experimental_forge_github["experimental-forge-github"]
+ pkg_forge_gitlab["forge-gitlab"]
pkg_experimental_forge_session["experimental-forge-session"]
pkg_experimental_client_ui_forge["experimental-client-ui-forge"]
svc_forgeSession["ctx.forgeSession Session change request bindings"]
@@ -390,6 +391,7 @@ flowchart LR
pkg_experimental_worktree --> svc_worktrees
pkg_file_reference --> svc_fileReferences
pkg_file_reference_local --> svc_fileReferences
+ pkg_forge_gitlab --> svc_forge
pkg_fs --> svc_fs
pkg_fs_local --> svc_fs
pkg_fs_sandbox --> svc_fs
@@ -680,7 +682,7 @@ flowchart LR
| `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | The dsh launcher supplies data-only profile locations and composition inputs; reload scheduling belongs to dsh-hmr. |
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | Applies source policy and shared HTTP request dispatch; credential verification belongs to ConnectionAuthentication, and API adapters register endpoints and streams. |
| `ctx.connection.authentication` | `seam` | [`client-connection`](../packages/client/connection) | [`host-authentication-token`](../packages/host/authentication-token), [`host-authentication-desktop`](../packages/host/authentication-desktop) | [`client-connection`](../packages/client/connection) | - | Tries scope-owned credential verifiers in registration order and returns the first live Peer; transport source policy and business authorization stay with their consumers. |
-| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | Providers map remote and change request URLs, look up change requests by head branch, and read status in batches; watchers of one change request share one polling loop. |
+| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github), [`forge-gitlab`](../packages/experimental/forge-gitlab) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | Providers map remote and change request URLs, look up change requests by head branch, and read status in batches; watchers of one change request share one polling loop. |
| `ctx.forgeSession` | `service` | [`experimental-forge-session`](../packages/experimental/forge-session) | - | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | A Session projection derives bindings from shell results and binding records and publishes their URLs without status to clients; push results trigger head-branch discovery, and Session watchers poll bound change requests through the forge registry. |
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | Streams one panel state per followed Session: Git inspection using Session permissions, the recognized code host and its sign-in, and the bound change requests with polled status. |
| `ctx.worktrees` | `seam` | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-tool-worktree`](../packages/experimental/tool-worktree) | - | Explicit experimental creation from a pinned local commit. Existing write permissions govern checkout and shared Git metadata; the working-directory service owns the resulting Session directory. |
diff --git a/docs/capability-seams.zh.md b/docs/capability-seams.zh.md
index 4f8eb09bfb..a7b44ce529 100644
--- a/docs/capability-seams.zh.md
+++ b/docs/capability-seams.zh.md
@@ -46,6 +46,7 @@ flowchart LR
pkg_experimental_forge["experimental-forge"]
svc_forge["ctx.forge Code host change requests"]
pkg_experimental_forge_github["experimental-forge-github"]
+ pkg_forge_gitlab["forge-gitlab"]
pkg_experimental_forge_session["experimental-forge-session"]
pkg_experimental_client_ui_forge["experimental-client-ui-forge"]
svc_forgeSession["ctx.forgeSession Session change request bindings"]
@@ -392,6 +393,7 @@ flowchart LR
pkg_experimental_worktree --> svc_worktrees
pkg_file_reference --> svc_fileReferences
pkg_file_reference_local --> svc_fileReferences
+ pkg_forge_gitlab --> svc_forge
pkg_fs --> svc_fs
pkg_fs_local --> svc_fs
pkg_fs_sandbox --> svc_fs
@@ -682,7 +684,7 @@ flowchart LR
| `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | dsh launcher 提供纯数据形式的 profile 位置与组合输入;重载调度由 dsh-hmr 负责。 |
| `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | 执行来源策略与共享 HTTP 请求分发;凭据验证归 ConnectionAuthentication,API 适配器注册端点和流。 |
| `ctx.connection.authentication` | `seam` | [`client-connection`](../packages/client/connection) | [`host-authentication-token`](../packages/host/authentication-token), [`host-authentication-desktop`](../packages/host/authentication-desktop) | [`client-connection`](../packages/client/connection) | - | 按注册顺序尝试作用域拥有的凭据验证器,返回首个存活 Peer;传输来源策略和业务授权仍归各自消费者。 |
-| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | 提供方映射远端与变更请求 URL、按 head 分支查找变更请求并批量读取状态;同一变更请求的监听方共享一个轮询循环。 |
+| `ctx.forge` | `seam` | [`experimental-forge`](../packages/experimental/forge) | [`experimental-forge-github`](../packages/experimental/forge-github), [`forge-gitlab`](../packages/experimental/forge-gitlab) | [`experimental-forge-session`](../packages/experimental/forge-session), [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | 提供方映射远端与变更请求 URL、按 head 分支查找变更请求并批量读取状态;同一变更请求的监听方共享一个轮询循环。 |
| `ctx.forgeSession` | `service` | [`experimental-forge-session`](../packages/experimental/forge-session) | - | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | Session 投影从 shell 结果与绑定记录派生绑定,并把不含状态的 URL 发布给客户端;推送结果触发按 head 分支的发现,Session 监听方通过 forge 注册表轮询已绑定的变更请求。 |
| `ctx.forgePanel` | `service` | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | - | - | - | 为每个被跟随的 Session 推送一份面板状态:使用 Session 权限进行的 Git 检查、识别出的代码托管平台及其登录状态,以及带轮询状态的已绑定变更请求。 |
| `ctx.worktrees` | `seam` | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-worktree`](../packages/experimental/worktree) | [`experimental-tool-worktree`](../packages/experimental/tool-worktree) | - | 显式实验组合从固定的本地提交创建工作树。检出目录与共享 Git 元数据受现有写权限约束;工作目录服务拥有创建后的 Session 目录。 |
diff --git a/docs/config-catalog.md b/docs/config-catalog.md
index caaa9d7a9b..6b8ec45529 100644
--- a/docs/config-catalog.md
+++ b/docs/config-catalog.md
@@ -1182,7 +1182,7 @@ export interface CotTranslationPreferences {
## `@deepseek-ai/dsh-experimental-client-ui-forge`
- `inject`: `forge` · `forgeSession` · `sessionProjections` · `workingDirectory` · `fs` · `subprocess` · `sandbox` · `sandboxPolicy` · `agents`
-- `source`: [`packages/experimental/client-ui-forge/src/types.ts:483`](../packages/experimental/client-ui-forge/src/types.ts)
+- `source`: [`packages/experimental/client-ui-forge/src/types.ts:485`](../packages/experimental/client-ui-forge/src/types.ts)
```ts config-catalog
/** Host settings of the forge panel Remote. */
@@ -1270,7 +1270,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge`
-- `source`: [`packages/experimental/forge/src/types.ts:603`](../packages/experimental/forge/src/types.ts)
+- `source`: [`packages/experimental/forge/src/types.ts:638`](../packages/experimental/forge/src/types.ts)
```ts config-catalog
/** Poll cadence and fetch deadline for watched change requests. */
@@ -1293,7 +1293,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge-github`
- `inject`: `forge`
-- `source`: [`packages/experimental/forge-github/src/index.ts:14`](../packages/experimental/forge-github/src/index.ts)
+- `source`: [`packages/experimental/forge-github/src/index.ts:19`](../packages/experimental/forge-github/src/index.ts)
```ts config-catalog
/** GitHub CLI executable, served hosts, and invocation limits. */
@@ -1325,7 +1325,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge-session`
- `inject`: `forge` · `sessions` · `sessionProjections`
-- `source`: [`packages/experimental/forge-session/src/types.ts:91`](../packages/experimental/forge-session/src/types.ts)
+- `source`: [`packages/experimental/forge-session/src/types.ts:160`](../packages/experimental/forge-session/src/types.ts)
```ts config-catalog
/** Deployment settings of `forgeSession`. */
@@ -1629,6 +1629,39 @@ export interface Config {
```
+
+
+
+## `@deepseek-ai/dsh-forge-gitlab`
+
+- `inject`: `forge`
+- `source`: [`packages/experimental/forge-gitlab/src/index.ts:19`](../packages/experimental/forge-gitlab/src/index.ts)
+
+```ts config-catalog
+/** GitLab CLI executable, served hosts, and read limits. */
+export interface Config {
+ /** GitLab CLI executable name or absolute host path. */
+ glabCommand?: string
+ /** Host names this provider serves; list self-managed GitLab hosts explicitly. */
+ hosts?: string[]
+ /** Deadline in milliseconds for one `glab` invocation. */
+ timeoutMs?: number
+ /** Maximum captured bytes per `glab` output stream and combined JSON bytes of one complete check read or review read. */
+ maxOutputBytes?: number
+ /** Most review threads one review read returns, which reports itself truncated past it. */
+ maxReviewThreads?: number
+ /** Most commits one merge request commit listing returns, the oldest ones when there are more. */
+ maxCommits?: number
+ /** Most merge requests one status query reads; GitLab refuses a query over its complexity limit, which halves the batch. */
+ statusBatchSize?: number
+ /** Most `glab` processes one status fetch runs at once. */
+ maxConcurrentRequests?: number
+ /** Most bytes of diff version patches kept in memory for the hunks of outdated review threads. */
+ maxCachedVersionBytes?: number
+}
+```
+
+
@@ -5146,7 +5179,7 @@ export interface Config {
## `@deepseek-ai/dsh-working-directory`
- `inject`: `fs` · `sessionProjections` · `systemPrompt`
-- `source`: [`packages/session/working-directory/src/index.ts:70`](../packages/session/working-directory/src/index.ts)
+- `source`: [`packages/session/working-directory/src/index.ts:65`](../packages/session/working-directory/src/index.ts)
```ts config-catalog
/** Deployment default for Sessions without an original project directory. */
diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md
index 51d86a27b8..db152b0c77 100644
--- a/docs/config-catalog.zh.md
+++ b/docs/config-catalog.zh.md
@@ -1184,7 +1184,7 @@ export interface CotTranslationPreferences {
## `@deepseek-ai/dsh-experimental-client-ui-forge`
- `inject`: `forge` · `forgeSession` · `sessionProjections` · `workingDirectory` · `fs` · `subprocess` · `sandbox` · `sandboxPolicy` · `agents`
-- `source`: [`packages/experimental/client-ui-forge/src/types.ts:483`](../packages/experimental/client-ui-forge/src/types.ts)
+- `source`: [`packages/experimental/client-ui-forge/src/types.ts:485`](../packages/experimental/client-ui-forge/src/types.ts)
```ts config-catalog
/** Host settings of the forge panel Remote. */
@@ -1272,7 +1272,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge`
-- `source`: [`packages/experimental/forge/src/types.ts:603`](../packages/experimental/forge/src/types.ts)
+- `source`: [`packages/experimental/forge/src/types.ts:638`](../packages/experimental/forge/src/types.ts)
```ts config-catalog
/** Poll cadence and fetch deadline for watched change requests. */
@@ -1295,7 +1295,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge-github`
- `inject`: `forge`
-- `source`: [`packages/experimental/forge-github/src/index.ts:14`](../packages/experimental/forge-github/src/index.ts)
+- `source`: [`packages/experimental/forge-github/src/index.ts:19`](../packages/experimental/forge-github/src/index.ts)
```ts config-catalog
/** GitHub CLI executable, served hosts, and invocation limits. */
@@ -1327,7 +1327,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-forge-session`
- `inject`: `forge` · `sessions` · `sessionProjections`
-- `source`: [`packages/experimental/forge-session/src/types.ts:91`](../packages/experimental/forge-session/src/types.ts)
+- `source`: [`packages/experimental/forge-session/src/types.ts:160`](../packages/experimental/forge-session/src/types.ts)
```ts config-catalog
/** Deployment settings of `forgeSession`. */
@@ -1631,6 +1631,39 @@ export interface Config {
```
+
+
+
+## `@deepseek-ai/dsh-forge-gitlab`
+
+- `inject`: `forge`
+- `source`: [`packages/experimental/forge-gitlab/src/index.ts:19`](../packages/experimental/forge-gitlab/src/index.ts)
+
+```ts config-catalog
+/** GitLab CLI executable, served hosts, and read limits. */
+export interface Config {
+ /** GitLab CLI executable name or absolute host path. */
+ glabCommand?: string
+ /** Host names this provider serves; list self-managed GitLab hosts explicitly. */
+ hosts?: string[]
+ /** Deadline in milliseconds for one `glab` invocation. */
+ timeoutMs?: number
+ /** Maximum captured bytes per `glab` output stream and combined JSON bytes of one complete check read or review read. */
+ maxOutputBytes?: number
+ /** Most review threads one review read returns, which reports itself truncated past it. */
+ maxReviewThreads?: number
+ /** Most commits one merge request commit listing returns, the oldest ones when there are more. */
+ maxCommits?: number
+ /** Most merge requests one status query reads; GitLab refuses a query over its complexity limit, which halves the batch. */
+ statusBatchSize?: number
+ /** Most `glab` processes one status fetch runs at once. */
+ maxConcurrentRequests?: number
+ /** Most bytes of diff version patches kept in memory for the hunks of outdated review threads. */
+ maxCachedVersionBytes?: number
+}
+```
+
+
@@ -5148,7 +5181,7 @@ export interface Config {
## `@deepseek-ai/dsh-working-directory`
- `inject`: `fs` · `sessionProjections` · `systemPrompt`
-- `source`: [`packages/session/working-directory/src/index.ts:70`](../packages/session/working-directory/src/index.ts)
+- `source`: [`packages/session/working-directory/src/index.ts:65`](../packages/session/working-directory/src/index.ts)
```ts config-catalog
/** Deployment default for Sessions without an original project directory. */
diff --git a/docs/event-producer-consumer.md b/docs/event-producer-consumer.md
index 7dfebc32a9..d849aba804 100644
--- a/docs/event-producer-consumer.md
+++ b/docs/event-producer-consumer.md
@@ -47,8 +47,8 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
| `deepseek-account/signed-out` | `emit` | [`packages/credentials/deepseek-account/src/index.ts:29`](../packages/credentials/deepseek-account/src/index.ts) | [`deepseek-account`](../packages/credentials/deepseek-account) (`emit`) | [`deepseek-account`](../packages/credentials/deepseek-account) |
| `domain/changed` | `emit` | [`packages/storage/storage-domain/src/events.ts:46`](../packages/storage/storage-domain/src/events.ts) | [`storage-domain`](../packages/storage/storage-domain) (`emit`) | `workspace-controller` |
| `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) |
-| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:30`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
-| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:39`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
+| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:31`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
+| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:40`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` |
@@ -104,7 +104,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
| `workflow/log` | `emit` | [`packages/workflow/workflow/src/index.ts:58`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow) |
| `workflow/phase` | `emit` | [`packages/workflow/workflow/src/index.ts:51`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow) |
| `workflow/start` | `emit` | [`packages/workflow/workflow/src/index.ts:43`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | - |
-| `working-directory/access` | `waterfall` | [`packages/session/working-directory/src/index.ts:32`](../packages/session/working-directory/src/index.ts) | [`working-directory`](../packages/session/working-directory) (`waterfall`) | `worktree` |
+| `working-directory/access` | `waterfall` | [`packages/session/working-directory/src/index.ts:34`](../packages/session/working-directory/src/index.ts) | [`working-directory`](../packages/session/working-directory) (`waterfall`) | `worktree` |
| `workspace/session-activity` | `waterfall` | [`packages/workspace/workspace/src/index.ts:130`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`waterfall`) | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent) |
| `workspace/session-archived` | `parallel` | [`packages/workspace/workspace/src/index.ts:157`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`parallel`) | `worktree` |
| `workspace/session-stop` | `parallel` | [`packages/workspace/workspace/src/index.ts:148`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`parallel`) | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent) |
diff --git a/docs/event-producer-consumer.zh.md b/docs/event-producer-consumer.zh.md
index 2e854a66dd..fc1caa1aec 100644
--- a/docs/event-producer-consumer.zh.md
+++ b/docs/event-producer-consumer.zh.md
@@ -49,8 +49,8 @@
| `deepseek-account/signed-out` | `emit` | [`packages/credentials/deepseek-account/src/index.ts:29`](../packages/credentials/deepseek-account/src/index.ts) | [`deepseek-account`](../packages/credentials/deepseek-account) (`emit`) | [`deepseek-account`](../packages/credentials/deepseek-account) |
| `domain/changed` | `emit` | [`packages/storage/storage-domain/src/events.ts:46`](../packages/storage/storage-domain/src/events.ts) | [`storage-domain`](../packages/storage/storage-domain) (`emit`) | `workspace-controller` |
| `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) |
-| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:30`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
-| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:39`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
+| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:31`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
+| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:40`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` |
@@ -106,7 +106,7 @@
| `workflow/log` | `emit` | [`packages/workflow/workflow/src/index.ts:58`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow) |
| `workflow/phase` | `emit` | [`packages/workflow/workflow/src/index.ts:51`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | [`tool-workflow`](../packages/workflow/tool-workflow) |
| `workflow/start` | `emit` | [`packages/workflow/workflow/src/index.ts:43`](../packages/workflow/workflow/src/index.ts) | [`workflow`](../packages/workflow/workflow) (`events.dispatch`) | - |
-| `working-directory/access` | `waterfall` | [`packages/session/working-directory/src/index.ts:32`](../packages/session/working-directory/src/index.ts) | [`working-directory`](../packages/session/working-directory) (`waterfall`) | `worktree` |
+| `working-directory/access` | `waterfall` | [`packages/session/working-directory/src/index.ts:34`](../packages/session/working-directory/src/index.ts) | [`working-directory`](../packages/session/working-directory) (`waterfall`) | `worktree` |
| `workspace/session-activity` | `waterfall` | [`packages/workspace/workspace/src/index.ts:130`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`waterfall`) | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent) |
| `workspace/session-archived` | `parallel` | [`packages/workspace/workspace/src/index.ts:157`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`parallel`) | `worktree` |
| `workspace/session-stop` | `parallel` | [`packages/workspace/workspace/src/index.ts:148`](../packages/workspace/workspace/src/index.ts) | [`workspace`](../packages/workspace/workspace) (`parallel`) | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent) |
diff --git a/docs/module-graph.md b/docs/module-graph.md
index b9803f617c..ec7e6d6328 100644
--- a/docs/module-graph.md
+++ b/docs/module-graph.md
@@ -312,6 +312,7 @@ flowchart TD
pkg_experimental_webworker_packer["experimental-webworker-packer"]
pkg_experimental_webworker_runtime["experimental-webworker-runtime"]
pkg_experimental_worktree["experimental-worktree"]
+ pkg_forge_gitlab["forge-gitlab"]
pkg_hook_protocol["hook-protocol"]
pkg_hooks_claude_code["hooks-claude-code"]
pkg_hooks_codex["hooks-codex"]
@@ -536,8 +537,6 @@ flowchart TD
pkg_credentials_local --> pkg_launch_environment
pkg_cua_mcp --> pkg_app_boot
pkg_cua_mcp --> pkg_attachment
- pkg_experimental_forge_github --> pkg_experimental_forge
- pkg_experimental_forge_github --> pkg_subprocess
pkg_experimental_webworker_runtime --> pkg_client_connection
pkg_experimental_webworker_runtime --> pkg_client_modules
pkg_experimental_webworker_runtime --> pkg_host_webserver
@@ -1310,6 +1309,9 @@ flowchart TD
pkg_experimental_claude_code_mods --> pkg_typert_protocol
pkg_experimental_claude_code_mods --> pkg_user_questions
pkg_experimental_claude_code_mods --> pkg_working_directory
+ pkg_experimental_forge_github --> pkg_experimental_forge
+ pkg_experimental_forge_github --> pkg_experimental_forge_session
+ pkg_experimental_forge_github --> pkg_subprocess
pkg_experimental_worktree --> pkg_agent
pkg_experimental_worktree --> pkg_error
pkg_experimental_worktree --> pkg_fs
@@ -1323,6 +1325,9 @@ flowchart TD
pkg_experimental_worktree --> pkg_subprocess
pkg_experimental_worktree --> pkg_working_directory
pkg_experimental_worktree --> pkg_workspace
+ pkg_forge_gitlab --> pkg_experimental_forge
+ pkg_forge_gitlab --> pkg_experimental_forge_session
+ pkg_forge_gitlab --> pkg_subprocess
pkg_tool_session_query --> pkg_agent
pkg_tool_session_query --> pkg_llm
pkg_tool_session_query --> pkg_session
@@ -1755,7 +1760,6 @@ flowchart TD
| [`authorization`](../packages/credentials/authorization) | `credentials` | [`credentials`](../packages/credentials/credentials), [`llm`](../packages/llm/llm) |
| [`credentials-local`](../packages/credentials/credentials-local) | `credentials` | [`atomic-write`](../packages/util/atomic-write), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`launch-environment`](../packages/util/launch-environment) |
| [`cua-mcp`](../packages/experimental/cua-mcp) | `experimental` | [`app-boot`](../packages/boot/app-boot), [`attachment`](../packages/attachment/attachment) |
-| [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`subprocess`](../packages/subprocess/subprocess) |
| [`experimental-webworker-runtime`](../packages/experimental/webworker-runtime) | `experimental` | [`client-connection`](../packages/client/connection), [`client-modules`](../packages/client/modules), [`host-webserver`](../packages/host/webserver) |
| [`host-authentication-desktop`](../packages/host/authentication-desktop) | `host` | [`client-connection`](../packages/client/connection) |
| [`host-authentication-token`](../packages/host/authentication-token) | `host` | [`client-connection`](../packages/client/connection), [`host-webserver`](../packages/host/webserver) |
@@ -1924,7 +1928,9 @@ flowchart TD
| [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | `compaction` | [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) |
| [`experimental-browser-use-runtime`](../packages/experimental/browser-use-runtime) | `experimental` | [`agent`](../packages/core/agent), [`browser-use`](../packages/browser-use/browser-use), [`error`](../packages/util/error), [`mcp-client`](../packages/mcp/mcp-client), [`scope`](../packages/core/scope), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) |
| [`experimental-claude-code-mods`](../packages/experimental/claude-code-mods) | `experimental` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`storage-domain`](../packages/storage/storage-domain), [`subprocess`](../packages/subprocess/subprocess), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
+| [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-forge-session`](../packages/experimental/forge-session), [`subprocess`](../packages/subprocess/subprocess) |
| [`experimental-worktree`](../packages/experimental/worktree) | `experimental` | [`agent`](../packages/core/agent), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`settings`](../packages/settings/settings), [`subprocess`](../packages/subprocess/subprocess), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
+| [`forge-gitlab`](../packages/experimental/forge-gitlab) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-forge-session`](../packages/experimental/forge-session), [`subprocess`](../packages/subprocess/subprocess) |
| [`tool-session-query`](../packages/experimental/tool-session-query) | `experimental` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) |
| [`webhook-github`](../packages/experimental/webhook-github) | `experimental` | [`credentials`](../packages/credentials/credentials), [`host-webserver`](../packages/host/webserver), [`session`](../packages/core/session), [`webhook`](../packages/experimental/webhook) |
| [`mcp-manager`](../packages/mcp/mcp-manager) | `mcp` | [`mcp-client`](../packages/mcp/mcp-client), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-values`](../packages/util/values) |
diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md
index 33d40c2f7b..18b5f97bf0 100644
--- a/docs/module-graph.zh.md
+++ b/docs/module-graph.zh.md
@@ -314,6 +314,7 @@ flowchart TD
pkg_experimental_webworker_packer["experimental-webworker-packer"]
pkg_experimental_webworker_runtime["experimental-webworker-runtime"]
pkg_experimental_worktree["experimental-worktree"]
+ pkg_forge_gitlab["forge-gitlab"]
pkg_hook_protocol["hook-protocol"]
pkg_hooks_claude_code["hooks-claude-code"]
pkg_hooks_codex["hooks-codex"]
@@ -538,8 +539,6 @@ flowchart TD
pkg_credentials_local --> pkg_launch_environment
pkg_cua_mcp --> pkg_app_boot
pkg_cua_mcp --> pkg_attachment
- pkg_experimental_forge_github --> pkg_experimental_forge
- pkg_experimental_forge_github --> pkg_subprocess
pkg_experimental_webworker_runtime --> pkg_client_connection
pkg_experimental_webworker_runtime --> pkg_client_modules
pkg_experimental_webworker_runtime --> pkg_host_webserver
@@ -1312,6 +1311,9 @@ flowchart TD
pkg_experimental_claude_code_mods --> pkg_typert_protocol
pkg_experimental_claude_code_mods --> pkg_user_questions
pkg_experimental_claude_code_mods --> pkg_working_directory
+ pkg_experimental_forge_github --> pkg_experimental_forge
+ pkg_experimental_forge_github --> pkg_experimental_forge_session
+ pkg_experimental_forge_github --> pkg_subprocess
pkg_experimental_worktree --> pkg_agent
pkg_experimental_worktree --> pkg_error
pkg_experimental_worktree --> pkg_fs
@@ -1325,6 +1327,9 @@ flowchart TD
pkg_experimental_worktree --> pkg_subprocess
pkg_experimental_worktree --> pkg_working_directory
pkg_experimental_worktree --> pkg_workspace
+ pkg_forge_gitlab --> pkg_experimental_forge
+ pkg_forge_gitlab --> pkg_experimental_forge_session
+ pkg_forge_gitlab --> pkg_subprocess
pkg_tool_session_query --> pkg_agent
pkg_tool_session_query --> pkg_llm
pkg_tool_session_query --> pkg_session
@@ -1757,7 +1762,6 @@ flowchart TD
| [`authorization`](../packages/credentials/authorization) | `credentials` | [`credentials`](../packages/credentials/credentials), [`llm`](../packages/llm/llm) |
| [`credentials-local`](../packages/credentials/credentials-local) | `credentials` | [`atomic-write`](../packages/util/atomic-write), [`credentials`](../packages/credentials/credentials), [`home-paths`](../packages/util/home-paths), [`launch-environment`](../packages/util/launch-environment) |
| [`cua-mcp`](../packages/experimental/cua-mcp) | `experimental` | [`app-boot`](../packages/boot/app-boot), [`attachment`](../packages/attachment/attachment) |
-| [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`subprocess`](../packages/subprocess/subprocess) |
| [`experimental-webworker-runtime`](../packages/experimental/webworker-runtime) | `experimental` | [`client-connection`](../packages/client/connection), [`client-modules`](../packages/client/modules), [`host-webserver`](../packages/host/webserver) |
| [`host-authentication-desktop`](../packages/host/authentication-desktop) | `host` | [`client-connection`](../packages/client/connection) |
| [`host-authentication-token`](../packages/host/authentication-token) | `host` | [`client-connection`](../packages/client/connection), [`host-webserver`](../packages/host/webserver) |
@@ -1926,7 +1930,9 @@ flowchart TD
| [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | `compaction` | [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) |
| [`experimental-browser-use-runtime`](../packages/experimental/browser-use-runtime) | `experimental` | [`agent`](../packages/core/agent), [`browser-use`](../packages/browser-use/browser-use), [`error`](../packages/util/error), [`mcp-client`](../packages/mcp/mcp-client), [`scope`](../packages/core/scope), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) |
| [`experimental-claude-code-mods`](../packages/experimental/claude-code-mods) | `experimental` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`storage-domain`](../packages/storage/storage-domain), [`subprocess`](../packages/subprocess/subprocess), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
+| [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-forge-session`](../packages/experimental/forge-session), [`subprocess`](../packages/subprocess/subprocess) |
| [`experimental-worktree`](../packages/experimental/worktree) | `experimental` | [`agent`](../packages/core/agent), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`settings`](../packages/settings/settings), [`subprocess`](../packages/subprocess/subprocess), [`working-directory`](../packages/session/working-directory), [`workspace`](../packages/workspace/workspace) |
+| [`forge-gitlab`](../packages/experimental/forge-gitlab) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-forge-session`](../packages/experimental/forge-session), [`subprocess`](../packages/subprocess/subprocess) |
| [`tool-session-query`](../packages/experimental/tool-session-query) | `experimental` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) |
| [`webhook-github`](../packages/experimental/webhook-github) | `experimental` | [`credentials`](../packages/credentials/credentials), [`host-webserver`](../packages/host/webserver), [`session`](../packages/core/session), [`webhook`](../packages/experimental/webhook) |
| [`mcp-manager`](../packages/mcp/mcp-manager) | `mcp` | [`mcp-client`](../packages/mcp/mcp-client), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-values`](../packages/util/values) |
diff --git a/docs/persistence-catalog.i18n.yaml b/docs/persistence-catalog.i18n.yaml
index 5d779194c7..48ac05c91d 100644
--- a/docs/persistence-catalog.i18n.yaml
+++ b/docs/persistence-catalog.i18n.yaml
@@ -300,8 +300,8 @@
en: e8dd0cebbb930eb7
zh: e8dd0cebbb930eb7
/session-persistence-event-catalog/events/working-directory/working-directory-change-log-only:
- en: 27f0761cbdd6fe2f
- zh: 33528f333498132d
+ en: fbdf3777f155f458
+ zh: 98dc9a9351c07415
/session-persistence-event-catalog/events/workspace:
en: 63ee1a85e4b59ae3
zh: 63ee1a85e4b59ae3
@@ -1497,8 +1497,8 @@
en: bef51e0442ebb903
zh: 240ebeb160533d8c
/session-persistence-event-catalog/resolved-persistence-types/cwd:
- en: 2809c921c6996791
- zh: 80b15177561766d7
+ en: 6a6f06c1421739c3
+ zh: 0e28ae71c2e84a1d
/session-persistence-event-catalog/resolved-persistence-types/decision-durationms-exitcode-handlerid:
en: a99ac57bbec0370f
zh: 9073329e324a66e0
@@ -1935,8 +1935,8 @@
en: c6e1e91281b3f9c2
zh: 33225e83b0bd8cff
/session-persistence-event-catalog/resolved-persistence-types/kind-working-directory:
- en: b28ca6b37f5a338d
- zh: 4c4f2f05721b8b62
+ en: f688f9a75f549c23
+ zh: 03ccb103398fc27b
/session-persistence-event-catalog/resolved-persistence-types/max-tokens-messages-model-thinking:
en: 3216b23c131d0070
zh: 73ca171c6014f16e
diff --git a/docs/persistence-catalog.md b/docs/persistence-catalog.md
index 7def108a38..2bb9fbbc0b 100644
--- a/docs/persistence-catalog.md
+++ b/docs/persistence-catalog.md
@@ -1329,7 +1329,7 @@ Source: [`packages/web/web-search-deepseek/src/provider.ts:89`](../packages/web/
}
```
-Source: [`packages/session/working-directory/src/index.ts:55`](../packages/session/working-directory/src/index.ts)
+Source: [`packages/session/working-directory/src/index.ts:57`](../packages/session/working-directory/src/index.ts)
### `workspace/*`
@@ -6216,7 +6216,7 @@ Sources: [`packages/compaction/compaction/src/types.ts:24`](../packages/compacti
SHA-256: `da60ed58a8fa23d7aa4920ab5c1f4e3d28109cb0797ef9e5c8b125721b847582`
-Sources: [`packages/session/working-directory/src/index.ts:55`](../packages/session/working-directory/src/index.ts)
+Sources: [`packages/session/working-directory/src/index.ts:57`](../packages/session/working-directory/src/index.ts)
| Property | Presence | Type |
|---|---|---|
@@ -7970,7 +7970,7 @@ Sources: [`packages/experimental/webhook/src/types.ts:75`](../packages/experimen
SHA-256: `2235d957bf4b7c6cf959231d480f0ba1f3a6d72d82981493fb6c7c963021d3d5`
-Sources: [`packages/session/working-directory/src/index.ts:48`](../packages/session/working-directory/src/index.ts)
+Sources: [`packages/session/working-directory/src/index.ts:50`](../packages/session/working-directory/src/index.ts)
| Property | Presence | Type |
|---|---|---|
diff --git a/docs/persistence-catalog.zh.md b/docs/persistence-catalog.zh.md
index ef9da5e74e..38c7939c3e 100644
--- a/docs/persistence-catalog.zh.md
+++ b/docs/persistence-catalog.zh.md
@@ -1331,7 +1331,7 @@ export type SessionEvent = {
}
```
-来源:[`packages/session/working-directory/src/index.ts:55`](../packages/session/working-directory/src/index.ts)
+来源:[`packages/session/working-directory/src/index.ts:57`](../packages/session/working-directory/src/index.ts)
### `workspace/*`
@@ -6218,7 +6218,7 @@ SHA-256: `3e4e7683b0192c9f0e6a75c59076108f017892cdb302a98032c2632fd79c356f`
SHA-256: `da60ed58a8fa23d7aa4920ab5c1f4e3d28109cb0797ef9e5c8b125721b847582`
-来源:[`packages/session/working-directory/src/index.ts:55`](../packages/session/working-directory/src/index.ts)
+来源:[`packages/session/working-directory/src/index.ts:57`](../packages/session/working-directory/src/index.ts)
| 属性 | 存在性 | 类型 |
|---|---|---|
@@ -7972,7 +7972,7 @@ SHA-256: `9edc162949abf93bd5ff049191b345454ba104f583937ce5580fb50f067d2b94`
SHA-256: `2235d957bf4b7c6cf959231d480f0ba1f3a6d72d82981493fb6c7c963021d3d5`
-来源:[`packages/session/working-directory/src/index.ts:48`](../packages/session/working-directory/src/index.ts)
+来源:[`packages/session/working-directory/src/index.ts:50`](../packages/session/working-directory/src/index.ts)
| 属性 | 存在性 | 类型 |
|---|---|---|
diff --git a/docs/persistence-schema.json b/docs/persistence-schema.json
index de6119883d..2339b21492 100644
--- a/docs/persistence-schema.json
+++ b/docs/persistence-schema.json
@@ -161,7 +161,7 @@
{"digest":"2142e391b9ccb60d487afcf373ce74db98d952f69e8289eddb352a7e16e996c5","names":[],"sources":[]},
{"digest":"2152caf1a71e588e4df2358a806dea24936c1c47131134f01a12939d12cdc0c0","names":["packages/team/agent-team/src/types.ts#TeamMessageSource"],"sources":["packages/team/agent-team/src/types.ts:121"]},
{"digest":"21fb6a90d5068f6a0003b7ab316ed2f56342477146a65c00db0f13c4d8df667d","names":[],"sources":[]},
- {"digest":"2235d957bf4b7c6cf959231d480f0ba1f3a6d72d82981493fb6c7c963021d3d5","names":[],"sources":["packages/session/working-directory/src/index.ts:48"]},
+ {"digest":"2235d957bf4b7c6cf959231d480f0ba1f3a6d72d82981493fb6c7c963021d3d5","names":[],"sources":["packages/session/working-directory/src/index.ts:50"]},
{"digest":"224aa11d4d5f88c450822d01b99e6ca5e3a9c7f26a5ede10bae33384a09ef4dc","names":[],"sources":[]},
{"digest":"234142ee4f996f38cc9fa3b8b3e3de29b03c9aefe5ebf6c224eddd564505aa85","names":[],"sources":[]},
{"digest":"237c004c73b6b288246816e0d7fde16e09c63a47aa3b1227383d7afe58666163","names":[],"sources":[]},
@@ -608,7 +608,7 @@
{"digest":"d9196086e41e4dd5c2ce87f5c25529c8112a1731d258cf0728747d41a9ee3241","names":[],"sources":[]},
{"digest":"d9c462b9f62fdd3efc76a44b9524dc8781f6b91cd9c7e584b17d971defafebab","names":["packages/llm/llm/src/message.ts#ToolMessageSource"],"sources":["packages/llm/llm/src/message.ts:28"]},
{"digest":"d9edf1862e4471d6ad8a106a3f4160e0643874368707d50ecd8e27e5ee7a2567","names":[],"sources":[]},
- {"digest":"da60ed58a8fa23d7aa4920ab5c1f4e3d28109cb0797ef9e5c8b125721b847582","names":[],"sources":["packages/session/working-directory/src/index.ts:55"]},
+ {"digest":"da60ed58a8fa23d7aa4920ab5c1f4e3d28109cb0797ef9e5c8b125721b847582","names":[],"sources":["packages/session/working-directory/src/index.ts:57"]},
{"digest":"dacf3d5f3e4ff619c1320e64a48dec5e7ecd7870bece65fbd449a0e63adfa521","names":[],"sources":[]},
{"digest":"db06ef35b27a38425046b2228fa6bce9582abe140d781d363137eb2f4d233a1c","names":[],"sources":[]},
{"digest":"db6c5246911d47a7969f6b4cb47c7d0dbbde75c402710b22ace3672fa97bebe0","names":[],"sources":[]},
diff --git a/docs/subsystems/forge.i18n.yaml b/docs/subsystems/forge.i18n.yaml
index d8461f092c..0d87e8fc0b 100644
--- a/docs/subsystems/forge.i18n.yaml
+++ b/docs/subsystems/forge.i18n.yaml
@@ -3,11 +3,11 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/forge.md
/forges:
- en: 3990a17e12c66a23
- zh: 4170c33e49248f8f
+ en: 37c9cbfb3141702b
+ zh: c5fcbb7f4fda1dbc
/forges/providers-and-change-requests:
- en: e5d807b29f553751
- zh: e0b25d9e964f988e
+ en: 8df1bf8a6d294252
+ zh: 79ba96596739569f
/forges/status-polling:
en: 26ccfa2e342e3e67
zh: fe6cc2a622757c48
@@ -15,14 +15,14 @@
en: ae735fbdbdf2d870
zh: 9903fcc571104ad8
/forges/review-threads:
- en: af729af6e59e915f
- zh: 1b7d7671ec36a5b2
+ en: 6a4162560b1aa158
+ zh: 5349e9f25d08fd97
/forges/overview-and-viewed-marks:
en: fd5928603c9375b1
zh: 1a3bca55344ff385
/forges/session-bindings:
- en: 13dfd36f2166bba0
- zh: a369434f52f04d57
+ en: 74255d6005e1c9e8
+ zh: 252d0d552f1e26a1
/forges/panel:
en: 7dcefe2825490257
zh: 38cec4d1ae3b0d6e
diff --git a/docs/subsystems/forge.md b/docs/subsystems/forge.md
index cc8922729a..5f03e70c8e 100644
--- a/docs/subsystems/forge.md
+++ b/docs/subsystems/forge.md
@@ -2,11 +2,11 @@
English | [中文](forge.zh.md)
-The experimental forge capability seam reads change requests, meaning pull requests and merge requests, from code hosts. [`dsh-experimental-forge`](../../packages/experimental/forge/README.md) is the Service Definition and provides `ctx.forge`; [`dsh-experimental-forge-github`](../../packages/experimental/forge-github/README.md) is the Service Provider for GitHub hosts; [`dsh-experimental-forge-session`](../../packages/experimental/forge-session/README.md) is the Consumer that binds change requests to Sessions and provides `ctx.forgeSession`; [`dsh-experimental-client-ui-forge`](../../packages/experimental/client-ui-forge/README.md) is the GUI Consumer that provides `ctx.forgePanel`. The default-disabled [forge bundle](../../packages/experimental/forge-bundle/README.md) composes all four, with the [worktree model tool](../../packages/experimental/tool-worktree/README.md) and one shared [worktree service](../../packages/experimental/worktree/README.md), from the Plugins page; otherwise they load only through explicit composition.
+The experimental forge capability seam reads change requests, meaning pull requests and merge requests, from code hosts. [`dsh-experimental-forge`](../../packages/experimental/forge/README.md) is the Service Definition and provides `ctx.forge`; [`dsh-experimental-forge-github`](../../packages/experimental/forge-github/README.md) and [`dsh-forge-gitlab`](../../packages/experimental/forge-gitlab/README.md) are the Service Providers for GitHub and GitLab hosts; [`dsh-experimental-forge-session`](../../packages/experimental/forge-session/README.md) is the Consumer that binds change requests to Sessions and provides `ctx.forgeSession`; [`dsh-experimental-client-ui-forge`](../../packages/experimental/client-ui-forge/README.md) is the GUI Consumer that provides `ctx.forgePanel`. The default-disabled [forge bundle](../../packages/experimental/forge-bundle/README.md) composes all five, with the [worktree model tool](../../packages/experimental/tool-worktree/README.md) and one shared [worktree service](../../packages/experimental/worktree/README.md), from the Plugins page; otherwise they load only through explicit composition.
## Providers and change requests
-A provider serves one forge family, such as `github`. It maps Git remote URLs to repositories and change request URLs to references, builds canonical change request URLs, finds open change requests by head branch, and reads status in batches. `changeRequestKey` derives one case-insensitive key from a reference, so watchers of differently spelled URLs share one polling loop.
+A provider serves one forge family, such as `github`, on the hosts it lists in `hosts`; no two registered providers may list the same host, so each remote and change request URL has at most one provider. It maps Git remote URLs to repositories and change request URLs to references, builds canonical change request URLs, finds open change requests by head branch, and reads status in batches. `changeRequestKey` derives one case-insensitive key from a reference, so watchers of differently spelled URLs share one polling loop.
```ts type-equiv
/** One repository on a code host, identified the way its provider addresses it. */
@@ -40,11 +40,20 @@ type ChangeRequestKey = Branded<'ChangeRequestKey'>
```ts type-equiv
/**
* Host-specific access registered with `ctx.forge`. One provider serves one
- * forge family; methods that take a signal must stop work when it aborts.
+ * forge family on the hosts it lists; methods that take a signal must stop work when it aborts.
*/
interface ForgeProvider {
/** Forge family name stored in every repository this provider returns. */
readonly forge: string
+ /**
+ * Lowercase host names this provider serves, such as `github.com`; `repositoryFromRemote` and `changeRequestFromUrl`
+ * return only these hosts, and no other registered provider may list one of them.
+ */
+ readonly hosts: readonly string[]
+ /** Product name readers know this provider's hosts by, such as `GitHub`. */
+ readonly label: string
+ /** What this provider's hosts call a change request. */
+ readonly changeRequestNoun: ChangeRequestNoun
/** Publish a comment or completed review. Omission declares that this provider cannot write reviews. */
submitReview?(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise
/**
@@ -135,8 +144,10 @@ interface ForgeProvider {
reviewerCandidates?(ref: ChangeRequestRef, query: string, signal: AbortSignal): Promise
/**
* Bring the base branch's new commits into the head branch while its head is still `request.headSha`, resolving to
- * undefined once the host accepted the update. Omission declares that the provider updates no branches, and its
- * snapshots then offer no `branchUpdates`.
+ * undefined once the host accepted the update. A host whose update names the expected head checks it with the update;
+ * for one whose update cannot, the provider reads the head just before it, so a push between the read and the update
+ * is updated too. Omission declares that the provider updates no branches, and its snapshots then offer no
+ * `branchUpdates`.
*/
updateBranch?(ref: ChangeRequestRef, request: BranchUpdateRequest, signal: AbortSignal): Promise
}
@@ -179,6 +190,27 @@ interface ForgeReadiness {
readonly state: 'ready' | 'unauthenticated' | 'unavailable'
/** Human-readable detail, or null when ready. */
readonly message: string | null
+ /** Shell command the user runs on the host to sign in, while `unauthenticated`; null otherwise or when the provider names none. */
+ readonly signIn: { readonly command: string } | null
+}
+```
+
+`ctx.forge.describe(forge)` names a registered family with the `label` and `changeRequestNoun` its provider declares, so readers can call the code host and its change requests what the host calls them.
+
+```ts type-equiv
+/** What the hosts of a forge family call a change request. */
+type ChangeRequestNoun = 'pull-request' | 'merge-request'
+```
+
+```ts type-equiv
+/** How readers name a forge family and its change requests. */
+interface ForgeDescription {
+ /** Forge family name, such as `github`. */
+ readonly forge: string
+ /** Product name readers know the family's hosts by, such as `GitHub`. */
+ readonly label: string
+ /** What the family's hosts call a change request. */
+ readonly changeRequestNoun: ChangeRequestNoun
}
```
@@ -411,7 +443,7 @@ type ForgeReviewResult =
## Review threads
-`ctx.forge.readReview(ref, headSha, signal)` reads the review threads of a change request at one head commit. The provider returns `ForgeReviewData` only when the read names `headSha` as the head; otherwise it returns `stale`, which polls a watched change request again at once, as a stale diff read does. For a provider without `readReview` the service returns `unsupported`, so consumers show no threads instead of a failure. A line thread has two positions: `original` on the commit it was written on, and `current` on the head of the read, which is null once the host no longer places the thread on that commit. A consumer that shows the head's diff places a thread at `current` and shows the others with their `diffHunk`; reading the file at `original.commit` through `fileText` shows the whole file the thread was written on. The [GitHub provider README](../../packages/experimental/forge-github/README.md#use-this-package) owns how GitHub's fields map onto these positions.
+`ctx.forge.readReview(ref, headSha, signal)` reads the review threads of a change request at one head commit. The provider returns `ForgeReviewData` only when the read names `headSha` as the head; otherwise it returns `stale`, which polls a watched change request again at once, as a stale diff read does. For a provider without `readReview` the service returns `unsupported`, so consumers show no threads instead of a failure. A line thread has two positions: `original` on the commit it was written on, and `current` on the head of the read, which is null once the host no longer places the thread on that commit. A consumer that shows the head's diff places a thread at `current` and shows the others with their `diffHunk`; reading the file at `original.commit` through `fileText` shows the whole file the thread was written on. The [GitHub provider README](../../packages/experimental/forge-github/README.md#use-this-package) and the [GitLab provider README](../../packages/experimental/forge-gitlab/README.md#use-this-package) own how each host's fields map onto these positions; GitLab keeps only the last position a thread's lines were unchanged at, which becomes its `original`.
```ts type-equiv
/** Opaque host identity of one review thread. */
@@ -474,9 +506,9 @@ interface ForgeReviewComment {
```ts type-equiv
/**
- * One review thread on a file of a change request. A line thread has two positions: `original` on the commit it was
- * written on, and `current` on the head commit of the read. `current` is null once the host no longer places the
- * thread on the head commit, as after later commits changed its lines.
+ * One review thread on a file of a change request. A line thread has two positions: `original` on a commit whose file
+ * holds the thread's lines as they were written, and `current` on the head commit of the read. `current` is null once
+ * the host no longer places the thread on the head commit, as after later commits changed its lines.
*/
interface ForgeReviewThread {
/** Host identity of the thread. */
@@ -489,7 +521,11 @@ interface ForgeReviewThread {
readonly subject: 'line' | 'file'
/** Lines in the diff that ends at the head commit of the read, whose `commit` is that head; null for an outdated or file thread. */
readonly current: ForgeAnchor | null
- /** Lines in the diff that ended at the commit the thread was written on; null for a file thread. */
+ /**
+ * Lines in the diff that ended at a commit whose file holds the lines as the thread was written on them: the commit
+ * the thread was written on, or a later one the host carried the thread to while the lines stayed unchanged; null for
+ * a file thread.
+ */
readonly original: ForgeAnchor | null
/** Diff hunk the host recorded when the thread was written, ending at its last line; null when it recorded none. */
readonly diffHunk: string | null
@@ -525,6 +561,11 @@ interface ForgeReviewData {
* false for a provider without it.
*/
readonly viewerCanReview: boolean
+ /**
+ * Decisions the host lets the signed-in user record in a submitted review of this change request, such as only
+ * `comment` on their own pull request on GitHub; empty when `viewerCanReview` is false.
+ */
+ readonly reviewEvents: readonly ForgeReviewEvent[]
}
```
@@ -711,15 +752,14 @@ interface ForgeViewedRequest {
## 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.
+`ctx.forgeSession` derives each Session's bindings from its own log by the command rules that providers register: forge-github's `gh` rule and forge-gitlab's `glab` rule bind the URLs that `gh pr create` and `glab mr create` results print and the change request that `gh pr view`, `glab mr view`, and their sibling reference commands 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.
```ts type-equiv
/**
- * How a change request became bound to a Session: `created` when a
- * `gh pr create` result printed its URL, `referenced` when a `gh pr view`,
- * `gh pr edit`, or `gh pr checkout` call named it or its result printed its
- * own URL, `discovered` when a lookup found it for a branch the Session pushed
- * or works on, `tracked` when a caller bound it by URL.
+ * How a change request became bound to a Session: `created` when the result of a command a registered rule names as a
+ * creation printed its URL, `referenced` when a command a rule names as a reference named it, its result printed its
+ * own URL, or a lookup for it found the URL, `discovered` when a lookup found it for a branch the Session pushed or
+ * works on, `tracked` when a caller bound it by URL.
*/
type BindingOrigin = 'created' | 'referenced' | 'discovered' | 'tracked'
```
@@ -729,7 +769,7 @@ type BindingOrigin = 'created' | 'referenced' | 'discovered' | 'tracked'
interface BindingRecord {
/**
* `track` binds or restores, `dismiss` hides, `discover` binds a branch lookup,
- * and `reference` binds a CLI selector lookup without restoring dismissed entries.
+ * and `reference` binds a command lookup without restoring dismissed entries.
*/
readonly action: 'track' | 'dismiss' | 'discover' | 'reference'
/** Web URL of the change request. */
@@ -759,6 +799,84 @@ interface SessionChangeRequest {
type SessionChangeRequestsListener = (changeRequests: readonly SessionChangeRequest[]) => void
```
+Providers register the commands of their CLI with `registerCommands`; the [Session binding README](../../packages/experimental/forge-session/README.md#use-this-package) owns how the projection folds with them.
+
+```ts type-equiv
+/**
+ * The shell commands of one forge family's CLI that bind change requests to the Session that ran them, registered
+ * with `ctx.forgeSession.registerCommands`. The `forgeChangeRequests` projection folds the Session log with the
+ * recognized rules and folds it again when a registration changes them, so a rule must classify the same input the
+ * same way every time: its members are fixed, and `select` reads only its arguments.
+ */
+interface ForgeCommandRule {
+ /** Stable name of the rule, such as `gh`; no two registered rules share one. */
+ readonly id: string
+ /** Positive integer the registrant raises whenever the rule classifies some command or output differently. */
+ readonly version: number
+ /** Executable word the rule classifies, such as `gh`; no two registered rules share one. */
+ readonly executable: string
+ /** Subcommand word sequences that create a change request and print its URL, such as `['pr', 'create']`. */
+ readonly creates: readonly (readonly string[])[]
+ /** Subcommands that act on one change request, which their words or their output name, such as `['pr', 'view']`. */
+ readonly references: ForgeCommandGroup
+ /**
+ * Subcommands that send a raw API request, such as `['api']`, whose words can name one change request. Their output
+ * is not read, since one request can list many change requests.
+ */
+ readonly apiRequests: ForgeCommandGroup
+ /** Regular expression source matching a change request page path after the repository path, such as `\/pull\/\d+`. */
+ readonly changeRequestPath: string
+ /** JSON member names whose value is the URL of the change request a reference command prints, such as `url`. */
+ readonly urlMembers: readonly string[]
+ /**
+ * Find the change request that one literal reference or API request command names.
+ * @param command - the command's kind, subcommand, operands, and option values.
+ * @param environment - the variables the command assigns before the executable, the last assignment of a name winning.
+ * @returns the change request's URL when the command names its host; a lookup when it names the change request
+ * without one; undefined when it names no change request.
+ */
+ select(command: ForgeCommandArguments, environment: Readonly>): ForgeCommandSelection | undefined
+}
+```
+
+```ts type-equiv
+/** Subcommands of one kind and the options they accept. */
+interface ForgeCommandGroup {
+ /** Subcommand word sequences, such as `['pr', 'view']`; may be empty. */
+ readonly subcommands: readonly (readonly string[])[]
+ /**
+ * Options that take a value: the next word, the text after `=`, or for a one-letter option such as `-R`, the rest of
+ * the word.
+ */
+ readonly valueOptions: readonly string[]
+ /** Options that take no value; a command with any other option names nothing. */
+ readonly flagOptions: readonly string[]
+}
+```
+
+```ts type-equiv
+/** The parsed words of one reference or API request command after its executable. */
+interface ForgeCommandArguments {
+ /** Which group of the rule the subcommand belongs to. */
+ readonly kind: 'reference' | 'api-request'
+ /** The subcommand words, such as `['pr', 'view']`. */
+ readonly subcommand: readonly string[]
+ /** Words after the subcommand that are neither options nor option values. */
+ readonly operands: readonly string[]
+ /** Each value option as written, with its value, in command order. */
+ readonly values: readonly (readonly [option: string, value: string])[]
+}
+```
+
+```ts type-equiv
+/**
+ * The change request one command names: its URL, or a read-only command, starting with the executable, that prints
+ * exactly that URL. forge-session runs a lookup in the shell of the command that named it, with that command's
+ * variable assignments, and only while the command runs; replaying the Session log runs none.
+ */
+type ForgeCommandSelection = { readonly url: string } | { readonly lookup: readonly string[] }
+```
+
## Panel
`ctx.forgePanel` is the Host Remote of the [forge panel](../../packages/experimental/client-ui-forge/README.md#use-this-package). Following a Session streams a `ForgePanelState`: a read-only Git inspection of the Session's current directory in its execution world, the code host recognized from the upstream remote or `origin`, the sign-in state of that host, the Session's bindings with their polled status and last snapshot, and its worktree request. Its actions list base branches, bind and hide URLs, refresh, mark a bound draft ready or merge a bound change request, request or withdraw a worktree, stop a running creation, and restore a removed worktree or leave it for the source checkout. A request is a `plugin:client-ui-forge/worktree` record. When a message enters a Session's inbox while its Agent is idle, the panel holds the message's turn with maintenance of the [Agent](../../packages/core/agent/README.md), started before the delivery wakes the Agent: it creates the worktree of an open request through `ctx.worktrees` and, after a failed or stopped attempt, waits for another attempt or the request's withdrawal; for a Session that works in its created worktree it checks that worktree and, when it is gone, waits until it is restored or left. The panel state names what a message waits for and the last failed attempt. The first step proposal creates the worktree for a message no hold took. Requests after the first turn starts are ignored. Changes to a Session's checkout run as maintenance of its Agent, so a message from another client waits for them.
@@ -932,6 +1050,8 @@ interface ForgePanelWorktree {
```ts type-equiv
/** One bound change request in the panel state. */
interface ForgePanelChangeRequest extends SessionChangeRequest {
+ /** How readers name the change request's code host and its change requests, or null when no provider serves its URL. */
+ readonly forge: ForgeDescription | null
/** Latest snapshot a poll returned, kept while later polls fail, or null before the first successful poll. */
readonly snapshot: ChangeRequestSnapshot | null
/**
@@ -1332,21 +1452,28 @@ Registry of forge providers. Watchers of one change request share a single polli
* fiber. Watches of that forge receive an `unavailable` failure when the
* registration ends. Unregistering cancels and awaits its in-flight calls;
* results from the withdrawn registration are discarded.
- * @param provider - provider to serve `provider.forge`.
+ * @param provider - provider to serve `provider.forge` on `provider.hosts`.
* @returns the disposer that unregisters the provider and waits for its calls to finish.
- * @throws when another provider already serves the same forge.
+ * @throws when another provider already serves the same forge or one of the same hosts, compared without case.
*/
register(provider: ForgeProvider): () => Promise
/**
- * Map a Git remote URL to a repository through the first provider that serves it.
+ * Name a forge family and its change requests for readers.
+ * @param forge - forge family name, such as `github`.
+ * @returns the registered provider's description, or undefined when no provider serves the family.
+ */
+describe(forge: string): ForgeDescription | undefined
+
+/**
+ * Map a Git remote URL to a repository through the provider that serves its host.
* @param url - fetch or push URL as Git reports it.
* @returns the repository, or undefined when no provider serves the URL.
*/
repositoryFromRemote(url: string): ForgeRepository | undefined
/**
- * Map a change request web URL through the first provider that serves it.
+ * Map a change request web URL through the provider that serves its host.
* @param url - web URL of a pull or merge request.
* @returns the change request, or undefined when no provider serves the URL.
*/
@@ -2066,9 +2193,28 @@ 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, 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`.
+Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from the results of the creation and reference commands that forge providers register through `registerCommands`, from `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
+/**
+ * Register the commands of one forge CLI as an effect on the calling fiber.
+ * A rule that changes the recognized rule set re-registers the
+ * `forgeChangeRequests` projection at the new set's state version, so every
+ * Session refolds its log with the new rules when next read, including
+ * commands that ran before the registration, and watchers receive the
+ * refolded bindings. Disposal does not change the recognized set: the rule
+ * keeps recognizing commands until the service restarts or another rule
+ * replaces its id or executable, so unloading a provider, including at
+ * shutdown, leaves the checkpointed state version unchanged. Only live
+ * registrations run reference lookups, so a disposed rule starts no CLI
+ * process; lookups that started before a change finish with the rules they
+ * started with.
+ * @param rule - the CLI's executable, subcommands, change request page path, and selection.
+ * @returns the disposer that ends the registration.
+ * @throws when the rule is malformed, or a live registration has its id or executable.
+ */
+registerCommands(rule: ForgeCommandRule): () => void
+
/**
* List the change requests bound to a Session and not dismissed.
* @param session - Session whose bindings are read.
diff --git a/docs/subsystems/forge.zh.md b/docs/subsystems/forge.zh.md
index 167f4ba646..26baa7de4e 100644
--- a/docs/subsystems/forge.zh.md
+++ b/docs/subsystems/forge.zh.md
@@ -2,11 +2,11 @@
[English](forge.md) | 中文
-实验性的 forge 能力 seam 从代码托管平台读取变更请求(change request,即 pull request 与 merge request)。[`dsh-experimental-forge`](../../packages/experimental/forge/README.zh.md) 是 Service Definition,提供 `ctx.forge`;[`dsh-experimental-forge-github`](../../packages/experimental/forge-github/README.zh.md) 是服务 GitHub 主机的 Service Provider;[`dsh-experimental-forge-session`](../../packages/experimental/forge-session/README.zh.md) 是把变更请求绑定到 Session 的 Consumer,提供 `ctx.forgeSession`;[`dsh-experimental-client-ui-forge`](../../packages/experimental/client-ui-forge/README.zh.md) 是提供 `ctx.forgePanel` 的 GUI Consumer。默认禁用的 [forge Bundle](../../packages/experimental/forge-bundle/README.zh.md) 可从插件页面组合这四个包,同时加载[工作树模型工具](../../packages/experimental/tool-worktree/README.zh.md),并为面板附带一个隔离的 [worktree 服务](../../packages/experimental/worktree/README.zh.md);除此之外,它们只能通过显式组合加载。
+实验性的 forge 能力 seam 从代码托管平台读取变更请求(change request,即 pull request 与 merge request)。[`dsh-experimental-forge`](../../packages/experimental/forge/README.zh.md) 是 Service Definition,提供 `ctx.forge`;[`dsh-experimental-forge-github`](../../packages/experimental/forge-github/README.zh.md) 与 [`dsh-forge-gitlab`](../../packages/experimental/forge-gitlab/README.zh.md) 是服务 GitHub 与 GitLab 主机的 Service Provider;[`dsh-experimental-forge-session`](../../packages/experimental/forge-session/README.zh.md) 是把变更请求绑定到 Session 的 Consumer,提供 `ctx.forgeSession`;[`dsh-experimental-client-ui-forge`](../../packages/experimental/client-ui-forge/README.zh.md) 是提供 `ctx.forgePanel` 的 GUI Consumer。默认禁用的 [forge Bundle](../../packages/experimental/forge-bundle/README.zh.md) 可从插件页面组合这五个包,同时加载[工作树模型工具](../../packages/experimental/tool-worktree/README.zh.md),并为面板附带一个隔离的 [worktree 服务](../../packages/experimental/worktree/README.zh.md);除此之外,它们只能通过显式组合加载。
## 提供方与变更请求
-一个提供方服务一个 forge 家族,例如 `github`。它把 Git 远端 URL 映射为仓库,把变更请求 URL 映射为引用,构造规范的变更请求 URL,按 head 分支查找打开状态的变更请求,并批量读取状态。`changeRequestKey` 从引用派生一个不区分大小写的键,因此 URL 拼写不同的监听方共享同一个轮询循环。
+一个提供方在其 `hosts` 列出的主机上服务一个 forge 家族,例如 `github`;任意两个已注册的提供方不能列出同一主机,因此每个远端和变更请求 URL 至多对应一个提供方。它把 Git 远端 URL 映射为仓库,把变更请求 URL 映射为引用,构造规范的变更请求 URL,按 head 分支查找打开状态的变更请求,并批量读取状态。`changeRequestKey` 从引用派生一个不区分大小写的键,因此 URL 拼写不同的监听方共享同一个轮询循环。
```ts type-equiv
/** One repository on a code host, identified the way its provider addresses it. */
@@ -40,11 +40,20 @@ type ChangeRequestKey = Branded<'ChangeRequestKey'>
```ts type-equiv
/**
* Host-specific access registered with `ctx.forge`. One provider serves one
- * forge family; methods that take a signal must stop work when it aborts.
+ * forge family on the hosts it lists; methods that take a signal must stop work when it aborts.
*/
interface ForgeProvider {
/** Forge family name stored in every repository this provider returns. */
readonly forge: string
+ /**
+ * Lowercase host names this provider serves, such as `github.com`; `repositoryFromRemote` and `changeRequestFromUrl`
+ * return only these hosts, and no other registered provider may list one of them.
+ */
+ readonly hosts: readonly string[]
+ /** Product name readers know this provider's hosts by, such as `GitHub`. */
+ readonly label: string
+ /** What this provider's hosts call a change request. */
+ readonly changeRequestNoun: ChangeRequestNoun
/** Publish a comment or completed review. Omission declares that this provider cannot write reviews. */
submitReview?(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise
/**
@@ -135,8 +144,10 @@ interface ForgeProvider {
reviewerCandidates?(ref: ChangeRequestRef, query: string, signal: AbortSignal): Promise
/**
* Bring the base branch's new commits into the head branch while its head is still `request.headSha`, resolving to
- * undefined once the host accepted the update. Omission declares that the provider updates no branches, and its
- * snapshots then offer no `branchUpdates`.
+ * undefined once the host accepted the update. A host whose update names the expected head checks it with the update;
+ * for one whose update cannot, the provider reads the head just before it, so a push between the read and the update
+ * is updated too. Omission declares that the provider updates no branches, and its snapshots then offer no
+ * `branchUpdates`.
*/
updateBranch?(ref: ChangeRequestRef, request: BranchUpdateRequest, signal: AbortSignal): Promise
}
@@ -179,6 +190,27 @@ interface ForgeReadiness {
readonly state: 'ready' | 'unauthenticated' | 'unavailable'
/** Human-readable detail, or null when ready. */
readonly message: string | null
+ /** Shell command the user runs on the host to sign in, while `unauthenticated`; null otherwise or when the provider names none. */
+ readonly signIn: { readonly command: string } | null
+}
+```
+
+`ctx.forge.describe(forge)` 用已注册家族的提供方声明的 `label` 与 `changeRequestNoun` 称呼该家族,读者因此可以按托管平台自己的叫法称呼平台及其变更请求。
+
+```ts type-equiv
+/** What the hosts of a forge family call a change request. */
+type ChangeRequestNoun = 'pull-request' | 'merge-request'
+```
+
+```ts type-equiv
+/** How readers name a forge family and its change requests. */
+interface ForgeDescription {
+ /** Forge family name, such as `github`. */
+ readonly forge: string
+ /** Product name readers know the family's hosts by, such as `GitHub`. */
+ readonly label: string
+ /** What the family's hosts call a change request. */
+ readonly changeRequestNoun: ChangeRequestNoun
}
```
@@ -411,7 +443,7 @@ type ForgeReviewResult =
## 评审讨论
-`ctx.forge.readReview(ref, headSha, signal)` 读取变更请求在某个 head 提交处的评审讨论。只有当读取时的 head 就是 `headSha` 时,提供方才返回 `ForgeReviewData`;否则返回 `stale`,并像 diff 读取遇到 `stale` 时一样,立即重新轮询被关注的变更请求。提供方没有实现 `readReview` 时,服务返回 `unsupported`,使用方据此不显示讨论,也不报错。行级讨论有两套位置:`original` 是写下讨论时所在提交上的行,`current` 是本次读取的 head 上的行;托管平台不再把讨论放在该提交上时,`current` 为 null。显示 head diff 的使用方把讨论放在 `current` 位置,其余讨论用 `diffHunk` 展示;用 `fileText` 读取 `original.commit` 上的文件,可以看到写下讨论时的完整文件。GitHub 各字段如何映射到这两套位置,由 [GitHub 提供方 README](../../packages/experimental/forge-github/README.zh.md#use-this-package) 说明。
+`ctx.forge.readReview(ref, headSha, signal)` 读取变更请求在某个 head 提交处的评审讨论。只有当读取时的 head 就是 `headSha` 时,提供方才返回 `ForgeReviewData`;否则返回 `stale`,并像 diff 读取遇到 `stale` 时一样,立即重新轮询被关注的变更请求。提供方没有实现 `readReview` 时,服务返回 `unsupported`,使用方据此不显示讨论,也不报错。行级讨论有两套位置:`original` 是写下讨论时所在提交上的行,`current` 是本次读取的 head 上的行;托管平台不再把讨论放在该提交上时,`current` 为 null。显示 head diff 的使用方把讨论放在 `current` 位置,其余讨论用 `diffHunk` 展示;用 `fileText` 读取 `original.commit` 上的文件,可以看到写下讨论时的完整文件。各平台的字段如何映射到这两套位置,由 [GitHub 提供方 README](../../packages/experimental/forge-github/README.zh.md#use-this-package) 与 [GitLab 提供方 README](../../packages/experimental/forge-gitlab/README.zh.md#use-this-package) 说明;GitLab 只保留讨论所在行保持不变的最后一个位置,它即成为讨论的 `original`。
```ts type-equiv
/** Opaque host identity of one review thread. */
@@ -474,9 +506,9 @@ interface ForgeReviewComment {
```ts type-equiv
/**
- * One review thread on a file of a change request. A line thread has two positions: `original` on the commit it was
- * written on, and `current` on the head commit of the read. `current` is null once the host no longer places the
- * thread on the head commit, as after later commits changed its lines.
+ * One review thread on a file of a change request. A line thread has two positions: `original` on a commit whose file
+ * holds the thread's lines as they were written, and `current` on the head commit of the read. `current` is null once
+ * the host no longer places the thread on the head commit, as after later commits changed its lines.
*/
interface ForgeReviewThread {
/** Host identity of the thread. */
@@ -489,7 +521,11 @@ interface ForgeReviewThread {
readonly subject: 'line' | 'file'
/** Lines in the diff that ends at the head commit of the read, whose `commit` is that head; null for an outdated or file thread. */
readonly current: ForgeAnchor | null
- /** Lines in the diff that ended at the commit the thread was written on; null for a file thread. */
+ /**
+ * Lines in the diff that ended at a commit whose file holds the lines as the thread was written on them: the commit
+ * the thread was written on, or a later one the host carried the thread to while the lines stayed unchanged; null for
+ * a file thread.
+ */
readonly original: ForgeAnchor | null
/** Diff hunk the host recorded when the thread was written, ending at its last line; null when it recorded none. */
readonly diffHunk: string | null
@@ -525,6 +561,11 @@ interface ForgeReviewData {
* false for a provider without it.
*/
readonly viewerCanReview: boolean
+ /**
+ * Decisions the host lets the signed-in user record in a submitted review of this change request, such as only
+ * `comment` on their own pull request on GitHub; empty when `viewerCanReview` is false.
+ */
+ readonly reviewEvents: readonly ForgeReviewEvent[]
}
```
@@ -713,15 +754,14 @@ interface ForgeViewedRequest {
## 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)。
+`ctx.forgeSession` 按提供方注册的命令规则,从每个 Session 自己的日志派生其绑定:forge-github 的 `gh` 规则与 forge-gitlab 的 `glab` 规则绑定 `gh pr create` 与 `glab mr create` 结果输出的 URL,以及 `gh pr view`、`glab mr view` 及其同类引用命令所操作的变更请求,`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)。
```ts type-equiv
/**
- * How a change request became bound to a Session: `created` when a
- * `gh pr create` result printed its URL, `referenced` when a `gh pr view`,
- * `gh pr edit`, or `gh pr checkout` call named it or its result printed its
- * own URL, `discovered` when a lookup found it for a branch the Session pushed
- * or works on, `tracked` when a caller bound it by URL.
+ * How a change request became bound to a Session: `created` when the result of a command a registered rule names as a
+ * creation printed its URL, `referenced` when a command a rule names as a reference named it, its result printed its
+ * own URL, or a lookup for it found the URL, `discovered` when a lookup found it for a branch the Session pushed or
+ * works on, `tracked` when a caller bound it by URL.
*/
type BindingOrigin = 'created' | 'referenced' | 'discovered' | 'tracked'
```
@@ -731,7 +771,7 @@ type BindingOrigin = 'created' | 'referenced' | 'discovered' | 'tracked'
interface BindingRecord {
/**
* `track` binds or restores, `dismiss` hides, `discover` binds a branch lookup,
- * and `reference` binds a CLI selector lookup without restoring dismissed entries.
+ * and `reference` binds a command lookup without restoring dismissed entries.
*/
readonly action: 'track' | 'dismiss' | 'discover' | 'reference'
/** Web URL of the change request. */
@@ -761,6 +801,84 @@ interface SessionChangeRequest {
type SessionChangeRequestsListener = (changeRequests: readonly SessionChangeRequest[]) => void
```
+提供方通过 `registerCommands` 注册其 CLI 的命令;投影如何据此折叠见 [Session 绑定 README](../../packages/experimental/forge-session/README.zh.md#use-this-package)。
+
+```ts type-equiv
+/**
+ * The shell commands of one forge family's CLI that bind change requests to the Session that ran them, registered
+ * with `ctx.forgeSession.registerCommands`. The `forgeChangeRequests` projection folds the Session log with the
+ * recognized rules and folds it again when a registration changes them, so a rule must classify the same input the
+ * same way every time: its members are fixed, and `select` reads only its arguments.
+ */
+interface ForgeCommandRule {
+ /** Stable name of the rule, such as `gh`; no two registered rules share one. */
+ readonly id: string
+ /** Positive integer the registrant raises whenever the rule classifies some command or output differently. */
+ readonly version: number
+ /** Executable word the rule classifies, such as `gh`; no two registered rules share one. */
+ readonly executable: string
+ /** Subcommand word sequences that create a change request and print its URL, such as `['pr', 'create']`. */
+ readonly creates: readonly (readonly string[])[]
+ /** Subcommands that act on one change request, which their words or their output name, such as `['pr', 'view']`. */
+ readonly references: ForgeCommandGroup
+ /**
+ * Subcommands that send a raw API request, such as `['api']`, whose words can name one change request. Their output
+ * is not read, since one request can list many change requests.
+ */
+ readonly apiRequests: ForgeCommandGroup
+ /** Regular expression source matching a change request page path after the repository path, such as `\/pull\/\d+`. */
+ readonly changeRequestPath: string
+ /** JSON member names whose value is the URL of the change request a reference command prints, such as `url`. */
+ readonly urlMembers: readonly string[]
+ /**
+ * Find the change request that one literal reference or API request command names.
+ * @param command - the command's kind, subcommand, operands, and option values.
+ * @param environment - the variables the command assigns before the executable, the last assignment of a name winning.
+ * @returns the change request's URL when the command names its host; a lookup when it names the change request
+ * without one; undefined when it names no change request.
+ */
+ select(command: ForgeCommandArguments, environment: Readonly>): ForgeCommandSelection | undefined
+}
+```
+
+```ts type-equiv
+/** Subcommands of one kind and the options they accept. */
+interface ForgeCommandGroup {
+ /** Subcommand word sequences, such as `['pr', 'view']`; may be empty. */
+ readonly subcommands: readonly (readonly string[])[]
+ /**
+ * Options that take a value: the next word, the text after `=`, or for a one-letter option such as `-R`, the rest of
+ * the word.
+ */
+ readonly valueOptions: readonly string[]
+ /** Options that take no value; a command with any other option names nothing. */
+ readonly flagOptions: readonly string[]
+}
+```
+
+```ts type-equiv
+/** The parsed words of one reference or API request command after its executable. */
+interface ForgeCommandArguments {
+ /** Which group of the rule the subcommand belongs to. */
+ readonly kind: 'reference' | 'api-request'
+ /** The subcommand words, such as `['pr', 'view']`. */
+ readonly subcommand: readonly string[]
+ /** Words after the subcommand that are neither options nor option values. */
+ readonly operands: readonly string[]
+ /** Each value option as written, with its value, in command order. */
+ readonly values: readonly (readonly [option: string, value: string])[]
+}
+```
+
+```ts type-equiv
+/**
+ * The change request one command names: its URL, or a read-only command, starting with the executable, that prints
+ * exactly that URL. forge-session runs a lookup in the shell of the command that named it, with that command's
+ * variable assignments, and only while the command runs; replaying the Session log runs none.
+ */
+type ForgeCommandSelection = { readonly url: string } | { readonly lookup: readonly string[] }
+```
+
## 面板
`ctx.forgePanel` 是 [forge 面板](../../packages/experimental/client-ui-forge/README.zh.md#use-this-package)的宿主 Remote。跟随一个 Session 时,它以流的形式推送 `ForgePanelState`:在 Session 执行环境中对其当前目录进行的只读 Git 检查、从上游远端或 `origin` 识别出的代码托管平台、该平台的登录状态、Session 的绑定及其轮询状态与最近的快照,以及它的 worktree 请求。它的操作可以列出基准分支、绑定和隐藏 URL、刷新、把已绑定的草稿标记为可评审或合并已绑定的变更请求、请求或撤回 worktree、停止正在进行的创建,以及恢复已删除的 worktree 或离开它回到源检出。请求是一条 `plugin:client-ui-forge/worktree` 记录。消息在 Session 的 Agent 空闲时进入其收件箱,面板会在这次投递唤醒 [Agent](../../packages/core/agent/README.zh.md) 之前启动它的维护任务,暂留这条消息的这一轮:对未完成的请求,它通过 `ctx.worktrees` 创建 worktree,尝试失败或被停止后等待下一次尝试或请求被撤回;对在所创建 worktree 中工作的 Session,它检查该 worktree,已被删除时等待它被恢复或离开。面板状态说明消息在等待什么,以及最近一次失败的尝试。对于没有被暂留的消息,由第一个步骤提议创建 worktree。第一轮开始之后的请求会被忽略。对 Session 检出的改动以其 Agent 的维护任务运行,因此其他客户端发来的消息会等它们完成。
@@ -934,6 +1052,8 @@ interface ForgePanelWorktree {
```ts type-equiv
/** One bound change request in the panel state. */
interface ForgePanelChangeRequest extends SessionChangeRequest {
+ /** How readers name the change request's code host and its change requests, or null when no provider serves its URL. */
+ readonly forge: ForgeDescription | null
/** Latest snapshot a poll returned, kept while later polls fail, or null before the first successful poll. */
readonly snapshot: ChangeRequestSnapshot | null
/**
@@ -1334,21 +1454,28 @@ Registry of forge providers. Watchers of one change request share a single polli
* fiber. Watches of that forge receive an `unavailable` failure when the
* registration ends. Unregistering cancels and awaits its in-flight calls;
* results from the withdrawn registration are discarded.
- * @param provider - provider to serve `provider.forge`.
+ * @param provider - provider to serve `provider.forge` on `provider.hosts`.
* @returns the disposer that unregisters the provider and waits for its calls to finish.
- * @throws when another provider already serves the same forge.
+ * @throws when another provider already serves the same forge or one of the same hosts, compared without case.
*/
register(provider: ForgeProvider): () => Promise
/**
- * Map a Git remote URL to a repository through the first provider that serves it.
+ * Name a forge family and its change requests for readers.
+ * @param forge - forge family name, such as `github`.
+ * @returns the registered provider's description, or undefined when no provider serves the family.
+ */
+describe(forge: string): ForgeDescription | undefined
+
+/**
+ * Map a Git remote URL to a repository through the provider that serves its host.
* @param url - fetch or push URL as Git reports it.
* @returns the repository, or undefined when no provider serves the URL.
*/
repositoryFromRemote(url: string): ForgeRepository | undefined
/**
- * Map a change request web URL through the first provider that serves it.
+ * Map a change request web URL through the provider that serves its host.
* @param url - web URL of a pull or merge request.
* @returns the change request, or undefined when no provider serves the URL.
*/
@@ -2068,9 +2195,28 @@ 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, 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`.
+Session-scoped change request bindings. The `forgeChangeRequests` projection derives them from the results of the creation and reference commands that forge providers register through `registerCommands`, from `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
+/**
+ * Register the commands of one forge CLI as an effect on the calling fiber.
+ * A rule that changes the recognized rule set re-registers the
+ * `forgeChangeRequests` projection at the new set's state version, so every
+ * Session refolds its log with the new rules when next read, including
+ * commands that ran before the registration, and watchers receive the
+ * refolded bindings. Disposal does not change the recognized set: the rule
+ * keeps recognizing commands until the service restarts or another rule
+ * replaces its id or executable, so unloading a provider, including at
+ * shutdown, leaves the checkpointed state version unchanged. Only live
+ * registrations run reference lookups, so a disposed rule starts no CLI
+ * process; lookups that started before a change finish with the rules they
+ * started with.
+ * @param rule - the CLI's executable, subcommands, change request page path, and selection.
+ * @returns the disposer that ends the registration.
+ * @throws when the rule is malformed, or a live registration has its id or executable.
+ */
+registerCommands(rule: ForgeCommandRule): () => void
+
/**
* List the change requests bound to a Session and not dismissed.
* @param session - Session whose bindings are read.
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.i18n.yaml
new file mode 100644
index 0000000000..b9a9f6787c
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.i18n.yaml
@@ -0,0 +1,16 @@
+# Bilingual-pair consistency record for guide.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/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.md
+/:
+ en: 07b8a3b72e028278
+ zh: 3e976865cbeae2fa
+/forge-providers-register-the-commands-that-bind-change-requests:
+ en: 1cd94d0f8b2f2419
+ zh: d78a94516aad67d2
+/forge-providers-register-the-commands-that-bind-change-requests/change:
+ en: bdcd520b855a0b49
+ zh: 7c2237400cce6b4f
+/forge-providers-register-the-commands-that-bind-change-requests/migration:
+ en: 36618d08e8647e63
+ zh: fa83f0c3ad6ed020
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.md b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.md
new file mode 100644
index 0000000000..6d83765ae0
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.md
@@ -0,0 +1,22 @@
+---
+kind: upgrade-guide
+description: "forge-session no longer recognizes gh commands by itself; forge providers register the commands that bind change requests, and existing forgeChangeRequests checkpoints fold again once."
+---
+
+# Forge providers register the commands that bind change requests
+
+English | [中文](guide.zh.md)
+
+## Change
+
+`@deepseek-ai/dsh-experimental-forge-session` used to recognize `gh pr create`, `gh pr view`, `gh pr edit`, and `gh pr checkout` by itself. It now recognizes only the commands that forge providers register through `ctx.forgeSession.registerCommands(rule)`: `@deepseek-ai/dsh-experimental-forge-github` registers `gh`, and `@deepseek-ai/dsh-forge-gitlab` registers `glab`. A composition that loads forge-session without forge-github no longer binds pull requests from `gh` commands; `git push` discovery, `track`, and recorded bindings are unchanged. Once a rule registers, each Session's earlier commands bind as well.
+
+The `forgeChangeRequests` projection's state version now derives from the registered rules, so every checkpointed row from an earlier release is discarded once: each Session folds its log again when next read, and until then the Session list shows no cached bindings for it. Bindings are not lost. The `gh` lookup for a number without a host now runs `gh pr view --repo --json url --jq .url`.
+
+This affects custom `cordis.yml` compositions and code that registers command rules. The forge bundle loads both providers and needs no change.
+
+## Migration
+
+1. In a composition that loads forge-session, also load `@deepseek-ai/dsh-experimental-forge-github` for `gh` commands, `@deepseek-ai/dsh-forge-gitlab` for `glab` commands, or both.
+2. To bind the commands of another CLI, register a `ForgeCommandRule` with `ctx.forgeSession.registerCommands` from a plugin that injects `forgeSession`, as [`packages/experimental/forge-github/src/commands.ts`](../../../../packages/experimental/forge-github/src/commands.ts) does, and raise its `version` whenever it classifies any command differently.
+3. Open a Session that ran `gh pr create`; the migration works when the forge panel lists the pull request that command printed.
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.zh.md
new file mode 100644
index 0000000000..a10673fcdd
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-command-rules/guide.zh.md
@@ -0,0 +1,22 @@
+---
+kind: upgrade-guide
+description: "forge-session 不再自行识别 gh 命令;由 forge 提供方注册绑定变更请求的命令,已有的 forgeChangeRequests 检查点会重新折叠一次。"
+---
+
+# Forge 提供方注册绑定变更请求的命令
+
+[English](guide.md) | 中文
+
+## 变更
+
+`@deepseek-ai/dsh-experimental-forge-session` 过去自行识别 `gh pr create`、`gh pr view`、`gh pr edit` 与 `gh pr checkout`。现在它只识别 forge 提供方通过 `ctx.forgeSession.registerCommands(rule)` 注册的命令:`@deepseek-ai/dsh-experimental-forge-github` 注册 `gh`,`@deepseek-ai/dsh-forge-gitlab` 注册 `glab`。加载 forge-session 但不加载 forge-github 的组合,不再从 `gh` 命令绑定 pull request;`git push` 发现、`track` 与已记录的绑定不变。规则注册后,每个 Session 此前执行过的命令同样会绑定。
+
+`forgeChangeRequests` 投影的状态版本现由已注册的规则派生,因此此前版本检查点中的每一行都会被丢弃一次:每个 Session 下次被读取时重新折叠其日志,在此之前 Session 列表不显示它的缓存绑定。绑定不会丢失。对未写明主机的编号,`gh` 查询现在执行 `gh pr view --repo --json url --jq .url`。
+
+受影响的是自定义 `cordis.yml` 组合与注册命令规则的代码。forge 套件会加载两个提供方,无需改动。
+
+## 迁移
+
+1. 在加载 forge-session 的组合中,同时加载 `@deepseek-ai/dsh-experimental-forge-github` 以识别 `gh` 命令、加载 `@deepseek-ai/dsh-forge-gitlab` 以识别 `glab` 命令,或两者都加载。
+2. 若要绑定其他 CLI 的命令,像 [`packages/experimental/forge-github/src/commands.ts`](../../../../packages/experimental/forge-github/src/commands.ts) 那样,从注入 `forgeSession` 的插件中通过 `ctx.forgeSession.registerCommands` 注册一条 `ForgeCommandRule`,并在其对任何命令的分类发生变化时提高 `version`。
+3. 打开一个执行过 `gh pr create` 的 Session;forge 面板列出该命令打印的 pull request 时,迁移即已生效。
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.i18n.yaml
new file mode 100644
index 0000000000..cadd50adf8
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.i18n.yaml
@@ -0,0 +1,16 @@
+# Bilingual-pair consistency record for guide.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/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.md
+/:
+ en: 7a694c15b528d821
+ zh: bceb9c2829c09bf8
+/forge-providers-declare-hosts-names-sign-in-and-review-decisions:
+ en: e876851b5e7ef5b5
+ zh: 50314894e615738b
+/forge-providers-declare-hosts-names-sign-in-and-review-decisions/change:
+ en: 8795de8b80f1385c
+ zh: e1c7308d3c762198
+/forge-providers-declare-hosts-names-sign-in-and-review-decisions/migration:
+ en: 7b2abf659941fc7f
+ zh: 9c934740f791f0f0
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.md b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.md
new file mode 100644
index 0000000000..6e98b16519
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.md
@@ -0,0 +1,25 @@
+---
+kind: upgrade-guide
+description: "ForgeProvider must list its hosts and name itself, ForgeReadiness carries a sign-in command, and ForgeReviewData lists the review decisions the reader may submit."
+---
+
+# Forge providers declare hosts, names, sign-in, and review decisions
+
+English | [中文](guide.zh.md)
+
+## Change
+
+`ForgeProvider` gains three required members: `hosts`, the lowercase host names the provider serves; `label`, the product name readers know those hosts by, such as `GitHub`; and `changeRequestNoun`, `'pull-request'` or `'merge-request'`. `ctx.forge.register` now throws when a provider lists a host, compared without case, that an already registered provider lists. `ctx.forge.describe(forge)` returns the `ForgeDescription` the panel uses to name the code host in its copy.
+
+`ForgeReadiness` gains the required `signIn: { command } | null`. The forge panel shows that command in its sign-in banner instead of building `gh auth login` for the `github` family itself.
+
+`ForgeReviewData` gains the required `reviewEvents`, the decisions the host lets the signed-in user record in a submitted review. The review dialog offers only these, replacing its own rule that the author of a pull request may only comment.
+
+This affects third-party providers and code that builds these values. All types come from `@deepseek-ai/dsh-experimental-forge`. The GitHub provider sets `hosts` from its `hosts` setting, `label: 'GitHub'`, `changeRequestNoun: 'pull-request'`, `signIn` while `gh` is not signed in, and `['comment']` for the author of a pull request.
+
+## Migration
+
+1. Add `hosts`, `label`, and `changeRequestNoun` to each `ForgeProvider`. List every host whose remotes or change request URLs the provider maps, and make sure no other loaded provider lists one of them.
+2. Return `signIn: null`, or `{ command }` with the shell command that signs the user in, from every `readiness` result.
+3. Return `reviewEvents` from `readReview`: the decisions the signed-in user may submit, or `[]` when `viewerCanReview` is false.
+4. Run your type check, then start a profile that loads your provider; it succeeds when the type check passes and `ctx.forge.register` does not throw.
diff --git a/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.zh.md
new file mode 100644
index 0000000000..08c451b514
--- /dev/null
+++ b/docs/upgrade-guide/v0.2.2-rc.3/forge-provider-hosts/guide.zh.md
@@ -0,0 +1,25 @@
+---
+kind: upgrade-guide
+description: "ForgeProvider 必须列出所服务的主机并给出名称,ForgeReadiness 带有登录命令,ForgeReviewData 列出读者可提交的评审结论。"
+---
+
+# Forge 提供方声明主机、名称、登录方式与评审结论
+
+[English](guide.md) | 中文
+
+## 变更
+
+`ForgeProvider` 新增三个必需成员:`hosts`,提供方服务的小写主机名;`label`,读者熟知的这些主机的产品名,例如 `GitHub`;`changeRequestNoun`,取值 `'pull-request'` 或 `'merge-request'`。提供方列出的主机(不区分大小写)已被另一个已注册的提供方列出时,`ctx.forge.register` 会抛出错误。`ctx.forge.describe(forge)` 返回 `ForgeDescription`,面板用它在文案中称呼代码托管平台。
+
+`ForgeReadiness` 新增必需的 `signIn: { command } | null`。Forge 面板在登录提示中显示这条命令,不再自行为 `github` 家族拼出 `gh auth login`。
+
+`ForgeReviewData` 新增必需的 `reviewEvents`,即托管平台允许当前用户在提交的评审中记录的结论。评审对话框只提供这些结论,取代它原先内置的规则:拉取请求的作者只能评论。
+
+受影响的是第三方提供方,以及构造这些值的代码。所有类型都来自 `@deepseek-ai/dsh-experimental-forge`。GitHub 提供方按其 `hosts` 设置填写 `hosts`,`label` 为 `'GitHub'`,`changeRequestNoun` 为 `'pull-request'`,`gh` 未登录时给出 `signIn`,拉取请求的作者只得到 `['comment']`。
+
+## 迁移
+
+1. 为每个 `ForgeProvider` 添加 `hosts`、`label` 与 `changeRequestNoun`。列出提供方会映射其 remote 或变更请求 URL 的每个主机,并确认其他已加载的提供方没有列出其中任何一个。
+2. 在每个 `readiness` 结果中返回 `signIn: null`,或带有登录 shell 命令的 `{ command }`。
+3. 在 `readReview` 的结果中返回 `reviewEvents`:当前用户可以提交的结论;`viewerCanReview` 为 false 时返回 `[]`。
+4. 运行类型检查,再启动加载你的提供方的 profile;类型检查通过且 `ctx.forge.register` 没有抛出错误即完成迁移。
diff --git a/package.json b/package.json
index cce2a50477..b60ab1acbe 100644
--- a/package.json
+++ b/package.json
@@ -310,6 +310,7 @@
"@deepseek-ai/dsh-experimental-tool-subagent-oar": "workspace:*",
"@deepseek-ai/dsh-experimental-forge": "workspace:*",
"@deepseek-ai/dsh-experimental-forge-github": "workspace:*",
+ "@deepseek-ai/dsh-forge-gitlab": "workspace:*",
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
"@deepseek-ai/dsh-action-cards": "workspace:*"
}
diff --git a/packages/client/ui-chat/README.i18n.yaml b/packages/client/ui-chat/README.i18n.yaml
index a986f761c4..5110a89ec8 100644
--- a/packages/client/ui-chat/README.i18n.yaml
+++ b/packages/client/ui-chat/README.i18n.yaml
@@ -15,8 +15,8 @@
en: 5ee429751fcbeb4f
zh: 981a37018b6cae3a
/deepseek-ai-dsh-client-ui-chat/reference-previews:
- en: c07a50787d77a7cd
- zh: 70ee4e32d664e88e
+ en: 90e75f3a18a86854
+ zh: bb7b0a10050de9aa
/deepseek-ai-dsh-client-ui-chat/hidden-chat-rows:
en: 8ca277dc7fed699f
zh: 167478dba50f3904
diff --git a/packages/client/ui-chat/README.md b/packages/client/ui-chat/README.md
index 70921859ae..98280f5773 100644
--- a/packages/client/ui-chat/README.md
+++ b/packages/client/ui-chat/README.md
@@ -38,7 +38,7 @@ Image drag actions arrive through the image entry’s inject face from [ui-file-
Sent generic-file attachments retain the draft's [file-card radius](../../../docs/ui-radius.md#radius-scale).
-`ChatView` supplies file and HTTP(S) navigation through the existing `MarkdownDelegateProvider` around its node list, passing `requestOpenFile`, `openExternalLink`, and `fileImages` directly. Its file opener retains Chat's failure feedback and retry handling. Assistant Markdown file links open in the right Sidebar after the message settles, including references to unmodified files. Relative paths resolve in the viewed Session's workspace; absolute paths retain the same Session's filesystem access. [Supported Markdown line references](../ui-primitives/README.md#rendering-agent-output) navigate to the first specified line and reuse an existing file tab. Missing files show the preview's error state.
+`ChatView` supplies file and HTTP(S) navigation through the existing `MarkdownDelegateProvider` around its node list, passing `requestOpenFile`, `openExternalLink`, and `fileImages` directly. Its file opener retains Chat's failure feedback and retry handling. Assistant Markdown file links open in the right Sidebar after the message settles, including references to unmodified files. Relative link and image paths in an Assistant message resolve from the directory that was current when the message was written, using the `workingDirectoryHistory` projection; without that history they resolve from the Session's current working directory, or its workspace root when none is recorded; absolute paths retain the same Session's filesystem access. [Supported Markdown line references](../ui-primitives/README.md#rendering-agent-output) navigate to the first specified line and reuse an existing file tab. Missing files show the preview's error state.
`ChatView` also passes `renderCode`, so each Markdown fence in the Chat flow that has a language and content renders through the session-scoped `conversation.chat.markdown.fence` hoc slot. Its `entryKey` is the lowercased fence language, and its owner props carry that `lang`, the fence `code`, the `streaming` state, and `meta`, the rest of the info string when present. The slot content is a plain code block without unified-diff rows, so a language without a layer renders as code. Chat registers layers for `math`, which shows the source while the message streams and display TeX after it settles, and for `diff` and `patch`, which render unified-diff rows in place of the content. Other plugins add a language by registering a layer whose `key` is the lowercased language: a layer that omits `children` replaces the code block, a layer that renders `children` decorates it, and either may parse its own parameters from `meta`.
diff --git a/packages/client/ui-chat/README.zh.md b/packages/client/ui-chat/README.zh.md
index d50ba90f91..a1715ea366 100644
--- a/packages/client/ui-chat/README.zh.md
+++ b/packages/client/ui-chat/README.zh.md
@@ -38,7 +38,7 @@ kind: "package-reference"
已发送的普通文件附件保留草稿中的[文件卡片圆角](../../../docs/ui-radius.zh.md#radius-scale)。
-`ChatView` 通过节点列表外围既有的 `MarkdownDelegateProvider` 提供文件及 HTTP(S) 导航,直接传入 `requestOpenFile`、`openExternalLink` 和 `fileImages`。文件打开动作保留 Chat 的失败反馈与重试处理。Assistant Markdown 文件链接在消息落定后可于右侧栏打开,包括未修改文件的引用。相对路径基于当前查看的 Session 工作区解析;绝对路径仍使用同一 Session 的文件系统访问。[支持的 Markdown 行号引用](../ui-primitives/README.zh.md#rendering-agent-output)定位到指定起始行,并复用现有文件标签。文件缺失时显示预览错误状态。
+`ChatView` 通过节点列表外围既有的 `MarkdownDelegateProvider` 提供文件及 HTTP(S) 导航,直接传入 `requestOpenFile`、`openExternalLink` 和 `fileImages`。文件打开动作保留 Chat 的失败反馈与重试处理。Assistant Markdown 文件链接在消息落定后可于右侧栏打开,包括未修改文件的引用。Assistant 消息中的相对链接与图片路径按该消息写下时的当前目录解析(取自 `workingDirectoryHistory` 投影);没有该历史时按 Session 的当前工作目录解析,未记录时回落到其工作区根目录;绝对路径仍使用同一 Session 的文件系统访问。[支持的 Markdown 行号引用](../ui-primitives/README.zh.md#rendering-agent-output)定位到指定起始行,并复用现有文件标签。文件缺失时显示预览错误状态。
`ChatView` 还传入 `renderCode`,因此 Chat 消息流中带语言且有内容的每个 Markdown 围栏都经由 session 作用域的 `conversation.chat.markdown.fence` hoc slot 渲染。其 `entryKey` 为小写的围栏语言,owner props 携带该 `lang`、围栏 `code`、`streaming` 状态,以及存在时为 info string 其余部分的 `meta`。slot 内容是不带统一 diff 行的普通代码块,因此没有对应层的语言按代码渲染。Chat 自带 `math` 层,消息流式输出时显示源码,落定后显示行间 TeX;还自带 `diff` 与 `patch` 层,以统一 diff 行代替内容渲染。其他插件注册 `key` 为小写语言的层即可接入该语言:不渲染 `children` 的层替换代码块,渲染 `children` 的层装饰代码块,两者都可以自行从 `meta` 解析参数。
diff --git a/packages/client/ui-chat/package.json b/packages/client/ui-chat/package.json
index 709a5a28f8..42e24bda65 100644
--- a/packages/client/ui-chat/package.json
+++ b/packages/client/ui-chat/package.json
@@ -100,7 +100,8 @@
"@deepseek-ai/dsh-settings": "workspace:*",
"@deepseek-ai/dsh-client-product-analytics": "workspace:*",
"@deepseek-ai/dsh-client-ui-file-drag": "workspace:*",
- "@deepseek-ai/dsh-client-ui-context-menu": "workspace:*"
+ "@deepseek-ai/dsh-client-ui-context-menu": "workspace:*",
+ "@deepseek-ai/dsh-working-directory": "workspace:*"
},
"dependencies": {
"@deepseek-ai/schemastery": "workspace:~"
diff --git a/packages/client/ui-chat/src/client/chat/AssistantMarkdown.tsx b/packages/client/ui-chat/src/client/chat/AssistantMarkdown.tsx
index 3d946f8c91..77f1f98a42 100644
--- a/packages/client/ui-chat/src/client/chat/AssistantMarkdown.tsx
+++ b/packages/client/ui-chat/src/client/chat/AssistantMarkdown.tsx
@@ -3,7 +3,7 @@ import { fileMediaUrl } from '@deepseek-ai/dsh-util-workspace-path'
import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
import type { ReactNode } from 'react'
import { JsonBlock, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
-import type { MarkdownFileMentions, MarkdownPathImages } from '@deepseek-ai/dsh-client-ui-primitives'
+import type { MarkdownFileMentions, MarkdownPathImages, MarkdownPathResolver } from '@deepseek-ai/dsh-client-ui-primitives'
import type { ChatNodeOwnerProps, ChatViewSlotProps, UseDisclosure, UsePresentation, UseGroupAction } from '../contract/slots.ts'
import type { AssistantBlock } from '../contract/snapshot.ts'
import { markdownLabels } from '../markdown-labels.ts'
@@ -50,6 +50,8 @@ export interface AssistantMarkdownProps extends
revealProcess?: (() => void) | undefined
/** Resolved prose file mentions for this Assistant's closing turn. */
mentions?: MarkdownFileMentions | undefined
+ /** Maps local link and image destinations of the response text; reasoning keeps the delegate's resolution. */
+ resolvePath?: MarkdownPathResolver | undefined
/** The owning view's locale seat, passed down as a plain prop. */
t: ChatViewSlotProps['t']
}
@@ -57,7 +59,7 @@ export interface AssistantMarkdownProps extends
/** Renders non-blank reasoning blocks as independent disclosures alongside the response. */
export const AssistantMarkdown = memo(function AssistantMarkdown({
blocks, streaming, textInteractionSource = false, interrupted, loadImage, groupPart, useDisclosure,
- reasoningHidden = false, usePresentation, revealProcess, mentions, renderSlot, useGroupAction, t,
+ reasoningHidden = false, usePresentation, revealProcess, mentions, resolvePath, renderSlot, useGroupAction, t,
}: AssistantMarkdownProps) {
// Stable per locale revision (t identity changes on switch): a fresh object
// per render would rebuild MarkdownText's component table every chunk.
@@ -90,6 +92,7 @@ export const AssistantMarkdown = memo(function AssistantMarkdown({
labels={labels}
fileMentions={mentions}
pathImages={pathImages}
+ resolvePath={resolvePath}
textInteractionSource={textInteractionSource}
/>,
)
diff --git a/packages/client/ui-chat/src/client/chat/AssistantNodeView.tsx b/packages/client/ui-chat/src/client/chat/AssistantNodeView.tsx
index ad5963c093..fff07365d0 100644
--- a/packages/client/ui-chat/src/client/chat/AssistantNodeView.tsx
+++ b/packages/client/ui-chat/src/client/chat/AssistantNodeView.tsx
@@ -1,7 +1,10 @@
import { memo, useCallback, useMemo } from 'react'
import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
+import { resolveWorkspacePath } from '@deepseek-ai/dsh-util-workspace-path'
+import type {} from '@deepseek-ai/dsh-working-directory/client'
import type { ChatFileMentions, ChatNodeViewProps, PresentationInjected, TurnTailOwnerProps } from '../contract/slots.ts'
import { AssistantMarkdown } from './AssistantMarkdown.tsx'
+import { directoryAt } from './directory-at.ts'
/** Business readers owned by the assistant renderer's existing Slot registration. */
export interface AssistantNodeInjected extends PresentationInjected {
@@ -17,7 +20,7 @@ type AssistantNodeViewProps = ChatNodeViewProps<'assistant-step'> & InjectFace getTriggerProps(() => ({
@@ -46,6 +49,12 @@ export const AssistantNodeView = memo(function AssistantNodeView({
: turnProcess.spec.answerStep === data.step && turnProcess.spec.inlineReasoning)
&& !turnProcess.open
const revealProcess = useCallback(() => { turnProcess?.setOpen(true) }, [turnProcess])
+ // Relative destinations name files in the directory that was current when this message was written.
+ const directory = useProjection('workingDirectoryHistory', history => directoryAt(history, node.anchorSeq))
+ const resolvePath = useMemo(
+ () => directory === undefined ? undefined : (path: string) => resolveWorkspacePath(directory, path),
+ [directory],
+ )
return (
)
diff --git a/packages/client/ui-chat/src/client/chat/ChatView.tsx b/packages/client/ui-chat/src/client/chat/ChatView.tsx
index c9143248a1..7ee99e6d00 100644
--- a/packages/client/ui-chat/src/client/chat/ChatView.tsx
+++ b/packages/client/ui-chat/src/client/chat/ChatView.tsx
@@ -6,6 +6,7 @@ import type {
NodeKey, RenderEntry,
} from '@deepseek-ai/dsh-client-ui-conversation/client'
import type { InboxState } from '@deepseek-ai/dsh-agent/types'
+import type {} from '@deepseek-ai/dsh-working-directory/client'
import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client'
import {
Button, FenceCodeBlock, IconChevronDownOutlineRegular, MarkdownDelegateProvider, Modal,
@@ -98,16 +99,18 @@ export function ChatView({
)
const inbox = useProjection('inbox') as InboxState | undefined
// Workspace root off the session list row: path summaries display relative to it.
- const cwd = useSessions(s => s.byId[sessionId]?.cwd)
+ const rootCwd = useSessions(s => s.byId[sessionId]?.cwd)
+ // Images outside a message's path scope resolve like file links: from the current directory, else that root.
+ const imageCwd = useProjection('workingDirectory') ?? rootCwd
const fileImages = useMemo(() => ({
fileDrag,
- resolve: (path: string) => fileMediaUrl(document.baseURI, resolveWorkspacePath(cwd, path)),
- resourceAddress: (path: string) => sessionFileAddress(sessionId, resolveWorkspacePath(cwd, path)),
+ resolve: (path: string) => fileMediaUrl(document.baseURI, resolveWorkspacePath(imageCwd, path)),
+ resourceAddress: (path: string) => sessionFileAddress(sessionId, resolveWorkspacePath(imageCwd, path)),
labels: {
open: t('image.open'), loading: t('image.loading'), failed: t('image.failed'),
dialog: t('image.dialog'), close: t('image.close'),
},
- }), [cwd, t, fileDrag, sessionId])
+ }), [imageCwd, t, fileDrag, sessionId])
const codeLabels = useMemo(() => markdownLabels(t).code, [t])
// Every fence in the flow dispatches by language; the content is the plain
// code block, so a language without a layer renders as code without diff rows.
@@ -280,7 +283,7 @@ export function ChatView({
>
{renderSlot('conversation.chat.flow', {
entries, pendingInputs, lastInputTurn, deferCollapse,
- cwd, openFile: requestOpenFile, inspectCall, forkAt, loadImage,
+ cwd: rootCwd, openFile: requestOpenFile, inspectCall, forkAt, loadImage,
}, { hookContext: flowContext })}