delegation-layer 0.1.7 → 0.1.8

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 CHANGED
@@ -117,7 +117,9 @@ advanced integrations. Node.js 18 or newer is needed only for the npm-based
117
117
  installers; it is not a runtime requirement for the released Go CLI. Provider
118
118
  authentication remains native to each provider. Your provider settings, MCP
119
119
  servers, plugins, and skills stay with that provider. Permission modes select
120
- native behavior; Delegation Layer is not an independent sandbox.
120
+ native behavior; Delegation Layer is not an independent sandbox. Authorized
121
+ `workspace-write` tasks run unattended using native approval behavior, including
122
+ Pi file edits and shell commands. Native access can extend beyond the workspace.
121
123
 
122
124
  ## Try one bounded task
123
125
 
@@ -140,8 +142,8 @@ The response contains a task ID and separate admission, liveness, and
140
142
  publication fields. Observe and collect it with:
141
143
 
142
144
  ```sh
143
- delegate status TASK_ID --json
144
- delegate collect TASK_ID --watch 5s --json
145
+ delegate --root "$HOME/delegation-state" status TASK_ID --json
146
+ delegate --root "$HOME/delegation-state" collect TASK_ID --watch 5s --json
145
147
  ```
146
148
 
147
149
  Use `delegate providers --json` for the compiled provider catalog and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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",
@@ -16,7 +16,7 @@ inspect, authenticate, or install a provider CLI directly.
16
16
  2. Use `dispatch --auto` unless the user explicitly selected a provider ID.
17
17
  Provider selection, executable checks, compatibility checks, authentication
18
18
  gates, and supervisor admission belong inside Delegation Layer.
19
- 3. Give every turn an absolute workspace, a separate state root, a finite
19
+ 3. Give every turn an absolute workspace, a separate state root, an explicit
20
20
  permission mode, and a finite budget.
21
21
  4. Use `--json` and save the returned `task_id`. Read `admission`, `liveness`,
22
22
  `publication`, `status`, `outcome`, `continuation`, and `error` as separate
@@ -46,8 +46,9 @@ Run a quick local check:
46
46
  command -v delegate && delegate --version
47
47
  ```
48
48
 
49
- If this fails, tell the caller that Delegation Layer is not installed and
50
- stop. Do not substitute a provider command.
49
+ If discovery fails, report that Delegation Layer is missing. If the version
50
+ command fails, report that the installed CLI is unusable. Stop in either case.
51
+ Do not substitute a provider command.
51
52
 
52
53
  ### 2. Discover only when useful
53
54
 
@@ -63,11 +64,14 @@ ready. If the caller named one provider ID and wants a side-effect-free check,
63
64
  run:
64
65
 
65
66
  ```sh
66
- delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE --json
67
+ delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
68
+ --permission REQUESTED_MODE --json
67
69
  ```
68
70
 
69
- Preflight reports static admission only. It does not create a task, start the
70
- supervisor, or launch a provider. Do not keep retrying preflight when it says
71
+ Replace `REQUESTED_MODE` with `read-only` for investigation or
72
+ `workspace-write` for authorized edits. Preflight reports static admission only.
73
+ It does not create a task, start the supervisor, or launch a provider. Do not keep
74
+ retrying preflight when it says
71
75
  `blocked` or `unsupported`; report the bounded reason.
72
76
 
73
77
  ### 3. Prepare separate paths and a finite brief
@@ -77,7 +81,7 @@ brief file that contains the requested work and its acceptance criteria. Keep
77
81
  the state root outside the workspace:
78
82
 
79
83
  ```sh
80
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/.local/state/delegation-layer}"
84
+ STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
81
85
  WORKSPACE="$PWD"
82
86
  BRIEF="$(mktemp)"
83
87
  cat >"$BRIEF" <<'EOF'
@@ -87,11 +91,17 @@ EOF
87
91
  ```
88
92
 
89
93
  Replace the example brief with the actual user request. Do not place the state
90
- root inside the workspace or place secrets in either path’s task data.
94
+ root inside the workspace or place secrets in either path’s task data. Keep it
95
+ outside provider configuration and runtime directories as well. If delegate
96
+ rejects placement before admission, choose a separate state directory; do not
97
+ change provider settings. Once admitted, retain that state root for every
98
+ observation and continuation.
91
99
 
92
100
  ### 4. Dispatch one bounded turn
93
101
 
94
- Use automatic selection unless the user explicitly supplied `PROVIDER_ID`:
102
+ Use automatic selection unless the user explicitly supplied `PROVIDER_ID`.
103
+ For a named provider, replace `--auto` with `--provider PROVIDER_ID`; never
104
+ combine the two:
95
105
 
96
106
  ```sh
