delegation-layer 0.1.30 → 0.1.37
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 +8 -0
- package/package.json +1 -1
- package/plugins/delegation-layer/.claude-plugin/plugin.json +1 -1
- package/plugins/delegation-layer/.codex-plugin/plugin.json +1 -1
- package/plugins/delegation-layer/skills/agent-integration/SKILL.md +31 -13
- package/plugins/delegation-layer/skills/agent-integration/examples/json-results.md +42 -0
- package/plugins/delegation-layer/skills/agent-integration/examples/managed-workspace.md +61 -0
- package/plugins/delegation-layer/skills/agent-integration/references/collaboration.md +16 -0
- package/plugins/delegation-layer/skills/agent-integration/references/command-reference.md +28 -4
- package/plugins/delegation-layer/skills/agent-integration/references/continuation.md +94 -5
- package/plugins/delegation-layer/skills/agent-integration/references/result-handling.md +67 -3
- package/plugins/delegation-layer/skills/agent-integration/references/workspaces.md +131 -5
- package/skills/agent-integration/SKILL.md +31 -13
- package/skills/agent-integration/examples/json-results.md +42 -0
- package/skills/agent-integration/examples/managed-workspace.md +61 -0
- package/skills/agent-integration/references/collaboration.md +16 -0
- package/skills/agent-integration/references/command-reference.md +28 -4
- package/skills/agent-integration/references/continuation.md +94 -5
- package/skills/agent-integration/references/result-handling.md +67 -3
- package/skills/agent-integration/references/workspaces.md +131 -5
package/README.md
CHANGED
|
@@ -301,6 +301,14 @@ reference](skills/agent-integration/references/workspaces.md) for attachment,
|
|
|
301
301
|
continuation, verification, review scope, release, and forgetting. This
|
|
302
302
|
feature does not automatically apply, commit, branch, or merge worker changes.
|
|
303
303
|
|
|
304
|
+
To fork a worker from current uncommitted work, first record a Git checkpoint
|
|
305
|
+
with `delegate checkpoint create --cwd ABS` (or `--workspace ID`). It stores a
|
|
306
|
+
synthetic commit under a Delegate-owned ref without moving `HEAD` or touching
|
|
307
|
+
the real index. After `checkpoint status` reports it `checkpointed` and
|
|
308
|
+
`usable`, pass its commit to `dispatch --isolation git-worktree --base`.
|
|
309
|
+
Checkpoints stay until `checkpoint remove`; see the [checkpoint
|
|
310
|
+
guidance](skills/agent-integration/references/workspaces.md#git-checkpoints).
|
|
311
|
+
|
|
304
312
|
## Documentation
|
|
305
313
|
|
|
306
314
|
- [Getting started](docs/getting-started.md) — install and run a first task.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "delegation-layer",
|
|
3
3
|
"displayName": "Delegation Layer",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.37",
|
|
5
5
|
"description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hesham Karam",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "delegation-layer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hesham Karam",
|
|
@@ -112,7 +112,13 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
|
|
|
112
112
|
output as an answer.
|
|
113
113
|
7. If a task is timed out and its JSON says `continuation.resumable: true`, use
|
|
114
114
|
`continue --task TASK_ID`, optionally with a new `--brief`. Do not create a
|
|
115
|
-
fresh unrelated dispatch to replace a resumable task.
|
|
115
|
+
fresh unrelated dispatch to replace a resumable task. The one other automatic
|
|
116
|
+
route is an `interrupted` task from `status` or `collect`, and only when
|
|
117
|
+
`failure.code` is `"task_interrupted"`, `failure.next_action` is
|
|
118
|
+
`"continue_task"`, and `continuation.resumable` is `true`; see
|
|
119
|
+
[interrupted turn](references/continuation.md#interrupted-turn). A
|
|
120
|
+
cancellation, `stop_and_report`, or failed admission always takes precedence
|
|
121
|
+
over `resumable: true`.
|
|
116
122
|
8. Treat `blocked` authentication as unresolved. Do not call it compatible,
|
|
117
123
|
successful, or failed provider behavior, and do not invent login commands.
|
|
118
124
|
9. Never put credentials, tokens, or unrestricted provider output in a brief,
|
|
@@ -127,7 +133,12 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
|
|
|
127
133
|
or provider comparison. For independent parallel writes, choose
|
|
128
134
|
`--isolation git-worktree` automatically unless the user explicitly chooses
|
|
129
135
|
shared coordination; the model chooses fan-out and task scope. A read-only
|
|
130
|
-
review may attach a retained workspace with `--workspace ID`.
|
|
136
|
+
review may attach a retained workspace with `--workspace ID`. To fork a
|
|
137
|
+
worker from current uncommitted content, follow
|
|
138
|
+
[checkpoint before fork](references/workspaces.md#checkpoint-before-fork):
|
|
139
|
+
fork only from a `checkpointed`, `usable` checkpoint commit. If your own
|
|
140
|
+
turn holds the workspace, do not wait or retry through `--cwd`; report so
|
|
141
|
+
the Lead checkpoints after your turn closes.
|
|
131
142
|
|
|
132
143
|
For an explicit Codex code review, use the discoverable `codex:review` profile
|
|
133
144
|
with one persisted target: `--review-target uncommitted`,
|
|
@@ -321,8 +332,8 @@ delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" status TASK_ID --json
|
|
|
321
332
|
delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" collect TASK_ID --watch 5s --json
|
|
322
333
|
```
|
|
323
334
|
|
|
324
|
-
Check `status` first: if it is `timed_out`, follow step 6 even
|
|
325
|
-
is pending and no outcome is present. If `interaction.pending_requests` is
|
|
335
|
+
Check `status` first: if it is `timed_out` or `interrupted`, follow step 6 even
|
|
336
|
+
when publication is pending or unknown and no outcome is present. If `interaction.pending_requests` is
|
|
326
337
|
nonempty and the interaction is not closed, answer the questions using
|
|
327
338
|
[active-task interaction](references/interaction.md) before collecting again.
|
|
328
339
|
Otherwise, if `collect` exits with code `3` because publication is still
|
|
@@ -336,14 +347,19 @@ is committed. A rejected outcome is terminal evidence and must be reported as
|
|
|
336
347
|
rejected. Payload and raw output are returned as validated descriptors; do not
|
|
337
348
|
copy unrestricted provider output into the control response.
|
|
338
349
|
|
|
339
|
-
### 6. Continue a timed out turn
|
|
350
|
+
### 6. Continue a timed out or interrupted turn
|
|
340
351
|
|
|
341
|
-
When `status` or `collect` reports `timed_out`, read
|
|
342
|
-
[continuation and timeout recovery](references/continuation.md).
|
|
343
|
-
`
|
|
344
|
-
|
|
352
|
+
When `status` or `collect` reports `timed_out` or `interrupted`, read
|
|
353
|
+
[continuation and timeout recovery](references/continuation.md). Unless a
|
|
354
|
+
cancellation or `stop_and_report` applies, a `timed_out` task with
|
|
355
|
+
`continuation.resumable: true` may use `continue --task TASK_ID`. An
|
|
356
|
+
`interrupted` task may use it only under all three conditions in rule 7;
|
|
357
|
+
otherwise report it. When continuing, use the original state root and a finite
|
|
358
|
+
budget, then observe the returned successor ID. Do not
|
|
345
359
|
wait indefinitely for pending publication or restart the task as an unrelated
|
|
346
|
-
dispatch. If continuation is unavailable, report its reason
|
|
360
|
+
dispatch. If continuation is unavailable, report its reason, except the busy
|
|
361
|
+
managed-workspace case in [continuation and timeout
|
|
362
|
+
recovery](references/continuation.md). Apply the same
|
|
347
363
|
`failure` and `task_record` decisions as for dispatch; never repeat an uncertain
|
|
348
364
|
successor creation.
|
|
349
365
|
|
|
@@ -365,10 +381,12 @@ recruit more agents unless that is explicitly part of the task.
|
|
|
365
381
|
model/effort options or another public command.
|
|
366
382
|
- Read [result handling](references/result-handling.md) when interpreting
|
|
367
383
|
admission, publication, authentication, errors, or exit codes.
|
|
368
|
-
- Read [continuation](references/continuation.md) for timeout
|
|
369
|
-
exact-session follow-up.
|
|
384
|
+
- Read [continuation](references/continuation.md) for timeout or interruption
|
|
385
|
+
recovery or an exact-session follow-up.
|
|
370
386
|
- Read [managed workspaces](references/workspaces.md) for optional Git
|
|
371
|
-
worktrees, capture, review scope, release, and forgetting
|
|
387
|
+
worktrees, capture, review scope, release, and forgetting, and
|
|
388
|
+
[Git checkpoints](references/workspaces.md#git-checkpoints) before creating,
|
|
389
|
+
observing, forking from, or removing a checkpoint.
|
|
372
390
|
- Use [read-only example](examples/read-only-task.md),
|
|
373
391
|
[write example](examples/workspace-write-task.md),
|
|
374
392
|
[JSON examples](examples/json-results.md), and
|
|
@@ -11,3 +11,45 @@ own the decision order for task creation, failures, timeout continuation,
|
|
|
11
11
|
terminal outcomes, pending interaction, and bounded collection. Read them
|
|
12
12
|
before interpreting these commands; pending publication alone is not a reason
|
|
13
13
|
to wait when the task needs an answer or timeout recovery.
|
|
14
|
+
|
|
15
|
+
## Checkpoint responses
|
|
16
|
+
|
|
17
|
+
These abbreviated shapes use the delivered field names; `…` marks omitted
|
|
18
|
+
values. Apply [checkpoint results](../references/result-handling.md#checkpoint-results)
|
|
19
|
+
to the whole response and its exit code.
|
|
20
|
+
|
|
21
|
+
Accepted creation, exit `3`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{"schema_version":1,"command":"checkpoint","root_id":"…","admission":"unknown","liveness":"undetermined","publication":"unknown",
|
|
25
|
+
"checkpoint":{"id":"CHECKPOINT_ID","next_action":"watch_checkpoint"}}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Busy refusal, exit `3`, with no accepted ID:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{"checkpoint":{"reason_code":"requested_action_not_authorized","next_action":"retry_create"}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Qualified checkpoint from `status`, exit `0`; only this state may be forked:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{"checkpoint":{"id":"CHECKPOINT_ID","current":{"id":"CHECKPOINT_ID","selection":"ordinary","cwd":"/abs/source",
|
|
38
|
+
"state":"checkpointed","snapshot_ref":"refs/delegate/ROOT_ID/checkpoints/CHECKPOINT_ID","commit_oid":"…","usable":true}}}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Exact removal attempt from `status CHECKPOINT_ID --operation OPERATION_ID`,
|
|
42
|
+
exit `0`. Creation history stays `checkpointed`, but `usable` is now `false`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{"checkpoint":{"id":"CHECKPOINT_ID","operation_id":"OPERATION_ID",
|
|
46
|
+
"current":{"id":"CHECKPOINT_ID","selection":"ordinary","state":"checkpointed","usable":false,
|
|
47
|
+
"removal":{"operation_id":"OPERATION_ID","attempts":1,"state":"removed"}},
|
|
48
|
+
"operation":{"operation_id":"OPERATION_ID","attempts":1,"state":"removed"}}}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
An empty `list` page, exit `0`, still has the array:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{"schema_version":1,"command":"checkpoint","root_id":"…","admission":"unknown","liveness":"undetermined","publication":"unknown","checkpoints":[]}
|
|
55
|
+
```
|
|
@@ -66,3 +66,64 @@ Save each response and exit code once. A created task is observed with
|
|
|
66
66
|
success; continue observing the same task. The Lead reviews the capture and
|
|
67
67
|
owns landing any changes. `workspace release` is explicit; no automatic
|
|
68
68
|
apply, commit, branch merge, TTL eviction, or provider-CLI fallback occurs.
|
|
69
|
+
|
|
70
|
+
## Fork from a checkpoint
|
|
71
|
+
|
|
72
|
+
Use this sequence when the worker must start from current uncommitted content
|
|
73
|
+
instead of a committed base. Run it from the Lead, not from inside a worker
|
|
74
|
+
that uses the same workspace. The [checkpoint guidance](../references/workspaces.md#checkpoint-before-fork)
|
|
75
|
+
owns the rules; [checkpoint results](../references/result-handling.md#checkpoint-results)
|
|
76
|
+
owns every response decision.
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
SOURCE="$PWD"
|
|
80
|
+
RESPONSE="$(mktemp)"
|
|
81
|
+
if delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" checkpoint create \
|
|
82
|
+
--cwd "$SOURCE" --budget 5m --json >"$RESPONSE.checkpoint"; then
|
|
83
|
+
checkpoint_exit=0
|
|
84
|
+
else
|
|
85
|
+
checkpoint_exit=$?
|
|
86
|
+
fi
|
|
87
|
+
printf '%s\n' "$checkpoint_exit" >"$RESPONSE.checkpoint.exit"
|
|
88
|
+
cat "$RESPONSE.checkpoint"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Exit `3` with `checkpoint.id` and `next_action: "watch_checkpoint"` means the
|
|
92
|
+
request was accepted, not captured. Use that `checkpoint.id` as
|
|
93
|
+
`CHECKPOINT_ID`. Do not run `create` again.
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
if delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" checkpoint status CHECKPOINT_ID \
|
|
97
|
+
--watch 30s --json >"$RESPONSE.checkpoint.status"; then
|
|
98
|
+
checkpoint_status_exit=0
|
|
99
|
+
else
|
|
100
|
+
checkpoint_status_exit=$?
|
|
101
|
+
fi
|
|
102
|
+
printf '%s\n' "$checkpoint_status_exit" >"$RESPONSE.checkpoint.status.exit"
|
|
103
|
+
cat "$RESPONSE.checkpoint.status"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Repeat that status command while it exits `3`. Fork only when it exits `0`,
|
|
107
|
+
`checkpoint.current.state` is `checkpointed`, and `checkpoint.current.usable`
|
|
108
|
+
is `true`. Use `checkpoint.current.commit_oid` as `COMMIT_OID` in the first
|
|
109
|
+
dispatch example, replacing `--base HEAD` with `--base COMMIT_OID`. Report a
|
|
110
|
+
`stop_and_report` result instead of forking.
|
|
111
|
+
|
|
112
|
+
When the Lead no longer needs the checkpoint, remove it explicitly:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
if delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" checkpoint remove CHECKPOINT_ID \
|
|
116
|
+
--budget 5m --json >"$RESPONSE.checkpoint.remove"; then
|
|
117
|
+
checkpoint_remove_exit=0
|
|
118
|
+
else
|
|
119
|
+
checkpoint_remove_exit=$?
|
|
120
|
+
fi
|
|
121
|
+
printf '%s\n' "$checkpoint_remove_exit" >"$RESPONSE.checkpoint.remove.exit"
|
|
122
|
+
cat "$RESPONSE.checkpoint.remove"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Exit `3` with `checkpoint.operation_id` and `watch_checkpoint` means removal
|
|
126
|
+
attempt `OPERATION_ID` was accepted. Observe that exact attempt with
|
|
127
|
+
`checkpoint status CHECKPOINT_ID --operation OPERATION_ID --watch 30s --json`,
|
|
128
|
+
saving its response and exit the same way. A `retry_remove` response has no
|
|
129
|
+
`operation_id` and accepted nothing.
|
|
@@ -8,6 +8,22 @@ cap or TTL eviction. A read-only review may attach a retained workspace with
|
|
|
8
8
|
release rules live in [managed workspace guidance](workspaces.md); do not
|
|
9
9
|
restate them in each collaboration brief.
|
|
10
10
|
|
|
11
|
+
Give each participant a bounded deliverable, explicit write ownership, and the
|
|
12
|
+
inputs it depends on. Run independent assignments in parallel; dependent work
|
|
13
|
+
begins only after the required results are collected and any prerequisite
|
|
14
|
+
changes are applied and verified in the consuming worker's workspace, without
|
|
15
|
+
requiring a merge. Combine the relevant completed results in the verification
|
|
16
|
+
workspace before running checks that depend on their interaction. A worker's
|
|
17
|
+
terminal outcome establishes that assignment's result, not completion of the
|
|
18
|
+
user's full objective; keep remaining integration, verification and unresolved
|
|
19
|
+
work explicit.
|
|
20
|
+
|
|
21
|
+
When a participant must start from the Lead's current uncommitted work, the
|
|
22
|
+
Lead checkpoints that content first and forks each worker from the qualified
|
|
23
|
+
checkpoint commit with `--base`. Follow
|
|
24
|
+
[checkpoint before fork](workspaces.md#checkpoint-before-fork); a worker never
|
|
25
|
+
checkpoints a workspace its own turn is using.
|
|
26
|
+
|
|
11
27
|
## Keep each request identifiable
|
|
12
28
|
|
|
13
29
|
Choose the fan-out needed for the user's task. Each participant needs its own
|
|
@@ -6,7 +6,8 @@ All paths passed to `--root`, `--cwd`, and `--brief` must be absolute. Add
|
|
|
6
6
|
Pass the intended workspace directly. Delegate handles provider launch options;
|
|
7
7
|
do not initialize Git, change trust settings, or call a provider CLI as a
|
|
8
8
|
workspace workaround. Ordinary tasks support non-Git directories. Git is
|
|
9
|
-
required for managed worktree creation/attachment
|
|
9
|
+
required for managed worktree creation/attachment and checkpoint creation or
|
|
10
|
+
removal only; native review retains
|
|
10
11
|
its separate explicit review-target contract. See [managed workspace guidance](workspaces.md)
|
|
11
12
|
for the policy owner.
|
|
12
13
|
|
|
@@ -52,8 +53,8 @@ Dispatch flags:
|
|
|
52
53
|
- `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
|
|
53
54
|
Codex maps effort to TOML `model_reasoning_effort` for ordinary turns or a native
|
|
54
55
|
turn parameter for interactive turns, while Claude and AGY
|
|
55
|
-
pass native effort flags; Pi maps effort to `--thinking`; OpenCode
|
|
56
|
-
|
|
56
|
+
pass native effort flags; Pi maps effort to `--thinking`; OpenCode sends model
|
|
57
|
+
and effort as acknowledged ACP session options; CCR forwards effort to Claude and uses `--model` as a CCR alias; `default` is omitted;
|
|
57
58
|
- `--interactive`: enable advertised native clarification and steering; see [interaction](interaction.md);
|
|
58
59
|
- `--native-timeout DURATION`: optional provider-native timeout where advertised.
|
|
59
60
|
|
|
@@ -101,6 +102,27 @@ Continuation flags:
|
|
|
101
102
|
- `--budget DURATION`, `--model MODEL`, and `--effort VALUE`: optional overrides;
|
|
102
103
|
- `--interactive`: enable interaction when supported; already-interactive predecessors keep it.
|
|
103
104
|
|
|
105
|
+
## Checkpoint commands
|
|
106
|
+
|
|
107
|
+
Git checkpoints are optional and launch no provider work. Use them to fork a
|
|
108
|
+
worker from current uncommitted content; the canonical
|
|
109
|
+
[checkpoint guidance](workspaces.md#git-checkpoints) owns targets, limits, and
|
|
110
|
+
the checkpoint-before-fork sequence, and
|
|
111
|
+
[checkpoint results](result-handling.md#checkpoint-results) owns the decisions.
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
delegate --root ROOT checkpoint create --cwd ABS [--budget DURATION] --json
|
|
115
|
+
delegate --root ROOT checkpoint create --workspace ID [--budget DURATION] --json
|
|
116
|
+
delegate --root ROOT checkpoint status CHECKPOINT_ID [--operation OP] [--watch DURATION] --json
|
|
117
|
+
delegate --root ROOT checkpoint list [--after CHECKPOINT_ID] [--limit 1..50] --json
|
|
118
|
+
delegate --root ROOT checkpoint remove CHECKPOINT_ID [--budget DURATION] --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`create` takes exactly one of `--cwd` or `--workspace`. `--operation` selects a
|
|
122
|
+
removal attempt ID returned by `remove`; without it, `status` observes the
|
|
123
|
+
creation and its latest removal. `list` pages with the returned
|
|
124
|
+
`checkpoint_cursor` as `--after`.
|
|
125
|
+
|
|
104
126
|
## Choosing models and effort
|
|
105
127
|
|
|
106
128
|
Pass an explicitly supplied model ID and effort unchanged, even if discovery
|
|
@@ -135,7 +157,9 @@ enumeration, not effort metadata. `null` means effort metadata is unknown;
|
|
|
135
157
|
`[]` means the provider explicitly reported no choices. Discovery exits `0`
|
|
136
158
|
for `available` or `partial`, `2` for `blocked` or `unavailable`, and `1` for
|
|
137
159
|
`failed`. Preserve a blocked or unavailable discovery result as unresolved;
|
|
138
|
-
defaults remain allowed.
|
|
160
|
+
defaults remain allowed. An operational discovery failure also includes an
|
|
161
|
+
optional `failure` object and a fixed `error` message; keep both fields and
|
|
162
|
+
follow `failure.next_action`.
|
|
139
163
|
|
|
140
164
|
## Checking readiness
|
|
141
165
|
|
|
@@ -53,6 +53,42 @@ Then retry the exact `continue --task PREDECESSOR_ID` after it becomes retained.
|
|
|
53
53
|
Keep the original predecessor, brief, and budget; do not replace continuation
|
|
54
54
|
with a fresh dispatch. A created successor is only observed.
|
|
55
55
|
|
|
56
|
+
**Busy managed workspace after a timeout.** This is the only case where an
|
|
57
|
+
unavailable continuation may be waited for instead of reported. It applies
|
|
58
|
+
only when a `timed_out` task reports all of `continuation.resumable: false`,
|
|
59
|
+
`continuation.reason` exactly `"managed workspace is busy"`,
|
|
60
|
+
`workspace.state: "busy"`, and `workspace.next_action: "watch_workspace"`.
|
|
61
|
+
Another reservation may still hold the workspace; do not infer which use. Wait
|
|
62
|
+
only when further work needs to continue this task, and return a committed
|
|
63
|
+
result normally. Do not wait when a cancellation (`failure.code:
|
|
64
|
+
"task_cancelled"`), a concrete fault, or `stop_and_report` applies to the task
|
|
65
|
+
or the workspace. If a successor from this predecessor was already created,
|
|
66
|
+
observe that successor instead; if its creation is uncertain, follow the
|
|
67
|
+
`task_record` stop rule in [result handling](result-handling.md).
|
|
68
|
+
|
|
69
|
+
1. Watch the workspace with the same root and a finite duration, using
|
|
70
|
+
`workspace.id` from the task response; never guess an ID or path:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
delegate --root "${DELEGATE_ROOT:-$HOME/delegation-state}" workspace status \
|
|
74
|
+
WORKSPACE_ID --watch 30s --json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Repeat the watch only while it reports `state: "busy"`.
|
|
78
|
+
2. When it reports `state: "retained"`, run a fresh `status` for the same
|
|
79
|
+
predecessor task ID.
|
|
80
|
+
3. Only if that status now reports `continuation.resumable: true` and the task
|
|
81
|
+
rules above still permit it, run the exact `continue --task PREDECESSOR_ID`
|
|
82
|
+
once. Otherwise report its reason and stop.
|
|
83
|
+
|
|
84
|
+
Never run `continue` while `resumable` is `false`. Report any other reason,
|
|
85
|
+
workspace state, or fault under the existing guidance; do not reactivate a
|
|
86
|
+
`released` or `forgotten` workspace. An `undetermined` workspace view is
|
|
87
|
+
unobserved and follows [managed workspace results](result-handling.md#managed-workspace-results);
|
|
88
|
+
it is neither a terminal failure nor permission to continue. Do not dispatch,
|
|
89
|
+
fall back to another provider, repair the environment, or mutate the workspace
|
|
90
|
+
to free it. Availability is not guaranteed; do not wait indefinitely.
|
|
91
|
+
|
|
56
92
|
`mode` describes the provider contract:
|
|
57
93
|
|
|
58
94
|
- `native` uses the provider’s exact persisted conversation/session ID;
|
|
@@ -61,11 +97,14 @@ with a fresh dispatch. A created successor is only observed.
|
|
|
61
97
|
- `unsupported` cannot be continued safely.
|
|
62
98
|
|
|
63
99
|
Do not use a guessed session ID, a provider-specific resume command, or a new
|
|
64
|
-
independent dispatch to recover a timeout. The CLI accepts
|
|
65
|
-
terminal outcome
|
|
66
|
-
lifetime-termination record with independently proven empty scope
|
|
67
|
-
|
|
68
|
-
|
|
100
|
+
independent dispatch to recover a timeout. The CLI accepts a validated
|
|
101
|
+
terminal outcome, a durable Pueue-ended budget stop backed by a guardian
|
|
102
|
+
lifetime-termination record with independently proven empty scope, or canonical
|
|
103
|
+
closed lifetime evidence of any closure kind together with a free runner lease
|
|
104
|
+
for a turn with no seal or outcome. A sealed predecessor must be collected
|
|
105
|
+
first. A queue-row end or a timestamp alone never qualifies; without one of those
|
|
106
|
+
proofs it refuses continuation. Inspect the predecessor again rather than
|
|
107
|
+
bypassing that boundary.
|
|
69
108
|
|
|
70
109
|
For a managed workspace timeout, capture is a new finite auxiliary operation
|
|
71
110
|
after canonical closure. The normal path proves the provider scope empty and
|
|
@@ -76,6 +115,56 @@ unavailable capture can still preserve continuation evidence; it does not
|
|
|
76
115
|
change the provider outcome.
|
|
77
116
|
|
|
78
117
|
|
|
118
|
+
## Interrupted turn
|
|
119
|
+
|
|
120
|
+
A host restart can end a provider turn before it publishes anything. Delegate
|
|
121
|
+
reports an interruption only when the task's stored publication state is still
|
|
122
|
+
unknown, with no provider exit or outcome, its canonical lifetime closure is
|
|
123
|
+
proven, and its runner lease is released. A terminated budget stop is checked
|
|
124
|
+
first and reports `timed_out` instead, as does a closure whose recorded
|
|
125
|
+
termination cause is the budget. Closure proves only that the provider
|
|
126
|
+
scope is gone; it is not provider success, and no answer or output from that
|
|
127
|
+
turn is accepted. Do not check these facts yourself or infer eligibility from
|
|
128
|
+
missing files: obey the returned `status`, `failure`, `continuation`, and
|
|
129
|
+
`pending` fields. For an eligible task, after real outcomes and concrete errors
|
|
130
|
+
are checked, `status` and `collect` report `status: "interrupted"` with
|
|
131
|
+
`publication: "unknown"`, no `outcome`, and
|
|
132
|
+
`failure.code: "task_interrupted"`. `status` exits `0`; `collect` exits `1`.
|
|
133
|
+
An interruption may also carry `pending.kind: "supervisor-command"`; that
|
|
134
|
+
independent observation means only that a supervisor command has not
|
|
135
|
+
finished, so follow the interruption's `failure` and `continuation` as usual.
|
|
136
|
+
Do not infer an interruption from `publication: "unknown"` alone: a response
|
|
137
|
+
with `pending.kind: "publication"` is still pending publication and carries no
|
|
138
|
+
interrupted resume offer, so handle it as pending under
|
|
139
|
+
[result handling](result-handling.md). Outcomes, `timed_out`, interaction,
|
|
140
|
+
`lifetime-finalization`, and ordinary pending exit `3` keep their meaning.
|
|
141
|
+
|
|
142
|
+
| Response | Action |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `failure.code: "task_interrupted"`, `failure.next_action: "continue_task"`, and `continuation.resumable: true` (all three) | Run the `continue` above for that predecessor with the original root and a finite budget, then observe the successor. |
|
|
145
|
+
| `interrupted` with any other combination, including `failure.next_action: "stop_and_report"` or `continuation.resumable: false` | Report the reason and stop. |
|
|
146
|
+
| `timed_out` with `failure.code: "task_cancelled"` (user stop and budget stop, no outcome) | `stop_and_report`; `continuation.resumable` is `false` and no `continue_command` is returned. Report it. `collect` exit `3` here is a finite watch, not success and not a reason to keep waiting. |
|
|
147
|
+
| Any other operational error | It is not an interruption; apply [result handling](result-handling.md). |
|
|
148
|
+
|
|
149
|
+
`continuation.resumable: true` alone never revives an attempt that returned
|
|
150
|
+
`stop_and_report`, and a failed admission keeps its `task_record` rules.
|
|
151
|
+
Never continue a cancelled task automatically or start a fresh provider
|
|
152
|
+
fallback. A user stop keeps `interrupted` / `task_interrupted` for a closed
|
|
153
|
+
interrupted task, now with `stop_and_report` and `resumable: false`. A
|
|
154
|
+
committed or rejected outcome stays authoritative and is never replaced by
|
|
155
|
+
`task_cancelled`. A later, explicit user request to `continue` is a separate
|
|
156
|
+
action and still validated against real closure and the recorded session.
|
|
157
|
+
|
|
158
|
+
The successor uses the predecessor's observed provider session from
|
|
159
|
+
`provider.ref`. Only when `provider.ref` is genuinely absent, for any eligible
|
|
160
|
+
predecessor and not only an interrupted one, does `continue` fall back to the
|
|
161
|
+
validated immutable session that turn was asked to resume. The response reports
|
|
162
|
+
the source in `continuation.session_source`: `observed` means `provider.ref`
|
|
163
|
+
supplied the identity, and `recorded_input` means the requested session supplied
|
|
164
|
+
it. Neither value is evidence the provider saved any message or resumed
|
|
165
|
+
successfully. A missing task reference, or an unreadable, malformed, or mismatched
|
|
166
|
+
record, refuses. Never search ancestors or rerun the original task.
|
|
167
|
+
|
|
79
168
|
## Follow up after normal completion
|
|
80
169
|
|
|
81
170
|
A validated terminal outcome, committed or rejected, can also support a new
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Use the response fields independently. A successful control command is not
|
|
4
4
|
the same as a successful provider result.
|
|
5
5
|
|
|
6
|
-
1. Save `task_id` immediately after dispatch or continue.
|
|
6
|
+
1. Save `task_id` immediately after dispatch or continue. It is the durable
|
|
7
|
+
Delegate identity. `supervisor.numeric_task_id` and a stop's
|
|
8
|
+
`numeric_task_id` are private, ephemeral queue addresses. The queue can
|
|
9
|
+
reuse a number for a later task, so a repeated number is not a binding
|
|
10
|
+
error; never use it as a task handle.
|
|
7
11
|
2. For a dispatch or continue error, inspect `task_record` first. When it is
|
|
8
12
|
`created`, observe the returned ID with `status`. Before applying the generic
|
|
9
13
|
`not_created` stop rule, handle the sole migration exception: when
|
|
@@ -24,7 +28,13 @@ the same as a successful provider result.
|
|
|
24
28
|
evidence for an existing task.
|
|
25
29
|
3. If `status` is `timed_out`, follow the continuation procedure before treating
|
|
26
30
|
pending publication as a reason to wait. `continuation.resumable: true`
|
|
27
|
-
permits a linked successor even when no outcome has been published.
|
|
31
|
+
permits a linked successor even when no outcome has been published. An
|
|
32
|
+
`interrupted` task (`failure.code: "task_interrupted"`) follows the table in
|
|
33
|
+
[interrupted turn](continuation.md#interrupted-turn): continue only when
|
|
34
|
+
`failure.next_action` is `continue_task` and `continuation.resumable` is
|
|
35
|
+
`true`, otherwise report it. A `timed_out` task whose `failure.code` is
|
|
36
|
+
`task_cancelled` is `stop_and_report`: report it and stop, even though
|
|
37
|
+
`collect` exits `3`; that exit is not success.
|
|
28
38
|
4. If `publication` is committed and `outcome.verdict` is committed, return
|
|
29
39
|
the result and its payload/evidence descriptors.
|
|
30
40
|
5. If `outcome.verdict` is rejected and `failure.next_action` is `recheck`,
|
|
@@ -51,7 +61,13 @@ from an inspection-worker or supervisor-observation failure.
|
|
|
51
61
|
For `delegate models`, validate the complete JSON envelope before using any
|
|
52
62
|
fact. Treat `available` and `partial` with exit `0` as observations, preserve
|
|
53
63
|
`blocked` and `unavailable` with exit `2` as unresolved prerequisites, and
|
|
54
|
-
preserve `failed`
|
|
64
|
+
preserve `failed` as a discovery failure. Exit `1` with `failed` is an
|
|
65
|
+
operational failure; exit `2` with `failed` is an invalid or unsupported
|
|
66
|
+
request, not an authentication block. Status and exit are separate
|
|
67
|
+
observations. When the response
|
|
68
|
+
includes the optional `failure` object and `error` message, keep both in the
|
|
69
|
+
report and follow `failure.next_action`; report and stop on
|
|
70
|
+
`stop_and_report`. `complete` refers to
|
|
55
71
|
model enumeration. Keep `efforts: null` distinct from `efforts: []`, and do not
|
|
56
72
|
apply harness-wide effort choices to every model. Discovery is advisory and
|
|
57
73
|
never an admission allowlist; a provider default remains valid and a listed
|
|
@@ -79,6 +95,18 @@ The provider outcome is immutable and the workspace `CaptureReceipt` is a
|
|
|
79
95
|
separate immutable fact; a failed or unavailable capture must not be reported
|
|
80
96
|
as a provider failure when native closure is already proven.
|
|
81
97
|
|
|
98
|
+
In task `status` or `collect`, a workspace with `state: "undetermined"`,
|
|
99
|
+
`evidence_state: "unknown"`, and `next_action: "watch_workspace"` means that
|
|
100
|
+
observer's bounded view expired before it read the workspace. It is an
|
|
101
|
+
unobserved view only. It does not imply corruption, change the task fields, or
|
|
102
|
+
revoke an eligible continuation, and it does not turn a committed task into a
|
|
103
|
+
failure. Follow the task fields above: return a committed result, handle a
|
|
104
|
+
rejection using its reported guidance, and keep observing only while the task
|
|
105
|
+
fields are pending. When useful, watch the same workspace with the same root.
|
|
106
|
+
Do not dispatch again, retry the provider, fall back to another integration,
|
|
107
|
+
or repair the environment because of it. A workspace view with `stop_and_report` remains a
|
|
108
|
+
concrete failure to report.
|
|
109
|
+
|
|
82
110
|
Before a task record exists, a pending workspace provision returns
|
|
83
111
|
`task_record: "not_created"` with
|
|
84
112
|
`failure.code: "workspace_provision_pending"` and
|
|
@@ -112,6 +140,42 @@ Lead has terminal task/capture evidence and explicitly releases it. Read
|
|
|
112
140
|
[managed workspace guidance](workspaces.md) for the exact command surface and
|
|
113
141
|
review/capture/forgetting boundaries.
|
|
114
142
|
|
|
143
|
+
## Checkpoint results
|
|
144
|
+
|
|
145
|
+
A `checkpoint` response has `command: "checkpoint"` and no `task_id` or
|
|
146
|
+
`outcome`. A checkpoint receipt is Git-content evidence; it never replaces a
|
|
147
|
+
provider outcome, and a provider outcome never proves a checkpoint. Read
|
|
148
|
+
`checkpoint.id`, `checkpoint.operation_id`, `checkpoint.current`,
|
|
149
|
+
`checkpoint.operation`, `checkpoint.reason_code`, `checkpoint.next_action`, and
|
|
150
|
+
`error` separately, together with the exit code. Exit `0` alone is not enough.
|
|
151
|
+
|
|
152
|
+
| Command and response | Meaning and next action |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| `create`: exit `3`, `id` C, `next_action: "watch_checkpoint"` | Accepted, not yet captured. Watch `status C`; never repeat `create`. |
|
|
155
|
+
| `create`: exit `3`, `requested_action_not_authorized`, `retry_create`, no `id` | Busy refusal; nothing was accepted. Apply the [busy rule](workspaces.md#checkpoint-before-fork). Never wait for your own turn or switch to `--cwd`. |
|
|
156
|
+
| `remove C`: exit `3`, `id` C, `operation_id` R, `watch_checkpoint` | Removal attempt R is accepted. Watch `status C --operation R`; never repeat `remove` to observe it. |
|
|
157
|
+
| `remove C`: exit `3`, `requested_action_not_authorized`, `retry_remove`, no `operation_id` | Not accepted, usually because creation is still pending. The `id` in your command is not a removal ID. Watch `status C` until it settles, then retry `remove C` once. |
|
|
158
|
+
| `remove C`: exit `0` with `operation_id` R | R already succeeded. No new attempt was registered. |
|
|
159
|
+
| `status C`: exit `0` | Successful observation. Fork only when `current.state` is `checkpointed` and `current.usable` is `true`. With `next_action: "stop_and_report"`, report the unavailable creation or latest removal; do not fork. |
|
|
160
|
+
| `status C`: exit `3`, `watch_checkpoint` | Creation or latest removal is still pending. Keep watching the same C. |
|
|
161
|
+
| `status C --operation R`: exit `0`, `1`, or `3` | R's own result: `removed` or `nothing_to_remove` is `0`; `unavailable` is `1` with `stop_and_report`; pending is `3`. A newer attempt in `current.removal` never replaces R's outcome. Keep watching R, not the newer head. |
|
|
162
|
+
| `list`: exit `0` | One metadata page. Entries may be pending, unavailable, or removed. Run `status C` for a reconciled verdict. |
|
|
163
|
+
| Exit `1` with `stop_and_report` | Concrete failure. Report `error` and every ID already returned; do not repeat the mutation. |
|
|
164
|
+
| Exit `2` | Invalid request. Parse errors print usage on stderr without guaranteed JSON; correct the request. |
|
|
165
|
+
|
|
166
|
+
Take `C` only from `checkpoint.id` and `R` only from `checkpoint.operation_id`
|
|
167
|
+
of a response that returned them. Never invent an operation ID or reuse a
|
|
168
|
+
creation ID as `--operation`. Returned IDs stay valid after a later read
|
|
169
|
+
fault; an unreadable `current` or `operation` is omitted rather than shown as
|
|
170
|
+
empty availability.
|
|
171
|
+
|
|
172
|
+
`status --watch` repeats the same observation of the same IDs until a settled
|
|
173
|
+
or failed result or the bound ends. It never begins another action, renews a
|
|
174
|
+
helper deadline, or cancels accepted work. The latest observation chooses the
|
|
175
|
+
exit. A watch that ends at exit `3` means keep observing; it is not a failure.
|
|
176
|
+
If writing the response itself fails (exit `1`), accepted work stays accepted;
|
|
177
|
+
observe it with `status` instead of repeating the mutation.
|
|
178
|
+
|
|
115
179
|
## Offline recovery
|
|
116
180
|
|
|
117
181
|
When Delegate returns `failure.next_action: "recheck"`, use the same root and
|