owenloop 0.5.15 → 0.5.17
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 +15 -0
- package/dist/packages/work/src/agent/loop.js +71 -2
- package/dist/packages/work/src/harness/claude.d.ts +1 -1
- package/dist/packages/work/src/harness/claude.js +12 -9
- package/dist/packages/work/src/harness/codex.js +4 -1
- package/dist/packages/work/src/harness/contract.d.ts +9 -1
- package/dist/packages/work/src/harness/gatekeeper.d.ts +22 -6
- package/dist/packages/work/src/harness/gatekeeper.js +35 -27
- package/dist/packages/work/src/hub/types.d.ts +5 -0
- package/dist/packages/work/src/lease/loop.js +2 -1
- package/dist/packages/work/src/shift/loop.js +5 -4
- package/dist/src/cli.js +2 -1
- package/docs/agent-runner.md +17 -2
- package/docs/cli.md +22 -2
- package/docs/shift-logs.md +14 -0
- 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,21 @@ 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.17](https://github.com/typicalday/owenloop/compare/v0.5.16...v0.5.17) (2026-08-21)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **work:** send the release reason so an unservable order stops being silent ([#279](https://github.com/typicalday/owenloop/issues/279)) ([6bd1194](https://github.com/typicalday/owenloop/commit/6bd119449a8684fb25eae034703d8746b28f175a))
|
|
13
|
+
|
|
14
|
+
## [0.5.16](https://github.com/typicalday/owenloop/compare/v0.5.15...v0.5.16) (2026-08-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **work:** let a declared unrestricted filesystem widen the gatekeeper's read check ([#276](https://github.com/typicalday/owenloop/issues/276)) ([e353402](https://github.com/typicalday/owenloop/commit/e353402d64b57adcd03d6a727a350b918126dbe7))
|
|
20
|
+
* **work:** name capability-silent harness failures ([#272](https://github.com/typicalday/owenloop/issues/272)) ([cff319f](https://github.com/typicalday/owenloop/commit/cff319f32296ca287b37a506d01ba4df3629fdac))
|
|
21
|
+
|
|
7
22
|
## [0.5.15](https://github.com/typicalday/owenloop/compare/v0.5.14...v0.5.15) (2026-08-21)
|
|
8
23
|
|
|
9
24
|
|
|
@@ -69,6 +69,10 @@ import { resolveCapabilityCandidates, selectCandidate, } from "./capability-mode
|
|
|
69
69
|
export const DEFAULT_CONFIRM_INTERVAL_MS = 1_000;
|
|
70
70
|
/** Default confirm-phase bound: give the hub 15s to show the submit's outcome. */
|
|
71
71
|
export const DEFAULT_SUBMIT_GRACE_MS = 15_000;
|
|
72
|
+
/** Keep capability-silent release diagnostics useful without growing worker logs without bound. */
|
|
73
|
+
const HARNESS_FAILURE_TAIL_SIZE = 4;
|
|
74
|
+
const HARNESS_FAILURE_FRAGMENT_CAP = 700;
|
|
75
|
+
const HARNESS_FAILURE_TAIL_CAP = 2_000;
|
|
72
76
|
function errMsg(e) {
|
|
73
77
|
return e instanceof Error ? e.message : String(e);
|
|
74
78
|
}
|
|
@@ -268,6 +272,47 @@ export function createAgentRunLoop(opts) {
|
|
|
268
272
|
let deliveredReasonAt;
|
|
269
273
|
/** Captures a thrown safety-gate append from the synchronous `started` event. */
|
|
270
274
|
let activePersistenceFailure;
|
|
275
|
+
/** Provider-selected model, when a harness reports it after its synchronous start gate. */
|
|
276
|
+
let runtimeModel;
|
|
277
|
+
/** Recent unique harness diagnostics for the capability-silent no-submit log only. */
|
|
278
|
+
const harnessFailures = [];
|
|
279
|
+
function oneLine(text) {
|
|
280
|
+
return text.replace(/\s+/gu, ' ').trim();
|
|
281
|
+
}
|
|
282
|
+
function bounded(text) {
|
|
283
|
+
const line = oneLine(text);
|
|
284
|
+
return line.length > HARNESS_FAILURE_FRAGMENT_CAP
|
|
285
|
+
? `${line.slice(0, HARNESS_FAILURE_FRAGMENT_CAP)}…`
|
|
286
|
+
: line;
|
|
287
|
+
}
|
|
288
|
+
function rememberRuntimeModel(model) {
|
|
289
|
+
if (model === undefined)
|
|
290
|
+
return;
|
|
291
|
+
const normalized = bounded(model);
|
|
292
|
+
if (normalized !== '')
|
|
293
|
+
runtimeModel = normalized;
|
|
294
|
+
}
|
|
295
|
+
function rememberHarnessFailure(failure) {
|
|
296
|
+
if (failure === undefined)
|
|
297
|
+
return;
|
|
298
|
+
const normalized = bounded(failure);
|
|
299
|
+
if (normalized === '')
|
|
300
|
+
return;
|
|
301
|
+
const previous = harnessFailures.indexOf(normalized);
|
|
302
|
+
if (previous >= 0)
|
|
303
|
+
harnessFailures.splice(previous, 1);
|
|
304
|
+
harnessFailures.push(normalized);
|
|
305
|
+
if (harnessFailures.length > HARNESS_FAILURE_TAIL_SIZE)
|
|
306
|
+
harnessFailures.shift();
|
|
307
|
+
}
|
|
308
|
+
function harnessFailureTail() {
|
|
309
|
+
if (harnessFailures.length === 0)
|
|
310
|
+
return undefined;
|
|
311
|
+
const tail = harnessFailures.join(' | ');
|
|
312
|
+
return tail.length > HARNESS_FAILURE_TAIL_CAP
|
|
313
|
+
? `${tail.slice(0, HARNESS_FAILURE_TAIL_CAP - 1)}…`
|
|
314
|
+
: tail;
|
|
315
|
+
}
|
|
271
316
|
let resolveOrder;
|
|
272
317
|
const orderReady = new Promise((r) => {
|
|
273
318
|
resolveOrder = r;
|
|
@@ -379,6 +424,7 @@ export function createAgentRunLoop(opts) {
|
|
|
379
424
|
switch (e.kind) {
|
|
380
425
|
case 'started':
|
|
381
426
|
sessionRef = e.ref;
|
|
427
|
+
rememberRuntimeModel(e.model);
|
|
382
428
|
opts.err(`owenloop work agent-run: session started for ${order} (harness '${e.ref.harness}')`);
|
|
383
429
|
// This synchronous event is the cold-start gate. The adapter must not
|
|
384
430
|
// begin provider work until the callback returns. A thrown durable append
|
|
@@ -393,6 +439,8 @@ export function createAgentRunLoop(opts) {
|
|
|
393
439
|
}
|
|
394
440
|
return;
|
|
395
441
|
case 'progress':
|
|
442
|
+
rememberRuntimeModel(e.model);
|
|
443
|
+
rememberHarnessFailure(e.failure);
|
|
396
444
|
opts.err(`owenloop work agent-run: ${e.text}`);
|
|
397
445
|
return;
|
|
398
446
|
case 'assistant_response':
|
|
@@ -409,6 +457,10 @@ export function createAgentRunLoop(opts) {
|
|
|
409
457
|
opts.err(`owenloop work agent-run: turn ended for ${order} (telemetry — the hub decides the outcome)`);
|
|
410
458
|
return;
|
|
411
459
|
case 'exited':
|
|
460
|
+
rememberHarnessFailure(e.error);
|
|
461
|
+
if (e.error === undefined && e.exitCode !== null && e.exitCode !== 0) {
|
|
462
|
+
rememberHarnessFailure(`harness exited with code ${String(e.exitCode)}`);
|
|
463
|
+
}
|
|
412
464
|
opts.err(`owenloop work agent-run: harness exited (code ${String(e.exitCode)}${e.error !== undefined ? `, ${e.error}` : ''}) — telemetry only, ignored for the outcome`);
|
|
413
465
|
return;
|
|
414
466
|
}
|
|
@@ -610,8 +662,17 @@ export function createAgentRunLoop(opts) {
|
|
|
610
662
|
return releaseWith('incompatible-harness-policy', 'incompatible-harness-policy');
|
|
611
663
|
}
|
|
612
664
|
if (routing.kind === 'unrouted') {
|
|
613
|
-
|
|
614
|
-
|
|
665
|
+
const authoredSettings = [];
|
|
666
|
+
if (permissions.model !== undefined)
|
|
667
|
+
authoredSettings.push(`model '${permissions.model}'`);
|
|
668
|
+
if (permissions.effort !== undefined)
|
|
669
|
+
authoredSettings.push(`effort '${permissions.effort}'`);
|
|
670
|
+
const executionPolicy = authoredSettings.length === 0
|
|
671
|
+
? 'no roster model or effort override and no authored step model or effort; it will choose its own default model'
|
|
672
|
+
: `no roster model or effort override; authored step ${authoredSettings.join(' and ')} remains in effect`;
|
|
673
|
+
opts.err(`CAPABILITY-SILENT owenloop work agent-run: ${order} step '${packet.step}' declares no capabilities, so no crew roster row applies; ` +
|
|
674
|
+
`selected harness '${resolution.id}' receives ${executionPolicy} ` +
|
|
675
|
+
`(the exact runtime model id will be reported by the harness when available).`);
|
|
615
676
|
}
|
|
616
677
|
else {
|
|
617
678
|
opts.out(`owenloop work agent-run: ${order} resolved '${routing.capability}' (${routing.match} row) → ` +
|
|
@@ -826,6 +887,7 @@ export function createAgentRunLoop(opts) {
|
|
|
826
887
|
}
|
|
827
888
|
// TURN END — NOT task end. Log the failure shape for humans, then confirm.
|
|
828
889
|
if (raced.failure !== undefined) {
|
|
890
|
+
rememberHarnessFailure(errMsg(raced.failure));
|
|
829
891
|
const why = isResumeUnavailable(raced.failure)
|
|
830
892
|
? `the harness could not resume the session (${errMsg(raced.failure)})`
|
|
831
893
|
: errMsg(raced.failure);
|
|
@@ -876,6 +938,13 @@ export function createAgentRunLoop(opts) {
|
|
|
876
938
|
return 'lease-lost';
|
|
877
939
|
case 'no-submit':
|
|
878
940
|
record('dead');
|
|
941
|
+
if (routing.kind === 'unrouted') {
|
|
942
|
+
const model = runtimeModel ?? 'model id not reported by the harness';
|
|
943
|
+
const failure = harnessFailureTail() ?? 'no specific harness failure was reported';
|
|
944
|
+
opts.err(`CAPABILITY-SILENT owenloop work agent-run: ${order} step '${packet.step}' on harness '${resolution.id}' ` +
|
|
945
|
+
`reported runtime model ${model}; harness failure context: ${failure}; no submit reached the hub within the confirm grace — releasing for re-offer.`);
|
|
946
|
+
return releaseWith('capability-silent-no-submit', 'no-submit');
|
|
947
|
+
}
|
|
879
948
|
opts.err(`owenloop work agent-run: the turn ended and no submit reached the hub within the confirm grace — releasing ${order} for re-offer`);
|
|
880
949
|
// Release so the hub re-offers immediately instead of waiting out the
|
|
881
950
|
// claim TTL. This is the ONLY path that releases on a turn end.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options, Query, SDKMessage } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
-
import type
|
|
2
|
+
import { type GatePolicy } from './gatekeeper.ts';
|
|
3
3
|
import type { ApprovalRequester } from './contract.ts';
|
|
4
4
|
import type { AgentEvent, HarnessAdapter, HarnessSessionRef, StartArgs, StepPermissions } from './contract.ts';
|
|
5
5
|
/**
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { randomUUID } from 'node:crypto';
|
|
27
27
|
import { accessSync, constants, existsSync } from 'node:fs';
|
|
28
28
|
import { delimiter, join } from 'node:path';
|
|
29
|
-
import { classifyToolCall } from "./gatekeeper.js";
|
|
29
|
+
import { classifyToolCall, READ_ONLY_TOOLS } from "./gatekeeper.js";
|
|
30
30
|
import { register } from "./registry.js";
|
|
31
31
|
import { filterOwenloopEnv } from "./child-env.js";
|
|
32
32
|
import { normalizeStepPermissions, validateHarnessOptions } from "./permissions.js";
|
|
@@ -343,11 +343,11 @@ function decisionMessage(reason, note) {
|
|
|
343
343
|
* the behavior is exactly what it was before: deny, and name `ask` as the
|
|
344
344
|
* channel that does reach someone.
|
|
345
345
|
*/
|
|
346
|
-
function buildCanUseTool(cwd, policy, onEvent, approvals) {
|
|
346
|
+
function buildCanUseTool(cwd, policy, filesystem, onEvent, approvals) {
|
|
347
347
|
return async (toolName, input, options) => {
|
|
348
348
|
let verdict;
|
|
349
349
|
try {
|
|
350
|
-
verdict = classifyToolCall({ toolName, input, workdir: cwd, blockedPath: options.blockedPath }, policy);
|
|
350
|
+
verdict = classifyToolCall({ toolName, input, workdir: cwd, blockedPath: options.blockedPath, filesystem }, policy);
|
|
351
351
|
}
|
|
352
352
|
catch (err) {
|
|
353
353
|
verdict = { decision: 'escalate', reason: `the gatekeeper could not judge this call (${errText(err)})` };
|
|
@@ -402,9 +402,6 @@ function buildCanUseTool(cwd, policy, onEvent, approvals) {
|
|
|
402
402
|
}
|
|
403
403
|
/** The five-value closed union the SDK types `Options.effort` as. */
|
|
404
404
|
const EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
405
|
-
/** Audited built-ins that cannot mutate the filesystem. WebFetch/WebSearch
|
|
406
|
-
* can read the unrestricted network without weakening a read-only filesystem. */
|
|
407
|
-
const READ_ONLY_TOOLS = new Set(['Read', 'Glob', 'Grep', 'WebFetch', 'WebSearch']);
|
|
408
405
|
/** Audited built-ins allowed when only the network is restricted. */
|
|
409
406
|
const OWENLOOP_ONLY_NETWORK_TOOLS = new Set([
|
|
410
407
|
'Read',
|
|
@@ -571,12 +568,13 @@ export function buildClaudeOptions(inputs, extra) {
|
|
|
571
568
|
: mergeMcpServers(permissions.extensions['mcpServers'], inputs.owenloopMcp),
|
|
572
569
|
...(isolated ? { settingSources: [], strictMcpConfig: true, skills: [] } : {}),
|
|
573
570
|
stderr: (data) => {
|
|
574
|
-
|
|
571
|
+
const line = data.trimEnd();
|
|
572
|
+
extra.onEvent({ kind: 'progress', text: `stderr: ${line}`, failure: cap(line) });
|
|
575
573
|
},
|
|
576
574
|
// Set here, before the `permissionMode` block below, because it is not
|
|
577
575
|
// conditional on that block running: a step naming no mode at all is exactly
|
|
578
576
|
// the case that used to reach the SDK's `default` and be denied wholesale.
|
|
579
|
-
canUseTool: buildCanUseTool(inputs.cwd, gatePolicyFor(permissions.permissionMode), extra.onEvent, inputs.approvals),
|
|
577
|
+
canUseTool: buildCanUseTool(inputs.cwd, gatePolicyFor(permissions.permissionMode), permissions.filesystem, extra.onEvent, inputs.approvals),
|
|
580
578
|
};
|
|
581
579
|
// Omit the key entirely when nothing resolves — see `resolveExecutable`.
|
|
582
580
|
const executable = resolveExecutable(extra.env);
|
|
@@ -743,7 +741,11 @@ function toolResultText(content) {
|
|
|
743
741
|
function emitAssistant(message, onEvent) {
|
|
744
742
|
const from = origin(message.parent_tool_use_id);
|
|
745
743
|
if (message.error !== undefined) {
|
|
746
|
-
onEvent({
|
|
744
|
+
onEvent({
|
|
745
|
+
kind: 'progress',
|
|
746
|
+
text: `${from}assistant error: ${message.error}`,
|
|
747
|
+
failure: cap(message.error),
|
|
748
|
+
});
|
|
747
749
|
}
|
|
748
750
|
for (const block of message.message.content) {
|
|
749
751
|
switch (block.type) {
|
|
@@ -849,6 +851,7 @@ export async function consumeTurn(q, onEvent, onInit, expectedSessionId) {
|
|
|
849
851
|
text: `session ${message.session_id}: cliVersion=${message.claude_code_version} ` +
|
|
850
852
|
`model=${message.model} apiKeySource=${message.apiKeySource} ` +
|
|
851
853
|
`permissionMode=${message.permissionMode} cwd=${message.cwd} mcp=[${servers}]`,
|
|
854
|
+
model: cap(message.model),
|
|
852
855
|
});
|
|
853
856
|
onInit?.(sessionId);
|
|
854
857
|
}
|
|
@@ -912,7 +912,10 @@ async function openClient(cwd, onEvent, gate, approvals) {
|
|
|
912
912
|
// in `jsonrpc-stdio.ts`), so the reader keeps draining notifications, and no
|
|
913
913
|
// timeout wraps a server request the way `client.request` wraps ours.
|
|
914
914
|
onServerRequest: handleServerRequest(onEvent, approvals),
|
|
915
|
-
onStderr: (line) =>
|
|
915
|
+
onStderr: (line) => {
|
|
916
|
+
const text = cap(line);
|
|
917
|
+
onEvent({ kind: 'progress', text, failure: text });
|
|
918
|
+
},
|
|
916
919
|
onExit: (code, signal) => {
|
|
917
920
|
reportExit(code, signal === null ? undefined : `killed by ${signal}`);
|
|
918
921
|
// Resolve-on-turn-end means a death BEFORE `turn/completed` is a failure,
|
|
@@ -59,10 +59,18 @@ export type AgentEvent = {
|
|
|
59
59
|
/** Provider-selected model when the session-start response exposes it. */
|
|
60
60
|
model?: string;
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Optional log line. Adapters may emit none; nothing may depend on it.
|
|
64
|
+
*
|
|
65
|
+
* Model and failure fields enrich local telemetry when a provider reports them
|
|
66
|
+
* after the synchronous started-event gate. They never affect task outcome,
|
|
67
|
+
* hub confirmation, or release behavior, and adapters may omit either.
|
|
68
|
+
*/
|
|
63
69
|
| {
|
|
64
70
|
kind: 'progress';
|
|
65
71
|
text: string;
|
|
72
|
+
model?: string;
|
|
73
|
+
failure?: string;
|
|
66
74
|
}
|
|
67
75
|
/** The completed top-level assistant reply, assembled by the owning adapter.
|
|
68
76
|
* Unlike `progress`, this is suitable for a caller that explicitly needs the
|
|
@@ -49,14 +49,17 @@
|
|
|
49
49
|
* genuinely all be reviewed should say `permissionMode: ask`, which escalates
|
|
50
50
|
* every shell call without consulting the deny-list at all.
|
|
51
51
|
*/
|
|
52
|
+
import type { FilesystemPermission } from './contract.ts';
|
|
52
53
|
/**
|
|
53
54
|
* How much the gatekeeper escalates, derived by the adapter from the step's
|
|
54
55
|
* authored `permissionMode`.
|
|
55
56
|
*
|
|
56
|
-
* - `human-gate` — the `ask` position. Everything beyond a
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* - `human-gate` — the `ask` position. Everything beyond a declared-safe
|
|
58
|
+
* filesystem read escalates. Such reads are workdir-contained unless the
|
|
59
|
+
* step explicitly declares `filesystem: unrestricted` and the call belongs
|
|
60
|
+
* to the shared audited read-tool set; a harness `blockedPath` remains
|
|
61
|
+
* authoritative. The classifier is not consulted: the point of `ask` is
|
|
62
|
+
* that a person sees the call, not that a pattern list approves of it first.
|
|
60
63
|
* - `classifier` — the `auto-safe` position, and the right reading of a step
|
|
61
64
|
* that named the vendor's own `default`/`acceptEdits` or named nothing at all.
|
|
62
65
|
* Ordinary work proceeds; the checks below escalate what they can actually
|
|
@@ -86,6 +89,11 @@ export interface GateCall {
|
|
|
86
89
|
* shell commands this module deliberately does not try to parse.
|
|
87
90
|
*/
|
|
88
91
|
blockedPath?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The normalized filesystem boundary declared by the step. An explicit
|
|
94
|
+
* `unrestricted` declaration may widen audited filesystem reads only.
|
|
95
|
+
*/
|
|
96
|
+
filesystem?: FilesystemPermission;
|
|
89
97
|
}
|
|
90
98
|
/** The gatekeeper's answer. `reason` is written to be shown to a person and to
|
|
91
99
|
* the agent, so it names the specific thing that triggered it. */
|
|
@@ -95,6 +103,11 @@ export type GateVerdict = {
|
|
|
95
103
|
decision: 'escalate';
|
|
96
104
|
reason: string;
|
|
97
105
|
};
|
|
106
|
+
/** Audited built-ins that cannot mutate the filesystem. WebFetch/WebSearch
|
|
107
|
+
* can read the unrestricted network without weakening a read-only filesystem.
|
|
108
|
+
* This is the canonical audited read-tool set used by both the adapter's tool
|
|
109
|
+
* surface and the explicit unrestricted-filesystem containment exception. */
|
|
110
|
+
export declare const READ_ONLY_TOOLS: ReadonlySet<string>;
|
|
98
111
|
/**
|
|
99
112
|
* Whether `candidate` resolves inside `root`.
|
|
100
113
|
*
|
|
@@ -118,7 +131,10 @@ export declare function dangerousCommand(command: string): string | undefined;
|
|
|
118
131
|
* ORDER MATTERS. The owenloop mount is cleared first so no later rule can strand
|
|
119
132
|
* a step's ability to submit or escalate. The harness's own `blockedPath` is
|
|
120
133
|
* consulted next because it is authoritative and covers cases this module cannot
|
|
121
|
-
* see.
|
|
122
|
-
*
|
|
134
|
+
* see. Path calls then stay contained, except when an explicitly unrestricted
|
|
135
|
+
* filesystem declaration and the shared audited read-tool set both permit the
|
|
136
|
+
* exception. Only then does policy divide: `human-gate` allows declared-safe
|
|
137
|
+
* filesystem reads but escalates writes and network operations; `classifier`
|
|
138
|
+
* runs the two checks it can actually decide.
|
|
123
139
|
*/
|
|
124
140
|
export declare function classifyToolCall(call: GateCall, policy: GatePolicy): GateVerdict;
|
|
@@ -51,13 +51,11 @@
|
|
|
51
51
|
*/
|
|
52
52
|
import { isAbsolute, relative, resolve } from 'node:path';
|
|
53
53
|
const ALLOW = { decision: 'allow' };
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
const READ_ONLY_TOOLS = new Set(['Read', 'Glob', 'Grep', 'NotebookRead']);
|
|
54
|
+
/** Audited built-ins that cannot mutate the filesystem. WebFetch/WebSearch
|
|
55
|
+
* can read the unrestricted network without weakening a read-only filesystem.
|
|
56
|
+
* This is the canonical audited read-tool set used by both the adapter's tool
|
|
57
|
+
* surface and the explicit unrestricted-filesystem containment exception. */
|
|
58
|
+
export const READ_ONLY_TOOLS = new Set(['Read', 'Glob', 'Grep', 'WebFetch', 'WebSearch']);
|
|
61
59
|
/**
|
|
62
60
|
* Where each tool names a filesystem path. Only tools whose path argument is a
|
|
63
61
|
* plain string are listed: containment is checked where it can be checked, and
|
|
@@ -65,13 +63,13 @@ const READ_ONLY_TOOLS = new Set(['Read', 'Glob', 'Grep', 'NotebookRead']);
|
|
|
65
63
|
* guessed at.
|
|
66
64
|
*/
|
|
67
65
|
const PATH_ARGS = Object.freeze({
|
|
68
|
-
Read: ['file_path'],
|
|
69
|
-
Write: ['file_path'],
|
|
70
|
-
Edit: ['file_path'],
|
|
71
|
-
NotebookRead: ['notebook_path'],
|
|
72
|
-
NotebookEdit: ['notebook_path'],
|
|
73
|
-
Glob: ['path'],
|
|
74
|
-
Grep: ['path'],
|
|
66
|
+
Read: { args: ['file_path'], humanGateSafeRead: true },
|
|
67
|
+
Write: { args: ['file_path'] },
|
|
68
|
+
Edit: { args: ['file_path'] },
|
|
69
|
+
NotebookRead: { args: ['notebook_path'], humanGateSafeRead: true },
|
|
70
|
+
NotebookEdit: { args: ['notebook_path'] },
|
|
71
|
+
Glob: { args: ['path'], humanGateSafeRead: true },
|
|
72
|
+
Grep: { args: ['path'], humanGateSafeRead: true },
|
|
75
73
|
});
|
|
76
74
|
/**
|
|
77
75
|
* The owenloop MCP mount, which is ALWAYS allowed under every policy.
|
|
@@ -159,8 +157,11 @@ export function dangerousCommand(command) {
|
|
|
159
157
|
* ORDER MATTERS. The owenloop mount is cleared first so no later rule can strand
|
|
160
158
|
* a step's ability to submit or escalate. The harness's own `blockedPath` is
|
|
161
159
|
* consulted next because it is authoritative and covers cases this module cannot
|
|
162
|
-
* see.
|
|
163
|
-
*
|
|
160
|
+
* see. Path calls then stay contained, except when an explicitly unrestricted
|
|
161
|
+
* filesystem declaration and the shared audited read-tool set both permit the
|
|
162
|
+
* exception. Only then does policy divide: `human-gate` allows declared-safe
|
|
163
|
+
* filesystem reads but escalates writes and network operations; `classifier`
|
|
164
|
+
* runs the two checks it can actually decide.
|
|
164
165
|
*/
|
|
165
166
|
export function classifyToolCall(call, policy) {
|
|
166
167
|
if (call.toolName.startsWith(OWENLOOP_MCP_PREFIX))
|
|
@@ -175,22 +176,29 @@ export function classifyToolCall(call, policy) {
|
|
|
175
176
|
reason: `the harness flagged \`${call.blockedPath}\` as outside the directories this step may touch`,
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
|
-
const
|
|
179
|
+
const pathArgs = PATH_ARGS[call.toolName];
|
|
180
|
+
const paths = (pathArgs?.args ?? [])
|
|
179
181
|
.map((key) => stringArg(call.input, key))
|
|
180
182
|
.filter((p) => p !== undefined);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
// An explicit unrestricted filesystem declaration widens only the declared
|
|
184
|
+
// boundary of the shared audited read set. It does not change which operation
|
|
185
|
+
// categories the `ask` policy regards as safe.
|
|
186
|
+
if (call.filesystem !== 'unrestricted' || !READ_ONLY_TOOLS.has(call.toolName)) {
|
|
187
|
+
for (const p of paths) {
|
|
188
|
+
if (!isInside(call.workdir, p)) {
|
|
189
|
+
return {
|
|
190
|
+
decision: 'escalate',
|
|
191
|
+
reason: `\`${p}\` is outside this step's working directory (\`${call.workdir}\`)`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
196
|
if (policy === 'human-gate') {
|
|
190
|
-
// Every path this tool named is contained, or it
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
|
|
197
|
+
// Every path this tool named is contained, or it was an explicitly
|
|
198
|
+
// unrestricted audited read. A declared-safe filesystem read is the one
|
|
199
|
+
// thing `ask` lets through; anything that can mutate or reach the network
|
|
200
|
+
// is what the position exists to put in front of a person.
|
|
201
|
+
if (pathArgs?.humanGateSafeRead === true)
|
|
194
202
|
return ALLOW;
|
|
195
203
|
return {
|
|
196
204
|
decision: 'escalate',
|
|
@@ -352,6 +352,7 @@ export type ReleaseRequest = {
|
|
|
352
352
|
} | {
|
|
353
353
|
workflow: string;
|
|
354
354
|
run: string;
|
|
355
|
+
reason?: string;
|
|
355
356
|
};
|
|
356
357
|
/**
|
|
357
358
|
* Response shapes mirror hub-core `verbs/release.ts` (verified 2026-07-18):
|
|
@@ -362,6 +363,10 @@ export type ReleaseRequest = {
|
|
|
362
363
|
* drain-exempt-ion, never list which claims were exempt.
|
|
363
364
|
* - targeted: `{ released: boolean, reason?, workflow?, run? }` — idempotent
|
|
364
365
|
* (a not-held target is `released: false`, not an error).
|
|
366
|
+
* Targeted requests may carry an optional `reason`; the hub trims it,
|
|
367
|
+
* treats blank text as absent, truncates it to 1024 Unicode code points
|
|
368
|
+
* without splitting surrogate pairs, and records whether truncation
|
|
369
|
+
* occurred. It retains only the first observation for a workflow/step.
|
|
365
370
|
*
|
|
366
371
|
* The by-session form's `released` array is REQUIRED (the drain role reads it);
|
|
367
372
|
* the targeted form's fields are all optional so callers that only do a
|
|
@@ -225,8 +225,9 @@ export function createLeaseLoop(opts) {
|
|
|
225
225
|
return 'stopped';
|
|
226
226
|
opts.out(`owenloop work ${role}: final breath (${stopReason || 'stop'}) — releasing ${workflow}/${runId}`);
|
|
227
227
|
try {
|
|
228
|
+
const request = { workflow, run: runId, ...(stopReason !== '' ? { reason: stopReason } : {}) };
|
|
228
229
|
const raced = await Promise.race([
|
|
229
|
-
opts.hub.release(
|
|
230
|
+
opts.hub.release(request).then(() => 'ok'),
|
|
230
231
|
opts.sleep(RELEASE_CAP_MS).then(() => 'timeout'),
|
|
231
232
|
]);
|
|
232
233
|
if (raced === 'timeout') {
|
|
@@ -391,14 +391,15 @@ export function createShiftLoop(opts) {
|
|
|
391
391
|
* deliberately stays off the dispatch critical path; a failed release falls
|
|
392
392
|
* back to the existing pickup-window behavior and is observable.
|
|
393
393
|
*/
|
|
394
|
-
function releaseClaim(workflow, run) {
|
|
395
|
-
void opts.hub.release({ workflow, run }).catch((e) => {
|
|
394
|
+
function releaseClaim(workflow, run, reason) {
|
|
395
|
+
void opts.hub.release({ workflow, run, ...(reason !== undefined ? { reason } : {}) }).catch((e) => {
|
|
396
396
|
noteServerBackoff(e);
|
|
397
397
|
const message = errMsg(e);
|
|
398
398
|
opts.err(`[${workflow}/${run}] release failed: ${message} — leaving the hub pickup window to re-offer it`);
|
|
399
399
|
emit({ type: 'hub-error', op: 'release', workflow, message });
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
+
const formatReleaseReason = (reason, message) => `${reason}: ${message}`;
|
|
402
403
|
function acquireDispatchLock(waitMs, label) {
|
|
403
404
|
return acquireFileLockSync(join(opts.stateDir, '.dispatch.lock'), {
|
|
404
405
|
...opts.dispatchLockOptions,
|
|
@@ -614,7 +615,7 @@ export function createShiftLoop(opts) {
|
|
|
614
615
|
reason: 'claim-expired',
|
|
615
616
|
message,
|
|
616
617
|
});
|
|
617
|
-
releaseClaim(candidate.workflow, candidate.order.run);
|
|
618
|
+
releaseClaim(candidate.workflow, candidate.order.run, formatReleaseReason('claim-expired', message));
|
|
618
619
|
return true;
|
|
619
620
|
}
|
|
620
621
|
/** Dispatch already-claimed orders when local child capacity becomes free. */
|
|
@@ -787,7 +788,7 @@ export function createShiftLoop(opts) {
|
|
|
787
788
|
*/
|
|
788
789
|
const releaseOrder = (workflow, order, reason, message) => {
|
|
789
790
|
dropOrder(workflow, order, reason, message);
|
|
790
|
-
releaseClaim(workflow, order.run);
|
|
791
|
+
releaseClaim(workflow, order.run, formatReleaseReason(reason, message));
|
|
791
792
|
// Re-arm the next sweep, but only for the two TRANSIENT reasons — see
|
|
792
793
|
// `SweepResult.releasedForCapacity` for why `agent-lane-closed` is not
|
|
793
794
|
// one of them. The independent cooldown prevents a busy cursor from
|
package/dist/src/cli.js
CHANGED
|
@@ -1281,6 +1281,7 @@ ${' '.repeat(41)}refresh the local hub-rosters cache with an agent credential
|
|
|
1281
1281
|
check <def> [--format text|json] [--max-depth N] [--max-states N] [--max-collection N] [--assume-provided] [--strict-inputs]
|
|
1282
1282
|
bounded reachability check (stall states, true deadlocks, stuck, dead steps, declared invariants)
|
|
1283
1283
|
create <def> [--title t] [--provide name=json ...] [--param k=v ...]
|
|
1284
|
+
${' '.repeat(41)}create a local SQLite workflow instance
|
|
1284
1285
|
provide <wf> <name> [--value json] [--hub <url>] supply an owed (seedOwed) input
|
|
1285
1286
|
adopt <wf> re-pin an instance to the current def (§28); settles new debts
|
|
1286
1287
|
tick <wf> [--now <ms>] [--shallow] [--capability <c>]... pull eligible orders (deep: also from calls: children; --shallow for this instance only; --capability filters to matching-capability steps)
|
|
@@ -1291,7 +1292,7 @@ ${' '.repeat(41)}refresh the local hub-rosters cache with an agent credential
|
|
|
1291
1292
|
status --all every instance's status in one call (fleet read)
|
|
1292
1293
|
wait <wf> --until eligible|done [--timeout <dur>] block until engine state matches
|
|
1293
1294
|
show <wf> dump raw artifacts
|
|
1294
|
-
trace <wf> [--format text] causal timeline + artifact biographies
|
|
1295
|
+
trace <wf> [--format text] local causal timeline + artifact biographies
|
|
1295
1296
|
graph <def-or-wf> [--format dot|mermaid|json] wiring graph (+ live overlay if wf id)
|
|
1296
1297
|
list list workflow instances
|
|
1297
1298
|
green <wf> <run> <path> [--value json] [--terminal]
|
package/docs/agent-runner.md
CHANGED
|
@@ -6,6 +6,21 @@ The runtime worker resolves the verified workflow definition from the local work
|
|
|
6
6
|
|
|
7
7
|
Runtime preflight is authoritative. `owenloop work lint` runs the same common and adapter checks for author feedback, but lint cannot account for a later `--harness` override or a selected crew-roster candidate.
|
|
8
8
|
|
|
9
|
+
## Capability-silent steps
|
|
10
|
+
|
|
11
|
+
A step with no declared capabilities is valid loud-proceed work: no crew roster
|
|
12
|
+
model or effort is injected. An authored `x.harness.model` or
|
|
13
|
+
`x.harness.effort` still applies; only when neither is authored does the
|
|
14
|
+
selected harness choose its own default. The worker emits a
|
|
15
|
+
`CAPABILITY-SILENT` claim-time warning that names the selected harness and
|
|
16
|
+
which policy applies. If the turn ends without a hub outcome, its
|
|
17
|
+
terminal local line repeats the provider-reported runtime model and a bounded
|
|
18
|
+
harness diagnostic when either was reported; missing values are named rather
|
|
19
|
+
than guessed. These messages are telemetry only. The hub remains the sole
|
|
20
|
+
source of task outcome. Its targeted release receives the stable
|
|
21
|
+
`capability-silent-no-submit` reason, while the provider-reported runtime model
|
|
22
|
+
and bounded harness diagnostic remain local to the worker output.
|
|
23
|
+
|
|
9
24
|
Native judge entries do not carry a separately authored `x` map. The definition
|
|
10
25
|
compiler deep-clones the producer step's complete parsed `x` map onto every
|
|
11
26
|
synthesized judge step, and generated and persisted judge orders expose that
|
|
@@ -92,9 +107,9 @@ The vendor classifiers do not, in practice, consult anyone. The SDK's `auto` mod
|
|
|
92
107
|
|
|
93
108
|
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
109
|
|
|
95
|
-
- **Path containment.** A tool call naming a path outside the step's working directory escalates
|
|
110
|
+
- **Path containment.** A tool call naming a path outside the step's working directory escalates under either policy, except when both the step explicitly declares `filesystem: unrestricted` and the call is one of the shared audited filesystem readers: `Read`, `Glob`, or `Grep`. A harness-reported `blockedPath` remains authoritative, and writes, non-read tools, and calls with narrower or omitted filesystem declarations remain workdir-contained. This is decidable and is the check that catches the probes above.
|
|
96
111
|
- **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
|
|
112
|
+
- **Policy.** `ask` allows a declared-safe filesystem read: normally that means a contained read, while an explicitly unrestricted filesystem also permits the audited `Read`/`Glob`/`Grep` exception above. It still escalates writes, network readers, and every other operation. `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
113
|
|
|
99
114
|
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
115
|
|
package/docs/cli.md
CHANGED
|
@@ -106,7 +106,7 @@ is independent of the `SEARCH INCOMPLETE` bounds notice.
|
|
|
106
106
|
| `work <subcommand> [options]` | run the execution-side CLI companion — see [`work`](#work--execution-side-cli-companion) |
|
|
107
107
|
| `util modifier-init --default <value>` | choose a modifier from rejection feedback, the order hint, or a default; intended for command steps |
|
|
108
108
|
| `trust init\|grant\|revoke` | create and sign local enrollment trust records offline — see [`trust`](#trust--local-enrollment-trust) |
|
|
109
|
-
| `create <def> [--title t] [--provide name=json …] [--param k=v …]` |
|
|
109
|
+
| `create <def> [--title t] [--provide name=json …] [--param k=v …]` | create a local SQLite instance in the selected `--db` store; prints `{workflow}` |
|
|
110
110
|
| `provide <wf> <name> [--value json] [--hub <url>]` | supply a seeded input after the fact; `--hub` targets a hosted workflow |
|
|
111
111
|
| `tick <wf> [--now=<ms>] [--shallow] [--capability <l>]…` | claim and emit eligible **orders** (the jobs to run); deep by default — also descends into live `calls:` children (`--shallow` = this instance only); repeatable `--capability` claims steps without capabilities plus matching-capability steps — see below |
|
|
112
112
|
| `reap <wf> [--now]` | run the reaper; `--now` forces every claim stale (TTL 0) — see below |
|
|
@@ -114,6 +114,7 @@ is independent of the `SEARCH INCOMPLETE` bounds notice.
|
|
|
114
114
|
| `status <wf>` | derived view: `done`, `debts`, `eligible`, `blocked`, `inFlight` |
|
|
115
115
|
| `wait <wf> --until eligible\|done [--timeout <dur>]` | block until engine state matches, then print `status` |
|
|
116
116
|
| `show <wf>` | dump raw artifacts (debugging) |
|
|
117
|
+
| `trace <wf> [--format text\|json]` | read the local causal timeline and artifact biographies from the selected store; JSON is the default and both formats are local-store reads |
|
|
117
118
|
| `list` | list instances |
|
|
118
119
|
| `green <wf> <run> <path> [--value json] [--terminal]` | accept an owed output |
|
|
119
120
|
| `emit <wf> <run> --items '[{…},{…}]'` | add collection elements |
|
|
@@ -126,6 +127,20 @@ is independent of the `SEARCH INCOMPLETE` bounds notice.
|
|
|
126
127
|
| `delete <wf>` | delete an instance and all its rows |
|
|
127
128
|
| `adopt <wf>` | re-pin an instance to the current definition and settle any new debts |
|
|
128
129
|
|
|
130
|
+
### Local versus hosted instances
|
|
131
|
+
|
|
132
|
+
`create`, `tick`, `list`, `runs`, `status`, `show`, and `trace` are the local
|
|
133
|
+
engine path. `create` creates a local SQLite workflow instance; it does not
|
|
134
|
+
copy or expose the history of an existing hub run. `start` is the authenticated
|
|
135
|
+
hub path for creating a published workflow.
|
|
136
|
+
|
|
137
|
+
Every local invocation must resolve the same runtime database and definitions.
|
|
138
|
+
Repeat `--db` and `--defs` on each command, or set stable `OWENLOOP_DB` and
|
|
139
|
+
`OWENLOOP_DEFS` values. `list` returning `[]` means only that the selected
|
|
140
|
+
database has no instances. Changing the database selector can legitimately
|
|
141
|
+
produce `[]` or “workflow not found”; changing the definitions selector can
|
|
142
|
+
leave a stored workflow's definition unresolvable.
|
|
143
|
+
|
|
129
144
|
Without `--hub`, `provide` and `reject` use the local SQLite engine exactly as
|
|
130
145
|
before. With `--hub`, they operate on the project-bound (or explicitly named)
|
|
131
146
|
hosted workflow and use the logged-in human credential; the explicit hub must
|
|
@@ -3285,15 +3300,20 @@ owenloop() { node bin/owenloop.mjs "$@"; } # or `npm link` to put it on PATH
|
|
|
3285
3300
|
|
|
3286
3301
|
owenloop defs # what workflows are available
|
|
3287
3302
|
|
|
3288
|
-
#
|
|
3303
|
+
# create a local instance; `proposal` is seeded as owed, so we provide it up front
|
|
3289
3304
|
wf=$(owenloop create delivery \
|
|
3290
3305
|
--provide proposal='{"text":"add dark mode"}' | jq -r .workflow)
|
|
3291
3306
|
|
|
3307
|
+
owenloop list # includes $wf in this local database
|
|
3308
|
+
|
|
3292
3309
|
# the Step Agent loop: tick → run → report
|
|
3293
3310
|
run=$(owenloop tick $wf | jq -r '.orders[0].run') # claim the planner job
|
|
3294
3311
|
owenloop green $wf $run plan --value '{"plan":"…"}' # report its output
|
|
3312
|
+
owenloop close "$wf" "$run" # complete the planner firing
|
|
3295
3313
|
|
|
3296
3314
|
owenloop status $wf # done / debts / eligible / blocked / pending / inFlight
|
|
3315
|
+
owenloop trace "$wf" # local causal timeline as JSON
|
|
3316
|
+
owenloop trace "$wf" --format text # the same local trace as text
|
|
3297
3317
|
```
|
|
3298
3318
|
|
|
3299
3319
|
**A knock-back.** When the reviewer's job comes up, instead of greening its
|
package/docs/shift-logs.md
CHANGED
|
@@ -38,6 +38,20 @@ tail; for a failed command, the receipt is ask context rather than an artifact.
|
|
|
38
38
|
Full streams are represented only by the receipt's output hash and stdout/stderr
|
|
39
39
|
byte counts.
|
|
40
40
|
|
|
41
|
+
## Capability-silent agent diagnostics
|
|
42
|
+
|
|
43
|
+
Capability-silent `agent-run` attempts write their claim-time
|
|
44
|
+
`CAPABILITY-SILENT` warning and any terminal no-submit diagnostic to worker
|
|
45
|
+
stdout/stderr, so Shift dispatch preserves them in `<run>.log`. The claim
|
|
46
|
+
warning states whether the harness will use its default or an authored step
|
|
47
|
+
model/effort; the terminal message may name the harness-reported runtime model
|
|
48
|
+
and bounded failure context when available. It is intentionally not a
|
|
49
|
+
`shift.log` event. The targeted hub release receives only the stable
|
|
50
|
+
`capability-silent-no-submit` reason; the detailed provider and failure context
|
|
51
|
+
stays in worker output. Local logging can still be disabled as described below,
|
|
52
|
+
in which case the worker remains runnable but these local diagnostics are not
|
|
53
|
+
retained.
|
|
54
|
+
|
|
41
55
|
| Command outcome | Worker channel | Header |
|
|
42
56
|
| --- | --- | --- |
|
|
43
57
|
| exit 0 and no machinery error | stdout | `… the command for step 'X' succeeded; its output follows` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owenloop",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
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.
|
|
3
|
+
"version": "0.5.17",
|
|
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"
|