@fitlab-ai/agent-infra 0.11.8 → 0.11.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/lib/agent-clients/custom-tool-invocations.js +92 -0
  4. package/dist/lib/agent-clients/next-steps.js +1 -1
  5. package/dist/lib/agent-clients/reconcile.js +3 -3
  6. package/dist/lib/agent-clients/schema.js +18 -10
  7. package/dist/lib/init.js +2 -2
  8. package/dist/lib/internal/agent-client.js +3 -3
  9. package/dist/lib/sandbox/recovery.js +1 -22
  10. package/dist/lib/sandbox/tools.js +2 -0
  11. package/dist/lib/task/finalization.js +90 -93
  12. package/dist/lib/task/verification.js +0 -1
  13. package/dist/lib/update.js +2 -2
  14. package/dist/lifecycle-build-manifest.json +3 -3
  15. package/lib/agent-clients/custom-tool-invocations.ts +129 -0
  16. package/lib/agent-clients/next-steps.ts +3 -3
  17. package/lib/agent-clients/reconcile.ts +3 -3
  18. package/lib/agent-clients/schema.ts +18 -10
  19. package/lib/init.ts +2 -2
  20. package/lib/internal/agent-client.ts +3 -3
  21. package/lib/sandbox/recovery.ts +0 -25
  22. package/lib/sandbox/tool-types.ts +1 -0
  23. package/lib/sandbox/tools.ts +2 -0
  24. package/lib/task/finalization.ts +91 -88
  25. package/lib/task/verification.ts +1 -2
  26. package/lib/update.ts +2 -3
  27. package/package.json +1 -1
  28. package/templates/.agents/README.en.md +2 -50
  29. package/templates/.agents/README.zh-CN.md +2 -50
  30. package/templates/.agents/rules/next-step-output.en.md +1 -1
  31. package/templates/.agents/rules/next-step-output.zh-CN.md +1 -1
  32. package/templates/.agents/scripts/lib/agent-infra-package.js +0 -7
  33. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  34. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  35. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  36. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  37. package/templates/.agents/skills/review-code/SKILL.en.md +1 -1
  38. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +1 -1
  39. package/templates/.agents/skills/review-code/reference/output-templates.en.md +15 -6
  40. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +15 -6
  41. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +1 -1
  42. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -1
  43. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +2 -268
  44. package/dist/lib/agent-clients/custom-tuis.js +0 -99
  45. package/lib/agent-clients/custom-tuis.ts +0 -149
@@ -261,59 +261,11 @@ When you disable a built-in client, reconciliation stops maintaining its seed co
261
261
  ### Relation to other config fields
262
262
 
263
263
  - `sandbox.tools.ids` lists non-client tools such as `agent-infra` and custom tools; custom definitions belong in `sandbox.tools.definitions`. Built-in client installation belongs in `agentClients[].installInSandbox`.
