@fitlab-ai/agent-infra 0.9.4 → 0.9.5
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/bin/internal-cli.js +10 -0
- package/dist/lib/agent-clients/adapter.js +2 -2
- package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +382 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +163 -0
- package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +211 -0
- package/dist/lib/agent-clients/adapters/codex.js +2 -2
- package/dist/lib/git/worktree-identity.js +64 -0
- package/dist/lib/internal/codex-lifecycle.js +202 -0
- package/dist/lib/internal/task-create.js +48 -0
- package/dist/lib/internal/task-orchestration.js +68 -29
- package/dist/lib/sandbox/commands/create.js +1 -0
- package/dist/lib/sandbox/control/client.js +29 -15
- package/dist/lib/sandbox/control/protocol.js +23 -4
- package/dist/lib/sandbox/control/server.js +53 -18
- package/dist/lib/sandbox/workspace-view.js +8 -2
- package/dist/lib/task/activity-log.js +32 -5
- package/dist/lib/task/commit-finalization.js +14 -3
- package/dist/lib/task/create-service.js +137 -0
- package/dist/lib/task/create.js +333 -0
- package/dist/lib/task/orchestration.js +151 -15
- package/dist/lib/task/review-fingerprint.js +4 -0
- package/dist/lib/task/workspace-snapshot.js +78 -3
- package/lib/agent-clients/adapter.ts +4 -4
- package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +442 -0
- package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +307 -0
- package/lib/agent-clients/adapters/codex-lifecycle/store.ts +250 -0
- package/lib/agent-clients/adapters/codex.ts +2 -2
- package/lib/git/worktree-identity.ts +86 -0
- package/lib/internal/codex-lifecycle.ts +204 -0
- package/lib/internal/task-create.ts +49 -0
- package/lib/internal/task-orchestration.ts +54 -28
- package/lib/sandbox/commands/create.ts +1 -0
- package/lib/sandbox/control/client.ts +42 -18
- package/lib/sandbox/control/protocol.ts +43 -8
- package/lib/sandbox/control/server.ts +60 -22
- package/lib/sandbox/workspace-view.ts +9 -2
- package/lib/task/activity-log.ts +46 -7
- package/lib/task/commit-finalization.ts +23 -3
- package/lib/task/create-service.ts +171 -0
- package/lib/task/create.ts +372 -0
- package/lib/task/orchestration.ts +182 -18
- package/lib/task/review-fingerprint.ts +9 -0
- package/lib/task/workspace-snapshot.ts +98 -4
- package/package.json +7 -7
- package/templates/.agents/hooks/lifecycle-delegation.js +47 -3
- package/templates/.agents/rules/task-management.en.md +1 -0
- package/templates/.agents/rules/task-management.zh-CN.md +1 -0
- package/templates/.agents/skills/commit/SKILL.en.md +3 -9
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -10
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +4 -3
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +5 -4
- package/templates/.agents/skills/create-task/SKILL.en.md +26 -43
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +26 -43
- package/templates/.codex/hooks.json +50 -0
|
@@ -31,21 +31,17 @@ description: >
|
|
|
31
31
|
|
|
32
32
|
未显式指定 task scope 时,只有 `TASK_CONTEXT_NOT_FOUND` 可继续既有纯提交路径;detached HEAD、损坏候选或多匹配属于歧义,必须失败。显式 task scope 解析失败时一律失败。
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## 步骤开始:恢复或创建受控 attempt
|
|
35
35
|
|
|
36
36
|
已解析出 `{task-id}` 时,先调用 `agent-infra-internal task-orchestration {task-id} commit-status`:
|
|
37
37
|
|
|
38
|
-
- `recoverable
|
|
38
|
+
- `recoverable`:调用 `commit-recover --agent {standard-agent-token}` 完成收尾,不得重复 commit 或 push。
|
|
39
|
+
- `prepared`:调用 `commit-recover --agent {standard-agent-token}` 安全清理 intent,再次查询 status 并复用返回的 `retryable-start` attempt。
|
|
40
|
+
- `retryable-start`:调用 `commit-recover --agent {standard-agent-token}` 取得原 attempt,不追加第二条 started。
|
|
39
41
|
- `invalid` / `conflict` / `orphaned-start`:输出结构化 code 与状态证据并停止。
|
|
40
|
-
- `idle
|
|
42
|
+
- `idle`:调用 `commit-start --agent {standard-agent-token}`,由核心在任务锁内原子写入结构化 started 并返回 attempt/baseline。
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Commit [started]** by {agent} — started
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
`ai task log` 会把它与提交完成时写入的 done 条目配对成一行(进行中 → 已完成)。格式与配对规则见 `.agents/rules/task-management.md` 的「Activity Log started / done 双标记约定」。仅当本任务存在 task.md 时写入(无任务上下文的纯提交可跳过)。
|
|
44
|
+
只从 `commit-start` / `commit-recover` 的结构化输出读取 `{commit-attempt}`;不得手写、复制或猜测 attempt。无任务上下文的纯提交跳过本协议。
|
|
49
45
|
|
|
50
46
|
## 1. 检查本地修改(关键)
|
|
51
47
|
|
|
@@ -9,12 +9,12 @@ This protocol applies only when `{task-id}` was resolved. A taskless Git-only co
|
|
|
9
9
|
|
|
10
10
|
## Begin before side effects
|
|
11
11
|
|
|
12
|
-
Call `commit-status` whenever the commit skill starts.
|
|
12
|
+
Call `commit-status` whenever the commit skill starts. Use `commit-recover --agent {standard-agent-token}` for `recoverable` / `prepared` / `retryable-start`; use `commit-start --agent {standard-agent-token}` for `idle`; fail closed for every other state. Read `commit_attempt` only from `finalization.attempt.attempt` in start/recover output.
|
|
13
13
|
|
|
14
14
|
After read-only preparation of status, copyright, message, review snapshot, and push routing, record `baseline_head=$(git rev-parse HEAD)` and run this before any commit, push, success log, or platform success sync:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head")
|
|
17
|
+
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head" --attempt "$commit_attempt")
|
|
18
18
|
commit_intent_token=$(printf '%s' "$commit_intent_result" | node -e 'let input = ""; process.stdin.on("data", chunk => input += chunk).on("end", () => process.stdout.write(JSON.parse(input).token))')
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -44,6 +44,7 @@ After the committed/pushed checkpoint and before task synchronization or `task-v
|
|
|
44
44
|
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
-
|
|
47
|
+
- If an intent exists but no side effect occurred, use `commit-abort --token ... --expected-head ...` while HEAD still equals baseline; when abandoning the attempt, then close it with `commit-terminate --attempt "$commit_attempt" --agent {standard-agent-token} --code <STABLE_CODE>`.
|
|
48
|
+
- If begin failed before intent creation, retain the attempt for retry or terminate it only while HEAD is unchanged.
|
|
48
49
|
- After a commit or push, never abort. Retain the intent and use `commit-status` / `commit-recover` for cross-session recovery.
|
|
49
50
|
- Stop when `commit-complete` fails. Do not repeat commit/push or mark a run complete without its full receipt lifecycle.
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
|
|
10
10
|
## 副作用前 begin
|
|
11
11
|
|
|
12
|
-
每次进入 commit 技能先调用 `commit-status`。`recoverable` / `prepared` 调用以下无 token
|
|
12
|
+
每次进入 commit 技能先调用 `commit-status`。`recoverable` / `prepared` / `retryable-start` 调用以下无 token 恢复入口,`idle` 调用 `commit-start --agent {standard-agent-token}`;其他状态 fail closed:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
agent-infra-internal task-orchestration {task-id} commit-recover --agent {standard-agent-token}
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
恢复入口只接受 `--agent`;不得传 token、head 或 `--orchestrated
|
|
18
|
+
恢复入口只接受 `--agent`;不得传 token、head 或 `--orchestrated`。从 start/recover 结构化输出读取 `finalization.attempt.attempt` 为 `commit_attempt`,不得手写 attempt。
|
|
19
19
|
|
|
20
20
|
完成状态、版权、提交信息、review snapshot 和 push 场景的只读准备后,记录 `baseline_head=$(git rev-parse HEAD)`,并在任何 commit、push、任务成功日志或平台成功同步之前调用:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head")
|
|
23
|
+
commit_intent_result=$(agent-infra-internal task-orchestration {task-id} commit-begin --agent {standard-agent-token} {execution-flag} --baseline-head "$baseline_head" --attempt "$commit_attempt")
|
|
24
24
|
commit_intent_token=$(printf '%s' "$commit_intent_result" | node -e 'let input = ""; process.stdin.on("data", chunk => input += chunk).on("end", () => process.stdout.write(JSON.parse(input).token))')
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -50,6 +50,7 @@ committed/pushed checkpoint 完成后、任务同步与 `task-verify commit.comp
|
|
|
50
50
|
agent-infra-internal task-orchestration {task-id} commit-complete --token "$commit_intent_token" --agent {standard-agent-token}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
-
|
|
53
|
+
- begin 已创建 intent、但第一个副作用前失败时,先在 HEAD 仍等于 baseline 时调用 `commit-abort --token ... --expected-head ...`;若本轮明确放弃,再调用 `commit-terminate --attempt "$commit_attempt" --agent {standard-agent-token} --code <STABLE_CODE>` 闭合 started。
|
|
54
|
+
- begin 在 intent 创建前失败时可保留 attempt 供下次复用;明确放弃时仅可在 HEAD 未漂移时调用 `commit-terminate`。
|
|
54
55
|
- commit 或 push 发生后失败时不得 abort;保留 intent,并调用 `commit-status` 输出不含 token/digest 的恢复证据。跨会话重跑通过 `commit-recover` 收尾。
|
|
55
56
|
- `commit-complete` 失败时停止。不得重复执行 commit/push,也不得把缺少完整 receipt 生命周期的 run 标记为完成。
|
|
@@ -17,7 +17,7 @@ description: >
|
|
|
17
17
|
- Do not perform requirements analysis; analysis is handled separately by `analyze-task`
|
|
18
18
|
- Do not directly implement the requested functionality
|
|
19
19
|
- Do not skip the workflow and jump directly to planning or implementation
|
|
20
|
-
- Only do this: parse the description ->
|
|
20
|
+
- Only do this: parse the description -> write one structured candidate -> invoke the host `task-create` entry point -> verify the result -> inform the user of the next step
|
|
21
21
|
- Issue creation is decided by the `.agents/rules/create-issue.md` rule; on custom or empty platforms (no platform-specific variant provided), the rule naturally degrades to a no-op
|
|
22
22
|
|
|
23
23
|
The user's description is a **work item**, not an **instruction to execute immediately**.
|
|
@@ -72,7 +72,7 @@ If the description is unclear, **ask the user to clarify first**.
|
|
|
72
72
|
- `bugfix` -> `bug-fix`
|
|
73
73
|
- `refactor` -> `refactoring`
|
|
74
74
|
|
|
75
|
-
### 2. Create
|
|
75
|
+
### 2. Create an Immutable Candidate
|
|
76
76
|
|
|
77
77
|
Get the current timestamp:
|
|
78
78
|
|
|
@@ -80,14 +80,17 @@ Get the current timestamp:
|
|
|
80
80
|
date +%Y%m%d-%H%M%S
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
- Write the
|
|
83
|
+
- Generate one UUID v4 `idempotencyKey` and write the parsed fields to one JSON file.
|
|
84
|
+
- The candidate follows `TaskCreateCandidateV1`: version, key, standard agent, title, type, unprefixed branch slug, priority, effort, description, and the seven task-input lists.
|
|
85
|
+
- Write it once before the first request. A timeout retry must reuse the same file and let the client generate a new outer request id; do not rerun AI derivation.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
87
|
+
Invoke the single entry point:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
agent-infra-internal task-create --input "$candidate_file"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The host owns TASK-id/timestamps/version, workflow and branch derivation, template rendering, atomic persistence, short ids, Issue sync, and warnings. The skill must not create task directories, copy templates, allocate short ids, or call platform subcommands directly.
|
|
91
94
|
|
|
92
95
|
Task metadata (`task.md` YAML front matter):
|
|
93
96
|
```yaml
|
|
@@ -109,7 +112,7 @@ assigned_to: {current AI agent}
|
|
|
109
112
|
|
|
110
113
|
priority / effort are required: the AI infers them from the task title and description (candidates in `.agents/rules/issue-fields.md`; normalize localized input). Leave start_date / target_date empty at creation: `start_date` is written by the analyze stage and `target_date` by the complete stage; do not invent dates.
|
|
111
114
|
|
|
112
|
-
### 3.
|
|
115
|
+
### 3. Handle the Structured Result
|
|
113
116
|
|
|
114
117
|
Get the current time:
|
|
115
118
|
|
|
@@ -117,43 +120,25 @@ Get the current time:
|
|
|
117
120
|
date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
118
121
|
```
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
- `
|
|
122
|
-
- `
|
|
123
|
-
- `
|
|
124
|
-
- `agent_infra_version`: value from `.agents/rules/version-stamp.md`
|
|
125
|
-
- `## Context` -> `- **Branch**:`: update it to the generated branch name
|
|
126
|
-
- **Append** to `## Activity Log` (do NOT overwrite previous entries):
|
|
127
|
-
```
|
|
128
|
-
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Create Task** by {agent} — Task created from description
|
|
129
|
-
```
|
|
123
|
+
- `applied` / `no-op`: use the returned task id, short id, and optional Issue identity; do not discover them by scanning directories.
|
|
124
|
+
- `degraded`: the local task is retained; display the returned warning.
|
|
125
|
+
- `blocked`: retain the candidate and retry the same file after the transient problem is fixed.
|
|
126
|
+
- `failed`: report the stable error code. Never modify and retry a candidate under the same idempotency key.
|
|
130
127
|
|
|
131
|
-
### 4.
|
|
128
|
+
### 4. Platform Failure Compatibility
|
|
132
129
|
|
|
133
|
-
|
|
130
|
+
The host service owns platform cascading. The compatibility recovery commands remain visible in the host warning and are not run from the sandbox:
|
|
134
131
|
|
|
135
132
|
```bash
|
|
136
|
-
agent-infra-internal
|
|
137
|
-
agent-infra-internal platform-
|
|
133
|
+
agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number"
|
|
134
|
+
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
|
|
138
135
|
```
|
|
139
136
|
|
|
140
|
-
|
|
141
|
-
- Intent created the Issue: `issue_number` was written through the task writer; run `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
|
|
142
|
-
- Rule failed (auth / network / template parse / etc.): do not roll back task.md or append an extra Activity Log entry; run `agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "Fix auth/network/template issues and manually retry Issue creation, or create/find an Issue and write issue_number"` to submit a structured warning intent (callers do not allocate ids or edit rows), then follow Scenario C
|
|
143
|
-
- Intent returned no-op/degraded: continue applicable operations without blocking the workflow
|
|
144
|
-
- task.md already has a valid `issue_number`: create validates the binding and returns no-op without creating a duplicate
|
|
137
|
+
The skill only consumes the Issue identity, operations, and warnings returned by the host; it must not repeat platform writes.
|
|
145
138
|
|
|
146
139
|
### 5. Verification Gate
|
|
147
140
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
node .agents/scripts/task-short-id.js alloc "$task_id"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
If this fails (non-zero exit), follow the message — archive some active tasks or raise `task.shortIdLength` — and do NOT continue.
|
|
155
|
-
|
|
156
|
-
Run the verification gate to confirm the task artifact and sync state are valid:
|
|
141
|
+
The host `task-create` service runs the same typed gate before returning. Consume the returned `task:verify` operation; a branch-only sandbox must not try to read the invisible new task. For direct host diagnostics, run:
|
|
157
142
|
|
|
158
143
|
```bash
|
|
159
144
|
agent-infra-internal task-verify {task-id} create-task.completed --format text
|
|
@@ -244,12 +229,10 @@ For later platform sync: after fixing auth / network / template issues, manually
|
|
|
244
229
|
|
|
245
230
|
## Completion Checklist
|
|
246
231
|
|
|
247
|
-
- [ ]
|
|
232
|
+
- [ ] Wrote one candidate and invoked `agent-infra-internal task-create`
|
|
233
|
+
- [ ] The host created `.agents/workspace/active/{task-id}/task.md`
|
|
248
234
|
- [ ] Wrote and checked `## Task Input` source and state semantics according to `reference/context-capture.md`
|
|
249
|
-
- [ ]
|
|
250
|
-
- [ ] Updated `updated_at` to the current time in task.md
|
|
251
|
-
- [ ] Updated `assigned_to` in task.md
|
|
252
|
-
- [ ] Appended an Activity Log entry to task.md
|
|
235
|
+
- [ ] The returned task id and short id passed completion verification
|
|
253
236
|
- [ ] Tried cascading Issue creation through `.agents/rules/create-issue.md`; if it failed, kept task.md and recorded the reason
|
|
254
237
|
- [ ] Rendered the selected next-step commands through the shared helper
|
|
255
238
|
- [ ] **Did not modify any business code or configuration files**
|
|
@@ -17,7 +17,7 @@ description: >
|
|
|
17
17
|
- 不要执行需求分析;分析由 `analyze-task` 独立完成
|
|
18
18
|
- 不要直接实现所描述的功能
|
|
19
19
|
- 不要跳过工作流直接进入计划/实现阶段
|
|
20
|
-
- 仅执行:解析描述 ->
|
|
20
|
+
- 仅执行:解析描述 -> 一次性生成结构化 candidate -> 调用宿主 `task-create` 入口 -> 校验结果 -> 告知用户下一步
|
|
21
21
|
- Issue 创建由 `.agents/rules/create-issue.md` 规则决定;自定义或空平台(未提供平台变体规则文件)时,规则会自然降级为 no-op
|
|
22
22
|
|
|
23
23
|
用户的描述是一个**待办事项**,而不是**立即执行的指令**。
|
|
@@ -71,7 +71,7 @@ description: >
|
|
|
71
71
|
- `bugfix` -> `bug-fix`
|
|
72
72
|
- `refactor` -> `refactoring`
|
|
73
73
|
|
|
74
|
-
### 2.
|
|
74
|
+
### 2. 生成不可变 candidate
|
|
75
75
|
|
|
76
76
|
获取当前时间戳:
|
|
77
77
|
|
|
@@ -79,14 +79,17 @@ description: >
|
|
|
79
79
|
date +%Y%m%d-%H%M%S
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
82
|
+
- 生成随机 UUID v4 作为 `idempotencyKey`,并把步骤 1 的结果写入单个 JSON 文件。
|
|
83
|
+
- candidate 必须符合宿主 `TaskCreateCandidateV1`:`version`、`idempotencyKey`、标准 `agent`、`title`、`type`、不带项目前缀的 `branchSlug`、`priority`、`effort`、`description` 和 `taskInput` 七类列表。
|
|
84
|
+
- 首次提交前只写一次 candidate;等待终态期间不得重新运行 AI 推导或改写文件。超时重试必须复用同一文件,由客户端生成新的 outer request ID。
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
86
|
+
调用统一入口:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
agent-infra-internal task-create --input "$candidate_file"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
宿主负责 TASK-id/时间戳/版本戳、workflow/branch 派生、模板渲染、原子持久化、短号、Issue 与 warning。技能不得自行 `mkdir`、复制任务模板、分配短号或直接调用平台子命令。
|
|
90
93
|
|
|
91
94
|
任务元数据(task.md YAML front matter):
|
|
92
95
|
```yaml
|
|
@@ -108,7 +111,7 @@ assigned_to: {当前 AI 代理}
|
|
|
108
111
|
|
|
109
112
|
priority / effort 必填:由 AI 从任务标题与描述推断后填入(候选值见 `.agents/rules/issue-fields.md`;中文输入按本地化映射规范化)。start_date / target_date 创建时保持留空:`start_date` 由 analyze 阶段写入、`target_date` 由 complete 阶段写入;不要臆测日期。
|
|
110
113
|
|
|
111
|
-
### 3.
|
|
114
|
+
### 3. 处理结构化结果
|
|
112
115
|
|
|
113
116
|
获取当前时间:
|
|
114
117
|
|
|
@@ -116,43 +119,25 @@ priority / effort 必填:由 AI 从任务标题与描述推断后填入(候
|
|
|
116
119
|
date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
|
|
117
120
|
```
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
- `
|
|
121
|
-
- `
|
|
122
|
-
- `
|
|
123
|
-
- `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
|
|
124
|
-
- `## 上下文` 中的 `- **分支**:`:更新为生成的分支名
|
|
125
|
-
- **追加**到 `## Activity Log`(不要覆盖之前的记录):
|
|
126
|
-
```
|
|
127
|
-
- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Create Task** by {agent} — Task created from description
|
|
128
|
-
```
|
|
122
|
+
- `applied` / `no-op`:从响应读取 task ID、短号与可选 Issue 身份;不得从目录扫描推断。
|
|
123
|
+
- `degraded`:本地任务已经保留;展示响应中的 warning。
|
|
124
|
+
- `blocked`:保留 candidate 文件,修复暂态问题后用同一文件重试。
|
|
125
|
+
- `failed`:报告稳定错误码;幂等冲突时不得改写原 key 或原 candidate 后重试。
|
|
129
126
|
|
|
130
|
-
### 4.
|
|
127
|
+
### 4. 平台失败兼容说明
|
|
131
128
|
|
|
132
|
-
|
|
129
|
+
平台级联由宿主服务完成。兼容的人工恢复命令仍由宿主 warning 指引,不在沙箱内执行:
|
|
133
130
|
|
|
134
131
|
```bash
|
|
135
|
-
agent-infra-internal
|
|
136
|
-
agent-infra-internal platform-
|
|
132
|
+
agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后写入 issue_number"
|
|
133
|
+
agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}
|
|
137
134
|
```
|
|
138
135
|
|
|
139
|
-
|
|
140
|
-
- intent 成功创建 Issue:`issue_number` 已由任务写入内核回写;调用 `agent-infra-internal platform-comment sync {task-id} --kind task --agent {standard-agent-token}`
|
|
141
|
-
- 规则失败(认证 / 网络 / 模板解析等):不回滚 task.md;不追加额外 Activity Log;先调用 `agent-infra-internal task-warning {task-id} add --step create-task --severity ACTION_REQUIRED --code ISSUE_CREATE_FAILED --target issue --message "{error_code}: {error_message}" --action "修复认证/网络/模板问题后手动重试 Issue 创建,或手动创建/找到 Issue 后写入 issue_number"` 提交结构化 warning 意图(调用方不分配编号或写表格);再按"场景 C:Issue 创建失败"输出
|
|
142
|
-
- intent 为 no-op/degraded:按结构化 operations 继续可执行部分;自定义或空平台不创建评论且不阻塞工作流
|
|
143
|
-
- task.md 已存在有效 `issue_number`:create intent 校验绑定后返回 no-op,不重复创建
|
|
136
|
+
技能只消费宿主返回的 Issue identity、operations 与 warnings;不得重复发起平台写入。
|
|
144
137
|
|
|
145
138
|
### 5. 完成校验
|
|
146
139
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
node .agents/scripts/task-short-id.js alloc "$task_id"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
如失败(退出码非 0),按提示「归档若干任务」或「调高 task.shortIdLength」处理;不要继续执行后续步骤。
|
|
154
|
-
|
|
155
|
-
运行完成校验,确认任务产物和同步状态符合规范:
|
|
140
|
+
宿主 `task-create` 服务在返回前运行同一 typed 完成校验;技能从响应的 `task:verify` operation 取得当次结果。branch-only 不得尝试读取不可见的新任务。宿主直接诊断时可运行:
|
|
156
141
|
|
|
157
142
|
```bash
|
|
158
143
|
agent-infra-internal task-verify {task-id} create-task.completed --format text
|
|
@@ -243,12 +228,10 @@ Issue 创建失败:
|
|
|
243
228
|
|
|
244
229
|
## 完成检查清单
|
|
245
230
|
|
|
246
|
-
- [ ]
|
|
231
|
+
- [ ] 只生成一次结构化 candidate 并调用 `agent-infra-internal task-create`
|
|
232
|
+
- [ ] 宿主创建了任务文件 `.agents/workspace/active/{task-id}/task.md`
|
|
247
233
|
- [ ] 已按 `reference/context-capture.md` 写入并复核 `## 任务输入` 的来源与状态语义
|
|
248
|
-
- [ ]
|
|
249
|
-
- [ ] 更新了 task.md 中的 `updated_at` 为当前时间
|
|
250
|
-
- [ ] 更新了 task.md 中的 `assigned_to`
|
|
251
|
-
- [ ] 追加了 Activity Log 条目到 task.md
|
|
234
|
+
- [ ] 响应中的任务 ID 和短号已通过完成校验
|
|
252
235
|
- [ ] 已按 `.agents/rules/create-issue.md` 尝试级联创建 Issue;失败时保留 task.md 并记录原因
|
|
253
236
|
- [ ] 已通过统一 helper 渲染已选场景的下一步命令
|
|
254
237
|
- [ ] **没有修改任何业务代码或配置文件**
|
|
@@ -11,6 +11,56 @@
|
|
|
11
11
|
"statusMessage": "Checking template version before git commit"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"matcher": "^collaborationspawn_agent$",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event pre-tool",
|
|
21
|
+
"timeout": 5,
|
|
22
|
+
"statusMessage": "Recording Codex lifecycle spawn evidence"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"PostToolUse": [
|
|
28
|
+
{
|
|
29
|
+
"matcher": "^collaborationspawn_agent$",
|
|
30
|
+
"hooks": [
|
|
31
|
+
{
|
|
32
|
+
"type": "command",
|
|
33
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event post-tool",
|
|
34
|
+
"timeout": 5,
|
|
35
|
+
"statusMessage": "Recording Codex lifecycle tool completion"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"SubagentStart": [
|
|
41
|
+
{
|
|
42
|
+
"matcher": "^agent-infra-lifecycle-(executor|reviewer)$",
|
|
43
|
+
"hooks": [
|
|
44
|
+
{
|
|
45
|
+
"type": "command",
|
|
46
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-start",
|
|
47
|
+
"timeout": 5,
|
|
48
|
+
"statusMessage": "Recording Codex child identity"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"SubagentStop": [
|
|
54
|
+
{
|
|
55
|
+
"matcher": "^agent-infra-lifecycle-(executor|reviewer)$",
|
|
56
|
+
"hooks": [
|
|
57
|
+
{
|
|
58
|
+
"type": "command",
|
|
59
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-stop",
|
|
60
|
+
"timeout": 5,
|
|
61
|
+
"statusMessage": "Recording Codex child stop evidence"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
14
64
|
}
|
|
15
65
|
]
|
|
16
66
|
}
|