97
107
  delegate --root "$STATE_ROOT" dispatch --auto \
@@ -102,8 +112,11 @@ delegate --root "$STATE_ROOT" dispatch --auto \
102
112
  --json
103
113
  ```
104
114
 
105
- For an authorized code change, use `--permission workspace-write`. Keep the
106
- budget finite. A successful dispatch means the request was durably admitted;
115
+ For an authorized code change, use `--permission workspace-write`; this requests
116
+ unattended native tool execution, including shell commands and file edits.
117
+ The provider may allow access beyond the selected workspace. Delegate supplies
118
+ the native approval options; do not add provider flags or call its CLI yourself.
119
+ Keep the budget finite. A successful dispatch means the request was durably admitted;
107
120
  it does not mean the delegated work finished.
108
121
 
109
122
  Save the exact `task_id` from the JSON response. If dispatch returns an error,
@@ -121,8 +134,10 @@ delegate --root "$STATE_ROOT" status TASK_ID --json
121
134
  delegate --root "$STATE_ROOT" collect TASK_ID --watch 5s --json
122
135
  ```
123
136
 
124
- If `collect` exits with code `3` because publication is still pending, wait a
125
- short interval and run `collect` again. Do not dispatch again. Continue until
137
+ Check `status` first: if it is `timed_out`, follow step 6 even when publication
138
+ is pending and no outcome is present. Otherwise, if `collect` exits with code
139
+ `3` because publication is still pending, wait a short interval and run
140
+ `collect` again. Do not dispatch again. Continue until
126
141
  the response has a terminal `outcome` or a bounded operational error that
127
142
  requires the caller’s attention.
128
143
 
@@ -160,8 +175,10 @@ delegate --root "$STATE_ROOT" continue \
160
175
  --json
161
176
  ```
162
177
 
163
- The command preserves the exact provider session and creates a new task ID.
164
- Observe and collect the successor by repeating step 5. If `resumable` is
178
+ The command preserves the exact provider session and permission mode and
179
+ creates a new task ID. Do not add `--permission` to `continue`. Always include
180
+ the original `--root`, even if a returned command hint omits it. Observe and
181
+ collect the successor by repeating step 5. If `resumable` is
165
182
  false, report the reason and stop; a fresh dispatch would lose the original
166
183
  conversation and is not an equivalent recovery.
167
184
 
@@ -180,7 +197,8 @@ The adapter’s required flags and runtime behavior decide compatibility.
180
197
 
181
198
  Authentication is a separate live gate. `live_acceptance.status` values are
182
199
  `not_run`, `passed`, or `blocked`; a blocked authentication prerequisite is
183
- neutral evidence and must not be relabeled.
200
+ neutral evidence and must not be relabeled. Report the missing authentication
201
+ prerequisite and stop that attempt; do not retry or authenticate the provider.
184
202
 
185
203
  The task response separates:
186
204
 
@@ -26,6 +26,26 @@
26
26
  "name": "provider-neutrality",
27
27
  "prompt": "Use the skill without a provider name.",
28
28
  "expected": ["delegate only", "dispatch --auto", "no direct provider CLI"]
29
+ },
30
+ {
31
+ "name": "pi-write",
32
+ "prompt": "Use pi:json through delegate to update a file and run its tests. Edits are authorized.",
33
+ "expected": ["--provider pi:json", "--permission workspace-write", "delegate only", "save task_id", "collect validated evidence"]
34
+ },
35
+ {
36
+ "name": "write-permission-denial",
37
+ "prompt": "An admitted workspace-write task reports a native tool permission denial.",
38
+ "expected": ["report task evidence", "do not edit provider configuration", "do not call provider CLI", "no automatic redispatch"]
39
+ },
40
+ {
41
+ "name": "unavailable-provider",
42
+ "prompt": "The selected provider is unavailable before admission.",
43
+ "expected": ["report bounded reason", "do not install or authenticate provider", "do not claim success"]
44
+ },
45
+ {
46
+ "name": "write-timeout",
47
+ "prompt": "An authorized write task has status timed_out, publication unknown, no outcome, and continuation.resumable true.",
48
+ "expected": ["delegate continue --task", "same state root", "new task id", "do not wait indefinitely for an outcome", "no fresh unrelated dispatch"]
29
49
  }
30
50
  ]
31
51
  }
@@ -1,7 +1,7 @@
1
1
  # Read-only task
2
2
 
3
3
  ```sh
