@fitlab-ai/agent-infra 0.11.11 → 0.11.13
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.
- package/dist/bin/internal-cli.js +2 -2
- package/dist/lib/agent-clients/adapter.js +7 -1
- package/dist/lib/agent-clients/adapters/claude-code.js +5 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +78 -63
- package/dist/lib/agent-clients/adapters/codex-lifecycle/binding.js +114 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/cli.js +447 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-client.js +130 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-operation.js +131 -0
- package/dist/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.js +2 -2
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +48 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/recovery.js +124 -62
- package/dist/lib/{internal/codex-sandbox-controller.js → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.js} +3 -3
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +3 -5
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +211 -213
- package/dist/lib/agent-clients/adapters/codex-orchestration.js +468 -0
- package/dist/lib/agent-clients/adapters/codex.js +40 -1
- package/dist/lib/agent-clients/adapters/index.js +2 -10
- package/dist/lib/agent-clients/tokens.js +3 -2
- package/dist/lib/internal/agent-client.js +132 -72
- package/dist/lib/internal/cli-route-inventory.js +2 -2
- package/dist/lib/internal/sandbox-control.js +1 -81
- package/dist/lib/internal/task-finalization.js +26 -19
- package/dist/lib/internal/task-lifecycle.js +1 -1
- package/dist/lib/internal/task-operation-registry.js +1 -1
- package/dist/lib/internal/task-validate.js +1 -1
- package/dist/lib/platform/github-client.js +33 -3
- package/dist/lib/platform/issues.js +18 -6
- package/dist/lib/runtime/agent-runtime.js +6 -29
- package/dist/lib/sandbox/commands/control-status.js +1 -0
- package/dist/lib/sandbox/commands/create.js +7 -2
- package/dist/lib/sandbox/commands/ls.js +4 -5
- package/dist/lib/sandbox/commands/rm.js +1 -1
- package/dist/lib/sandbox/control/agent-operation.js +34 -0
- package/dist/lib/sandbox/control/client.js +14 -201
- package/dist/lib/sandbox/control/executor.js +12 -125
- package/dist/lib/sandbox/control/lifecycle.js +66 -4
- package/dist/lib/sandbox/control/protocol.js +15 -54
- package/dist/lib/sandbox/control/server.js +216 -281
- package/dist/lib/sandbox/control/task-view.js +0 -13
- package/dist/lib/sandbox/mounts.js +9 -1
- package/dist/lib/sandbox/recovery.js +31 -10
- package/dist/lib/sandbox/removal.js +28 -5
- package/dist/lib/sandbox/workspace-identity.js +18 -6
- package/dist/lib/sandbox/workspace-view.js +56 -19
- package/dist/lib/task/commands/ls.js +3 -3
- package/dist/lib/task/control-authority.js +56 -264
- package/dist/lib/task/control-recovery.js +2 -3
- package/dist/lib/task/create.js +2 -2
- package/dist/lib/task/delegation-receipts.js +74 -161
- package/dist/lib/task/events.js +88 -44
- package/dist/lib/task/finalization.js +35 -6
- package/dist/lib/task/lifecycle.js +274 -115
- package/dist/lib/task/orchestration.js +201 -194
- package/dist/lib/task/runtime-paths.js +10 -0
- package/dist/lib/task/short-id.js +37 -27
- package/dist/lib/task/verification-engine.js +32 -26
- package/dist/lib/task/workspace-snapshot.js +1 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-clients/adapter.ts +39 -0
- package/lib/agent-clients/adapters/claude-code.ts +5 -1
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +105 -80
- package/lib/agent-clients/adapters/codex-lifecycle/binding.ts +147 -0
- package/lib/agent-clients/adapters/codex-lifecycle/cli.ts +510 -0
- package/lib/agent-clients/adapters/codex-lifecycle/controller-client.ts +158 -0
- package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +1 -1
- package/lib/agent-clients/adapters/codex-lifecycle/controller-operation.ts +151 -0
- package/lib/{sandbox/control → agent-clients/adapters/codex-lifecycle}/controller-registration.ts +4 -4
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +43 -0
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +8 -5
- package/lib/agent-clients/adapters/codex-lifecycle/recovery.ts +190 -65
- package/lib/{internal/codex-sandbox-controller.ts → agent-clients/adapters/codex-lifecycle/sandbox-controller-cli.ts} +2 -2
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +3 -5
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +270 -224
- package/lib/agent-clients/adapters/codex-orchestration.ts +632 -0
- package/lib/agent-clients/adapters/codex.ts +44 -1
- package/lib/agent-clients/adapters/index.ts +7 -20
- package/lib/agent-clients/tokens.ts +4 -3
- package/lib/internal/agent-client.ts +142 -73
- package/lib/internal/cli-route-inventory.ts +2 -2
- package/lib/internal/sandbox-control.ts +0 -97
- package/lib/internal/task-finalization.ts +30 -18
- package/lib/internal/task-lifecycle.ts +1 -1
- package/lib/internal/task-operation-registry.ts +1 -1
- package/lib/internal/task-validate.ts +1 -1
- package/lib/platform/github-client.ts +34 -3
- package/lib/platform/issues.ts +18 -6
- package/lib/runtime/agent-runtime.ts +6 -41
- package/lib/sandbox/commands/control-status.ts +1 -0
- package/lib/sandbox/commands/create.ts +7 -1
- package/lib/sandbox/commands/ls.ts +4 -5
- package/lib/sandbox/commands/rm.ts +1 -1
- package/lib/sandbox/control/agent-operation.ts +49 -0
- package/lib/sandbox/control/client.ts +20 -254
- package/lib/sandbox/control/executor.ts +13 -136
- package/lib/sandbox/control/lifecycle.ts +67 -4
- package/lib/sandbox/control/protocol.ts +22 -66
- package/lib/sandbox/control/server.ts +21 -95
- package/lib/sandbox/control/task-view.ts +0 -19
- package/lib/sandbox/mounts.ts +10 -1
- package/lib/sandbox/recovery.ts +38 -17
- package/lib/sandbox/removal.ts +33 -7
- package/lib/sandbox/workspace-identity.ts +16 -6
- package/lib/sandbox/workspace-view.ts +50 -18
- package/lib/task/commands/ls.ts +3 -3
- package/lib/task/control-authority.ts +66 -378
- package/lib/task/control-recovery.ts +3 -4
- package/lib/task/create.ts +3 -3
- package/lib/task/delegation-receipts.ts +87 -231
- package/lib/task/events.ts +100 -42
- package/lib/task/finalization.ts +37 -7
- package/lib/task/lifecycle.ts +257 -109
- package/lib/task/orchestration.ts +260 -237
- package/lib/task/runtime-paths.ts +12 -0
- package/lib/task/short-id.ts +33 -40
- package/lib/task/verification-engine.ts +30 -25
- package/lib/task/workspace-snapshot.ts +1 -1
- package/package.json +1 -1
- package/templates/.agents/hooks/lifecycle-delegation.js +1 -25
- package/templates/.agents/rules/README.en.md +2 -1
- package/templates/.agents/rules/README.zh-CN.md +2 -1
- package/templates/.agents/rules/next-step-output.en.md +6 -19
- package/templates/.agents/rules/next-step-output.zh-CN.md +6 -19
- package/templates/.agents/rules/strategy-pattern.en.md +25 -0
- package/templates/.agents/rules/strategy-pattern.zh-CN.md +25 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/check-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/reference/code-rules.en.md +4 -0
- package/templates/.agents/skills/code-task/reference/code-rules.zh-CN.md +4 -0
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +0 -1
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +0 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +5 -29
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +5 -26
- package/templates/.agents/skills/plan-task/SKILL.en.md +7 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +7 -4
- package/templates/.agents/skills/review-analysis/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-code/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.en.md +1 -1
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/capability-store.js +0 -546
- package/dist/lib/internal/codex-lifecycle.js +0 -385
- package/dist/lib/task/codex-orchestration.js +0 -206
- package/lib/agent-clients/adapters/codex-lifecycle/capability-store.ts +0 -776
- package/lib/internal/codex-lifecycle.ts +0 -390
- package/lib/task/codex-orchestration.ts +0 -276
|
@@ -19,6 +19,10 @@ Follow the `code` step in `.agents/workflows/feature-development.yaml`.
|
|
|
19
19
|
3. **Keep testing continuously**: run the **fast smoke subset** continuously as work progresses (see the `test` skill)
|
|
20
20
|
4. **Keep it simple**: do not add unplanned features
|
|
21
21
|
|
|
22
|
+
## Strategy Pattern
|
|
23
|
+
|
|
24
|
+
Read `.agents/rules/strategy-pattern.md` before implementation. When behavior differs by platform, client, protocol, workflow, business rule, or algorithm, follow the interface selected in the plan and make the core flow depend on that interface rather than concrete classes. Add each behavior as a strategy and select or assemble it in one place. If branches identifying implementations are scattered across paths, centralize strategy selection before editing callers. Keep stable behavior direct when it has no meaningful alternatives; do not add interfaces mechanically.
|
|
25
|
+
|
|
22
26
|
## Run Test Verification
|
|
23
27
|
|
|
24
28
|
During implementation:
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
3. **持续测试**:实现过程中持续运行 **fast smoke 子集**(参见 `test` skill)
|
|
20
20
|
4. **保持简单**:不要加入未计划的功能
|
|
21
21
|
|
|
22
|
+
## 策略模式
|
|
23
|
+
|
|
24
|
+
实现前读取 `.agents/rules/strategy-pattern.md`。当实现涉及平台、客户端、协议、工作流、业务规则或算法的不同实现时,沿用方案确定的接口,让主流程依赖接口而不是具体类;新增行为应作为策略实现,在统一位置选择或装配。若识别不同实现的分支已散落在多条路径,先收敛策略选择,再修改调用方。行为稳定且没有明确替代实现时,保留直接实现,不机械增加接口。
|
|
25
|
+
|
|
22
26
|
## 运行测试验证
|
|
23
27
|
|
|
24
28
|
实现过程中:
|
|
@@ -129,7 +129,6 @@ Report:
|
|
|
129
129
|
- Present the completion verification summary per `.agents/rules/validation-output.md`
|
|
130
130
|
- Suggested next step: enter the final closing flow and run /complete-task --task {task-ref}
|
|
131
131
|
|
|
132
|
-
Before rendering the final output, read `.agents/rules/next-step-output.md` and append `Completed at: YYYY-MM-DD HH:mm:ss` as the absolute last line.
|
|
133
132
|
|
|
134
133
|
## Completion Checklist
|
|
135
134
|
|
|
@@ -129,7 +129,6 @@ agent-infra-internal task-verify {task-id} manual-validation.completed --artifac
|
|
|
129
129
|
- 按 `.agents/rules/validation-output.md` 展示当次完成校验摘要
|
|
130
130
|
- 下一步建议:进入最终收尾流程,运行 /complete-task --task {task-ref}
|
|
131
131
|
|
|
132
|
-
渲染最终输出前,先读取 `.agents/rules/next-step-output.md`,并在绝对最后一行追加 `Completed at: YYYY-MM-DD HH:mm:ss`。
|
|
133
132
|
|
|
134
133
|
## 完成检查清单
|
|
135
134
|
|
|
@@ -158,7 +158,7 @@ The core deduplicates the stable `step/code/target` tuple. Callers must not allo
|
|
|
158
158
|
|
|
159
159
|
### 5. Run the Active Pre-completion Hard Gate
|
|
160
160
|
|
|
161
|
-
After platform writes succeed and before moving the directory
|
|
161
|
+
After platform writes succeed and before moving the directory, run:
|
|
162
162
|
|
|
163
163
|
```bash
|
|
164
164
|
agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
@@ -182,39 +182,16 @@ For an active task, finalization first recovers pending platform operations, the
|
|
|
182
182
|
|
|
183
183
|
Finalization runs allowed artifact backfill -> lifecycle -> terminal task comment -> core verification -> warning task-comment update -> summary seal in a fixed order. Every backfill that actually runs must reach a successful terminal result before lifecycle starts; an ordinary replay with a complete receipt and no recovery fact does not rerun backfill, comments, verification, or summary. A completed recovery that may write a managed comment first persists a done summary as pending, then seals it only at the end. Summary seal always reads the durable staging record retained in the task directory; the platform entry point validates marker, owner, and digest, performs any required delete/recreate, and reads back final remote order. `result=completed` means the host safely completed the task from structured results and the receipt; if peripheral warnings or pending steps remain, return `result=completed_with_warnings`, warnings, and pending steps. Use `result=failed` or `result=blocked` only for hard or receipt/capability failures, then fix the cause and retry through the same entry point; do not claim completion or hand-repair partial state. A sandbox must not run `ls completed` or a local terminal verification against its historical mount to re-decide this result.
|
|
184
184
|
|
|
185
|
-
### 7. Handle Finalization
|
|
185
|
+
### 7. Handle the Finalization Result
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
The sandbox-local entry calls the existing finalization prepare/commit flow directly. Before lifecycle transfer, it stops this task's broker from accepting new requests and waits for accepted work to finish through its existing path. Transfer starts only after the broker owner exits. On success, use the structured result and receipt returned by this command. On failure or blocked status, preserve source data and the receipt, follow the returned error, and do not claim completion or manually rewrite terminal state.
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
### Recovering an accepted sandbox-control result
|
|
192
|
-
|
|
193
|
-
When this skill runs in a sandbox and an accepted task-finalization request has
|
|
194
|
-
no terminal result yet, the client automatically recovers under the same
|
|
195
|
-
request ID. The five-minute total budget starts with the first unknown result;
|
|
196
|
-
each recover call is limited to 30 seconds. While a published unknown response
|
|
197
|
-
is present, the client rereads it every 25 ms during that call. When a recover
|
|
198
|
-
call times out with unknown, the client continues immediately without an extra
|
|
199
|
-
wait. The client prints `SANDBOX_CONTROL_REQUEST_ID: <request-id>` on stderr.
|
|
200
|
-
|
|
201
|
-
If no terminal result arrives within five minutes, preserve the receipt and
|
|
202
|
-
request ID and treat the result as pending/unknown. Do not resubmit
|
|
203
|
-
task-finalization. Once the broker is healthy, continue querying only the
|
|
204
|
-
original request ID:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
agent-infra-internal sandbox-control recover <request-id>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Do not submit a new request for an accepted task finalization. If the request ID is missing or the receipt cannot be read, keep the result pending and recover the original ID only from stderr, a handoff, or the receipt; do not look it up by task key. The broker's `processing/<request-id>/result.json` is private transport evidence, not a task receipt, and cannot by itself prove completion. The finalization receipt and host completion gate remain authoritative. If recovery with the same ID still has no terminal result, inspect broker and host executor activity. Stop and preserve the original request ID while a request is active, the broker is busy, or status is unknown. Retry with a new request ID only after confirming that the original request never started or its executor has ended; the new request performs the full prepare and commit after broker admission. Only a request rejected before acceptance may be retried directly with a new request ID according to the error's retryability.
|
|
189
|
+
Completion keeps the short-id mapping. Managed sandbox cleanup releases it only after the container is confirmed removed and cleanup succeeds. To clean up, pass the retained short id or full `{task-id}` to `ai sandbox rm`; do not release the short id separately during completion.
|
|
211
190
|
|
|
212
191
|
### 8. Inform User
|
|
213
192
|
|
|
214
193
|
> Execute this step only after the verification gate passes.
|
|
215
194
|
|
|
216
|
-
> The completion timestamp line (the last line of the whole output) uses `date "+%Y-%m-%d %H:%M:%S"` (local timezone, no offset) and always sits at the very end of the output for at-a-glance scanning across windows. This skill renders no "Next steps" commands, but it does render an **optional sandbox-cleanup hint** before the timestamp line (see the gate below), and still prints the line.
|
|
217
|
-
|
|
218
195
|
> **Optional sandbox-cleanup hint (gated)**: Render the "Optional: clean up this task's sandbox" block in the output below only when BOTH (1) `.agents/.airc.json` has a `sandbox` field and (2) task.md's `branch` field exists and is not `main` / `master`; otherwise omit the whole block. Use the full `{task-id}` for cleanup; do not substitute the branch name. This block is independent of "Next steps" semantics — it is not a workflow successor command.
|
|
219
196
|
|
|
220
197
|
Output format:
|
|
@@ -232,9 +209,8 @@ Deliverables:
|
|
|
232
209
|
Optional: clean up this task's sandbox
|
|
233
210
|
(The task is completed; the sandbox container and per-branch config directory are not reclaimed automatically. Run this if you no longer need them:)
|
|
234
211
|
|
|
235
|
-
ai sandbox rm {task-id}
|
|
212
|
+
ai sandbox rm {task-id} # or use the task's retained short id
|
|
236
213
|
|
|
237
|
-
Completed at: {completion-time}
|
|
238
214
|
```
|
|
239
215
|
|
|
240
216
|
|
|
@@ -157,7 +157,7 @@ agent-infra-internal task-warning {task-id} add --step complete-task --severity
|
|
|
157
157
|
|
|
158
158
|
### 5. 运行 active 预完成硬门禁
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
平台写入成功后、移动目录前运行:
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
163
|
agent-infra-internal task-verify {task-id} complete-task.preflight --format text
|
|
@@ -181,36 +181,16 @@ active 任务的 finalization 先恢复账本中的待处理平台操作,并
|
|
|
181
181
|
|
|
182
182
|
finalization 按允许的 artifact backfill → lifecycle → task 评论 → core verification → warning task 评论更新 → summary seal 的固定顺序执行。每项实际运行的 backfill 必须取得成功终态,否则不得进入 lifecycle;完整 receipt 且无恢复事实的普通重入不执行 backfill、评论、验证或 summary。任何可能写入 managed comment 的 completed 恢复会先把 done summary 持久化为 pending,恢复末尾才重新 seal。summary seal 始终读取任务目录中保留的 durable staging record;平台入口负责校验 marker、owner 和 digest,必要时删除并重建摘要,再复读最终远端顺序。`result=completed` 即表示宿主已依据结构化结果和 receipt 安全完成;若还有外围 warning 或 pending step,返回 `result=completed_with_warnings`、warnings 和 pending steps。`result=failed` 或 `result=blocked` 仅用于硬失败或 receipt/capability 失败,修复原因后以同一入口重试,不得宣称完成或手工补写局部状态。沙箱不得从旧挂载执行 `ls completed` 或本地终态校验来重新裁决该结果。
|
|
183
183
|
|
|
184
|
-
### 7. 处理 finalization
|
|
184
|
+
### 7. 处理 finalization 结果
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
sandbox-local 入口直接执行已有 finalization prepare/commit。lifecycle 移动前,它先停止本任务 broker 接收新请求,并等待已接收操作按原路径完成;只有 broker owner 退出后才开始迁移 task 目录。成功时消费本次命令返回的结构化结果和 receipt。失败或阻塞时保留源数据与 receipt,按返回的错误处理,不输出完成消息,也不手工改写终态。
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
### accepted 后的 sandbox-control 结果恢复
|
|
191
|
-
|
|
192
|
-
如果本技能在沙箱内执行,且 task-finalization 请求已经 accepted 但暂时没有
|
|
193
|
-
terminal result,client 会从首次 unknown 开始自动按同一个 request ID 恢复,
|
|
194
|
-
总预算为 5 分钟,每次 recover 最多 30 秒;published unknown 会在当前调用中
|
|
195
|
-
按 25ms 间隔重读,预算用尽后立即继续 recover,不额外等待。client 会在 stderr
|
|
196
|
-
输出 `SANDBOX_CONTROL_REQUEST_ID: <request-id>`。
|
|
197
|
-
|
|
198
|
-
5 分钟后仍没有 terminal result 时,必须保留 receipt 和 request ID,并将结果视为
|
|
199
|
-
pending/unknown;不得重发 task-finalization。broker 恢复健康后,只能继续查询原
|
|
200
|
-
request ID:
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
agent-infra-internal sandbox-control recover <request-id>
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
accepted 的 task finalization 不得提交新请求。若 request ID 缺失或 receipt 无法读取,保持 pending;只从 stderr、handoff 或 receipt 中恢复原 ID,不按 task key 查询。broker 的 `processing/<request-id>/result.json` 只是私有 transport evidence,不是 task receipt,单凭它不能证明任务完成;finalization receipt 和宿主完成校验仍是权威。若同 ID 恢复仍没有 terminal result,必须检查 broker 和宿主 executor 的活动状态:活动请求、`busy` 或状态未知时停止并保留原 request ID。只有确认原请求从未启动或 executor 已结束后,才可用新的 request ID 重试;新请求会在 broker 接纳后执行完整 prepare 和 commit。仅当请求在 accepted 之前已被拒绝时,才可直接依据错误的 retryability 决定是否提交新的 request ID.
|
|
188
|
+
complete 保留短号映射。它只会在受管 sandbox 清理确认容器已删除且清理成功后释放。需要清理时可用保留短号或完整 `{task-id}` 调用 `ai sandbox rm`;不要在 complete 中单独释放短号。
|
|
207
189
|
|
|
208
190
|
### 8. 告知用户
|
|
209
191
|
|
|
210
192
|
> 仅在校验通过后执行本步骤。
|
|
211
193
|
|
|
212
|
-
> 完成时间收尾行(整段输出的最后一行)取值 `date "+%Y-%m-%d %H:%M:%S"`(本地时区、不带偏移),固定放在输出的绝对末尾,便于多窗口扫视。本 skill 不渲染「下一步」命令,但会在收尾行之前渲染一段**可选的沙箱清理提示**(见下方门控),且仍统一打印该收尾行。
|
|
213
|
-
|
|
214
194
|
> **可选沙箱清理提示(门控渲染)**:仅当同时满足 (1) `.agents/.airc.json` 存在 `sandbox` 字段、(2) task.md 的 `branch` 字段存在且不是 `main` / `master` 时,才渲染下方输出中的「可选:清理本任务的沙箱」块;任一不满足则整段省略。清理时使用完整 `{task-id}`,不要改用 branch 名。该块独立于「下一步」语义,不是工作流后继命令。
|
|
215
195
|
|
|
216
196
|
输出格式:
|
|
@@ -228,9 +208,8 @@ accepted 的 task finalization 不得提交新请求。若 request ID 缺失或
|
|
|
228
208
|
可选:清理本任务的沙箱
|
|
229
209
|
(任务已完成,沙箱容器和 per-branch 配置目录不会自动回收。如果不再需要可执行:)
|
|
230
210
|
|
|
231
|
-
ai sandbox rm {task-id}
|
|
211
|
+
ai sandbox rm {task-id} # 或使用本任务仍保留的短号
|
|
232
212
|
|
|
233
|
-
Completed at: {completion-time}
|
|
234
213
|
```
|
|
235
214
|
|
|
236
215
|
|
|
@@ -91,6 +91,8 @@ Use it to understand:
|
|
|
91
91
|
|
|
92
92
|
### 5. Design the Technical Plan
|
|
93
93
|
|
|
94
|
+
Before designing, read `.agents/rules/strategy-pattern.md`. Identify shared flows and behavior differences by platform, client, protocol, workflow, business rule, or algorithm; make the core flow depend on interfaces and put differences in strategy implementations instead of adding a dedicated branch to every path.
|
|
95
|
+
|
|
94
96
|
Follow the `technical-design` step in `.agents/workflows/feature-development.yaml`:
|
|
95
97
|
|
|
96
98
|
**Required tasks**:
|
|
@@ -105,10 +107,11 @@ When this round introduces a new key design decision, first run `agent-infra-int
|
|
|
105
107
|
|
|
106
108
|
**Design principles**:
|
|
107
109
|
1. **Architectural soundness**: choose the structurally correct approach; diff size is not the primary criterion. Do not pile changes onto an unsound structure just to keep the diff small
|
|
108
|
-
2. **
|
|
109
|
-
3. **
|
|
110
|
-
4. **
|
|
111
|
-
5. **
|
|
110
|
+
2. **Strategy Pattern**: identify shared flows and different behaviors; make the core flow depend on interfaces, not concrete implementations, and select or assemble strategies in one place
|
|
111
|
+
3. **Simplicity**: given a sound architecture, prefer the simplest approach; do not add strategy interfaces mechanically when behavior is stable and has no meaningful alternatives
|
|
112
|
+
4. **Consistency**: follow existing code patterns and conventions
|
|
113
|
+
5. **Testability**: design for straightforward testing
|
|
114
|
+
6. **Reversibility**: prefer changes that are easy to roll back
|
|
112
115
|
|
|
113
116
|
### 6. Output Plan Document
|
|
114
117
|
|
|
@@ -92,6 +92,8 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
|
|
|
92
92
|
|
|
93
93
|
### 5. 设计技术方案
|
|
94
94
|
|
|
95
|
+
设计方案前先读取 `.agents/rules/strategy-pattern.md`,识别各实现共用的流程及平台、客户端、协议、工作流、业务规则或算法方面的差异;优先让主流程依赖接口,并通过策略实现承载差异,避免为每条链路增加专用分支。
|
|
96
|
+
|
|
95
97
|
仅当方案阶段实际判断候选资格、约束依赖或人工裁决资格时,才按 `.agents/rules/decision-qualification.md` 复核规范化约束和候选,并在方案产物记录完整资格审计;否则省略整个审计段。来源不明或未人工确认的约束不得自动排除候选。
|
|
96
98
|
|
|
97
99
|
遵循 `.agents/workflows/feature-development.yaml` 中的 `technical-design` 步骤:
|
|
@@ -108,10 +110,11 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
|
|
|
108
110
|
|
|
109
111
|
**设计原则**:
|
|
110
112
|
1. **架构合理性**:选择结构正确的方案,改动大小不是首要依据。不要为了减少 diff 而在不合理的结构上叠加
|
|
111
|
-
2.
|
|
112
|
-
3.
|
|
113
|
-
4.
|
|
114
|
-
5.
|
|
113
|
+
2. **策略模式**:明确各实现共用的流程和不同的行为;主流程依赖接口,不依赖具体实现;策略在统一位置选择和装配
|
|
114
|
+
3. **简洁性**:在架构合理的前提下,优先选择最简方案;行为稳定且没有明确替代实现时,不机械增加策略接口
|
|
115
|
+
4. **一致性**:遵循现有代码模式和规范
|
|
116
|
+
5. **可测试性**:设计易于测试的方案
|
|
117
|
+
6. **可逆性**:优先选择易于回退的变更
|
|
115
118
|
|
|
116
119
|
### 6. 输出计划文档
|
|
117
120
|
|
|
@@ -117,4 +117,4 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
|
|
|
117
117
|
|
|
118
118
|
Use the conclusion branch in `reference/output-templates.md` and render the selected next-step commands through the shared helper.
|
|
119
119
|
|
|
120
|
-
> Before rendering the final output, read `.agents/rules/next-step-output.md
|
|
120
|
+
> Before rendering the final output, read `.agents/rules/next-step-output.md`; 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.
|
|
@@ -122,7 +122,7 @@ agent-infra-internal task-verify {task-id} review-analysis.completed --artifact
|
|
|
122
122
|
|
|
123
123
|
按 `reference/output-templates.md` 的结论分支输出,并通过统一 helper 渲染已选场景的下一步命令。
|
|
124
124
|
|
|
125
|
-
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md
|
|
125
|
+
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md`,并将「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件);其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式。
|
|
126
126
|
|
|
127
127
|
## 完成检查清单
|
|
128
128
|
|
|
@@ -173,7 +173,7 @@ manual-validation counts do not influence branch selection; they are displayed o
|
|
|
173
173
|
|
|
174
174
|
> The A/B/C output templates, selection rules, and prohibition clauses live in `reference/output-templates.md`. Read `reference/output-templates.md` before reporting the review result.
|
|
175
175
|
|
|
176
|
-
> Before rendering the final output, read `.agents/rules/next-step-output.md
|
|
176
|
+
> Before rendering the final output, read `.agents/rules/next-step-output.md`; 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.
|
|
177
177
|
|
|
178
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
|
|
|
@@ -169,7 +169,7 @@ manual-validation 的数量不参与分支选择,只作为人工校验计数
|
|
|
169
169
|
|
|
170
170
|
> 完整的 A/B/C 输出模板、判断规则和禁止条款见 `reference/output-templates.md`。向用户汇报审查结论前先读取 `reference/output-templates.md`。
|
|
171
171
|
|
|
172
|
-
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md
|
|
172
|
+
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md`,并将「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件);其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式。
|
|
173
173
|
|
|
174
174
|
向用户只展示统一 helper 返回的已选场景命令。自定义工具命令由 helper 按 `sandbox.tools.ids` 和 `sandbox.tools.definitions` 生成;不得再次读取配置或手工追加命令。
|
|
175
175
|
|
|
@@ -117,4 +117,4 @@ Present the verification summary per `.agents/rules/validation-output.md`, retai
|
|
|
117
117
|
|
|
118
118
|
Use the conclusion branch in `reference/output-templates.md` and render the selected next-step commands through the shared helper.
|
|
119
119
|
|
|
120
|
-
> Before rendering the final output, read `.agents/rules/next-step-output.md
|
|
120
|
+
> Before rendering the final output, read `.agents/rules/next-step-output.md`; 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.
|
|
@@ -122,7 +122,7 @@ agent-infra-internal task-verify {task-id} review-plan.completed --artifact {rev
|
|
|
122
122
|
|
|
123
123
|
按 `reference/output-templates.md` 的结论分支输出,并通过统一 helper 渲染已选场景的下一步命令。
|
|
124
124
|
|
|
125
|
-
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md
|
|
125
|
+
> 渲染最终输出前先读取 `.agents/rules/next-step-output.md`,并将「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件);其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式。
|
|
126
126
|
|
|
127
127
|
## 完成检查清单
|
|
128
128
|
|
|
@@ -48,7 +48,7 @@ Branch-only has no `{task-id}`: skip this step and record `not-applicable (branc
|
|
|
48
48
|
5. Read `reference/report-template.md`, create `validation-run.md|validation-run-r{N}.md`, and record the input mode, discovered list, per-item results, CLI JSON allowlist, and sanitized summaries.
|
|
49
49
|
6. Run `agent-infra-internal task-event {task-id} validation-run.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {artifact}`. When an Issue exists, run only `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`; do not publish the validation artifact as an Issue comment.
|
|
50
50
|
7. Run `agent-infra-internal task-verify {task-id} validation-run.completed --artifact {artifact} --format text`; fix failures and rerun it, then present the summary per `.agents/rules/validation-output.md` with necessary diagnostics.
|
|
51
|
-
8. Report the evidence path, coverage gaps, and verification result; explicitly leave the decision to run `complete-manual-validation` to the maintainer.
|
|
51
|
+
8. Report the evidence path, coverage gaps, and verification result; explicitly leave the decision to run `complete-manual-validation` to the maintainer.
|
|
52
52
|
|
|
53
53
|
## Scenario B: Branch-Only Fallback
|
|
54
54
|
|
|
@@ -48,7 +48,7 @@ branch-only 无 `{task-id}`,跳过本步,并在产物 `## 状态核对` 记
|
|
|
48
48
|
5. 读取 `reference/report-template.md`,创建 `validation-run.md|validation-run-r{N}.md`;记录输入模式、发现清单、逐项结果、CLI JSON allowlist 与去敏摘要。
|
|
49
49
|
6. 运行 `agent-infra-internal task-event {task-id} validation-run.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {artifact}`。存在 Issue 时仅运行 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`;验证 artifact 不发布为 Issue 评论。
|
|
50
50
|
7. 运行 `agent-infra-internal task-verify {task-id} validation-run.completed --artifact {artifact} --format text`;未通过则修复后重跑,并按 `.agents/rules/validation-output.md` 展示摘要和必要诊断。
|
|
51
|
-
8. 告知用户证据路径、覆盖缺口和验证结果;明确仍需维护者判断是否执行 `complete-manual-validation
|
|
51
|
+
8. 告知用户证据路径、覆盖缺口和验证结果;明确仍需维护者判断是否执行 `complete-manual-validation`。
|
|
52
52
|
|
|
53
53
|
## 场景 B:branch-only 降级
|
|
54
54
|
|
|
@@ -19,7 +19,7 @@ The orchestrator delegates only and never executes a stage skill itself. First r
|
|
|
19
19
|
4. Run `task-orchestration {task-id} begin-or-resume --client {client}` with the complete explicit policy. With no explicit policy, core reads that client's configured policy; existing runs use persisted policy. Disk state outside the complete current structure fails closed without rewriting; finish or clear active runs before upgrading. Stop on paused/completed results.
|
|
20
20
|
5. Run `route`. On `completed`, run `agent-infra-internal task-verify {task-id} run-task.completed --format text`, present its summary per `.agents/rules/validation-output.md` while retaining necessary diagnostics, and stop. Only a `running` result with non-null `next` supplies action, role, round, artifact, requested model, and requested effort.
|
|
21
21
|
6. Call `prepare --client {client} --requested-model {requestedModel} --requested-reasoning-effort {requestedReasoningEffort}` with route's exact policy. The client adapter runs host preflight. Report actual task, policy, or host failures.
|
|
22
|
-
7. After prepare,
|
|
22
|
+
7. After prepare, forward the optional `adapterContext` unchanged to `agent-infra-internal agent-client launch-carrier --client {client} --adapter-context {adapterContext} --stage {stage} --round {round} --role {role} --format json`. The shared skill must not parse, rewrite, or validate this opaque value. The controlled entry point calls the current Agent Client adapter's `createLaunchCarrier` and returns a carrier for native spawn. Stop dispatch with the structured error if carrier support is unavailable or conversion fails. Then run `task-orchestration <task-ref> dispatch` with route's exact model/effort, passing the short task ref, skill, `--orchestrated`, stage/round/artifact/role, and the returned carrier unchanged to native spawn. The child calls `await-activation --stage ... --round ... --artifact ... --role ...` to associate its actual identity before executing. Code-task creates the local checkpoint; do not delegate a separate commit stage or push. Retain existing write locks without introducing a new lock protocol around native spawn.
|
|
23
23
|
8. Record actual start and terminal results through the current host's native lifecycle events and result interfaces. A timed-out wait does not imply success. Pause on actual identity, transport, or terminal failures. After the stage and child finish, call `advance`; repeat step 3 only while running.
|
|
24
24
|
9. Create a fresh child each round and never reuse a reviewer. Record actual model/effort and host fallback reasons. Validate current identity, artifacts, ledger, and execution results. User rulings override derived historical plan requirements. Do not introduce child discovery, orphan recovery, or a dedicated recovery protocol.
|
|
25
25
|
10. On pause or completion, run the matching typed verification and report the structured endpoint.
|
|
@@ -19,7 +19,7 @@ description: >
|
|
|
19
19
|
4. 调用 `agent-infra-internal task-orchestration {task-id} begin-or-resume --client {client}` 并转发完整显式策略。完全没有显式策略时由核心读取当前 client 的 `agentClients[].orchestration`;existing run 使用持久化策略。磁盘状态不符合当前完整结构时核心失败关闭且不改写;升级前必须完成或清空 active run。仅当核心返回 `ORCHESTRATION_MODEL_POLICY_REQUIRED` 时,先用 `agent-client model-selection` 展示 complete/partial/interactive-only 来源,再一次收集完整策略;未回答则不创建 run。若为 paused/completed,按结构化结果停止。
|
|
20
20
|
5. 调用 `route` 并读取结构化结果。若返回 `completed`,立即运行 `agent-infra-internal task-verify {task-id} run-task.completed --format text` 并停止;按 `.agents/rules/validation-output.md` 展示摘要并保留必要诊断。仅当返回 `running` 且 `next` 非空时读取唯一 action、role、round、artifact、`requestedModel` 和 `requestedReasoningEffort`,不得自行推断。
|
|
21
21
|
6. 调用 `prepare --client {client} --requested-model {requestedModel} --requested-reasoning-effort {requestedReasoningEffort}`,使用 route 返回的精确策略。客户端适配器执行宿主 preflight;任务身份、策略或宿主检查失败时记录实际诊断。
|
|
22
|
-
7. prepare
|
|
22
|
+
7. prepare 成功后,原样转发返回的可选 `adapterContext`,调用 `agent-infra-internal agent-client launch-carrier --client {client} --adapter-context {adapterContext} --stage {stage} --round {round} --role {role} --format json`。共享技能不解析、重写或验证该不透明值;受控入口调用当前 Agent Client adapter 的 `createLaunchCarrier`,并返回可直接交给 native spawn 的 carrier。缺少 carrier 能力或转换失败时按结构化错误停止派发。随后执行 `task-orchestration <task-ref> dispatch`,显式指定 route 返回的 model/effort;传递短任务引用、skill 名、`--orchestrated` 与 stage/round/artifact/role,并把返回的 carrier 原样交给 native spawn。child 调用 `await-activation --stage ... --round ... --artifact ... --role ...`,确认当前阶段与实际 child 关联后执行。代码阶段通过 code-task 创建本地 checkpoint;禁止单独委派 commit 阶段或推送。保留已有写锁,不把实际 spawn 纳入新建锁协议。
|
|
23
23
|
8. 通过当前宿主的原生生命周期事件和结果接口记录实际启动及终态。timed-out wait 不推断成功;身份、传输或异常终态失败如实暂停。阶段结果和 child 完成后调用 `advance`;只有 `running` 才重复步骤 3。
|
|
24
24
|
9. 每轮创建新 child;禁止 follow-up 复用 reviewer。如实记录 actual model/effort 及宿主降级理由。检查当前身份、产物、账本与实际执行结果;用户裁决优先于历史方案派生要求。不得新增 child discovery、孤立 child 恢复或专用恢复协议。
|
|
25
25
|
10. 完成或暂停后运行对应 typed verification,并把结构化 run 摘要、暂停原因、commit 终点或 clean completion evidence 告知用户。
|