owenloop 0.5.4 → 0.5.6

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/packages/work/src/agent/brief.d.ts +28 -4
  3. package/dist/packages/work/src/agent/brief.js +170 -2
  4. package/dist/packages/work/src/agent/loop.d.ts +10 -1
  5. package/dist/packages/work/src/agent/loop.js +60 -3
  6. package/dist/packages/work/src/agent/workdir.d.ts +22 -0
  7. package/dist/packages/work/src/agent/workdir.js +80 -0
  8. package/dist/packages/work/src/exec/loop.d.ts +13 -1
  9. package/dist/packages/work/src/exec/loop.js +31 -0
  10. package/dist/packages/work/src/harness/claude.d.ts +24 -0
  11. package/dist/packages/work/src/harness/claude.js +131 -23
  12. package/dist/packages/work/src/harness/contract.d.ts +25 -20
  13. package/dist/packages/work/src/harness/contract.js +25 -20
  14. package/dist/packages/work/src/harness/gatekeeper.d.ts +124 -0
  15. package/dist/packages/work/src/harness/gatekeeper.js +208 -0
  16. package/dist/packages/work/src/hold/mcp.d.ts +11 -2
  17. package/dist/packages/work/src/hold/mcp.js +69 -2
  18. package/dist/packages/work/src/hub/client.d.ts +8 -1
  19. package/dist/packages/work/src/hub/client.js +1 -0
  20. package/dist/packages/work/src/hub/types.d.ts +29 -0
  21. package/dist/packages/work/src/roles/agent-run.js +9 -1
  22. package/dist/packages/work/src/roles/exec.js +9 -0
  23. package/dist/packages/work/src/roles/shift.js +9 -1
  24. package/dist/packages/work/src/settings/settings.d.ts +20 -1
  25. package/dist/packages/work/src/settings/settings.js +23 -1
  26. package/dist/packages/work/src/shift/runtime.d.ts +7 -0
  27. package/dist/packages/work/src/shift/runtime.js +29 -4
  28. package/dist/packages/work/src/shift/spawn.d.ts +12 -2
  29. package/dist/packages/work/src/shift/spawn.js +16 -3
  30. package/dist/src/cli.js +54 -1
  31. package/dist/src/engine.d.ts +46 -1
  32. package/dist/src/engine.js +72 -0
  33. package/dist/src/index.d.ts +1 -1
  34. package/dist/src/index.js +1 -1
  35. package/dist/src/model.d.ts +29 -5
  36. package/dist/src/model.js +63 -14
  37. package/dist/src/types.d.ts +8 -2
  38. package/docs/agent-runner.md +17 -5
  39. package/docs/cli.md +34 -0
  40. package/package.json +1 -1
  41. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
  42. package/plugins/claude-code/plugin/.mcp.json +1 -1
  43. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
  44. package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