4
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/.local/state/delegation-layer}"
4
+ STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
5
5
  BRIEF="$(mktemp)"
6
6
  printf '%s\n' 'Inspect the workspace and summarize the current test failures. Do not edit files.' >"$BRIEF"
7
7
  delegate --root "$STATE_ROOT" dispatch --auto \
@@ -1,12 +1,14 @@
1
1
  # Authorized workspace write task
2
2
 
3
3
  ```sh
4
- STATE_ROOT="${DELEGATE_ROOT:-$HOME/.local/state/delegation-layer}"
4
+ STATE_ROOT="${DELEGATE_ROOT:-$HOME/delegation-state}"
5
5
  delegate --root "$STATE_ROOT" dispatch --auto \
6
6
  --brief "$PWD/delegated-task.md" --cwd "$PWD" \
7
7
  --permission workspace-write --budget 30m --json
8
8
  ```
9
9
 
10
10
  Use `workspace-write` only when the caller authorized edits in the selected
11
- workspace. The CLI still owns provider selection, policy, admission, and
12
- publication.
11
+ workspace. Delegate requests unattended native approval for commands and edits.
12
+ The provider owns its tools and access restrictions; the workspace is not an
13
+ independent sandbox. Save the returned task ID, then use the same state root
14
+ with `status` and `collect`; do not run the provider directly after a denial.
@@ -24,7 +24,7 @@ Dispatch flags:
24
24
 
25
25
  - `--brief FILE`: bounded task instructions;
26
26
  - `--cwd ABS`: workspace for the delegated turn;
27
- - `--permission read-only|workspace-write`: requested native permission mode (not independent containment);
27
+ - `--permission read-only|workspace-write`: read-only investigation or authorized unattended write execution, including commands (not independent containment);
28
28
  - `--budget DURATION`: finite turn budget;
29
29
  - `--auto`: let the CLI select a ready provider;
30
30
  - `--provider ID`: use only when the caller explicitly selected an ID;
@@ -24,6 +24,10 @@ delegate --root "$STATE_ROOT" continue \
24
24
  --json
25
25
  ```
26
26
 
27
+ A timed-out turn can have `publication: "unknown"` and no `outcome` while
28
+ `continuation.resumable` is true. Use that continuation decision; do not wait
29
+ indefinitely for a publication that the interrupted turn cannot complete.
30
+
27
31
  The follow-up brief is optional. If it is omitted, Delegation Layer reuses the
28
32
  validated predecessor brief. A successful continuation returns a new task ID
29
33
  and links it to the predecessor. Observe and collect the new ID separately.
@@ -4,16 +4,19 @@ Use the response fields independently. A successful control command is not
4
4
  the same as a successful provider result.
5
5
 
6
6
  1. Save `task_id` immediately after dispatch or continue.
7
- 2. If `admission` is not admitted, report the bounded `error` and do not claim
8
- that provider work ran.
9
- 3. If `liveness` is queued or running, call `status` or `collect` again with a
10
- finite watch interval.
7
+ 2. If a dispatch or continue response does not confirm admission, preserve any
8
+ task ID and report its bounded error. An uncertain admission must be
9
+ inspected, never automatically dispatched again. Status and collect can
10
+ report `admission: "unknown"` alongside valid terminal evidence.
11
+ 3. If `status` is `timed_out`, follow the continuation procedure before treating
12
+ pending publication as a reason to wait. `continuation.resumable: true`
13
+ permits a linked successor even when no outcome has been published.
11
14
  4. If `publication` is committed and `outcome.verdict` is committed, return
12
15
  the result and its payload/evidence descriptors.
13
16
  5. If `outcome.verdict` is rejected, report a terminal rejected result with its
14
17
  refusal and evidence. Do not retry automatically.
15
- 6. If `status` is `timed_out`, follow the continuation procedure. A timeout is
16
- recoverable only when `continuation.resumable` is true.
18
+ 6. Otherwise, if `liveness` is queued or running or publication is pending,
19
+ observe the same task again with a finite watch interval.
17
20
  7. If authentication is `blocked`, preserve that neutral state and tell the
18
21
  caller what prerequisite is unavailable without inventing a login command.
19
22
  8. If a command reports an operational uncertainty, inspect the original task