hive-tasks 1.5.0 → 1.6.0
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/CHANGELOG.md +27 -0
- package/README.md +4 -5
- package/README.zh-CN.md +3 -4
- package/SPEC.md +24 -39
- package/package.json +3 -3
- package/src/cli.js +3 -23
- package/src/role.js +1 -1
- package/src/stage.js +4 -4
- package/src/task.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,29 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.6.0] - 2026-12-04
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- The state machine has exactly four states: pending, claimed, done and failed. The
|
|
12
|
+
blocked state is removed; a card that cannot proceed is failed with a reason.
|
|
13
|
+
- Stage runtime states are the same four. fail marks the current stage failed; a stage
|
|
14
|
+
with a done onFail target still rewinds the chain.
|
|
15
|
+
- `block` and `unblock` are no longer commands. Use `fail <id> --reason R` to mark a
|
|
16
|
+
failure and `retry <id> [--stage KEY]` to return a failed card to pending.
|
|
17
|
+
- Events `task_block` and `task_unblock` are no longer emitted; a failure is `task_fail`.
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
|
|
21
|
+
- The blocked card state and stage state from the CLI, list/ready/stats output, SPEC and
|
|
22
|
+
both READMEs; the block and unblock commands; their events.
|
|
23
|
+
|
|
24
|
+
### Tests
|
|
25
|
+
|
|
26
|
+
- 41 node:test scenarios: the four-state behaviour, fail/retry on plain and staged
|
|
27
|
+
cards, ready excluding failed cards, stats counting only the four states, and the
|
|
28
|
+
removal of block/unblock as commands.
|
|
29
|
+
|
|
7
30
|
## [1.5.0] - 2026-12-04
|
|
8
31
|
|
|
9
32
|
### Added
|
|
@@ -24,6 +47,10 @@ All notable changes to this project are documented here. The format follows
|
|
|
24
47
|
release, the task_delete event, unknown ids, the non-idempotent second delete and
|
|
25
48
|
--json output.
|
|
26
49
|
|
|
50
|
+
### Published
|
|
51
|
+
|
|
52
|
+
- npm: `hive-tasks@1.5.0` on 2026-12-04.
|
|
53
|
+
|
|
27
54
|
## [1.4.0] - 2026-12-04
|
|
28
55
|
|
|
29
56
|
### Added
|
package/README.md
CHANGED
|
@@ -74,10 +74,9 @@ token-tests-ba66 pending tester token tests
|
|
|
74
74
|
| done <id> [--sha S] [--verdict pass\|fail] [--verify] | finish, release leases, record resultCommit; on a staged card it opens the next stage; --verify runs the current stage acceptance first |
|
|
75
75
|
| plan --file plan.json | create a whole dependency tree in one transaction |
|
|
76
76
|
| fail <id> --reason R | failure is data: attempt stays; a stage with a done onFail target rewinds instead |
|
|
77
|
-
| retry <id> [--stage KEY] | failed
|
|
78
|
-
| block <id> --reason R / unblock <id> | park a card without losing it |
|
|
77
|
+
| retry <id> [--stage KEY] | failed back to pending (or reset a chain to KEY) |
|
|
79
78
|
| reopen <id> [--reason R] [--agent A] [--stage KEY] | every state back to pending; clears owner, claim, result and verdict, attempt + 1; releases the claim's leases; a staged card resets to KEY (default the first stage) |
|
|
80
|
-
| rm <id> [--force] [--json] | delete a pending/failed/
|
|
79
|
+
| rm <id> [--force] [--json] | delete a pending/failed/done card; a claimed card is refused (exit 2) unless --force, which releases its leases first |
|
|
81
80
|
|
|
82
81
|
Exit codes: 0 done, 1 internal error, 2 refused (already claimed, wrong state, dependency missing, mode freeze, path busy).
|
|
83
82
|
|
|
@@ -139,7 +138,7 @@ hive-tasks: task working-card-9f8e is claimed by agent-A; release or reopen it f
|
|
|
139
138
|
$ hive-tasks rm working-card-9f8e --force # releases the claim's leases, then deletes
|
|
140
139
|
~~~
|
|
141
140
|
|
|
142
|
-
pending, failed
|
|
141
|
+
pending, failed and done cards are deletable. A claimed card is protected on
|
|
143
142
|
purpose: delete it with --force, which releases exactly that claim's hive leases first, so
|
|
144
143
|
no lease is stranded. An unknown id is exit 2, and a second delete reports "no such task"
|
|
145
144
|
instead of pretending to succeed.
|
|
@@ -203,7 +202,7 @@ created without stages keep the old single-implicit-stage behaviour, stored blob
|
|
|
203
202
|
|
|
204
203
|
## Role resolution
|
|
205
204
|
|
|
206
|
-
A role is a free string, never an enum, so resolving one must never
|
|
205
|
+
A role is a free string, never an enum, so resolving one must never refuse a card. show
|
|
207
206
|
prints where the role came from:
|
|
208
207
|
|
|
209
208
|
~~~bash
|
package/README.zh-CN.md
CHANGED
|
@@ -74,10 +74,9 @@ token-tests-ba66 pending tester token 测试
|
|
|
74
74
|
| done <id> [--sha S] [--verdict pass\|fail] [--verify] | 完成、释放租约、记录 resultCommit;带阶段的卡会打开下一阶段;--verify 先跑当前阶段的验收 |
|
|
75
75
|
| plan --file plan.json | 一次事务创建整棵依赖树 |
|
|
76
76
|
| fail <id> --reason R | 失败是数据:attempt 保留;阶段有已 done 的 onFail 目标时改为回退 |
|
|
77
|
-
| retry <id> [--stage KEY] | failed
|
|
78
|
-
| block <id> --reason R / unblock <id> | 挂起而不丢卡 |
|
|
77
|
+
| retry <id> [--stage KEY] | failed 回到 pending(或把链复位到 KEY) |
|
|
79
78
|
| reopen <id> [--reason R] [--agent A] [--stage KEY] | 任何状态回到 pending;清 owner、认领、结果与判定,attempt + 1;释放认领时的租约;带阶段的卡复位到 KEY(默认第一阶段) |
|
|
80
|
-
| rm <id> [--force] [--json] | 删除 pending/failed/
|
|
79
|
+
| rm <id> [--force] [--json] | 删除 pending/failed/done 的卡;claimed 的卡默认拒绝(退出码 2),加 --force 会先释放租约再删 |
|
|
81
80
|
|
|
82
81
|
退出码:0 成功,1 内部错误,2 被拒(已被认领、状态不对、依赖缺失、模式 freeze、路径忙)。
|
|
83
82
|
|
|
@@ -135,7 +134,7 @@ hive-tasks: task working-card-9f8e is claimed by agent-A; release or reopen it f
|
|
|
135
134
|
$ hive-tasks rm working-card-9f8e --force # 先释放认领时的租约,再删除
|
|
136
135
|
~~~
|
|
137
136
|
|
|
138
|
-
pending、failed、
|
|
137
|
+
pending、failed、done 的卡都可以删。claimed 的卡是**故意保护**的:要加
|
|
139
138
|
--force 才删,并且会先释放这次认领持有的 hive 租约,不会留下孤儿租约。未知 id 退出码
|
|
140
139
|
为 2;第二次删除会报 "no such task",不会静默成功。
|
|
141
140
|
|
package/SPEC.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# hive-tasks protocol
|
|
2
2
|
|
|
3
|
-
Status: implemented, 1.
|
|
3
|
+
Status: implemented, 1.6.0. Protocol version v1 (card blobs keep `v: 1`).
|
|
4
4
|
|
|
5
5
|
## 1. Scope
|
|
6
6
|
|
|
@@ -91,7 +91,7 @@ Implementation sketch (plumbing, no working tree involved):
|
|
|
91
91
|
| owner | agent id while claimed |
|
|
92
92
|
| attempt | incremented on every claim and every reopen, and on an onFail rewind; used to stop retry loops |
|
|
93
93
|
| verdict | pass or fail, copied from the hive verdict when the card itself is done |
|
|
94
|
-
| reason | why the card is in its current state: the text passed to fail
|
|
94
|
+
| reason | why the card is in its current state: the text passed to fail or reopen, or "test failed: ..." after a review reflow |
|
|
95
95
|
| reviewOf | id of the card this review card tests; the id is also added to after, so the review is ready only when its upstream is done |
|
|
96
96
|
| tags | free labels; "fix" is special (see mode) |
|
|
97
97
|
| acceptance | optional shell command; used by done --verify when the card has no stages |
|
|
@@ -99,7 +99,7 @@ Implementation sketch (plumbing, no working tree involved):
|
|
|
99
99
|
| resultCommit | the commit recorded when the card or its current stage was finished |
|
|
100
100
|
| stages | optional ordered stage chain. Absent or [] means a card without stages |
|
|
101
101
|
| stage | current stage key, or null for a card without stages |
|
|
102
|
-
| stageState | state of the current stage: pending, claimed, done, failed
|
|
102
|
+
| stageState | state of the current stage: pending, claimed, done, failed; null for a card without stages |
|
|
103
103
|
|
|
104
104
|
Fields at the end are only stored when the card has stages. A card created without
|
|
105
105
|
`--stage`/`--stages` has exactly the 1.3.0 blob: `stages`, `stage` and
|
|
@@ -113,7 +113,7 @@ Fields at the end are only stored when the card has stages. A card created witho
|
|
|
113
113
|
role: coder # any string, not enumerated
|
|
114
114
|
acceptance: "npm test" # optional, used by done --verify at this stage
|
|
115
115
|
onFail: code # optional, the key to rewind to when this stage fails
|
|
116
|
-
state: pending # runtime: pending | claimed | done | failed
|
|
116
|
+
state: pending # runtime: pending | claimed | done | failed
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
| Field | Meaning |
|
|
@@ -121,7 +121,7 @@ Fields at the end are only stored when the card has stages. A card created witho
|
|
|
121
121
|
| key | unique and stable inside the card; the stage identifier |
|
|
122
122
|
| role | free-form role name; resolved to an adapter/model/prompt by the dispatcher (section 7) |
|
|
123
123
|
| acceptance | optional command; done --verify runs the current stage's command before it advances |
|
|
124
|
-
| onFail | optional key of an earlier stage. When this stage fails
|
|
124
|
+
| onFail | optional key of an earlier stage. When this stage fails and that target is done, the chain rewinds to it instead of failing the card |
|
|
125
125
|
| state | runtime stage state, maintained by every transition |
|
|
126
126
|
|
|
127
127
|
Stage state and card state move together for the current stage: a claimed stage means
|
|
@@ -133,13 +133,11 @@ Once a non-final stage is done the card returns to pending while the next stage
|
|
|
133
133
|
```
|
|
134
134
|
claim
|
|
135
135
|
pending ─────────────────────▶ claimed
|
|
136
|
-
▲ │ │
|
|
137
|
-
│ │ │ └── block ─▶ blocked
|
|
136
|
+
▲ │ │
|
|
138
137
|
│ │ └──── fail ──▶ failed
|
|
139
138
|
│ └───── done ───▶ done
|
|
140
139
|
│
|
|
141
|
-
├── retry (failed
|
|
142
|
-
├── unblock (blocked)
|
|
140
|
+
├── retry (failed)
|
|
143
141
|
└── reopen (every stored state)
|
|
144
142
|
```
|
|
145
143
|
|
|
@@ -152,7 +150,7 @@ card reopen always resets the chain (default first stage, --stage KEY selects an
|
|
|
152
150
|
including a card that is currently pending.
|
|
153
151
|
|
|
154
152
|
`rm` is the only destructive command: it removes the card's blob from the task tree in
|
|
155
|
-
one CAS. pending, failed
|
|
153
|
+
one CAS. pending, failed and done cards are deletable. A claimed card is refused
|
|
156
154
|
(exit 2, with a hint to release or reopen it) unless --force is given; --force releases
|
|
157
155
|
exactly that claim's hive leases and then deletes the card, so a forced delete cannot
|
|
158
156
|
strand a lease. Deleting a card is not idempotent: an unknown id is exit 2, and a second
|
|
@@ -164,17 +162,12 @@ now have a missing dependency, which the ready computation reports as a data err
|
|
|
164
162
|
| pending | claim | claimed | CAS winner; attempt + 1 |
|
|
165
163
|
| claimed | done | done | releases leases; records resultCommit and verdict |
|
|
166
164
|
| claimed | fail | failed | releases leases; attempt kept |
|
|
167
|
-
| claimed | block | blocked | releases leases |
|
|
168
165
|
| claimed | reopen | pending | releases leases; attempt + 1 |
|
|
169
166
|
| done | reopen | pending | attempt + 1; clears resultCommit and verdict |
|
|
170
167
|
| failed | retry | pending | attempt kept |
|
|
171
168
|
| failed | reopen | pending | attempt + 1 |
|
|
172
|
-
| blocked | unblock | pending | attempt kept |
|
|
173
|
-
| blocked | retry | pending | attempt kept |
|
|
174
|
-
| blocked | reopen | pending | attempt + 1 |
|
|
175
169
|
| pending | reopen | pending | no-op (exit 0) |
|
|
176
|
-
|
|
|
177
|
-
| pending/failed/blocked/done | rm | deleted | removes the blob in one CAS |
|
|
170
|
+
| pending/failed/done | rm | deleted | removes the blob in one CAS |
|
|
178
171
|
| claimed | rm --force | deleted | releases the claim's leases, then removes the blob |
|
|
179
172
|
|
|
180
173
|
- pending: exists, dependencies not satisfied (or no capacity to run it).
|
|
@@ -182,9 +175,8 @@ now have a missing dependency, which the ready computation reports as a data err
|
|
|
182
175
|
- claimed: a dispatcher claimed it; owner and attempt are set.
|
|
183
176
|
- done: owner finished and (optionally) a verdict was recorded.
|
|
184
177
|
- failed: the run failed; retry moves it back to pending with attempt preserved.
|
|
185
|
-
- blocked: cannot proceed (conflict, missing dependency, manual hold).
|
|
186
178
|
|
|
187
|
-
Stored states are pending, claimed, done, failed
|
|
179
|
+
Stored states are pending, claimed, done, failed. ready is always computed.
|
|
188
180
|
|
|
189
181
|
A claimed card carries claimedUntil. Once that time passes the card is **reclaimable**:
|
|
190
182
|
claim may take it over exactly as if it were pending, incrementing attempt. This is how
|
|
@@ -230,12 +222,12 @@ Rules:
|
|
|
230
222
|
(pending, owner cleared, leases released) and keeps the card pending. The last stage
|
|
231
223
|
finishes the card (state done, stageState done). done returns `nextStage` (null when
|
|
232
224
|
the chain is complete).
|
|
233
|
-
3. **Fail stops or rewinds.** fail
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
4. **Retry and reopen reset stages.** retry resets the failed
|
|
225
|
+
3. **Fail stops or rewinds.** fail marks the current stage failed. If the stage has
|
|
226
|
+
onFail and that target stage is done, the chain rewinds: the target and all later
|
|
227
|
+
stages become pending, the current stage stays failed as history, the card becomes
|
|
228
|
+
pending and ready again, and attempt is incremented. Without a usable onFail target
|
|
229
|
+
the whole card becomes failed, exactly as before.
|
|
230
|
+
4. **Retry and reopen reset stages.** retry resets the failed stage (or the
|
|
239
231
|
--stage target) to pending and keeps earlier done stages; reopen resets to the target
|
|
240
232
|
(default the first stage) and increments attempt.
|
|
241
233
|
5. **Acceptance is per stage.** done --verify runs the current stage acceptance, falling
|
|
@@ -250,13 +242,8 @@ Rules:
|
|
|
250
242
|
| claimed / claimed | done (last stage) | done / done | stage done; card done; resultCommit/verdict recorded |
|
|
251
243
|
| claimed / claimed | fail, onFail target done | pending / pending at target | stage failed; target..end pending; attempt + 1; card ready again |
|
|
252
244
|
| claimed / claimed | fail, no usable onFail | failed / failed | whole card failed; stage failed |
|
|
253
|
-
| claimed / claimed | block, onFail target done | pending / pending at target | stage blocked; target..end pending; attempt + 1 |
|
|
254
|
-
| claimed / claimed | block, no usable onFail | blocked / blocked | whole card blocked |
|
|
255
245
|
| failed / failed | retry [--stage KEY] | pending / pending at KEY | KEY..end reset to pending, attempt kept |
|
|
256
|
-
| blocked / blocked | unblock | pending / pending at current | current stage pending, attempt kept |
|
|
257
|
-
| blocked / blocked | retry [--stage KEY] | pending / pending at KEY | KEY..end reset to pending, attempt kept |
|
|
258
246
|
| any / any | reopen [--stage KEY] | pending / pending at KEY | KEY..end reset (default first), attempt + 1, leases released |
|
|
259
|
-
| any / any | block | blocked / blocked or rewind | block accepts any state |
|
|
260
247
|
|
|
261
248
|
## 5. Ready computation
|
|
262
249
|
|
|
@@ -292,8 +279,6 @@ see the same order; the claim CAS still gives exactly one winner per card.
|
|
|
292
279
|
hive-tasks done <id> [--sha S] [--verdict pass|fail] [--verify]
|
|
293
280
|
hive-tasks fail <id> --reason R
|
|
294
281
|
hive-tasks retry <id> [--stage KEY]
|
|
295
|
-
hive-tasks block <id> --reason R
|
|
296
|
-
hive-tasks unblock <id>
|
|
297
282
|
hive-tasks reopen <id> [--reason R] [--stage KEY]
|
|
298
283
|
hive-tasks rm <id> [--force] [--json]
|
|
299
284
|
|
|
@@ -316,11 +301,11 @@ held leases behind when the card CAS loses. Reverting the card is another CAS we
|
|
|
316
301
|
no state leaks. A staged card reverts its stageState to pending together with the card.
|
|
317
302
|
|
|
318
303
|
done releases the leases and records the verdict (or opens the next stage). fail releases
|
|
319
|
-
the leases and keeps the attempt counter. retry accepts failed
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
304
|
+
the leases and keeps the attempt counter. retry accepts failed cards and returns the card
|
|
305
|
+
to pending (or resets the chain to a stage). reopen accepts every stored state, returns
|
|
306
|
+
the card to pending and releases a claimed card's leases (section 4). add --review-of
|
|
307
|
+
links a review card to its upstream (section 4.1). rm deletes pending, failed and done
|
|
308
|
+
cards, and refuses a
|
|
324
309
|
claimed card (exit 2) unless --force, which releases the claim's leases first; it prints
|
|
325
310
|
the deleted card (with `deleted: true`) under --json.
|
|
326
311
|
|
|
@@ -367,9 +352,9 @@ Each command appends one line to .hive/events.jsonl:
|
|
|
367
352
|
{ "ts": "...", "actor": "worker-3", "kind": "task_claim", "task": "auth-token-a1b2", "attempt": 1 }
|
|
368
353
|
```
|
|
369
354
|
|
|
370
|
-
kinds: task_add, task_claim, task_done, task_fail, task_retry,
|
|
371
|
-
|
|
372
|
-
|
|
355
|
+
kinds: task_add, task_claim, task_done, task_fail, task_retry, task_renew, task_plan,
|
|
356
|
+
task_delete, reopen, review_failed, stage_done, stage_failed, stage_advanced,
|
|
357
|
+
stage_rewound.
|
|
373
358
|
|
|
374
359
|
`task_delete` records the removed card: it carries both `task` and `id` (the card id),
|
|
375
360
|
`state` (the state the card had when it was deleted) and `actor`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-tasks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Task cards for agent teams: one git tree behind one ref, with a state machine, optional stage chains, role resolution, dependencies and hive leases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"CHANGELOG.md"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=22.19"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "node --test test/*.test.mjs",
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
"url": "https://github.com/d86e/hive-tasks/issues"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/d86e/hive-tasks#readme"
|
|
46
|
-
}
|
|
46
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -42,8 +42,7 @@ const USAGE = [
|
|
|
42
42
|
" hive-tasks plan --file plan.json create a whole DAG in one transaction",
|
|
43
43
|
" hive-tasks done <id> [--sha S] [--verdict pass|fail] [--verify]",
|
|
44
44
|
" hive-tasks fail <id> --reason R",
|
|
45
|
-
" hive-tasks retry <id> [--stage KEY]",
|
|
46
|
-
" hive-tasks block <id> --reason R | unblock <id>",
|
|
45
|
+
" hive-tasks retry <id> [--stage KEY] failed back to pending",
|
|
47
46
|
" hive-tasks reopen <id> [--reason R] [--agent A] [--stage KEY]",
|
|
48
47
|
" any state back to pending, attempt+1; a staged card",
|
|
49
48
|
" resets to KEY (default the first stage)",
|
|
@@ -493,7 +492,7 @@ function run(argv) {
|
|
|
493
492
|
return printTask(claimed, options.json);
|
|
494
493
|
}
|
|
495
494
|
|
|
496
|
-
if (command === "done" || command === "fail" || command === "retry"
|
|
495
|
+
if (command === "done" || command === "fail" || command === "retry") {
|
|
497
496
|
const id = options.args[0];
|
|
498
497
|
if (!id) fail(command + " needs a task id", 2);
|
|
499
498
|
const agent = options.agent || process.env.HIVE_AGENT || "unknown";
|
|
@@ -506,8 +505,7 @@ function run(argv) {
|
|
|
506
505
|
|
|
507
506
|
if ((command === "done" || command === "fail") && current.state !== "claimed") fail("task " + id + " is " + current.state + ", not claimed", 2);
|
|
508
507
|
if ((command === "done" || command === "fail") && isStaged(current) && current.stageState !== "claimed") fail("task " + id + " stage " + current.stage + " is " + current.stageState + ", not claimed", 2);
|
|
509
|
-
if (command === "retry" && current.state !== "failed"
|
|
510
|
-
if (command === "unblock" && current.state !== "blocked") fail("task " + id + " is " + current.state + ", not blocked", 2);
|
|
508
|
+
if (command === "retry" && current.state !== "failed") fail("task " + id + " is " + current.state + ", not failed", 2);
|
|
511
509
|
|
|
512
510
|
if (command === "done" && options.verify) {
|
|
513
511
|
const acceptance = isStaged(current) ? ((currentStage(current) || {}).acceptance || current.acceptance) : current.acceptance;
|
|
@@ -564,19 +562,6 @@ function run(argv) {
|
|
|
564
562
|
}
|
|
565
563
|
return { targetState: "failed", nextStage: null, patch: { owner: null, claimedUntil: null, reason: options.reason || null }, events: [] };
|
|
566
564
|
}
|
|
567
|
-
if (command === "block") {
|
|
568
|
-
if (isStaged(task)) {
|
|
569
|
-
const blocked = failStage(task, "blocked");
|
|
570
|
-
const events = blocked.rewound ? [{ kind: "stage_rewound", from: blocked.from, stage: blocked.to, attempt: (task.attempt || 0) + 1 }] : [];
|
|
571
|
-
return {
|
|
572
|
-
targetState: blocked.rewound ? "pending" : "blocked",
|
|
573
|
-
nextStage: null,
|
|
574
|
-
patch: { owner: null, claimedUntil: null, reason: options.reason || null, ...blocked.patch },
|
|
575
|
-
events,
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
return { targetState: "blocked", nextStage: null, patch: { owner: null, claimedUntil: null, reason: options.reason || null }, events: [] };
|
|
579
|
-
}
|
|
580
565
|
if (command === "retry") {
|
|
581
566
|
if (isStaged(task)) {
|
|
582
567
|
const reset = resetStage(task, target || task.stage);
|
|
@@ -584,11 +569,6 @@ function run(argv) {
|
|
|
584
569
|
}
|
|
585
570
|
return { targetState: "pending", nextStage: null, patch: { owner: null, claimedUntil: null, reason: options.reason || null }, events: [] };
|
|
586
571
|
}
|
|
587
|
-
// unblock
|
|
588
|
-
if (isStaged(task)) {
|
|
589
|
-
return { targetState: "pending", nextStage: null, patch: { owner: null, claimedUntil: null, reason: options.reason || null, ...stageStatePatch(task, "pending") }, events: [] };
|
|
590
|
-
}
|
|
591
|
-
return { targetState: "pending", nextStage: null, patch: { owner: null, claimedUntil: null, reason: options.reason || null }, events: [] };
|
|
592
572
|
}
|
|
593
573
|
|
|
594
574
|
// A review card that fails sends its upstream card back to pending, so a
|
package/src/role.js
CHANGED
|
@@ -9,7 +9,7 @@ import path from "node:path";
|
|
|
9
9
|
* 2. default the name is one of the built-in roles (adapter dsh, model null,
|
|
10
10
|
* prompt from .hive/roles/<name>.md when that file exists)
|
|
11
11
|
* 3. synthetic a generated generic contract for any other name, so a card is
|
|
12
|
-
* never
|
|
12
|
+
* never refused because the team has no role config for it
|
|
13
13
|
*
|
|
14
14
|
* The returned object shape is stable and is what the runner/supervisor should
|
|
15
15
|
* consume:
|
package/src/stage.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* null, and every legacy path behaves exactly as it did in 1.3.0.
|
|
6
6
|
*
|
|
7
7
|
* A stage stores its configuration (key, role, acceptance, onFail) plus its
|
|
8
|
-
* runtime state (pending, claimed, done, failed
|
|
8
|
+
* runtime state (pending, claimed, done, failed). The card records
|
|
9
9
|
* the current stage and its state in stage / stageState.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
export const STAGE_STATES = ["pending", "claimed", "done", "failed"
|
|
12
|
+
export const STAGE_STATES = ["pending", "claimed", "done", "failed"];
|
|
13
13
|
export const STAGE_KEY_RE = /^[a-z][a-z0-9-]{0,31}$/;
|
|
14
14
|
|
|
15
15
|
export function isStaged(task) {
|
|
@@ -149,7 +149,7 @@ export function stageView(task) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
/** Set the current stage's runtime state (claim, lease revert,
|
|
152
|
+
/** Set the current stage's runtime state (claim, lease revert, retry). */
|
|
153
153
|
export function stageStatePatch(task, state) {
|
|
154
154
|
if (!isStaged(task)) return {};
|
|
155
155
|
const index = stageIndex(task, task.stage);
|
|
@@ -183,7 +183,7 @@ export function advanceStage(task) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* Fail
|
|
186
|
+
* Fail the current stage. When the stage names an onFail target that
|
|
187
187
|
* is already done, the chain rewinds to it (target pending, later stages
|
|
188
188
|
* pending, attempt + 1) and the card stays runnable. Otherwise the whole card
|
|
189
189
|
* takes the failure state.
|
package/src/task.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import { initialStageFields, isStageReady } from "./stage.js";
|
|
3
3
|
|
|
4
|
-
export const STATES = ["pending", "claimed", "done", "failed"
|
|
4
|
+
export const STATES = ["pending", "claimed", "done", "failed"];
|
|
5
5
|
export const ROLES = ["coder", "tester", "reviewer", "researcher", "planner", "worker"];
|
|
6
6
|
|
|
7
7
|
export function slug(title) {
|