@@ -59,8 +59,8 @@ A cache created by an older CLI may contain `filesystem` or `network` under `per
59
59
  | `network: owenloop-only` | supported through isolated settings, skills, MCP, and built-in tools | refused |
60
60
  | `network: unrestricted` | supported | supported with `filesystem: unrestricted`, or with an omitted filesystem field and legacy sandbox `workspace-write` / `danger-full-access`; legacy sandbox `read-only` is refused because Codex has no independent read-only network control |
61
61
  | `maxTurns` | enforced by the SDK | refused; Codex app-server has no thread or turn limit parameter |
62
- | `permissionMode: ask` | translated to `default` | translated to `approvalPolicy: untrusted` |
63
- | `permissionMode: auto-safe` | translated to `auto`, without the danger companion flag | translated to `approvalPolicy: on-request` |
62
+ | `permissionMode: ask` | translated to `default`, with the adapter's gatekeeper set to `human-gate` | translated to `approvalPolicy: untrusted` |
63
+ | `permissionMode: auto-safe` | translated to `default` (NOT the SDK's `auto`, which never reaches the permission callback), with the adapter's gatekeeper set to `classifier`; no danger companion flag | translated to `approvalPolicy: on-request` |
64
64
  | `permissionMode: full-access` | translated to `bypassPermissions` plus the SDK's `allowDangerouslySkipPermissions` companion flag | translated to `approvalPolicy: never` |
65
65
  | another adapter's `permissionMode` value | refused; the Claude Code adapter accepts only its own SDK union plus the three neutral values | refused; the Codex adapter accepts only `untrusted`, `on-request`, `never`, plus the three neutral values |
66
66
 
@@ -81,12 +81,24 @@ The neutral vocabulary is three positions on one axis, and both shipped harnesse
81
81
  | Neutral value | What is the gate | Claude Code | Codex |
82
82
  |---|---|---|---|
83
83
  | `ask` | a human, before anything beyond trivially safe reads | `default` | `untrusted` |
84
- | `auto-safe` | a model-side classifier; it proceeds on ordinary work and consults a human only when an action is potentially dangerous | `auto` | `on-request` |
84
+ | `auto-safe` | a classifier; it proceeds on ordinary work and escalates only when an action is potentially dangerous | `default` + the adapter's gatekeeper | `on-request` |
85
85
  | `full-access` | nothing; the harness never consults a human and a failed action is reported back to the model | `bypassPermissions` + `allowDangerouslySkipPermissions` | `never` |
86
86
 
87
- `auto-safe` is not a milder `full-access`. It can still stop and ask, which is the whole point of it, so an adapter must never map it onto a never-ask mode. The two exist separately so a definition states the choice rather than having it inferred.
87
+ `auto-safe` is not a milder `full-access`. It can still escalate, which is the whole point of it, so an adapter must never map it onto a never-ask mode. The two exist separately so a definition states the choice rather than having it inferred.
88
88
 
89
- `ask` and `auto-safe` are meaningful only where something can answer a prompt. In a Shift-dispatched run nothing can today, so a prompt is a stall: the Step Agent stops mid-turn, submits nothing, and the hub re-arms the step into a retry storm whose every worker dies in the same place. That is a reason for a definition author to choose `full-access` for headless steps, not a reason for an adapter to silently upgrade one value into another.
89
+ ### Who does the gating, and how a headless step escalates
90
+
91
+ The vendor classifiers do not, in practice, consult anyone. The SDK's `auto` mode was probed with five actions — among them a recursive delete on an absolute path outside the session working directory, an outbound network request, and a read of a file outside that directory. It consulted the host on none of them, auto-denied none of them, and four ran. `auto` also never reaches the SDK's `canUseTool` callback, so no host-side wiring can give it an exception path.
92
+
93
+ The Claude Code adapter therefore does not delegate `auto-safe` to `auto`. Both `ask` and `auto-safe` translate to `default`, the one SDK mode that routes every unapproved tool call to `canUseTool`, and the adapter's own gatekeeper decides:
94
+
95
+ - **Path containment.** A tool call naming a path outside the step's working directory escalates, under either policy. This is decidable and is the check that catches the probes above.
96
+ - **A shell deny-list.** Under `auto-safe`, `Bash` escalates on a short list of destructive or exfiltrating patterns (`sudo`, recursive force-delete, device writes, ownership changes, `curl`/`wget` carrying a request body, changes to what runs on the machine outside the step). It is a deny-list, not a proof: an obfuscated command gets past it. A step whose every command must be reviewed says `ask`, which escalates all of them without consulting the list.
97
+ - **Policy.** `ask` allows only a contained read and escalates everything else. `auto-safe` allows ordinary work and escalates what the two checks above establish. The worker-owned `owenloop` MCP mount is allowed under both, because gating it would remove a stuck step's ability to say so.
98
+
99
+ An escalation in a Shift-dispatched run cannot be a synchronous prompt — no person is watching at the moment of the call, and a call left waiting is a stall that re-arms the step into a retry storm. The adapter denies the call and routes the agent to the `ask` MCP tool, which freezes the owed artifact, closes the run without burning further attempts, and puts the question on a human's attention feed with an answer path back into the next attempt. The denial is also emitted as a progress event, so an operator can see a gate that fired.
100
+
101
+ A step that names no `permissionMode` at all reaches the SDK's `default` and is gated under the `classifier` policy. Before the gatekeeper existed such a step was denied wholesale — `default` denies when no callback is wired — silently and finally, with nobody prompted and nothing recorded.
90
102
 
91
103
  For each neutral value an adapter must either map it onto the vendor mode with the same meaning, or refuse it in preflight. Refusal is a legitimate answer and fails closed: the worker releases its claim and starts no model process. Mapping a value onto a mode that grants more than the value describes is never legitimate.
92
104
 
package/docs/cli.md CHANGED
@@ -189,6 +189,7 @@ The same directory holds `credentials.json`, `allowed_signers`, `org-root.pub`,
189
189
  owenloop shift start <crew...> [--all] [--origin <url>] [--as <account>] [--name <n>]
190
190
  [--cap <n>] [--max-agents <n>] [--poll-interval <ms>] [--once]
191
191
  [--cache-dir <p>] [--state-dir <p>] [--log-dir <p>] [--log-max-age <ms>]
192
+ [--work-root <dir>]...
192
193
  ```
193
194
 
194
195
  At least one named crew is required unless `--all` is present. `--all` and
@@ -209,6 +210,7 @@ one loop sweep and exits instead of keeping the foreground daemon running.
209
210
  | `--cache-dir <p>` | cache root; precedence is flag, then `OWENLOOP_CACHE_DIR`, then `settings.cacheDir`, then `$XDG_CACHE_HOME/owenloop`, then `$HOME/.cache/owenloop` |
210
211
  | `--state-dir <p>` | socket and child-state root; precedence is flag, then `OWENLOOP_STATE_DIR`, then `settings.stateDir`, then `$XDG_STATE_HOME/owenloop/exec`, then `$HOME/.local/state/owenloop/exec`; the socket is `shift.sock` inside this directory |
