owenloop 0.5.3 → 0.5.4
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 +17 -0
- package/README.md +6 -2
- package/dist/packages/work/src/agent/brief.d.ts +6 -0
- package/dist/packages/work/src/agent/brief.js +46 -2
- package/dist/packages/work/src/agent/loop.js +3 -0
- package/dist/packages/work/src/exec/loop.js +153 -9
- package/dist/packages/work/src/harness/child-env.js +8 -0
- package/dist/packages/work/src/harness/claude.js +18 -5
- package/dist/packages/work/src/harness/codex.js +7 -0
- package/dist/packages/work/src/harness/contract.d.ts +22 -3
- package/dist/packages/work/src/harness/contract.js +22 -3
- package/dist/packages/work/src/settings/settings.d.ts +12 -4
- package/dist/packages/work/src/settings/settings.js +14 -11
- package/dist/src/cli.js +203 -6
- package/dist/src/config-dir.d.ts +62 -0
- package/dist/src/config-dir.js +87 -0
- package/dist/src/crypto/trust-roots.d.ts +8 -4
- package/dist/src/crypto/trust-roots.js +18 -12
- package/dist/src/defs.js +57 -16
- package/dist/src/engine.js +25 -3
- package/dist/src/hub.d.ts +5 -1
- package/dist/src/hub.js +7 -8
- package/dist/src/paths.d.ts +47 -4
- package/dist/src/paths.js +36 -5
- package/dist/src/work-settings.d.ts +8 -5
- package/dist/src/work-settings.js +15 -12
- package/docs/authoring.md +40 -13
- package/docs/bundles.md +9 -0
- package/docs/cli.md +121 -24
- package/docs/crypto.md +8 -8
- package/docs/design.md +20 -2
- package/docs/embedding.md +5 -4
- package/docs/wire-contracts.md +3 -2
- package/package.json +1 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.5.4](https://github.com/typicalday/owenloop/compare/v0.5.3...v0.5.4) (2026-08-15)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add `owenloop cancel` to stop a running hub instance ([#158](https://github.com/typicalday/owenloop/issues/158)) ([76ccc75](https://github.com/typicalday/owenloop/commit/76ccc75cf4b1c9312484e691663f9e5c9e1ebe9a))
|
|
13
|
+
* add `owenloop instance show` to read a hub run's live state ([#161](https://github.com/typicalday/owenloop/issues/161)) ([9ab7cec](https://github.com/typicalday/owenloop/commit/9ab7cec6f72dc79c11c2c7079174f9581ff97304))
|
|
14
|
+
* let workdirFrom name a declared input, not only a consume ([#165](https://github.com/typicalday/owenloop/issues/165)) ([fff886b](https://github.com/typicalday/owenloop/commit/fff886b86c097a1b85de745faa322cf92d0e5615))
|
|
15
|
+
* state the submit contract in every rendered brief ([#160](https://github.com/typicalday/owenloop/issues/160)) ([f62430d](https://github.com/typicalday/owenloop/commit/f62430d1febc77597cafb25e8b2928f1ab7e7fb3))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* deliver a payload reject before the owed submits, not after ([#164](https://github.com/typicalday/owenloop/issues/164)) ([b38b709](https://github.com/typicalday/owenloop/commit/b38b709aededd0ebef2684f8c64abb8fe68226de))
|
|
21
|
+
* relay a failed command step's own output to the exec log ([#162](https://github.com/typicalday/owenloop/issues/162)) ([d40595d](https://github.com/typicalday/owenloop/commit/d40595dbfe40bfbf6f5d729296189e5b88424eec))
|
|
22
|
+
* scope owenloop's config dir without hijacking XDG_CONFIG_HOME ([#163](https://github.com/typicalday/owenloop/issues/163)) ([72838b4](https://github.com/typicalday/owenloop/commit/72838b45e3fb6f52038001148bca62f879a90efc))
|
|
23
|
+
|
|
7
24
|
## [0.5.3](https://github.com/typicalday/owenloop/compare/v0.5.2...v0.5.3) (2026-08-14)
|
|
8
25
|
|
|
9
26
|
|
package/README.md
CHANGED
|
@@ -487,8 +487,12 @@ hub's own def hashes. `owenloop agent new
|
|
|
487
487
|
Setting up a machine from scratch? `owenloop setup` may sign you in as a human
|
|
488
488
|
and, when needed, mint or rekey and store a Scoped Identity. Setup writes only
|
|
489
489
|
`hubOrigin` into the execution settings file, preserving the other keys. The
|
|
490
|
-
file is `$
|
|
491
|
-
|
|
490
|
+
file is `$OWENLOOP_CONFIG_DIR/settings.json` when `OWENLOOP_CONFIG_DIR` is set
|
|
491
|
+
to a non-blank absolute path; otherwise `$XDG_CONFIG_HOME/owenloop/settings.json`
|
|
492
|
+
when `XDG_CONFIG_HOME` is non-blank; otherwise
|
|
493
|
+
`$HOME/.config/owenloop/settings.json`. Prefer `OWENLOOP_CONFIG_DIR` when
|
|
494
|
+
running several shifts on one machine — `XDG_CONFIG_HOME` also relocates `gh`,
|
|
495
|
+
`git`, and `gcloud` for every command step the shift dispatches. For
|
|
492
496
|
a non-default account,
|
|
493
497
|
setup only prints the `OWENLOOP_ACCOUNT=<name>` instruction. Setup probes and,
|
|
494
498
|
when needed, converges the bundled `owenloop` plugins for Claude Code and Codex.
|
|
@@ -69,6 +69,12 @@ export interface BriefSpec {
|
|
|
69
69
|
* repeated rejections, not a first attempt.
|
|
70
70
|
*/
|
|
71
71
|
escalated?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The owed output paths for this order, in packet order — `packet.owes`
|
|
74
|
+
* mapped to its `path`. Feeds the submit contract; absent or empty renders
|
|
75
|
+
* the contract without naming any path.
|
|
76
|
+
*/
|
|
77
|
+
owes?: readonly string[];
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Substitute the four dispatch tokens into a step template.
|
|
@@ -28,8 +28,52 @@ export function renderBrief(templateContent, spec) {
|
|
|
28
28
|
.join(spec.account)
|
|
29
29
|
.split(SHIFT_TOKEN)
|
|
30
30
|
.join(spec.shiftId ?? '');
|
|
31
|
-
const
|
|
32
|
-
return
|
|
31
|
+
const blocks = [renderRoutingLine(spec), renderSubmitContract(spec), substituted];
|
|
32
|
+
return blocks.filter((b) => b !== '').join('\n\n');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* How an order is COMPLETED, stated to every agent on every run.
|
|
36
|
+
*
|
|
37
|
+
* WHY THIS EXISTS. Nothing else ever told an agent that finishing means calling
|
|
38
|
+
* a tool. The engine mounts the work-holder MCP server and then relies entirely
|
|
39
|
+
* on the def author's prose; owenloop's own house verb for it is "green <path>
|
|
40
|
+
* with <value>", which names no tool and is not a phrase any model has seen
|
|
41
|
+
* before. A strong enough model infers the tool call from the mounted surface
|
|
42
|
+
* and submits; a weaker one reads the same sentence as "print this JSON",
|
|
43
|
+
* writes the value into a code fence, and ends its turn. The hub then records
|
|
44
|
+
* nothing, the confirm grace lapses, and the order is re-offered — so the step
|
|
45
|
+
* loops forever while every attempt does the work correctly. That is a defect
|
|
46
|
+
* in what the engine states, not in the def or the model: the engine is the
|
|
47
|
+
* only party that knows the submit contract, so the engine has to state it.
|
|
48
|
+
*
|
|
49
|
+
* WHY IT NAMES THE OWED PATHS. `submit` is per-path and takes the path as an
|
|
50
|
+
* argument, so "call submit" alone is not actionable — an agent that owes two
|
|
51
|
+
* outputs and submits one is as stuck as one that submits none. The list comes
|
|
52
|
+
* from `packet.owes`, which is the hub's own answer to "what does this order
|
|
53
|
+
* still owe", so it stays correct on a re-offer where some paths are already
|
|
54
|
+
* paid.
|
|
55
|
+
*
|
|
56
|
+
* WHY THE COUNTER-EXAMPLE IS SPELLED OUT. The observed failure is not a refusal
|
|
57
|
+
* to submit — it is a belief that printing IS submitting. Naming the tool
|
|
58
|
+
* without ruling out the near-miss leaves that belief intact.
|
|
59
|
+
*
|
|
60
|
+
* Vendor-neutral by construction: it names owenloop's own tool and mount, and
|
|
61
|
+
* no harness. `test/vendor-gate.test.ts` fails any shipped file outside
|
|
62
|
+
* `src/harness/` that names a vendor.
|
|
63
|
+
*/
|
|
64
|
+
function renderSubmitContract(spec) {
|
|
65
|
+
const owed = (spec.owes ?? []).filter((p) => p !== '');
|
|
66
|
+
// Nothing owed, nothing to say — the same stance the routing line takes on an
|
|
67
|
+
// absent modifier. A contract with no path to name would have to write
|
|
68
|
+
// `<path>` into its own example, which teaches the shape of the call while
|
|
69
|
+
// leaving the one argument that matters unanswered.
|
|
70
|
+
if (owed.length === 0)
|
|
71
|
+
return '';
|
|
72
|
+
return [
|
|
73
|
+
`How this order completes: submit your result with the \`submit\` tool on the mounted \`owenloop\` MCP server. You owe ${owed.map((p) => `\`${p}\``).join(', ')} — call it once for each.`,
|
|
74
|
+
`Example: \`submit({"path": "${owed[0]}", "value": <the value this brief asks for>})\`.`,
|
|
75
|
+
'Printing that value as text, or inside a code fence, does NOT submit it — the turn ends, the hub records nothing, and this order is re-offered from scratch. Wherever this brief says "green <path> with <value>", it means exactly this tool call.',
|
|
76
|
+
].join('\n');
|
|
33
77
|
}
|
|
34
78
|
/**
|
|
35
79
|
* The run's depth, stated to the agent in one line, PREPENDED rather than
|
|
@@ -402,6 +402,9 @@ export function createAgentRunLoop(opts) {
|
|
|
402
402
|
// statement about the RUN, and a shift has no say in it.
|
|
403
403
|
...(packet.modifier !== undefined ? { modifier: packet.modifier } : {}),
|
|
404
404
|
...(packet.escalated === true ? { escalated: true } : {}),
|
|
405
|
+
// The hub's own answer to "what does this order still owe", so the submit
|
|
406
|
+
// contract names the right paths on a re-offer where some are already paid.
|
|
407
|
+
owes: packet.owes.map((owed) => owed.path),
|
|
405
408
|
};
|
|
406
409
|
// Permissions arrive PRE-NORMALIZED in the spec. `prepare` ran
|
|
407
410
|
// `normalizeStepPermissions` over the step's `x.harness` options at cache
|
|
@@ -20,9 +20,12 @@
|
|
|
20
20
|
* 3. RUN + RACE — the runner shells the command out while the lease loop runs.
|
|
21
21
|
* Whichever settles first wins (plan decision 9):
|
|
22
22
|
* - an ordinary command settles (any exit code, or a machinery error) ⇒
|
|
23
|
-
* build a receipt
|
|
24
|
-
*
|
|
25
|
-
* the receipt
|
|
23
|
+
* build a receipt. A payload reject is delivered FIRST (the hub refuses
|
|
24
|
+
* a reject once the claim has closed, and the last owed submit is what
|
|
25
|
+
* closes it); then `submit` the receipt to every owed path, unless that
|
|
26
|
+
* reject closed the run, in which case the owed paths stay debts. Exit 0
|
|
27
|
+
* means the receipt/reject delivery won; the receipt's exit code still
|
|
28
|
+
* carries the command result.
|
|
26
29
|
* - a judge command exits 0 ⇒ submit its receipt; a non-zero exit ⇒ send
|
|
27
30
|
* `reject` for `order.judge` without a receipt; signal or machinery
|
|
28
31
|
* failure ⇒ no verdict, leave the claim for the reap path.
|
|
@@ -243,6 +246,102 @@ export function createExecLoop(opts) {
|
|
|
243
246
|
return 'reject-failed';
|
|
244
247
|
}
|
|
245
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Deliver a PAYLOAD reject before the owed submits, and say whether this
|
|
251
|
+
* worker is finished.
|
|
252
|
+
*
|
|
253
|
+
* The distinction from `issueReject` is the third outcome. A judge reject is
|
|
254
|
+
* always the end of the run; a payload reject may leave the claim open, and
|
|
255
|
+
* when it does the owed receipts still have to land. So this returns either a
|
|
256
|
+
* terminal `ExecOutcome` or the sentinel `'continue'`.
|
|
257
|
+
*
|
|
258
|
+
* refused / threw → terminal. `issueReject` has already logged it and
|
|
259
|
+
* settled the lease. Nothing is submitted: a reject that
|
|
260
|
+
* did not land must not be followed by a receipt that
|
|
261
|
+
* greens the path the reject was protesting.
|
|
262
|
+
* landed, closed → terminal `'rejected'`. The rejected path was consumed
|
|
263
|
+
* by this firing, the hub closed the run `no_work`, and
|
|
264
|
+
* the owed paths stay debts for the next firing.
|
|
265
|
+
* landed, still open → `'continue'`. The rejected path was not consumed
|
|
266
|
+
* here, so the claim and the consume fingerprint are
|
|
267
|
+
* both intact and every owed submit proceeds normally.
|
|
268
|
+
*
|
|
269
|
+
* `closed` is read from the hub's own response rather than re-derived from the
|
|
270
|
+
* order, because the consumed-input test lives in the hub
|
|
271
|
+
* (`reject-artifact.ts` checks `runRow.fingerprint`, which is what the engine
|
|
272
|
+
* recorded at claim time — not what the def declares the step consumes).
|
|
273
|
+
*/
|
|
274
|
+
async function relayPayloadReject(path, text, owed) {
|
|
275
|
+
let res;
|
|
276
|
+
try {
|
|
277
|
+
res = await hub.reject({ workflow, run: runId, path, text });
|
|
278
|
+
}
|
|
279
|
+
catch (e) {
|
|
280
|
+
opts.err(`owenloop work exec: reject of ${path} failed: ${errMsg(e)}`);
|
|
281
|
+
// Nothing has been submitted yet, so unlike the post-submit case there
|
|
282
|
+
// are no committed receipts to reason about. Release and let the step be
|
|
283
|
+
// re-offered.
|
|
284
|
+
lease.stop('reject-failed');
|
|
285
|
+
await leasePromise;
|
|
286
|
+
return 'reject-failed';
|
|
287
|
+
}
|
|
288
|
+
if (res.ok !== true) {
|
|
289
|
+
opts.err(`owenloop work exec: reject of ${path} was refused: ${res.text}`);
|
|
290
|
+
lease.stop('reject-failed', res.closed === true ? { release: false } : undefined);
|
|
291
|
+
await leasePromise;
|
|
292
|
+
return 'reject-failed';
|
|
293
|
+
}
|
|
294
|
+
if (res.closed === true) {
|
|
295
|
+
opts.out(`owenloop work exec: rejected ${path} — run closed, ${owed} owed path(s) left as debts`);
|
|
296
|
+
lease.stop('rejected', { release: false });
|
|
297
|
+
await leasePromise;
|
|
298
|
+
return 'rejected';
|
|
299
|
+
}
|
|
300
|
+
opts.out(`owenloop work exec: rejected ${path} (not consumed by this firing) — submitting owed receipts`);
|
|
301
|
+
return 'continue';
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Relay the child's own output to this process's stderr when the command did
|
|
305
|
+
* not succeed.
|
|
306
|
+
*
|
|
307
|
+
* ## Why this exists
|
|
308
|
+
*
|
|
309
|
+
* Until this was added, a command step that failed produced a worker log that
|
|
310
|
+
* named the failure and said NOTHING about its cause. The runner captures the
|
|
311
|
+
* last 4 KiB of combined stdout+stderr as `outputTail` and puts it in the
|
|
312
|
+
* receipt — but a receipt only reaches a human if the submit is ACCEPTED, and
|
|
313
|
+
* the most common command-step failure is precisely the one where it is not:
|
|
314
|
+
* the script dies before printing a payload line, so the receipt has no
|
|
315
|
+
* `payload` key and `merge`'s schema rejects it. The one artifact carrying the
|
|
316
|
+
* diagnosis was discarded by the same event that made it necessary.
|
|
317
|
+
*
|
|
318
|
+
* Measured on `wf_40bd0c3f6783f9d31291d74d`: the `merger` step failed four
|
|
319
|
+
* times across two shifts and one foreground `owenloop work exec`, and every
|
|
320
|
+
* one of those logs contained the same three lines — holding, running,
|
|
321
|
+
* schema-rejected — with no trace of what the child said. Reproducing the
|
|
322
|
+
* script by hand outside the engine was the only way to see its stderr.
|
|
323
|
+
*
|
|
324
|
+
* `outputTail` is already capped at 4 KiB by the runner, so this cannot flood
|
|
325
|
+
* a log. Each line is prefixed so the child's words are never mistaken for
|
|
326
|
+
* exec's own.
|
|
327
|
+
*/
|
|
328
|
+
function relayChildOutput(result, step) {
|
|
329
|
+
if (result.exitCode === 0 && result.error === undefined)
|
|
330
|
+
return;
|
|
331
|
+
const how = result.error !== undefined
|
|
332
|
+
? `could not be run (${result.error})`
|
|
333
|
+
: result.signal !== undefined
|
|
334
|
+
? `was killed by ${result.signal}`
|
|
335
|
+
: `exited ${result.exitCode}`;
|
|
336
|
+
opts.err(`owenloop work exec: the command for step '${step}' ${how}; its last output follows`);
|
|
337
|
+
const tail = result.outputTail.replace(/\n+$/, '');
|
|
338
|
+
if (tail === '') {
|
|
339
|
+
opts.err(' (the command produced no output)');
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
for (const line of tail.split('\n'))
|
|
343
|
+
opts.err(` | ${line}`);
|
|
344
|
+
}
|
|
246
345
|
/** Build the receipt and submit it to every owed path. */
|
|
247
346
|
async function submitReceipt(result, order, resolvedCommand) {
|
|
248
347
|
if (signalled) {
|
|
@@ -255,6 +354,9 @@ export function createExecLoop(opts) {
|
|
|
255
354
|
await leasePromise;
|
|
256
355
|
return 'killed';
|
|
257
356
|
}
|
|
357
|
+
// Before any of the branches below decide what to do about the failure.
|
|
358
|
+
// Every one of them is reachable with a useless log otherwise.
|
|
359
|
+
relayChildOutput(result, order.step);
|
|
258
360
|
const parsedPayload = parsePayloadLine(result.payloadLine, result.payloadOverCap);
|
|
259
361
|
if (order.judge !== undefined) {
|
|
260
362
|
if (result.exitCode === null) {
|
|
@@ -286,6 +388,54 @@ export function createExecLoop(opts) {
|
|
|
286
388
|
run: runId,
|
|
287
389
|
step: order.step,
|
|
288
390
|
}, parsedPayload);
|
|
391
|
+
// ---- the payload reject goes FIRST, and it is not an ordering nicety ----
|
|
392
|
+
//
|
|
393
|
+
// It used to run after every owed submit, on the reasoning that "all owed
|
|
394
|
+
// submissions must land before invalidating a consumed input; rejection
|
|
395
|
+
// moves the consume fingerprint and would born-reject later submits from
|
|
396
|
+
// this run". The second half of that sentence is true. The first half made
|
|
397
|
+
// the reject UNDELIVERABLE, because the submits it waited on are what kill
|
|
398
|
+
// the claim it needs.
|
|
399
|
+
//
|
|
400
|
+
// The hub refuses a reject from a run whose claim has closed
|
|
401
|
+
// (`hub-core/src/verbs/reject-artifact.ts`: `held` requires
|
|
402
|
+
// `runRow.outcome === undefined`, and the refusal is explicit —
|
|
403
|
+
// "is not currently held by an open claim — nothing was rejected"). A step's
|
|
404
|
+
// last owed submit closes the run. So for the single-owed-path case — which
|
|
405
|
+
// is every gate in the delivery workflow — submit-then-reject could only
|
|
406
|
+
// ever produce the pair observed on `run_ecfedb23a84194e446159e67`:
|
|
407
|
+
//
|
|
408
|
+
// submitted receipt to mergeable (green)
|
|
409
|
+
// reject of pr was refused: ... is not currently held by an open claim
|
|
410
|
+
//
|
|
411
|
+
// The gate greened its own output and its reject evaporated, so `merger`
|
|
412
|
+
// proceeded on a PR the gate had explicitly refused to confirm. The def-side
|
|
413
|
+
// cascade that was supposed to un-green `mergeable` never fired, because it
|
|
414
|
+
// hangs off a `pr` rejection that never happened.
|
|
415
|
+
//
|
|
416
|
+
// Rejecting first is correct in both directions, and which one applies is
|
|
417
|
+
// the hub's answer, not a guess:
|
|
418
|
+
//
|
|
419
|
+
// `closed: true` — the rejected path WAS one of this firing's consumed
|
|
420
|
+
// inputs, so the hub closed the run `no_work` (not `failed`: no attempt
|
|
421
|
+
// is burned). The owed paths stay debts and the step re-fires against the
|
|
422
|
+
// rebuilt input. Skipping the submits here is not a loss — an artifact
|
|
423
|
+
// derived from an input this same command just declared bad is exactly
|
|
424
|
+
// what the engine's dead-input cascade would have thrown away anyway.
|
|
425
|
+
// This is also the branch that makes the old born-reject warning moot:
|
|
426
|
+
// there are no later submits to born-reject.
|
|
427
|
+
//
|
|
428
|
+
// `closed: false` — the rejected path was NOT consumed by this firing, so
|
|
429
|
+
// the claim is still open and the fingerprint has not moved. Fall through
|
|
430
|
+
// and submit every owed path exactly as before.
|
|
431
|
+
//
|
|
432
|
+
// A REFUSED reject now submits nothing. That is the point: previously the
|
|
433
|
+
// receipt had already landed and greened a path whose gate had failed.
|
|
434
|
+
if (order.judge === undefined && parsedPayload.reject !== undefined) {
|
|
435
|
+
const rejected = await relayPayloadReject(parsedPayload.reject.path, parsedPayload.reject.text, order.owes.length);
|
|
436
|
+
if (rejected !== 'continue')
|
|
437
|
+
return rejected;
|
|
438
|
+
}
|
|
289
439
|
for (const owe of order.owes) {
|
|
290
440
|
let res;
|
|
291
441
|
try {
|
|
@@ -332,12 +482,6 @@ export function createExecLoop(opts) {
|
|
|
332
482
|
}
|
|
333
483
|
opts.out(`owenloop work exec: submitted receipt to ${owe.path} (${outcome})`);
|
|
334
484
|
}
|
|
335
|
-
if (order.judge === undefined && parsedPayload.reject !== undefined) {
|
|
336
|
-
// All owed submissions must land before invalidating a consumed input;
|
|
337
|
-
// rejection moves the consume fingerprint and would born-reject later
|
|
338
|
-
// submits from this run.
|
|
339
|
-
return issueReject(parsedPayload.reject.path, parsedPayload.reject.text, 'rejected');
|
|
340
|
-
}
|
|
341
485
|
// Every owed path landed — the run has closed, so stop WITHOUT releasing.
|
|
342
486
|
lease.stop('submitted', { release: false });
|
|
343
487
|
await leasePromise;
|
|
@@ -108,6 +108,14 @@ export const ADMITTED_OWENLOOP_KEYS = new Set([
|
|
|
108
108
|
'OWENLOOP_NO_KEYCHAIN',
|
|
109
109
|
// `holdSession` — src/roles/hold.ts. The fallback when `--session` is absent.
|
|
110
110
|
'OWENLOOP_SESSION',
|
|
111
|
+
// `owenloopConfigDir` — src/config-dir.ts. Scopes owenloop's OWN config
|
|
112
|
+
// directory (`settings.json`, `credentials.json`, `allowed_signers`) without
|
|
113
|
+
// touching `XDG_CONFIG_HOME`, which the rest of the operator's toolchain also
|
|
114
|
+
// reads. A path, not credential material — but the credential FILE backend
|
|
115
|
+
// resolves under it (`readStoredCredential` → `configDir` → src/hub.ts), so a
|
|
116
|
+
// mount that does not see this variable falls back to `XDG_CONFIG_HOME` and
|
|
117
|
+
// reads a DIFFERENT credential store than the shift that spawned it.
|
|
118
|
+
'OWENLOOP_CONFIG_DIR',
|
|
111
119
|
]);
|
|
112
120
|
/** The namespace this filter governs. Nothing outside it is ever touched. */
|
|
113
121
|
const NAMESPACE = 'OWENLOOP_';
|
|
@@ -186,11 +186,24 @@ const PERMISSION_MODES = [
|
|
|
186
186
|
* `canUseTool` callback — a human decision point — and denies when no callback
|
|
187
187
|
* is wired. That is the "human is the gate" position.
|
|
188
188
|
* - `auto-safe` → `auto`. `auto` is the SDK's model-classifier mode: it decides
|
|
189
|
-
* per call
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
189
|
+
* per call, with no prompt. NOT `acceptEdits`, which auto-approves filesystem
|
|
190
|
+
* operations by category and applies no judgment to anything else, and NOT
|
|
191
|
+
* `dontAsk`, which DENIES an unapproved tool rather than consulting anyone —
|
|
192
|
+
* silently narrower than what the step asked for.
|
|
193
|
+
*
|
|
194
|
+
* MEASURED against SDK 0.3.220, `canUseTool` wired throughout: the classifier
|
|
195
|
+
* consulted the host on NONE of five probe commands, and emitted no
|
|
196
|
+
* `permission_denied` system message for any of them. Four ran, including
|
|
197
|
+
* `rm -rf` on an ABSOLUTE path outside the session cwd (verified by the
|
|
198
|
+
* target directory being gone afterwards), a `curl` to the public internet,
|
|
199
|
+
* and a read of a file under `$HOME` outside cwd.
|
|
200
|
+
*
|
|
201
|
+
* So `auto` does not, in practice, escalate to whoever hosts the session.
|
|
202
|
+
* Wiring `canUseTool` does not give `auto-safe` a human exception path — the
|
|
203
|
+
* callback is simply never reached. Anything that needs a person in the loop
|
|
204
|
+
* has to run under `ask`, whose `default` mode does route to the callback
|
|
205
|
+
* (measured on the same SDK build, including calls originating inside a
|
|
206
|
+
* subagent, which arrive carrying that subagent's `agentID`).
|
|
194
207
|
* - `full-access` → `bypassPermissions`. The only SDK mode that runs tools with
|
|
195
208
|
* no prompt at all, and the one the companion flag below exists for.
|
|
196
209
|
*
|
|
@@ -264,6 +264,13 @@ function isPlainMap(v) {
|
|
|
264
264
|
* keeps this list a complete statement of what the child needs.
|
|
265
265
|
*/
|
|
266
266
|
const MOUNT_ENV_KEEP = ['HOME', 'XDG_CONFIG_HOME', 'XDG_STATE_HOME', 'XDG_CACHE_HOME'];
|
|
267
|
+
/**
|
|
268
|
+
* `OWENLOOP_CONFIG_DIR` rides the `OWENLOOP_*` allowlist below rather than this
|
|
269
|
+
* list, but it belongs to the same job: without it a mount whose parent scoped
|
|
270
|
+
* owenloop's config with `OWENLOOP_CONFIG_DIR` would fall back to
|
|
271
|
+
* `XDG_CONFIG_HOME` and read a DIFFERENT settings file than the shift that
|
|
272
|
+
* spawned it.
|
|
273
|
+
*/
|
|
267
274
|
/**
|
|
268
275
|
* The environment for the owenloop mount, forwarded from THIS process.
|
|
269
276
|
*
|
|
@@ -138,9 +138,28 @@ export interface StepPermissions {
|
|
|
138
138
|
* - `full-access` — nothing is gated. The harness never consults a human, and
|
|
139
139
|
* a failed action is simply reported back to the model.
|
|
140
140
|
*
|
|
141
|
-
* `auto-safe` is NOT a milder `full-access`: it
|
|
142
|
-
* headless step that must not stall wants
|
|
143
|
-
* separately so that choice is stated rather
|
|
141
|
+
* `auto-safe` is NOT a milder `full-access`: the position it names still has a
|
|
142
|
+
* human exception path. A headless step that must not stall wants
|
|
143
|
+
* `full-access`, and the two exist separately so that choice is stated rather
|
|
144
|
+
* than inferred.
|
|
145
|
+
*
|
|
146
|
+
* WHAT `auto-safe` COSTS YOU TODAY, MEASURED. The three positions above
|
|
147
|
+
* describe the vocabulary, not a guarantee about how far any given classifier
|
|
148
|
+
* actually goes before it consults someone. On one shipped adapter the
|
|
149
|
+
* classifier was probed with five actions — among them a recursive delete on an
|
|
150
|
+
* absolute path outside the session working directory, an outbound network
|
|
151
|
+
* request, and a read of a file outside that directory — and it consulted the
|
|
152
|
+
* host on none of them and reported no auto-denial for any of them; four ran.
|
|
153
|
+
* On the other, the position that maps to `auto-safe` keys its judgment on
|
|
154
|
+
* filesystem access being restricted, so a step that also declares
|
|
155
|
+
* `filesystem: unrestricted` moves it close to `full-access` as well.
|
|
156
|
+
*
|
|
157
|
+
* The practical consequence for a definition author: choosing `auto-safe`
|
|
158
|
+
* because you want a person consulted on the dangerous cases may get you
|
|
159
|
+
* neither the prompt nor a record that one was skipped. Choose `ask` when a
|
|
160
|
+
* human decision genuinely has to happen, and `full-access` when it genuinely
|
|
161
|
+
* must not. Treat `auto-safe` as the classifier's own judgment with no
|
|
162
|
+
* guaranteed appeal, not as a supervised `full-access`.
|
|
144
163
|
*
|
|
145
164
|
* `ask` and `auto-safe` are meaningful only where something can answer a
|
|
146
165
|
* prompt. In a Shift-dispatched run nothing can, so a prompt is a stall: the
|
|
@@ -24,9 +24,28 @@
|
|
|
24
24
|
* - `full-access` — nothing is gated. The harness never consults a human, and
|
|
25
25
|
* a failed action is simply reported back to the model.
|
|
26
26
|
*
|
|
27
|
-
* `auto-safe` is NOT a milder `full-access`: it
|
|
28
|
-
* headless step that must not stall wants
|
|
29
|
-
* separately so that choice is stated rather
|
|
27
|
+
* `auto-safe` is NOT a milder `full-access`: the position it names still has a
|
|
28
|
+
* human exception path. A headless step that must not stall wants
|
|
29
|
+
* `full-access`, and the two exist separately so that choice is stated rather
|
|
30
|
+
* than inferred.
|
|
31
|
+
*
|
|
32
|
+
* WHAT `auto-safe` COSTS YOU TODAY, MEASURED. The three positions above
|
|
33
|
+
* describe the vocabulary, not a guarantee about how far any given classifier
|
|
34
|
+
* actually goes before it consults someone. On one shipped adapter the
|
|
35
|
+
* classifier was probed with five actions — among them a recursive delete on an
|
|
36
|
+
* absolute path outside the session working directory, an outbound network
|
|
37
|
+
* request, and a read of a file outside that directory — and it consulted the
|
|
38
|
+
* host on none of them and reported no auto-denial for any of them; four ran.
|
|
39
|
+
* On the other, the position that maps to `auto-safe` keys its judgment on
|
|
40
|
+
* filesystem access being restricted, so a step that also declares
|
|
41
|
+
* `filesystem: unrestricted` moves it close to `full-access` as well.
|
|
42
|
+
*
|
|
43
|
+
* The practical consequence for a definition author: choosing `auto-safe`
|
|
44
|
+
* because you want a person consulted on the dangerous cases may get you
|
|
45
|
+
* neither the prompt nor a record that one was skipped. Choose `ask` when a
|
|
46
|
+
* human decision genuinely has to happen, and `full-access` when it genuinely
|
|
47
|
+
* must not. Treat `auto-safe` as the classifier's own judgment with no
|
|
48
|
+
* guaranteed appeal, not as a supervised `full-access`.
|
|
30
49
|
*
|
|
31
50
|
* `ask` and `auto-safe` are meaningful only where something can answer a
|
|
32
51
|
* prompt. In a Shift-dispatched run nothing can, so a prompt is a stall: the
|
|
@@ -154,10 +154,18 @@ export interface SettingsInspection extends ValidatedSettings {
|
|
|
154
154
|
exists: boolean;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
* Resolve the settings file path from the caller's env
|
|
158
|
-
* `$
|
|
159
|
-
* non-
|
|
160
|
-
*
|
|
157
|
+
* Resolve the settings file path from the caller's env, through the one shared
|
|
158
|
+
* ladder in `src/config-dir.ts`: `$OWENLOOP_CONFIG_DIR/settings.json` when
|
|
159
|
+
* `OWENLOOP_CONFIG_DIR` is set and non-blank (it must be absolute), else
|
|
160
|
+
* `$XDG_CONFIG_HOME/owenloop/settings.json`, else
|
|
161
|
+
* `$HOME/.config/owenloop/settings.json`. Throws when no rung yields a value
|
|
162
|
+
* rather than guessing a home directory.
|
|
163
|
+
*
|
|
164
|
+
* `OWENLOOP_CONFIG_DIR` is the variable an operator running SEVERAL shifts on
|
|
165
|
+
* one machine should reach for. Setting `XDG_CONFIG_HOME` per shift also works,
|
|
166
|
+
* but a shift spreads its whole environment into every worker and every command
|
|
167
|
+
* step's child, so relocating `XDG_CONFIG_HOME` relocates the config of `gh`,
|
|
168
|
+
* `git`, `gcloud`, and everything else those steps shell out to.
|
|
161
169
|
*/
|
|
162
170
|
export declare function settingsPath(env: Record<string, string | undefined>): string;
|
|
163
171
|
/**
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { existsSync, readFileSync } from 'node:fs';
|
|
16
16
|
import { join } from 'node:path';
|
|
17
|
+
import { owenloopConfigDir } from "../../../../src/config-dir.js";
|
|
17
18
|
import { validateCapabilityModels } from "../agent/capability-model.js";
|
|
18
19
|
/** The known settings keys, in the order `owenloop work settings` prints them. */
|
|
19
20
|
export const KNOWN_SETTINGS_KEYS = [
|
|
@@ -42,19 +43,21 @@ export const KNOWN_SETTINGS_KEYS = [
|
|
|
42
43
|
*/
|
|
43
44
|
export const RETIRED_IGNORED_KEYS = ['escalateAt', 'escalationExtensionKey'];
|
|
44
45
|
/**
|
|
45
|
-
* Resolve the settings file path from the caller's env
|
|
46
|
-
* `$
|
|
47
|
-
* non-
|
|
48
|
-
*
|
|
46
|
+
* Resolve the settings file path from the caller's env, through the one shared
|
|
47
|
+
* ladder in `src/config-dir.ts`: `$OWENLOOP_CONFIG_DIR/settings.json` when
|
|
48
|
+
* `OWENLOOP_CONFIG_DIR` is set and non-blank (it must be absolute), else
|
|
49
|
+
* `$XDG_CONFIG_HOME/owenloop/settings.json`, else
|
|
50
|
+
* `$HOME/.config/owenloop/settings.json`. Throws when no rung yields a value
|
|
51
|
+
* rather than guessing a home directory.
|
|
52
|
+
*
|
|
53
|
+
* `OWENLOOP_CONFIG_DIR` is the variable an operator running SEVERAL shifts on
|
|
54
|
+
* one machine should reach for. Setting `XDG_CONFIG_HOME` per shift also works,
|
|
55
|
+
* but a shift spreads its whole environment into every worker and every command
|
|
56
|
+
* step's child, so relocating `XDG_CONFIG_HOME` relocates the config of `gh`,
|
|
57
|
+
* `git`, `gcloud`, and everything else those steps shell out to.
|
|
49
58
|
*/
|
|
50
59
|
export function settingsPath(env) {
|
|
51
|
-
|
|
52
|
-
if (xdg !== undefined && xdg.trim() !== '')
|
|
53
|
-
return join(xdg, 'owenloop', 'settings.json');
|
|
54
|
-
const home = env.HOME;
|
|
55
|
-
if (home !== undefined && home.trim() !== '')
|
|
56
|
-
return join(home, '.config', 'owenloop', 'settings.json');
|
|
57
|
-
throw new Error('cannot locate a settings directory: set HOME or XDG_CONFIG_HOME');
|
|
60
|
+
return join(owenloopConfigDir(env), 'settings.json');
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
63
|
* Validate a parsed settings object. Checks the TYPE of every known key
|