delegation-layer 0.1.37 → 0.1.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Multi-provider AI agent delegation CLI and Agent Skill for running bounded coding tasks across provider CLIs.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
3
  "displayName": "Delegation Layer",
4
- "version": "0.1.37",
4
+ "version": "0.1.39",
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.37",
3
+ "version": "0.1.39",
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",
@@ -128,8 +128,9 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
128
128
  report delegate's evidence; do not assume the user's configuration is faulty
129
129
  or remove MCP servers, plugins, settings, or credentials to make it pass.
130
130
  11. The model chooses ordinary-task fan-out by issuing independent `dispatch`
131
- commands concurrently. The private supervisor does not impose a task-count
132
- or CPU-based limit. Use this for independent investigation, debate, review,
131
+ commands concurrently. There is no fixed task-count cap, but Delegate
132
+ refuses a new request while the host shows confirmed resource pressure (see
133
+ the `resource_pressure` row below). Use this for independent investigation, debate, review,
133
134
  or provider comparison. For independent parallel writes, choose
134
135
  `--isolation git-worktree` automatically unless the user explicitly chooses
135
136
  shared coordination; the model chooses fan-out and task scope. A read-only
@@ -313,10 +314,13 @@ for **each attempt**, including requests issued together:
313
314
  | `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate --root "<the exact absolute state root used by the failed command>" supervisor migrate --json` once. Retry the exact original admission argv once only after `supervisor_control.state: migrated` and `supervisor_control.next_action: retry_dispatch`; otherwise stop and report the migration response. Preserve an explicit custom root exactly. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
314
315
  | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