211
212
  | `--log-dir <p>` | where `shift.log` and each `<run>.log` are written; precedence is flag, then `OWENLOOP_SHIFT_LOG_DIR`, then `settings.shiftLogDir`, then the resolved state directory |
213
+ | `--work-root <dir>` | **repeatable.** restrict this machine to orders whose working directory is inside one of these roots; precedence is the flags, then `OWENLOOP_ALLOWED_WORKDIR_ROOTS` (a `:`-separated list), then `settings.allowedWorkdirRoots`. Each rung REPLACES the one below it rather than extending it. No rung set anywhere ⇒ **no restriction**, which is the default |
212
214
  | `--log-max-age <ms>` | worker-log retention, swept once at startup; precedence is flag, then `OWENLOOP_SHIFT_LOG_MAX_AGE_MS`, then `settings.shiftLogMaxAgeMs`, then `1209600000` (14 days). `0` reaps every completed run's log at the next startup; there is no value that disables the sweep, and `shift.log` is never reaped |
213
215
 
214
216
  **On-disk logs.** A running shift appends its dispatch record to
@@ -219,6 +221,38 @@ dispatch: the shift reports it once on stderr and serves with logging disabled.
219
221
  Full field-by-field contract, retention rules, and uploader notes in
220
222
  [`docs/shift-logs.md`](shift-logs.md).
221
223
 
224
+ **Where a shift will do work.** A shift is not bound to a project: it is an
225
+ orchestrator that runs whatever its crews are offered. `--work-root` is how the
226
+ person who owns the machine bounds that — it is a **local** policy, declared at
227
+ the shift, and the hub is never asked and never informed in advance.
228
+
229
+ The check happens in the WORKER, not in dispatch. The shift's `whats_next` sweep
230
+ receives a `WorkOrder`, which carries no working directory at all; only the
231
+ `OrderPacket` a worker fetches with `get_order` has one. So `owenloop work exec`
232
+ and `owenloop work agent-run` each resolve the roots themselves — from
233
+ `OWENLOOP_ALLOWED_WORKDIR_ROOTS`, which the shift exports into every child it
234
+ spawns, or from the settings file when run by hand — and refuse there.
235
+
236
+ A refusal is a **release**, not a failure. The order is valid; this machine is
237
+ simply not configured to host that tree. The worker releases its claim, exits
238
+ non-zero, and writes one line to `<log-dir>/<run>.log` naming the directory and
239
+ the roots. The order returns to the hub's pickup window, where a machine that
240
+ *is* configured for that tree can take it.
241
+
242
+ Only a workdir the ORDER names is checked. A step that declares neither
243
+ `workdir:` nor `workdirFrom:` falls back to a directory the operator already
244
+ controls — the shift's own launch directory for a command step, or
245
+ `<workRoot>/<workflow>/<run>/` for an agent step — and is never denied.
246
+
247
+ `--work-root` is not `--work-root`'s neighbour `workRoot`. `workRoot` (settings,
248
+ `OWENLOOP_WORK_ROOT`) is the ONE directory owenloop **creates** per-run
249
+ directories under. `--work-root` / `allowedWorkdirRoots` is the SET of
250
+ directories an order is **allowed to name**. Neither derives from the other.
251
+
252
+ ```bash
253
+ owenloop shift start build --work-root ~/code --work-root /srv/work
254
+ ```
255
+
222
256
  **One harness per shift.** A shift has no per-order harness switch and no
223
257
  `--harness` flag. It never puts `--harness` on a worker's command line; each
224
258
  `agent-run` child resolves its own adapter, in this order:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Deterministic rails for agentic workflows. Declare steps and dependencies; the engine guarantees order, redoes what changes invalidate, and stops what keeps failing — instead of hoping the agent follows through.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "typicalday",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Claude Code driver for owenloop — cross-harness shift and conduct skills driven by the owenloop CLI, plus one hub control-plane MCP server backing an author skill and a fallback worker, for conducting and authoring workflows against your hosted owenloop server.",
5
5
  "author": {
6
6
  "name": "Typical Day"
@@ -7,7 +7,7 @@
7
7
  "mcp"
8
8
  ],
9
9
  "env": {
10
- "OWENLOOP_PLUGIN_VERSION": "0.5.4"
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.6"
11
11
  }
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Codex plugin for the owenloop workflow engine.",
5
5
  "skills": "./skills/",
6
6
  "mcpServers": "./.mcp.json"
@@ -6,7 +6,7 @@
6
6
  "mcp"
7
7
  ],
8
8
  "env": {
9
- "OWENLOOP_PLUGIN_VERSION": "0.5.4"
9
+ "OWENLOOP_PLUGIN_VERSION": "0.5.6"
10
10
  },
11
11
  "env_vars": [
12
12
  "HOME",