owenloop 0.5.0 → 0.5.1
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 +45 -0
- package/README.md +137 -35
- package/bin/owenloop.mjs +49 -1
- package/dist/packages/work/src/agent/brief.d.ts +8 -4
- package/dist/packages/work/src/agent/brief.js +7 -3
- package/dist/packages/work/src/agent/loop.d.ts +13 -7
- package/dist/packages/work/src/agent/loop.js +136 -9
- package/dist/packages/work/src/agent/model-policy.d.ts +49 -0
- package/dist/packages/work/src/agent/model-policy.js +138 -0
- package/dist/packages/work/src/bundle/cache.d.ts +7 -5
- package/dist/packages/work/src/bundle/cache.js +20 -6
- package/dist/packages/work/src/bundle/fetch.d.ts +7 -5
- package/dist/packages/work/src/bundle/fetch.js +27 -7
- package/dist/packages/work/src/bundle/types.d.ts +8 -4
- package/dist/packages/work/src/consumed-verifier.d.ts +45 -0
- package/dist/packages/work/src/consumed-verifier.js +205 -0
- package/dist/packages/work/src/exec/instructions.d.ts +99 -0
- package/dist/packages/work/src/exec/instructions.js +323 -0
- package/dist/packages/work/src/exec/loop.d.ts +12 -1
- package/dist/packages/work/src/exec/loop.js +137 -20
- package/dist/packages/work/src/exec/payload.d.ts +29 -0
- package/dist/packages/work/src/exec/payload.js +54 -0
- package/dist/packages/work/src/exec/receipt.d.ts +9 -6
- package/dist/packages/work/src/exec/receipt.js +12 -1
- package/dist/packages/work/src/exec/runner.d.ts +7 -1
- package/dist/packages/work/src/exec/runner.js +74 -3
- package/dist/packages/work/src/harness/child-env.js +7 -0
- package/dist/packages/work/src/harness/claude.d.ts +20 -8
- package/dist/packages/work/src/harness/claude.js +260 -58
- package/dist/packages/work/src/harness/codex.d.ts +5 -4
- package/dist/packages/work/src/harness/codex.js +169 -41
- package/dist/packages/work/src/harness/contract.d.ts +36 -11
- package/dist/packages/work/src/harness/fake.js +1 -0
- package/dist/packages/work/src/harness/jsonrpc-stdio.js +7 -0
- package/dist/packages/work/src/harness/permissions.d.ts +16 -3
- package/dist/packages/work/src/harness/permissions.js +102 -13
- package/dist/packages/work/src/harness/session-store.d.ts +27 -9
- package/dist/packages/work/src/harness/session-store.js +271 -67
- package/dist/packages/work/src/hold/mcp.d.ts +25 -5
- package/dist/packages/work/src/hold/mcp.js +126 -11
- package/dist/packages/work/src/hub/client.d.ts +2 -1
- package/dist/packages/work/src/hub/client.js +14 -1
- package/dist/packages/work/src/hub/types.d.ts +69 -33
- package/dist/packages/work/src/hub/types.js +8 -10
- package/dist/packages/work/src/mcp/server.js +1 -1
- package/dist/packages/work/src/owenloop-bin.d.ts +1 -0
- package/dist/packages/work/src/owenloop-bin.js +18 -0
- package/dist/packages/work/src/roles/agent-run.d.ts +12 -6
- package/dist/packages/work/src/roles/agent-run.js +116 -34
- package/dist/packages/work/src/roles/exec.d.ts +8 -0
- package/dist/packages/work/src/roles/exec.js +27 -2
- package/dist/packages/work/src/roles/hold.d.ts +4 -0
- package/dist/packages/work/src/roles/hold.js +44 -5
- package/dist/packages/work/src/roles/lint.d.ts +3 -4
- package/dist/packages/work/src/roles/lint.js +41 -7
- package/dist/packages/work/src/roles/settings.js +5 -0
- package/dist/packages/work/src/roles/shift.d.ts +1 -0
- package/dist/packages/work/src/roles/shift.js +23 -1
- package/dist/packages/work/src/settings/settings.d.ts +17 -1
- package/dist/packages/work/src/settings/settings.js +39 -0
- package/dist/packages/work/src/shift/loop.d.ts +14 -3
- package/dist/packages/work/src/shift/loop.js +447 -164
- package/dist/packages/work/src/shift/protocol.d.ts +4 -0
- package/dist/packages/work/src/shift/runtime.d.ts +2 -0
- package/dist/packages/work/src/shift/runtime.js +66 -3
- package/dist/packages/work/src/shift/spawn.d.ts +41 -18
- package/dist/packages/work/src/shift/spawn.js +89 -31
- package/dist/packages/work/src/shift/state.d.ts +53 -51
- package/dist/packages/work/src/shift/state.js +325 -102
- package/dist/packages/work/src/submit-proof.d.ts +36 -0
- package/dist/packages/work/src/submit-proof.js +93 -0
- package/dist/src/add.d.ts +64 -259
- package/dist/src/add.js +81 -615
- package/dist/src/archive.d.ts +97 -0
- package/dist/src/archive.js +591 -0
- package/dist/src/bundle/index.d.ts +64 -0
- package/dist/src/bundle/index.js +508 -0
- package/dist/src/bundle/manifest.d.ts +50 -0
- package/dist/src/bundle/manifest.js +435 -0
- package/dist/src/bundle/runtime.d.ts +26 -0
- package/dist/src/bundle/runtime.js +64 -0
- package/dist/src/bundle/tar.d.ts +62 -0
- package/dist/src/bundle/tar.js +238 -0
- package/dist/src/bundle/types.d.ts +105 -0
- package/dist/src/bundle/types.js +21 -0
- package/dist/src/cli.d.ts +90 -20
- package/dist/src/cli.js +2407 -365
- package/dist/src/credentials.d.ts +4 -3
- package/dist/src/credentials.js +21 -19
- package/dist/src/crypto/allowed-signers.d.ts +68 -0
- package/dist/src/crypto/allowed-signers.js +307 -0
- package/dist/src/crypto/canonical.d.ts +8 -0
- package/dist/src/crypto/canonical.js +92 -0
- package/dist/src/crypto/chain.d.ts +65 -0
- package/dist/src/crypto/chain.js +377 -0
- package/dist/src/crypto/dsse.d.ts +209 -0
- package/dist/src/crypto/dsse.js +282 -0
- package/dist/src/crypto/enrollment.d.ts +78 -0
- package/dist/src/crypto/enrollment.js +186 -0
- package/dist/src/crypto/index.d.ts +48 -0
- package/dist/src/crypto/index.js +44 -0
- package/dist/src/crypto/keys.d.ts +258 -0
- package/dist/src/crypto/keys.js +908 -0
- package/dist/src/crypto/org-root.d.ts +33 -0
- package/dist/src/crypto/org-root.js +78 -0
- package/dist/src/crypto/origin-rules.d.ts +56 -0
- package/dist/src/crypto/origin-rules.js +143 -0
- package/dist/src/crypto/policy-floor.d.ts +98 -0
- package/dist/src/crypto/policy-floor.js +353 -0
- package/dist/src/crypto/records.d.ts +316 -0
- package/dist/src/crypto/records.js +157 -0
- package/dist/src/crypto/scope.d.ts +49 -0
- package/dist/src/crypto/scope.js +83 -0
- package/dist/src/crypto/ssh.d.ts +171 -0
- package/dist/src/crypto/ssh.js +396 -0
- package/dist/src/crypto/submission.d.ts +33 -0
- package/dist/src/crypto/submission.js +47 -0
- package/dist/src/crypto/trust-roots.d.ts +29 -0
- package/dist/src/crypto/trust-roots.js +39 -0
- package/dist/src/crypto/verify-consumed.d.ts +67 -0
- package/dist/src/crypto/verify-consumed.js +259 -0
- package/dist/src/crypto/verify-origin.d.ts +50 -0
- package/dist/src/crypto/verify-origin.js +151 -0
- package/dist/src/crypto/verify-publication.d.ts +60 -0
- package/dist/src/crypto/verify-publication.js +150 -0
- package/dist/src/defs.d.ts +24 -1
- package/dist/src/defs.js +145 -25
- package/dist/src/engine.d.ts +99 -3
- package/dist/src/engine.js +238 -34
- package/dist/src/factory.d.ts +16 -0
- package/dist/src/factory.js +16 -4
- package/dist/src/global-config.d.ts +59 -0
- package/dist/src/global-config.js +84 -0
- package/dist/src/hub.d.ts +75 -21
- package/dist/src/hub.js +123 -40
- package/dist/src/index.d.ts +17 -2
- package/dist/src/index.js +20 -2
- package/dist/src/install.d.ts +538 -0
- package/dist/src/install.js +1981 -0
- package/dist/src/lock.d.ts +15 -57
- package/dist/src/lock.js +251 -143
- package/dist/src/mcp/serve.d.ts +46 -22
- package/dist/src/mcp/serve.js +167 -44
- package/dist/src/mcp/server.js +12 -1
- package/dist/src/model.d.ts +15 -0
- package/dist/src/model.js +111 -1
- package/dist/src/order-resolver.d.ts +184 -0
- package/dist/src/order-resolver.js +252 -0
- package/dist/src/package-version.d.ts +10 -0
- package/dist/src/package-version.js +42 -0
- package/dist/src/paths.d.ts +14 -1
- package/dist/src/paths.js +18 -0
- package/dist/src/schemas/enrollment-grant.v1.schema.json +90 -0
- package/dist/src/schemas/index.d.ts +1416 -0
- package/dist/src/schemas/index.js +31 -0
- package/dist/src/schemas/order.v1.schema.json +106 -0
- package/dist/src/schemas/origin.v1.schema.json +68 -0
- package/dist/src/schemas/policy-floor.v1.schema.json +29 -0
- package/dist/src/schemas/publication.v1.schema.json +31 -0
- package/dist/src/schemas/revocation.v1.schema.json +39 -0
- package/dist/src/schemas/submission.v1.schema.json +61 -0
- package/dist/src/store/def-source.d.ts +52 -0
- package/dist/src/store/def-source.js +335 -0
- package/dist/src/store/index-file.d.ts +69 -0
- package/dist/src/store/index-file.js +151 -0
- package/dist/src/store/index.d.ts +27 -0
- package/dist/src/store/index.js +22 -0
- package/dist/src/store/ingestor.d.ts +43 -0
- package/dist/src/store/ingestor.js +211 -0
- package/dist/src/store/install.d.ts +228 -0
- package/dist/src/store/install.js +555 -0
- package/dist/src/store/instruction-source.d.ts +49 -0
- package/dist/src/store/instruction-source.js +298 -0
- package/dist/src/store/origin-evidence.d.ts +21 -0
- package/dist/src/store/origin-evidence.js +66 -0
- package/dist/src/store/pre-commit-verifier.d.ts +68 -0
- package/dist/src/store/pre-commit-verifier.js +418 -0
- package/dist/src/store/resolve.d.ts +138 -0
- package/dist/src/store/resolve.js +363 -0
- package/dist/src/store/types.d.ts +288 -0
- package/dist/src/store/types.js +356 -0
- package/dist/src/types.d.ts +45 -11
- package/dist/src/untar.d.ts +8 -23
- package/dist/src/untar.js +10 -136
- package/docs/agent-runner.md +86 -0
- package/docs/authoring.md +57 -6
- package/docs/bundles.md +250 -0
- package/docs/cli.md +1171 -97
- package/docs/crypto.md +816 -0
- package/docs/design.md +342 -20
- package/docs/embedding.md +132 -25
- package/docs/wire-contracts.md +380 -0
- package/package.json +6 -1
- package/plugins/claude-code/.claude-plugin/marketplace.json +14 -0
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +8 -0
- package/plugins/claude-code/plugin/.mcp.json +14 -0
- package/plugins/claude-code/plugin/hooks/hooks.json +26 -0
- package/plugins/claude-code/plugin/hooks/session-end.sh +40 -0
- package/plugins/claude-code/plugin/hooks/session-start.sh +52 -0
- package/plugins/claude-code/plugin/skills/author/SKILL.md +181 -0
- package/plugins/claude-code/plugin/skills/conduct/SKILL.md +106 -0
- package/plugins/claude-code/plugin/skills/shift/SKILL.md +105 -0
- package/plugins/codex/.agents/plugins/marketplace.json +21 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +7 -0
- package/plugins/codex/plugins/owenloop/.mcp.json +20 -0
- package/plugins/codex/plugins/owenloop/hooks/hooks.json +26 -0
- package/plugins/codex/plugins/owenloop/hooks/session-end.sh +40 -0
- package/plugins/codex/plugins/owenloop/hooks/session-start.sh +52 -0
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +181 -0
- package/plugins/codex/plugins/owenloop/skills/conduct/SKILL.md +106 -0
- package/plugins/codex/plugins/owenloop/skills/shift/SKILL.md +105 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - `dispatchCap` — shift max in-flight exec children; below `--cap`,
|
|
12
12
|
* above the built-in default of 3. A positive integer.
|
|
13
13
|
* - `commandRouting` — who runs `executor: 'command'` steps this machine sees.
|
|
14
|
+
* - `defPolicy` — local publication trust policy (`warn` by default).
|
|
14
15
|
*/
|
|
15
16
|
export interface Settings {
|
|
16
17
|
/** Default hub origin when `--origin` is omitted. */
|
|
@@ -29,6 +30,15 @@ export interface Settings {
|
|
|
29
30
|
* most restrictive wins (see src/shift/routing.ts).
|
|
30
31
|
*/
|
|
31
32
|
commandRouting?: 'shift' | 'manual';
|
|
33
|
+
/**
|
|
34
|
+
* Publication trust policy for installed workflow definitions. `warn` is the
|
|
35
|
+
* built-in default; `enforce` refuses unsigned/unverifiable definitions and
|
|
36
|
+
* `off` suppresses those warnings for agent orders only. Command workers
|
|
37
|
+
* always require a verified definition regardless of this value.
|
|
38
|
+
*/
|
|
39
|
+
defPolicy?: 'enforce' | 'warn' | 'off';
|
|
40
|
+
/** Policy for signed consumed artifact values; defaults to `warn`. */
|
|
41
|
+
artifactPolicy?: 'enforce' | 'warn' | 'off';
|
|
32
42
|
/**
|
|
33
43
|
* Max in-flight `agent-run` children (positive integer, default 4 —
|
|
34
44
|
* `DEFAULT_MAX_AGENTS` in `src/roles/shift.ts`). A SEPARATE
|
|
@@ -66,9 +76,15 @@ export interface Settings {
|
|
|
66
76
|
* of the MACHINE running the shift, not of the workflow.
|
|
67
77
|
*/
|
|
68
78
|
workRepo?: string;
|
|
79
|
+
/** Quality-tier to concrete model mapping; merged over the built-in map. */
|
|
80
|
+
tierMap?: Record<string, string>;
|
|
81
|
+
/** Reject count at which the default retry policy escalates. */
|
|
82
|
+
escalateAt?: number;
|
|
83
|
+
/** Extension namespace containing an authored escalation object. */
|
|
84
|
+
escalationExtensionKey?: string;
|
|
69
85
|
}
|
|
70
86
|
/** The known settings keys, in the order `owenloop work settings` prints them. */
|
|
71
|
-
export declare const KNOWN_SETTINGS_KEYS: readonly ["hubOrigin", "cacheDir", "stateDir", "dispatchCap", "commandRouting", "maxConcurrentAgents", "workRoot", "workRepo"];
|
|
87
|
+
export declare const KNOWN_SETTINGS_KEYS: readonly ["hubOrigin", "cacheDir", "stateDir", "dispatchCap", "commandRouting", "defPolicy", "artifactPolicy", "maxConcurrentAgents", "workRoot", "workRepo", "tierMap", "escalateAt", "escalationExtensionKey"];
|
|
72
88
|
/**
|
|
73
89
|
* A validated load: the typed `settings` (unknown keys retained for forward
|
|
74
90
|
* compatibility — consumers ignore them), plus the list of keys that are NOT
|
|
@@ -21,9 +21,14 @@ export const KNOWN_SETTINGS_KEYS = [
|
|
|
21
21
|
'stateDir',
|
|
22
22
|
'dispatchCap',
|
|
23
23
|
'commandRouting',
|
|
24
|
+
'defPolicy',
|
|
25
|
+
'artifactPolicy',
|
|
24
26
|
'maxConcurrentAgents',
|
|
25
27
|
'workRoot',
|
|
26
28
|
'workRepo',
|
|
29
|
+
'tierMap',
|
|
30
|
+
'escalateAt',
|
|
31
|
+
'escalationExtensionKey',
|
|
27
32
|
];
|
|
28
33
|
/**
|
|
29
34
|
* Resolve the settings file path from the caller's env:
|
|
@@ -73,11 +78,45 @@ export function validateSettings(raw, path) {
|
|
|
73
78
|
throw bad('maxConcurrentAgents', 'a positive integer', v);
|
|
74
79
|
}
|
|
75
80
|
}
|
|
81
|
+
if ('tierMap' in obj) {
|
|
82
|
+
const v = obj['tierMap'];
|
|
83
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v)) {
|
|
84
|
+
throw bad('tierMap', 'an object whose values are non-empty strings', v);
|
|
85
|
+
}
|
|
86
|
+
for (const value of Object.values(v)) {
|
|
87
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
88
|
+
throw bad('tierMap', 'an object whose values are non-empty strings', v);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if ('escalateAt' in obj) {
|
|
92
|
+
const v = obj['escalateAt'];
|
|
93
|
+
if (typeof v !== 'number' || !Number.isInteger(v) || v <= 0) {
|
|
94
|
+
throw bad('escalateAt', 'a positive integer', v);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if ('escalationExtensionKey' in obj) {
|
|
98
|
+
const v = obj['escalationExtensionKey'];
|
|
99
|
+
if (typeof v !== 'string' || v.trim() === '') {
|
|
100
|
+
throw bad('escalationExtensionKey', 'a non-empty string', v);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
76
103
|
if ('commandRouting' in obj) {
|
|
77
104
|
const v = obj['commandRouting'];
|
|
78
105
|
if (v !== 'shift' && v !== 'manual')
|
|
79
106
|
throw bad('commandRouting', "'shift' or 'manual'", v);
|
|
80
107
|
}
|
|
108
|
+
if ('defPolicy' in obj) {
|
|
109
|
+
const v = obj['defPolicy'];
|
|
110
|
+
if (v !== 'enforce' && v !== 'warn' && v !== 'off') {
|
|
111
|
+
throw bad('defPolicy', "'enforce', 'warn', or 'off'", v);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if ('artifactPolicy' in obj) {
|
|
115
|
+
const v = obj['artifactPolicy'];
|
|
116
|
+
if (v !== 'enforce' && v !== 'warn' && v !== 'off') {
|
|
117
|
+
throw bad('artifactPolicy', "'enforce', 'warn', or 'off'", v);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
81
120
|
const known = new Set(KNOWN_SETTINGS_KEYS);
|
|
82
121
|
const unrecognized = Object.keys(obj).filter((k) => !known.has(k));
|
|
83
122
|
return { settings: obj, unrecognized };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { HubClient } from '../hub/client.ts';
|
|
2
|
+
import { type WorkOrder } from '../hub/types.ts';
|
|
3
|
+
import type { FetchedStep } from '../bundle/types.ts';
|
|
2
4
|
import { type Liveness } from './state.ts';
|
|
3
5
|
import { sweepWorkDirs as sweepWorkDirsImpl } from '../agent/workdir.ts';
|
|
4
6
|
import type { Spawner } from './spawn.ts';
|
|
@@ -8,8 +10,10 @@ export interface ShiftLoopOptions {
|
|
|
8
10
|
spawner: Spawner;
|
|
9
11
|
/** Injected sleep — tests pass an instant/scriptable stub (no real timers). */
|
|
10
12
|
sleep: (ms: number) => Promise<void>;
|
|
11
|
-
/** Injected clock. */
|
|
13
|
+
/** Injected wall clock for persisted and externally meaningful timestamps. */
|
|
12
14
|
now: () => number;
|
|
15
|
+
/** Injected monotonic clock for elapsed-time decisions. Default `performance.now`. */
|
|
16
|
+
monotonicNow?: () => number;
|
|
13
17
|
/** stdout sink (one line per call; newline appended). */
|
|
14
18
|
out: (line: string) => void;
|
|
15
19
|
/** stderr sink (one line per call; newline appended). */
|
|
@@ -39,6 +43,8 @@ export interface ShiftLoopOptions {
|
|
|
39
43
|
workflow?: string;
|
|
40
44
|
/** Machine-level command routing (raw — validated in routing.ts). */
|
|
41
45
|
commandRouting?: unknown;
|
|
46
|
+
/** Resolve exact order-pinned step metadata by `defDigest`; modern command orders fail closed without it. */
|
|
47
|
+
resolveOrderStep?: (order: WorkOrder) => Promise<FetchedStep | undefined>;
|
|
42
48
|
pollIntervalMs: number;
|
|
43
49
|
presenceIntervalMs: number;
|
|
44
50
|
/**
|
|
@@ -72,8 +78,8 @@ export interface ShiftLoop {
|
|
|
72
78
|
run(): Promise<number>;
|
|
73
79
|
stop(): void;
|
|
74
80
|
/**
|
|
75
|
-
* Run exactly one park iteration (presence →
|
|
76
|
-
*
|
|
81
|
+
* Run exactly one park iteration (presence → reconcile/queued dispatch → wake
|
|
82
|
+
* → required sweep → reap) and return how many children it spawned. The shift daemon
|
|
77
83
|
* uses this seam for its loop core; the standing `run()` loop ignores the
|
|
78
84
|
* count. Cursor/presence state is held in the closure and persists across calls.
|
|
79
85
|
*/
|
|
@@ -117,4 +123,9 @@ export interface ShiftLoop {
|
|
|
117
123
|
*/
|
|
118
124
|
noteRunEnded(run: string): void;
|
|
119
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The hub reaps a never-contacted claim after 120 seconds. Stop local queueing
|
|
128
|
+
* after 90 seconds so a detached child retains 30 seconds to make first contact.
|
|
129
|
+
*/
|
|
130
|
+
export declare const MAX_PENDING_CANDIDATE_AGE_MS = 90000;
|
|
120
131
|
export declare function createShiftLoop(opts: ShiftLoopOptions): ShiftLoop;
|