Merge commit 'c9cd70aba9c' into feat/files-upload-retries
This commit is contained in:
commit
9d33fae5d4
196 files changed
+8955
-914
No files matched your search
+2
-2
@@ -15,5 +15,5 @@
|
||||
en: 1e2239783738cec2
|
||||
zh: 5f248eee47de376e
|
||||
/agent-note-session-change-request-bindings/consequences:
|
||||
en: a2960e50ec52c9b6
|
||||
zh: fd23f4fe1137787d
|
||||
en: 2786b1dffa995c14
|
||||
zh: c124420915da5aae
|
||||
@@ -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.
|
||||
@@ -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`。
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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)。
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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([])
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
en: 41d772192075e133
|
||||
zh: 5ef3da69b4de1d8a
|
||||
/capability-seams-and-core-services:
|
||||
en: e55823589627cda5
|
||||
zh: 2e82c1116fcdb9f8
|
||||
en: 377f8f047b34cfde
|
||||
zh: be08abadad0beb93
|
||||
@@ -44,6 +44,7 @@ flowchart LR
|
||||
pkg_experimental_forge["experimental-forge"]
|
||||
svc_forge["ctx.forge<br/>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<br/>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. |
|
||||
|
||||
@@ -46,6 +46,7 @@ flowchart LR
|
||||
pkg_experimental_forge["experimental-forge"]
|
||||
svc_forge["ctx.forge<br/>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<br/>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 目录。 |
|
||||
|
||||
+38
-5
@@ -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 {
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-file-reference-local -->
|
||||
|
||||
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-forge-gitlab -->
|
||||
<a id="deepseek-aidsh-forge-gitlab"></a>
|
||||
|
||||
## `@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
|
||||
}
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-forge-gitlab -->
|
||||
|
||||
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-fs-local -->
|
||||
<a id="deepseek-aidsh-fs-local"></a>
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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 {
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-file-reference-local -->
|
||||
|
||||
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-forge-gitlab -->
|
||||
<a id="deepseek-aidsh-forge-gitlab"></a>
|
||||
|
||||
## `@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
|
||||
}
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-forge-gitlab -->
|
||||
|
||||
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-fs-local -->
|
||||
<a id="deepseek-aidsh-fs-local"></a>
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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) |
|
||||
|
||||
@@ -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) |
|
||||
|
||||
@@ -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) |
|
||||
|
||||
@@ -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) |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 |
|
||||
|---|---|---|
|
||||
|
||||
@@ -1331,7 +1331,7 @@ export type SessionEvent<T extends SessionEventType = SessionEventType> = {
|
||||
}
|
||||
```
|
||||
|
||||
来源:[`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)
|
||||
|
||||
| 属性 | 存在性 | 类型 |
|
||||
|---|---|---|
|
||||
|
||||
Generated
+2
-2
@@ -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":[]},
|
||||
|
||||
@@ -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
|
||||
|
||||
+168
-22
@@ -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<ForgeReviewResult>
|
||||
/**
|
||||
@@ -135,8 +144,10 @@ interface ForgeProvider {
|
||||
reviewerCandidates?(ref: ChangeRequestRef, query: string, signal: AbortSignal): Promise<readonly ForgeReviewerCandidate[] | ForgeFailure>
|
||||
/**
|
||||
* 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<ForgeActionFailure | undefined>
|
||||
}
|
||||
@@ -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<Record<string, string>>): 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<void>
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
+168
-22
@@ -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<ForgeReviewResult>
|
||||
/**
|
||||
@@ -135,8 +144,10 @@ interface ForgeProvider {
|
||||
reviewerCandidates?(ref: ChangeRequestRef, query: string, signal: AbortSignal): Promise<readonly ForgeReviewerCandidate[] | ForgeFailure>
|
||||
/**
|
||||
* 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<ForgeActionFailure | undefined>
|
||||
}
|
||||
@@ -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<Record<string, string>>): 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<void>
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -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
|
||||
@@ -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 <number> --repo <repository> --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.
|
||||
@@ -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 <number> --repo <repository> --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 时,迁移即已生效。
|
||||
@@ -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
|
||||
@@ -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.
|
||||
@@ -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` 没有抛出错误即完成迁移。
|
||||
@@ -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:*"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`.
|
||||
|
||||
|
||||
@@ -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` 解析参数。
|
||||
|
||||
|
||||
@@ -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:~"
|
||||
|
||||
@@ -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}
|
||||
/>,
|
||||
)
|
||||
|
||||
@@ -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<A
|
||||
/** Streaming, settled, and interrupted Assistant states share one keyed renderer instance. */
|
||||
export const AssistantNodeView = memo(function AssistantNodeView({
|
||||
node, groupPart, useDisclosure, useGroupAction, useTurnData, turnProcess, openFile, loadImage, fileMentions,
|
||||
usePresentation, renderSlot, t, sessionId, useContextMenu, resolveFilePath,
|
||||
usePresentation, renderSlot, t, sessionId, useContextMenu, resolveFilePath, useProjection,
|
||||
}: AssistantNodeViewProps) {
|
||||
const { getTriggerProps } = useContextMenu()
|
||||
const getFileTriggerProps = useCallback((path: string) => 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 (
|
||||
<AssistantMarkdown
|
||||
blocks={data.blocks}
|
||||
@@ -61,6 +70,7 @@ export const AssistantNodeView = memo(function AssistantNodeView({
|
||||
renderSlot={renderSlot}
|
||||
revealProcess={revealProcess}
|
||||
mentions={mentions}
|
||||
resolvePath={resolvePath}
|
||||
t={t}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -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 })}
|
||||
</MarkdownDelegateProvider>
|
||||
<div ref={interactionSurfaceRef} className={css.textInteraction} data-text-interaction-surface=""
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/** Select the working directory that applied at one Session log position. */
|
||||
import type { WorkingDirectoryHistoryEntry } from '@deepseek-ai/dsh-working-directory/client'
|
||||
|
||||
/**
|
||||
* Find the directory in effect for an event: the last history entry whose seq
|
||||
* precedes the event's seq.
|
||||
* @param history - Ascending directory history, or undefined while it is unavailable.
|
||||
* @param seq - Seq of the event whose recorded paths are being resolved.
|
||||
* @returns the absolute directory, or undefined when no entry precedes `seq`.
|
||||
*/
|
||||
export function directoryAt(history: readonly WorkingDirectoryHistoryEntry[] | undefined, seq: number): string | undefined {
|
||||
let found: string | undefined
|
||||
for (const entry of history ?? []) {
|
||||
if (entry.seq >= seq) break
|
||||
found = entry.cwd
|
||||
}
|
||||
return found
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-s
|
||||
import type { KeyedSnapshotSelectorHook, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import { allowAllAccess, bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import { createSnapshotStore, type ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
||||
import type {} from '@deepseek-ai/dsh-working-directory/client'
|
||||
import type { ConnectionState } from '@deepseek-ai/dsh-client-connection/client'
|
||||
import { EMPTY_CONVERSATION_SNAPSHOT } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
import { en as commonEn } from '@deepseek-ai/dsh-client-locale/src/locales/en.ts'
|
||||
@@ -791,6 +792,44 @@ describe('Chat node rendering', () => {
|
||||
expect(h.openFile).toHaveBeenCalledWith('src/index.ts', { line: 24 })
|
||||
})
|
||||
|
||||
it('resolves each message\'s relative images and links from the directory current when it was written', () => {
|
||||
const h = makeHarness({
|
||||
nodes: [
|
||||
user(1, 'draw'), assistant(2, ' [notes](notes.md)', 1),
|
||||
user(6, 'again'), assistant(7, ' [notes again](notes.md)', 2),
|
||||
],
|
||||
turnEnds: new Map([[1, 2], [2, 7]]),
|
||||
})
|
||||
const sessions = createSnapshotStore<SessionListState>({
|
||||
ids: [SID], phase: 'ready', projectionsBySession: {},
|
||||
byId: { [SID]: { id: SID, displayTitle: 'proj', cwd: '/proj', running: false, blank: false, updatedAt: 1, retainedBy: {} } },
|
||||
})
|
||||
h.props.useSessions = bindSnapshotSelector(sessions)
|
||||
const projections = createSnapshotStore<Record<string, unknown>>({
|
||||
workingDirectory: '/proj/w',
|
||||
workingDirectoryHistory: [{ seq: 0, cwd: '/proj' }, { seq: 4, cwd: '/proj/w' }],
|
||||
})
|
||||
const useProjections = bindSnapshotSelector(projections)
|
||||
const useOther = h.props.useProjection
|
||||
h.props.useProjection = (key: 'inbox', selector?: (value: never) => unknown) => {
|
||||
const value: unknown = useProjections(values => values[key])
|
||||
const other: unknown = useOther(key)
|
||||
const picked = key in projections.getSnapshot() ? value : other
|
||||
return selector === undefined ? picked : selector(picked as never)
|
||||
}
|
||||
const view = render(<h.ChatView {...h.props} />)
|
||||
const source = (name: string) => new URL(view.getByRole('img', { name }).getAttribute('src')!, document.baseURI).searchParams.get('path')
|
||||
expect(source('before')).toBe('/proj/tmp/a.png')
|
||||
expect(source('after')).toBe('/proj/w/tmp/a.png')
|
||||
fireEvent.click(view.getByRole('button', { name: 'notes' }))
|
||||
expect(h.openFile).toHaveBeenLastCalledWith('/proj/notes.md')
|
||||
fireEvent.click(view.getByRole('button', { name: 'notes again' }))
|
||||
expect(h.openFile).toHaveBeenLastCalledWith('/proj/w/notes.md')
|
||||
// Without a history, relative destinations fall back to the current directory.
|
||||
act(() => { projections.set({ workingDirectory: '/proj/w', workingDirectoryHistory: undefined }) })
|
||||
expect(source('before')).toBe('/proj/w/tmp/a.png')
|
||||
})
|
||||
|
||||
it('threads the injected file-mention vocabulary into the closing prose only', () => {
|
||||
const wrote = (seq: number, callId: string): ToolResultNode => ({
|
||||
...toolResult(seq, callId, 'write'),
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
{
|
||||
"path": "../../session/session-turn-outline"
|
||||
},
|
||||
{
|
||||
"path": "../../session/working-directory"
|
||||
},
|
||||
{
|
||||
"path": "../../subagent/subagent"
|
||||
},
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
en: fd3499ef403a0594
|
||||
zh: 3a17727316d3c666
|
||||
/deepseek-ai-dsh-client-ui-primitives/use-this-package/rendering-agent-output:
|
||||
en: 7fed4894a6d0d568
|
||||
zh: c22881bfcef2d4b6
|
||||
en: 2ee1078604fc12d4
|
||||
zh: f8417d691c7ad31a
|
||||
/deepseek-ai-dsh-client-ui-primitives/use-this-package/localizing-copy:
|
||||
en: 3fd7072b662eed0a
|
||||
zh: 88c6c299c0a6f8cd
|
||||
|
||||
@@ -125,7 +125,7 @@ Explicit `./`, `../`, slash/backslash-rooted paths (including UNC), and Windows
|
||||
|
||||
`JsonTree` clamps collapsed strings to `collapsedStringLines` (three by default). Expanded strings show raw text, retain sibling commas, and fit within the window and outer scrolling containers. Resize and ancestor-scroll events update that limit. Row copy feedback updates independently of JSON value rendering; pending clipboard writes cannot update a different row or an unmounted tree.
|
||||
|
||||
`ImageLightbox` is the shared original-image modal with focus restoration and Escape dismissal. Like `Modal`, its mask leaves the Windows caption unpainted, and its close control sits 20px below the caption. The internal thumbnail renderer receives loading/failure labels from its owner. `HoverCard.inline` keeps a file link in the text flow and uses the shared menu material, keyboard-visible focus, and placement above or below the anchor without covering it. Its transparent hover region connects the anchor to the panel across the visual gap, so crossing the gap does not activate content beneath it. Escape closes an open thumbnail even when focus is elsewhere; subsequent Escape presses reach the owner. `MarkdownDelegateProvider.fileImages` supplies a decoded-path resolver and complete image labels: settled image links gain hover previews, and standalone images gain lightbox activation. Image-only anchors retain their single navigation target. The parser recovers only complete, unescaped, standalone local image references with bare spaces and an unambiguous supported image suffix; code and ambiguous destinations remain literal.
|
||||
`ImageLightbox` is the shared original-image modal with focus restoration and Escape dismissal. Like `Modal`, its mask leaves the Windows caption unpainted, and its close control sits 20px below the caption. The internal thumbnail renderer receives loading/failure labels from its owner. `HoverCard.inline` keeps a file link in the text flow and uses the shared menu material, keyboard-visible focus, and placement above or below the anchor without covering it. Its transparent hover region connects the anchor to the panel across the visual gap, so crossing the gap does not activate content beneath it. Escape closes an open thumbnail even when focus is elsewhere; subsequent Escape presses reach the owner. `MarkdownDelegateProvider.fileImages` supplies a decoded-path resolver and complete image labels: settled image links gain hover previews, and standalone images gain lightbox activation. `MarkdownText`'s `resolvePath` maps each decoded local link and image destination of settled renders before it reaches the delegate's file opener, image resolver, drag address, and object menus; rendered labels and alt text keep the authored path, and destinations pass unchanged without it. Image-only anchors retain their single navigation target. The parser recovers only complete, unescaped, standalone local image references with bare spaces and an unambiguous supported image suffix; code and ambiguous destinations remain literal.
|
||||
|
||||
`DraggableImage` receives explicit `fileDrag: FileDragActions`, also supplied through `MarkdownDelegateProvider.fileImages.fileDrag`. The [file-drag plugin](../ui-file-drag/README.md) owns preparation, transfer, and localized failure feedback; the image primitive manages gestures and cancellation. Resource-backed images prepare on primary pointer down; other sources also prepare on hover. Releasing inside the image preserves preparation for the next gesture; pointer leave releases unused preparation. Markdown export names use the decoded path basename. Panning images skip preparation. Starting before preparation finishes cancels that gesture quietly; an actual preparation failure reports a retry message. Managed Web transfers carry an application-local token and a `DownloadURL` pointing to a plugin-owned Blob URL, with no `text/plain` payload.
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ kind: "package-library"
|
||||
|
||||
`JsonTree` 把折叠字符串限制为 `collapsedStringLines` 行(默认三行)。展开后显示原始文本、保留同级逗号,并限制在窗口与外层滚动容器内;尺寸变化和祖先滚动事件会更新此限制。行复制反馈独立于 JSON 值渲染更新;尚未完成的剪贴板写入不会更新另一行或已卸载的树。
|
||||
|
||||
`ImageLightbox` 是共享原图浮层,支持焦点恢复与 Esc 关闭。与 `Modal` 相同,其遮罩不覆盖 Windows 顶栏,关闭按钮位于顶栏下方 20px。包内缩略图渲染器由调用方提供加载及失败文案。`HoverCard.inline` 使文件链接保持在文本流内,并使用共享菜单材质、键盘可见焦点,并在锚点上方或下方定位而不遮挡锚点。即使焦点位于其他位置,Esc 也会关闭已打开的缩略图;后续 Esc 按键继续传给 owner。`MarkdownDelegateProvider.fileImages` 提供已解码路径解析器与完整图片文案:消息落定后的图片链接支持悬停预览,独立图片支持点击放大。仅包含图片的链接保留单一导航目标。解析器仅恢复完整、未转义、独立成段且带明确图片扩展名的含裸空格本地图片引用;代码与有歧义的目标保持原文。 透明悬停区域连接锚点与弹层之间的视觉空隙,鼠标经过时不会激活下方内容。
|
||||
`ImageLightbox` 是共享原图浮层,支持焦点恢复与 Esc 关闭。与 `Modal` 相同,其遮罩不覆盖 Windows 顶栏,关闭按钮位于顶栏下方 20px。包内缩略图渲染器由调用方提供加载及失败文案。`HoverCard.inline` 使文件链接保持在文本流内,并使用共享菜单材质、键盘可见焦点,并在锚点上方或下方定位而不遮挡锚点。即使焦点位于其他位置,Esc 也会关闭已打开的缩略图;后续 Esc 按键继续传给 owner。`MarkdownDelegateProvider.fileImages` 提供已解码路径解析器与完整图片文案:消息落定后的图片链接支持悬停预览,独立图片支持点击放大。`MarkdownText` 的 `resolvePath` 会在落定渲染中每个已解码的本地链接与图片目标到达委托的文件打开、图片解析、拖放地址与对象菜单之前先做映射;显示的文字与 alt 仍保留原文路径,未传入时目标原样传递。仅包含图片的链接保留单一导航目标。解析器仅恢复完整、未转义、独立成段且带明确图片扩展名的含裸空格本地图片引用;代码与有歧义的目标保持原文。 透明悬停区域连接锚点与弹层之间的视觉空隙,鼠标经过时不会激活下方内容。
|
||||
|
||||
`DraggableImage` 接收显式的 `fileDrag: FileDragActions`,受管理的 Markdown 图片通过 `MarkdownDelegateProvider.fileImages.fileDrag` 接收同一组回调。[文件拖放插件](../ui-file-drag/README.zh.md) 负责准备、传递与本地化失败提示;图片原语负责手势和取消。带资源引用的图片仅在主指针按下时准备,其他来源也可在悬停时准备。在图片内松开保留准备供下一次手势使用;指针移开释放未使用的准备,平移模式跳过准备。Markdown 导出名取已解码路径的文件名。在准备完成前起拖会静默取消本次手势;实际准备失败才显示重试提示。受管理的 Web 拖放携带应用内令牌和指向插件所持 Blob URL 的 `DownloadURL`,不设置 `text/plain`。
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ export type { MarkdownDelegate, MarkdownDelegateProviderProps, MarkdownExternalL
|
||||
export { DetailDocument, detailDocumentState, useDetailDocumentLabels } from './DetailDocument.tsx'
|
||||
export type { DetailDocumentCopy, DetailDocumentLabels, DetailDocumentRead, DetailDocumentState } from './DetailDocument.tsx'
|
||||
export { MarkdownText } from './markdown/MarkdownText.tsx'
|
||||
export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages } from './markdown/MarkdownText.tsx'
|
||||
export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages, MarkdownPathResolver } from './markdown/MarkdownText.tsx'
|
||||
export { extractMarkdownPlainText } from './markdown/plain-text.ts'
|
||||
export type { MarkdownPlainTextMode, MarkdownPlainTextOptions } from './markdown/plain-text.ts'
|
||||
export * from './icons/index.tsx'
|
||||
|
||||
@@ -21,11 +21,13 @@ import {
|
||||
collectReferenceTargets, createReferenceTargets, renderBlocks, renderFootnoteSection,
|
||||
wrapBlockChildren,
|
||||
} from './render.tsx'
|
||||
import type { MarkdownFileMentions, MarkdownLabels, MarkdownPathImages, MarkdownRenderContext, ReferenceTargets } from './render.tsx'
|
||||
import type {
|
||||
MarkdownFileMentions, MarkdownLabels, MarkdownPathImages, MarkdownPathResolver, MarkdownRenderContext, ReferenceTargets,
|
||||
} from './render.tsx'
|
||||
import 'katex/dist/katex.min.css'
|
||||
import css from './MarkdownText.module.css'
|
||||
|
||||
export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages } from './render.tsx'
|
||||
export type { MarkdownCodeLabels, MarkdownFileMentions, MarkdownLabels, MarkdownPathImages, MarkdownPathResolver } from './render.tsx'
|
||||
|
||||
/** One settled full render: parse with math, resolve references, append the footnote section. */
|
||||
function renderSettled(
|
||||
@@ -33,6 +35,7 @@ function renderSettled(
|
||||
labels: MarkdownLabels,
|
||||
fileMentions: MarkdownFileMentions | undefined,
|
||||
pathImages: MarkdownPathImages | undefined,
|
||||
resolvePath: MarkdownPathResolver | undefined,
|
||||
omitHtml: boolean,
|
||||
): ReactNode[] {
|
||||
const root = parseGfmWithMath(text)
|
||||
@@ -43,6 +46,7 @@ function renderSettled(
|
||||
labels,
|
||||
fileMentions,
|
||||
pathImages,
|
||||
resolvePath,
|
||||
omitHtml,
|
||||
targets,
|
||||
footnoteOrder: [],
|
||||
@@ -116,6 +120,7 @@ class StreamingRenderer {
|
||||
labels: this.labels,
|
||||
fileMentions: undefined,
|
||||
pathImages: undefined,
|
||||
resolvePath: undefined,
|
||||
omitHtml: this.omitHtml,
|
||||
targets: frameTargets,
|
||||
footnoteOrder: this.frozenFootnoteOrder,
|
||||
@@ -136,6 +141,7 @@ class StreamingRenderer {
|
||||
labels: this.labels,
|
||||
fileMentions: undefined,
|
||||
pathImages: undefined,
|
||||
resolvePath: undefined,
|
||||
omitHtml: this.omitHtml,
|
||||
targets: frameTargets,
|
||||
footnoteOrder: [...this.frozenFootnoteOrder],
|
||||
@@ -165,7 +171,8 @@ class StreamingRenderer {
|
||||
* identity discards the streaming render cache mid-message. `fileMentions`
|
||||
* links inline-code tokens its resolver recognizes as real files, and
|
||||
* `pathImages` rewrites image destinations that are local file paths into
|
||||
* displayable URLs its resolver vouches for. Those two vocabularies are the
|
||||
* displayable URLs its resolver vouches for. `resolvePath` maps decoded local
|
||||
* link and image destinations before they reach the delegate. Those vocabularies are the
|
||||
* single streaming gate — they apply to settled renders only, because a
|
||||
* streaming message's vocabulary is not final and frozen cached elements
|
||||
* must not bake in handlers that could go stale. A surrounding
|
||||
@@ -187,13 +194,15 @@ class StreamingRenderer {
|
||||
* absolute HTTP(S) images render directly.
|
||||
*/
|
||||
export const MarkdownText = memo(function MarkdownText({
|
||||
text, streaming = false, labels, fileMentions, pathImages, variant = 'body', omitHtml = false, textInteractionSource = false,
|
||||
text, streaming = false, labels, fileMentions, pathImages, resolvePath, variant = 'body', omitHtml = false,
|
||||
textInteractionSource = false,
|
||||
}: {
|
||||
text: string
|
||||
streaming?: boolean
|
||||
labels: MarkdownLabels
|
||||
fileMentions?: MarkdownFileMentions | undefined
|
||||
pathImages?: MarkdownPathImages | undefined
|
||||
resolvePath?: MarkdownPathResolver | undefined
|
||||
variant?: 'body' | 'compact'
|
||||
omitHtml?: boolean
|
||||
textInteractionSource?: boolean
|
||||
@@ -203,14 +212,14 @@ export const MarkdownText = memo(function MarkdownText({
|
||||
const children = useMemo(() => {
|
||||
if (!streaming) {
|
||||
streamRef.current = null
|
||||
return renderSettled(text, labels, fileMentions, pathImages, omitHtml)
|
||||
return renderSettled(text, labels, fileMentions, pathImages, resolvePath, omitHtml)
|
||||
}
|
||||
if (streamRef.current === null || streamLabelsRef.current !== labels || streamRef.current.omitHtml !== omitHtml) {
|
||||
streamRef.current = new StreamingRenderer(labels, omitHtml)
|
||||
streamLabelsRef.current = labels
|
||||
}
|
||||
return streamRef.current.render(text)
|
||||
}, [text, streaming, labels, fileMentions, pathImages, omitHtml])
|
||||
}, [text, streaming, labels, fileMentions, pathImages, resolvePath, omitHtml])
|
||||
return <div className={clsx(css.markdown, variant === 'compact' && css.compact)}
|
||||
data-text-interaction-source={textInteractionSource ? '' : undefined}
|
||||
data-markdown-variant={variant === 'compact' ? variant : undefined}
|
||||
|
||||
@@ -187,6 +187,16 @@ export function collectReferenceTargets(
|
||||
* documented fallback (the image's alt text). Rewritten destinations must be
|
||||
* absolute; the renderer re-checks their protocol before emitting them.
|
||||
*/
|
||||
/**
|
||||
* Map one decoded local destination before it reaches the enclosing
|
||||
* `MarkdownDelegate`'s file opener, image resolver, drag address, and object
|
||||
* menus, for example against the directory current when a message was written.
|
||||
* Rendered labels, titles, and alt text keep the authored path.
|
||||
* @param path - Destination as the document authored it.
|
||||
* @returns Path passed to the delegate.
|
||||
*/
|
||||
export type MarkdownPathResolver = (path: string) => string
|
||||
|
||||
export interface MarkdownPathImages {
|
||||
/**
|
||||
* Resolve one authored image destination.
|
||||
@@ -233,6 +243,8 @@ export interface MarkdownRenderContext {
|
||||
readonly fileMentions: MarkdownFileMentions | undefined
|
||||
/** Local-path image vocabulary; absent wherever no rewriting owner exists. */
|
||||
readonly pathImages: MarkdownPathImages | undefined
|
||||
/** Local-destination mapping applied before delegate calls; absent wherever destinations pass unchanged. */
|
||||
readonly resolvePath: MarkdownPathResolver | undefined
|
||||
/** Raw HTML renders nothing instead of literal text. */
|
||||
readonly omitHtml: boolean
|
||||
/** Inside an anchor's children: interactive mentions must not nest there. */
|
||||
@@ -392,7 +404,7 @@ function renderNode(node: Md.RootContent, key: Key, context: MarkdownRenderConte
|
||||
case 'link':
|
||||
return renderAnchor(
|
||||
node.url, renderChildren(node.children, { ...context, inLink: true }), key,
|
||||
!anchorWrapsOnlyImages(node.children), context.streaming,
|
||||
!anchorWrapsOnlyImages(node.children), context,
|
||||
)
|
||||
case 'linkReference':
|
||||
return renderLinkReference(node, key, context)
|
||||
@@ -625,34 +637,36 @@ function MarkdownAnchor({ href, glyph, children }: {
|
||||
}
|
||||
|
||||
/** Local destinations use the scoped file delegate after settlement. */
|
||||
function renderAnchor(url: string, children: ReactNode[], key: Key, glyph = true, streaming = false): ReactNode {
|
||||
function renderAnchor(url: string, children: ReactNode[], key: Key, glyph: boolean, context: MarkdownRenderContext): ReactNode {
|
||||
const file = parseFileLink(url)
|
||||
if (file !== undefined) {
|
||||
if (streaming) return <Fragment key={key}>{children}</Fragment>
|
||||
return <MarkdownFileLink key={key} file={file} glyph={glyph}>{children}</MarkdownFileLink>
|
||||
if (context.streaming) return <Fragment key={key}>{children}</Fragment>
|
||||
return <MarkdownFileLink key={key} file={file} glyph={glyph} resolvePath={context.resolvePath}>{children}</MarkdownFileLink>
|
||||
}
|
||||
return renderSafeLink(normalizeUri(url), children, key, glyph)
|
||||
}
|
||||
|
||||
function MarkdownFileLink({ file, glyph, children }: {
|
||||
function MarkdownFileLink({ file, glyph, resolvePath, children }: {
|
||||
readonly file: { path: string; line?: number }
|
||||
readonly glyph: boolean
|
||||
readonly resolvePath: MarkdownPathResolver | undefined
|
||||
readonly children: ReactNode[]
|
||||
}): ReactNode {
|
||||
const { openFile, fileImages, getTriggerProps } = useMarkdownDelegate()
|
||||
const [load] = useState(nextImageLoad)
|
||||
if (openFile === undefined) return <>{children}</>
|
||||
const target = { ...file, path: resolvePath?.(file.path) ?? file.path }
|
||||
// Pure-image anchors already contain their preview and keep one navigation target.
|
||||
const preview = glyph && classifyLinkPath(file.path) === 'image' ? fileImages : undefined
|
||||
const resolved = preview?.resolve(file.path)
|
||||
const resolved = preview?.resolve(target.path)
|
||||
const src = resolved === undefined ? undefined : freshImageUrl(resolved, load)
|
||||
const anchor = (
|
||||
<button
|
||||
type="button"
|
||||
className={clsx(css.fileMention, css.fileLink)}
|
||||
title={src === undefined ? file.path : undefined}
|
||||
{...getTriggerProps?.({ kind: 'file', ...file })}
|
||||
onClick={() => { openFile(file.path, file.line === undefined ? undefined : { line: file.line }) }}
|
||||
{...getTriggerProps?.({ kind: 'file', ...target })}
|
||||
onClick={() => { openFile(target.path, target.line === undefined ? undefined : { line: target.line }) }}
|
||||
>
|
||||
{glyph && <LinkIconMedium kind={classifyLinkPath(file.path)} className={css.linkIcon} />}
|
||||
{children}
|
||||
@@ -682,30 +696,35 @@ function inlineCodeHttpUrl(value: string): string | undefined {
|
||||
}
|
||||
|
||||
function renderImage(url: string, alt: string, key: Key, context: MarkdownRenderContext): ReactNode {
|
||||
return <MarkdownImage key={`${key}:${url}`} destination={url} alt={alt}
|
||||
pathImages={context.pathImages} streaming={context.streaming} inLink={context.inLink === true} />
|
||||
return <MarkdownImage key={`${key}:${url}`} destination={url} alt={alt} pathImages={context.pathImages}
|
||||
resolvePath={context.resolvePath} streaming={context.streaming} inLink={context.inLink === true} />
|
||||
}
|
||||
|
||||
function MarkdownImage({ destination, alt, pathImages, streaming, inLink }: {
|
||||
function MarkdownImage({ destination, alt, pathImages, resolvePath, streaming, inLink }: {
|
||||
destination: string
|
||||
alt: string
|
||||
pathImages: MarkdownPathImages | undefined
|
||||
resolvePath: MarkdownPathResolver | undefined
|
||||
streaming: boolean
|
||||
inLink: boolean
|
||||
}): ReactNode {
|
||||
const { fileImages } = useMarkdownDelegate()
|
||||
const [load] = useState(nextImageLoad)
|
||||
const file = streaming ? undefined : parseFileLink(destination)
|
||||
const resolved = file === undefined ? undefined : fileImages?.resolve(file.path)
|
||||
const targetPath = file === undefined ? undefined : resolvePath?.(file.path) ?? file.path
|
||||
const resolved = targetPath === undefined ? undefined : fileImages?.resolve(targetPath)
|
||||
const src = resolved === undefined ? imageSource(destination, pathImages, load) : freshImageUrl(resolved, load)
|
||||
if (src === undefined) return <span className={css.imageAlt}>{alt}</span>
|
||||
return <LoadedMarkdownImage key={src} src={src} alt={alt} destination={destination} preview={inLink ? undefined : fileImages} />
|
||||
return <LoadedMarkdownImage key={src} src={src} alt={alt} destination={destination} targetPath={targetPath}
|
||||
preview={inLink ? undefined : fileImages} />
|
||||
}
|
||||
|
||||
function LoadedMarkdownImage({ src, alt, destination, preview }: {
|
||||
function LoadedMarkdownImage({ src, alt, destination, targetPath, preview }: {
|
||||
src: string
|
||||
alt: string
|
||||
destination: string
|
||||
/** Mapped local path of `destination`; undefined for non-file destinations and streaming renders. */
|
||||
targetPath: string | undefined
|
||||
preview: ReturnType<typeof useMarkdownDelegate>['fileImages']
|
||||
}): ReactNode {
|
||||
const { getTriggerProps } = useMarkdownDelegate()
|
||||
@@ -714,7 +733,7 @@ function LoadedMarkdownImage({ src, alt, destination, preview }: {
|
||||
const close = useCallback(() => { setOpen(false) }, [])
|
||||
if (failed) return <span className={css.imageAlt}>{preview === undefined ? '' : `${preview.labels.failed} · `}{alt || destination}</span>
|
||||
const file = parseFileLink(destination)
|
||||
const contextMenuProps = getTriggerProps?.({ kind: 'image', url: src, ...(file === undefined ? {} : { path: file.path }) })
|
||||
const contextMenuProps = getTriggerProps?.({ kind: 'image', url: src, ...(targetPath === undefined ? {} : { path: targetPath }) })
|
||||
const imageProps = { className: css.image, src, alt, onError: () => { setFailed(true) },
|
||||
loading: 'lazy' as const, decoding: 'async' as const, referrerPolicy: 'no-referrer' as const }
|
||||
if (preview === undefined) return <img {...imageProps} {...contextMenuProps} />
|
||||
@@ -724,7 +743,7 @@ function LoadedMarkdownImage({ src, alt, destination, preview }: {
|
||||
const img = <DraggableImage
|
||||
fileDrag={preview.fileDrag}
|
||||
{...imageProps}
|
||||
resourceAddress={file === undefined ? undefined : preview.resourceAddress?.(file.path)}
|
||||
resourceAddress={targetPath === undefined ? undefined : preview.resourceAddress?.(targetPath)}
|
||||
name={exportName}
|
||||
/>
|
||||
return <>
|
||||
@@ -757,7 +776,7 @@ function renderLinkReference(
|
||||
return <Fragment key={key}>{'['}{renderChildren(node.children, context)}{referenceSuffix(node)}</Fragment>
|
||||
}
|
||||
const rendered = renderChildren(node.children, { ...context, inLink: true })
|
||||
return renderAnchor(definition.url, rendered, key, !anchorWrapsOnlyImages(node.children), context.streaming)
|
||||
return renderAnchor(definition.url, rendered, key, !anchorWrapsOnlyImages(node.children), context)
|
||||
}
|
||||
|
||||
function renderImageReference(
|
||||
|
||||
@@ -172,3 +172,23 @@ it('uses the fallback filename for an external image URL without a path', () =>
|
||||
mount('')
|
||||
expect(screen.getByRole('img').getAttribute('src')).toBe('https://example.com/')
|
||||
})
|
||||
|
||||
it('maps local destinations through resolvePath before every delegate call while showing the authored path', () => {
|
||||
const resolve = vi.fn((path: string) => `https://example.com/api/file?path=${encodeURIComponent(path)}`)
|
||||
const resourceAddress = vi.fn((path: string) => `dsh-resource://file/${path}`)
|
||||
const getTriggerProps = vi.fn(() => ({}))
|
||||
const openFile = vi.fn()
|
||||
render(<MarkdownDelegateProvider openFile={openFile} getTriggerProps={getTriggerProps}
|
||||
fileImages={{ fileDrag, resolve, resourceAddress, labels }}>
|
||||
<MarkdownText text={'\n\n[Notes](notes.md#L3) and [Shot](tmp/b.png)'} resolvePath={path => `/then/${path}`} />
|
||||
</MarkdownDelegateProvider>)
|
||||
expect(new URL(screen.getByRole('img', { name: 'Chart' }).getAttribute('src')!).searchParams.get('path')).toBe('/then/tmp/a.png')
|
||||
expect(resolve).toHaveBeenCalledWith('/then/tmp/b.png')
|
||||
expect(resolve).not.toHaveBeenCalledWith('tmp/a.png')
|
||||
expect(resourceAddress).toHaveBeenCalledWith('/then/tmp/a.png')
|
||||
expect(getTriggerProps).toHaveBeenCalledWith(expect.objectContaining({ kind: 'image', path: '/then/tmp/a.png' }))
|
||||
expect(getTriggerProps).toHaveBeenCalledWith({ kind: 'file', path: '/then/notes.md', line: 3 })
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Notes' }))
|
||||
expect(openFile).toHaveBeenCalledWith('/then/notes.md', { line: 3 })
|
||||
expect(screen.getByRole('img', { name: 'Chart' }).getAttribute('alt')).toBe('Chart')
|
||||
})
|
||||
@@ -23,6 +23,7 @@ function makeContext(): MarkdownRenderContext {
|
||||
labels: markdownLabels,
|
||||
fileMentions: undefined,
|
||||
pathImages: undefined,
|
||||
resolvePath: undefined,
|
||||
omitHtml: false,
|
||||
targets: createReferenceTargets(),
|
||||
footnoteOrder: [],
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
en: 55d9e37b0a8dd4d8
|
||||
zh: 3acb6415f92698fb
|
||||
/packages-experimental/packages:
|
||||
en: b60443f52b61eab4
|
||||
zh: d8aacf1be8858fa3
|
||||
en: 699ef25d2e7d08de
|
||||
zh: ccd87e5b25b97eaf
|
||||
/packages-experimental/related-documentation:
|
||||
en: 40797d4849455966
|
||||
zh: bb91a68dd995887c
|
||||
|
||||
@@ -98,6 +98,7 @@ Promotion requires a named product role, documented public behavior and limitati
|
||||
| [`worktree`](worktree/README.md) | Creates a named Git worktree and changes the calling Session directory | `ctx.worktrees` |
|
||||
| [`forge`](forge/README.md) | Code host provider registry with shared change request polling | `ctx.forge` |
|
||||
| [`forge-github`](forge-github/README.md) | GitHub provider that reads pull requests through the host GitHub CLI | registers a provider on `ctx.forge` |
|
||||
| [`forge-gitlab`](forge-gitlab/README.md) | GitLab provider that reads and writes merge requests through the host GitLab CLI | registers a provider on `ctx.forge` |
|
||||
| [`forge-session`](forge-session/README.md) | Binds change requests to the Sessions that created, pushed, or tracked them | `ctx.forgeSession` |
|
||||
| [`client-ui-forge`](client-ui-forge/README.md) | GUI panel for a Session's Git checkout, worktrees, and bound pull requests | `ctx.forgePanel` |
|
||||
| [`forge-bundle`](forge-bundle/README.md) | Default-disabled pull request and worktree panel composition | — |
|
||||
|
||||
@@ -98,6 +98,7 @@ kind: "package-group"
|
||||
| [`worktree`](worktree/README.zh.md) | 创建具名 Git 工作树并改变调用 Session 的当前目录 | `ctx.worktrees` |
|
||||
| [`forge`](forge/README.zh.md) | 代码托管提供方注册表,共享变更请求轮询 | `ctx.forge` |
|
||||
| [`forge-github`](forge-github/README.zh.md) | 通过宿主 GitHub CLI 读取 pull request 的 GitHub 提供方 | 在 `ctx.forge` 上注册提供方 |
|
||||
| [`forge-gitlab`](forge-gitlab/README.zh.md) | 通过宿主 GitLab CLI 读写合并请求的 GitLab 提供方 | 在 `ctx.forge` 上注册提供方 |
|
||||
| [`forge-session`](forge-session/README.zh.md) | 把变更请求绑定到创建、推送或跟踪它们的 Session | `ctx.forgeSession` |
|
||||
| [`client-ui-forge`](client-ui-forge/README.zh.md) | 展示 Session 的 Git 检出、worktree 与已绑定 pull request 的 GUI 面板 | `ctx.forgePanel` |
|
||||
| [`forge-bundle`](forge-bundle/README.zh.md) | 默认禁用的 pull request 与 worktree 面板组合 | — |
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 2f8a621b991260a1
|
||||
/deepseek-ai-dsh-experimental-client-ui-forge/use-this-package:
|
||||
en: 40afd7bf9dca56f6
|
||||
zh: 7d8f8795a9f69643
|
||||
en: 240a0267069304b5
|
||||
zh: 1e28533a1706a37d
|
||||
/deepseek-ai-dsh-experimental-client-ui-forge/understand-the-implementation:
|
||||
en: 8a32164b43695f96
|
||||
zh: c5659ca104118d3b
|
||||
|
||||
@@ -36,7 +36,7 @@ Panel text follows the application language: Chinese, English, Japanese, Spanish
|
||||
- **Code review and changes** — on the right-sidebar start page, opens the same change request tab as the Session header button.
|
||||
- **Header button** — appears when the Session has bound change requests or its directory is inside a Git checkout, and shows or hides the tab. A red dot marks an open change request with failed checks, requested changes, or conflicts.
|
||||
- **Session list** — after a Session row's time, a branch glyph shows while the Session works in the worktree the panel created for it, and a glyph shows the state of its most urgent change request: one needing attention first, then open, draft, not yet polled, merged, and closed. The glyph of an open change request keeps the row's subdued color, with its head branch end filled in the color of running, passed, or failed checks; merged and closed ones keep their state colors. The row's hover card names the worktree branch and what it started from, then up to three change requests with their number, title, state, and checks, and how many more there are. A restart shows the states known before it until the next poll.
|
||||
- **Tab** — the first row names the checked-out branch, or the abbreviated commit on a detached HEAD, after a folder glyph for the project directory or a branch glyph for a worktree, and the kind of checkout, which is the worktree the Session created with its base, another worktree, or the project directory; its tooltip adds the path with the Host home shortened to `~`, its button copies the full path, and for a removed worktree it offers Restore. Below it, each change request card shows a glyph for its state, its title, which opens it in the browser, and its number; the glyph tells open, draft, merged, and closed apart, and marks an open one that is not a draft with failed checks, requested changes, or conflicts as needing attention, as the header button's red dot does. The card's header also offers Open in browser, Copy change request link, and Remove from this Session, whose toast offers Undo. Cancelled checks have a separate count; a collapsed card names cancellations when no listed check failed. A collapsed card adds the checks of an open change request and the most urgent of requested changes, conflicts, or draft, or when a merged or closed one ended. An expanded card shows the head and base branches, then one row per fact, each a glyph and its value. For an open change request, the rows are the checks, whose menu groups the failed, running, and cancelled checks with their durations and links, lists the passed and skipped ones on request, and offers Rerun failed when the user may rerun checks and a failed check names a rerun none of whose checks is still running; the review decision with the first three reviewers' avatars and how many more, whose menu lists each reviewer with their kind and latest outcome, notes an outcome given before the latest commit, and, when the user may request reviews, re-requests a review from a reviewer or requests one from someone else through a search that lists the host's suggestions first; the merge state, which names a head behind its base and, when the user may update it, offers Update branch, whose menu chooses merge or rebase, pins the displayed head when opened, and disables Confirm update once a poll names another head; the changed lines, formatted in the selected UI language, with the unresolved threads, whose count ends in `+` when the provider counted only some threads, in a row that opens the changes view; and the linked issues the host closes when the change request merges, each linking to its page. A merged or closed one shows when it ended and the changed lines. Rerun failed, a review request, Update branch, Ready for review, and Merge report their outcome in a toast, which asks to check the change request in the browser when the host did not confirm the outcome, and new commits since the displayed head stop a rerun or an update. An open draft also offers Ready for review; a change request the host would merge now offers Merge, whose menu lists the methods the repository allows with the user's usual one chosen and pins the displayed head when opened. Confirm merge uses that head; a polled head change disables confirmation until the menu is reopened after review. A toast reports each outcome, and new commits since that head stop the merge. When exactly one bound change request is open, its card starts expanded. Refresh inspects the checkout, checks sign-in, and polls every change request again; its icon turns until the inspection and the sign-in check end. A banner shows the `gh auth login` command when sign-in is missing.
|
||||
- **Tab** — the first row names the checked-out branch, or the abbreviated commit on a detached HEAD, after a folder glyph for the project directory or a branch glyph for a worktree, and the kind of checkout, which is the worktree the Session created with its base, another worktree, or the project directory; its tooltip adds the path with the Host home shortened to `~`, its button copies the full path, and for a removed worktree it offers Restore. Below it, each change request card shows a glyph for its state, its title, which opens it in the browser, and its number; the glyph tells open, draft, merged, and closed apart, and marks an open one that is not a draft with failed checks, requested changes, or conflicts as needing attention, as the header button's red dot does. The card's header also offers Open in browser, Copy change request link, and Remove from this Session, whose toast offers Undo. Cancelled checks have a separate count; a collapsed card names cancellations when no listed check failed. A collapsed card adds the checks of an open change request and the most urgent of requested changes, conflicts, or draft, or when a merged or closed one ended. An expanded card shows the head and base branches, then one row per fact, each a glyph and its value. For an open change request, the rows are the checks, whose menu groups the failed, running, and cancelled checks with their durations and links, lists the passed and skipped ones on request, and offers Rerun failed when the user may rerun checks and a failed check names a rerun none of whose checks is still running; the review decision with the first three reviewers' avatars and how many more, whose menu lists each reviewer with their kind and latest outcome, notes an outcome given before the latest commit, and, when the user may request reviews, re-requests a review from a reviewer or requests one from someone else through a search that lists the host's suggestions first; the merge state, which names a head behind its base and, when the user may update it, offers Update branch, whose menu chooses merge or rebase, pins the displayed head when opened, and disables Confirm update once a poll names another head; the changed lines, formatted in the selected UI language, with the unresolved threads, whose count ends in `+` when the provider counted only some threads, in a row that opens the changes view; and the linked issues the host closes when the change request merges, each linking to its page. A merged or closed one shows when it ended and the changed lines. Rerun failed, a review request, Update branch, Ready for review, and Merge report their outcome in a toast, which asks to check the change request in the browser when the host did not confirm the outcome, and new commits since the displayed head stop a rerun or an update. An open draft also offers Ready for review; a change request the host would merge now offers Merge, whose menu lists the methods the repository allows with the user's usual one chosen and pins the displayed head when opened. Confirm merge uses that head; a polled head change disables confirmation until the menu is reopened after review. A toast reports each outcome, and new commits since that head stop the merge. When exactly one bound change request is open, its card starts expanded. Refresh inspects the checkout, checks sign-in, and polls every change request again; its icon turns until the inspection and the sign-in check end. When sign-in is missing, a banner shows the sign-in command the provider names, such as `gh auth login --hostname github.com`, with a button that copies it.
|
||||
- **Local changes card** — whenever the `branch` scope changes files, independently of bound change requests, a card above the change requests names the ref it compares with, such as `HEAD → origin/main`, which is always the default base below, and shows the added and deleted lines and the number of files, which open the changes view; its file list, which names files as the changes view does, opens the view at one file. Create change request, offered when the code host repository is recognized and no open change request (including drafts) has the checked-out branch as its head, sends the Session a user message in the UI language that asks the Agent to create a change request for these changes, and a toast reports whether it was sent.
|
||||
- **Changes view** — The Changes row of an expanded change request card and the local changes card open a right-sidebar tab that lists the changed files. The local tab is named Local changes and shows Branch by default: the working tree and untracked files against the fork point. Its header names the checked-out branch, or the abbreviated commit on a detached HEAD, and the base branch, which opens a searchable menu: first Default, the base commit of the worktree the Session created, else the merge base of HEAD with the default branch of the code host remote, then remote-tracking and then local branches, each most recently committed first, without the checked-out branch and, outside a created worktree, without the remote-tracking branch Default already names. Typing filters the listed rows at once and lists the branches whose names contain the text, ignoring case, after a short pause; Enter chooses the first row. Choosing another branch compares with the merge base of HEAD and that branch. The tab keeps the choice while other scopes show; closing the tab or reloading the application returns it to Default. When the chosen branch is gone, its name is struck through, and when it shares no history with HEAD, the view says so as well; both offer Use the default base branch instead of Retry. A narrow view hides the note that uncommitted changes count, then the checked-out branch. Uncommitted compares them with HEAD, Unstaged with the index, and Staged compares the index with HEAD. A change request view shows the host's diff at its head and says how many commits the checked-out branch has beyond that head when it is the change request's head branch. The toolbar jumps to a file, totals the changed lines, refreshes, and switches between two columns and one and between wrapped and cut long lines. The toolbar and the header each keep one line: as the toolbar narrows, the line totals, expanding all files, two columns, and wrapping move into a More menu first, then the test file switch, with the viewed progress label shortened to a bare count beside its ring, and then refresh, while header buttons keep their labels on one line and the menus and title shorten. Visited changes tabs stay mounted across tab and Session switches, hiding the sidebar, and docking changes, preserving file folds, revealed large files, expanded context, layout, and scroll position while the diff is unchanged. Hidden changes views release their panel subscription and defer diff reads; returning reads again only when the latest head or local summary differs. A refresh that replaces the diff discards expanded context, and changed content may move the reading position. Temporary menus close when the view is hidden. Closing the tab or reloading the application discards this progress. Each file is a separate card, with a tinted header that stays at the top while its lines scroll. Files are named before their directories, which use smaller subdued type and shorten first; hovering one shows its complete path, and both paths for a renamed file. Each file shows badges for a new, deleted, or renamed file, the last naming the old file name, or the old path when only the directory changed, and, in the Branch scope, an untracked one, and a menu that copies its path and opens the whole file in the sidebar for local changes or its page at the head in the browser for a change request. When the header is narrow, the path, the badges, and Changed since viewed shorten, so the line counts, Viewed, and the menu stay whole. Unchanged lines between hunks collapse into rows that expand from the file's new side: the working tree, the index for Staged, or the head commit through the code host; a file that changed after the diff was read stays collapsed until the view reads again. A binary file and an untracked file over `maxDiffBytes` show a note instead of their lines, a file whose hunks draw more than 1,000 lines starts as one collapsed strip that names its changed lines and draws them when opened, and a file below files that change more than 5,000 lines starts collapsed. The view reads again on Refresh and the page refresh shortcut, on each navigation, when the change request's head moves, and when the Branch scope's summary changes; a change request's view first waits for the status that names its head, unless no provider serves it or that poll failed. When the head moved past the latest status, the view keeps loading and reads again at the head of a status later than the one the read started with, at once when that status arrived during the read. While a read replaces changes already shown, the Refresh icon turns. A change request whose diff the code host or its provider refuses over a size limit, such as a GitHub diff whose output exceeds the provider's `maxOutputBytes`, says its changes are too large to show here and offers View in browser; another failed read offers Retry and, for a change request, View in browser. A change request's diff is downloaded once per hLine truncated
|
||||
|
||||
@@ -50,7 +50,7 @@ The diff follows the file tree’s depth-first order: directories before files,
|
||||
|
||||
`gitCommand`, `gitTimeoutMs`, `graceMs`, `maxOutputBytes`, `readinessTimeoutMs`, `maxBranches`, `worktreePrefix`, `maxDiffBytes`, `maxUntrackedFiles`, `maxCachedDiffBytes`, `maxCachedReviewBytes`, `reviewRefreshMs`, `maxCommits`, `testPaths`, `interfacePaths`, `lensTimeoutMs`, `maxLensReadBytes`, `maxCachedLensBytes`, and `maxAnnotationsPerFile` are listed in the [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-experimental-client-ui-forge).
|
||||
|
||||
All files opens a searchable directory tree with the selected file scrolled to its middle. Single-child directories share a row, and renamed files also match their old path. A wide changes pane shows the same tree beside the diff; its File tree toolbar button cycles through left, right, and hidden, starting on the left. Its accessible name describes the next action, and focus stays on the button when it moves or hides the tree. The search, folds, selection, and width survive moving or hiding the tree and switching tabs or Sessions. Drag the divider or use its arrow keys to resize the tree. Files and folders reserve the same disclosure column so each child is indented from its parent. Local changes and each PR retain separate tabs. Select code text or use line numbers to select a range within one displayed hunk and side; text selection and copying stay on the starting side. The plus button opens the plain-text comment editor. With a mouse, hovering a line also shows a plus beside its line number, which stays clickable, on the hovered side in two columns and on the line's own side in one column; pressing it selects that line, dragging extends the range on that side, and releasing opens the editor. Several editors can stay open at once, and choosing the range of an open one focuses it again. In two columns, each comment sits under its own side of the row, so a left and a right comment share that row side by side, each continuing its line’s background. It accepts newlines and IME composition; only its action buttons submit the comment. Drag its lower edge to adjust the height. Add to input inserts a removable quote into the main composer that shows the file name, side and lines, and comment, and on hover the file path; multiple quotes are sent together only when the user sends that composer. Once the review threads are read and the user may review, the GitHub split button starts the user's pending review on GitHub with the comment, or adds the comment to it; the comment then shows as a thread tagged Pending, which only the user sees until the review is submitted. Its menu publishes a single comment immediately, which GitHub refuses while the user has a pending review, so the menu is then absent. Agent references and published comments remain beside their code. Request changes requires a review summary; the dialog explains this beside the summary field and announces the requirement when the decision changes. Submit review in the PR title bar opens a centered dialog showing only the pending count, summary, and Comment, Approve, or Request changes. With a pending review, it submits that review, keeping a submission whose outcome is unknown blocked until the user checks GitHub, as a direct submission is, and Discard review deletes the review and its comments after a confirmation; without one, it publishes the summary as one review. On the user's own pull request, which GitHub lets its author only comment on, Approve and Request changes are unavailable. Added and deleted files show only their populated line-number column. The summary, decision, and records of Agent references and published comments are stored in this browser per Session and tab, including the original PR head commit. Switching Sessions or hiding the pane retains them; closing the tab clears them, and reopening starts an empty summary. The pending review, published GitHub comments, and references already added to the main composer are unaffected. Comment drafts an earlier version kept in this browser stay beside their code tagged Browser draft and can be edited, deleted, or added to the pending review; they keep Submit review disabled while a pending review exists, and without one Submit review publishes them with the summary. Records whose code changed remain visible below their file, or after the diff when the file is absent. A changed head requires fresh line selections. While the tab remains open, an uncertain write stays blocked across reloads until the user checks GitHub and explicitly permits another submission.
|
||||
All files opens a searchable directory tree with the selected file scrolled to its middle. Single-child directories share a row, and renamed files also match their old path. A wide changes pane shows the same tree beside the diff; its File tree toolbar button cycles through left, right, and hidden, starting on the left. Its accessible name describes the next action, and focus stays on the button when it moves or hides the tree. The search, folds, selection, and width survive moving or hiding the tree and switching tabs or Sessions. Drag the divider or use its arrow keys to resize the tree. Files and folders reserve the same disclosure column so each child is indented from its parent. Local changes and each PR retain separate tabs. Select code text or use line numbers to select a range within one displayed hunk and side; text selection and copying stay on the starting side. The plus button opens the plain-text comment editor. With a mouse, hovering a line also shows a plus beside its line number, which stays clickable, on the hovered side in two columns and on the line's own side in one column; pressing it selects that line, dragging extends the range on that side, and releasing opens the editor. Several editors can stay open at once, and choosing the range of an open one focuses it again. In two columns, each comment sits under its own side of the row, so a left and a right comment share that row side by side, each continuing its line’s background. It accepts newlines and IME composition; only its action buttons submit the comment. Drag its lower edge to adjust the height. Add to input inserts a removable quote into the main composer that shows the file name, side and lines, and comment, and on hover the file path; multiple quotes are sent together only when the user sends that composer. Once the review threads are read and the user may review, the split button adds the comment to the user's pending review on the code host, starting one when there is none; the comment then shows as a thread tagged Pending, which only the user sees until the review is submitted. Its menu publishes a single comment immediately and is absent while the user has a pending review. Agent references and published comments remain beside their code. Request changes requires a review summary; the dialog explains this beside the summary field and announces the requirement when the decision changes. Submit review in the PR title bar opens a centered dialog showing only the pending count, summary, and Comment, Approve, or Request changes. With a pending review, it submits that review, keeping a submission whose outcome is unknown blocked until the user checks GitHub, as a direct submission is, and Discard review deletes the review and its comments after a confirmation; without one, it publishes the summary as one review. Decisions the code host does not let the user record are unavailable, such as Approve and Request changes on the user's own pull request on GitHub; when only Comment remains, the dialog says so. The view's copy names the code host and its word for a change request, such as GitHub and PR, after the change request's provider. Added and deleted files show only their populated line-number column. The summary, decision, and records of Agent references and published comments are stored in this browser per Session and tab, including the original PR head commit. Switching Sessions or hiding the pane retains them; closing the tab clears them, and reopening starts an empty summary. The pending review, published GitHub comments, and references already added to the main composer are unaffected. Comment drafts an earlier version kept in this browser stay beside their code tagged Browser draft and can be edited, deleted, or added to the pending review; they keep Submit review disabled while a pending review exists, and without one Submit review publishes them with the summary. Records whose code changed remain visible below their file, or after the diff when the file is absent. A changed head requires fresh line selections. While the tab remains open, an uncertain write stays blocked across reloads until the user checks GitHub and explicitly permits another submission.
|
||||
|
||||
-----
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ kind: "package-reference"
|
||||
- **代码审查和变更**——右侧栏起始页中的入口,与会话标题栏按钮打开同一个变更请求标签页。
|
||||
- **标题栏按钮**——Session 有已绑定的变更请求、或其目录位于 Git 检出中时出现,用来显示或隐藏标签页。打开状态的变更请求存在检查失败、被要求修改或冲突时,按钮带红点。
|
||||
- **会话列表**——Session 在面板为它创建的 worktree 中工作时,会话行的时间之后显示分支图标;另有一个图标显示它最需要关注的变更请求的状态,依次为需要处理、打开、草稿、尚未轮询、已合并、已关闭。打开中的变更请求图标保持会话行的浅色,head 分支端点填充为检查进行中、已通过或失败对应的颜色;已合并与已关闭的保留各自的状态颜色。会话行的悬浮卡片写出 worktree 分支及其起点,再列出最多三个变更请求的编号、标题、状态与检查,并说明还有多少个。重启后,下次轮询之前显示重启前已知的状态。
|
||||
- **标签页**——顶部一行显示当前检出的分支(分离 HEAD 时为缩写提交),项目目录前显示目录图标、worktree 前显示分支图标,并说明检出的类型(Session 创建的 worktree 及其基准、其他 worktree 或项目目录);它的提示给出路径,宿主主目录缩写为 `~`,旁边的按钮复制完整路径;worktree 已被删除时提供“恢复”。其下每张变更请求卡片显示状态图标、标题(点击在浏览器中打开)与编号;图标区分打开、草稿、已合并与已关闭,打开中的变更请求(草稿除外)检查失败、被要求修改或有冲突时显示为“需要处理”,与标题栏按钮的红点一致。卡片右上角还提供“在浏览器中打开”“复制变更请求链接”与“从本会话移除”,移除后的 toast 提供“撤销”。已取消的检查单独计数;列出的检查没有失败项时,折叠卡片显示取消数量。折叠的卡片还显示打开的变更请求的检查,以及被要求修改、冲突、草稿中最需要注意的一项;已合并或已关闭的则显示结束时间。展开的卡片显示源分支与目标分支,下面每项一行,由图标与取值组成。打开的变更请求依次是:检查,其菜单按失败、运行中、已取消分组列出检查及其耗时与链接,按需列出通过与跳过的检查,用户可以重跑检查、且有失败检查指向一个其中没有检查仍在进行的重跑时提供“重跑失败项”;评审结论,带前三位评审者的头像与其余人数,其菜单列出每位评审者的类型与最近结论,注明早于最新提交的结论,用户可以请求评审时还能重新请求某位评审者,或通过先列出托管平台建议的搜索向其他人请求评审;合并状态,会注明 head 落后于基线,用户可以更新时提供“更新分支”,其菜单在 merge 与 rebase 之间选择,打开时固定卡片显示的 head,轮询发现 head 变化后禁用“确认更新”;按所选界面语言格式化的变更行数与未解决讨论数(提供方只统计了部分讨论时数字后带 `+`),点击该行打开变更视图;以及合并时托管平台会关闭的关联 issue,各自链接到其页面。已合并或已关闭的显示结束时间与变更行数。“重跑失败项”、评审请求、“更新分支”、“标记为可评审”与“合并”的结果都以 toast 报告,托管平台未确认结果时提示到浏览器中查看变更请求;显示的 head 之后有新提交时不会重跑或更新。打开中的草稿还提供“标记为可评审”;主机现在就会合并的变更请求提供“合并”,其菜单列出仓库允许的合并方式并选中用户常用的一种,打开时固定卡片显示的 head。“确认合并”使用这个 head;轮询发现 head 变化后禁用确认,需重新检查并打开菜单。每次操作的结果都以 toast 报告;该 head 之后有新提交时不会合并。恰好有一个已绑定的变更请求处于打开状态时,它的卡片默认展开。刷新会重新检查检出与登录状态,并立即再次轮询每个变更请求;检查与登录状态确认结束前,刷新图标持续旋转。缺少登录时,横幅显示 `gh auth login` 命令。
|
||||
- **标签页**——顶部一行显示当前检出的分支(分离 HEAD 时为缩写提交),项目目录前显示目录图标、worktree 前显示分支图标,并说明检出的类型(Session 创建的 worktree 及其基准、其他 worktree 或项目目录);它的提示给出路径,宿主主目录缩写为 `~`,旁边的按钮复制完整路径;worktree 已被删除时提供“恢复”。其下每张变更请求卡片显示状态图标、标题(点击在浏览器中打开)与编号;图标区分打开、草稿、已合并与已关闭,打开中的变更请求(草稿除外)检查失败、被要求修改或有冲突时显示为“需要处理”,与标题栏按钮的红点一致。卡片右上角还提供“在浏览器中打开”“复制变更请求链接”与“从本会话移除”,移除后的 toast 提供“撤销”。已取消的检查单独计数;列出的检查没有失败项时,折叠卡片显示取消数量。折叠的卡片还显示打开的变更请求的检查,以及被要求修改、冲突、草稿中最需要注意的一项;已合并或已关闭的则显示结束时间。展开的卡片显示源分支与目标分支,下面每项一行,由图标与取值组成。打开的变更请求依次是:检查,其菜单按失败、运行中、已取消分组列出检查及其耗时与链接,按需列出通过与跳过的检查,用户可以重跑检查、且有失败检查指向一个其中没有检查仍在进行的重跑时提供“重跑失败项”;评审结论,带前三位评审者的头像与其余人数,其菜单列出每位评审者的类型与最近结论,注明早于最新提交的结论,用户可以请求评审时还能重新请求某位评审者,或通过先列出托管平台建议的搜索向其他人请求评审;合并状态,会注明 head 落后于基线,用户可以更新时提供“更新分支”,其菜单在 merge 与 rebase 之间选择,打开时固定卡片显示的 head,轮询发现 head 变化后禁用“确认更新”;按所选界面语言格式化的变更行数与未解决讨论数(提供方只统计了部分讨论时数字后带 `+`),点击该行打开变更视图;以及合并时托管平台会关闭的关联 issue,各自链接到其页面。已合并或已关闭的显示结束时间与变更行数。“重跑失败项”、评审请求、“更新分支”、“标记为可评审”与“合并”的结果都以 toast 报告,托管平台未确认结果时提示到浏览器中查看变更请求;显示的 head 之后有新提交时不会重跑或更新。打开中的草稿还提供“标记为可评审”;主机现在就会合并的变更请求提供“合并”,其菜单列出仓库允许的合并方式并选中用户常用的一种,打开时固定卡片显示的 head。“确认合并”使用这个 head;轮询发现 head 变化后禁用确认,需重新检查并打开菜单。每次操作的结果都以 toast 报告;该 head 之后有新提交时不会合并。恰好有一个已绑定的变更请求处于打开状态时,它的卡片默认展开。刷新会重新检查检出与登录状态,并立即再次轮询每个变更请求;检查与登录状态确认结束前,刷新图标持续旋转。缺少登录时,横幅显示提供方给出的登录命令(例如 `gh auth login --hostname github.com`),并提供复制按钮。
|
||||
- **本地变更卡片**——`branch` 范围有文件变更时始终显示,不受已关联变更请求影响。变更请求列表上方的卡片显示比较的基准(例如 `HEAD → origin/main`,始终是下文的默认基准)以及新增、删除行数与文件数,点击打开变更视图;展开的文件列表像变更视图一样标出各个文件,点击某个文件时,变更视图定位到该文件。识别出代码托管仓库、且没有以当前检出分支为源分支的打开中变更请求(含草稿)时,卡片提供“创建变更请求”:它以界面语言向 Session 发送一条用户消息,请 Agent 为这些变更创建变更请求,并以 toast 报告是否已发送。
|
||||
- **变更视图**——展开的变更请求卡片上的“变更”一行与本地变更卡片会打开一个右侧边栏标签页,列出所有变更的文件。本地标签页名为“本地变更”,默认显示“分支”:工作树与未跟踪文件相对于分叉点的变更。它的标题栏写出当前检出的分支(分离 HEAD 时为缩写提交)与基准分支;点击基准分支打开可搜索的菜单:最前面是“默认”,即 Session 创建的 worktree 的基准提交,否则是 HEAD 与代码托管远端默认分支的合并基准;其后依次是远程跟踪分支与本地分支,各按最近提交排序,不含当前检出的分支,不在所创建的 worktree 中时也不含“默认”已经指向的远程跟踪分支。输入文字会立即筛选已列出的行,短暂停顿后列出名称包含该文字(不区分大小写)的分支;按 Enter 选择第一行。选择其他分支后,与 HEAD 和该分支的合并基准比较。标签页切换到其他范围时仍保留这个选择;关闭标签页或重新加载应用后回到“默认”。所选分支已不存在时,它的名称显示删除线;它与 HEAD 没有共同历史时,视图同样给出说明;两种情况都提供“使用默认基准分支”而不是“重试”。视图较窄时,先隐藏“包含未提交的修改”,再隐藏当前分支。“未提交”与 HEAD 比较,“未暂存”与暂存区比较,“已暂存”比较暂存区与 HEAD。变更请求的视图显示托管平台在其 head 处的 diff;当前检出分支就是该变更请求的源分支时,还会说明本地分支比该 head 多出几个提交。工具栏可以跳到某个文件、汇总变更行数、刷新,并在左右对比与单栏对比、自动换行与截断长行之间切换。工具栏和标题栏各自保持一行:工具栏变窄时,先把变更行数、全部展开、左右对比与自动换行收进“更多视图选项”菜单,再收起“隐藏测试文件”开关,已审阅进度的文字缩短为圆环旁的计数,最后收起刷新;标题栏的按钮文字不换行,菜单和标题先缩短。访问过的变更标签页会在切换标签页与 Session、隐藏侧边栏及调整停靠位置时保持挂载,在 diff 未改变时保留文件折叠、大文件展开、上下文展开、布局与滚动位置。隐藏的变更视图释放面板订阅并推迟 diff 读取;返回时仅在最新 head 或本地摘要不同时重新读取。刷新替换 diff 后会丢弃展开的上下文,内容变化也可能移动阅读位置。视图隐藏时关闭临时菜单。关闭标签页或重新加载应用后不保留这些进度。每个文件是一张独立的卡片,带浅色底的标题在滚动时停在顶部。文件名在前,目录在后,用更小的浅色字显示,空间不够时目录先缩短;悬停时显示完整路径,重命名的文件显示新旧两条路径。每个文件带有新文件、已删除、重命名的标记(重命名标记写出原文件名,只换了目录时写出原路径),“分支”范围下的未跟踪文件还标“未提交”;文件菜单可以复制路径,本地变更可在侧边栏打开整个文件,变更请求可在浏览器中查看该文件在 head 处的页面。标题变窄时,路径、标记和“有新改动”会缩短,行数、“已审阅”和文件菜单始终完整显示。hunk 之间未变更的行折叠成一行,点击后从文件的新版本展开:工作树、“已暂存”时为暂存区,或经托管平台读取的 head 提交;读取 diff 之后文件又有修改时不会展开,直到视图重新读取。二进制文件与超过 `maxDiffBytes` 的未跟踪文件只显示一条说明;hunk 超过 1,000 行的文件先显示为一条写出变更行数的折叠条,点击后才绘制;前面的文件累计变更超过 5,000 行后,其后的文件默认收起。刷新与页面刷新快捷键、每次导航、变更请求的 head 变化,以及“分支”范围的摘要变化时,视图都会重新读取;变更请求的视图会先等到给出 head 的状态再读取,除非没有提供方服务它或那次轮询失败。head 已越过最新状态时,视图保持加载,等到比读取开始时更新的状态后按其 head 重新读取;该状态在读取期间已到达时立即重读。重新读取已显示的变更时,刷新图标会旋转。托管平台或其提供方因超过大小上限拒绝给出 diff 的变更请求(例如 GitHub 上输出超过提供方 `maxOutputBytes` 的 diff)显示“变更太大,无法在这里显示”并提供“在浏览器中查看”;其他读取失败提供“重试”,变更请求还提供“在浏览器中查看”。变更请求的 diff 在缓存期间对每个 head 提交与目标分支只下载一次,因此在同一 head 下重新打开、刷新与导航都不会再从托管平台读取。刷新评审标记时,如果Line truncated
|
||||
|
||||
@@ -50,7 +50,7 @@ diff 按文件树的深度优先顺序排列:同层目录在前、文件在后
|
||||
|
||||
`gitCommand`、`gitTimeoutMs`、`graceMs`、`maxOutputBytes`、`readinessTimeoutMs`、`maxBranches`、`worktreePrefix`、`maxDiffBytes`、`maxUntrackedFiles`、`maxCachedDiffBytes`、`maxCachedReviewBytes`、`reviewRefreshMs`、`maxCommits`、`testPaths`、`interfacePaths`、`lensTimeoutMs`、`maxLensReadBytes`、`maxCachedLensBytes` 与 `maxAnnotationsPerFile` 列在[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-experimental-client-ui-forge)中。
|
||||
|
||||
“全部文件”打开可搜索的目录树,并把选中文件滚动到中间;只有一个子目录的路径会合并显示,重命名文件也可以按旧路径搜索。较宽的变更面板会在 diff 旁显示同一棵树,工具栏的“文件树”按钮按“左侧 → 右侧 → 隐藏”循环切换,默认显示在左侧。按钮的无障碍名称说明下一步操作,移动或隐藏文件树时焦点仍留在按钮上。移动或隐藏文件树,以及切换标签页与 Session 时保留搜索、折叠状态、选中文件和宽度。拖动分隔线,或聚焦分隔线后使用方向键,可以调整文件树宽度。文件与文件夹预留相同的展开箭头列,子项相对父目录向内缩进。本地变更与每个 PR 保留独立标签页。划选代码文字或通过行号选择同一已显示 hunk、同一侧的连续行,文字划选与复制都限定在起始侧。点击“+”打开纯文本评论框。使用鼠标时,悬停在某一行上也会在其行号旁显示“+”,行号仍可点击:两栏时显示在悬停的一侧,单栏时显示在该行所属的一侧;按下即选中这一行,拖动可在同一侧扩展范围,松开即打开评论框。可以同时打开多个评论框,再次选中已打开评论框的范围会回到该评论框。两栏时每条评论位于该行自己一侧的下方,左右两侧的评论并排处在同一行,各自延续所在行的底色。评论框支持换行和输入法组合输入,只有点击操作按钮才提交。可拖动底边调整高度。“添加到输入框”将评论作为可移除的引用加入主输入框,引用显示文件名、侧与行号以及评论,悬停时显示文件路径;多条引用只会在用户发送主输入框时一起发送。读到评审讨论且用户可以评审时,GitHub 分段按钮会用这条评论在 GitHub 上开始用户的待提交评审,或把评论加入其中;评论随后显示为带“待提交”标签的讨论,提交评审之前只有用户自己能看到。下拉菜单可以立即发布单条评论;用户有待提交评审时 GitHub 会拒绝单条评论,因此这时没有该菜单。Agent 引用和已发布的评论保留在对应代码旁。“请求更改”需要填写评审总结,弹窗在总结输入框旁说明此要求,并在切换评审决定时播报。PR 标题栏中的“提交评审”打开居中弹窗,只显示待提交数量、总结以及“评论”“批准”“请求更改”选项。有待提交评审时提交该评审,结果不明的提交与直接提交一样,在用户到 GitHub 核对之前阻止再次提交;“丢弃评审”在确认后删除该评审及其中的评论;没有待提交评审时,把总结作为一次评审发布。在用户自己的 PR 上,GitHub 只允许作者评论,因此“批准”和“请求更改”不可用。新建和删除文件只显示有内容的一侧行号。总结、评审决定,以及 Agent 引用与已发布评论的记录按 Session 和页签保存在当前浏览器,包括最初评审的 head。切换 Session 或隐藏面板时保留;关闭页签会清空它们,重新打开从空总结开始。待提交评审、已发布到 GitHub 的评论与已加入主输入框的引用不受影响。早期版本保存在此浏览器中的评论草稿保留在对应代码旁,带“浏览器草稿”标签,可以编辑、删除或加入待提交评审;存在待提交评审时,它们会让“提交评审”保持不可用;没有待提交评审时,“提交评审”把它们连同总结一起发布。head 变化后需要重新选择评论行。代码变化后的记录保留在文件末尾;文件已不在 diff 中时,记录显示在 diff 之后。页签保持打开时,结果不明的提交在重新加载后仍会阻止重复发送,直到用户检查 GitHub 并明确允许再次提交。
|
||||
“全部文件”打开可搜索的目录树,并把选中文件滚动到中间;只有一个子目录的路径会合并显示,重命名文件也可以按旧路径搜索。较宽的变更面板会在 diff 旁显示同一棵树,工具栏的“文件树”按钮按“左侧 → 右侧 → 隐藏”循环切换,默认显示在左侧。按钮的无障碍名称说明下一步操作,移动或隐藏文件树时焦点仍留在按钮上。移动或隐藏文件树,以及切换标签页与 Session 时保留搜索、折叠状态、选中文件和宽度。拖动分隔线,或聚焦分隔线后使用方向键,可以调整文件树宽度。文件与文件夹预留相同的展开箭头列,子项相对父目录向内缩进。本地变更与每个 PR 保留独立标签页。划选代码文字或通过行号选择同一已显示 hunk、同一侧的连续行,文字划选与复制都限定在起始侧。点击“+”打开纯文本评论框。使用鼠标时,悬停在某一行上也会在其行号旁显示“+”,行号仍可点击:两栏时显示在悬停的一侧,单栏时显示在该行所属的一侧;按下即选中这一行,拖动可在同一侧扩展范围,松开即打开评论框。可以同时打开多个评论框,再次选中已打开评论框的范围会回到该评论框。两栏时每条评论位于该行自己一侧的下方,左右两侧的评论并排处在同一行,各自延续所在行的底色。评论框支持换行和输入法组合输入,只有点击操作按钮才提交。可拖动底边调整高度。“添加到输入框”将评论作为可移除的引用加入主输入框,引用显示文件名、侧与行号以及评论,悬停时显示文件路径;多条引用只会在用户发送主输入框时一起发送。读到评审讨论且用户可以评审时,分段按钮会把这条评论加入用户在代码托管平台上的待提交评审,没有时先开始一个;评论随后显示为带“待提交”标签的讨论,提交评审之前只有用户自己能看到。下拉菜单可以立即发布单条评论;用户有待提交评审时没有该菜单。Agent 引用和已发布的评论保留在对应代码旁。“请求更改”需要填写评审总结,弹窗在总结输入框旁说明此要求,并在切换评审决定时播报。PR 标题栏中的“提交评审”打开居中弹窗,只显示待提交数量、总结以及“评论”“批准”“请求更改”选项。有待提交评审时提交该评审,结果不明的提交与直接提交一样,在用户到 GitHub 核对之前阻止再次提交;“丢弃评审”在确认后删除该评审及其中的评论;没有待提交评审时,把总结作为一次评审发布。代码托管平台不允许用户记录的结论不可用,例如在 GitHub 上用户自己的 PR 里,“批准”和“请求更改”不可用;只剩“评论”时,对话框会说明。视图中的文案按变更请求的提供方称呼代码托管平台及其对变更请求的叫法,例如 GitHub 和 PR。新建和删除文件只显示有内容的一侧行号。总结、评审决定,以及 Agent 引用与已发布评论的记录按 Session 和页签保存在当前浏览器,包括最初评审的 head。切换 Session 或隐藏面板时保留;关闭页签会清空它们,重新打开从空总结开始。待提交评审、已发布到 GitHub 的评论与已加入主输入框的引用不受影响。早期版本保存在此浏览器中的评论草稿保留在对应代码旁,带“浏览器草稿”标签,可以编辑、删除或加入待提交评审;存在待提交评审时,它们会让“提交评审”保持不可用;没有待提交评审时,“提交评审”把它们连同总结一起发布。head 变化后需要重新选择评论行。代码变化后的记录保留在文件末尾;文件已不在 diff 中时,记录显示在 diff 之后。页签保持打开时,结果不明的提交在重新加载后仍会阻止重复发送,直到用户检查 GitHub 并明确允许再次提交。
|
||||
|
||||
-----
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-workspace": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge-github": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-worktree": "workspace:*",
|
||||
"@deepseek-ai/dsh-fs": "workspace:*",
|
||||
|
||||
@@ -56,6 +56,7 @@ import { ChangedFilesMenu, type ChangedFilesProps, type ChangedFilesState } from
|
||||
import { drawnLines, matchesHunks, textLines } from './diff-rows.ts'
|
||||
import { ChangeRequestGlyph } from './glyphs.tsx'
|
||||
import type { ForgePanelKey, NS } from './locales.ts'
|
||||
import { useForgeCopy } from './forge-copy.ts'
|
||||
import { RefreshGlyph } from './RefreshGlyph.tsx'
|
||||
import { ViewOptionsMenu } from './ViewOptionsMenu.tsx'
|
||||
import type { ForgeLensDescription } from './changes-service.ts'
|
||||
@@ -518,14 +519,18 @@ function OrphanReviews({ path, actions, t }: PropsLocale<typeof NS> & {
|
||||
export function ChangesTab({
|
||||
useTabInfo, sessionId, useStore, actions, usePanel, reconnect, localDiff, diffBases, localText, localCommits, changeRequestDiff,
|
||||
changeRequestText, changeRequestCommits, changeRequestReview, changeRequestReviewWrite, viewedFiles, changeRequestViewed, setFileViewed,
|
||||
openLink, copyPath, createChangeRequest, addReviewToInput, addThreadToInput, reviewQueue, submitReview, report, useLenses, useExtensions,
|
||||
useAnnotations, changesLens, renderSlot, t,
|
||||
openLink, copyPath, createChangeRequest, addReviewToInput, addThreadToInput, reviewQueue, submitReview, report, useLenses,
|
||||
useExtensions, useAnnotations, changesLens, renderSlot, t: translate,
|
||||
}: ChangesTabProps): ReactNode {
|
||||
const { tab } = useTabInfo()
|
||||
const { navigation, signal } = tab
|
||||
const target = useMemo(() => parseChangesAddress(tab.contentId), [tab.contentId])
|
||||
if (target === undefined) throw new Error(`forge-panel: not a changes address "${tab.contentId}"`)
|
||||
const source = target.source
|
||||
const snapshot = usePanel(tab.visible ? 'visible' : 'inactive')
|
||||
const state = snapshot?.state ?? null
|
||||
const entry = source.kind === 'change' ? state?.changeRequests.find(item => item.url === source.url) : undefined
|
||||
const { t, host: hostCopy } = useForgeCopy(translate, source.kind === 'change' ? source.url : null, entry?.forge ?? null)
|
||||
const queue = reviewQueue(tab)
|
||||
useSyncExternalStore(queue.subscribe, queue.getStatus)
|
||||
const reviewState = queue.getSnapshot()
|
||||
@@ -556,7 +561,8 @@ export function ChangesTab({
|
||||
return message
|
||||
}
|
||||
if (!complete(result.url)) return t('review.unknown')
|
||||
report(request.kind === 'review' ? 'review.submitted' : 'review.published')
|
||||
if (request.kind === 'review') report('review.submitted')
|
||||
else report('review.published', hostCopy)
|
||||
if (request.kind === 'review') setReviewOpen(false)
|
||||
return undefined
|
||||
} catch (_error) {
|
||||
@@ -635,8 +641,6 @@ export function ChangesTab({
|
||||
}, [signal, actions, tab.id])
|
||||
const [attempt, setAttempt] = useState(0)
|
||||
useEffect(() => tab.actions.bindCommands({ refresh: () => { setAttempt(value => value + 1) } }), [tab.actions])
|
||||
const snapshot = usePanel(tab.visible ? 'visible' : 'inactive')
|
||||
const state = snapshot?.state ?? null
|
||||
const scope = choices?.scope ?? 'branch'
|
||||
const base = choices?.base ?? null
|
||||
const chosenCommits = choices?.commits ?? null
|
||||
@@ -653,7 +657,6 @@ export function ChangesTab({
|
||||
const listLocalCommits = useCallback((signal: AbortSignal) => localCommits(baseRef, signal), [localCommits, baseRef])
|
||||
const split = choices?.split ?? true
|
||||
const wrap = choices?.wrap ?? true
|
||||
const entry = source.kind === 'change' ? state?.changeRequests.find(item => item.url === source.url) : undefined
|
||||
// A read starts once the panel state arrives and again when what it describes moves. A change request's read
|
||||
// also waits for its first status, which names the head, unless no provider serves it or its first poll failed.
|
||||
const pending = entry !== undefined && entry.ref !== null && entry.update === null
|
||||
@@ -787,9 +790,9 @@ export function ChangesTab({
|
||||
const hostOwner = useMemo(() => data?.kind === 'change' && data.viewed !== null
|
||||
? { url: data.url, headSha: data.headSha, files: data.files, viewed: data.viewed } : null, [data])
|
||||
const host = useHostViewed(hostOwner, setFileViewed, (failure) => {
|
||||
if (failure.kind === 'stale') report('viewed.syncStale')
|
||||
if (failure.kind === 'stale') report('viewed.syncStale', hostCopy)
|
||||
else if (failure.kind === 'unknown') report('viewed.syncUnknown', { message: failure.message })
|
||||
else report('viewed.syncFailed', { message: failure.message })
|
||||
else report('viewed.syncFailed', { ...hostCopy, message: failure.message })
|
||||
})
|
||||
const marks = host?.marks ?? localMarks
|
||||
// The centered loader marks a first read; the toolbar's glyph turns only while shown changes are read again.
|
||||
@@ -912,8 +915,6 @@ export function ChangesTab({
|
||||
// the code host is submitted or discarded there; without one, the summary and any comment drafts kept in the browser
|
||||
// are published as one review.
|
||||
const pendingReview = review?.pendingReview ?? null
|
||||
// Logins compare without case, as GitHub's do.
|
||||
const ownChangeRequest = review?.viewer != null && prAuthor !== null && review.viewer.toLowerCase() === prAuthor.toLowerCase()
|
||||
const finishWrite = async (send: () => Promise<string | undefined>, done: ForgePanelKey): Promise<void> => {
|
||||
if (reviewRunning.current) return
|
||||
reviewRunning.current = true
|
||||
@@ -933,7 +934,8 @@ export function ChangesTab({
|
||||
}
|
||||
}
|
||||
const reviewForm = tab.visible && data !== null && reviewOpen && data.kind === 'change' && data.commits === null && <SubmitReview queue={queue}
|
||||
url={data.url} headSha={data.headSha} pending={pendingReview} own={ownChangeRequest} busy={reviewBusy} error={reviewError}
|
||||
url={data.url} headSha={data.headSha} pending={pendingReview} events={review?.reviewEvents ?? null} busy={reviewBusy}
|
||||
error={reviewError}
|
||||
close={() => { setReviewOpen(false) }}
|
||||
check={() => { openLink(data.url) }} reconcile={() => { queue.finish(false); setReviewError(null) }}
|
||||
submit={() => {
|
||||
@@ -1152,9 +1154,9 @@ export function ChangesTab({
|
||||
}), [reach, target])
|
||||
const reviewStarted = pendingReview !== null
|
||||
const publishingBlocked = reviewState.uncertain !== null
|
||||
// Comments on a commit range or on local changes go to the input only; a whole change request also takes GitHub comments:
|
||||
// into its pending review once the threads say the user may review, and on their own while the user has no pending
|
||||
// review, since GitHub refuses a single comment beside one.
|
||||
// Comments on a commit range or on local changes go to the input only; a whole change request also takes comments on the
|
||||
// code host: into its pending review once the threads say the user may review, and on their own while the user has no
|
||||
// pending review, since GitHub refuses a single comment beside one and the view keeps one rule for every host.
|
||||
const whole = data?.kind === 'change' && data.commits === null
|
||||
const queueable = whole && review?.viewerCanReview === true
|
||||
const single = whole && pendingReview === null
|
||||
|
||||
@@ -140,7 +140,7 @@ function SignIn({ state, copyText, t }: {
|
||||
if (readiness.state === 'unavailable') {
|
||||
return <div className={css.banner} role="status">{t('signin.unavailable', { host, message: readiness.message ?? '' })}</div>
|
||||
}
|
||||
const command = repository.forge === 'github' ? `gh auth login --hostname ${host}` : undefined
|
||||
const command = readiness.signIn?.command
|
||||
return (
|
||||
<div className={css.banner} role="status">
|
||||
<span>{t('signin.title', { host })}</span>
|
||||
|
||||
@@ -129,7 +129,7 @@ export function ReviewComposer({ selection, actions, close, visible = true, t }:
|
||||
})}
|
||||
{visible && actions.queue !== undefined && <SplitAction disabled={busy || actions.publishingBlocked === true || empty}
|
||||
label={t(busy ? 'review.publishing' : actions.reviewStarted === true ? 'review.queue' : 'review.startReview')}
|
||||
run={() => { void send(actions.queue) }} menuLabel={t('review.githubActions')}
|
||||
run={() => { void send(actions.queue) }} menuLabel={t('review.hostActions')}
|
||||
other={actions.publish === undefined ? undefined : t('review.publish')} menu={() => { void send(actions.publish) }} />}
|
||||
{actions.queue === undefined && actions.publish !== undefined && <Button size="sm" variant="primary"
|
||||
disabled={busy || actions.publishingBlocked === true || empty} onClick={() => { void send(actions.publish) }}>{t('review.publish')}</Button>}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useId, useState, useSyncExternalStore, type ReactNode } from 'react'
|
||||
import clsx from 'clsx'
|
||||
import { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { ForgePendingReview } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { ForgePendingReview, ForgeReviewEvent } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { ReviewQueue } from './review-queue.ts'
|
||||
import type { NS } from './locales.ts'
|
||||
import css from './SubmitReview.module.css'
|
||||
@@ -17,15 +17,15 @@ import reviewCss from './ReviewComposer.module.css'
|
||||
* @returns a portalled modal with keyboard focus ownership.
|
||||
*/
|
||||
export function SubmitReview({
|
||||
queue, url, headSha, pending, own, busy, error, submit, discard, close, check, reconcile, t,
|
||||
queue, url, headSha, pending, events, busy, error, submit, discard, close, check, reconcile, t,
|
||||
}: PropsLocale<typeof NS> & {
|
||||
readonly queue: ReviewQueue
|
||||
readonly url: string
|
||||
readonly headSha: string
|
||||
/** The signed-in user's pending review on the code host, or null without one. */
|
||||
readonly pending: ForgePendingReview | null
|
||||
/** Whether the signed-in user authored the change request, which the code host lets them only comment on. */
|
||||
readonly own: boolean
|
||||
/** Decisions the code host lets the signed-in user record, or null before the review threads are read, which offers all. */
|
||||
readonly events: readonly ForgeReviewEvent[] | null
|
||||
readonly busy: boolean
|
||||
readonly error: string | null
|
||||
readonly submit: () => void
|
||||
@@ -41,8 +41,11 @@ export function SubmitReview({
|
||||
const summaryHint = `${name}-summary-hint`
|
||||
const requiresSummary = state.event === 'request-changes'
|
||||
const locked = busy || state.uncertain !== null
|
||||
// A decision kept from another change request stays chosen until the reader picks Comment.
|
||||
const refused = own && state.event !== 'comment'
|
||||
const allowed = (event: ForgeReviewEvent): boolean => events === null || events.includes(event)
|
||||
// A decision kept from another change request stays chosen until the reader picks an allowed one.
|
||||
const refused = !allowed(state.event)
|
||||
// The host allows only comments, as GitHub does for the author of a pull request.
|
||||
const commentOnly = events !== null && events.length === 1 && events[0] === 'comment'
|
||||
const count = pending?.comments ?? state.comments.length
|
||||
// Drafts kept in the browser join only a review published without a pending one on the code host.
|
||||
const blocked = pending !== null && state.comments.length > 0
|
||||
@@ -79,12 +82,12 @@ export function SubmitReview({
|
||||
</div>
|
||||
<div className={css.decisions}>
|
||||
{(['comment', 'approve', 'request-changes'] as const).map(value => <label key={value}>
|
||||
<input type="radio" name={name} value={value} checked={state.event === value} disabled={locked || (own && value !== 'comment')}
|
||||
<input type="radio" name={name} value={value} checked={state.event === value} disabled={locked || !allowed(value)}
|
||||
onChange={() => { queue.summarize(state.body, value) }} />
|
||||
{t(value === 'comment' ? 'review.commentOnly' : value === 'approve' ? 'review.approve' : 'review.requestChanges')}
|
||||
</label>)}
|
||||
</div>
|
||||
{own && <div className={css.hint}>{t('review.ownChangeRequest')}</div>}
|
||||
{commentOnly && <div className={css.hint}>{t('review.decisionsLimited')}</div>}
|
||||
{notice !== null && <div className={css.error} role="alert">{notice}</div>}
|
||||
{state.uncertain !== null && !busy && <div className={css.reconcile}>
|
||||
<Button size="sm" variant="outline" onClick={check}>{t('review.recheck')}</Button>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/** Copy of one changes view that names the change request's code host and what the host calls a change request. */
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import type { ForgeDescription } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { NS } from './locales.ts'
|
||||
|
||||
/** The `forge` and `noun` parameters of copy that names the code host; a type alias so it passes as notice parameters. */
|
||||
export type HostParams = {
|
||||
/** Product name of the code host, such as `GitHub`. */
|
||||
readonly forge: string
|
||||
/** The code host's word for a change request, such as `PR`. */
|
||||
readonly noun: string
|
||||
}
|
||||
|
||||
/** The view's copy, given the `forge` and `noun` parameters, and those parameters for its notices. */
|
||||
export interface ForgeCopy {
|
||||
/** Translate a key; the caller's parameters override `forge` and `noun`. */
|
||||
readonly t: TranslateNS<typeof NS>
|
||||
/** The parameters, for notices whose copy names the code host. */
|
||||
readonly host: HostParams
|
||||
}
|
||||
|
||||
/**
|
||||
* Give every string of a changes view the code host's name as `forge` and its word for a change request as `noun`.
|
||||
* Without a provider for the change request, `forge` is the host name of its URL and `noun` the pull request word,
|
||||
* which only appears beside the read failures such a view shows.
|
||||
* @param translate - forge panel copy.
|
||||
* @param url - web URL of the change request, or null for local changes.
|
||||
* @param forge - how the change request's provider names itself, or null without one.
|
||||
* @returns copy with both parameters, and the parameters.
|
||||
*/
|
||||
export function useForgeCopy(translate: TranslateNS<typeof NS>, url: string | null, forge: ForgeDescription | null): ForgeCopy {
|
||||
const label = forge?.label ?? (url === null ? '' : hostOf(url))
|
||||
const noun = translate(forge?.changeRequestNoun === 'merge-request' ? 'noun.mergeRequest' : 'noun.pullRequest')
|
||||
return useMemo(() => {
|
||||
const host = { forge: label, noun }
|
||||
return { t: (key, params) => translate(key, { ...host, ...params }), host }
|
||||
}, [translate, label, noun])
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the host name of a web URL.
|
||||
* @param url - web URL.
|
||||
* @returns the host as written, or the whole URL when it names none.
|
||||
*/
|
||||
function hostOf(url: string): string {
|
||||
return /^[a-z][a-z\d+.-]*:\/\/([^/?#]+)/i.exec(url)?.[1] ?? url
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export const zh = {
|
||||
'toast.archiveCleanupScheduled': '已归档,工作树将被清理',
|
||||
'toast.archiveCleanupFailed': '已归档,工作树清理失败。分支已保留,请检查工作树。',
|
||||
'review.startReview': '开始评审',
|
||||
'review.githubActions': 'GitHub 评论选项',
|
||||
'review.hostActions': '{forge} 评论选项',
|
||||
'review.publishing': '发布中…',
|
||||
'review.submitting': '提交中…',
|
||||
'review.close': '关闭',
|
||||
@@ -41,24 +41,26 @@ export const zh = {
|
||||
'review.selectLine': '选择第 {line} 行',
|
||||
'review.inputFailed': '输入框暂时无法添加引用,请稍后重试',
|
||||
'review.saveFailed': '无法保存评审草稿,请检查浏览器存储后重试',
|
||||
'review.unknown': '无法确认提交结果。请先在 GitHub 核对,避免重复发布',
|
||||
'review.unknown': '无法确认提交结果。请先在 {forge} 核对,避免重复发布',
|
||||
'review.submit': '提交评审',
|
||||
'review.summary': '评审总结…',
|
||||
'review.approve': '批准',
|
||||
'review.requestChanges': '请求更改',
|
||||
'review.summaryRequired': '请求更改时,请填写评审总结',
|
||||
'review.ownChangeRequest': '这是你自己的 PR,GitHub 只允许评论,不能批准或请求更改',
|
||||
'review.decisionsLimited': '{forge} 只允许你在这个 {noun} 上发表评论,不能批准或请求更改',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': '评论',
|
||||
'review.drafts': '待提交评论({count})',
|
||||
'review.edit': '编辑',
|
||||
'review.remove': '删除',
|
||||
'review.stale': 'PR 已有新提交,请刷新并重新选择评论行',
|
||||
'review.published': '已发布到 GitHub',
|
||||
'review.stale': '{noun} 已有新提交,请刷新并重新选择评论行',
|
||||
'review.published': '已发布到 {forge}',
|
||||
'review.submitted': '已提交评审',
|
||||
'review.failed': '提交失败:{message}',
|
||||
'review.unsupported': '此代码托管服务不支持提交评审',
|
||||
'review.loadFailed': '无法读取评审草稿,请检查浏览器存储',
|
||||
'review.recheck': '在 GitHub 查看',
|
||||
'review.recheck': '在 {forge} 查看',
|
||||
'review.confirmRetry': '已核对,允许重新提交',
|
||||
'tab.title': '变更请求',
|
||||
'header.label': '本会话的变更请求',
|
||||
@@ -258,12 +260,12 @@ export const zh = {
|
||||
'viewed.progressAria': '已审阅的文件',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': '无法保存已审阅状态',
|
||||
'viewed.hintHost': '保存在 GitHub · 按 V 切换当前文件',
|
||||
'viewed.saving': '正在保存到 GitHub…',
|
||||
'viewed.unavailable': '未能读取 GitHub 上的已审阅状态',
|
||||
'viewed.readFailed': '未能读取 GitHub 上的已审阅状态,暂时不能标记文件:{message}',
|
||||
'viewed.syncFailed': '已审阅状态未能保存到 GitHub:{message}',
|
||||
'viewed.syncStale': 'PR 已有新提交,已审阅状态未保存。请刷新后再标记',
|
||||
'viewed.hintHost': '保存在 {forge} · 按 V 切换当前文件',
|
||||
'viewed.saving': '正在保存到 {forge}…',
|
||||
'viewed.unavailable': '未能读取 {forge} 上的已审阅状态',
|
||||
'viewed.readFailed': '未能读取 {forge} 上的已审阅状态,暂时不能标记文件:{message}',
|
||||
'viewed.syncFailed': '已审阅状态未能保存到 {forge}:{message}',
|
||||
'viewed.syncStale': '{noun} 已有新提交,已审阅状态未保存。请刷新后再标记',
|
||||
'viewed.syncUnknown': '未能确认已审阅状态是否已保存:{message}。刷新后可查看实际状态',
|
||||
'commits.all': '全部提交',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -392,7 +394,7 @@ export const zh = {
|
||||
'thread.empty': '还没有评审讨论',
|
||||
'thread.back': '返回变更',
|
||||
'thread.truncated': '讨论太多,只显示了前 {count} 个',
|
||||
'thread.openAll': '在 GitHub 中查看',
|
||||
'thread.openAll': '在 {forge} 中查看',
|
||||
'thread.replies': '{count} 条回复',
|
||||
'thread.fileLevel': '文件级讨论',
|
||||
'thread.onCommit': '在 {commit} 上',
|
||||
@@ -410,12 +412,12 @@ export const zh = {
|
||||
'thread.hideOriginal': '收起当时的文件',
|
||||
'thread.originalLoading': '正在读取当时的文件…',
|
||||
'thread.originalFailed': '无法读取当时的文件:{message}',
|
||||
'thread.openOnHost': '在 GitHub 中查看',
|
||||
'thread.openOnHost': '在 {forge} 中查看',
|
||||
'thread.unresolvedCount': '{count} 条未解决',
|
||||
'thread.unresolvedAria': '{name} 有 {count} 条未解决的讨论,跳到下一条',
|
||||
'thread.next': '跳到下一条未解决的讨论',
|
||||
'thread.treeCount': '{count} 条未解决的讨论',
|
||||
'thread.loadFailed': '无法读取 GitHub 讨论:{message}',
|
||||
'thread.loadFailed': '无法读取 {forge} 讨论:{message}',
|
||||
'thread.inputFailed': '输入框暂时无法添加这个讨论,请稍后重试',
|
||||
'thread.copy': '复制',
|
||||
'thread.copied': '复制成功',
|
||||
@@ -424,7 +426,7 @@ export const zh = {
|
||||
'thread.unwrap': '取消自动换行',
|
||||
'thread.footnotes': '脚注',
|
||||
'review.browserDraft': '浏览器草稿',
|
||||
'review.browserDrafts': '有 {count} 条评论草稿只保存在此浏览器中,不在 GitHub 的待提交评审里。请先将它们加入评审或删除',
|
||||
'review.browserDrafts': '有 {count} 条评论草稿只保存在此浏览器中,不在 {forge} 的待提交评审里。请先将它们加入评审或删除',
|
||||
'review.discard': '丢弃评审',
|
||||
'review.discardConfirm': '丢弃待提交的评审及其中的 {count} 条评论?此操作无法撤销',
|
||||
'review.discarding': '丢弃中…',
|
||||
@@ -441,9 +443,9 @@ export const zh = {
|
||||
'thread.deleting': '删除中…',
|
||||
'thread.deleteConfirm': '删除这条评论?',
|
||||
'thread.deleteLast': '删除这条评论?它是讨论中唯一的评论,讨论也会一并删除',
|
||||
'thread.writeUnknown': '无法确认 GitHub 是否已执行。正在重新读取讨论,请核对后再重试',
|
||||
'thread.writeFailed': 'GitHub 未执行此操作:{message}',
|
||||
'thread.writeStale': 'PR 已有新提交。讨论会按新提交重新读取,请核对后重试',
|
||||
'thread.writeUnknown': '无法确认 {forge} 是否已执行。正在重新读取讨论,请核对后再重试',
|
||||
'thread.writeFailed': '{forge} 未执行此操作:{message}',
|
||||
'thread.writeStale': '{noun} 已有新提交。讨论会按新提交重新读取,请核对后重试',
|
||||
'thread.writeUnsupported': '此代码托管服务不支持在这里修改讨论',
|
||||
} as const
|
||||
|
||||
@@ -462,7 +464,7 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Archived; the worktree will be cleaned up',
|
||||
'toast.archiveCleanupFailed': 'Archived; worktree cleanup failed. The branch is retained. Check the worktree.',
|
||||
'review.startReview': 'Start review',
|
||||
'review.githubActions': 'GitHub comment options',
|
||||
'review.hostActions': '{forge} comment options',
|
||||
'review.publishing': 'Publishing…',
|
||||
'review.submitting': 'Submitting…',
|
||||
'review.close': 'Close',
|
||||
@@ -488,24 +490,26 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Select line {line}',
|
||||
'review.inputFailed': 'The input cannot accept a reference yet. Try again shortly.',
|
||||
'review.saveFailed': 'Could not save the review draft. Check browser storage and try again.',
|
||||
'review.unknown': 'The submission outcome is unknown. Check GitHub before publishing again.',
|
||||
'review.unknown': 'The submission outcome is unknown. Check {forge} before publishing again.',
|
||||
'review.submit': 'Submit review',
|
||||
'review.summary': 'Review summary…',
|
||||
'review.approve': 'Approve',
|
||||
'review.requestChanges': 'Request changes',
|
||||
'review.summaryRequired': 'Enter a review summary to request changes.',
|
||||
'review.ownChangeRequest': 'This is your own PR. GitHub lets you comment on it, but not approve it or request changes.',
|
||||
'review.decisionsLimited': '{forge} lets you comment on this {noun}, but not approve it or request changes.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Comment',
|
||||
'review.drafts': 'Pending comments ({count})',
|
||||
'review.edit': 'Edit',
|
||||
'review.remove': 'Delete',
|
||||
'review.stale': 'The PR has new commits. Refresh and select the comment lines again.',
|
||||
'review.published': 'Published to GitHub',
|
||||
'review.stale': 'The {noun} has new commits. Refresh and select the comment lines again.',
|
||||
'review.published': 'Published to {forge}',
|
||||
'review.submitted': 'Review submitted',
|
||||
'review.failed': 'Submission failed: {message}',
|
||||
'review.unsupported': 'This code host does not support review submission.',
|
||||
'review.loadFailed': 'Could not read review drafts. Check browser storage.',
|
||||
'review.recheck': 'View on GitHub',
|
||||
'review.recheck': 'View on {forge}',
|
||||
'review.confirmRetry': 'Checked; allow resubmission',
|
||||
'tab.title': 'Change requests',
|
||||
'header.label': 'Change requests of this Session',
|
||||
@@ -705,12 +709,12 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Viewed files',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'Could not save the viewed state',
|
||||
'viewed.hintHost': 'Saved on GitHub · Press V to toggle the current file',
|
||||
'viewed.saving': 'Saving to GitHub…',
|
||||
'viewed.unavailable': 'Could not read viewed files from GitHub',
|
||||
'viewed.readFailed': 'Could not read viewed files from GitHub, so files cannot be marked: {message}',
|
||||
'viewed.syncFailed': 'Could not save the viewed mark to GitHub: {message}',
|
||||
'viewed.syncStale': 'The PR has new commits, so the viewed mark was not saved. Refresh and mark the file again.',
|
||||
'viewed.hintHost': 'Saved on {forge} · Press V to toggle the current file',
|
||||
'viewed.saving': 'Saving to {forge}…',
|
||||
'viewed.unavailable': 'Could not read viewed files from {forge}',
|
||||
'viewed.readFailed': 'Could not read viewed files from {forge}, so files cannot be marked: {message}',
|
||||
'viewed.syncFailed': 'Could not save the viewed mark to {forge}: {message}',
|
||||
'viewed.syncStale': 'The {noun} has new commits, so the viewed mark was not saved. Refresh and mark the file again.',
|
||||
'viewed.syncUnknown': 'Could not confirm that the viewed mark was saved: {message}. Refresh to see where it stands.',
|
||||
'commits.all': 'All commits',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -839,7 +843,7 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'No review threads yet',
|
||||
'thread.back': 'Back to changes',
|
||||
'thread.truncated': 'Too many threads; showing the first {count}',
|
||||
'thread.openAll': 'View on GitHub',
|
||||
'thread.openAll': 'View on {forge}',
|
||||
'thread.replies': '{count} replies',
|
||||
'thread.fileLevel': 'File thread',
|
||||
'thread.onCommit': 'on {commit}',
|
||||
@@ -857,12 +861,12 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Hide file at that commit',
|
||||
'thread.originalLoading': 'Reading the file at that commit…',
|
||||
'thread.originalFailed': 'Could not read the file at that commit: {message}',
|
||||
'thread.openOnHost': 'View on GitHub',
|
||||
'thread.openOnHost': 'View on {forge}',
|
||||
'thread.unresolvedCount': '{count} unresolved',
|
||||
'thread.unresolvedAria': '{name} has {count} unresolved threads; go to the next one',
|
||||
'thread.next': 'Go to the next unresolved thread',
|
||||
'thread.treeCount': '{count} unresolved threads',
|
||||
'thread.loadFailed': 'Could not read GitHub threads: {message}',
|
||||
'thread.loadFailed': 'Could not read {forge} threads: {message}',
|
||||
'thread.inputFailed': 'The input could not take this thread; try again later',
|
||||
'thread.copy': 'Copy',
|
||||
'thread.copied': 'Copied',
|
||||
@@ -871,7 +875,7 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'Do not wrap lines',
|
||||
'thread.footnotes': 'Footnotes',
|
||||
'review.browserDraft': 'Browser draft',
|
||||
'review.browserDrafts': '{count} comment drafts are saved only in this browser, not in your pending GitHub review. Add them to the review or delete them first.',
|
||||
'review.browserDrafts': '{count} comment drafts are saved only in this browser, not in your pending {forge} review. Add them to the review or delete them first.',
|
||||
'review.discard': 'Discard review',
|
||||
'review.discardConfirm': 'Discard your pending review and its {count} comments? This cannot be undone.',
|
||||
'review.discarding': 'Discarding…',
|
||||
@@ -888,9 +892,9 @@ export const en: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Deleting…',
|
||||
'thread.deleteConfirm': 'Delete this comment?',
|
||||
'thread.deleteLast': 'Delete this comment? It is the only comment, so the thread is deleted too.',
|
||||
'thread.writeUnknown': 'Could not confirm whether GitHub applied this. The threads are being read again; check them before retrying.',
|
||||
'thread.writeFailed': 'GitHub did not apply this: {message}',
|
||||
'thread.writeStale': 'The PR has new commits. The threads are read again at the new head; check them, then retry.',
|
||||
'thread.writeUnknown': 'Could not confirm whether {forge} applied this. The threads are being read again; check them before retrying.',
|
||||
'thread.writeFailed': '{forge} did not apply this: {message}',
|
||||
'thread.writeStale': 'The {noun} has new commits. The threads are read again at the new head; check them, then retry.',
|
||||
'thread.writeUnsupported': 'This code host does not support changing threads here.',
|
||||
}
|
||||
|
||||
@@ -913,7 +917,7 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'アーカイブしました。ワークツリーを削除します',
|
||||
'toast.archiveCleanupFailed': 'アーカイブしましたが、ワークツリーの削除に失敗しました。ブランチは保持されています。ワークツリーを確認してください。',
|
||||
'review.startReview': 'レビューを開始',
|
||||
'review.githubActions': 'GitHub コメントの操作',
|
||||
'review.hostActions': '{forge} コメントの操作',
|
||||
'review.publishing': '投稿中…',
|
||||
'review.submitting': '送信中…',
|
||||
'review.close': '閉じる',
|
||||
@@ -939,24 +943,26 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': '{line} 行を選択',
|
||||
'review.inputFailed': '入力欄に引用を追加できません。後でもう一度お試しください。',
|
||||
'review.saveFailed': 'レビューの下書きを保存できません。ブラウザーのストレージを確認してください。',
|
||||
'review.unknown': '送信結果を確認できません。再投稿する前に GitHub を確認してください。',
|
||||
'review.unknown': '送信結果を確認できません。再投稿する前に {forge} を確認してください。',
|
||||
'review.submit': 'レビューを送信',
|
||||
'review.summary': 'レビューの要約…',
|
||||
'review.approve': '承認',
|
||||
'review.requestChanges': '変更を要求',
|
||||
'review.summaryRequired': '変更を要求するには、レビューの概要を入力してください。',
|
||||
'review.ownChangeRequest': '自分の PR です。GitHub ではコメントのみ可能で、承認や変更の要求はできません。',
|
||||
'review.decisionsLimited': '{forge} では、この {noun} にはコメントのみ可能で、承認や変更の要求はできません。',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'コメント',
|
||||
'review.drafts': '保留中のコメント({count})',
|
||||
'review.edit': '編集',
|
||||
'review.remove': '削除',
|
||||
'review.stale': 'PR に新しいコミットがあります。更新してコメント行を選び直してください。',
|
||||
'review.published': 'GitHub に投稿しました',
|
||||
'review.stale': '{noun} に新しいコミットがあります。更新してコメント行を選び直してください。',
|
||||
'review.published': '{forge} に投稿しました',
|
||||
'review.submitted': 'レビューを送信しました',
|
||||
'review.failed': '送信に失敗しました:{message}',
|
||||
'review.unsupported': 'このホストはレビューの送信に対応していません。',
|
||||
'review.loadFailed': '下書きを読み込めません。ブラウザーのストレージを確認してください。',
|
||||
'review.recheck': 'GitHub で表示',
|
||||
'review.recheck': '{forge} で表示',
|
||||
'review.confirmRetry': '確認済み・再送信を許可',
|
||||
'list.worktree': '専用のワークツリー内',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -1156,12 +1162,12 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': '確認済みのファイル',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': '確認済みの状態を保存できませんでした',
|
||||
'viewed.hintHost': 'GitHub に保存 · V キーで現在のファイルを切り替え',
|
||||
'viewed.saving': 'GitHub に保存しています…',
|
||||
'viewed.unavailable': 'GitHub の確認済み状態を読み込めませんでした',
|
||||
'viewed.readFailed': 'GitHub の確認済み状態を読み込めないため、ファイルに印を付けられません:{message}',
|
||||
'viewed.syncFailed': '確認済みの印を GitHub に保存できませんでした:{message}',
|
||||
'viewed.syncStale': 'PR に新しいコミットがあるため、確認済みの印は保存されていません。更新してからもう一度付けてください。',
|
||||
'viewed.hintHost': '{forge} に保存 · V キーで現在のファイルを切り替え',
|
||||
'viewed.saving': '{forge} に保存しています…',
|
||||
'viewed.unavailable': '{forge} の確認済み状態を読み込めませんでした',
|
||||
'viewed.readFailed': '{forge} の確認済み状態を読み込めないため、ファイルに印を付けられません:{message}',
|
||||
'viewed.syncFailed': '確認済みの印を {forge} に保存できませんでした:{message}',
|
||||
'viewed.syncStale': '{noun} に新しいコミットがあるため、確認済みの印は保存されていません。更新してからもう一度付けてください。',
|
||||
'viewed.syncUnknown': '確認済みの印が保存されたか確認できませんでした:{message}。更新すると実際の状態を確認できます。',
|
||||
'commits.all': 'すべてのコミット',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -1290,7 +1296,7 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'レビュースレッドはまだありません',
|
||||
'thread.back': '変更に戻る',
|
||||
'thread.truncated': 'スレッドが多いため、最初の {count} 件のみ表示しています',
|
||||
'thread.openAll': 'GitHub で表示',
|
||||
'thread.openAll': '{forge} で表示',
|
||||
'thread.replies': '返信 {count} 件',
|
||||
'thread.fileLevel': 'ファイルへのスレッド',
|
||||
'thread.onCommit': '{commit} 上',
|
||||
@@ -1308,12 +1314,12 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': '当時のファイルを閉じる',
|
||||
'thread.originalLoading': '当時のファイルを読み込み中…',
|
||||
'thread.originalFailed': '当時のファイルを読み込めません:{message}',
|
||||
'thread.openOnHost': 'GitHub で表示',
|
||||
'thread.openOnHost': '{forge} で表示',
|
||||
'thread.unresolvedCount': '未解決 {count} 件',
|
||||
'thread.unresolvedAria': '{name} に未解決のスレッドが {count} 件あります。次のスレッドへ移動',
|
||||
'thread.next': '次の未解決のスレッドへ移動',
|
||||
'thread.treeCount': '未解決のスレッド {count} 件',
|
||||
'thread.loadFailed': 'GitHub のスレッドを読み込めません:{message}',
|
||||
'thread.loadFailed': '{forge} のスレッドを読み込めません:{message}',
|
||||
'thread.inputFailed': '入力欄にこのスレッドを追加できません。しばらくしてから再試行してください',
|
||||
'thread.copy': 'コピー',
|
||||
'thread.copied': 'コピーしました',
|
||||
@@ -1322,7 +1328,7 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': '行を折り返さない',
|
||||
'thread.footnotes': '脚注',
|
||||
'review.browserDraft': 'ブラウザーの下書き',
|
||||
'review.browserDrafts': '{count} 件のコメントの下書きはこのブラウザーにのみ保存され、GitHub の保留中のレビューに含まれていません。先にレビューに追加するか削除してください。',
|
||||
'review.browserDrafts': '{count} 件のコメントの下書きはこのブラウザーにのみ保存され、{forge} の保留中のレビューに含まれていません。先にレビューに追加するか削除してください。',
|
||||
'review.discard': 'レビューを破棄',
|
||||
'review.discardConfirm': '保留中のレビューとその {count} 件のコメントを破棄しますか?この操作は元に戻せません。',
|
||||
'review.discarding': '破棄中…',
|
||||
@@ -1339,9 +1345,9 @@ export const ja: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': '削除中…',
|
||||
'thread.deleteConfirm': 'このコメントを削除しますか?',
|
||||
'thread.deleteLast': 'このコメントを削除しますか?スレッド唯一のコメントのため、スレッドも削除されます。',
|
||||
'thread.writeUnknown': 'GitHub に反映されたか確認できません。スレッドを再読み込みしています。確認してから再試行してください。',
|
||||
'thread.writeFailed': 'GitHub はこの操作を実行しませんでした:{message}',
|
||||
'thread.writeStale': 'PR に新しいコミットがあります。新しいヘッドでスレッドを再読み込みします。確認してから再試行してください。',
|
||||
'thread.writeUnknown': '{forge} に反映されたか確認できません。スレッドを再読み込みしています。確認してから再試行してください。',
|
||||
'thread.writeFailed': '{forge} はこの操作を実行しませんでした:{message}',
|
||||
'thread.writeStale': '{noun} に新しいコミットがあります。新しいヘッドでスレッドを再読み込みします。確認してから再試行してください。',
|
||||
'thread.writeUnsupported': 'このホストでは、ここからスレッドを変更できません。',
|
||||
}
|
||||
|
||||
@@ -1357,7 +1363,7 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Archivado; se eliminará el árbol de trabajo',
|
||||
'toast.archiveCleanupFailed': 'Archivado; no se pudo eliminar el árbol de trabajo. La rama se conserva. Revisa el árbol de trabajo.',
|
||||
'review.startReview': 'Iniciar revisión',
|
||||
'review.githubActions': 'Opciones de comentario de GitHub',
|
||||
'review.hostActions': 'Opciones de comentario de {forge}',
|
||||
'review.publishing': 'Publicando…',
|
||||
'review.submitting': 'Enviando…',
|
||||
'review.close': 'Cerrar',
|
||||
@@ -1383,24 +1389,26 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Seleccionar línea {line}',
|
||||
'review.inputFailed': 'No se puede añadir la referencia. Inténtalo más tarde.',
|
||||
'review.saveFailed': 'No se pudo guardar el borrador. Comprueba el almacenamiento del navegador.',
|
||||
'review.unknown': 'El resultado del envío es desconocido. Comprueba GitHub antes de volver a publicar.',
|
||||
'review.unknown': 'El resultado del envío es desconocido. Comprueba {forge} antes de volver a publicar.',
|
||||
'review.submit': 'Enviar revisión',
|
||||
'review.summary': 'Resumen de la revisión…',
|
||||
'review.approve': 'Aprobar',
|
||||
'review.requestChanges': 'Solicitar cambios',
|
||||
'review.summaryRequired': 'Escribe un resumen de la revisión para solicitar cambios.',
|
||||
'review.ownChangeRequest': 'Este PR es tuyo. GitHub te permite comentarlo, pero no aprobarlo ni solicitar cambios.',
|
||||
'review.decisionsLimited': '{forge} te permite comentar este {noun}, pero no aprobarlo ni solicitar cambios.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Comentar',
|
||||
'review.drafts': 'Comentarios pendientes ({count})',
|
||||
'review.edit': 'Editar',
|
||||
'review.remove': 'Eliminar',
|
||||
'review.stale': 'El PR tiene nuevos commits. Actualiza y vuelve a seleccionar las líneas.',
|
||||
'review.published': 'Publicado en GitHub',
|
||||
'review.stale': 'El {noun} tiene nuevos commits. Actualiza y vuelve a seleccionar las líneas.',
|
||||
'review.published': 'Publicado en {forge}',
|
||||
'review.submitted': 'Revisión enviada',
|
||||
'review.failed': 'Error al enviar: {message}',
|
||||
'review.unsupported': 'Este servicio no admite el envío de revisiones.',
|
||||
'review.loadFailed': 'No se pudieron leer los borradores. Comprueba el almacenamiento del navegador.',
|
||||
'review.recheck': 'Ver en GitHub',
|
||||
'review.recheck': 'Ver en {forge}',
|
||||
'review.confirmRetry': 'Comprobado; permitir reenvío',
|
||||
'list.worktree': 'En su propio árbol de trabajo',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -1600,12 +1608,12 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Archivos revisados',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'No se pudo guardar el estado de revisión',
|
||||
'viewed.hintHost': 'Se guarda en GitHub · Pulsa V para cambiar el archivo actual',
|
||||
'viewed.saving': 'Guardando en GitHub…',
|
||||
'viewed.unavailable': 'No se pudo leer de GitHub qué archivos se revisaron',
|
||||
'viewed.readFailed': 'No se pudo leer de GitHub qué archivos se revisaron, así que no se pueden marcar: {message}',
|
||||
'viewed.syncFailed': 'No se pudo guardar la marca de revisión en GitHub: {message}',
|
||||
'viewed.syncStale': 'El PR tiene nuevos commits y la marca de revisión no se guardó. Actualiza y vuelve a marcar el archivo.',
|
||||
'viewed.hintHost': 'Se guarda en {forge} · Pulsa V para cambiar el archivo actual',
|
||||
'viewed.saving': 'Guardando en {forge}…',
|
||||
'viewed.unavailable': 'No se pudo leer de {forge} qué archivos se revisaron',
|
||||
'viewed.readFailed': 'No se pudo leer de {forge} qué archivos se revisaron, así que no se pueden marcar: {message}',
|
||||
'viewed.syncFailed': 'No se pudo guardar la marca de revisión en {forge}: {message}',
|
||||
'viewed.syncStale': 'El {noun} tiene nuevos commits y la marca de revisión no se guardó. Actualiza y vuelve a marcar el archivo.',
|
||||
'viewed.syncUnknown': 'No se pudo confirmar que la marca de revisión se guardara: {message}. Actualiza para ver su estado real.',
|
||||
'commits.all': 'Todos los commits',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -1734,7 +1742,7 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'Aún no hay hilos de revisión',
|
||||
'thread.back': 'Volver a los cambios',
|
||||
'thread.truncated': 'Hay demasiados hilos; se muestran los primeros {count}',
|
||||
'thread.openAll': 'Ver en GitHub',
|
||||
'thread.openAll': 'Ver en {forge}',
|
||||
'thread.replies': '{count} respuestas',
|
||||
'thread.fileLevel': 'Hilo del archivo',
|
||||
'thread.onCommit': 'en {commit}',
|
||||
@@ -1752,12 +1760,12 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Ocultar el archivo de ese commit',
|
||||
'thread.originalLoading': 'Leyendo el archivo de ese commit…',
|
||||
'thread.originalFailed': 'No se pudo leer el archivo de ese commit: {message}',
|
||||
'thread.openOnHost': 'Ver en GitHub',
|
||||
'thread.openOnHost': 'Ver en {forge}',
|
||||
'thread.unresolvedCount': '{count} sin resolver',
|
||||
'thread.unresolvedAria': '{name} tiene {count} hilos sin resolver; ir al siguiente',
|
||||
'thread.next': 'Ir al siguiente hilo sin resolver',
|
||||
'thread.treeCount': '{count} hilos sin resolver',
|
||||
'thread.loadFailed': 'No se pudieron leer los hilos de GitHub: {message}',
|
||||
'thread.loadFailed': 'No se pudieron leer los hilos de {forge}: {message}',
|
||||
'thread.inputFailed': 'El campo de entrada no pudo recibir este hilo; inténtalo más tarde',
|
||||
'thread.copy': 'Copiar',
|
||||
'thread.copied': 'Copiado',
|
||||
@@ -1766,7 +1774,7 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'No ajustar líneas',
|
||||
'thread.footnotes': 'Notas a pie de página',
|
||||
'review.browserDraft': 'Borrador del navegador',
|
||||
'review.browserDrafts': '{count} borradores de comentarios solo están guardados en este navegador, no en tu revisión pendiente de GitHub. Añádelos a la revisión o elimínalos primero.',
|
||||
'review.browserDrafts': '{count} borradores de comentarios solo están guardados en este navegador, no en tu revisión pendiente de {forge}. Añádelos a la revisión o elimínalos primero.',
|
||||
'review.discard': 'Descartar revisión',
|
||||
'review.discardConfirm': '¿Descartar tu revisión pendiente y sus {count} comentarios? No se puede deshacer.',
|
||||
'review.discarding': 'Descartando…',
|
||||
@@ -1783,9 +1791,9 @@ export const es: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Eliminando…',
|
||||
'thread.deleteConfirm': '¿Eliminar este comentario?',
|
||||
'thread.deleteLast': '¿Eliminar este comentario? Es el único del hilo, así que también se elimina el hilo.',
|
||||
'thread.writeUnknown': 'No se pudo confirmar si GitHub aplicó el cambio. Se están volviendo a leer los hilos; revísalos antes de reintentar.',
|
||||
'thread.writeFailed': 'GitHub no aplicó el cambio: {message}',
|
||||
'thread.writeStale': 'El PR tiene nuevos commits. Los hilos se vuelven a leer en el nuevo head; revísalos y reintenta.',
|
||||
'thread.writeUnknown': 'No se pudo confirmar si {forge} aplicó el cambio. Se están volviendo a leer los hilos; revísalos antes de reintentar.',
|
||||
'thread.writeFailed': '{forge} no aplicó el cambio: {message}',
|
||||
'thread.writeStale': 'El {noun} tiene nuevos commits. Los hilos se vuelven a leer en el nuevo head; revísalos y reintenta.',
|
||||
'thread.writeUnsupported': 'Este servicio no admite cambiar hilos desde aquí.',
|
||||
}
|
||||
|
||||
@@ -1801,7 +1809,7 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Archivé ; l’arbre de travail sera supprimé',
|
||||
'toast.archiveCleanupFailed': 'Archivé ; échec de la suppression de l’arbre de travail. La branche est conservée. Vérifiez l’arbre de travail.',
|
||||
'review.startReview': 'Commencer la revue',
|
||||
'review.githubActions': 'Options de commentaire GitHub',
|
||||
'review.hostActions': 'Options de commentaire {forge}',
|
||||
'review.publishing': 'Publication…',
|
||||
'review.submitting': 'Envoi…',
|
||||
'review.close': 'Fermer',
|
||||
@@ -1827,24 +1835,26 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Sélectionner la ligne {line}',
|
||||
'review.inputFailed': 'Impossible d’ajouter la référence. Réessayez plus tard.',
|
||||
'review.saveFailed': 'Impossible d’enregistrer le brouillon. Vérifiez le stockage du navigateur.',
|
||||
'review.unknown': 'Le résultat de l’envoi est inconnu. Vérifiez GitHub avant de republier.',
|
||||
'review.unknown': 'Le résultat de l’envoi est inconnu. Vérifiez {forge} avant de republier.',
|
||||
'review.submit': 'Envoyer la revue',
|
||||
'review.summary': 'Résumé de la revue…',
|
||||
'review.approve': 'Approuver',
|
||||
'review.requestChanges': 'Demander des modifications',
|
||||
'review.summaryRequired': 'Saisissez un résumé de la revue pour demander des modifications.',
|
||||
'review.ownChangeRequest': 'Cette PR est la vôtre. GitHub vous permet de la commenter, mais pas de l’approuver ni de demander des modifications.',
|
||||
'review.decisionsLimited': '{forge} vous permet de commenter cette {noun}, mais pas de l’approuver ni de demander des modifications.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Commenter',
|
||||
'review.drafts': 'Commentaires en attente ({count})',
|
||||
'review.edit': 'Modifier',
|
||||
'review.remove': 'Supprimer',
|
||||
'review.stale': 'La PR contient de nouveaux commits. Actualisez et sélectionnez à nouveau les lignes.',
|
||||
'review.published': 'Publié sur GitHub',
|
||||
'review.stale': 'La {noun} contient de nouveaux commits. Actualisez et sélectionnez à nouveau les lignes.',
|
||||
'review.published': 'Publié sur {forge}',
|
||||
'review.submitted': 'Revue envoyée',
|
||||
'review.failed': 'Échec de l’envoi : {message}',
|
||||
'review.unsupported': 'Ce service ne prend pas en charge l’envoi de revues.',
|
||||
'review.loadFailed': 'Impossible de lire les brouillons. Vérifiez le stockage du navigateur.',
|
||||
'review.recheck': 'Voir sur GitHub',
|
||||
'review.recheck': 'Voir sur {forge}',
|
||||
'review.confirmRetry': 'Vérifié ; autoriser un nouvel envoi',
|
||||
'list.worktree': 'Dans son propre arbre de travail',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -2044,12 +2054,12 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Fichiers vus',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'Impossible d’enregistrer l’état de revue',
|
||||
'viewed.hintHost': 'Enregistré sur GitHub · Appuyez sur V pour basculer le fichier actuel',
|
||||
'viewed.saving': 'Enregistrement sur GitHub…',
|
||||
'viewed.unavailable': 'Impossible de lire l’état de revue sur GitHub',
|
||||
'viewed.readFailed': 'Impossible de lire l’état de revue sur GitHub ; les fichiers ne peuvent pas être marqués : {message}',
|
||||
'viewed.syncFailed': 'Impossible d’enregistrer la marque de revue sur GitHub : {message}',
|
||||
'viewed.syncStale': 'La PR contient de nouveaux commits ; la marque de revue n’a pas été enregistrée. Actualisez et marquez à nouveau le fichier.',
|
||||
'viewed.hintHost': 'Enregistré sur {forge} · Appuyez sur V pour basculer le fichier actuel',
|
||||
'viewed.saving': 'Enregistrement sur {forge}…',
|
||||
'viewed.unavailable': 'Impossible de lire l’état de revue sur {forge}',
|
||||
'viewed.readFailed': 'Impossible de lire l’état de revue sur {forge} ; les fichiers ne peuvent pas être marqués : {message}',
|
||||
'viewed.syncFailed': 'Impossible d’enregistrer la marque de revue sur {forge} : {message}',
|
||||
'viewed.syncStale': 'La {noun} contient de nouveaux commits ; la marque de revue n’a pas été enregistrée. Actualisez et marquez à nouveau le fichier.',
|
||||
'viewed.syncUnknown': 'Impossible de confirmer que la marque de revue a été enregistrée : {message}. Actualisez pour voir son état réel.',
|
||||
'commits.all': 'Tous les commits',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -2178,7 +2188,7 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'Aucun fil de revue pour le moment',
|
||||
'thread.back': 'Retour aux modifications',
|
||||
'thread.truncated': 'Trop de fils ; seuls les {count} premiers sont affichés',
|
||||
'thread.openAll': 'Voir sur GitHub',
|
||||
'thread.openAll': 'Voir sur {forge}',
|
||||
'thread.replies': '{count} réponses',
|
||||
'thread.fileLevel': 'Fil du fichier',
|
||||
'thread.onCommit': 'sur {commit}',
|
||||
@@ -2196,12 +2206,12 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Masquer le fichier à ce commit',
|
||||
'thread.originalLoading': 'Lecture du fichier à ce commit…',
|
||||
'thread.originalFailed': 'Impossible de lire le fichier à ce commit : {message}',
|
||||
'thread.openOnHost': 'Voir sur GitHub',
|
||||
'thread.openOnHost': 'Voir sur {forge}',
|
||||
'thread.unresolvedCount': '{count} non résolus',
|
||||
'thread.unresolvedAria': '{name} a {count} fils non résolus ; aller au suivant',
|
||||
'thread.next': 'Aller au fil non résolu suivant',
|
||||
'thread.treeCount': '{count} fils non résolus',
|
||||
'thread.loadFailed': 'Impossible de lire les fils GitHub : {message}',
|
||||
'thread.loadFailed': 'Impossible de lire les fils {forge} : {message}',
|
||||
'thread.inputFailed': 'Le champ de saisie n’a pas pu recevoir ce fil ; réessayez plus tard',
|
||||
'thread.copy': 'Copier',
|
||||
'thread.copied': 'Copié',
|
||||
@@ -2210,7 +2220,7 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'Désactiver le retour à la ligne',
|
||||
'thread.footnotes': 'Notes de bas de page',
|
||||
'review.browserDraft': 'Brouillon du navigateur',
|
||||
'review.browserDrafts': '{count} brouillons de commentaires sont enregistrés uniquement dans ce navigateur, pas dans votre revue GitHub en attente. Ajoutez-les à la revue ou supprimez-les d’abord.',
|
||||
'review.browserDrafts': '{count} brouillons de commentaires sont enregistrés uniquement dans ce navigateur, pas dans votre revue {forge} en attente. Ajoutez-les à la revue ou supprimez-les d’abord.',
|
||||
'review.discard': 'Abandonner la revue',
|
||||
'review.discardConfirm': 'Abandonner votre revue en attente et ses {count} commentaires ? Cette action est irréversible.',
|
||||
'review.discarding': 'Abandon…',
|
||||
@@ -2227,9 +2237,9 @@ export const fr: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Suppression…',
|
||||
'thread.deleteConfirm': 'Supprimer ce commentaire ?',
|
||||
'thread.deleteLast': 'Supprimer ce commentaire ? C’est le seul du fil, qui sera donc supprimé aussi.',
|
||||
'thread.writeUnknown': 'Impossible de confirmer que GitHub a appliqué la modification. Les fils sont en cours de relecture ; vérifiez-les avant de réessayer.',
|
||||
'thread.writeFailed': 'GitHub n’a pas appliqué la modification : {message}',
|
||||
'thread.writeStale': 'La PR contient de nouveaux commits. Les fils sont relus au nouveau head ; vérifiez-les, puis réessayez.',
|
||||
'thread.writeUnknown': 'Impossible de confirmer que {forge} a appliqué la modification. Les fils sont en cours de relecture ; vérifiez-les avant de réessayer.',
|
||||
'thread.writeFailed': '{forge} n’a pas appliqué la modification : {message}',
|
||||
'thread.writeStale': 'La {noun} contient de nouveaux commits. Les fils sont relus au nouveau head ; vérifiez-les, puis réessayez.',
|
||||
'thread.writeUnsupported': 'Ce service ne permet pas de modifier les fils ici.',
|
||||
}
|
||||
|
||||
@@ -2245,7 +2255,7 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Archiviert; der Arbeitsbaum wird entfernt',
|
||||
'toast.archiveCleanupFailed': 'Archiviert; der Arbeitsbaum konnte nicht entfernt werden. Der Branch bleibt erhalten. Prüfe den Arbeitsbaum.',
|
||||
'review.startReview': 'Review starten',
|
||||
'review.githubActions': 'GitHub-Kommentaroptionen',
|
||||
'review.hostActions': '{forge}-Kommentaroptionen',
|
||||
'review.publishing': 'Wird veröffentlicht…',
|
||||
'review.submitting': 'Wird gesendet…',
|
||||
'review.close': 'Schließen',
|
||||
@@ -2271,24 +2281,26 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Zeile {line} auswählen',
|
||||
'review.inputFailed': 'Die Referenz kann noch nicht eingefügt werden. Versuche es später erneut.',
|
||||
'review.saveFailed': 'Der Entwurf konnte nicht gespeichert werden. Prüfe den Browserspeicher.',
|
||||
'review.unknown': 'Das Ergebnis der Übermittlung ist unbekannt. Prüfe GitHub vor einer erneuten Veröffentlichung.',
|
||||
'review.unknown': 'Das Ergebnis der Übermittlung ist unbekannt. Prüfe {forge} vor einer erneuten Veröffentlichung.',
|
||||
'review.submit': 'Review absenden',
|
||||
'review.summary': 'Zusammenfassung der Review…',
|
||||
'review.approve': 'Genehmigen',
|
||||
'review.requestChanges': 'Änderungen anfordern',
|
||||
'review.summaryRequired': 'Gib eine Zusammenfassung des Reviews ein, um Änderungen anzufordern.',
|
||||
'review.ownChangeRequest': 'Das ist dein eigener PR. GitHub erlaubt Kommentare, aber keine Genehmigung und keine Änderungsanforderung.',
|
||||
'review.decisionsLimited': '{forge} erlaubt bei diesem {noun} nur Kommentare, keine Genehmigung und keine Änderungsanforderung.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Kommentieren',
|
||||
'review.drafts': 'Ausstehende Kommentare ({count})',
|
||||
'review.edit': 'Bearbeiten',
|
||||
'review.remove': 'Löschen',
|
||||
'review.stale': 'Der PR enthält neue Commits. Aktualisiere die Ansicht und wähle die Zeilen erneut aus.',
|
||||
'review.published': 'Auf GitHub veröffentlicht',
|
||||
'review.stale': 'Der {noun} enthält neue Commits. Aktualisiere die Ansicht und wähle die Zeilen erneut aus.',
|
||||
'review.published': 'Auf {forge} veröffentlicht',
|
||||
'review.submitted': 'Review abgesendet',
|
||||
'review.failed': 'Übermittlung fehlgeschlagen: {message}',
|
||||
'review.unsupported': 'Dieser Dienst unterstützt keine Review-Übermittlung.',
|
||||
'review.loadFailed': 'Entwürfe konnten nicht gelesen werden. Prüfe den Browserspeicher.',
|
||||
'review.recheck': 'Auf GitHub ansehen',
|
||||
'review.recheck': 'Auf {forge} ansehen',
|
||||
'review.confirmRetry': 'Geprüft; erneutes Senden erlauben',
|
||||
'list.worktree': 'Im eigenen Arbeitsbaum',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -2488,12 +2500,12 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Angesehene Dateien',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'Der Ansichtsstatus konnte nicht gespeichert werden',
|
||||
'viewed.hintHost': 'Auf GitHub gespeichert · V schaltet die aktuelle Datei um',
|
||||
'viewed.saving': 'Wird auf GitHub gespeichert…',
|
||||
'viewed.unavailable': 'Der Ansichtsstatus konnte nicht von GitHub gelesen werden',
|
||||
'viewed.readFailed': 'Der Ansichtsstatus konnte nicht von GitHub gelesen werden, daher lassen sich keine Dateien markieren: {message}',
|
||||
'viewed.syncFailed': 'Die Ansichtsmarkierung konnte nicht auf GitHub gespeichert werden: {message}',
|
||||
'viewed.syncStale': 'Der PR hat neue Commits, daher wurde die Ansichtsmarkierung nicht gespeichert. Aktualisieren und die Datei erneut markieren.',
|
||||
'viewed.hintHost': 'Auf {forge} gespeichert · V schaltet die aktuelle Datei um',
|
||||
'viewed.saving': 'Wird auf {forge} gespeichert…',
|
||||
'viewed.unavailable': 'Der Ansichtsstatus konnte nicht von {forge} gelesen werden',
|
||||
'viewed.readFailed': 'Der Ansichtsstatus konnte nicht von {forge} gelesen werden, daher lassen sich keine Dateien markieren: {message}',
|
||||
'viewed.syncFailed': 'Die Ansichtsmarkierung konnte nicht auf {forge} gespeichert werden: {message}',
|
||||
'viewed.syncStale': 'Der {noun} hat neue Commits, daher wurde die Ansichtsmarkierung nicht gespeichert. Aktualisieren und die Datei erneut markieren.',
|
||||
'viewed.syncUnknown': 'Es ließ sich nicht bestätigen, dass die Ansichtsmarkierung gespeichert wurde: {message}. Zum Prüfen des tatsächlichen Stands aktualisieren.',
|
||||
'commits.all': 'Alle Commits',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -2622,7 +2634,7 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'Noch keine Review-Threads',
|
||||
'thread.back': 'Zurück zu den Änderungen',
|
||||
'thread.truncated': 'Zu viele Threads; die ersten {count} werden angezeigt',
|
||||
'thread.openAll': 'Auf GitHub ansehen',
|
||||
'thread.openAll': 'Auf {forge} ansehen',
|
||||
'thread.replies': '{count} Antworten',
|
||||
'thread.fileLevel': 'Thread zur Datei',
|
||||
'thread.onCommit': 'auf {commit}',
|
||||
@@ -2640,12 +2652,12 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Datei in diesem Commit ausblenden',
|
||||
'thread.originalLoading': 'Datei in diesem Commit wird gelesen…',
|
||||
'thread.originalFailed': 'Die Datei in diesem Commit konnte nicht gelesen werden: {message}',
|
||||
'thread.openOnHost': 'Auf GitHub ansehen',
|
||||
'thread.openOnHost': 'Auf {forge} ansehen',
|
||||
'thread.unresolvedCount': '{count} ungelöst',
|
||||
'thread.unresolvedAria': '{name} hat {count} ungelöste Threads; zum nächsten springen',
|
||||
'thread.next': 'Zum nächsten ungelösten Thread springen',
|
||||
'thread.treeCount': '{count} ungelöste Threads',
|
||||
'thread.loadFailed': 'GitHub-Threads konnten nicht gelesen werden: {message}',
|
||||
'thread.loadFailed': '{forge}-Threads konnten nicht gelesen werden: {message}',
|
||||
'thread.inputFailed': 'Das Eingabefeld konnte diesen Thread nicht aufnehmen; später erneut versuchen',
|
||||
'thread.copy': 'Kopieren',
|
||||
'thread.copied': 'Kopiert',
|
||||
@@ -2654,7 +2666,7 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'Zeilen nicht umbrechen',
|
||||
'thread.footnotes': 'Fußnoten',
|
||||
'review.browserDraft': 'Browser-Entwurf',
|
||||
'review.browserDrafts': '{count} Kommentarentwürfe sind nur in diesem Browser gespeichert, nicht in deiner ausstehenden GitHub-Review. Füge sie zuerst zur Review hinzu oder lösche sie.',
|
||||
'review.browserDrafts': '{count} Kommentarentwürfe sind nur in diesem Browser gespeichert, nicht in deiner ausstehenden {forge}-Review. Füge sie zuerst zur Review hinzu oder lösche sie.',
|
||||
'review.discard': 'Review verwerfen',
|
||||
'review.discardConfirm': 'Deine ausstehende Review und ihre {count} Kommentare verwerfen? Das lässt sich nicht rückgängig machen.',
|
||||
'review.discarding': 'Wird verworfen…',
|
||||
@@ -2671,9 +2683,9 @@ export const de: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Wird gelöscht…',
|
||||
'thread.deleteConfirm': 'Diesen Kommentar löschen?',
|
||||
'thread.deleteLast': 'Diesen Kommentar löschen? Er ist der einzige im Thread, daher wird auch der Thread gelöscht.',
|
||||
'thread.writeUnknown': 'Es ließ sich nicht bestätigen, ob GitHub die Änderung übernommen hat. Die Threads werden neu gelesen; prüfe sie vor einem erneuten Versuch.',
|
||||
'thread.writeFailed': 'GitHub hat die Änderung nicht übernommen: {message}',
|
||||
'thread.writeStale': 'Der PR enthält neue Commits. Die Threads werden am neuen Head neu gelesen; prüfe sie und versuche es erneut.',
|
||||
'thread.writeUnknown': 'Es ließ sich nicht bestätigen, ob {forge} die Änderung übernommen hat. Die Threads werden neu gelesen; prüfe sie vor einem erneuten Versuch.',
|
||||
'thread.writeFailed': '{forge} hat die Änderung nicht übernommen: {message}',
|
||||
'thread.writeStale': 'Der {noun} enthält neue Commits. Die Threads werden am neuen Head neu gelesen; prüfe sie und versuche es erneut.',
|
||||
'thread.writeUnsupported': 'Dieser Dienst unterstützt hier keine Änderungen an Threads.',
|
||||
}
|
||||
|
||||
@@ -2689,7 +2701,7 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Архивировано; рабочее дерево будет удалено',
|
||||
'toast.archiveCleanupFailed': 'Архивировано; не удалось удалить рабочее дерево. Ветка сохранена. Проверьте рабочее дерево.',
|
||||
'review.startReview': 'Начать проверку',
|
||||
'review.githubActions': 'Действия с комментарием GitHub',
|
||||
'review.hostActions': 'Действия с комментарием {forge}',
|
||||
'review.publishing': 'Публикация…',
|
||||
'review.submitting': 'Отправка…',
|
||||
'review.close': 'Закрыть',
|
||||
@@ -2715,24 +2727,26 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Выбрать строку {line}',
|
||||
'review.inputFailed': 'Не удалось добавить ссылку. Повторите попытку позже.',
|
||||
'review.saveFailed': 'Не удалось сохранить черновик. Проверьте хранилище браузера.',
|
||||
'review.unknown': 'Результат отправки неизвестен. Проверьте GitHub перед повторной публикацией.',
|
||||
'review.unknown': 'Результат отправки неизвестен. Проверьте {forge} перед повторной публикацией.',
|
||||
'review.submit': 'Отправить проверку',
|
||||
'review.summary': 'Итог проверки…',
|
||||
'review.approve': 'Одобрить',
|
||||
'review.requestChanges': 'Запросить изменения',
|
||||
'review.summaryRequired': 'Чтобы запросить изменения, добавьте итоговый комментарий.',
|
||||
'review.ownChangeRequest': 'Это ваш собственный PR. GitHub позволяет его комментировать, но не одобрять и не запрашивать изменения.',
|
||||
'review.decisionsLimited': '{forge} позволяет только комментировать этот {noun}, но не одобрять его и не запрашивать изменения.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Комментарий',
|
||||
'review.drafts': 'Ожидающие комментарии ({count})',
|
||||
'review.edit': 'Изменить',
|
||||
'review.remove': 'Удалить',
|
||||
'review.stale': 'В PR появились новые коммиты. Обновите и выберите строки заново.',
|
||||
'review.published': 'Опубликовано на GitHub',
|
||||
'review.stale': 'В {noun} появились новые коммиты. Обновите и выберите строки заново.',
|
||||
'review.published': 'Опубликовано на {forge}',
|
||||
'review.submitted': 'Проверка отправлена',
|
||||
'review.failed': 'Ошибка отправки: {message}',
|
||||
'review.unsupported': 'Этот сервис не поддерживает отправку проверок.',
|
||||
'review.loadFailed': 'Не удалось прочитать черновики. Проверьте хранилище браузера.',
|
||||
'review.recheck': 'Открыть на GitHub',
|
||||
'review.recheck': 'Открыть на {forge}',
|
||||
'review.confirmRetry': 'Проверено; разрешить повторную отправку',
|
||||
'list.worktree': 'В собственном рабочем дереве',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -2932,12 +2946,12 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Просмотренные файлы',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'Не удалось сохранить отметку о просмотре',
|
||||
'viewed.hintHost': 'Сохраняется на GitHub · V переключает текущий файл',
|
||||
'viewed.saving': 'Сохранение на GitHub…',
|
||||
'viewed.unavailable': 'Не удалось прочитать отметки о просмотре с GitHub',
|
||||
'viewed.readFailed': 'Не удалось прочитать отметки о просмотре с GitHub, поэтому файлы нельзя отметить: {message}',
|
||||
'viewed.syncFailed': 'Не удалось сохранить отметку о просмотре на GitHub: {message}',
|
||||
'viewed.syncStale': 'В PR появились новые коммиты, поэтому отметка о просмотре не сохранена. Обновите и отметьте файл снова.',
|
||||
'viewed.hintHost': 'Сохраняется на {forge} · V переключает текущий файл',
|
||||
'viewed.saving': 'Сохранение на {forge}…',
|
||||
'viewed.unavailable': 'Не удалось прочитать отметки о просмотре с {forge}',
|
||||
'viewed.readFailed': 'Не удалось прочитать отметки о просмотре с {forge}, поэтому файлы нельзя отметить: {message}',
|
||||
'viewed.syncFailed': 'Не удалось сохранить отметку о просмотре на {forge}: {message}',
|
||||
'viewed.syncStale': 'В {noun} появились новые коммиты, поэтому отметка о просмотре не сохранена. Обновите и отметьте файл снова.',
|
||||
'viewed.syncUnknown': 'Не удалось подтвердить, что отметка о просмотре сохранена: {message}. Обновите, чтобы увидеть фактическое состояние.',
|
||||
'commits.all': 'Все коммиты',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -3066,7 +3080,7 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'Обсуждений ревью пока нет',
|
||||
'thread.back': 'Назад к изменениям',
|
||||
'thread.truncated': 'Обсуждений слишком много; показаны первые {count}',
|
||||
'thread.openAll': 'Открыть на GitHub',
|
||||
'thread.openAll': 'Открыть на {forge}',
|
||||
'thread.replies': 'Ответов: {count}',
|
||||
'thread.fileLevel': 'Обсуждение файла',
|
||||
'thread.onCommit': 'в {commit}',
|
||||
@@ -3084,12 +3098,12 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Скрыть файл в том коммите',
|
||||
'thread.originalLoading': 'Чтение файла в том коммите…',
|
||||
'thread.originalFailed': 'Не удалось прочитать файл в том коммите: {message}',
|
||||
'thread.openOnHost': 'Открыть на GitHub',
|
||||
'thread.openOnHost': 'Открыть на {forge}',
|
||||
'thread.unresolvedCount': 'Нерешённых: {count}',
|
||||
'thread.unresolvedAria': 'В {name} нерешённых обсуждений: {count}. Перейти к следующему',
|
||||
'thread.next': 'Перейти к следующему нерешённому обсуждению',
|
||||
'thread.treeCount': 'Нерешённых обсуждений: {count}',
|
||||
'thread.loadFailed': 'Не удалось прочитать обсуждения GitHub: {message}',
|
||||
'thread.loadFailed': 'Не удалось прочитать обсуждения {forge}: {message}',
|
||||
'thread.inputFailed': 'Не удалось добавить обсуждение в поле ввода; повторите попытку позже',
|
||||
'thread.copy': 'Копировать',
|
||||
'thread.copied': 'Скопировано',
|
||||
@@ -3098,7 +3112,7 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'Не переносить строки',
|
||||
'thread.footnotes': 'Сноски',
|
||||
'review.browserDraft': 'Черновик в браузере',
|
||||
'review.browserDrafts': 'Черновики комментариев ({count}) сохранены только в этом браузере и не входят в вашу ожидающую проверку на GitHub. Сначала добавьте их в проверку или удалите.',
|
||||
'review.browserDrafts': 'Черновики комментариев ({count}) сохранены только в этом браузере и не входят в вашу ожидающую проверку на {forge}. Сначала добавьте их в проверку или удалите.',
|
||||
'review.discard': 'Отменить проверку',
|
||||
'review.discardConfirm': 'Отменить ожидающую проверку и её комментарии ({count})? Это действие необратимо.',
|
||||
'review.discarding': 'Отмена…',
|
||||
@@ -3115,9 +3129,9 @@ export const ru: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Удаление…',
|
||||
'thread.deleteConfirm': 'Удалить этот комментарий?',
|
||||
'thread.deleteLast': 'Удалить этот комментарий? Он единственный в обсуждении, поэтому обсуждение тоже будет удалено.',
|
||||
'thread.writeUnknown': 'Не удалось подтвердить, применил ли GitHub изменение. Обсуждения читаются заново; проверьте их перед повторной попыткой.',
|
||||
'thread.writeFailed': 'GitHub не применил изменение: {message}',
|
||||
'thread.writeStale': 'В PR появились новые коммиты. Обсуждения будут прочитаны заново для нового head; проверьте их и повторите попытку.',
|
||||
'thread.writeUnknown': 'Не удалось подтвердить, применил ли {forge} изменение. Обсуждения читаются заново; проверьте их перед повторной попыткой.',
|
||||
'thread.writeFailed': '{forge} не применил изменение: {message}',
|
||||
'thread.writeStale': 'В {noun} появились новые коммиты. Обсуждения будут прочитаны заново для нового head; проверьте их и повторите попытку.',
|
||||
'thread.writeUnsupported': 'Этот сервис не поддерживает изменение обсуждений отсюда.',
|
||||
}
|
||||
|
||||
@@ -3133,7 +3147,7 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'toast.archiveCleanupScheduled': 'Arquivado; a árvore de trabalho será removida',
|
||||
'toast.archiveCleanupFailed': 'Arquivado; a remoção da árvore de trabalho falhou. O ramo foi mantido. Verifique a árvore de trabalho.',
|
||||
'review.startReview': 'Iniciar revisão',
|
||||
'review.githubActions': 'Opções de comentário do GitHub',
|
||||
'review.hostActions': 'Opções de comentário do {forge}',
|
||||
'review.publishing': 'Publicando…',
|
||||
'review.submitting': 'Enviando…',
|
||||
'review.close': 'Fechar',
|
||||
@@ -3159,24 +3173,26 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'review.selectLine': 'Selecionar linha {line}',
|
||||
'review.inputFailed': 'Não foi possível adicionar a referência. Tente novamente mais tarde.',
|
||||
'review.saveFailed': 'Não foi possível salvar o rascunho. Verifique o armazenamento do navegador.',
|
||||
'review.unknown': 'O resultado do envio é desconhecido. Verifique o GitHub antes de publicar novamente.',
|
||||
'review.unknown': 'O resultado do envio é desconhecido. Verifique o {forge} antes de publicar novamente.',
|
||||
'review.submit': 'Enviar revisão',
|
||||
'review.summary': 'Resumo da revisão…',
|
||||
'review.approve': 'Aprovar',
|
||||
'review.requestChanges': 'Solicitar alterações',
|
||||
'review.summaryRequired': 'Escreva um resumo da revisão para solicitar alterações.',
|
||||
'review.ownChangeRequest': 'Este PR é seu. O GitHub permite comentá-lo, mas não aprová-lo nem solicitar alterações.',
|
||||
'review.decisionsLimited': 'O {forge} permite comentar este {noun}, mas não aprová-lo nem solicitar alterações.',
|
||||
'noun.pullRequest': 'PR',
|
||||
'noun.mergeRequest': 'MR',
|
||||
'review.commentOnly': 'Comentar',
|
||||
'review.drafts': 'Comentários pendentes ({count})',
|
||||
'review.edit': 'Editar',
|
||||
'review.remove': 'Excluir',
|
||||
'review.stale': 'O PR tem novos commits. Atualize e selecione as linhas novamente.',
|
||||
'review.published': 'Publicado no GitHub',
|
||||
'review.stale': 'O {noun} tem novos commits. Atualize e selecione as linhas novamente.',
|
||||
'review.published': 'Publicado no {forge}',
|
||||
'review.submitted': 'Revisão enviada',
|
||||
'review.failed': 'Falha no envio: {message}',
|
||||
'review.unsupported': 'Este serviço não oferece envio de revisões.',
|
||||
'review.loadFailed': 'Não foi possível ler os rascunhos. Verifique o armazenamento do navegador.',
|
||||
'review.recheck': 'Ver no GitHub',
|
||||
'review.recheck': 'Ver no {forge}',
|
||||
'review.confirmRetry': 'Verificado; permitir reenvio',
|
||||
'list.worktree': 'Na sua própria árvore de trabalho',
|
||||
'list.stateChecks': '{state} · {checks}',
|
||||
@@ -3376,12 +3392,12 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'viewed.progressAria': 'Arquivos revisados',
|
||||
'viewed.count': '{viewed}/{total}',
|
||||
'viewed.saveFailed': 'Não foi possível salvar o estado de revisão',
|
||||
'viewed.hintHost': 'Salvo no GitHub · Pressione V para alternar o arquivo atual',
|
||||
'viewed.saving': 'Salvando no GitHub…',
|
||||
'viewed.unavailable': 'Não foi possível ler do GitHub quais arquivos foram revisados',
|
||||
'viewed.readFailed': 'Não foi possível ler do GitHub quais arquivos foram revisados, então não é possível marcá-los: {message}',
|
||||
'viewed.syncFailed': 'Não foi possível salvar a marca de revisão no GitHub: {message}',
|
||||
'viewed.syncStale': 'O PR tem novos commits, então a marca de revisão não foi salva. Atualize e marque o arquivo novamente.',
|
||||
'viewed.hintHost': 'Salvo no {forge} · Pressione V para alternar o arquivo atual',
|
||||
'viewed.saving': 'Salvando no {forge}…',
|
||||
'viewed.unavailable': 'Não foi possível ler do {forge} quais arquivos foram revisados',
|
||||
'viewed.readFailed': 'Não foi possível ler do {forge} quais arquivos foram revisados, então não é possível marcá-los: {message}',
|
||||
'viewed.syncFailed': 'Não foi possível salvar a marca de revisão no {forge}: {message}',
|
||||
'viewed.syncStale': 'O {noun} tem novos commits, então a marca de revisão não foi salva. Atualize e marque o arquivo novamente.',
|
||||
'viewed.syncUnknown': 'Não foi possível confirmar se a marca de revisão foi salva: {message}. Atualize para ver o estado real.',
|
||||
'commits.all': 'Todos os commits',
|
||||
'commits.range': '{from}…{to}',
|
||||
@@ -3510,7 +3526,7 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'thread.empty': 'Ainda não há discussões de revisão',
|
||||
'thread.back': 'Voltar às alterações',
|
||||
'thread.truncated': 'Há discussões demais; mostrando as primeiras {count}',
|
||||
'thread.openAll': 'Ver no GitHub',
|
||||
'thread.openAll': 'Ver no {forge}',
|
||||
'thread.replies': '{count} respostas',
|
||||
'thread.fileLevel': 'Discussão do arquivo',
|
||||
'thread.onCommit': 'em {commit}',
|
||||
@@ -3528,12 +3544,12 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'thread.hideOriginal': 'Ocultar o arquivo daquele commit',
|
||||
'thread.originalLoading': 'Lendo o arquivo naquele commit…',
|
||||
'thread.originalFailed': 'Não foi possível ler o arquivo naquele commit: {message}',
|
||||
'thread.openOnHost': 'Ver no GitHub',
|
||||
'thread.openOnHost': 'Ver no {forge}',
|
||||
'thread.unresolvedCount': '{count} não resolvidas',
|
||||
'thread.unresolvedAria': '{name} tem {count} discussões não resolvidas; ir para a próxima',
|
||||
'thread.next': 'Ir para a próxima discussão não resolvida',
|
||||
'thread.treeCount': '{count} discussões não resolvidas',
|
||||
'thread.loadFailed': 'Não foi possível ler as discussões do GitHub: {message}',
|
||||
'thread.loadFailed': 'Não foi possível ler as discussões do {forge}: {message}',
|
||||
'thread.inputFailed': 'O campo de entrada não pôde receber esta discussão; tente novamente mais tarde',
|
||||
'thread.copy': 'Copiar',
|
||||
'thread.copied': 'Copiado',
|
||||
@@ -3542,7 +3558,7 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'thread.unwrap': 'Não quebrar linhas',
|
||||
'thread.footnotes': 'Notas de rodapé',
|
||||
'review.browserDraft': 'Rascunho do navegador',
|
||||
'review.browserDrafts': '{count} rascunhos de comentários estão salvos apenas neste navegador, não na sua revisão pendente do GitHub. Adicione-os à revisão ou exclua-os primeiro.',
|
||||
'review.browserDrafts': '{count} rascunhos de comentários estão salvos apenas neste navegador, não na sua revisão pendente do {forge}. Adicione-os à revisão ou exclua-os primeiro.',
|
||||
'review.discard': 'Descartar revisão',
|
||||
'review.discardConfirm': 'Descartar sua revisão pendente e seus {count} comentários? Esta ação não pode ser desfeita.',
|
||||
'review.discarding': 'Descartando…',
|
||||
@@ -3559,8 +3575,8 @@ export const pt: Record<ForgePanelKey, string> = {
|
||||
'thread.deleting': 'Excluindo…',
|
||||
'thread.deleteConfirm': 'Excluir este comentário?',
|
||||
'thread.deleteLast': 'Excluir este comentário? É o único da discussão, então a discussão também será excluída.',
|
||||
'thread.writeUnknown': 'Não foi possível confirmar se o GitHub aplicou a alteração. As discussões estão sendo lidas novamente; verifique-as antes de tentar de novo.',
|
||||
'thread.writeFailed': 'O GitHub não aplicou a alteração: {message}',
|
||||
'thread.writeStale': 'O PR tem novos commits. As discussões são lidas novamente no novo head; verifique-as e tente de novo.',
|
||||
'thread.writeUnknown': 'Não foi possível confirmar se o {forge} aplicou a alteração. As discussões estão sendo lidas novamente; verifique-as antes de tentar de novo.',
|
||||
'thread.writeFailed': 'O {forge} não aplicou a alteração: {message}',
|
||||
'thread.writeStale': 'O {noun} tem novos commits. As discussões são lidas novamente no novo head; verifique-as e tente de novo.',
|
||||
'thread.writeUnsupported': 'Este serviço não permite alterar discussões aqui.',
|
||||
}
|
||||
@@ -219,7 +219,8 @@ export class SessionPanel {
|
||||
return changeRequests.map((entry) => {
|
||||
if (entry.update !== null && 'snapshot' in entry.update) this.snapshots.set(entry.url, entry.update.snapshot)
|
||||
const reviewRevision = entry.ref === null ? 0 : this.reviewRevision(entry.ref)
|
||||
return { ...entry, snapshot: this.snapshots.get(entry.url) ?? null, reviewRevision }
|
||||
const forge = entry.ref === null ? null : this.ctx.forge.describe(entry.ref.repository.forge) ?? null
|
||||
return { ...entry, forge, snapshot: this.snapshots.get(entry.url) ?? null, reviewRevision }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -362,7 +363,7 @@ export class SessionPanel {
|
||||
using timeout = deadline(this.lifetime.signal, this.config.readinessTimeoutMs, 'FORGE_PANEL_READINESS_TIMEOUT')
|
||||
readiness = await this.ctx.forge.readiness(repository, timeout.signal)
|
||||
} catch (error) {
|
||||
readiness = { state: 'unavailable', message: error instanceof Error ? error.message : String(error) }
|
||||
readiness = { state: 'unavailable', message: error instanceof Error ? error.message : String(error), signIn: null }
|
||||
}
|
||||
if (this.lifetime.signal.aborted || this.current.repository === null || hostOf(this.current.repository) !== host) return
|
||||
this.publish({ ...this.current, readiness })
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import type {} from '@deepseek-ai/dsh-typert-protocol'
|
||||
import type { Branded } from '@deepseek-ai/dsh-brand'
|
||||
import type { ChangeRequestRef, ChangeRequestSnapshot, ForgeCommit, ForgeReadiness, ForgeRepository } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { ChangeRequestRef, ChangeRequestSnapshot, ForgeCommit, ForgeDescription, ForgeReadiness, ForgeRepository } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { SessionChangeRequest } from '@deepseek-ai/dsh-experimental-forge-session/types'
|
||||
|
||||
/** Git facts for the checkout that contains the Session's current directory. */
|
||||
@@ -184,6 +184,8 @@ export type ForgeChangeRequestStatesFrame =
|
||||
|
||||
/** One bound change request in the panel state. */
|
||||
export 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
|
||||
/**
|
||||
|
||||
@@ -32,11 +32,13 @@ import type {
|
||||
import type {
|
||||
ChangeRequestKey, ForgeCommitList, ForgeReviewData, ForgeReviewId, ForgeReviewThread, ForgeReviewWriteResult, ForgeThreadId,
|
||||
} from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import { entry, ready, snapshot } from './client-fixtures.client.ts'
|
||||
import { entry, hostCopy, ready, snapshot } from './client-fixtures.client.ts'
|
||||
import { reviewComment, reviewThread } from './thread-fixtures.client.ts'
|
||||
import { brandString } from '@deepseek-ai/dsh-brand'
|
||||
|
||||
const t = makeTranslate(en)
|
||||
const english = makeTranslate(en)
|
||||
/** Copy of a view of a GitHub pull request, which names the code host and the noun. */
|
||||
const t = (key: string, params?: Record<string, unknown>): string => english(key, { forge: 'GitHub', noun: 'PR', ...params })
|
||||
const SESSION = brandString<SessionId>('s1')
|
||||
const TAB = 'tab-changes' as TabId
|
||||
const URL7 = 'https://github.com/octo/demo/pull/7'
|
||||
@@ -139,7 +141,9 @@ function ok<T>(value: T): RemoteResult<T> {
|
||||
|
||||
/** Threads of #7 at its head, none of them yet, read for `lin`, who may review the change request `octo` opened. */
|
||||
function reviewData(overrides: Partial<ForgeReviewData> = {}): ForgeReviewData {
|
||||
return { headSha: HEAD, viewer: 'lin', threads: [], truncated: false, pendingReview: null, viewerCanReview: true, ...overrides }
|
||||
return {
|
||||
headSha: HEAD, viewer: 'lin', threads: [], truncated: false, pendingReview: null, viewerCanReview: true, reviewEvents: ['comment', 'approve', 'request-changes'], ...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
/** The pending review of `octo` on #7. */
|
||||
@@ -1397,7 +1401,7 @@ describe('line review actions', () => {
|
||||
m.publish()
|
||||
await settle()
|
||||
expect(m.sectionQueries.queryByRole('textbox')).toBeNull()
|
||||
expect(m.faces.report).toHaveBeenCalledWith('review.published')
|
||||
expect(m.faces.report).toHaveBeenCalledWith('review.published', { forge: 'GitHub', noun: 'PR' })
|
||||
expect(m.section('src/app.ts').querySelector('[data-forge-review-thread="published"]')).not.toBeNull()
|
||||
})
|
||||
it.each(['rejected', 'remote-error', 'receipt-storage'] as const)('holds an uncertain %s result for explicit reconciliation', async (kind) => {
|
||||
@@ -1410,12 +1414,12 @@ describe('line review actions', () => {
|
||||
m.publish()
|
||||
await settle()
|
||||
expect(records.getSnapshot().uncertain).not.toBeNull()
|
||||
fireEvent.click(m.view.getByRole('button', { name: en['review.recheck'] }))
|
||||
fireEvent.click(m.view.getByRole('button', { name: hostCopy('review.recheck') }))
|
||||
expect(m.faces.openLink).toHaveBeenCalledWith(URL7)
|
||||
fireEvent.click(m.view.getByRole('button', { name: 'Submit review' }))
|
||||
const dialog = within(m.view.getByRole('dialog'))
|
||||
expect(dialog.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
fireEvent.click(dialog.getByRole('button', { name: en['review.recheck'] }))
|
||||
fireEvent.click(dialog.getByRole('button', { name: hostCopy('review.recheck') }))
|
||||
fireEvent.click(dialog.getByRole('button', { name: 'Checked; allow resubmission' }))
|
||||
expect(records.getSnapshot().uncertain).toBeNull()
|
||||
fireEvent.click(dialog.getByRole('button', { name: 'Cancel' }))
|
||||
@@ -1483,7 +1487,7 @@ describe('line review actions', () => {
|
||||
expect(publish).toBeDefined()
|
||||
expect(await publish!({ source: { kind: 'local', scope: 'branch', base: 'origin/main', baseRef: null, commits: null }, comment: {
|
||||
path: 'src/app.ts', side: 'R', startLine: 4, endLine: 4, hunk: '', body: 'Local reference',
|
||||
} })).toBe(en['review.stale'])
|
||||
} })).toBe(hostCopy('review.stale'))
|
||||
expect(m.faces.submitReview).not.toHaveBeenCalled()
|
||||
})
|
||||
it('extends a range on one side and adds successive frozen references without submitting a message', async () => {
|
||||
@@ -1561,7 +1565,7 @@ describe('line review actions', () => {
|
||||
fireEvent.click(within(dialog.getByRole('group', { name: 'Discard review' })).getByRole('button', { name: 'Discard review' }))
|
||||
await settle()
|
||||
expect(m.faces.changeRequestReviewWrite).toHaveBeenLastCalledWith(URL7, { kind: 'discard-pending', headSha: HEAD, review: 'review-1' })
|
||||
expect(dialog.getByRole('alert').textContent).toBe(en['thread.writeStale'])
|
||||
expect(dialog.getByRole('alert').textContent).toBe(hostCopy('thread.writeStale'))
|
||||
expect(m.faces.report).not.toHaveBeenCalled()
|
||||
fireEvent.click(within(dialog.getByRole('group', { name: 'Discard review' })).getByRole('button', { name: 'Discard review' }))
|
||||
await settle()
|
||||
@@ -1591,7 +1595,7 @@ describe('line review actions', () => {
|
||||
expect(queue).toBeDefined()
|
||||
expect(await queue!({ source: { kind: 'local', scope: 'branch', base: 'origin/main', baseRef: null, commits: null }, comment: {
|
||||
path: 'src/app.ts', side: 'R', startLine: 4, endLine: 4, hunk: '', body: 'Local reference',
|
||||
} })).toBe(en['review.stale'])
|
||||
} })).toBe(hostCopy('review.stale'))
|
||||
expect(m.faces.changeRequestReviewWrite).not.toHaveBeenCalled()
|
||||
})
|
||||
it('keeps a pending review submission whose outcome is unknown blocked until the reader checks GitHub', async () => {
|
||||
@@ -1609,7 +1613,7 @@ describe('line review actions', () => {
|
||||
await settle()
|
||||
const records = m.faces.reviewQueue({ id: TAB, signal: m.aborter.signal })
|
||||
expect(records.getSnapshot().uncertain).toEqual({ kind: 'review', headSha: HEAD, event: 'comment', body: 'Looks good', comments: [] })
|
||||
expect(dialog.getByRole('alert').textContent).toBe(en['thread.writeUnknown'])
|
||||
expect(dialog.getByRole('alert').textContent).toBe(hostCopy('thread.writeUnknown'))
|
||||
expect(dialog.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
expect(m.faces.submitReview).not.toHaveBeenCalled()
|
||||
fireEvent.click(dialog.getByRole('button', { name: 'Checked; allow resubmission' }))
|
||||
@@ -1641,10 +1645,10 @@ describe('line review actions', () => {
|
||||
it.each([
|
||||
['an unsupported write', ok<ForgeReviewWriteResult>({ ok: false, code: 'unsupported', message: 'no writes' }), en['thread.writeUnsupported'], 1],
|
||||
['a refused write', ok<ForgeReviewWriteResult>({ ok: false, code: 'failed', message: 'Locked' }), t('thread.writeFailed', { message: 'Locked' }), 2],
|
||||
['a stale write', ok<ForgeReviewWriteResult>({ ok: false, code: 'stale', message: 'moved' }), en['thread.writeStale'], 1],
|
||||
['an unknown write', ok<ForgeReviewWriteResult>({ ok: false, code: 'unknown', message: 'timeout' }), en['thread.writeUnknown'], 2],
|
||||
['a stale write', ok<ForgeReviewWriteResult>({ ok: false, code: 'stale', message: 'moved' }), hostCopy('thread.writeStale'), 1],
|
||||
['an unknown write', ok<ForgeReviewWriteResult>({ ok: false, code: 'unknown', message: 'timeout' }), hostCopy('thread.writeUnknown'), 2],
|
||||
['an unbound change request', REFUSED.notBound, t('thread.writeFailed', { message: 'not bound' }), 1],
|
||||
['a lost connection', REFUSED.failed, en['thread.writeUnknown'], 2],
|
||||
['a lost connection', REFUSED.failed, hostCopy('thread.writeUnknown'), 2],
|
||||
] as const)('keeps the comment after %s, reading the threads again only when they may have changed', async (_label, answer, message, reads) => {
|
||||
const m = await comment({ setup: (faces) => { faces.changeRequestReviewWrite.mockResolvedValueOnce(answer) } })
|
||||
fireEvent.click(m.sectionQueries.getByRole('button', { name: 'Start review' }))
|
||||
@@ -1682,27 +1686,25 @@ describe('line review actions', () => {
|
||||
expect(section.getByRole('button', { name: 'Add to review' })).toBeTruthy()
|
||||
expect(section.queryByRole('button', { name: 'GitHub comment options' })).toBeNull()
|
||||
})
|
||||
it('lets the author of the change request only comment in the review dialog', async () => {
|
||||
it('offers only the decisions the code host allows in the review dialog', async () => {
|
||||
const m = mount({ source: { kind: 'change', url: URL7 }, setup: (faces) => {
|
||||
faces.changeRequestReview.mockResolvedValue(ok(reviewData({ viewer: 'OCTO', pendingReview: PENDING_REVIEW })))
|
||||
faces.changeRequestReview.mockResolvedValue(ok(reviewData({ viewer: 'octo', pendingReview: PENDING_REVIEW, reviewEvents: ['comment'] })))
|
||||
} })
|
||||
await settle()
|
||||
fireEvent.click(m.view.getByRole('button', { name: 'Submit review (1)' }))
|
||||
const dialog = within(m.view.getByRole('dialog'))
|
||||
expect(dialog.getByText(en['review.ownChangeRequest'])).toBeTruthy()
|
||||
expect(dialog.getByText('GitHub lets you comment on this PR, but not approve it or request changes.')).toBeTruthy()
|
||||
expect(dialog.getByRole('radio', { name: 'Approve' })).toHaveProperty('disabled', true)
|
||||
expect(dialog.getByRole('radio', { name: 'Request changes' })).toHaveProperty('disabled', true)
|
||||
})
|
||||
it.each([
|
||||
['another reviewer', 'reviewer'],
|
||||
['an unnamed viewer', null],
|
||||
] as const)('lets %s choose every review decision', async (_label, viewer) => {
|
||||
it('lets the reader choose every review decision the code host allows', async () => {
|
||||
const m = mount({ source: { kind: 'change', url: URL7 }, setup: (faces) => {
|
||||
faces.changeRequestReview.mockResolvedValue(ok(reviewData({ viewer, pendingReview: PENDING_REVIEW })))
|
||||
faces.changeRequestReview.mockResolvedValue(ok(reviewData({ viewer: 'octo', pendingReview: PENDING_REVIEW })))
|
||||
} })
|
||||
await settle()
|
||||
fireEvent.click(m.view.getByRole('button', { name: 'Submit review (1)' }))
|
||||
const dialog = within(m.view.getByRole('dialog'))
|
||||
expect(dialog.queryByText(en['review.ownChangeRequest'])).toBeNull()
|
||||
expect(dialog.queryByText('GitHub lets you comment on this PR, but not approve it or request changes.')).toBeNull()
|
||||
expect(dialog.getByRole('radio', { name: 'Approve' })).toHaveProperty('disabled', false)
|
||||
})
|
||||
it('offers no pending review action while the threads are unread, the user may not review, or chosen commits show', async () => {
|
||||
@@ -1871,13 +1873,13 @@ describe('ChangesTab viewed marks the host keeps', () => {
|
||||
expect(m.view.getByRole('progressbar').getAttribute('aria-valuetext')).toBe('1 / 3 viewed')
|
||||
|
||||
const gone = box(m, 'docs/gone.txt', 'gone.txt')
|
||||
expect(gone.closest('label')?.title).toBe(en['viewed.hintHost'])
|
||||
expect(gone.closest('label')?.title).toBe(hostCopy('viewed.hintHost'))
|
||||
fireEvent.click(gone)
|
||||
expect(m.faces.setFileViewed).toHaveBeenCalledWith(URL7, { path: 'docs/gone.txt', viewed: true, headSha: HEAD })
|
||||
expect(marks(m)[0]).toEqual(['docs/gone.txt', 'viewed', 'closed'])
|
||||
// While its write is in flight the mark stays put, also for V.
|
||||
expect(gone.disabled).toBe(true)
|
||||
expect(gone.closest('label')?.title).toBe(en['viewed.saving'])
|
||||
expect(gone.closest('label')?.title).toBe(hostCopy('viewed.saving'))
|
||||
fireEvent.keyDown(m.section('docs/gone.txt'), { key: 'v' })
|
||||
expect(m.faces.setFileViewed).toHaveBeenCalledOnce()
|
||||
await act(async () => { saved.resolve(ok(undefined)); await Promise.resolve() })
|
||||
@@ -1888,8 +1890,8 @@ describe('ChangesTab viewed marks the host keeps', () => {
|
||||
})
|
||||
|
||||
it.each([
|
||||
['refused', { ok: false, error: new RemoteError('forgePanel/action-failed', 'Resource not accessible', {}) }, ['viewed.syncFailed', { message: 'Resource not accessible' }]],
|
||||
['stale', REFUSED.staleHead, ['viewed.syncStale']],
|
||||
['refused', { ok: false, error: new RemoteError('forgePanel/action-failed', 'Resource not accessible', {}) }, ['viewed.syncFailed', { forge: 'GitHub', noun: 'PR', message: 'Resource not accessible' }]],
|
||||
['stale', REFUSED.staleHead, ['viewed.syncStale', { forge: 'GitHub', noun: 'PR' }]],
|
||||
] as const)('returns a %s mark to what the host keeps and says why', async (_label, result, report) => {
|
||||
const m = mount({ source, setup: (faces) => {
|
||||
faces.changeRequestViewed.mockResolvedValue(hosted({ 'src/app.ts': 'viewed' }))
|
||||
@@ -1922,7 +1924,7 @@ describe('ChangesTab viewed marks the host keeps', () => {
|
||||
const notice = m.view.getByText('Could not read viewed files from GitHub, so files cannot be marked: API rate limit exceeded')
|
||||
const app = box(m, 'src/app.ts', 'app.ts')
|
||||
expect(app.disabled).toBe(true)
|
||||
expect(app.closest('label')?.title).toBe(en['viewed.unavailable'])
|
||||
expect(app.closest('label')?.title).toBe(hostCopy('viewed.unavailable'))
|
||||
fireEvent.click(app)
|
||||
fireEvent.keyDown(m.section('src/app.ts'), { key: 'v' })
|
||||
expect(m.faces.setFileViewed).not.toHaveBeenCalled()
|
||||
@@ -2004,7 +2006,7 @@ describe('ChangesTab viewed marks the host keeps', () => {
|
||||
expect(marks(m).map(row => row[1])).toEqual(['viewed', 'viewed', 'unviewed'])
|
||||
expect(box(m, 'src/app.ts', 'app.ts').disabled).toBe(false)
|
||||
expect(box(m, 'docs/gone.txt', 'gone.txt').disabled).toBe(true)
|
||||
expect(m.faces.report).toHaveBeenCalledWith('viewed.syncFailed', { message: 'late' })
|
||||
expect(m.faces.report).toHaveBeenCalledWith('viewed.syncFailed', { forge: 'GitHub', noun: 'PR', message: 'late' })
|
||||
await act(async () => { next.resolve(ok(undefined)); await Promise.resolve() })
|
||||
expect(box(m, 'docs/gone.txt', 'gone.txt').disabled).toBe(false)
|
||||
})
|
||||
@@ -2241,7 +2243,7 @@ describe('ChangesTab review threads', () => {
|
||||
line('missing', 'src/missing.ts', 'R', 1),
|
||||
line('missing-no-url', 'src/missing.ts', 'R', 2, { comments: [reviewComment({ url: null })] }),
|
||||
]
|
||||
const REVIEW: ForgeReviewData = { headSha: HEAD, viewer: 'octo', threads: THREADS, truncated: false, pendingReview: null, viewerCanReview: false }
|
||||
const REVIEW: ForgeReviewData = { headSha: HEAD, viewer: 'octo', threads: THREADS, truncated: false, pendingReview: null, viewerCanReview: false, reviewEvents: [] }
|
||||
const reviewed = (review: ForgeReviewData = REVIEW) => (faces: Faces): void => {
|
||||
faces.changeRequestDiff.mockImplementation(async () => ok({ ...CHANGE, files: FILES }))
|
||||
faces.changeRequestReview.mockImplementation(async () => ok(review))
|
||||
@@ -2335,7 +2337,7 @@ describe('ChangesTab review threads', () => {
|
||||
m.faces.openLink.mockClear()
|
||||
fireEvent.click(list.querySelector('[data-forge-thread-item="missing-no-url"]')!)
|
||||
expect(m.faces.openLink).not.toHaveBeenCalled()
|
||||
fireEvent.click(within(list).getByRole('button', { name: en['thread.openAll'] }))
|
||||
fireEvent.click(within(list).getByRole('button', { name: hostCopy('thread.openAll') }))
|
||||
expect(m.faces.openLink).toHaveBeenLastCalledWith(URL7)
|
||||
fireEvent.keyDown(list, { key: 'Enter' })
|
||||
expect(list.isConnected).toBe(true)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/** Panel state builders shared by the browser-side tests. */
|
||||
|
||||
import type {
|
||||
ChangeRequestCheck, ChangeRequestKey, ChangeRequestRef, ChangeRequestSnapshot, ForgeFailure,
|
||||
ChangeRequestCheck, ChangeRequestKey, ChangeRequestRef, ChangeRequestSnapshot, ForgeDescription, ForgeFailure,
|
||||
} from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import type { BindingOrigin } from '@deepseek-ai/dsh-experimental-forge-session/types'
|
||||
import type {
|
||||
ForgeChangeRequestListState, ForgeCheckout, ForgePanelChangeRequest, ForgePanelState, ForgePanelWorktree, ForgeSessionWorktree,
|
||||
ForgeWorktreeCreation, ForgeWorktreeFailure,
|
||||
} from '../src/types.ts'
|
||||
import { en, type ForgePanelKey } from '../src/client/locales.ts'
|
||||
|
||||
/** Pull request reference in `octo/demo` on github.com. */
|
||||
export function ref(number: number): ChangeRequestRef {
|
||||
@@ -92,6 +93,18 @@ export interface EntryOptions {
|
||||
readonly reviewRevision?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* English copy of `key` as a view of a GitHub pull request shows it, with the code host and noun filled in.
|
||||
* @param key - forge panel copy key.
|
||||
* @returns the copy.
|
||||
*/
|
||||
export function hostCopy(key: ForgePanelKey): string {
|
||||
return en[key].replaceAll('{forge}', 'GitHub').replaceAll('{noun}', 'PR')
|
||||
}
|
||||
|
||||
/** How the GitHub provider names itself and its pull requests. */
|
||||
export const GITHUB: ForgeDescription = { forge: 'github', label: 'GitHub', changeRequestNoun: 'pull-request' }
|
||||
|
||||
/** Binding of pull request `number` whose latest poll returned `status`, or that has not been polled yet. */
|
||||
export function entry(
|
||||
number: number,
|
||||
@@ -99,7 +112,10 @@ export function entry(
|
||||
options: EntryOptions = {},
|
||||
): ForgePanelChangeRequest {
|
||||
const key = `github:github.com/octo/demo#${number}` as ChangeRequestKey
|
||||
const binding = { url: `https://github.com/octo/demo/pull/${number}`, origin: options.origin ?? 'created', ref: ref(number), reviewRevision: options.reviewRevision ?? 0 }
|
||||
const binding = {
|
||||
url: `https://github.com/octo/demo/pull/${number}`, origin: options.origin ?? 'created', ref: ref(number), forge: GITHUB,
|
||||
reviewRevision: options.reviewRevision ?? 0,
|
||||
}
|
||||
if (status === null) return { ...binding, update: null, snapshot: null }
|
||||
if ('code' in status) return { ...binding, update: { key, fetchedAt: 1, failure: status }, snapshot: options.kept ?? null }
|
||||
return { ...binding, update: { key, fetchedAt: 1, snapshot: status }, snapshot: status }
|
||||
@@ -107,7 +123,7 @@ export function entry(
|
||||
|
||||
/** Binding of a URL that no provider serves. */
|
||||
export function unserved(url: string): ForgePanelChangeRequest {
|
||||
return { url, origin: 'created', ref: null, update: null, snapshot: null, reviewRevision: 0 }
|
||||
return { url, origin: 'created', ref: null, forge: null, update: null, snapshot: null, reviewRevision: 0 }
|
||||
}
|
||||
|
||||
/** Checkout of `/work/repo` on `main`. */
|
||||
@@ -147,7 +163,7 @@ export function ready(overrides: Partial<ForgePanelState> = {}, checkoutOverride
|
||||
directory: '/work/repo',
|
||||
checkout: { state: 'ready', checkout: checkout(checkoutOverrides) },
|
||||
repository: { forge: 'github', host: 'github.com', owner: 'octo', name: 'demo' },
|
||||
readiness: { state: 'ready', message: null },
|
||||
readiness: { state: 'ready', message: null, signIn: null },
|
||||
changeRequests: [],
|
||||
worktree: worktree(),
|
||||
local: null,
|
||||
|
||||
@@ -155,7 +155,7 @@ describe('forgePanel.follow', () => {
|
||||
directory: repo,
|
||||
checkout: { state: 'ready', checkout: { root: repo, branch: 'main', linked: false, commit: COMMIT } },
|
||||
repository: demo,
|
||||
readiness: { state: 'ready', message: null },
|
||||
readiness: { state: 'ready', message: null, signIn: null },
|
||||
changeRequests: [],
|
||||
worktree: UNAVAILABLE,
|
||||
// The remote was never fetched, so it names no default branch to fork from.
|
||||
@@ -295,23 +295,23 @@ describe('forgePanel.follow', () => {
|
||||
const { repo } = await project()
|
||||
const opened = await open(repo)
|
||||
const held = Promise.withResolvers<ForgeReadiness>()
|
||||
opened.provider.readinessImpl = host => host === 'fake.test' ? held.promise : Promise.resolve({ state: 'unauthenticated', message: 'sign in' })
|
||||
opened.provider.readinessImpl = host => host === 'fake.test' ? held.promise : Promise.resolve({ state: 'unauthenticated', message: 'sign in', signIn: null })
|
||||
const follower = reader(opened)
|
||||
await follower.until(state => state.repository?.host === 'fake.test')
|
||||
|
||||
await git(repo, 'remote', 'set-url', 'origin', 'https://other.test/octo/demo.git')
|
||||
shellTurn(opened.session, 1, [{ callId: 'list', command: 'ls', output: '' }])
|
||||
const moved = await follower.until(state => state.repository?.host === 'other.test' && state.readiness !== null)
|
||||
held.resolve({ state: 'ready', message: null })
|
||||
held.resolve({ state: 'ready', message: null, signIn: null })
|
||||
await Promise.resolve()
|
||||
|
||||
expect(moved.readiness).toEqual({ state: 'unauthenticated', message: 'sign in' })
|
||||
expect(moved.readiness).toEqual({ state: 'unauthenticated', message: 'sign in', signIn: null })
|
||||
expect(opened.provider.probes).toEqual(['fake.test', 'other.test'])
|
||||
// A new commit gives the next inspection a state of its own to publish.
|
||||
await git(repo, 'commit', '--allow-empty', '-m', 'again')
|
||||
shellTurn(opened.session, 2, [{ callId: 'again', command: 'ls', output: '' }])
|
||||
await follower.next(state => state.checkout.state === 'ready')
|
||||
expect(follower.states.at(-1)?.readiness).toEqual({ state: 'unauthenticated', message: 'sign in' })
|
||||
expect(follower.states.at(-1)?.readiness).toEqual({ state: 'unauthenticated', message: 'sign in', signIn: null })
|
||||
expect(opened.provider.probes).toEqual(['fake.test', 'other.test'])
|
||||
})
|
||||
|
||||
@@ -327,7 +327,7 @@ describe('forgePanel.follow', () => {
|
||||
|
||||
await opened.ctx.workingDirectory.set(opened.agent, outside)
|
||||
await follower.until(state => state.directory === outside && state.checkout.state === 'none')
|
||||
held.resolve({ state: 'ready', message: null })
|
||||
held.resolve({ state: 'ready', message: null, signIn: null })
|
||||
await new Promise(resolve => setTimeout(resolve, 20))
|
||||
|
||||
expect(follower.states.at(-1)).toMatchObject({ directory: outside, repository: null, readiness: null })
|
||||
@@ -404,7 +404,7 @@ describe('forgePanel.follow', () => {
|
||||
const stopping = opened.panel.dispose().then(() => { stopped = true })
|
||||
await settle()
|
||||
expect(stopped).toBe(false)
|
||||
held.resolve({ state: 'ready', message: null })
|
||||
held.resolve({ state: 'ready', message: null, signIn: null })
|
||||
await stopping
|
||||
|
||||
await ending
|
||||
@@ -1078,7 +1078,7 @@ describe('forgePanel worktree requests', () => {
|
||||
directory: created?.path,
|
||||
checkout: { state: 'ready', checkout: { root: created?.path, branch: created?.branch, linked: true, commit: COMMIT } },
|
||||
repository: demo,
|
||||
readiness: { state: 'ready', message: null },
|
||||
readiness: { state: 'ready', message: null, signIn: null },
|
||||
changeRequests: [],
|
||||
worktree: { ...UNAVAILABLE, request: { from: null }, created },
|
||||
local: { base: created?.baseCommit.slice(0, 7), files: [] },
|
||||
@@ -1788,7 +1788,7 @@ describe('forgePanel actions', () => {
|
||||
await vi.waitFor(() => { expect(opened.provider.probes).toHaveLength(3) })
|
||||
await settle()
|
||||
expect(settled).toBe(false)
|
||||
probe.resolve({ state: 'ready', message: null })
|
||||
probe.resolve({ state: 'ready', message: null, signIn: null })
|
||||
await probed
|
||||
expect(opened.provider.probes).toHaveLength(3)
|
||||
})
|
||||
@@ -1811,6 +1811,19 @@ describe('forgePanel actions', () => {
|
||||
expect(follower.states).toHaveLength(published)
|
||||
})
|
||||
|
||||
it('names the code host of each bound change request, and none once its provider no longer describes it', async () => {
|
||||
const opened = await open(await plain())
|
||||
shellTurn(opened.session, 1, [{ callId: 'create', command: 'gh pr create --fill', output: `${pullUrl(7)}\n` }])
|
||||
const follower = reader(opened)
|
||||
const named = await follower.until(state => state.changeRequests.length === 1)
|
||||
expect(named.changeRequests[0]?.forge).toEqual({ forge: 'fake', label: 'Fake', changeRequestNoun: 'pull-request' })
|
||||
|
||||
vi.spyOn(opened.ctx.forge, 'describe').mockReturnValue(undefined)
|
||||
shellTurn(opened.session, 2, [{ callId: 'view', command: 'gh pr view', output: `${pullUrl(8)}\n` }])
|
||||
const unnamed = await follower.until(state => state.changeRequests.length === 2)
|
||||
expect(unnamed.changeRequests.map(entry => entry.forge)).toEqual([null, null])
|
||||
})
|
||||
|
||||
it('refreshes a Session outside a checkout without polling change requests that no provider serves', async () => {
|
||||
const opened = await open(await plain())
|
||||
shellTurn(opened.session, 1, [{ callId: 'create', command: 'gh pr create --fill', output: 'https://unserved.test/a/b/pull/3\n' }])
|
||||
@@ -1823,7 +1836,7 @@ describe('forgePanel actions', () => {
|
||||
// The refresh found the same state, which the panel already published.
|
||||
const refreshed = follower.states.at(-1)
|
||||
expect(refreshed?.checkout.state).toBe('none')
|
||||
expect(refreshed?.changeRequests).toEqual([{ url: 'https://unserved.test/a/b/pull/3', origin: 'created', ref: null, update: null, snapshot: null, reviewRevision: 0 }])
|
||||
expect(refreshed?.changeRequests).toEqual([{ url: 'https://unserved.test/a/b/pull/3', origin: 'created', ref: null, forge: null, update: null, snapshot: null, reviewRevision: 0 }])
|
||||
expect(opened.sandbox.calls.length).toBeGreaterThan(inspections)
|
||||
expect(opened.provider.fetches).toEqual([])
|
||||
expect(opened.provider.probes).toEqual([])
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// @vitest-environment jsdom
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { cleanup, renderHook } from '@testing-library/react'
|
||||
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import { en } from '../src/client/locales.ts'
|
||||
import { useForgeCopy } from '../src/client/forge-copy.ts'
|
||||
|
||||
const translate = makeTranslate(en)
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
describe('forge copy of a changes view', () => {
|
||||
it('names the provider and its word for a merge request', () => {
|
||||
const { result } = renderHook(() => useForgeCopy(translate, 'https://gitlab.example.test/group/app/-/merge_requests/6',
|
||||
{ forge: 'gitlab', label: 'GitLab', changeRequestNoun: 'merge-request' }))
|
||||
|
||||
expect(result.current.host).toEqual({ forge: 'GitLab', noun: 'MR' })
|
||||
expect(result.current.t('review.stale')).toBe('The MR has new commits. Refresh and select the comment lines again.')
|
||||
expect(result.current.t('thread.writeFailed', { message: 'denied', forge: 'Mirror' })).toBe('Mirror did not apply this: denied')
|
||||
})
|
||||
|
||||
it.each([
|
||||
['the host of its URL', 'https://code.example.test/a/b/pull/3', 'code.example.test'],
|
||||
['the whole URL without a host', 'not a url', 'not a url'],
|
||||
['nothing for local changes', null, ''],
|
||||
])('names %s without a provider, with the pull request word', (_label, url, forge) => {
|
||||
const { result } = renderHook(() => useForgeCopy(translate, url, null))
|
||||
|
||||
expect(result.current.host).toEqual({ forge, noun: 'PR' })
|
||||
})
|
||||
})
|
||||
@@ -300,8 +300,8 @@ describe('ForgeTab local changes', () => {
|
||||
})
|
||||
|
||||
describe('ForgeTab sign-in banner', () => {
|
||||
it('offers the GitHub CLI sign-in command for an unauthenticated GitHub host', () => {
|
||||
const b = tab(ready({ readiness: { state: 'unauthenticated', message: 'not logged in' } }))
|
||||
it('offers the sign-in command the provider names for an unauthenticated host', () => {
|
||||
const b = tab(ready({ readiness: { state: 'unauthenticated', message: 'not logged in', signIn: { command: 'gh auth login --hostname github.com' } } }))
|
||||
const banner = b.view.getByRole('status')
|
||||
expect(within(banner).getByText('Sign in to github.com to show change request status')).toBeTruthy()
|
||||
expect(within(banner).getByText('gh auth login --hostname github.com').tagName).toBe('CODE')
|
||||
@@ -313,10 +313,10 @@ describe('ForgeTab sign-in banner', () => {
|
||||
it.each([
|
||||
['with its message', 'token expired', ['Sign in to gitlab.example.test to show change request status', 'token expired']],
|
||||
['without a message', null, ['Sign in to gitlab.example.test to show change request status']],
|
||||
])('asks to sign in to another code host %s', (_label, message, texts) => {
|
||||
])('asks to sign in %s when the provider names no sign-in command', (_label, message, texts) => {
|
||||
const b = tab(ready({
|
||||
repository: { forge: 'gitlab', host: 'gitlab.example.test', owner: 'octo', name: 'demo' },
|
||||
readiness: { state: 'unauthenticated', message },
|
||||
readiness: { state: 'unauthenticated', message, signIn: null },
|
||||
}))
|
||||
const banner = b.view.getByRole('status')
|
||||
expect([...banner.children].map(child => child.textContent)).toEqual(texts)
|
||||
@@ -327,14 +327,14 @@ describe('ForgeTab sign-in banner', () => {
|
||||
['with its message', 'spawn gh ENOENT', 'Change requests on github.com could not be read: spawn gh ENOENT'],
|
||||
['without a message', null, 'Change requests on github.com could not be read: '],
|
||||
])('explains an unreachable host %s', (_label, message, text) => {
|
||||
const b = tab(ready({ readiness: { state: 'unavailable', message } }))
|
||||
const b = tab(ready({ readiness: { state: 'unavailable', message, signIn: null } }))
|
||||
expect(b.view.getByRole('status').textContent).toBe(text)
|
||||
})
|
||||
|
||||
it.each([
|
||||
['sign-in is unknown', ready({ readiness: null })],
|
||||
['the host is signed in', ready()],
|
||||
['no provider serves the repository', ready({ repository: null, readiness: { state: 'unauthenticated', message: 'not logged in' } })],
|
||||
['no provider serves the repository', ready({ repository: null, readiness: { state: 'unauthenticated', message: 'not logged in', signIn: null } })],
|
||||
])('shows no banner while %s', (_label, state) => {
|
||||
const b = tab(state)
|
||||
expect(b.view.queryByRole('status')).toBeNull()
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
ChangeRequestKey, ChangeRequestRef, ChangeRequestSnapshot, ForgeActionFailure, ForgeCommitList, ForgeFailure, ForgeProvider,
|
||||
ForgeReadiness, ForgeRepository, MergeRequest,
|
||||
} from '@deepseek-ai/dsh-experimental-forge'
|
||||
import { GH_COMMANDS } from '@deepseek-ai/dsh-experimental-forge-github/src/commands.ts'
|
||||
import ForgeSessionService from '@deepseek-ai/dsh-experimental-forge-session'
|
||||
import WorktreeService from '@deepseek-ai/dsh-experimental-worktree'
|
||||
import LocalFileSystem from '@deepseek-ai/dsh-fs-local'
|
||||
@@ -279,13 +280,16 @@ export function snapshot(ref: ChangeRequestRef): ChangeRequestSnapshot {
|
||||
/** Provider for `https://fake.test/<owner>/<name>.git` remotes and `https://fake.test/<owner>/<name>/pull/<n>` URLs. */
|
||||
export class FakeProvider implements ForgeProvider {
|
||||
readonly forge = 'fake'
|
||||
readonly hosts = ['fake.test', 'other.test']
|
||||
readonly label = 'Fake'
|
||||
readonly changeRequestNoun = 'pull-request'
|
||||
readonly fetches: (readonly number[])[] = []
|
||||
readonly probes: string[] = []
|
||||
/** Polling failures returned instead of snapshots, by change request number. */
|
||||
readonly failures = new Map<number, ForgeFailure>()
|
||||
/** Snapshot fields that replace the defaults, by change request number. */
|
||||
readonly overrides = new Map<number, Partial<ChangeRequestSnapshot>>()
|
||||
readinessImpl: (host: string, signal: AbortSignal) => Promise<ForgeReadiness> = () => Promise.resolve({ state: 'ready', message: null })
|
||||
readinessImpl: (host: string, signal: AbortSignal) => Promise<ForgeReadiness> = () => Promise.resolve({ state: 'ready', message: null, signIn: null })
|
||||
/** Every action in call order, such as `ready 7` or `merge 7 squash <sha>`. */
|
||||
readonly actions: string[] = []
|
||||
/** Outcome of the next actions; undefined reports success. */
|
||||
@@ -565,6 +569,9 @@ export async function runtime(cwd: string, options: BenchOptions = {}): Promise<
|
||||
await ctx.plugin(ForgeService, { activeIntervalMs: 60_000, idleIntervalMs: 60_000, maxBackoffMs: 60_000, fetchTimeoutMs: 1_000 })
|
||||
await ctx.plugin({ inject: ['forge'], apply(child: Context) { child.forge.register(provider) } })
|
||||
await ctx.plugin(ForgeSessionService, {})
|
||||
// forge-github registers these commands in a real composition; the projection re-registers with them.
|
||||
await ctx.plugin({ inject: ['forgeSession'], apply(child: Context) { child.forgeSession.registerCommands(GH_COMMANDS) } })
|
||||
await new Promise((resolve) => { setImmediate(resolve) })
|
||||
const worktrees = options.worktrees === true ? ctx.plugin(WorktreeService, {}) : undefined
|
||||
if (worktrees !== undefined) await worktrees
|
||||
const session = ctx.sessions.create(brandString<SessionId>(`forge-panel-${Math.random().toString(36).slice(2)}`), { meta: { cwd } })
|
||||
|
||||
@@ -209,7 +209,7 @@ async function base() {
|
||||
changeRequestText: vi.fn(async (_sessionId: SessionId, _url: string, _commit: string, _path: string): Read<string> => ({ ok: true, value: 'b\n' })),
|
||||
changeRequestReview: vi.fn(async (
|
||||
_sessionId: SessionId, _url: string, headSha: string, _fresh: boolean, _signal?: AbortSignal,
|
||||
): Read<ForgeReviewData> => ({ ok: true, value: { headSha, viewer: 'octo', threads: [], truncated: false, pendingReview: null, viewerCanReview: true } })),
|
||||
): Read<ForgeReviewData> => ({ ok: true, value: { headSha, viewer: 'octo', threads: [], truncated: false, pendingReview: null, viewerCanReview: true, reviewEvents: ['comment', 'approve', 'request-changes'] } })),
|
||||
changeRequestReviewWrite: vi.fn(async (_sessionId: SessionId, _url: string, _write: ForgeReviewWrite): Read<ForgeReviewWriteResult> =>
|
||||
({ ok: true, value: { ok: true } })),
|
||||
submitReview: vi.fn(async (_sessionId: SessionId, _url: string, _request: ForgeReviewRequest): Read<ForgeReviewResult> => ({ ok: true, value: { ok: true, url: 'https://github.com/review' } })),
|
||||
@@ -984,7 +984,7 @@ describe('mountForgePanel changes view', () => {
|
||||
expect(await view.changeRequestCommits('https://github.com/octo/demo/pull/7', signal)).toEqual({ ok: true, value: COMMITS })
|
||||
expect(f.forgePanel.changeRequestCommits).toHaveBeenCalledWith(S1, 'https://github.com/octo/demo/pull/7', signal)
|
||||
expect(await view.changeRequestReview('https://github.com/octo/demo/pull/7', 'a'.repeat(40), true, signal))
|
||||
.toEqual({ ok: true, value: { headSha: 'a'.repeat(40), viewer: 'octo', threads: [], truncated: false, pendingReview: null, viewerCanReview: true } })
|
||||
.toEqual({ ok: true, value: { headSha: 'a'.repeat(40), viewer: 'octo', threads: [], truncated: false, pendingReview: null, viewerCanReview: true, reviewEvents: ['comment', 'approve', 'request-changes'] } })
|
||||
expect(f.forgePanel.changeRequestReview).toHaveBeenCalledWith(S1, 'https://github.com/octo/demo/pull/7', 'a'.repeat(40), true, signal)
|
||||
const write = { kind: 'resolve', headSha: 'a'.repeat(40), thread: 'thread-1' as ForgeThreadId, resolved: true } as const
|
||||
expect(await view.changeRequestReviewWrite('https://github.com/octo/demo/pull/7', write)).toEqual({ ok: true, value: { ok: true } })
|
||||
|
||||
@@ -9,7 +9,7 @@ const c = 'fake:c#3' as ChangeRequestKey
|
||||
|
||||
/** A read with no threads, told apart by its head, whose length sets its size. */
|
||||
function review(head: string): ForgeReviewData {
|
||||
return { headSha: head, viewer: null, threads: [], truncated: false, pendingReview: null, viewerCanReview: false }
|
||||
return { headSha: head, viewer: null, threads: [], truncated: false, pendingReview: null, viewerCanReview: false, reviewEvents: [] }
|
||||
}
|
||||
|
||||
const size = Buffer.byteLength(JSON.stringify(review('x')))
|
||||
|
||||
@@ -6,11 +6,14 @@ import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { ForgeReviewThread, ForgeThreadId } from '@deepseek-ai/dsh-experimental-forge/types'
|
||||
import { RemoteError, type RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
||||
import { en } from '../src/client/locales.ts'
|
||||
import { hostCopy } from './client-fixtures.client.ts'
|
||||
import { Avatar, OutdatedThreads, ThreadCard, type ThreadActions, type ThreadWrites } from '../src/client/ReviewThreads.tsx'
|
||||
import { ThreadList, type ThreadListProps } from '../src/client/ThreadList.tsx'
|
||||
import { diffFile, reviewComment, reviewThread } from './thread-fixtures.client.ts'
|
||||
|
||||
const t = makeTranslate(en)
|
||||
const english = makeTranslate(en)
|
||||
/** Copy of a view of a GitHub pull request, which names the code host and the noun. */
|
||||
const t = (key: string, params?: Record<string, unknown>): string => english(key, { forge: 'GitHub', noun: 'PR', ...params })
|
||||
const OLD = 'b'.repeat(40)
|
||||
const scrolled = vi.fn()
|
||||
|
||||
@@ -129,7 +132,7 @@ describe('ThreadCard writes', () => {
|
||||
expect(open.getByRole('button', { name: 'Resolve thread' })).toHaveProperty('disabled', true)
|
||||
expect(await open.findByRole('alert')).toHaveProperty('textContent', 'Refused')
|
||||
fireEvent.click(open.getByRole('button', { name: 'Resolve thread' }))
|
||||
await vi.waitFor(() => { expect(open.getByRole('alert').textContent).toBe(en['thread.writeUnknown']) })
|
||||
await vi.waitFor(() => { expect(open.getByRole('alert').textContent).toBe(hostCopy('thread.writeUnknown')) })
|
||||
open.unmount()
|
||||
const settled = render(<ThreadCard thread={reviewThread({ id: 't2' as ForgeThreadId, resolved: true, viewerCanResolve: true })} place={LINE}
|
||||
actions={actions({ writes: writes({ write }), focused: { id: 't2' as ForgeThreadId, revision: 1 } })} t={t} />)
|
||||
@@ -267,7 +270,7 @@ describe('ThreadCard', () => {
|
||||
fireEvent.click(view.getByRole('button', { name: en['review.addToInput'] }))
|
||||
expect(shared.addToInput).toHaveBeenCalledWith(thread, 'R3')
|
||||
expect(shared.inputFailed).toHaveBeenCalledOnce()
|
||||
fireEvent.click(view.getByRole('button', { name: en['thread.openOnHost'] }))
|
||||
fireEvent.click(view.getByRole('button', { name: hostCopy('thread.openOnHost') }))
|
||||
expect(shared.openLink).toHaveBeenCalledWith(thread.comments[0]?.url)
|
||||
})
|
||||
|
||||
@@ -275,7 +278,7 @@ describe('ThreadCard', () => {
|
||||
const view = render(<ThreadCard thread={reviewThread({ subject: 'file', current: null, original: null, comments: [reviewComment({ url: null })] })}
|
||||
place={{ kind: 'file' }} actions={actions()} t={t} />)
|
||||
expect(view.getByRole('region', { name: en['thread.fileLevel'] }).textContent).toContain(en['thread.fileLevel'])
|
||||
expect(view.queryByRole('button', { name: en['thread.openOnHost'] })).toBeNull()
|
||||
expect(view.queryByRole('button', { name: hostCopy('thread.openOnHost') })).toBeNull()
|
||||
})
|
||||
|
||||
it('folds a resolved thread into one row until unfolded or jumped to, and folds it again after a jump', () => {
|
||||
@@ -362,7 +365,7 @@ describe('ThreadList', () => {
|
||||
cleanup()
|
||||
const { view } = list({ entries: [{ thread: reviewThread(), place: { kind: 'line', side: 'R', startLine: 3, endLine: 3 } }], filter: 'resolved' })
|
||||
expect(view.getByText(en['thread.none'])).toBeDefined()
|
||||
expect(view.getByRole('button', { name: en['thread.openAll'] }).parentElement?.textContent).toBe(en['thread.openAll'])
|
||||
expect(view.getByRole('button', { name: hostCopy('thread.openAll') }).parentElement?.textContent).toBe(hostCopy('thread.openAll'))
|
||||
})
|
||||
|
||||
it('orders each file\'s threads from file threads to lines to outdated ones and describes each', () => {
|
||||
|
||||
@@ -12,8 +12,11 @@ import { ReviewThread } from '../src/client/ReviewThread.tsx'
|
||||
import { SubmitReview } from '../src/client/SubmitReview.tsx'
|
||||
import { ReviewComposer, type ReviewActions } from '../src/client/ReviewComposer.tsx'
|
||||
import { en } from '../src/client/locales.ts'
|
||||
import { hostCopy } from './client-fixtures.client.ts'
|
||||
|
||||
const t = makeTranslate(en)
|
||||
const english = makeTranslate(en)
|
||||
/** Copy of a view of a GitHub pull request, which names the code host and the noun. */
|
||||
const t = (key: string, params?: Record<string, unknown>): string => english(key, { forge: 'GitHub', noun: 'PR', ...params })
|
||||
const file: ForgeDiffFile = { path: 'a.ts', previousPath: null, status: 'modified', binary: false, oversized: false, untracked: false, layer: 'implementation', digest: 'digest', additions: 3, deletions: 2,
|
||||
hunks: [
|
||||
{ oldStart: 2, oldLines: 2, newStart: 2, newLines: 3, lines: [' unchanged', '-old', '+new', '+another'] },
|
||||
@@ -68,7 +71,7 @@ describe('review references', () => {
|
||||
expect(view.getByRole('button', { name: en['review.publishing'] })).toHaveProperty('disabled', true)
|
||||
expect(view.getByRole('textbox')).toHaveProperty('disabled', true)
|
||||
await act(async () => { reject(new Error('transport lost')) })
|
||||
expect(view.getByRole('alert')).toHaveProperty('textContent', en['review.unknown'])
|
||||
expect(view.getByRole('alert')).toHaveProperty('textContent', hostCopy('review.unknown'))
|
||||
expect(publish).toHaveBeenCalledOnce()
|
||||
})
|
||||
it('dispatches at most once when two activations arrive in the same render batch', async () => {
|
||||
@@ -352,7 +355,7 @@ describe('inline records', () => {
|
||||
expect(records.getSnapshot().comments).toHaveLength(1)
|
||||
queue.mockRejectedValueOnce(new Error('transport lost'))
|
||||
fireEvent.click(view.getByRole('button', { name: 'Add to review' }))
|
||||
await vi.waitFor(() => { expect(view.getByRole('alert').textContent).toBe(en['review.unknown']) })
|
||||
await vi.waitFor(() => { expect(view.getByRole('alert').textContent).toBe(hostCopy('review.unknown')) })
|
||||
queue.mockResolvedValueOnce(undefined)
|
||||
vi.spyOn(records, 'editThread').mockReturnValueOnce(false)
|
||||
fireEvent.click(view.getByRole('button', { name: 'Add to review' }))
|
||||
@@ -383,7 +386,7 @@ describe('inline records', () => {
|
||||
const openLink = vi.fn()
|
||||
const view = render(<ReviewThread thread={{ key: 1, kind: 'published', selection, url: 'https://github.com/review' }}
|
||||
actions={{ source: selection.source, addToInput: () => true, openLink }} locked={false} outdated={false} t={t} />)
|
||||
fireEvent.click(view.getByRole('button', { name: en['review.recheck'] }))
|
||||
fireEvent.click(view.getByRole('button', { name: hostCopy('review.recheck') }))
|
||||
expect(openLink).toHaveBeenCalledWith('https://github.com/review')
|
||||
expect(view.queryByRole('button', { name: 'Edit' })).toBeNull()
|
||||
})
|
||||
@@ -392,7 +395,7 @@ describe('inline records', () => {
|
||||
describe('submission availability', () => {
|
||||
it('explains why requesting changes needs a summary and enables submission when one is entered', () => {
|
||||
const queue = new ReviewQueue('review-test')
|
||||
const view = render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={null} own={false} busy={false} error={null}
|
||||
const view = render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={null} events={null} busy={false} error={null}
|
||||
submit={vi.fn()} discard={undefined} close={vi.fn()} check={vi.fn()} reconcile={vi.fn()} t={t} />)
|
||||
const button = view.getByRole('button', { name: 'Submit review' })
|
||||
const summary = view.getByRole('textbox')
|
||||
@@ -415,6 +418,23 @@ describe('submission availability', () => {
|
||||
expect(view.getByRole('status')).toBe(announcement)
|
||||
})
|
||||
|
||||
it.each([
|
||||
[['comment', 'approve'] as const],
|
||||
[['approve'] as const],
|
||||
])('blocks a decision outside %j and explains no limit beyond comment-only', (events) => {
|
||||
const queue = new ReviewQueue('review-test')
|
||||
queue.summarize('Please fix the missing check.', 'request-changes')
|
||||
const view = render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={null} events={events}
|
||||
busy={false} error={null} submit={vi.fn()} discard={undefined} close={vi.fn()} check={vi.fn()} reconcile={vi.fn()} t={t} />)
|
||||
const button = view.getByRole('button', { name: 'Submit review' })
|
||||
expect(view.getByRole('radio', { name: 'Request changes' })).toHaveProperty('disabled', true)
|
||||
expect(view.getByRole('radio', { name: 'Comment' })).toHaveProperty('disabled', !events.includes('comment' as never))
|
||||
expect(button).toHaveProperty('disabled', true)
|
||||
expect(view.container.textContent).not.toContain('lets you comment on this')
|
||||
fireEvent.click(view.getByRole('radio', { name: 'Approve' }))
|
||||
expect(button).toHaveProperty('disabled', false)
|
||||
})
|
||||
|
||||
it.each(['local', 'different-pr', 'different-head', 'empty-comment', 'load', 'save'] as const)('blocks %s and retains the review in the modal', (kind) => {
|
||||
const source = kind === 'different-pr' ? { kind: 'change' as const, url: 'other', headSha: 'a'.repeat(40), commits: null }
|
||||
: kind === 'different-head' ? { kind: 'change' as const, url: 'https://github.com/octo/demo/pull/7', headSha: 'b', commits: null } : selection.source
|
||||
@@ -426,7 +446,7 @@ describe('submission availability', () => {
|
||||
queue.summarize('Summary', 'comment')
|
||||
}
|
||||
if (kind === 'local') vi.spyOn(queue, 'getSnapshot').mockReturnValue({ ...queue.getSnapshot(), comments: [{ ...selection, source: { kind: 'local', scope: 'branch', base: 'origin/main', baseRef: null, commits: null } }] })
|
||||
const view = render(<SubmitReview queue={opened} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={null} own={false} busy={false} error={null}
|
||||
const view = render(<SubmitReview queue={opened} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={null} events={null} busy={false} error={null}
|
||||
submit={vi.fn()} discard={undefined} close={vi.fn()} check={vi.fn()} reconcile={vi.fn()} t={t} />)
|
||||
expect(view.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
})
|
||||
@@ -436,7 +456,7 @@ describe('pending review submission', () => {
|
||||
function dialog(
|
||||
queue: ReviewQueue, props: { readonly busy?: boolean; readonly discard?: () => void; readonly submit?: () => void } = {},
|
||||
) {
|
||||
return render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={PENDING} own={false}
|
||||
return render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)} pending={PENDING} events={null}
|
||||
busy={props.busy ?? false} error={null} submit={props.submit ?? vi.fn()} discard={props.discard ?? vi.fn()}
|
||||
close={vi.fn()} check={vi.fn()} reconcile={vi.fn()} t={t} />)
|
||||
}
|
||||
@@ -449,7 +469,7 @@ describe('pending review submission', () => {
|
||||
})
|
||||
it('refuses an empty comment review when the pending review holds no comments', () => {
|
||||
const view = render(<SubmitReview queue={new ReviewQueue('review-test')} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)}
|
||||
pending={{ ...PENDING, comments: 0 }} own={false} busy={false} error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
pending={{ ...PENDING, comments: 0 }} events={null} busy={false} error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
close={vi.fn()} check={vi.fn()}
|
||||
reconcile={vi.fn()} t={t} />)
|
||||
expect(view.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
@@ -481,25 +501,25 @@ describe('pending review submission', () => {
|
||||
const discard = view.getByRole('button', { name: 'Discard review' })
|
||||
expect(discard).toHaveProperty('disabled', true)
|
||||
view.rerender(<SubmitReview queue={new ReviewQueue('review-test')} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)}
|
||||
pending={PENDING} own={false} busy={false} error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
pending={PENDING} events={null} busy={false} error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
close={vi.fn()} check={vi.fn()} reconcile={vi.fn()}
|
||||
t={t} />)
|
||||
fireEvent.click(view.getByRole('button', { name: 'Discard review' }))
|
||||
view.rerender(<SubmitReview queue={new ReviewQueue('review-test')} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)}
|
||||
pending={PENDING} own={false} busy error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
pending={PENDING} events={null} busy error={null} submit={vi.fn()} discard={vi.fn()}
|
||||
close={vi.fn()} check={vi.fn()} reconcile={vi.fn()} t={t} />)
|
||||
const confirm = within(view.getByRole('group', { name: 'Discard review' }))
|
||||
expect(confirm.getByRole('button', { name: 'Discarding…' })).toHaveProperty('disabled', true)
|
||||
expect(confirm.getByRole('button', { name: 'Cancel' })).toHaveProperty('disabled', true)
|
||||
expect(view.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
})
|
||||
it('lets the author only comment on their own change request, keeping a stored decision until Comment is chosen', () => {
|
||||
it('lets the reader only comment where the code host allows only comments, keeping a stored decision until Comment is chosen', () => {
|
||||
const queue = new ReviewQueue('review-test')
|
||||
queue.summarize('Looks done', 'approve')
|
||||
const view = render(<SubmitReview queue={queue} url="https://github.com/octo/demo/pull/7" headSha={'a'.repeat(40)}
|
||||
pending={PENDING} own busy={false} error={null} submit={vi.fn()} discard={vi.fn()} close={vi.fn()} check={vi.fn()}
|
||||
pending={PENDING} events={['comment']} busy={false} error={null} submit={vi.fn()} discard={vi.fn()} close={vi.fn()} check={vi.fn()}
|
||||
reconcile={vi.fn()} t={t} />)
|
||||
expect(view.getByText(en['review.ownChangeRequest'])).toBeTruthy()
|
||||
expect(view.getByText('GitHub lets you comment on this PR, but not approve it or request changes.')).toBeTruthy()
|
||||
expect(view.getByRole('radio', { name: 'Approve' })).toHaveProperty('disabled', true)
|
||||
expect(view.getByRole('radio', { name: 'Request changes' })).toHaveProperty('disabled', true)
|
||||
expect(view.getByRole('button', { name: 'Submit review' })).toHaveProperty('disabled', true)
|
||||
|
||||
@@ -32,7 +32,7 @@ async function opened(config: Parameters<typeof bench>[1] = {}): Promise<{ opene
|
||||
|
||||
function review(headSha: string, path = 'src/a.ts'): ForgeReviewData {
|
||||
return {
|
||||
headSha, viewer: 'octo', truncated: false, pendingReview: null, viewerCanReview: true,
|
||||
headSha, viewer: 'octo', truncated: false, pendingReview: null, viewerCanReview: true, reviewEvents: ['comment', 'approve', 'request-changes'],
|
||||
threads: [{
|
||||
id: 'thread-1' as ForgeThreadId, path, side: 'R', subject: 'line', resolved: false, diffHunk: '@@ -1 +1 @@\n-old\n+new',
|
||||
current: { commit: headSha, startLine: 1, endLine: 1 }, original: { commit: headSha, startLine: 1, endLine: 1 }, comments: [],
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
en: 33679bed06be4e74
|
||||
zh: 77dcfac9570d1fbc
|
||||
/deepseek-ai-dsh-experimental-forge-bundle/understand-the-implementation:
|
||||
en: b25e0de13e5e1ed0
|
||||
zh: 5b0eff3cf148dfee
|
||||
en: 3afaeb5efc183949
|
||||
zh: c916499192d320f3
|
||||
/deepseek-ai-dsh-experimental-forge-bundle/further-exploration:
|
||||
en: ab1f524b8ad79c55
|
||||
zh: 137cfcb6d192c269
|
||||
@@ -30,8 +30,8 @@
|
||||
en: 0192ab064b8000a7
|
||||
zh: 1a1de04f87631b9a
|
||||
/deepseek-ai-dsh-experimental-forge-bundle/known-limitations-and-deferred-work:
|
||||
en: ab489084b24ecb16
|
||||
zh: 6be1686e9741dffa
|
||||
en: 0c681a81348e10e3
|
||||
zh: 40d04b43b23e4259
|
||||
/deepseek-ai-dsh-experimental-forge-bundle/known-limitations-and-deferred-work/dev-note:
|
||||
en: e67f633dc6fe7773
|
||||
zh: 3bb0c20c93f16f98
|
||||
@@ -37,7 +37,7 @@ The same switch enables the model's [`create_worktree`](../tool-worktree/README.
|
||||
<details>
|
||||
<summary>Maintainer details — click to expand</summary>
|
||||
|
||||
The bundle mounts the forge registry, GitHub provider, Session bindings, the worktree model tool, and the panel as six top-level rows. The tool and the panel share the one `worktree` service, so one `worktree` row override configures both, and one archive of a Session reclaims its checkout once; the row's Keep worktrees when archiving switch on the Plugins page turns the cleanup off for both. The panel records worktrees requested before a Session starts; model-created worktrees do not acquire the panel's recovery records, but both kinds take part in archive cleanup. The rows use the Session projection, working-directory, filesystem, subprocess, and sandbox services from base-backed profiles; archive cleanup also needs the Workspace registry and Session query of those profiles.
|
||||
The bundle mounts the forge registry, the GitHub and GitLab providers, Session bindings, the worktree model tool, and the panel as seven top-level rows. The tool and the panel share the one `worktree` service, so one `worktree` row override configures both, and one archive of a Session reclaims its checkout once; the row's Keep worktrees when archiving switch on the Plugins page turns the cleanup off for both. The panel records worktrees requested before a Session starts; model-created worktrees do not acquire the panel's recovery records, but both kinds take part in archive cleanup. The rows use the Session projection, working-directory, filesystem, subprocess, and sandbox services from base-backed profiles; archive cleanup also needs the Workspace registry and Session query of those profiles.
|
||||
|
||||
</details>
|
||||
|
||||
@@ -63,7 +63,7 @@ Enabling or disabling the bundle changes the model's tool schema list. Calls app
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- GitHub is the only code host provider, and the bundle serves github.com only; a GitHub Enterprise host needs a profile patch that lists it in the `forge-github` row's [`hosts`](../forge-github/README.md#use-this-package). No provider recognizes GitLab or other hosts.
|
||||
- The bundle serves github.com and gitlab.com only; a GitHub Enterprise or self-managed GitLab host needs a profile patch that lists it in the `forge-github` row's [`hosts`](../forge-github/README.md#use-this-package) or the `forge-gitlab` row's [`hosts`](../forge-gitlab/README.md#use-this-package). No provider recognizes other code hosts.
|
||||
- The model has no tool for bound change requests yet.
|
||||
|
||||
-----
|
||||
|
||||
@@ -37,7 +37,7 @@ kind: "package-bundle"
|
||||
<details>
|
||||
<summary>维护者细节——点击展开</summary>
|
||||
|
||||
组合包以六个顶层行挂载 Forge 注册表、GitHub 提供方、Session 绑定、工作树模型工具和面板。工具与面板共用同一个 `worktree` 服务,因此一条 `worktree` 行覆盖同时配置两者,归档一个 Session 只回收一次其检出目录;该行在插件页上的“归档时不删除工作树”开关同时为两者关闭清理。面板记录 Session 开始前请求的工作树;模型创建的工作树不会获得面板的恢复记录,但两种工作树都参与归档清理。这些行使用基于 base 的 profile 提供的 Session 投影、工作目录、文件系统、子进程和沙箱服务;归档清理还需要这些 profile 的 Workspace 注册表与 Session 查询。
|
||||
组合包以七个顶层行挂载 Forge 注册表、GitHub 与 GitLab 提供方、Session 绑定、工作树模型工具和面板。工具与面板共用同一个 `worktree` 服务,因此一条 `worktree` 行覆盖同时配置两者,归档一个 Session 只回收一次其检出目录;该行在插件页上的“归档时不删除工作树”开关同时为两者关闭清理。面板记录 Session 开始前请求的工作树;模型创建的工作树不会获得面板的恢复记录,但两种工作树都参与归档清理。这些行使用基于 base 的 profile 提供的 Session 投影、工作目录、文件系统、子进程和沙箱服务;归档清理还需要这些 profile 的 Workspace 注册表与 Session 查询。
|
||||
|
||||
</details>
|
||||
|
||||
@@ -63,7 +63,7 @@ kind: "package-bundle"
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- 只有 GitHub 一个代码托管提供方,且本 Bundle 只服务 github.com;GitHub Enterprise 主机需要用 profile patch 把它列入 `forge-github` 行的 [`hosts`](../forge-github/README.zh.md#use-this-package)。没有提供方识别 GitLab 等其他平台。
|
||||
- 本 Bundle 只服务 github.com 和 gitlab.com;GitHub Enterprise 或自建 GitLab 主机需要用 profile patch 把它列入 `forge-github` 行的 [`hosts`](../forge-github/README.zh.md#use-this-package) 或 `forge-gitlab` 行的 [`hosts`](../forge-gitlab/README.zh.md#use-this-package)。没有提供方识别其他代码托管平台。
|
||||
- 模型目前还没有读取已绑定变更请求的工具。
|
||||
|
||||
-----
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
name: '@deepseek-ai/dsh-experimental-forge'
|
||||
- id: forge-github
|
||||
name: '@deepseek-ai/dsh-experimental-forge-github'
|
||||
- id: forge-gitlab
|
||||
name: '@deepseek-ai/dsh-forge-gitlab'
|
||||
- id: forge-session
|
||||
name: '@deepseek-ai/dsh-experimental-forge-session'
|
||||
- id: forge-panel
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Änderungsanfragen und Arbeitsbäume",
|
||||
"description": "Verknüpfte GitHub-Pull-Requests neben der Unterhaltung verfolgen: Prüfungen und Reviews ansehen, Code vergleichen und Feedback an den Agenten senden. Lokale Änderungen prüfen und Aufgaben mit separaten Arbeitsbäumen isolieren. GitHub-Funktionen erfordern eine installierte gh-CLI und eine Anmeldung auf dem Host.",
|
||||
"description": "Verknüpfte Änderungsanfragen neben der Unterhaltung verfolgen, GitHub-Pull-Requests ebenso wie GitLab-Merge-Requests: Prüfungen und Reviews ansehen, Code vergleichen und Feedback an den Agenten senden. Lokale Änderungen prüfen und Aufgaben mit separaten Arbeitsbäumen isolieren. GitHub-Funktionen erfordern eine installierte gh-CLI und eine Anmeldung auf dem Host. GitLab-Merge-Requests erfordern die auf dem Host installierte und angemeldete glab-CLI.",
|
||||
"detail": "docs/DETAIL.de.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Change requests & worktrees",
|
||||
"description": "Keep linked GitHub pull requests beside your conversation: follow checks and reviews, inspect diffs, and send feedback to the agent. Review local changes and use a separate worktree to isolate each task. GitHub features require the gh CLI installed and signed in on the host.",
|
||||
"description": "Keep linked change requests beside your conversation, both GitHub pull requests and GitLab merge requests: follow checks and reviews, inspect diffs, and send feedback to the agent. Review local changes and use a separate worktree to isolate each task. GitHub features require the gh CLI installed and signed in on the host. GitLab merge requests require the glab CLI signed in on the host.",
|
||||
"detail": "docs/DETAIL.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Solicitudes de cambio y árboles de trabajo",
|
||||
"description": "Sigue los pull requests de GitHub vinculados a la conversación: consulta comprobaciones y revisiones, compara código y envía comentarios al agente. Revisa cambios locales y aísla cada tarea en un árbol de trabajo separado. Las funciones de GitHub requieren instalar la CLI gh e iniciar sesión en el equipo anfitrión.",
|
||||
"description": "Sigue las solicitudes de cambio vinculadas a la conversación, tanto pull requests de GitHub como merge requests de GitLab: consulta comprobaciones y revisiones, compara código y envía comentarios al agente. Revisa cambios locales y aísla cada tarea en un árbol de trabajo separado. Las funciones de GitHub requieren instalar la CLI gh e iniciar sesión en el equipo anfitrión. Las merge requests de GitLab requieren la CLI glab instalada y con sesión iniciada en el host.",
|
||||
"detail": "docs/DETAIL.es.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Demandes de modification et arbres de travail",
|
||||
"description": "Suivez les pull requests GitHub liées à votre conversation : consultez les vérifications et les revues, comparez le code et transmettez vos remarques à l’agent. Examinez les modifications locales et isolez chaque tâche dans un arbre de travail séparé. Les fonctions GitHub nécessitent la CLI gh installée et une connexion sur l’hôte.",
|
||||
"description": "Suivez les demandes de modification liées à votre conversation, pull requests GitHub comme merge requests GitLab : consultez les vérifications et les revues, comparez le code et transmettez vos remarques à l’agent. Examinez les modifications locales et isolez chaque tâche dans un arbre de travail séparé. Les fonctions GitHub nécessitent la CLI gh installée et une connexion sur l’hôte. Les merge requests GitLab nécessitent la CLI glab installée et connectée sur l’hôte.",
|
||||
"detail": "docs/DETAIL.fr.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "変更リクエストとワークツリー",
|
||||
"description": "会話のサイドバーで関連付けられた GitHub PR をまとめて確認できます。チェックやレビューの状況、コードの差分を確認し、修正案をエージェントに渡せます。ローカルの変更確認や、独立したワークツリーによるタスクの分離にも対応します。GitHub 機能にはホストでの gh CLI のインストールとログインが必要です。",
|
||||
"description": "会話のサイドバーで関連付けられた変更リクエスト(GitHub PR と GitLab MR)をまとめて確認できます。チェックやレビューの状況、コードの差分を確認し、修正案をエージェントに渡せます。ローカルの変更確認や、独立したワークツリーによるタスクの分離にも対応します。GitHub 機能にはホストでの gh CLI のインストールとログインが必要です。GitLab のマージリクエストには、ホストに glab CLI をインストールしてサインインしておく必要があります。",
|
||||
"detail": "docs/DETAIL.ja.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Solicitações de alteração e árvores de trabalho",
|
||||
"description": "Acompanhe os pull requests do GitHub vinculados à conversa: consulte verificações e revisões, compare código e envie comentários ao agente. Revise alterações locais e isole cada tarefa em uma árvore de trabalho separada. Os recursos do GitHub exigem a CLI gh instalada e uma sessão iniciada no host.",
|
||||
"description": "Acompanhe as solicitações de alteração vinculadas à conversa, tanto pull requests do GitHub quanto merge requests do GitLab: consulte verificações e revisões, compare código e envie comentários ao agente. Revise alterações locais e isole cada tarefa em uma árvore de trabalho separada. Os recursos do GitHub exigem a CLI gh instalada e uma sessão iniciada no host. Os merge requests do GitLab exigem a CLI glab instalada e conectada no host.",
|
||||
"detail": "docs/DETAIL.pt.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Запросы на изменение и рабочие деревья",
|
||||
"description": "Следите за связанными с беседой pull request GitHub: проверками, рецензиями и различиями в коде, а затем передавайте замечания агенту. Просматривайте локальные изменения и изолируйте задачи в отдельных рабочих деревьях. Для функций GitHub требуется установить CLI gh и войти в аккаунт на хосте.",
|
||||
"description": "Следите за связанными с беседой запросами на изменение — pull request GitHub и merge request GitLab: проверками, рецензиями и различиями в коде, а затем передавайте замечания агенту. Просматривайте локальные изменения и изолируйте задачи в отдельных рабочих деревьях. Для функций GitHub требуется установить CLI gh и войти в аккаунт на хосте. Для merge request GitLab нужна установленная на хосте и авторизованная CLI glab.",
|
||||
"detail": "docs/DETAIL.ru.md"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "变更请求与工作树",
|
||||
"description": "在会话侧栏集中跟踪关联的 GitHub PR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。",
|
||||
"description": "在会话侧栏集中跟踪关联的代码变更请求,支持 GitHub PR 以及 GitLab MR:查看检查状态、评审意见与代码差异,并把修改建议交给智能体继续处理。也可查看本地改动,用独立工作树隔离任务。GitHub 功能需要本机安装 gh 并登录。GitLab 合并请求需要本机安装 glab 并登录。",
|
||||
"detail": "docs/DETAIL.zh.md"
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,8 @@
|
||||
"@deepseek-ai/dsh-experimental-forge-github": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-tool-worktree": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-worktree": "workspace:*"
|
||||
"@deepseek-ai/dsh-experimental-worktree": "workspace:*",
|
||||
"@deepseek-ai/dsh-forge-gitlab": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~"
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 2f8a621b991260a1
|
||||
/deepseek-ai-dsh-experimental-forge-github/use-this-package:
|
||||
en: 7e0ba1b3e7bdc1d6
|
||||
zh: 4e6f269af19b444d
|
||||
en: bd3669692c01e362
|
||||
zh: 658e45e1511649a0
|
||||
/deepseek-ai-dsh-experimental-forge-github/understand-the-implementation:
|
||||
en: 9b639e511e850042
|
||||
zh: 25a1a3bde330e7da
|
||||
en: b3407071292d7d98
|
||||
zh: dfe8f077cd041909
|
||||
/deepseek-ai-dsh-experimental-forge-github/further-exploration:
|
||||
en: d377d5fd9d9f190e
|
||||
zh: 920bcbfdb8c993f2
|
||||
|
||||
@@ -36,7 +36,9 @@ Mount the provider after the forge registry and list every GitHub Enterprise hos
|
||||
|
||||
The provider runs `gh` as a host process, even when Sessions execute commands in another execution world. Sign in once per host with `gh auth login --hostname <host>`. The child receives the host environment without `DSH_*` variables and without variables whose names contain `KEY`, `PASSWORD`, `SECRET`, or `TOKEN`, so `GH_TOKEN` and `GITHUB_TOKEN` are not forwarded and `gh` uses its own credential store. Prompts, update notices, pagers, and colors are disabled. `maxOutputBytes`, `maxReviewThreads`, `maxCommits`, and `maxViewedFiles` must be positive safe integers; only `timeoutMs` is bounded by the runtime timer limit. `ghCommand`, `hosts`, `timeoutMs`, `maxOutputBytes`, `maxReviewThreads`, `maxCommits`, and `maxViewedFiles` are listed in the [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-experimental-forge-github).
|
||||
|
||||
The provider serves a remote URL in `https`, `http`, `ssh`, or `git` form, or in scp form such as `[email protected]:owner/name.git`, when its host is configured. HTTP(S) remotes retain custom ports in the host identity; SSH and Git transport ports are excluded. It serves pull request URLs of the form `https://<host>/<owner>/<name>/pull/<number>` with any trailing path, query, or fragment, and builds that form without the suffix as the canonical URL. A readiness probe runs `gh auth status --hostname <host>`: exit status 0 is `ready`, another exit status is `unauthenticated` with the first diagnostic line, and a `gh` that cannot start is `unavailable`. A head lookup returns up to 20 open pull requests whose head is the branch, newest first, excluding pull requests from forks; a lookup of the default branch returns none.
|
||||
While [forge-session](../forge-session/README.md) runs, the plugin registers the `gh` command rule with it. `gh pr create` and `gh pr new` bind the pull requests they print. `gh pr view`, `gh pr edit`, and `gh pr checkout` bind the pull request that a URL selects, or a number with `--repo`, `--repo=`, or `-R` before or after it; a repository that contains its host, or a literal `GH_HOST` assignment, supplies the URL directly, and any other repository resolves through `gh pr view <number> --repo <repository> --json url --jq .url` in the call's shell. `gh api` binds the pull request its REST path names, such as `repos/octo/demo/pulls/7/files`: directly when `--hostname` or a literal `GH_HOST` assignment names the host, else through the same `gh pr view` lookup, without `--repo` for the `{owner}/{repo}` placeholders.
|
||||
|
||||
The provider serves a remote URL in `https`, `http`, `ssh`, or `git` form, or in scp form such as `[email protected]:owner/name.git`, when its host is configured. HTTP(S) remotes retain custom ports in the host identity; SSH and Git transport ports are excluded. It serves pull request URLs of the form `https://<host>/<owner>/<name>/pull/<number>` with any trailing path, query, or fragment, and builds that form without the suffix as the canonical URL. The provider lists its configured hosts in lowercase as `hosts`, names itself `GitHub`, and calls change requests pull requests. A readiness probe runs `gh auth status --hostname <host>`: exit status 0 is `ready`, another exit status is `unauthenticated` with the first diagnostic line and `gh auth login --hostname <host>` as its sign-in command, and a `gh` that cannot start is `unavailable`. A head lookup returns up to 20 open pull requests whose head is the branch, newest first, excluding pull requests from forks; a lookup of the default branch returns none.
|
||||
|
||||
Polling returns the first 100 head-commit check contexts without following pages. An incomplete preview sets `checksTruncated` and keeps GitHub’s aggregate state; its counts do not describe the full list. `fetchChecks(ref, signal)` reads complete details only for the requested PR, pinning continuation pages to the first response’s rollup. The combined UTF-8 JSON responses, review thread pages included, must fit `maxOutputBytes`; excess returns `too-large`. Failed or non-advancing pages fail only this detail read and leave polling results intact. Runs with the same application, workflow, event, and check name keep only the newest run id; a queued replacement supersedes an older completed run. Runs without a numeric database id are retained by node id because their relative age is unknown. Commit status contexts keep the newest result per context name. Complete lists derive their indicator from these results; unknown context kinds retain GitHub’s aggregate state.
|
||||
|
||||
@@ -48,11 +50,11 @@ A pull request is `mergeReady` when it is open, not a draft, GitHub reports its
|
||||
|
||||
`diff` reads `headRefOid` and `baseRefOid` in one GraphQL query and returns `stale` when the head is not the requested commit, which must be a full 40- or 64-digit hexadecimal commit. Otherwise it reads `repos/<owner>/<name>/compare/<baseRefOid>...<headSha>` through `gh api --allow-escape-sequences` with the diff media type, the patch from the merge base of both commits, so neither end follows a moving branch. Each status snapshot carries `baseRefOid` as `baseSha`, and leaves it out when GitHub reports no full commit there; given it, `diff` starts this comparison while the GraphQL query confirms the head, and a stale head or another base commit cancels the early comparison and waits for it to end before `diff` returns. For every open and merged pull request measured, this patch is byte-identical to `gh pr diff`, which takes no commit argument. Unlike the pull request diff, the compare endpoint returns diffs over 300 files, so only output over `maxOutputBytes` or GitHub's own refusal makes such a diff `too-large`. `--allow-escape-sequences` keeps terminal escape sequences that file contents hold, which `gh` 2.97 and newer otherwise refuse to print; an older `gh` rejects the option with `unknown flag` before sending a request and prints such sequences unchanged, so that rejection repeats the read without it. `fileText` reads `repos/<owner>/<name>/contents/<path>?ref=<commit>` through `gh api` with the raw media type and accepts only a full 40- or 64-digit hexadecimal commit. `fileUrl` returns `https://<host>/<owner>/<name>/blob/<commit>/<path>`. Both paths percent-encode each segment. `commits` reads a pull request's commits through GraphQL, 100 per page with the owner, name, number, and cursor as variables, until `maxCommits`; every page must report the head and commit count of the first one and a cursor no earlier page returned, else the listing is `unavailable`. `compare` reads the patch from the merge base of two full commits to the second through the same compare request as `diff`. `mergeBase` reads `merge_base_commit.sha` from `repos/<owner>/<name>/compare/<base>...<head>?page=2&per_page=1`, a page of the comparison that lists no files, and returns `unavailable` when the answer is not a full commit. A refused read becomes `not-found` for HTTP 404, `unauthenticated` for a diagnostic that mentions authentication, `too-large` for GitHub's HTTP 406 refusal or `too_large` error, which a diff or file over its size limit draws, and `unavailable` otherwise, with GitHub's message. A read whose output exceeds `maxOutputBytes` becomes `too-large`, and one that outlives `timeoutMs` becomes `unavailable`.
|
||||
|
||||
Review submission checks the current pull request head, then posts a single inline comment or one completed review through the REST API with an explicit `commit_id`. Multiline comments carry their side and inclusive start and end lines. Review decisions are Comment, Approve, and Request changes. JSON request bodies travel on stdin. The provider never retries a mutation: a timeout, unexpected response, or server error after dispatch returns an unknown outcome that the caller must reconcile on GitHub. A commit arriving between the check and the write can make the explicitly addressed review outdated; GitHub does not offer an atomic head precondition on these endpoints.
|
||||
Review submission checks the current pull request head, then posts a single inline comment or one completed review through the REST API with an explicit `commit_id`. Multiline comments carry their side and inclusive start and end lines. GitHub refuses a single comment while the user has a pending review, so the changes view offers one only while there is none. Review decisions are Comment, Approve, and Request changes. JSON request bodies travel on stdin. The provider never retries a mutation: a timeout, unexpected response, or server error after dispatch returns an unknown outcome that the caller must reconcile on GitHub. A commit arriving between the check and the write can make the explicitly addressed review outdated; GitHub does not offer an atomic head precondition on these endpoints.
|
||||
|
||||
`readReview` reads review threads with one GraphQL query that names `headRefOid` and the signed-in viewer's login, and returns `stale` when the head is not the requested commit. It reads threads in pages of up to 100 until it has read `maxReviewThreads` of them, each thread page after the first naming the head again, so a push during the read returns `stale`; it reads every comment of each thread through comment pages, which do not name the head, and the commits and `diffHunk` of a thread's first comment once. All pages together, measured as JSON, must fit `maxOutputBytes`: a later page that would pass it is dropped with the threads after it, and the result is marked `truncated`, as when more than `maxReviewThreads` threads exist; a first page whose output alone passes it fails the read as `too-large`. A thread on lines gets a `current` position only when GitHub reports it not outdated, with a `line`, and its first comment's `commit` is the head: a comment written on an earlier commit after a force-push keeps a `line` that numbers that commit, and GitHub can mark a thread outdated while keeping its `line`. `original` comes from `originalLine` and `originalStartLine` at the first comment's `originalCommit`; `subjectType: FILE` threads have neither. A range whose start is on the other side of the diff keeps its last line. Threads without comments are left out. A pull request or repository GitHub does not have makes the read `not-found`, as it does the commit listing. REST's `position` does not tell outdated threads apart and is not read.
|
||||
|
||||
The same first page reads what the signed-in viewer may write: each thread's `viewerCanReply` and, for its current state, `viewerCanResolve` or `viewerCanUnresolve`, and each comment's `viewerCanUpdate` and `viewerCanDelete`. It also reads the viewer's pending review, the `PENDING` review the viewer authored, with its comment count; GitHub lists a pending review only to its author, and the read takes up to 100 so the viewer's is found even if another were listed first. The viewer may start a pending review unless the repository is archived or the conversation is locked without `ADMIN`, `MAINTAIN`, or `WRITE` permission.
|
||||
The same first page reads what the signed-in viewer may write: each thread's `viewerCanReply` and, for its current state, `viewerCanResolve` or `viewerCanUnresolve`, and each comment's `viewerCanUpdate` and `viewerCanDelete`. It also reads the viewer's pending review, the `PENDING` review the viewer authored, with its comment count; GitHub lists a pending review only to its author, and the read takes up to 100 so the viewer's is found even if another were listed first. The viewer may start a pending review unless the repository is archived or the conversation is locked without `ADMIN`, `MAINTAIN`, or `WRITE` permission. A viewer who may review records any decision, except on a pull request whose `viewerDidAuthor` is true, where GitHub allows only a comment.
|
||||
|
||||
`writeReview` first reads the pull request's `headRefOid` and the viewer's pending review in one GraphQL query and returns `stale` without writing when the head is not `write.headSha`. It then sends one mutation with its variables as JSON on stdin: `addPullRequestReviewThreadReply`, inside the pending review for a pending reply; `resolveReviewThread` or `unresolveReviewThread`; `updatePullRequestReviewComment` or `deletePullRequestReviewComment`; `addPullRequestReviewThread` into the pending review, or `addPullRequestReview` at `write.headSha` with the comment as its first thread when the viewer has none; and `submitPullRequestReview` or `deletePullRequestReview` for the pending review the write names, which the check must still find. A pending reply without a pending review first starts an empty one at the head, so it takes two mutations; when the reply then fails, the empty review stays. A write to a thread or comment also reads, in the same check, the pull request that holds it, and returns `failed` without a mutation when that is another pull request. GitHub adds every reply of a user with a pending review to that review, even one sent without its id, so a reply at once returns `failed` without a mutation while the viewer has one; a thread added to a pending review numbers the lines of the current head, whichever commit the review started at. A mutation's payload means GitHub applied it; GraphQL errors whose types all name a refusal (`FORBIDDEN`, `INSUFFICIENT_SCOPES`, `NOT_FOUND`, `RATE_LIMITED`, `UNPROCESSABLE`) and HTTP 400, 401, 403, 404, 409, and 422 refusals return `failed`, as does a `gh` that cannot start; any other GraphQL error, such as GitHub's timeout message, a `gh` timeout, a server error, or an answer without the payload returns `unknown`. No mutation is retried.
|
||||
|
||||
@@ -72,7 +74,8 @@ A fetch groups references by host and sends one initial `gh api graphql` query p
|
||||
|
||||
| Source | Responsibility |
|
||||
|---|---|
|
||||
| [`src/index.ts`](src/index.ts) | Configuration validation and provider registration |
|
||||
| [`src/index.ts`](src/index.ts) | Configuration validation, and provider and command rule registration |
|
||||
| [`src/commands.ts`](src/commands.ts) | The `gh` command rule that forge-session binds pull requests by |
|
||||
| [`src/provider.ts`](src/provider.ts) | URL mapping, host grouping, and failure classification |
|
||||
| [`src/graphql.ts`](src/graphql.ts) | Query construction and response validation and mapping |
|
||||
| [`src/compare.ts`](src/compare.ts) | Patch between two commits through the compare API, shared by every diff read |
|
||||
|
||||
@@ -36,7 +36,9 @@ kind: "package-reference"
|
||||
|
||||
即使 Session 在其他执行环境中运行命令,提供方也以宿主进程的形式运行 `gh`。每个主机执行一次 `gh auth login --hostname <host>` 完成登录。子进程继承的宿主环境去掉了 `DSH_*` 变量以及名称包含 `KEY`、`PASSWORD`、`SECRET` 或 `TOKEN` 的变量,因此 `GH_TOKEN` 与 `GITHUB_TOKEN` 不会被转发,`gh` 使用自己的凭据存储。交互提示、更新提醒、分页器与颜色输出均被关闭。`maxOutputBytes`、`maxReviewThreads`、`maxCommits` 与 `maxViewedFiles` 必须是正安全整数;只有 `timeoutMs` 受运行时定时器上限约束。`ghCommand`、`hosts`、`timeoutMs`、`maxOutputBytes`、`maxReviewThreads`、`maxCommits` 与 `maxViewedFiles` 见[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-experimental-forge-github)。
|
||||
|
||||
当主机在配置中时,提供方服务 `https`、`http`、`ssh`、`git` 形式的远端 URL,以及 `[email protected]:owner/name.git` 这类 scp 形式。HTTP(S) 远端在主机标识中保留自定义端口;SSH 和 Git 传输端口不计入主机标识。它服务 `https://<host>/<owner>/<name>/pull/<number>` 形式的 pull request URL,允许其后附带任意路径、查询或片段,并以去掉这些后缀的形式作为规范 URL。就绪探测运行 `gh auth status --hostname <host>`:退出码为 0 时为 `ready`,其他退出码为 `unauthenticated` 并带第一行诊断,`gh` 无法启动时为 `unavailable`。按 head 分支查找时,最多返回 20 个以该分支为 head 的打开状态 pull request,按创建时间从新到旧排列,不包含来自 fork 的 pull request;查找默认分支时返回空结果。
|
||||
[forge-session](../forge-session/README.zh.md) 运行期间,插件向其注册 `gh` 命令规则。`gh pr create` 与 `gh pr new` 绑定它们打印的 pull request。`gh pr view`、`gh pr edit` 与 `gh pr checkout` 绑定 URL 选中的 pull request,或前后带有 `--repo`、`--repo=` 或 `-R` 的编号所选中的 pull request;包含主机的仓库参数或字面量 `GH_HOST` 赋值可直接确定 URL,其他仓库参数则在调用所在的 shell 中通过 `gh pr view <number> --repo <repository> --json url --jq .url` 解析。`gh api` 绑定其 REST 路径指向的 pull request,例如 `repos/octo/demo/pulls/7/files`:`--hostname` 或字面量 `GH_HOST` 赋值写明主机时直接绑定,否则通过同样的 `gh pr view` 查询解析,`{owner}/{repo}` 占位符则不带 `--repo`。
|
||||
|
||||
当主机在配置中时,提供方服务 `https`、`http`、`ssh`、`git` 形式的远端 URL,以及 `[email protected]:owner/name.git` 这类 scp 形式。HTTP(S) 远端在主机标识中保留自定义端口;SSH 和 Git 传输端口不计入主机标识。它服务 `https://<host>/<owner>/<name>/pull/<number>` 形式的 pull request URL,允许其后附带任意路径、查询或片段,并以去掉这些后缀的形式作为规范 URL。提供方以小写形式在 `hosts` 中列出配置的主机,自称 `GitHub`,并把变更请求称为拉取请求。就绪探测运行 `gh auth status --hostname <host>`:退出码为 0 时为 `ready`,其他退出码为 `unauthenticated`,带第一行诊断,并以 `gh auth login --hostname <host>` 作为登录命令,`gh` 无法启动时为 `unavailable`。按 head 分支查找时,最多返回 20 个以该分支为 head 的打开状态 pull request,按创建时间从新到旧排列,不包含来自 fork 的 pull request;查找默认分支时返回空结果。
|
||||
|
||||
轮询只返回 head 提交的前 100 条检查上下文,不追读后续页。预览不完整时设置 `checksTruncated` 并保留 GitHub 的汇总状态,局部计数不代表完整列表。`fetchChecks(ref, signal)` 仅按需读取指定 PR 的完整详情,后续页固定使用首次响应的 rollup。所有 JSON 响应(包括评审讨论分页)的 UTF-8 字节总量受 `maxOutputBytes` 限制,超出时返回 `too-large`。分页失败或游标不前进只使此次详情读取失败,保留轮询结果。同一应用、工作流、触发事件与检查名称的运行只保留运行 id 最新的一条;新的排队运行会替代旧的已完成运行。缺少数字数据库 id 的运行无法确定先后,因此按节点 id 保留。提交状态上下文按名称保留最新结果。完整列表从这些结果计算总体指示;未知上下文类型保留 GitHub 的汇总状态。
|
||||
|
||||
@@ -48,11 +50,11 @@ pull request 处于打开状态、不是草稿、GitHub 报告其合并状态为
|
||||
|
||||
`diff` 在一次 GraphQL 查询中读取 `headRefOid` 与 `baseRefOid`,head 不是请求的提交时返回 `stale`;请求的提交必须是完整的 40 位或 64 位十六进制提交。否则经 `gh api --allow-escape-sequences` 以 diff 媒体类型读取 `repos/<owner>/<name>/compare/<baseRefOid>...<headSha>`,即两个提交的合并基准到 head 的补丁,两端都不跟随移动的分支。每个状态快照把 `baseRefOid` 作为 `baseSha` 携带(GitHub 返回的不是完整提交时省略);拿到它时,`diff` 在 GraphQL 查询确认 head 的同时就开始这次比较,head 已过时或基准提交不同时会取消提前开始的比较并等它结束,然后才返回。实测的所有 open 与已合并 pull request 上,该补丁与不接受提交参数的 `gh pr diff` 逐字节一致。与 pull request diff 不同,compare 接口会返回超过 300 个文件的 diff,因此这类 diff 只有在输出超过 `maxOutputBytes` 或 GitHub 自身拒绝时才为 `too-large`。`--allow-escape-sequences` 保留文件内容中的终端转义序列;否则 `gh` 2.97 及以上版本拒绝输出。更早的 `gh` 在发出请求前就以 `unknown flag` 拒绝该选项,且原样输出这类序列,因此遇到这一拒绝时去掉该选项重读一次。`fileText` 经 `gh api` 以 raw 媒体类型读取 `repos/<owner>/<name>/contents/<path>?ref=<commit>`,只接受完整的 40 位或 64 位十六进制提交。`fileUrl` 返回 `https://<host>/<owner>/<name>/blob/<commit>/<path>`。两者的路径都逐段做百分号编码。`commits` 经 GraphQL 读取拉取请求的提交,每页 100 个,owner、name、number 与游标作为变量传入,直到 `maxCommits`;每一页报告的 head 与提交总数必须与第一页相同,游标也不能与之前任何一页重复,否则返回 `unavailable`。`compare` 用与 `diff` 相同的 compare 请求读取两个完整提交的合并基准到第二个提交的补丁。`mergeBase` 从 `repos/<owner>/<name>/compare/<base>...<head>?page=2&per_page=1` 读取 `merge_base_commit.sha`;这一页比较结果不列文件。返回值不是完整提交时为 `unavailable`。被拒绝的读取在 HTTP 404 时为 `not-found`,诊断提到身份验证时为 `unauthenticated`,GitHub 以 HTTP 406 拒绝或报告 `too_large` 错误时(diff 或文件超过其大小上限即会如此)为 `too-large`,其余为 `unavailable`,并带有 GitHub 的原因。输出超过 `maxOutputBytes` 的读取为 `too-large`,超过 `timeoutMs` 的为 `unavailable`。
|
||||
|
||||
提交评审时先检查 PR 当前的 head,再通过 REST API 发布单条行内评论或一次完整评审,并显式指定 `commit_id`。多行评论携带所属侧及包含端点的起止行号。评审结论为“评论”“批准”或“请求更改”。JSON 请求正文通过标准输入传递。provider 不会重试写操作;发送后的超时、异常响应或服务端错误会返回结果不明,由调用方到 GitHub 核对。检查与写入之间到来的新提交可能让已明确定位到旧提交的评审过时;GitHub 的这些接口不提供原子的 head 前置条件。
|
||||
提交评审时先检查 PR 当前的 head,再通过 REST API 发布单条行内评论或一次完整评审,并显式指定 `commit_id`。多行评论携带所属侧及包含端点的起止行号。用户有待提交评审时 GitHub 会拒绝单条评论,因此更改视图只在没有待提交评审时提供单条评论。评审结论为“评论”“批准”或“请求更改”。JSON 请求正文通过标准输入传递。provider 不会重试写操作;发送后的超时、异常响应或服务端错误会返回结果不明,由调用方到 GitHub 核对。检查与写入之间到来的新提交可能让已明确定位到旧提交的评审过时;GitHub 的这些接口不提供原子的 head 前置条件。
|
||||
|
||||
`readReview` 用一次 GraphQL 查询读取评审讨论,同时读出 `headRefOid` 和当前登录用户的登录名;head 不是所请求的提交时返回 `stale`。讨论按每页最多 100 个分页读取,直到读满 `maxReviewThreads` 个;第一页之后的每一页讨论都会再次读取 head,因此读取期间有新的推送时返回 `stale`。每个讨论的评论都会经评论分页全部读出,评论分页不读取 head;讨论第一条评论的提交和 `diffHunk` 只读一次。所有页面按 JSON 计合计不得超过 `maxOutputBytes`:之后的某一页会超出上限时,该页及其后的讨论被丢弃,结果标记为 `truncated`,与讨论数超过 `maxReviewThreads` 时相同;第一页的输出本身超过上限时,读取以 `too-large` 失败。行级讨论只有在 GitHub 报告它未过期、带有 `line`,且第一条评论的 `commit` 就是 head 时,才得到 `current` 位置:force-push 之后写在旧提交上的评论保留的 `line` 是那个旧提交的行号,GitHub 也可能在标记讨论过期的同时保留它的 `line`。`original` 取自第一条评论 `originalCommit` 上的 `originalLine` 和 `originalStartLine`;`subjectType: FILE` 的讨论两者都没有。起始行在 diff 另一侧的范围只保留最后一行。没有评论的讨论会被略去。GitHub 上不存在该 PR 或仓库时,读取返回 `not-found`,与读取提交列表时相同。REST 的 `position` 无法区分已过期的讨论,因此不读取。
|
||||
|
||||
同一第一页还会读出当前登录用户可以写入哪些内容:每个讨论的 `viewerCanReply`,以及按讨论当前状态读取的 `viewerCanResolve` 或 `viewerCanUnresolve`,每条评论的 `viewerCanUpdate` 和 `viewerCanDelete`。它也读出该用户的待提交评审,即该用户自己写的 `PENDING` 评审,连同它的评论数;GitHub 只向作者列出待提交评审,读取最多取 100 条,即使排在前面的是别人的评审,也能找到该用户自己的。除非仓库已归档,或对话已锁定且用户没有 `ADMIN`、`MAINTAIN` 或 `WRITE` 权限,用户都可以开始待提交评审。
|
||||
同一第一页还会读出当前登录用户可以写入哪些内容:每个讨论的 `viewerCanReply`,以及按讨论当前状态读取的 `viewerCanResolve` 或 `viewerCanUnresolve`,每条评论的 `viewerCanUpdate` 和 `viewerCanDelete`。它也读出该用户的待提交评审,即该用户自己写的 `PENDING` 评审,连同它的评论数;GitHub 只向作者列出待提交评审,读取最多取 100 条,即使排在前面的是别人的评审,也能找到该用户自己的。除非仓库已归档,或对话已锁定且用户没有 `ADMIN`、`MAINTAIN` 或 `WRITE` 权限,用户都可以开始待提交评审。可以评审的用户能记录任何结论,但在 `viewerDidAuthor` 为 true 的拉取请求上,GitHub 只允许评论。
|
||||
|
||||
`writeReview` 先用一次 GraphQL 查询读出 pull request 的 `headRefOid` 和用户的待提交评审;head 不是 `write.headSha` 时不写入,直接返回 `stale`。随后发送一个 mutation,变量以 JSON 形式经 stdin 传入:回复用 `addPullRequestReviewThreadReply`,待提交的回复加入待提交评审;`resolveReviewThread` 或 `unresolveReviewThread`;`updatePullRequestReviewComment` 或 `deletePullRequestReviewComment`;新评论用 `addPullRequestReviewThread` 加入待提交评审,用户还没有待提交评审时,用 `addPullRequestReview` 在 `write.headSha` 上开始一个评审,并把这条评论作为它的第一个讨论;提交或丢弃用 `submitPullRequestReview` 或 `deletePullRequestReview`,作用于写操作指定的待提交评审,检查时必须仍能找到它。没有待提交评审时,待提交的回复会先在 head 上开始一个空评审,因此需要两个 mutation;回复随后失败时,这个空评审会保留下来。写入讨论或评论时,同一次检查还会读出它所属的 pull request,不是当前 pull request 时不发送 mutation,直接返回 `failed`。用户有待提交评审时,GitHub 会把该用户的每条回复都加入这个评审,即使发送时没有带上评审 id;因此该用户有待提交评审时,立即回复不发送 mutation,直接返回 `failed`。加入待提交评审的讨论使用当前 head 的行号,与评审开始时所在的提交无关。mutation 返回 payload 即表示 GitHub 已执行;错误类型全部表示拒绝(`FORBIDDEN`、`INSUFFICIENT_SCOPES`、`NOT_FOUND`、`RATE_LIMITED`、`UNPROCESSABLE`)的 GraphQL 错误以及 HTTP 400、401、403、404、409、422 拒绝返回 `failed`,`gh` 无法启动时也是如此;其他 GraphQL 错误(例如 GitHub 的超时提示)、`gh` 超时、服务端错误或没有 payload 的响应返回 `unknown`。mutation 从不重试。
|
||||
|
||||
@@ -72,7 +74,8 @@ pull request 处于打开状态、不是草稿、GitHub 报告其合并状态为
|
||||
|
||||
| 源码 | 职责 |
|
||||
|---|---|
|
||||
| [`src/index.ts`](src/index.ts) | 配置校验与提供方注册 |
|
||||
| [`src/index.ts`](src/index.ts) | 配置校验,以及提供方与命令规则注册 |
|
||||
| [`src/commands.ts`](src/commands.ts) | forge-session 据以绑定 pull request 的 `gh` 命令规则 |
|
||||
| [`src/provider.ts`](src/provider.ts) | URL 映射、按主机分组与失败分类 |
|
||||
| [`src/graphql.ts`](src/graphql.ts) | 构造查询,并校验和映射响应 |
|
||||
| [`src/compare.ts`](src/compare.ts) | 经 compare API 读取两个提交之间的补丁,供所有 diff 读取共用 |
|
||||
|
||||
@@ -41,12 +41,19 @@
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/dsh-experimental-forge": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-subprocess": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/dsh-brand": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge": "workspace:*",
|
||||
"@deepseek-ai/dsh-experimental-forge-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-subprocess": "workspace:*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@deepseek-ai/dsh-experimental-forge-session": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/** The GitHub CLI commands that bind pull requests to a Session through forge-session. */
|
||||
|
||||
import type { ForgeCommandArguments, ForgeCommandRule, ForgeCommandSelection } from '@deepseek-ai/dsh-experimental-forge-session'
|
||||
|
||||
const REPOSITORY = /^(?:([a-z\d.-]+(?::\d+)?)\/)?([a-z\d_-]+)\/([a-z\d_.-]+)$/i
|
||||
const PULL_URL = /^(https?:\/\/[^\s/]+\/[^\s/]+\/[^\s/]+\/pull\/[1-9]\d*)(?:[/?#].*)?$/
|
||||
const HOST = /^[a-z\d.-]+(?::\d+)?$/i
|
||||
/** A REST path that names one pull request of a repository. */
|
||||
const API_PULL = /^\/?repos\/([^/\s?#]+)\/([^/\s?#]+)\/pulls\/([1-9]\d*)(?:[/?#].*)?$/
|
||||
/** Placeholder pairs that `gh api` fills from the repository of the current directory. */
|
||||
const CURRENT_REPOSITORY = new Set(['{owner}/{repo}', ':owner/:repo'])
|
||||
|
||||
/**
|
||||
* `gh pr create` prints the pull request it opens; `gh pr view`, `gh pr edit`, and `gh pr checkout` act on the pull
|
||||
* request a URL or a number with `--repo`/`-R` selects. A number whose repository names no host takes `GH_HOST` from
|
||||
* the command's assignments, else resolves through `gh pr view` in the call's shell. `gh api` binds the pull request its
|
||||
* REST path names, such as `repos/octo/demo/pulls/7/files`: directly with `--hostname` or `GH_HOST`, else through
|
||||
* `gh pr view`, which for the `{owner}/{repo}` placeholders reads the repository of the current directory.
|
||||
*/
|
||||
export const GH_COMMANDS: ForgeCommandRule = {
|
||||
id: 'gh',
|
||||
version: 2,
|
||||
executable: 'gh',
|
||||
creates: [['pr', 'create'], ['pr', 'new']],
|
||||
references: {
|
||||
subcommands: [['pr', 'view'], ['pr', 'edit'], ['pr', 'checkout']],
|
||||
valueOptions: [
|
||||
'--repo', '-R', '--json', '--jq', '-q', '--template', '-t', '--title', '--body', '-b', '--body-file', '-F', '--base',
|
||||
'-B', '--add-assignee', '--add-label', '--add-project', '--add-reviewer', '--milestone', '-m', '--remove-assignee',
|
||||
'--remove-label', '--remove-project', '--remove-reviewer', '--branch',
|
||||
],
|
||||
flagOptions: ['--comments', '-c', '--web', '-w', '--detach', '-d', '--force', '-f', '--recurse-submodules', '--remove-milestone'],
|
||||
},
|
||||
apiRequests: {
|
||||
subcommands: [['api']],
|
||||
valueOptions: [
|
||||
'--hostname', '--method', '-X', '--field', '-F', '--raw-field', '-f', '--header', '-H', '--input', '--jq', '-q', '--template',
|
||||
'-t', '--preview', '-p', '--cache',
|
||||
],
|
||||
flagOptions: ['--include', '-i', '--paginate', '--slurp', '--silent', '--verbose', '--allow-escape-sequences'],
|
||||
},
|
||||
changeRequestPath: String.raw`\/pull\/\d+`,
|
||||
urlMembers: ['url'],
|
||||
select: (command, environment) => command.kind === 'api-request' ? selectApiPullRequest(command, environment) : selectPullRequest(command, environment),
|
||||
}
|
||||
|
||||
function selectPullRequest(
|
||||
{ operands, values }: ForgeCommandArguments,
|
||||
environment: Readonly<Record<string, string>>,
|
||||
): ForgeCommandSelection | undefined {
|
||||
const [selector] = operands
|
||||
if (selector === undefined || operands.length !== 1) return undefined
|
||||
const url = PULL_URL.exec(selector)?.[1]
|
||||
if (url !== undefined) return { url }
|
||||
const repository = values.findLast(([option]) => option === '--repo' || option === '-R')?.[1]
|
||||
if (!/^[1-9]\d*$/.test(selector) || !Number.isSafeInteger(Number(selector)) || repository === undefined) return undefined
|
||||
const match = REPOSITORY.exec(repository.replace(/^https?:\/\//, '').replace(/\.git$/, ''))
|
||||
if (match === null || match[3] === '.' || match[3] === '..') return undefined
|
||||
const [, repoHost, owner, name] = match
|
||||
const host = repoHost ?? environment.GH_HOST
|
||||
if (host !== undefined && HOST.test(host)) return { url: `https://${host}/${owner}/${name}/pull/${selector}` }
|
||||
return { lookup: lookup(selector, repository) }
|
||||
}
|
||||
|
||||
function selectApiPullRequest(
|
||||
{ operands, values }: ForgeCommandArguments,
|
||||
environment: Readonly<Record<string, string>>,
|
||||
): ForgeCommandSelection | undefined {
|
||||
const [endpoint] = operands
|
||||
const match = endpoint === undefined || operands.length !== 1 ? null : API_PULL.exec(endpoint)
|
||||
if (match === null) return undefined
|
||||
const [, owner, name, number] = match
|
||||
if (!Number.isSafeInteger(Number(number))) return undefined
|
||||
if (CURRENT_REPOSITORY.has(`${owner}/${name}`)) return { lookup: lookup(String(number)) }
|
||||
const repository = REPOSITORY.exec(`${owner}/${name}`)
|
||||
if (repository === null || name === '.' || name === '..') return undefined
|
||||
const host = values.findLast(([option]) => option === '--hostname')?.[1] ?? environment.GH_HOST
|
||||
if (host === undefined) return { lookup: lookup(String(number), `${owner}/${name}`) }
|
||||
return HOST.test(host) ? { url: `https://${host}/${owner}/${name}/pull/${number}` } : undefined
|
||||
}
|
||||
|
||||
/** `gh pr view` printing one pull request's URL, in `repository` or in the repository of the current directory. */
|
||||
function lookup(number: string, repository?: string): string[] {
|
||||
return ['gh', 'pr', 'view', number, ...repository === undefined ? [] : ['--repo', repository], '--json', 'url', '--jq', '.url']
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
/** Registers the GitHub provider of `ctx.forge`, which reads pull requests through the GitHub CLI on the host. */
|
||||
/**
|
||||
* Registers the GitHub provider of `ctx.forge`, which reads pull requests through the GitHub CLI on the host, and, while
|
||||
* forge-session runs, the `gh` commands that bind pull requests to a Session.
|
||||
*/
|
||||
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import z from '@deepseek-ai/schemastery'
|
||||
import type {} from '@deepseek-ai/dsh-experimental-forge'
|
||||
import type {} from '@deepseek-ai/dsh-experimental-forge-session'
|
||||
import { MAX_TIMER_DELAY_MS } from '@deepseek-ai/dsh-timeout'
|
||||
import { GH_COMMANDS } from './commands.ts'
|
||||
import { ghRunner } from './gh.ts'
|
||||
import { GitHubProvider } from './provider.ts'
|
||||
|
||||
@@ -57,4 +62,7 @@ export function apply(ctx: Context, config: Config): void {
|
||||
if (!Number.isSafeInteger(resolved[key]) || resolved[key] <= 0) throw new Error(`forge-github: ${key} must be a positive safe integer`)
|
||||
}
|
||||
ctx.forge.register(new GitHubProvider(ghRunner(resolved), resolved.hosts, resolved))
|
||||
ctx.inject(['forgeSession'], (scope) => {
|
||||
scope.forgeSession.registerCommands(GH_COMMANDS)
|
||||
})
|
||||
}
|
||||
@@ -53,7 +53,10 @@ export interface GitHubLimits {
|
||||
/** Reads GitHub and GitHub Enterprise pull requests through a `gh` runner. */
|
||||
export class GitHubProvider implements ForgeProvider {
|
||||
readonly forge = 'github'
|
||||
private readonly hosts: ReadonlySet<string>
|
||||
readonly hosts: readonly string[]
|
||||
readonly label = 'GitHub'
|
||||
readonly changeRequestNoun = 'pull-request'
|
||||
private readonly served: ReadonlySet<string>
|
||||
|
||||
async submitReview(ref: ChangeRequestRef, request: ForgeReviewRequest, signal: AbortSignal): Promise<ForgeReviewResult> {
|
||||
const failure = this.hostFailure(ref.repository.host)
|
||||
@@ -90,18 +93,19 @@ export class GitHubProvider implements ForgeProvider {
|
||||
* viewed files.
|
||||
*/
|
||||
constructor(private readonly gh: GhRunner, hosts: readonly string[], private readonly limits: GitHubLimits) {
|
||||
this.hosts = new Set(hosts.map(host => host.toLowerCase()))
|
||||
this.hosts = [...new Set(hosts.map(host => host.toLowerCase()))]
|
||||
this.served = new Set(this.hosts)
|
||||
}
|
||||
|
||||
repositoryFromRemote(url: string): ForgeRepository | undefined {
|
||||
const location = parseRemoteUrl(url)
|
||||
if (location === undefined || !this.hosts.has(location.host)) return undefined
|
||||
if (location === undefined || !this.served.has(location.host)) return undefined
|
||||
return { forge: this.forge, ...location }
|
||||
}
|
||||
|
||||
changeRequestFromUrl(url: string): ChangeRequestRef | undefined {
|
||||
const parsed = parsePullRequestUrl(url)
|
||||
if (parsed === undefined || !this.hosts.has(parsed.host)) return undefined
|
||||
if (parsed === undefined || !this.served.has(parsed.host)) return undefined
|
||||
return { repository: { forge: this.forge, host: parsed.host, owner: parsed.owner, name: parsed.name }, number: parsed.number }
|
||||
}
|
||||
|
||||
@@ -361,13 +365,17 @@ export class GitHubProvider implements ForgeProvider {
|
||||
|
||||
async readiness(host: string, signal: AbortSignal): Promise<ForgeReadiness> {
|
||||
const failure = this.hostFailure(host)
|
||||
if (failure !== undefined) return { state: 'unavailable', message: failure.message }
|
||||
if (failure !== undefined) return { state: 'unavailable', message: failure.message, signIn: null }
|
||||
try {
|
||||
const output = await this.gh(['auth', 'status', '--hostname', host], signal)
|
||||
if (output.exitCode === 0) return { state: 'ready', message: null }
|
||||
return { state: 'unauthenticated', message: firstLine(output.stderr) ?? firstLine(output.stdout) ?? `gh is not signed in to ${host}` }
|
||||
if (output.exitCode === 0) return { state: 'ready', message: null, signIn: null }
|
||||
return {
|
||||
state: 'unauthenticated',
|
||||
message: firstLine(output.stderr) ?? firstLine(output.stdout) ?? `gh is not signed in to ${host}`,
|
||||
signIn: { command: `gh auth login --hostname ${host}` },
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof GhUnavailableError) return { state: 'unavailable', message: error.message }
|
||||
if (error instanceof GhUnavailableError) return { state: 'unavailable', message: error.message, signIn: null }
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -435,7 +443,7 @@ export class GitHubProvider implements ForgeProvider {
|
||||
}
|
||||
|
||||
private hostFailure(host: string): ForgeFailure | undefined {
|
||||
return this.hosts.has(host.toLowerCase()) ? undefined : {
|
||||
return this.served.has(host.toLowerCase()) ? undefined : {
|
||||
code: 'unavailable', message: `forge-github: host ${JSON.stringify(host)} is not configured`,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import { Buffer } from 'node:buffer'
|
||||
import type {
|
||||
ChangeRequestRef, ForgeAnchor, ForgeCommentId, ForgeFailure, ForgeReviewComment, ForgeReviewData, ForgeReviewId, ForgeReviewThread,
|
||||
ForgeThreadId,
|
||||
ChangeRequestRef, ForgeAnchor, ForgeCommentId, ForgeFailure, ForgeReviewComment, ForgeReviewData, ForgeReviewEvent, ForgeReviewId,
|
||||
ForgeReviewThread, ForgeThreadId,
|
||||
} from '@deepseek-ai/dsh-experimental-forge'
|
||||
import { z } from 'zod'
|
||||
import type { GraphqlReader } from './commits.ts'
|
||||
@@ -39,7 +39,7 @@ export const REVIEW_QUERY = `query($owner: String!, $name: String!, $number: Int
|
||||
repository(owner: $owner, name: $name) {
|
||||
isArchived viewerPermission
|
||||
pullRequest(number: $number) {
|
||||
id headRefOid locked
|
||||
id headRefOid locked viewerDidAuthor
|
||||
reviews(states: PENDING, first: 100) { nodes { id viewerDidAuthor comments { totalCount } } }
|
||||
reviewThreads(first: $first) { ${THREAD_PAGE} }
|
||||
}
|
||||
@@ -115,6 +115,7 @@ const pullRequestSchema = z.object({
|
||||
id: z.string(),
|
||||
headRefOid: z.string(),
|
||||
locked: z.boolean(),
|
||||
viewerDidAuthor: z.boolean(),
|
||||
reviews: z.object({ nodes: z.array(pendingSchema) }),
|
||||
reviewThreads: threadPageSchema,
|
||||
})
|
||||
@@ -179,7 +180,11 @@ export async function readReviewThreads(
|
||||
const pendingReview = pending === undefined ? null : { id: pending.id as ForgeReviewId, comments: pending.comments.totalCount }
|
||||
// GitHub refuses every write to an archived repository, and comments on a locked conversation from anyone without write access.
|
||||
const viewerCanReview = !repository.isArchived && (!pull.locked || WRITERS.has(repository.viewerPermission ?? ''))
|
||||
const result = (truncated: boolean): ForgeReviewData => ({ headSha, viewer, threads, truncated, pendingReview, viewerCanReview })
|
||||
// GitHub lets the author of a pull request comment on it but not approve it or request changes.
|
||||
const reviewEvents: readonly ForgeReviewEvent[] = !viewerCanReview ? [] : pull.viewerDidAuthor ? ['comment'] : ['comment', 'approve', 'request-changes']
|
||||
const result = (truncated: boolean): ForgeReviewData => ({
|
||||
headSha, viewer, threads, truncated, pendingReview, viewerCanReview, reviewEvents,
|
||||
})
|
||||
const cursors = new Set<string>()
|
||||
for (;;) {
|
||||
for (const node of page.nodes.slice(0, limits.maxReviewThreads - threads.length)) {
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { compileRules } from '@deepseek-ai/dsh-experimental-forge-session/src/commands.ts'
|
||||
import { GH_COMMANDS } from '../src/commands.ts'
|
||||
|
||||
const rules = compileRules([GH_COMMANDS])
|
||||
|
||||
describe('gh command rule', () => {
|
||||
const url = 'https://ghe.example/octo/demo/pull/5960'
|
||||
|
||||
it.each([
|
||||
'gh pr view 5960 --repo ghe.example/octo/demo --json number,title,body 2>&1 | head -200',
|
||||
'gh -R ghe.example/octo/demo pr view --json number 5960',
|
||||
'gh pr edit --repo="ghe.example/octo/demo" --title "New title" 5960',
|
||||
"gh pr checkout -Rghe.example/octo/demo '5960'",
|
||||
'GH_HOST=ghe.example gh pr view 5960 -R octo/demo',
|
||||
'env GH_HOST=ghe.example gh pr view 5960 -R octo/demo',
|
||||
'GH_HOST=other.example gh pr view 5960 -R ghe.example/octo/demo',
|
||||
'gh pr view 5960 -R https://ghe.example/octo/demo.git',
|
||||
`gh pr view --json title '${url}/files'`,
|
||||
'gh pr view --comments 5960 -R ghe.example/octo/demo',
|
||||
'gh pr edit 5960 --title=Fixed -R ghe.example/octo/demo',
|
||||
])('names the pull request of %s', (command) => {
|
||||
expect(rules.named(command)).toEqual([{ url, lookup: null, rule: 'gh', kind: 'reference' }])
|
||||
})
|
||||
|
||||
it('looks up a repository without a host through gh in the same environment', () => {
|
||||
expect(rules.named('gh pr view 5960 --repo deepseek-harness/deepseek-harness --json number,title,body 2>&1 | head -200')).toEqual([
|
||||
{ url: null, lookup: 'env gh pr view 5960 --repo deepseek-harness/deepseek-harness --json url --jq .url', rule: 'gh', kind: 'reference' },
|
||||
])
|
||||
expect(rules.named('GH_CONFIG_DIR="/tmp/gh config" gh pr edit 12 -R octo/demo --title "A title"')).toEqual([
|
||||
{ url: null, lookup: "env 'GH_CONFIG_DIR=/tmp/gh config' gh pr view 12 --repo octo/demo --json url --jq .url", rule: 'gh', kind: 'reference' },
|
||||
])
|
||||
expect(rules.named('GH_HOST= gh pr view 12 -R octo/demo')).toEqual([
|
||||
{ url: null, lookup: String.raw`env GH_HOST\= gh pr view 12 --repo octo/demo --json url --jq .url`, rule: 'gh', kind: 'reference' },
|
||||
])
|
||||
})
|
||||
|
||||
it('keeps repository and selector in the same command, and does not look up in a compound shell environment', () => {
|
||||
expect(rules.named('gh pr view 5960 --json number && echo --repo ghe.example/octo/demo')).toEqual([])
|
||||
expect(rules.named('echo --repo ghe.example/octo/demo | gh pr view 5960')).toEqual([])
|
||||
expect(rules.named('cd other && gh pr view 5960 -R octo/demo')).toEqual([{ url: null, lookup: null, rule: 'gh', kind: 'reference' }])
|
||||
expect(rules.named('gh pr view 5960 -R octo/demo | custom-command')).toEqual([{ url: null, lookup: null, rule: 'gh', kind: 'reference' }])
|
||||
expect(rules.named('gh pr view 5960 -R ghe.example/octo/demo && gh pr checkout 12 -R github.com/other/repo')).toEqual([
|
||||
{ url, lookup: null, rule: 'gh', kind: 'reference' },
|
||||
{ url: 'https://github.com/other/repo/pull/12', lookup: null, rule: 'gh', kind: 'reference' },
|
||||
])
|
||||
})
|
||||
|
||||
it.each([
|
||||
'echo "gh pr view 5960 --repo ghe.example/octo/demo"',
|
||||
'gh pr view 5960 --repo "$REPO"',
|
||||
'gh pr view 5960 -R ghe.example/*/demo',
|
||||
'gh pr view 5960 -R ghe.example/octo/demo > output.txt',
|
||||
'gh pr view 5960 -R ghe.example/octo/demo # comment',
|
||||
'gh pr view topic -R ghe.example/octo/demo',
|
||||
'gh pr view - -R ghe.example/octo/demo',
|
||||
'gh pr edit --title 5960 --repo ghe.example/octo/demo',
|
||||
'gh pr view 5960 --unknown 42 --repo ghe.example/octo/demo',
|
||||
'gh pr view 5960 --repo',
|
||||
'gh pr view 5960 --repo=',
|
||||
'gh pr view 5960 -R bad/repo/extra/path',
|
||||
'gh pr view 5960 -R ghe.example/octo/..',
|
||||
'gh pr view 99999999999999999999 -R ghe.example/octo/demo',
|
||||
'gh pr view 1 2 -R ghe.example/octo/demo',
|
||||
'gh pr view --json',
|
||||
'gh pr view --help -R ghe.example/octo/demo',
|
||||
'gh pr edit --title --repo ghe.example/octo/demo 5960',
|
||||
'gh pr list -R ghe.example/octo/demo',
|
||||
'gh pr view',
|
||||
])('names nothing for unsupported or ambiguous input: %s', (command) => {
|
||||
expect(rules.named(command)).toEqual([])
|
||||
})
|
||||
|
||||
describe('gh api', () => {
|
||||
it.each([
|
||||
['gh api --hostname ghe.example repos/octo/demo/pulls/5960', 'https://ghe.example/octo/demo/pull/5960'],
|
||||
['GH_HOST=ghe.example gh api repos/octo/demo/pulls/5960/files --paginate', 'https://ghe.example/octo/demo/pull/5960'],
|
||||
['gh api -f body=LGTM -X POST /repos/octo/demo/pulls/5960/reviews --hostname=github.com --jq .id', 'https://github.com/octo/demo/pull/5960'],
|
||||
])('names the pull request a REST path names: %s', (command, url) => {
|
||||
expect(rules.named(command)).toEqual([{ url, lookup: null, rule: 'gh', kind: 'api-request' }])
|
||||
})
|
||||
|
||||
it('looks up a path without a host through gh, in the current repository for its placeholders', () => {
|
||||
expect(rules.named('gh api repos/octo/demo/pulls/12')).toEqual([
|
||||
{ url: null, lookup: 'env gh pr view 12 --repo octo/demo --json url --jq .url', rule: 'gh', kind: 'api-request' },
|
||||
])
|
||||
expect(rules.named("gh api 'repos/{owner}/{repo}/pulls/12/comments'")).toEqual([
|
||||
{ url: null, lookup: 'env gh pr view 12 --json url --jq .url', rule: 'gh', kind: 'api-request' },
|
||||
])
|
||||
expect(rules.named('gh api repos/:owner/:repo/pulls/12')).toEqual([
|
||||
{ url: null, lookup: 'env gh pr view 12 --json url --jq .url', rule: 'gh', kind: 'api-request' },
|
||||
])
|
||||
})
|
||||
|
||||
it.each([
|
||||
'gh api --hostname ghe.example repos/octo/demo/pulls',
|
||||
'gh api --hostname ghe.example repos/octo/demo/issues/7',
|
||||
'gh api --hostname ghe.example repos/octo/../pulls/7',
|
||||
'gh api --hostname ghe.example repos/oc%20to/demo/pulls/7',
|
||||
'gh api --hostname https://ghe.example repos/octo/demo/pulls/7',
|
||||
'gh api --hostname ghe.example repos/octo/demo/pulls/99999999999999999999',
|
||||
'gh api --bogus repos/octo/demo/pulls/7',
|
||||
'gh api graphql -f query=x',
|
||||
'gh api repos/octo/demo/pulls/7 repos/octo/demo/pulls/8',
|
||||
'gh api --hostname ghe.example',
|
||||
])('names nothing for %s', (command) => {
|
||||
expect(rules.named(command)).toEqual([])
|
||||
})
|
||||
|
||||
it('reads -f as a value of gh api and as a flag of gh pr checkout', () => {
|
||||
expect(rules.named('gh pr checkout -f 5960 -R ghe.example/octo/demo')).toEqual([{ url, lookup: null, rule: 'gh', kind: 'reference' }])
|
||||
})
|
||||
})
|
||||
})
|
||||
Loaded 100 of 196 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user