owenloop 0.5.8 → 0.5.9
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 +25 -0
- package/README.md +4 -2
- package/dist/packages/work/src/agent/loop.d.ts +23 -8
- package/dist/packages/work/src/agent/loop.js +48 -6
- package/dist/packages/work/src/consumed-verifier.js +6 -17
- package/dist/packages/work/src/exec/loop.d.ts +1 -1
- package/dist/packages/work/src/exec/loop.js +181 -32
- package/dist/packages/work/src/exec/receipt.d.ts +7 -7
- package/dist/packages/work/src/exec/receipt.js +6 -6
- package/dist/packages/work/src/harness/claude.js +100 -0
- package/dist/packages/work/src/hub/client.d.ts +19 -4
- package/dist/packages/work/src/hub/client.js +7 -3
- package/dist/packages/work/src/hub/types.d.ts +84 -0
- package/dist/packages/work/src/main.js +1 -0
- package/dist/packages/work/src/roles/agent-run.js +19 -22
- package/dist/packages/work/src/roles/exec.js +2 -0
- package/dist/packages/work/src/roles/settings.js +2 -0
- package/dist/packages/work/src/roles/shift.js +14 -2
- package/dist/packages/work/src/roles/util.d.ts +1 -0
- package/dist/packages/work/src/roles/util.js +10 -0
- package/dist/packages/work/src/settings/hub-roster-cache.d.ts +68 -0
- package/dist/packages/work/src/settings/hub-roster-cache.js +370 -0
- package/dist/packages/work/src/settings/roster.d.ts +84 -0
- package/dist/packages/work/src/settings/roster.js +364 -5
- package/dist/packages/work/src/settings/serving.d.ts +17 -0
- package/dist/packages/work/src/settings/serving.js +79 -0
- package/dist/packages/work/src/settings/settings.d.ts +14 -1
- package/dist/packages/work/src/settings/settings.js +14 -0
- package/dist/packages/work/src/shift/loop.d.ts +108 -5
- package/dist/packages/work/src/shift/loop.js +299 -51
- package/dist/packages/work/src/shift/protocol.d.ts +7 -5
- package/dist/packages/work/src/shift/runtime.d.ts +15 -0
- package/dist/packages/work/src/shift/runtime.js +94 -4
- package/dist/packages/work/src/shift/server.js +2 -0
- package/dist/packages/work/src/shift/spawn.d.ts +17 -2
- package/dist/packages/work/src/shift/spawn.js +16 -13
- package/dist/packages/work/src/shift/state.d.ts +29 -2
- package/dist/packages/work/src/shift/state.js +45 -15
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +7 -1
- package/dist/packages/work/src/util/modifier-init.d.ts +7 -0
- package/dist/packages/work/src/util/modifier-init.js +73 -0
- package/dist/src/bundle/tar.d.ts +9 -4
- package/dist/src/bundle/tar.js +9 -4
- package/dist/src/capabilities.d.ts +6 -0
- package/dist/src/cli.d.ts +14 -1
- package/dist/src/cli.js +687 -75
- package/dist/src/config-dir.d.ts +1 -1
- package/dist/src/config-dir.js +1 -1
- package/dist/src/crypto/index.d.ts +1 -1
- package/dist/src/crypto/index.js +1 -1
- package/dist/src/crypto/org-root.d.ts +30 -12
- package/dist/src/crypto/org-root.js +162 -14
- package/dist/src/crypto/records.d.ts +2 -0
- package/dist/src/crypto/records.js +2 -0
- package/dist/src/defs.d.ts +6 -1
- package/dist/src/defs.js +203 -8
- package/dist/src/engine.d.ts +42 -7
- package/dist/src/engine.js +158 -16
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +2 -2
- package/dist/src/mcp/serve.d.ts +22 -0
- package/dist/src/mcp/serve.js +88 -8
- package/dist/src/model.d.ts +2 -0
- package/dist/src/model.js +32 -25
- package/dist/src/order-resolver.d.ts +1 -0
- package/dist/src/order-resolver.js +8 -1
- package/dist/src/schemas/index.d.ts +11 -0
- package/dist/src/schemas/order.v1.schema.json +7 -1
- package/dist/src/store.d.ts +5 -0
- package/dist/src/store.js +43 -8
- package/dist/src/types.d.ts +40 -3
- package/docs/authoring.md +90 -2
- package/docs/bundles.md +26 -2
- package/docs/cli.md +170 -28
- package/docs/crypto.md +19 -3
- package/docs/design.md +70 -1
- package/docs/routing.md +189 -34
- package/docs/shift-logs.md +20 -9
- package/docs/wire-contracts.md +50 -7
- package/examples/workflows/delivery.yaml +31 -14
- package/examples/workflows/ship.yaml +10 -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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
function usage(message) {
|
|
3
|
+
process.stderr.write(`owenloop util modifier-init: ${message}\n`);
|
|
4
|
+
process.stderr.write('usage: owenloop util modifier-init --default <value>\n');
|
|
5
|
+
return 2;
|
|
6
|
+
}
|
|
7
|
+
function feedbackRequested(env) {
|
|
8
|
+
const inline = env['OWENLOOP_FEEDBACK'];
|
|
9
|
+
const file = env['OWENLOOP_FEEDBACK_FILE'];
|
|
10
|
+
let raw;
|
|
11
|
+
if (inline !== undefined)
|
|
12
|
+
raw = inline;
|
|
13
|
+
else if (file !== undefined)
|
|
14
|
+
raw = readFileSync(file, 'utf8');
|
|
15
|
+
if (raw === undefined)
|
|
16
|
+
return undefined;
|
|
17
|
+
const feedback = JSON.parse(raw);
|
|
18
|
+
if (!Array.isArray(feedback))
|
|
19
|
+
throw new Error('OWENLOOP_FEEDBACK must be a JSON feedback array');
|
|
20
|
+
let newest;
|
|
21
|
+
let position = 0;
|
|
22
|
+
for (const owed of feedback) {
|
|
23
|
+
if (!Array.isArray(owed.reasons))
|
|
24
|
+
continue;
|
|
25
|
+
const rejection = [...owed.reasons].reverse().find((reason) => reason.action === 'reject');
|
|
26
|
+
position++;
|
|
27
|
+
if (typeof rejection?.requested !== 'string')
|
|
28
|
+
continue;
|
|
29
|
+
const at = typeof rejection.at === 'number' ? rejection.at : Number.NEGATIVE_INFINITY;
|
|
30
|
+
if (newest === undefined
|
|
31
|
+
|| at > newest.at
|
|
32
|
+
|| (at === newest.at && position > newest.position)) {
|
|
33
|
+
newest = { requested: rejection.requested, at, position };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return newest?.requested;
|
|
37
|
+
}
|
|
38
|
+
/** Resolve requested feedback first, then the order modifier hint, then default. */
|
|
39
|
+
export function resolveModifierInit(args, env = process.env) {
|
|
40
|
+
let fallback;
|
|
41
|
+
for (let i = 0; i < args.length; i++) {
|
|
42
|
+
const arg = args[i];
|
|
43
|
+
if (arg !== '--default')
|
|
44
|
+
return { error: `unknown argument '${arg}'`, usage: true };
|
|
45
|
+
if (fallback !== undefined)
|
|
46
|
+
return { error: '--default may only be specified once', usage: true };
|
|
47
|
+
fallback = args[++i];
|
|
48
|
+
if (fallback === undefined)
|
|
49
|
+
return { error: 'missing value for --default', usage: true };
|
|
50
|
+
}
|
|
51
|
+
if (fallback === undefined)
|
|
52
|
+
return { error: 'missing required option: --default', usage: true };
|
|
53
|
+
try {
|
|
54
|
+
const value = feedbackRequested(env) ?? env['OWENLOOP_MODIFIER'] ?? fallback;
|
|
55
|
+
if (value === '' || /\s/.test(value))
|
|
56
|
+
return { error: 'resolved modifier must be a single word' };
|
|
57
|
+
return { value };
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
return { error: e instanceof Error ? e.message : String(e) };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function runModifierInit(args, env = process.env) {
|
|
64
|
+
const result = resolveModifierInit(args, env);
|
|
65
|
+
if (result.error !== undefined) {
|
|
66
|
+
if (result.usage)
|
|
67
|
+
return usage(result.error);
|
|
68
|
+
process.stderr.write(`owenloop util modifier-init: ${result.error}\n`);
|
|
69
|
+
return 3;
|
|
70
|
+
}
|
|
71
|
+
process.stdout.write(`${result.value}\n`);
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
package/dist/src/bundle/tar.d.ts
CHANGED
|
@@ -30,10 +30,15 @@ export declare const BUNDLE_GZIP_LEVEL = 9;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function buildCanonicalTar(files: CanonicalFile[], limits?: TarLimits): Buffer;
|
|
32
32
|
/**
|
|
33
|
-
* Gzip `tar` with fixed options and
|
|
34
|
-
*
|
|
35
|
-
* OS 19 on Darwin and embeds the clock
|
|
36
|
-
*
|
|
33
|
+
* Gzip `tar` with fixed options and controlled header ranges: magic (bytes
|
|
34
|
+
* 0-1), CM (2), FLG (3), MTIME (4-7), and OS (9). No FEXTRA/FNAME/FCOMMENT
|
|
35
|
+
* fields are emitted. Node's zlib reports OS 19 on Darwin and embeds the clock
|
|
36
|
+
* in mtime by default, so patch bytes 4-7 and 9 to fixed values. XFL (byte 8)
|
|
37
|
+
* is supplied by zlib and deliberately left unnormalized.
|
|
38
|
+
*
|
|
39
|
+
* The compressed DEFLATE payload is not normalized: linked zlib builds can
|
|
40
|
+
* emit different valid streams for the same input. Bundle identity is the
|
|
41
|
+
* SHA-256 digest of the uncompressed canonical tar.
|
|
37
42
|
*/
|
|
38
43
|
export declare function gzipDeterministic(tar: Uint8Array): Buffer;
|
|
39
44
|
/** A file collected from a bundle source tree. */
|
package/dist/src/bundle/tar.js
CHANGED
|
@@ -146,10 +146,15 @@ export function buildCanonicalTar(files, limits = DEFAULT_TAR_LIMITS) {
|
|
|
146
146
|
return tar;
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
|
-
* Gzip `tar` with fixed options and
|
|
150
|
-
*
|
|
151
|
-
* OS 19 on Darwin and embeds the clock
|
|
152
|
-
*
|
|
149
|
+
* Gzip `tar` with fixed options and controlled header ranges: magic (bytes
|
|
150
|
+
* 0-1), CM (2), FLG (3), MTIME (4-7), and OS (9). No FEXTRA/FNAME/FCOMMENT
|
|
151
|
+
* fields are emitted. Node's zlib reports OS 19 on Darwin and embeds the clock
|
|
152
|
+
* in mtime by default, so patch bytes 4-7 and 9 to fixed values. XFL (byte 8)
|
|
153
|
+
* is supplied by zlib and deliberately left unnormalized.
|
|
154
|
+
*
|
|
155
|
+
* The compressed DEFLATE payload is not normalized: linked zlib builds can
|
|
156
|
+
* emit different valid streams for the same input. Bundle identity is the
|
|
157
|
+
* SHA-256 digest of the uncompressed canonical tar.
|
|
153
158
|
*/
|
|
154
159
|
export function gzipDeterministic(tar) {
|
|
155
160
|
const gz = gzipSync(Buffer.from(tar), { level: BUNDLE_GZIP_LEVEL });
|
|
@@ -79,6 +79,12 @@ export declare function composeCapabilities(authored: readonly string[] | undefi
|
|
|
79
79
|
* bounded.
|
|
80
80
|
*/
|
|
81
81
|
export type CapabilityRewrites = Readonly<Record<string, string>>;
|
|
82
|
+
/**
|
|
83
|
+
* Crews matched per SERVED capability, supplied by the caller that owns the
|
|
84
|
+
* routing table. Keys are post-reroute capability strings; values are crew
|
|
85
|
+
* names in match order. Hub → worker; unrelated to `serve_crews`.
|
|
86
|
+
*/
|
|
87
|
+
export type CrewStamps = Readonly<Record<string, readonly string[]>>;
|
|
82
88
|
/**
|
|
83
89
|
* Substitute a caller's reroute decisions into a composed offer.
|
|
84
90
|
*
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface CliIO {
|
|
|
108
108
|
/** Optional resolver override for hermetic tests of a missing bundled marketplace. */
|
|
109
109
|
resolveBundledMarketplaceRoot?: (harness: HarnessId) => string | null;
|
|
110
110
|
/**
|
|
111
|
-
* The principal signing-key manager for `setup`'s `[4/
|
|
111
|
+
* The principal signing-key manager for `setup`'s `[4/8] signing keys` step.
|
|
112
112
|
* Injectable so setup tests never reach the developer's real `ssh-keygen`,
|
|
113
113
|
* Keychain, libsecret, SSH agent, or `$HOME` (`makeFakePrincipalKeys` in
|
|
114
114
|
* test/hubkit.ts). Default: a real `PrincipalKeyManager` over `io.env`.
|
|
@@ -169,6 +169,19 @@ export type AddSource = {
|
|
|
169
169
|
* the reason), and a URL is classified by scheme alone.
|
|
170
170
|
*/
|
|
171
171
|
export declare function classifyAddSource(spec: string): AddSource;
|
|
172
|
+
export interface CrewRosterInstallOptions {
|
|
173
|
+
/** Test seam for a temporary-name collision before target installation. */
|
|
174
|
+
tempName?: () => string;
|
|
175
|
+
/** Test seam for a short/failed temporary write after the file was created. */
|
|
176
|
+
writeTemp?: (path: string, contents: string) => void;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Install a fully-written strongest-layer roster without replacing an
|
|
180
|
+
* operator's file. Only EEXIST from the final exclusive link is interpreted
|
|
181
|
+
* as an existing target; failures creating its parent or temporary file stay
|
|
182
|
+
* failures instead of being misreported as a harmless skip.
|
|
183
|
+
*/
|
|
184
|
+
export declare function installCrewRosterIfAbsent(path: string, contents: string, options?: CrewRosterInstallOptions): 'created' | 'existing';
|
|
172
185
|
/**
|
|
173
186
|
* Coerce a raw string (a hostname) into a valid agent account name, or `''` when
|
|
174
187
|
* nothing usable survives. Lowercase; drop every character outside the account
|