owenloop 0.5.20 → 0.5.21

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 CHANGED
@@ -4,6 +4,13 @@ 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.21](https://github.com/typicalday/owenloop/compare/v0.5.20...v0.5.21) (2026-08-22)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **work:** resolve bundle-locked calls targets on workers ([#287](https://github.com/typicalday/owenloop/issues/287)) ([a2a6b47](https://github.com/typicalday/owenloop/commit/a2a6b47699ddc8b02f8f645ecc4a0ddd5269cf11))
13
+
7
14
  ## [0.5.20](https://github.com/typicalday/owenloop/compare/v0.5.19...v0.5.20) (2026-08-22)
8
15
 
9
16
 
@@ -7,13 +7,13 @@
7
7
  * requested order digest. `lookup` then reads only the verified definition held
8
8
  * in the in-memory cache populated by that prime.
9
9
  */
10
- import { dirname, join } from 'node:path';
10
+ import { join } from 'node:path';
11
11
  import { readFileSync } from 'node:fs';
12
- import { parseManifestBytes } from "../bundle/manifest.js";
12
+ import { isVersionedReference, parseManifestBytes } from "../bundle/manifest.js";
13
13
  import { defInstructionDigest } from "../order-resolver.js";
14
- import { finalizeDefs, loadDefFile } from "../defs.js";
14
+ import { digestScopedCallsTargetKey, finalizeDefs, loadDefFile } from "../defs.js";
15
15
  import { readWorkflowStoreIndex } from "./index-file.js";
16
- import { StoreIntegrityError, compareStoreText, defDigest, objectDirForDigest, } from "./types.js";
16
+ import { StoreIntegrityError, compareStoreText, defDigest, objectDirForDigest, parseWorkflowCoordinate, } from "./types.js";
17
17
  import { coordinateDigestRead, projectStoreRoot, probeObjectDir, probeStoreRoot, storeIndexPath, } from "./resolve.js";
18
18
  export class StoreInstructionSourceError extends Error {
19
19
  name = 'StoreInstructionSourceError';
@@ -60,45 +60,191 @@ function asDefDigest(raw) {
60
60
  return undefined;
61
61
  }
62
62
  }
63
+ function errorText(error) {
64
+ return error instanceof Error ? error.message : String(error);
65
+ }
66
+ /**
67
+ * Read every workflow from one exact, already-addressed object. This is shared
68
+ * by a requested parent and its lock-pinned dependencies so child bytes get
69
+ * precisely the same installed-object verification before they are parsed.
70
+ */
71
+ async function loadVerifiedObject(root, bundleDigest, level, verifier) {
72
+ return coordinateDigestRead(root, bundleDigest, async () => {
73
+ const objectPath = await verifiedCandidateObject(root, bundleDigest, level, verifier);
74
+ try {
75
+ const manifest = parseManifestBytes(readFileSync(join(objectPath, 'bundle.yaml')));
76
+ const defs = new Map();
77
+ for (const [workflowName, workflowPath] of Object.entries(manifest.workflows)) {
78
+ const def = loadDefFile(join(objectPath, workflowPath));
79
+ if (def.name !== workflowName) {
80
+ throw new StoreIntegrityError('object-corrupt', bundleDigest, `workflow '${workflowPath}' has definition name '${def.name}', expected '${workflowName}'`);
81
+ }
82
+ // CAS provenance is part of calls: resolution, not the instruction
83
+ // projection. defInstructionDigest deliberately excludes it.
84
+ def.bundlePackage = manifest.package.name;
85
+ def.bundleDigest = bundleDigest;
86
+ def.bundleLock = { ...manifest.lock };
87
+ defs.set(def.name, def);
88
+ }
89
+ return { bundleDigest, objectPath, root, level, manifest, defs };
90
+ }
91
+ catch (error) {
92
+ if (error instanceof StoreIntegrityError)
93
+ throw error;
94
+ throw new StoreIntegrityError('object-corrupt', bundleDigest, errorText(error));
95
+ }
96
+ });
97
+ }
63
98
  export function createStoreInstructionSource(args) {
64
99
  const projectRoot = args.projectRoot === undefined ? undefined : projectStoreRoot(args.projectRoot);
65
100
  const globalRoot = projectStoreRoot(args.globalRoot);
66
101
  const cache = new Map();
67
102
  const inFlight = new Map();
68
- const loadCandidate = async (requestedDigest, bundleDigest, root, level) => coordinateDigestRead(root, bundleDigest, async () => {
69
- const objectPath = await verifiedCandidateObject(root, bundleDigest, level, args.verifier);
70
- const manifest = parseManifestBytes(readFileSync(join(objectPath, 'bundle.yaml')));
71
- const loaded = new Map();
72
- for (const [workflowName, workflowPath] of Object.entries(manifest.workflows)) {
73
- const def = loadDefFile(join(objectPath, workflowPath));
74
- if (def.name !== workflowName) {
75
- throw new StoreIntegrityError('object-corrupt', bundleDigest, `workflow '${workflowPath}' has definition name '${def.name}', expected '${workflowName}'`);
103
+ const configuredRoots = () => {
104
+ const roots = [];
105
+ if (projectRoot !== undefined)
106
+ roots.push({ root: projectRoot, level: 'project' });
107
+ roots.push({ root: globalRoot, level: 'global' });
108
+ return roots.filter((candidate, index) => roots.findIndex((other) => other.root === candidate.root) === index);
109
+ };
110
+ /**
111
+ * Build the private, verified closure required to validate exact locked
112
+ * calls. It intentionally walks only digests named by the parent chain, not
113
+ * the whole store: unrelated indexed corruption must not poison this order.
114
+ */
115
+ const loadCandidate = async (requestedDigest, bundleDigest, root, level) => {
116
+ const parent = await loadVerifiedObject(root, bundleDigest, level, args.verifier);
117
+ const validation = new Map(parent.defs);
118
+ const support = new Map();
119
+ const loadedByRootAndDigest = new Map();
120
+ const registeredDependencies = new Set();
121
+ const walked = new Set();
122
+ const keyFor = (object) => `${object.root}:${object.bundleDigest}`;
123
+ const remember = (object) => {
124
+ support.set(keyFor(object), object);
125
+ };
126
+ const registerDependencyDefinitions = (object) => {
127
+ const key = keyFor(object);
128
+ if (registeredDependencies.has(key))
129
+ return;
130
+ registeredDependencies.add(key);
131
+ for (const [workflowName, def] of object.defs) {
132
+ validation.set(digestScopedCallsTargetKey(object.bundleDigest, workflowName), def);
76
133
  }
77
- loaded.set(def.name, def);
78
- }
79
- const finalized = finalizeDefs(loaded);
134
+ };
135
+ remember(parent);
136
+ loadedByRootAndDigest.set(keyFor(parent), parent);
137
+ const dependencyRoots = (from) => {
138
+ const roots = [{ root: from.root, level: from.level }, ...configuredRoots()];
139
+ return roots.filter((candidate, index) => roots.findIndex((other) => other.root === candidate.root) === index);
140
+ };
141
+ const loadAt = async (childDigest, candidate) => {
142
+ const key = `${candidate.root}:${childDigest}`;
143
+ const existing = loadedByRootAndDigest.get(key);
144
+ if (existing !== undefined)
145
+ return existing;
146
+ const loaded = await loadVerifiedObject(candidate.root, childDigest, candidate.level, args.verifier);
147
+ loadedByRootAndDigest.set(key, loaded);
148
+ remember(loaded);
149
+ return loaded;
150
+ };
151
+ const selectLockedTarget = (target, childDigest, child) => {
152
+ let coordinate;
153
+ try {
154
+ coordinate = parseWorkflowCoordinate(target);
155
+ }
156
+ catch (error) {
157
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' has an invalid coordinate: ${errorText(error)}`);
158
+ }
159
+ if (coordinate.name !== child.manifest.package.name
160
+ || coordinate.version !== child.manifest.package.version) {
161
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' does not match child manifest package '${child.manifest.package.name}@${child.manifest.package.version}'`);
162
+ }
163
+ const workflowName = child.manifest.default
164
+ ?? (child.defs.size === 1 ? child.defs.keys().next().value : undefined);
165
+ if (workflowName === undefined) {
166
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' digest ${childDigest} exports multiple workflows and has no default`);
167
+ }
168
+ const selected = child.defs.get(workflowName);
169
+ if (selected === undefined) {
170
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' selects missing child workflow '${workflowName}'`);
171
+ }
172
+ return selected;
173
+ };
174
+ const walkObject = async (object) => {
175
+ const objectKey = keyFor(object);
176
+ if (walked.has(objectKey))
177
+ return;
178
+ walked.add(objectKey);
179
+ for (const def of object.defs.values()) {
180
+ for (const step of def.steps) {
181
+ if (step.calls === undefined || !isVersionedReference(step.calls))
182
+ continue;
183
+ const target = step.calls;
184
+ if (!Object.prototype.hasOwnProperty.call(object.manifest.lock, target)) {
185
+ throw new StoreIntegrityError('object-corrupt', object.bundleDigest, `locked calls target '${target}' has no entry in parent bundle ${object.bundleDigest} manifest lock`);
186
+ }
187
+ const childDigest = defDigest(object.manifest.lock[target]);
188
+ let child;
189
+ for (const candidate of dependencyRoots(object)) {
190
+ try {
191
+ child = await loadAt(childDigest, candidate);
192
+ break;
193
+ }
194
+ catch (error) {
195
+ if (error instanceof StoreIntegrityError && error.code === 'object-missing')
196
+ continue;
197
+ const verified = error instanceof StoreIntegrityError
198
+ && error.message.includes('object failed verification');
199
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' digest ${childDigest} at ${candidate.level}-level root '${candidate.root}' ` +
200
+ `${verified ? 'failed installed-object verification' : 'could not load verified child'}: ${errorText(error)}`);
201
+ }
202
+ }
203
+ if (child === undefined) {
204
+ throw new StoreIntegrityError('object-corrupt', childDigest, `locked calls target '${target}' digest ${childDigest} is absent from every configured workflow store root`);
205
+ }
206
+ const selected = selectLockedTarget(target, childDigest, child);
207
+ // An alias is the only qualified path a parent calls: edge may take.
208
+ // All child workflows also retain an internal digest-scoped key so their
209
+ // bare sibling calls validate in the bundle that authored them.
210
+ if (child !== parent)
211
+ registerDependencyDefinitions(child);
212
+ validation.set(digestScopedCallsTargetKey(childDigest, target), selected);
213
+ await walkObject(child);
214
+ }
215
+ }
216
+ };
217
+ await walkObject(parent);
218
+ const finalized = finalizeDefs(validation);
219
+ const parentDefinitions = [...parent.defs.keys()].map((name) => finalized.get(name));
220
+ const cachedSupport = [...support.values()];
80
221
  // Hub-backed orders use the immutable bundle digest as their execution
81
- // identity. Keep every workflow from that exact verified object in the
82
- // cache; the later step lookup selects a unique definition and refuses an
83
- // ambiguous step name instead of choosing one by manifest order.
222
+ // identity. Dependencies are validation-only: never cache or publish them
223
+ // under the parent digest, even when a child step name is globally unique.
84
224
  if (requestedDigest === bundleDigest) {
85
- cache.set(requestedDigest, [...finalized.values()].map((def) => ({
225
+ cache.set(requestedDigest, parentDefinitions.map((def) => ({
86
226
  def,
87
227
  bundleDigest,
88
- objectPath,
228
+ objectPath: parent.objectPath,
229
+ support: cachedSupport,
89
230
  })));
90
231
  return true;
91
232
  }
92
233
  // Plain-YAML/local-engine orders retain the per-definition projection
93
234
  // digest path for backwards compatibility.
94
- for (const def of finalized.values()) {
235
+ for (const def of parentDefinitions) {
95
236
  if (defInstructionDigest(def) === requestedDigest) {
96
- cache.set(requestedDigest, [{ def, bundleDigest, objectPath }]);
237
+ cache.set(requestedDigest, [{
238
+ def,
239
+ bundleDigest,
240
+ objectPath: parent.objectPath,
241
+ support: cachedSupport,
242
+ }]);
97
243
  return true;
98
244
  }
99
245
  }
100
246
  return false;
101
- });
247
+ };
102
248
  const candidateFailureForRefusal = (error) => error instanceof StoreIntegrityError && error.code === 'object-missing' ? undefined : error;
103
249
  const scanTier = async (requestedDigest, bundleDigests, root, level) => {
104
250
  let firstFailure;
@@ -118,11 +264,12 @@ export function createStoreInstructionSource(args) {
118
264
  };
119
265
  const evictObject = (bundleDigest, objectPath) => {
120
266
  for (const [instructionDigest, cached] of cache) {
121
- const retained = cached.filter((candidate) => candidate.bundleDigest !== bundleDigest || candidate.objectPath !== objectPath);
122
- if (retained.length === 0)
267
+ // A cached entry is valid only while EVERY object that supported its
268
+ // locked-edge closure is valid. Never leave a parent usable after a
269
+ // supporting child changes or disappears.
270
+ if (cached.some((candidate) => candidate.support.some((support) => support.bundleDigest === bundleDigest && support.objectPath === objectPath))) {
123
271
  cache.delete(instructionDigest);
124
- else if (retained.length !== cached.length)
125
- cache.set(instructionDigest, retained);
272
+ }
126
273
  }
127
274
  };
128
275
  const verifyCached = async (requestedDigest) => {
@@ -131,23 +278,24 @@ export function createStoreInstructionSource(args) {
131
278
  return false;
132
279
  const verified = new Set();
133
280
  for (const candidate of cached) {
134
- const key = `${candidate.bundleDigest}:${candidate.objectPath}`;
135
- if (verified.has(key))
136
- continue;
137
- verified.add(key);
138
- const root = dirname(dirname(dirname(candidate.objectPath)));
139
- try {
140
- await coordinateDigestRead(root, candidate.bundleDigest, async () => {
141
- const verify = args.verifier.verifyInstalledObjectAfterCoordination ?? args.verifier.verifyInstalledObject;
142
- await verify.call(args.verifier, {
143
- objectDir: candidate.objectPath,
144
- digest: candidate.bundleDigest,
281
+ for (const support of candidate.support) {
282
+ const key = `${support.root}:${support.bundleDigest}`;
283
+ if (verified.has(key))
284
+ continue;
285
+ verified.add(key);
286
+ try {
287
+ await coordinateDigestRead(support.root, support.bundleDigest, async () => {
288
+ const verify = args.verifier.verifyInstalledObjectAfterCoordination ?? args.verifier.verifyInstalledObject;
289
+ await verify.call(args.verifier, {
290
+ objectDir: support.objectPath,
291
+ digest: support.bundleDigest,
292
+ });
145
293
  });
146
- });
147
- }
148
- catch (error) {
149
- evictObject(candidate.bundleDigest, candidate.objectPath);
150
- throw error;
294
+ }
295
+ catch (error) {
296
+ evictObject(support.bundleDigest, support.objectPath);
297
+ throw error;
298
+ }
151
299
  }
152
300
  }
153
301
  return true;
package/docs/bundles.md CHANGED
@@ -75,7 +75,7 @@ The following rules apply:
75
75
  - `runtime` is optional. When present, `runtime` is a closed mapping that contains `minVersion`, `features`, or both; `runtime: {}` is invalid. Runtime requirements are described in [Runtime compatibility](#runtime-compatibility).
76
76
  - `workflows` is a non-empty map from workflow names to archive-relative YAML paths. Each workflow name matches `/^[a-z][a-z0-9-]*$/`. Each path must pass the canonical bundle path safety policy, and two workflow names may not point to the same path.
77
77
  - A workflow file's `name:` must equal the workflow map key. For example, `workflows.delivery` must point to a file containing `name: delivery`.
78
- - An installed workflow is addressable from `calls:` by the qualified name `<package>/<workflow>`. A bare `calls: <workflow>` inside a CAS-installed bundle is resolved to a sibling from that same bundle; it does not search unrelated bundles for a same-named workflow. An exact versioned `calls: namespace/name@version` resolves through the verified store-index coordinate to the bundle's selected default workflow, then the engine checks the matching `lock` digest before creating the child.
78
+ - An installed workflow is addressable from `calls:` by the qualified name `<package>/<workflow>`. A bare `calls: <workflow>` inside a CAS-installed bundle is resolved to a sibling from that same bundle; it does not search unrelated bundles for a same-named workflow. For local-engine coordinate discovery, an exact versioned `calls: namespace/name@version` resolves through the verified store-index coordinate to the bundle's selected default workflow, then the engine checks the matching `lock` digest before creating the child. A worker validates the same edge differently: it follows only the verified parent manifest's pinned lock digest to a locally verified CAS object and never uses coordinator-supplied child definition bytes.
79
79
  - `default` is optional. When present, `default` must be one of the workflow map keys. When absent, a single-workflow package has that one workflow as its implicit default. A package with two or more workflows has no implicit default: the versioned coordinate is not registered as a callable target, while explicit `<package>/<workflow>` targets remain available.
80
80
  - `platforms` is a duplicate-free list of portable selector strings. The list is advisory; platform policy is outside the package parser.
81
81
  - `integrity.algorithm` is exactly `sha256`.
package/docs/design.md CHANGED
@@ -1875,10 +1875,21 @@ operation required by `OrderResolver`:
1875
1875
  is loaded. A project object that exists but is corrupt is an integrity
1876
1876
  refusal; it is not hidden by a valid global copy.
1877
1877
  3. The source reads the verified object's `bundle.yaml`, loads every workflow
1878
- path listed in the `workflows` map, finalizes all definitions together, and
1879
- computes each instruction projection digest. The source caches the matching
1880
- definition when one projection digest equals the order's `defDigest`.
1881
- 4. `lookup` then serves the cached step's authored body and command bytes. A
1878
+ path listed in the `workflows` map, and attaches its package, digest, and
1879
+ copied manifest lock as CAS provenance. For every exact versioned
1880
+ `calls:` edge, it follows only that verified manifest's lock digest,
1881
+ verifies the exact child object with the same installed-object verifier,
1882
+ resolves the child's explicit default (or its sole workflow), and repeats
1883
+ recursively. It strictly finalizes the combined private map, so child
1884
+ inputs, output shape, and cross-bundle cycles remain executable-time
1885
+ validations rather than deferred assumptions.
1886
+ 4. The cache exposes only definitions originating in the requested object; a
1887
+ dependency is never addressable through its parent's digest. Each cache entry
1888
+ records every verified supporting object, and a later `prime` re-verifies
1889
+ that entire support set, evicting every dependent cached parent on a failure.
1890
+ The source then computes each requested-object instruction projection digest
1891
+ and caches the matching definition when one equals the order's `defDigest`.
1892
+ 5. `lookup` then serves the cached step's authored body and command bytes. A
1882
1893
  cache miss is `unknown-digest`; a known digest with no matching step is
1883
1894
  `unknown-step`.
1884
1895
 
package/docs/embedding.md CHANGED
@@ -137,9 +137,13 @@ const instructions = resolver.resolveOrder(order); // synchronous cache lookup
137
137
 
138
138
  `prime` returns `resolved` or `unknown-digest`; an integrity failure is a
139
139
  separate refusal. The source enumerates indexed bundle objects, verifies each
140
- candidate on read, loads every workflow path listed by its `bundle.yaml`, and
141
- matches each finalized definition's instruction projection digest to
142
- `order.defDigest`. The order's digest is the
140
+ candidate on read, and for an exact versioned `calls:` edge follows only the
141
+ digest in that verified parent's manifest lock. Each pinned child is verified
142
+ before its workflow bytes are read; the combined closure is finalized strictly,
143
+ but only definitions from the requested object enter the instruction cache.
144
+ Later primes re-verify every object supporting that closure. The source matches
145
+ each requested definition's instruction projection digest to `order.defDigest`.
146
+ The order's digest is the
143
147
  only instruction key supplied by the transport; the source never accepts
144
148
  prompt or command text from the packet. `createEngine` keeps its default
145
149
  loaded-definition emitter, because the store source's `digestOf` is deliberately
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.20",
3
+ "version": "0.5.21",
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.20",
3
+ "version": "0.5.21",
4
4
  "description": "Claude Code driver for owenloop — cross-harness shift and conduct skills driven by the owenloop CLI, plus one hub control-plane MCP server backing an author skill and a fallback worker, for conducting and authoring workflows against your hosted owenloop server.",
5
5
  "author": {
6
6
  "name": "Typical Day"
@@ -7,7 +7,7 @@
7
7
  "mcp"
8
8
  ],
9
9
  "env": {
10
- "OWENLOOP_PLUGIN_VERSION": "0.5.20"
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.21"
11
11
  }
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.20",
3
+ "version": "0.5.21",
4
4
  "description": "Codex plugin for the owenloop workflow engine.",
5
5
  "skills": "./skills/",
6
6
  "mcpServers": "./.mcp.json"
@@ -6,7 +6,7 @@
6
6
  "mcp"
7
7
  ],
8
8
  "env": {
9
- "OWENLOOP_PLUGIN_VERSION": "0.5.20"
9
+ "OWENLOOP_PLUGIN_VERSION": "0.5.21"
10
10
  },
11
11
  "env_vars": [
12
12
  "HOME",