264
- - `agentClients` is independent from `customTUIs` (see below). Custom TUI command files are preserved even when their directory is under a disabled built-in client's path prefix.
265
-
266
- ## Custom TUI Configuration
267
-
268
- Use the top-level `.agents/.airc.json` `customTUIs` array when your team uses an AI TUI that is not one of the built-in command targets. This config lets agent-infra show the correct next-step commands and generate command files for project custom skills by learning from an existing command in the custom TUI directory.
269
-
270
- | Field | Required | Meaning |
271
- |-------|----------|---------|
272
- | `name` | Yes | Display name shown in reports and next-step guidance, for example `<your-tui-name>`. |
273
- | `dir` | Yes | Command directory relative to the project root, for example `.<your-tui>/commands`. The path must stay inside the project root. |
274
- | `invoke` | Yes | User-facing command template used in next-step guidance. |
275
-
276
- Supported `invoke` placeholders:
277
-
278
- | Placeholder | Replaced with | Example |
279
- |-------------|---------------|---------|
280
- | `${skillName}` | The skill command name, such as `review-code` or `commit`. | `<your-cli> ${skillName}` -> `<your-cli> review-code` |
281
- | `${projectName}` | The `.airc.json` `project` value. Use this for namespaced commands. | `/${projectName}:${skillName}` -> `/your-project:review-code` |
282
-
283
- Non-namespaced custom TUI:
284
-
285
- ```json
286
- {
287
- "customTUIs": [
288
- {
289
- "name": "<your-tui-name>",
290
- "dir": ".<your-tui>/commands",
291
- "invoke": "<your-cli> ${skillName}"
292
- }
293
- ]
294
- }
295
- ```
296
-
297
- Namespaced custom TUI:
298
-
299
- ```json
300
- {
301
- "project": "your-project",
302
- "customTUIs": [
303
- {
304
- "name": "<your-tui-name>",
305
- "dir": ".<your-tui>/commands",
306
- "invoke": "/${projectName}:${skillName}"
307
- }
308
- ]
309
- }
310
- ```
311
-
312
- `customTUIs` should contain one entry per custom TUI. To let `update-agent-infra` generate command files for custom skills, keep at least one existing command file in `dir` that references a built-in skill path such as `.agents/skills/analyze-task/SKILL.md`; agent-infra uses that file as the format reference.
264
+ - Custom tool next-step commands are configured with `sandbox.tools.definitions.<id>.invoke`. See [Custom Tool Invocations](https://github.com/fitlab-ai/agent-infra/blob/main/docs/en/custom-tool-invocations.md) for the full example.
313
265
 
314
266
  ## Sandbox Custom Tools
315
267
 
316
- `customTUIs` generates slash-command files but does not change the sandbox image. To install a non-npm CLI or tool (pip / cargo / curl-based / pre-built binary) into the sandbox image and live-mount its credentials, declare it under an ID key in `sandbox.tools.definitions` in `.agents/.airc.json`. Built-in Agent Clients are installed according to `agentClients[].installInSandbox`; `agent-infra` remains a non-client entry in `sandbox.tools.ids` and only provides the in-sandbox `ai` / `agent-infra` CLI.
268
+ To install a non-npm CLI or tool (pip / cargo / curl-based / pre-built binary) into the sandbox image and live-mount its credentials, declare it under an ID key in `sandbox.tools.definitions` in `.agents/.airc.json`. Built-in Agent Clients are installed according to `agentClients[].installInSandbox`; `agent-infra` remains a non-client entry in `sandbox.tools.ids` and only provides the in-sandbox `ai` / `agent-infra` CLI.
317
269
 
318
270
  ### Required fields
319
271
 
@@ -259,59 +259,11 @@ TraeCode CLI 以 `.agents/skills/` 作为 Skill 的唯一权威源。agent-infra
259
259
  ### 与其他配置字段的关系
260
260
 
261
261
  - `sandbox.tools.ids` 只列出 `agent-infra` 和自定义工具等非客户端工具;自定义定义放在 `sandbox.tools.definitions`。内建客户端的安装状态由 `agentClients[].installInSandbox` 表达。
262
- - `agentClients` 与 `customTUIs`(见下)相互独立。即使自定义 TUI 目录落在已取消的内建客户端路径前缀下,其命令文件也会被保留。
263
-
264
- ## 自定义 TUI 配置
265
-
266
- 当团队使用的 AI TUI 不属于内置命令目标时,可以在 `.agents/.airc.json` 顶层配置 `customTUIs` 数组。该配置用于让 agent-infra 输出正确的下一步命令,并通过学习自定义 TUI 目录中的既有命令文件,为项目自定义 skill 生成同格式命令。
267
-
268
- | 字段 | 必填 | 含义 |
269
- |------|------|------|
270
- | `name` | 是 | 报告和下一步提示中展示的工具名称,例如 `<your-tui-name>`。 |
271
- | `dir` | 是 | 相对项目根目录的命令目录,例如 `.<your-tui>/commands`。路径必须位于项目根目录内。 |
272
- | `invoke` | 是 | 面向用户展示的命令模板,用于生成下一步提示。 |
273
-
274
- `invoke` 支持的占位符:
275
-
276
- | 占位符 | 替换为 | 示例 |
277
- |--------|--------|------|
278
- | `${skillName}` | skill 命令名,例如 `review-code` 或 `commit`。 | `<your-cli> ${skillName}` -> `<your-cli> review-code` |
279
- | `${projectName}` | `.airc.json` 中的 `project` 值,适用于带命名空间的命令。 | `/${projectName}:${skillName}` -> `/your-project:review-code` |
280
-
281
- 不带命名空间的自定义 TUI:
282
-
283
- ```json
284
- {
285
- "customTUIs": [
286
- {
287
- "name": "<your-tui-name>",
288
- "dir": ".<your-tui>/commands",
289
- "invoke": "<your-cli> ${skillName}"
290
- }
291
- ]
292
- }
293
- ```
294
-
295
- 带命名空间的自定义 TUI:
296
-
297
- ```json
298
- {
299
- "project": "your-project",
300
- "customTUIs": [
301
- {
302
- "name": "<your-tui-name>",
303
- "dir": ".<your-tui>/commands",
304
- "invoke": "/${projectName}:${skillName}"
305
- }
306
- ]
307
- }
308
- ```
309
-
310
- `customTUIs` 每个条目对应一个自定义 TUI。若希望 `update-agent-infra` 为自定义 skill 生成命令文件,请在 `dir` 中保留至少一个引用内置 skill 路径的既有命令文件,例如 `.agents/skills/analyze-task/SKILL.md`;agent-infra 会以该文件作为格式参考。
262
+ - 自定义工具的下一步命令通过 `sandbox.tools.definitions.<id>.invoke` 配置。完整示例见 [自定义工具调用说明](https://github.com/fitlab-ai/agent-infra/blob/main/docs/zh-CN/custom-tool-invocations.md)。
311
263
 
312
264
  ## 沙箱自定义工具(Sandbox Custom Tools)
313
265
 
314
- `customTUIs` 只负责生成 slash-command 文件,**不影响沙箱镜像**。如果要把一个非 npm 分发的 CLI 或工具(pip / cargo / curl 脚本 / 裸二进制)装进沙箱镜像、并 live-mount 它的凭证目录,需要在 `.agents/.airc.json` 的 `sandbox.tools.definitions` 中按工具 ID 声明。内建 Agent Client 按 `agentClients[].installInSandbox` 安装;`agent-infra` 仍是 `sandbox.tools.ids` 中的非客户端条目,只提供沙箱内的 `ai` / `agent-infra` CLI。
266
+ 自定义沙箱工具通过 `.agents/.airc.json` 的 `sandbox.tools.definitions` 按工具 ID 声明。需要把非 npm 分发的 CLI 或工具(pip / cargo / curl 脚本 / 裸二进制)装进沙箱镜像,或 live-mount 它的凭证目录时,可在对应定义中配置。内建 Agent Client 按 `agentClients[].installInSandbox` 安装;`agent-infra` 仍是 `sandbox.tools.ids` 中的非客户端条目,只提供沙箱内的 `ai` / `agent-infra` CLI。
315
267
 
316
268
  ### 必填字段
317
269
 
@@ -33,7 +33,7 @@ agent-infra-internal agent-client next-steps \
33
33
 
34
34
  - Pass the next skill name for the already-selected scenario. Include `--task-ref` only when that command needs a task reference.
35
35
  - Include `--version` only for a versioned release command. It must start with a digit and satisfy `semver.valid(raw) === raw`; never pass an action, complete command, shell fragment, whitespace, or a `v` / `V` / `=` prefix.
36
- - The helper lists only built-in clients enabled in `.agents/.airc.json` `agentClients`, followed by valid `customTUIs` in configuration order.
36
+ - The helper lists enabled built-in clients, followed by selected sandbox custom tools with a valid `invoke` field in `sandbox.tools.ids` order.
37
37
  - Insert non-empty stdout verbatim at `{next-step-commands}` below the current "Next steps" heading. When stdout is empty, omit the client command block while still rendering reminders, warnings, and `Completed at`.
38
38
  - If the helper writes stderr or exits non-zero, use the current skill's error path and stop; never fall back to a hard-coded client table.
39
39
  - A complex skill selects one scenario first and invokes the helper once for that scenario; it must not pre-render every branch.
@@ -33,7 +33,7 @@ agent-infra-internal agent-client next-steps \
33
33
 
34
34
  - 静态传入当前已选场景的下一 skill 名;只有命令需要任务引用时才传 `--task-ref`。
35
35
  - 只有版本化发布命令需要版本时才传 `--version`;值必须是以数字开头且 `semver.valid(raw) === raw` 的规范 SemVer。不得传 action、完整命令、shell 片段、空白或 `v` / `V` / `=` 前缀。
36
- - helper 只展示 `.agents/.airc.json` 中 `agentClients` 已启用的内建客户端,并在其后按配置顺序追加合法的 `customTUIs`。
36
+ - helper 展示 `.agents/.airc.json` 中 `agentClients` 已启用的内建客户端,并按 `sandbox.tools.ids` 顺序追加具有有效 `invoke` 的已选自定义沙箱工具。
37
37
  - 将非空 stdout 原样放入当前“下一步”标题后的 `{next-step-commands}`;stdout 为空时省略整个客户端命令块,但继续输出提醒、告警和 `Completed at`。
38
38
  - helper 写 stderr 或返回非零时,按当前 skill 的错误路径报告并停止;禁止回退到硬编码客户端表。
39
39
  - 复杂 skill 先选定唯一场景,再只为该场景调用一次 helper,不得提前渲染所有分支。
@@ -1,7 +1,6 @@
1
1
  import childProcess from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
- import { fileURLToPath } from "node:url";
5
4
 
6
5
  const PACKAGE_NAME = "@fitlab-ai/agent-infra";
7
6
  const COMMAND_NAMES = ["ai", "agent-infra"];
@@ -82,7 +81,6 @@ function rootsForCommand(commandPath, platform) {
82
81
  function resolveAgentInfraPackage(options = {}) {
83
82
  const env = options.env || process.env;
84
83
  const platform = options.platform || process.platform;
85
- const startPath = options.startPath || fileURLToPath(import.meta.url);
86
84
  const attempts = [];
87
85
  const tryRoot = (candidate, source) => {
88
86
  const inspected = inspectPackageRoot(candidate, source);
@@ -95,11 +93,6 @@ function resolveAgentInfraPackage(options = {}) {
95
93
  if (explicit) return { ...explicit, attempts };
96
94
  }
97
95
 
98
- for (const candidate of packageRootsAbove(startPath)) {
99
- const self = tryRoot(candidate, "current installation");
100
- if (self) return { ...self, attempts };
101
- }
102
-
103
96
  for (const command of COMMAND_NAMES) {
104
97
  const commandPaths = lookupCommand(command, platform);
105
98
  if (commandPaths.length === 0) {
@@ -96,7 +96,7 @@ Present the verification summary per `.agents/rules/validation-output.md`; do no
96
96
 
97
97
  ## 6. Render the next step
98
98
 
99
- Before rendering the next step, read `.agents/rules/next-step-output.md` and call the unified helper exactly once based on the latest task and PR state. A failed push keeps the task active and reports only diagnostics; a final commit routes to `create-pr` or `complete-task` according to `prFlow`.
99
+ Before rendering the next step, read `.agents/rules/next-step-output.md` and call the unified helper exactly once based on the latest task and PR state. A failed push keeps the task active and reports only diagnostics. When a verified PR is already bound, route to `watch-pr`; without a bound PR, route to `create-pr` or `complete-task` according to `prFlow`.
100
100
 
101
101
  ## Notes
102
102
 
@@ -96,7 +96,7 @@ agent-infra-internal task-verify {task-id} commit.completed --format text
96
96
 
97
97
  ## 6. 输出下一步
98
98
 
99
- 渲染下一步前先读取 `.agents/rules/next-step-output.md`,并根据最新 task/PR 状态只调用一次统一 helper。push 失败时保持任务 active,只输出诊断;最终提交则按 `prFlow` 选择 `create-pr` 或 `complete-task`。
99
+ 渲染下一步前先读取 `.agents/rules/next-step-output.md`,并根据最新 task/PR 状态只调用一次统一 helper。push 失败时保持任务 active,只输出诊断;已有 verified 绑定 PR 时路由到 `watch-pr`;没有绑定 PR 时,按 `prFlow` 选择 `create-pr` 或 `complete-task`。
100
100
 
101
101
  ## 注意事项
102
102
 
@@ -57,7 +57,7 @@ Milestone rule:
57
57
 
58
58
  - Extract `platform_issue_identity` from task.md when this work belongs to an active task
59
59
  - If `platform_issue_identity` exists, complete the prerequisite code-hosting platform detection steps first, then query the Issue via `.agents/rules/issue-pr-commands.md`
60
- - Before calling the PR creation command, check whether the current branch already has a PR. If it does, report the PR URL and state, then stop without repeating metadata sync or summary publication
60
+ - Before calling `platform-pr create`, check whether the current branch already has a PR. If the task is bound to the unique PR, the core reuses that bound identity and continues metadata sync, change reporting, and summary publication. If an existing PR is unbound, verify and bind its identity before continuing; an ordinary create request without a bound PR identity may create a new PR
61
61
  - Use HEREDOC to pass the PR body
62
62
  - Replace `{$IssueNumber}` in the template when present
63
63
  - End the PR body with `Generated with AI assistance`
@@ -57,7 +57,7 @@ Milestone 规则:
57
57
 
58
58
  - 当前工作属于 active task 时,从 task.md 提取 `platform_issue_identity`
59
59
  - 如果存在 `platform_issue_identity`,先完成代码托管平台检测,再通过 `.agents/rules/issue-pr-commands.md` 查询 Issue
60
- - 调用 PR 创建命令前,先检查当前分支是否已有 PR;若已有,报告 PR URL 和状态后停止,不重复执行元数据同步或 summary 发布
60
+ - 调用 `platform-pr create` 前检查当前分支是否已有 PR;任务已绑定到唯一 PR 时,core 复用该绑定身份并继续完成元数据同步、变更报告和摘要发布;发现已有 PR 但任务尚未绑定时,先核验并绑定其身份再继续;未绑定 PR 身份的普通创建请求可能会创建新的 PR
61
61
  - 使用 HEREDOC 传入 PR 正文
62
62
  - 模板中存在 `{$IssueNumber}` 时进行替换
63
63
  - PR 正文以 `Generated with AI assistance` 结尾
@@ -175,7 +175,7 @@ manual-validation counts do not influence branch selection; they are displayed o
175
175
 
176
176
  > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
177
177
 
178
- render the selected next-step commands through the shared helper. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
178
+ Render only the selected scenario's commands returned by the shared helper. The helper builds custom tool commands from `sandbox.tools.ids` and `sandbox.tools.definitions`; do not reread configuration or manually append commands.
179
179
 
180
180
  ## Completion Checklist
181
181
 
@@ -171,7 +171,7 @@ manual-validation 的数量不参与分支选择,只作为人工校验计数
171
171
 
172
172
  > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
173
173
 
174
- 向用户通过统一 helper 渲染已选场景的下一步命令。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名)。
174
+ 向用户只展示统一 helper 返回的已选场景命令。自定义工具命令由 helper 按 `sandbox.tools.ids` 和 `sandbox.tools.definitions` 生成;不得再次读取配置或手工追加命令。
175
175
 
176
176
  ## 完成检查清单
177
177
 
@@ -41,10 +41,10 @@ If the summary cannot be parsed safely, set `{last-readable-review-result}` to "
41
41
 
42
42
  Do not route by review round. Read `prFlow` / verified `pr_delivery_fact`; when a PR exists, call `agent-infra-internal platform-checks inspect {task-id}`. Select exactly one mutually exclusive exit:
43
43
 
44
- - No PR: use Branch A3 (complete) when `prFlow=disabled`; otherwise use Branch A1 (create PR).
45
- - Existing PR with PR head != `R`: Branch A1 (create or update the PR).
46
- - PR head = `R` with `pending|failed|cancelled` checks or temporarily unavailable platform state: Branch A2 (watch); never show completion.
47
- - PR head = `R` with `passed|no-required` checks: Branch A3 (complete).
44
+ - No PR: use Branch A4 (complete) when `prFlow=disabled`; otherwise use Branch A1 (create PR).
45
+ - Existing PR with PR head != `R`: Branch A2 (update the existing PR).
46
+ - PR head = `R` with `pending|failed|cancelled` checks or temporarily unavailable platform state: Branch A3 (watch); never show completion.
47
+ - PR head = `R` with `passed|no-required` checks: Branch A4 (complete).
48
48
 
49
49
  Common Branch A summary:
50
50
 
@@ -63,7 +63,16 @@ Next step - create a Pull Request:
63
63
  {next-step-commands}
64
64
  ```
65
65
 
66
- #### Branch A2: Watch All Checks
66
+ #### Branch A2: Update an Existing Pull Request
67
+
68
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}`. `commit` delivers the current commit; when there is no new commit, it uses push-only delivery to update the bound PR. The commit skill routes a bound PR to `watch-pr` afterward.
69
+
70
+ ```text
71
+ Next step - update the existing Pull Request:
72
+ {next-step-commands}
73
+ ```
74
+
75
+ #### Branch A3: Watch All Checks
67
76
 
68
77
  Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
69
78
 
@@ -72,7 +81,7 @@ Next step - watch PR checks:
72
81
  {next-step-commands}
73
82
  ```
74
83
 
75
- #### Branch A3: Complete and Archive
84
+ #### Branch A4: Complete and Archive
76
85
 
77
86
  Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
78
87
 
@@ -41,10 +41,10 @@
41
41
 
42
42
  通过后不得按轮次路由。读取任务的 `prFlow` / verified `pr_delivery_fact`;存在 PR 时调用 `agent-infra-internal platform-checks inspect {task-id}`。只选择以下一个互斥出口:
43
43
 
44
- - 无 PR:`prFlow=disabled` 用场景 A3(完成);PR flow 开启时用场景 A1(创建 PR)。
45
- - 已有 PR 但 PR head != `R`:场景 A1(创建或更新 PR)。
46
- - PR head = `R`,checks 为 `pending|failed|cancelled` 或平台暂不可用:场景 A2(监控),不得输出完成命令。
47
- - PR head = `R`,checks 为 `passed|no-required`:场景 A3(完成)。
44
+ - 无 PR:`prFlow=disabled` 用场景 A4(完成);PR flow 开启时用场景 A1(创建 PR)。
45
+ - 已有 PR 但 PR head != `R`:场景 A2(更新已有 PR)。
46
+ - PR head = `R`,checks 为 `pending|failed|cancelled` 或平台暂不可用:场景 A3(监控),不得输出完成命令。
47
+ - PR head = `R`,checks 为 `passed|no-required`:场景 A4(完成)。
48
48
 
49
49
  场景 A 的共同摘要:
50
50
 
@@ -64,7 +64,16 @@
64
64
  {next-step-commands}
65
65
  ```
66
66
 
67
- #### 场景 A2:监控全部 checks
67
+ #### 场景 A2:更新已有 Pull Request
68
+
69
+ 使用 `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。`commit` 会交付当前提交;没有新提交时执行 push-only,将更新推送到已绑定的 PR。完成后按 commit 技能的绑定 PR 路由进入 `watch-pr`。
70
+
71
+ ```text
72
+ 下一步 - 更新已有 Pull Request:
73
+ {next-step-commands}
74
+ ```
75
+
76
+ #### 场景 A3:监控全部 checks
68
77
 
69
78
  使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
70
79
 
@@ -73,7 +82,7 @@
73
82
  {next-step-commands}
74
83
  ```
75
84
 
76
- #### 场景 A3:完成并归档
85
+ #### 场景 A4:完成并归档
77
86
 
78
87
  使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
79
88
 
@@ -51,7 +51,7 @@ The script outputs JSON to stdout. Parse and record the report.
51
51
  - `managed.conflicts`: guarded managed files with unknown origin, two-sided changes, or ownership that cannot be proven during a platform switch; list each target, reason, and three-way hash
52
52
  - `managed.removed`: deleted managed files (including old paths removed during template migrations)
53
53
  - `managed.skippedPlatform`: managed / merged entries skipped because they belong to a different platform
54
- - `managed.skippedTUI`: managed / merged entries skipped because they are owned by a built-in Agent Client whose `agentClients[].enabled` is `false` (customTUI command files under the same path prefix are preserved)
54
+ - `managed.skippedTUI`: managed / merged entries skipped because they are owned by a built-in Agent Client whose `agentClients[].enabled` is `false`
55
55
  - `merged.pending`: list of merged files for AI to process
56
56
  - Each item has `target` (project-relative path) and `template` (template-root-relative path)
57
57
  - `registryAdded`: newly added file registry entries
@@ -43,7 +43,7 @@ node .agents/skills/update-agent-infra/scripts/sync-templates.js
43
43
  - `managed.conflicts`:来源未知、双边修改或平台切换时无法证明官方所有权的 guarded managed 冲突;必须逐项展示 target、reason 与三方哈希
44
44
  - `managed.removed`:被删除的 managed 文件(包括模板迁移时移除的旧路径)
45
45
  - `managed.skippedPlatform`:因归属其他平台而被跳过的 managed / merged 条目
46
- - `managed.skippedTUI`:因对应内建 Agent Client 的 `agentClients[].enabled` 为 `false` 而被跳过的 managed / merged 条目(落在同一路径前缀下的 customTUI 命令文件会被保留)
46
+ - `managed.skippedTUI`:因对应内建 Agent Client 的 `agentClients[].enabled` 为 `false` 而被跳过的 managed / merged 条目
47
47
  - `merged.pending`:需要 AI 处理的 merged 文件列表
48
48
  - 每项包含 `target`(项目中的目标路径)和 `template`(模板根目录下的相对路径)
49
49
  - `registryAdded`:新增的文件注册条目