315
316
  | `task_record: not_created`, `failure.code: workspace_provision_pending` or `workspace_busy`, and `failure.next_action: watch_workspace` | Follow [managed workspace recovery](references/result-handling.md#managed-workspace-results) using the same root and workspace. Once ready, retry the exact admission command and inputs. A failed `continue` remains that same `continue`, never a new dispatch. |
317
+ | `task_record: not_created`, `failure.code: resource_pressure`, `failure.next_action: retry_later`, and `failure.retry_after_seconds: 30` | Delegate checked the host and confirmed resource pressure, so no ordinary task record was created and no provider task is running for this attempt. Do not poll or observe a task. Choose one: report the refusal and stop, or wait at least 30 seconds in the foreground and retry the exact original admission argv once. A `continue` stays that same `continue`. If the retry is refused again, report and stop. Never loop, retry in the background, schedule a retry, or run Pueue or process commands. The 30 seconds is advice, not a guarantee that the retry will pass. |
316
318
  | `task_record: not_created` with any other next action | Report that attempt's failure and stop it. Do not diagnose provider setup or substitute an integration. |
317
- | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
319
+ | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. An optional `resource_admission` object with `status: unknown` and `warnings` only means a resource metric could not be read; the task was admitted. Keep the warning with your report, observe that same task with `status` and `collect`, and do not redispatch. |
318
320
  | `task_record: unknown` or an ambiguous response | Stop and report; do not retry an uncertain task creation. |
319
321
 
322
+ `resource_admission` is optional. Its `status` is `clear`, `pressure`, or `unknown`, and `warnings` is a short list of bounded entries with `code`, optional `metric`, `reason_code`, and `message`. An unknown metric adds a warning and never refuses by itself, but confirmed pressure on an independent metric still refuses. The check runs only for a new dispatch or `continue`; `status`, `collect`, `cancel`, and the recovery of an existing task are not checked or refused.
323
+
320
324
  One attempt's `stop_and_report` does not prevent correcting another independent
321
325
  request's usage error. Keep the failed attempt reported as failed. With an
322
326
  explicit task ID, absence can race another dispatch creating the same ID;
@@ -3,7 +3,9 @@
3
3
  For independent parallel write work, choose `--isolation git-worktree`
4
4
  automatically unless the user explicitly chooses shared coordination. The
5
5
  model chooses fan-out and task scope; the supervisor has no fixed task-count
6
- cap or TTL eviction. A read-only review may attach a retained workspace with
6
+ cap or TTL eviction. Delegate still refuses a new request while the host shows
7
+ confirmed resource pressure: read each response separately, and handle a
8
+ `resource_pressure` refusal as in [result handling](result-handling.md). A read-only review may attach a retained workspace with
7
9
  `--workspace ID`. The single managed-workspace policy, capture boundary, and
8
10
  release rules live in [managed workspace guidance](workspaces.md); do not
9
11
  restate them in each collaboration brief.
@@ -72,7 +74,8 @@ Keep the request-to-label mapping alongside those files. Include any exact
72
74
  requested model/effort in its invocation. Read both exit codes, stderr, and JSON
73
75
  responses independently; shell `wait` is not proof that either dispatch succeeded.
74
76
  Poll only tasks with `task_record: created`. A returned task ID with
75
- `task_record: not_created` does not identify an observable task.
77
+ `task_record: not_created` does not identify an observable task. One request's
78
+ `resource_pressure` refusal does not change another request's response.
76
79
 
77
80
  ## Wait within the current turn
78
81
 
@@ -40,13 +40,27 @@ but it does not authorize a fresh dispatch. Apply the remaining `task_record`
40
40
  error rules in [result handling](result-handling.md) before retrying or
41
41
  observing.
42
42
 
43
+ Run `continue` with the same state root as the predecessor. The new turn uses
44
+ the environment of the process that calls `continue`, not an environment saved
45
+ by the predecessor, so the exact recorded session must be available there. If
46
+ `continue` fails because it is not, report the failure and stop. Do not copy
47
+ credentials or settings from another environment, choose a fresh session or
48
+ another provider, or dispatch again to repair the failure.
49
+
43
50
  When the predecessor is bound to a managed workspace, `continue --task` carries
44
- the recorded workspace, working directory, provider session, and environment
45
- to the new task ID. It does not mutate the predecessor's immutable request or
51
+ the recorded workspace, working directory, and provider session to the new task
52
+ ID. The new turn runs in the calling environment. It does not mutate the predecessor's immutable request or
46
53
  reservation. A changed provider request is a new turn and must pass the normal
47
54
  workspace-use reservation. Read [managed workspace guidance](workspaces.md)
48
55
  before attaching another provider, review, or verification operation.
49
56
 
57
+ A new `continue` is checked for host resource pressure before the successor is
58
+ created. If it returns `resource_pressure` with `task_record: "not_created"` and
59
+ `next_action: "retry_later"`, follow the bounded choice in
60
+ [result handling](result-handling.md): report and stop, or wait 30 seconds and
61
+ retry the exact `continue --task PREDECESSOR_ID` once. Never replace it with a
62
+ fresh dispatch. A predecessor that is already running is not affected.
63
+
50
64
  If `continue` returns `workspace_busy` with `task_record: "not_created"` and
51
65
  `next_action: "watch_workspace"`, observe that workspace with the same root.
52
66
  Then retry the exact `continue --task PREDECESSOR_ID` after it becomes retained.
@@ -20,12 +20,21 @@ the same as a successful provider result.
20
20
  or call a provider directly to replace a failed continuation. Also handle
21
21
  `workspace_provision_pending` or `workspace_busy` with `watch_workspace`
22
22
  using [managed workspace recovery](#managed-workspace-results) before the
23
- generic stop rule. For every other `not_created` response, do not poll;
23
+ generic stop rule. A `resource_pressure` refusal (`failure.next_action:
24
+ "retry_later"`, `failure.retry_after_seconds: 30`, `task_record: "not_created"`) is
25
+ a bounded caller choice: report and stop, or wait at least 30 seconds in the
26
+ foreground and retry the exact original admission once; `continue` remains
27
+ `continue`. Never loop, retry in the background, or poll. For every other
28
+ `not_created` response, do not poll;
24
29
  correct the request only if
25
30
  `failure.next_action` is `correct_request`, otherwise report and stop. When
26
31
  `task_record` is `unknown`, stop and report without polling or retrying.
27
32
  Status and collect can report `admission: "unknown"` alongside valid terminal
28
- evidence for an existing task.
33
+ evidence for an existing task. An admitted task can carry
34
+ `resource_admission` with `status: "unknown"` and bounded `warnings`
35
+ (for example `resource_observation_unavailable`). That is a warning about
36
+ an unreadable host metric, not a failure: observe that same task with
37
+ `status` and `collect`, and do not redispatch.
29
38
  3. If `status` is `timed_out`, follow the continuation procedure before treating
30
39
  pending publication as a reason to wait. `continuation.resumable: true`
31
40
  permits a linked successor even when no outcome has been published. An
@@ -102,9 +102,11 @@ flag. This auxiliary budget is separate from and does not renew the provider
102
102
  task budget. The existing `codex:review` default remains 1 hour.
103
103
 
104
104
  `continue --task PREDECESSOR_ID` inherits the predecessor's managed workspace,
105
- working directory, provider session, and recorded environment, while creating
106
- a new task ID. A changed provider request is a new turn; it must not mutate the
107
- predecessor's immutable records. A retained workspace can be used by a
105
+ working directory, and provider session, while creating a new task ID. The new
106
+ turn runs in the calling environment, so the exact recorded session must be
107
+ available there; see [continuation](continuation.md). The predecessor's
108
+ admitted records stay unchanged. A changed provider request is a new turn; it
109
+ must not mutate the predecessor's immutable records. A retained workspace can be used by a
108
110
  read-only review by attaching its ID, for example:
109
111
 
110
112
  ```text
@@ -128,8 +128,9 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
128
128
  report delegate's evidence; do not assume the user's configuration is faulty
129
129
  or remove MCP servers, plugins, settings, or credentials to make it pass.
130
130
  11. The model chooses ordinary-task fan-out by issuing independent `dispatch`
131
- commands concurrently. The private supervisor does not impose a task-count
132
- or CPU-based limit. Use this for independent investigation, debate, review,
131
+ commands concurrently. There is no fixed task-count cap, but Delegate
132
+ refuses a new request while the host shows confirmed resource pressure (see
133
+ the `resource_pressure` row below). Use this for independent investigation, debate, review,
133
134
  or provider comparison. For independent parallel writes, choose
134
135
  `--isolation git-worktree` automatically unless the user explicitly chooses
135
136
  shared coordination; the model chooses fan-out and task scope. A read-only
@@ -313,10 +314,13 @@ for **each attempt**, including requests issued together:
313
314
  | `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate --root "<the exact absolute state root used by the failed command>" supervisor migrate --json` once. Retry the exact original admission argv once only after `supervisor_control.state: migrated` and `supervisor_control.next_action: retry_dispatch`; otherwise stop and report the migration response. Preserve an explicit custom root exactly. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
314
315
  | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
315
316
  | `task_record: not_created`, `failure.code: workspace_provision_pending` or `workspace_busy`, and `failure.next_action: watch_workspace` | Follow [managed workspace recovery](references/result-handling.md#managed-workspace-results) using the same root and workspace. Once ready, retry the exact admission command and inputs. A failed `continue` remains that same `continue`, never a new dispatch. |
317
+ | `task_record: not_created`, `failure.code: resource_pressure`, `failure.next_action: retry_later`, and `failure.retry_after_seconds: 30` | Delegate checked the host and confirmed resource pressure, so no ordinary task record was created and no provider task is running for this attempt. Do not poll or observe a task. Choose one: report the refusal and stop, or wait at least 30 seconds in the foreground and retry the exact original admission argv once. A `continue` stays that same `continue`. If the retry is refused again, report and stop. Never loop, retry in the background, schedule a retry, or run Pueue or process commands. The 30 seconds is advice, not a guarantee that the retry will pass. |
316
318
  | `task_record: not_created` with any other next action | Report that attempt's failure and stop it. Do not diagnose provider setup or substitute an integration. |
317
- | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
319
+ | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. An optional `resource_admission` object with `status: unknown` and `warnings` only means a resource metric could not be read; the task was admitted. Keep the warning with your report, observe that same task with `status` and `collect`, and do not redispatch. |
318
320
  | `task_record: unknown` or an ambiguous response | Stop and report; do not retry an uncertain task creation. |
319
321
 
322
+ `resource_admission` is optional. Its `status` is `clear`, `pressure`, or `unknown`, and `warnings` is a short list of bounded entries with `code`, optional `metric`, `reason_code`, and `message`. An unknown metric adds a warning and never refuses by itself, but confirmed pressure on an independent metric still refuses. The check runs only for a new dispatch or `continue`; `status`, `collect`, `cancel`, and the recovery of an existing task are not checked or refused.
323
+
320
324
  One attempt's `stop_and_report` does not prevent correcting another independent
321
325
  request's usage error. Keep the failed attempt reported as failed. With an
322
326
  explicit task ID, absence can race another dispatch creating the same ID;
@@ -3,7 +3,9 @@
3
3
  For independent parallel write work, choose `--isolation git-worktree`
4
4
  automatically unless the user explicitly chooses shared coordination. The
5
5
  model chooses fan-out and task scope; the supervisor has no fixed task-count
6
- cap or TTL eviction. A read-only review may attach a retained workspace with
6
+ cap or TTL eviction. Delegate still refuses a new request while the host shows
7
+ confirmed resource pressure: read each response separately, and handle a
8
+ `resource_pressure` refusal as in [result handling](result-handling.md). A read-only review may attach a retained workspace with
7
9
  `--workspace ID`. The single managed-workspace policy, capture boundary, and
8
10
  release rules live in [managed workspace guidance](workspaces.md); do not
9
11
  restate them in each collaboration brief.
@@ -72,7 +74,8 @@ Keep the request-to-label mapping alongside those files. Include any exact
72
74
  requested model/effort in its invocation. Read both exit codes, stderr, and JSON
73
75
  responses independently; shell `wait` is not proof that either dispatch succeeded.
74
76
  Poll only tasks with `task_record: created`. A returned task ID with
75
- `task_record: not_created` does not identify an observable task.
77
+ `task_record: not_created` does not identify an observable task. One request's
78
+ `resource_pressure` refusal does not change another request's response.
76
79
 
77
80
  ## Wait within the current turn
78
81
 
@@ -40,13 +40,27 @@ but it does not authorize a fresh dispatch. Apply the remaining `task_record`
40
40
  error rules in [result handling](result-handling.md) before retrying or
41
41
  observing.
42
42
 
43
+ Run `continue` with the same state root as the predecessor. The new turn uses
44
+ the environment of the process that calls `continue`, not an environment saved
45
+ by the predecessor, so the exact recorded session must be available there. If
46
+ `continue` fails because it is not, report the failure and stop. Do not copy
47
+ credentials or settings from another environment, choose a fresh session or
48
+ another provider, or dispatch again to repair the failure.
49
+
43
50
  When the predecessor is bound to a managed workspace, `continue --task` carries
44
- the recorded workspace, working directory, provider session, and environment
45
- to the new task ID. It does not mutate the predecessor's immutable request or
51
+ the recorded workspace, working directory, and provider session to the new task
52
+ ID. The new turn runs in the calling environment. It does not mutate the predecessor's immutable request or
46
53
  reservation. A changed provider request is a new turn and must pass the normal
47
54
  workspace-use reservation. Read [managed workspace guidance](workspaces.md)
48
55
  before attaching another provider, review, or verification operation.
49
56
 
57
+ A new `continue` is checked for host resource pressure before the successor is
58
+ created. If it returns `resource_pressure` with `task_record: "not_created"` and
59
+ `next_action: "retry_later"`, follow the bounded choice in
60
+ [result handling](result-handling.md): report and stop, or wait 30 seconds and
61
+ retry the exact `continue --task PREDECESSOR_ID` once. Never replace it with a
62
+ fresh dispatch. A predecessor that is already running is not affected.
63
+
50
64
  If `continue` returns `workspace_busy` with `task_record: "not_created"` and
51
65
  `next_action: "watch_workspace"`, observe that workspace with the same root.
52
66
  Then retry the exact `continue --task PREDECESSOR_ID` after it becomes retained.
@@ -20,12 +20,21 @@ the same as a successful provider result.
20
20
  or call a provider directly to replace a failed continuation. Also handle
21
21
  `workspace_provision_pending` or `workspace_busy` with `watch_workspace`
22
22
  using [managed workspace recovery](#managed-workspace-results) before the
23
- generic stop rule. For every other `not_created` response, do not poll;
23
+ generic stop rule. A `resource_pressure` refusal (`failure.next_action:
24
+ "retry_later"`, `failure.retry_after_seconds: 30`, `task_record: "not_created"`) is
25
+ a bounded caller choice: report and stop, or wait at least 30 seconds in the
26
+ foreground and retry the exact original admission once; `continue` remains
27
+ `continue`. Never loop, retry in the background, or poll. For every other
28
+ `not_created` response, do not poll;
24
29
  correct the request only if
25
30
  `failure.next_action` is `correct_request`, otherwise report and stop. When
26
31
  `task_record` is `unknown`, stop and report without polling or retrying.
27
32
  Status and collect can report `admission: "unknown"` alongside valid terminal
28
- evidence for an existing task.
33
+ evidence for an existing task. An admitted task can carry
34
+ `resource_admission` with `status: "unknown"` and bounded `warnings`
35
+ (for example `resource_observation_unavailable`). That is a warning about
36
+ an unreadable host metric, not a failure: observe that same task with
37
+ `status` and `collect`, and do not redispatch.
29
38
  3. If `status` is `timed_out`, follow the continuation procedure before treating
30
39
  pending publication as a reason to wait. `continuation.resumable: true`
31
40
  permits a linked successor even when no outcome has been published. An
@@ -102,9 +102,11 @@ flag. This auxiliary budget is separate from and does not renew the provider
102
102
  task budget. The existing `codex:review` default remains 1 hour.
103
103
 
104
104
  `continue --task PREDECESSOR_ID` inherits the predecessor's managed workspace,
105
- working directory, provider session, and recorded environment, while creating
106
- a new task ID. A changed provider request is a new turn; it must not mutate the
107
- predecessor's immutable records. A retained workspace can be used by a
105
+ working directory, and provider session, while creating a new task ID. The new
106
+ turn runs in the calling environment, so the exact recorded session must be
107
+ available there; see [continuation](continuation.md). The predecessor's
108
+ admitted records stay unchanged. A changed provider request is a new turn; it
109
+ must not mutate the predecessor's immutable records. A retained workspace can be used by a
108
110
  read-only review by attaching its ID, for example:
109
111
 
110
112
  ```text