owenloop 0.5.10 → 0.5.11

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/dist/src/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * workflow definitions + a Step Agent that executes orders) layers a concrete
12
12
  * process — software delivery, research, triage — on top of it.
13
13
  */
14
- export { CallsPinError, Engine, ModifierRefusalError } from "./engine.js";
14
+ export { CallsPinError, Engine, InterfaceBindingRefusalError, InterfaceCallPinError, ModifierRefusalError, } from "./engine.js";
15
15
  // Routing capabilities: offer-time composition and the claim-side match. The
16
16
  // hub imports these to reason about the same compounds the engine composes.
17
17
  export { applyCapabilityMappings, applyCapabilityRewrites, capabilityName, claimMatches, composeCapabilities, DEFAULT_MATCH_MODE, MODIFIER_SEPARATOR, } from "./capabilities.js";
@@ -22,7 +22,7 @@ export { Store, openStore, readRuntimeSnapshotBundlePins, StoreVersionError } fr
22
22
  // store above): two-level digest-addressed workflow objects + coordinate
23
23
  // index, `.wnlp` bundle installation, and fail-closed resolution.
24
24
  export { defDigest, collectWorkflowStoreGarbage, emptyWorkflowStoreIndex, globalStoreRoot, hardenObjectModes, installWorkflowBundle, inspectCasDefs, isDefDigest, loadCasDefs, planWorkflowStoreGc, objectDestRelPath, objectDirForDigest, parseWorkflowCoordinate, parseWorkflowStoreIndex, projectStoreRoot, probeObjectDir, probeStoreRoot, readWorkflowStoreIndex, recoverWorkflowStore, resolveWorkflowCoordinate, resolveWorkflowDigest, serializeWorkflowStoreIndex, storeIndexPath, workflowCoordinate, workflowStoreStatePaths, WORKFLOW_STORE_INDEX_VERSION, WorkflowStoreError, StoreIndexError, StoreDigestError, StoreCoordinateError, StoreAmbiguityError, StoreNotFoundError, StoreIntegrityError, StoreConflictError, StoreDefinitionVerificationError, StoreOriginPolicyError, StorePathError, BundleIngestorUnavailableError, PreCommitVerifierUnavailableError, createExecutionOriginVerifier, originEvidencePath, persistOriginEvidence, readOriginEvidence, } from "./store/index.js";
25
- export { buildDef, cancelCleanupSteps, DefError, expandIncludes, finalizeDefs, hashDef, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, resolveCallsTarget, SUPPORTED_ENGINE_VERSION, validateDef } from "./defs.js";
25
+ export { buildDef, cancelCleanupSteps, DefError, expandIncludes, finalizeDefs, hashDef, InterfaceCallDefinitionError, lintDef, loadDefFile, loadDefs, loadDefsRaw, parseDef, resolveCallsTarget, SUPPORTED_ENGINE_VERSION, validateDef } from "./defs.js";
26
26
  export { checkInterfaceCompatibility, implementsIssues } from "./implements.js";
27
27
  export { credentialSlot, hashDefForHub, keychainServiceFor, normalizeOrigin, readStoredCredential } from "./hub.js";
28
28
  export { deleteCredential, ensureFreshOAuth, storeCredential } from "./credentials.js";
@@ -40,6 +40,6 @@ export { enrollmentGrantSchema, orderSchema, originSchema, policyFloorSchema, pu
40
40
  // typed errors. Low-level tar builders and add install primitives are
41
41
  // deliberately NOT exported through this surface (see docs/bundles.md).
42
42
  export { BundleError, DEFAULT_BUNDLE_LIMITS, digestBundle, inspectBundle, packBundle, unpackBundle } from "./bundle/index.js";
43
- export { DEBT_STATES, SETTLED_STATES } from "./types.js";
43
+ export { DEBT_STATES, isCallStep, SETTLED_STATES } from "./types.js";
44
44
  // ---- WP-D2 signed submission records ----
45
45
  export { canonicalValueBytes, valueDigestHex, buildSubmissionRecord, signSubmission } from "./crypto/index.js";
package/dist/src/model.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * The artifact set for one workflow instance is passed as a `Map<path, data>`.
11
11
  */
12
12
  import { bindProduce, elementPath, isMemberOf, parseElement, sealPath, sealStem, } from "./paths.js";
13
- import { DEBT_STATES, OUTSTANDING_STATES, SETTLED_STATES } from "./types.js";
13
+ import { DEBT_STATES, isCallStep, OUTSTANDING_STATES, SETTLED_STATES } from "./types.js";
14
14
  /**
15
15
  * Time facts used only when classifying a model-checker no-moves state. This
16
16
  * asks whether elapsed idle time could release a move; it deliberately does
@@ -431,7 +431,7 @@ export function requiredInputs(def, arts, art) {
431
431
  */
432
432
  function maintenanceInputs(def, arts, art) {
433
433
  const step = stepByName(def, art.producer);
434
- if (step?.calls)
434
+ if (step !== undefined && isCallStep(step))
435
435
  return Object.values(step.callsInputs ?? {});
436
436
  return requiredInputs(def, arts, art);
437
437
  }
@@ -595,7 +595,7 @@ function callsGateReady(step, arts) {
595
595
  function callsDischargeFirings(def, arts) {
596
596
  const firings = [];
597
597
  for (const step of def.steps) {
598
- if (!step.calls)
598
+ if (!isCallStep(step))
599
599
  continue;
600
600
  if (!callsGateReady(step, arts))
601
601
  continue;
@@ -670,7 +670,7 @@ export function eligibleFirings(def, arts, time, opts) {
670
670
  const firings = [];
671
671
  for (const step of def.steps) {
672
672
  // M2: calls: steps are machine-handled (the engine spawns the child); never emit a worker firing.
673
- if (step.calls)
673
+ if (isCallStep(step))
674
674
  continue;
675
675
  // §24: a judge step fires through the NORMAL pipeline (§7.1) — level-triggered
676
676
  // on "the judged stem is submitted and this judge hasn't approved the current
@@ -937,7 +937,7 @@ export function maintainDecisions(def, arts, time) {
937
937
  // was made on green inputs (§16.1).
938
938
  if (art.acceptance === 'skipped') {
939
939
  const producerStep = stepByName(def, art.producer);
940
- const isCallsCascade = producerStep?.calls && isEngineStructuralSkip(art);
940
+ const isCallsCascade = producerStep !== undefined && isCallStep(producerStep) && isEngineStructuralSkip(art);
941
941
  const req = isCallsCascade ? maintenanceInputs(def, arts, art) : requiredInputs(def, arts, art);
942
942
  const allGreen = req.length > 0 && req.every((p) => isGreen(arts.get(p)));
943
943
  const moved = !fingerprintMatches(arts, req, art.fingerprint ?? {});
@@ -1988,7 +1988,7 @@ function eligibleOutcomes(def, arts, firing) {
1988
1988
  // calls: produce may carry neither `judges:` nor `group:` (rejected by
1989
1989
  // `buildStep`). Modeling only the green keeps the successor set faithful to
1990
1990
  // what the engine can actually do here.
1991
- if (step.calls)
1991
+ if (isCallStep(step))
1992
1992
  return ['green'];
1993
1993
  const stem = collectionStem(step);
1994
1994
  const outPath = firing.outputs[0] ?? '';
@@ -111,6 +111,7 @@ export function defInstructionDigest(def) {
111
111
  ...(s.capabilities !== undefined ? { capabilities: s.capabilities } : {}),
112
112
  ...(s.maxLeaseMs !== undefined ? { maxLeaseMs: s.maxLeaseMs } : {}),
113
113
  ...(s.calls !== undefined ? { calls: s.calls } : {}),
114
+ ...(s.callsInterface !== undefined ? { callsInterface: s.callsInterface } : {}),
114
115
  ...(s.callsInputs !== undefined ? { callsInputs: s.callsInputs } : {}),
115
116
  ...(s.judges !== undefined ? { judges: s.judges } : {}),
116
117
  ...(s.groups !== undefined ? { groups: s.groups } : {}),
@@ -266,6 +266,7 @@ export function planWorkflowStoreGc(args) {
266
266
  const digests = [
267
267
  ...(snapshot.bundleDigest === undefined ? [] : [defDigest(snapshot.bundleDigest)]),
268
268
  ...snapshot.bundleLock.map((digest) => defDigest(digest)),
269
+ ...(snapshot.interfaceBindingDigests ?? []).map((digest) => defDigest(digest)),
269
270
  ];
270
271
  for (const digest of digests) {
271
272
  if (targetCoordinatesForDigest(digest).length > 0) {
@@ -44,6 +44,8 @@ export interface RuntimeSnapshotBundlePins {
44
44
  bundleLock: string[];
45
45
  /** Exact versioned calls not already covered by this snapshot's bundle lock. */
46
46
  exactCalls?: string[];
47
+ /** Start-bound implementation bundles retained before any child is spawned. */
48
+ interfaceBindingDigests?: string[];
47
49
  }
48
50
  /**
49
51
  * Read bundle pins from an EXISTING runtime database without migrating or
package/dist/src/store.js CHANGED
@@ -84,23 +84,35 @@ export function readRuntimeSnapshotBundlePins(path) {
84
84
  if (!hasWorkflow)
85
85
  return [];
86
86
  const columns = db.prepare('PRAGMA table_info(workflow)').all();
87
- if (!columns.some((column) => column.name === 'def_snapshot'))
87
+ const hasSnapshotColumn = columns.some((column) => column.name === 'def_snapshot');
88
+ const hasBindingsColumn = columns.some((column) => column.name === 'interface_bindings');
89
+ if (!hasSnapshotColumn && !hasBindingsColumn)
88
90
  return [];
91
+ const snapshotProjection = hasSnapshotColumn ? 'def_snapshot' : 'NULL AS def_snapshot';
92
+ const bindingProjection = hasBindingsColumn ? 'interface_bindings' : 'NULL AS interface_bindings';
93
+ const predicates = [
94
+ ...(hasSnapshotColumn ? ['def_snapshot IS NOT NULL'] : []),
95
+ ...(hasBindingsColumn ? ['interface_bindings IS NOT NULL'] : []),
96
+ ];
89
97
  const rows = db
90
- .prepare('SELECT id, def_snapshot FROM workflow WHERE def_snapshot IS NOT NULL ORDER BY created_at, id')
98
+ .prepare(`SELECT id, ${snapshotProjection}, ${bindingProjection} FROM workflow `
99
+ + `WHERE ${predicates.join(' OR ')} ORDER BY created_at, id`)
91
100
  .all();
92
101
  return rows.map((row) => {
93
- let snapshot;
94
- try {
95
- snapshot = JSON.parse(row.def_snapshot);
96
- }
97
- catch (error) {
98
- throw new Error(`workflow '${row.id}' has malformed def_snapshot JSON: ${error.message}`);
99
- }
100
- if (typeof snapshot !== 'object' || snapshot === null || Array.isArray(snapshot)) {
101
- throw new Error(`workflow '${row.id}' has malformed def_snapshot: expected an object`);
102
+ let record = {};
103
+ if (row.def_snapshot !== null) {
104
+ let snapshot;
105
+ try {
106
+ snapshot = JSON.parse(row.def_snapshot);
107
+ }
108
+ catch (error) {
109
+ throw new Error(`workflow '${row.id}' has malformed def_snapshot JSON: ${error.message}`);
110
+ }
111
+ if (typeof snapshot !== 'object' || snapshot === null || Array.isArray(snapshot)) {
112
+ throw new Error(`workflow '${row.id}' has malformed def_snapshot: expected an object`);
113
+ }
114
+ record = snapshot;
102
115
  }
103
- const record = snapshot;
104
116
  const rawDigest = record.bundleDigest;
105
117
  let bundleDigest;
106
118
  if (rawDigest !== undefined && rawDigest !== '') {
@@ -120,11 +132,15 @@ export function readRuntimeSnapshotBundlePins(path) {
120
132
  }
121
133
  return digest;
122
134
  });
123
- const exactCalls = exactCallsFromSnapshot(record, row.id);
135
+ const exactCalls = row.def_snapshot === null ? [] : exactCallsFromSnapshot(record, row.id);
136
+ const interfaceBindingDigests = [
137
+ ...new Set((parseStoredInterfaceBindings(row.interface_bindings, row.id) ?? []).map((binding) => binding.digest)),
138
+ ].sort(compareStoreText);
124
139
  return {
125
140
  ...(bundleDigest === undefined ? {} : { bundleDigest }),
126
141
  bundleLock: [...new Set(bundleLock)].sort(compareStoreText),
127
142
  ...(exactCalls.length === 0 ? {} : { exactCalls }),
143
+ ...(interfaceBindingDigests.length === 0 ? {} : { interfaceBindingDigests }),
128
144
  };
129
145
  });
130
146
  }
@@ -148,6 +164,7 @@ CREATE TABLE IF NOT EXISTS workflow (
148
164
  params TEXT NOT NULL DEFAULT '{}',
149
165
  modifier TEXT,
150
166
  meta TEXT,
167
+ interface_bindings TEXT,
151
168
  created_at INTEGER NOT NULL
152
169
  );
153
170
 
@@ -272,8 +289,11 @@ CREATE TABLE IF NOT EXISTS meta (
272
289
  *
273
290
  * Bumped to '11' for bound artifacts: the `workflow` table gains nullable
274
291
  * JSON `meta` for non-routing `meta.<key>` artifact binds.
292
+ *
293
+ * Bumped to '12' for immutable start-time interface-call bindings: the
294
+ * `workflow` table gains nullable JSON `interface_bindings`.
275
295
  */
276
- const SCHEMA_VERSION = '11';
296
+ const SCHEMA_VERSION = '12';
277
297
  /** Thrown by the `Store` constructor when the on-disk `schema_version` is
278
298
  * newer than this binary's `SCHEMA_VERSION` — the operator needs to
279
299
  * upgrade their owenloop install to open this database. */
@@ -346,6 +366,98 @@ function fromJson(s, fallback, ctx) {
346
366
  throw new Error(`Corrupt JSON in ${ctx.table}.${ctx.column} for row ${ctx.id}: ${msg}`);
347
367
  }
348
368
  }
369
+ function parseStoredInterfaceBindings(s, workflow) {
370
+ const value = fromJson(s, undefined, {
371
+ table: 'workflow',
372
+ id: workflow,
373
+ column: 'interface_bindings',
374
+ });
375
+ if (value === undefined)
376
+ return undefined;
377
+ if (!Array.isArray(value)) {
378
+ throw new Error(`workflow '${workflow}' has malformed interface_bindings: expected an array`);
379
+ }
380
+ const seenClaims = new Set();
381
+ for (const [index, binding] of value.entries()) {
382
+ const path = `workflow '${workflow}' interface_bindings[${index}]`;
383
+ if (typeof binding !== 'object' || binding === null || Array.isArray(binding)) {
384
+ throw new Error(`${path} is malformed: expected an object`);
385
+ }
386
+ const record = binding;
387
+ const bindingKeys = Object.keys(record).filter((key) => key !== 'interface' && key !== 'target' && key !== 'digest' && key !== 'signature');
388
+ if (bindingKeys.length > 0) {
389
+ throw new Error(`${path} is malformed: unknown field${bindingKeys.length === 1 ? '' : 's'} ${bindingKeys.join(', ')}`);
390
+ }
391
+ const claim = record.interface;
392
+ if (typeof claim !== 'object' || claim === null || Array.isArray(claim)) {
393
+ throw new Error(`${path}.interface is malformed: expected an object`);
394
+ }
395
+ const claimRecord = claim;
396
+ const claimKeys = Object.keys(claimRecord).filter((key) => key !== 'name' && key !== 'version');
397
+ if (claimKeys.length > 0) {
398
+ throw new Error(`${path}.interface is malformed: unknown field${claimKeys.length === 1 ? '' : 's'} ${claimKeys.join(', ')}`);
399
+ }
400
+ if (typeof claimRecord.name !== 'string' || claimRecord.name.trim() === ''
401
+ || typeof claimRecord.version !== 'string' || claimRecord.version.trim() === '') {
402
+ throw new Error(`${path}.interface is malformed: name and version must be non-empty strings`);
403
+ }
404
+ const claimKey = JSON.stringify([claimRecord.name, claimRecord.version]);
405
+ if (seenClaims.has(claimKey)) {
406
+ throw new Error(`${path}.interface is malformed: duplicate interface claim ${claimRecord.name}@${claimRecord.version}`);
407
+ }
408
+ seenClaims.add(claimKey);
409
+ if (typeof record.target !== 'string') {
410
+ throw new Error(`${path}.target is malformed: expected an exact workflow coordinate`);
411
+ }
412
+ try {
413
+ parseWorkflowCoordinate(record.target);
414
+ }
415
+ catch (error) {
416
+ throw new Error(`${path}.target is malformed: ${error.message}`);
417
+ }
418
+ if (typeof record.digest !== 'string' || !isDefDigest(record.digest)) {
419
+ throw new Error(`${path}.digest is noncanonical: ${JSON.stringify(record.digest)}`);
420
+ }
421
+ const signature = record.signature;
422
+ if (typeof signature !== 'object' || signature === null || Array.isArray(signature)) {
423
+ throw new Error(`${path}.signature is malformed: expected an object`);
424
+ }
425
+ const signatureRecord = signature;
426
+ const signatureKeys = Object.keys(signatureRecord).filter((key) => key !== 'inputs' && key !== 'outputs');
427
+ if (signatureKeys.length > 0) {
428
+ throw new Error(`${path}.signature is malformed: unknown field${signatureKeys.length === 1 ? '' : 's'} ${signatureKeys.join(', ')}`);
429
+ }
430
+ if (!Array.isArray(signatureRecord.inputs) || !Array.isArray(signatureRecord.outputs)) {
431
+ throw new Error(`${path}.signature is malformed: inputs and outputs must be arrays`);
432
+ }
433
+ const signatureArtifacts = {
434
+ inputs: signatureRecord.inputs,
435
+ outputs: signatureRecord.outputs,
436
+ };
437
+ for (const direction of ['inputs', 'outputs']) {
438
+ for (const [artifactIndex, artifact] of signatureArtifacts[direction].entries()) {
439
+ const artifactPath = `${path}.signature.${direction}[${artifactIndex}]`;
440
+ if (typeof artifact !== 'object' || artifact === null || Array.isArray(artifact)) {
441
+ throw new Error(`${artifactPath} is malformed: expected an object`);
442
+ }
443
+ const artifactRecord = artifact;
444
+ const artifactKeys = Object.keys(artifactRecord).filter((key) => key !== 'name' && key !== 'schema');
445
+ if (artifactKeys.length > 0) {
446
+ throw new Error(`${artifactPath} is malformed: unknown field${artifactKeys.length === 1 ? '' : 's'} ${artifactKeys.join(', ')}`);
447
+ }
448
+ if (typeof artifactRecord.name !== 'string' || artifactRecord.name.trim() === '') {
449
+ throw new Error(`${artifactPath}.name is malformed: expected a non-empty string`);
450
+ }
451
+ if (artifactRecord.schema !== undefined
452
+ && typeof artifactRecord.schema !== 'boolean'
453
+ && (typeof artifactRecord.schema !== 'object' || artifactRecord.schema === null || Array.isArray(artifactRecord.schema))) {
454
+ throw new Error(`${artifactPath}.schema is malformed: expected a JSON Schema object or boolean`);
455
+ }
456
+ }
457
+ }
458
+ }
459
+ return value;
460
+ }
349
461
  function mapArtifact(r) {
350
462
  const out = {
351
463
  id: r.id,
@@ -498,6 +610,9 @@ function mapWorkflow(r) {
498
610
  });
499
611
  if (meta !== undefined)
500
612
  out.meta = meta;
613
+ const interfaceBindings = parseStoredInterfaceBindings(r.interface_bindings, r.id);
614
+ if (interfaceBindings !== undefined)
615
+ out.interfaceBindings = interfaceBindings;
501
616
  return out;
502
617
  }
503
618
  // ---- the store ---------------------------------------------------------------
@@ -659,6 +774,9 @@ export class Store {
659
774
  if (!wfCols.some((c) => c.name === 'meta')) {
660
775
  this.db.exec(`ALTER TABLE workflow ADD COLUMN meta TEXT`);
661
776
  }
777
+ if (!wfCols.some((c) => c.name === 'interface_bindings')) {
778
+ this.db.exec(`ALTER TABLE workflow ADD COLUMN interface_bindings TEXT`);
779
+ }
662
780
  // Only a genuine pre-v8 -> v8 upgrade may backfill the current projection's
663
781
  // reason thread. Re-opening an already-v8 database must not manufacture a
664
782
  // second copy of its lifecycle events (even though the legacy keys differ
@@ -745,9 +863,9 @@ export class Store {
745
863
  const at = nowMs();
746
864
  this.db
747
865
  .prepare(`INSERT INTO workflow
748
- (id, def, title, params, produced_by_wf, produced_by_path, def_snapshot, def_hash, modifier, meta, created_at)
749
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
750
- .run(id, data.def, data.title ?? null, JSON.stringify(data.params ?? {}), producedBy?.parentWf ?? null, producedBy?.parentPath ?? null, toJson(data.defSnapshot), data.defHash ?? null, data.modifier ?? null, toJson(data.meta), at);
866
+ (id, def, title, params, produced_by_wf, produced_by_path, def_snapshot, def_hash, modifier, meta, interface_bindings, created_at)
867
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
868
+ .run(id, data.def, data.title ?? null, JSON.stringify(data.params ?? {}), producedBy?.parentWf ?? null, producedBy?.parentPath ?? null, toJson(data.defSnapshot), data.defHash ?? null, data.modifier ?? null, toJson(data.meta), toJson(data.interfaceBindings), at);
751
869
  return this.getWorkflow(id);
752
870
  }
753
871
  /**
@@ -42,6 +42,32 @@ export type RejectKind = 'judgment' | 'structural' | 'validation' | 'invalidated
42
42
  export type ReasonAction = 'reject' | 'retract' | 'skip' | 'reopen' | 'retry' | 'ask' | 'born-rejected' | 'schema-reject' | 'pinned';
43
43
  /** A JSON Schema, as authored in a definition: an object, or a boolean (allow/deny all). */
44
44
  export type JsonSchema = Record<string, unknown> | boolean;
45
+ /** A versioned external interface coordinate. Names and versions are opaque. */
46
+ export interface WorkflowInterfaceClaim {
47
+ name: string;
48
+ version: string;
49
+ }
50
+ /** A named input or public output and the schema that defines its values. */
51
+ export interface WorkflowInterfaceArtifact {
52
+ name: string;
53
+ schema?: JsonSchema;
54
+ }
55
+ /** The typed portion of an external workflow interface. */
56
+ export interface WorkflowInterfaceSignature {
57
+ inputs: WorkflowInterfaceArtifact[];
58
+ outputs: WorkflowInterfaceArtifact[];
59
+ }
60
+ /**
61
+ * One hub-selected implementation pinned when an instance starts. The engine
62
+ * validates the exact coordinate, bundle digest, nominal claim, and structural
63
+ * signature before persisting this immutable mapping.
64
+ */
65
+ export interface InterfaceCallBinding {
66
+ interface: WorkflowInterfaceClaim;
67
+ target: string;
68
+ digest: string;
69
+ signature: WorkflowInterfaceSignature;
70
+ }
45
71
  /** One entry in an artifact's append-only reason thread (design §4). */
46
72
  export interface ReasonEntry {
47
73
  at: number;
@@ -364,6 +390,12 @@ export interface WorkflowData {
364
390
  modifier?: string;
365
391
  /** Engine-written, non-routing metadata populated by artifact binds. */
366
392
  meta?: Record<string, unknown>;
393
+ /**
394
+ * Complete, normalized start-time interface-call bindings inherited by every
395
+ * calls child. Immutable instance state: routing/meta updates and adopt never
396
+ * rewrite it, and legacy rows map SQL NULL to true property absence.
397
+ */
398
+ interfaceBindings?: InterfaceCallBinding[];
367
399
  /** Instance-to-definition pinning (§28): the compiled def this instance was
368
400
  * created against, snapshotted verbatim as JSON. Absent on rows created
369
401
  * before this feature shipped — those instances fall back to today's
@@ -610,6 +642,8 @@ export interface StepDef {
610
642
  body: string;
611
643
  /** Mode 2 foundation: name of the child workflow this step delegates to. Machine-handled, never a worker firing. */
612
644
  calls?: string;
645
+ /** Versioned interface delegated to through the instance's immutable start-time binding. */
646
+ callsInterface?: WorkflowInterfaceClaim;
613
647
  /** Mode 2 foundation: child input name → parent artifact name wiring for a calls: step. */
614
648
  callsInputs?: Record<string, string>;
615
649
  /** §24 judges: marker naming the produce stem this synthesized step judges. Mirrors `calls?`. */
@@ -621,6 +655,8 @@ export interface StepDef {
621
655
  * `buildOrder` onto the Order for an external runner/tooling to read. */
622
656
  x?: Record<string, unknown>;
623
657
  }
658
+ /** True for either statically-targeted or start-bound machine call steps. */
659
+ export declare function isCallStep(step: Pick<StepDef, 'calls' | 'callsInterface'>): boolean;
624
660
  /** A workflow definition: a set of steps plus declared external inputs. */
625
661
  export interface WorkflowDef {
626
662
  name: string;
package/dist/src/types.js CHANGED
@@ -25,3 +25,7 @@ export const OUTSTANDING_STATES = new Set([
25
25
  ...DEBT_STATES,
26
26
  'submitted',
27
27
  ]);
28
+ /** True for either statically-targeted or start-bound machine call steps. */
29
+ export function isCallStep(step) {
30
+ return step.calls !== undefined || step.callsInterface !== undefined;
31
+ }
package/docs/authoring.md CHANGED
@@ -551,6 +551,16 @@ regardless of `executor:` — that requirement is orthogonal to this feature and
551
551
  applies even to a `executor: command` judge (the field just goes unread by a
552
552
  non-agent dispatcher).
553
553
 
554
+ Native judges declared here inherit the producing step's `capabilities:` when a
555
+ judge omits that key: the synthesized judge receives a copy. A non-empty
556
+ `capabilities:` list on the judge is authoritative and replaces — rather than
557
+ extends — the producer list; `capabilities: []` is invalid, so omit the key to
558
+ request inheritance. At offer time, the run modifier composes with every
559
+ capability in the resulting judge list just as it does for an ordinary step
560
+ (for example, `wise` under `deep` is offered as `wise:deep`). If neither the
561
+ producer nor judge supplies capabilities, the judge remains capability-silent,
562
+ and there is nothing to compose.
563
+
554
564
  Author `x:` on the producer step, not on individual judge entries. Every native
555
565
  judge synthesized from that producer inherits the producer's complete parsed
556
566
  `x:` map. Each judge receives an independent deep clone, so runner-side
@@ -642,7 +652,7 @@ from dead-end warnings, but unlike `terminal:` they stay re-armable.
642
652
  | `generates:` | step | yes | yes | internal sink, not the public interface |
643
653
  | `outputs:` | workflow | yes | yes | public interface / composition boundary |
644
654
 
645
- ## Composition — `include:` (compile-time) and `calls:` (runtime)
655
+ ## Composition — `include:` (compile-time) and runtime calls
646
656
 
647
657
  Two ways to build a workflow out of other workflows:
648
658
 
@@ -716,6 +726,64 @@ the engine re-provides it to the existing child — it never spawns a duplicate.
716
726
  | Use for | New combined workflows | Embedding an existing workflow as a black box |
717
727
  | Visibility | All child stems visible in the parent | Only the declared `produces:` artifact |
718
728
 
729
+ ### Calling a start-bound interface
730
+
731
+ `callsInterface:` is the interface-targeted form of a runtime call. The workflow
732
+ author names the exact interface version the step requires, while the host that starts
733
+ the instance selects the installed implementation. The engine validates that selection
734
+ before it writes the root instance and pins the complete binding set for the lifetime of
735
+ the run.
736
+
737
+ ```yaml
738
+ steps:
739
+ - name: report
740
+ callsInterface:
741
+ name: report
742
+ version: 1.0.0
743
+ inputs:
744
+ source: prepared_source
745
+ produces: [report]
746
+ ```
747
+
748
+ `callsInterface:` and `calls:` are mutually exclusive. Otherwise the call-step contract
749
+ is the same: exactly one `produces:` entry, child-input-to-parent-artifact `inputs:`
750
+ wiring, no `judges:` or `group:`, engine-managed spawning, and no Worker order for the
751
+ call step itself. Interface calls v1 also require the chosen implementation workflow to
752
+ declare exactly one public `outputs:` entry.
753
+
754
+ The host supplies one binding for every interface called directly by the workflow when
755
+ it invokes `Engine.createInstance`:
756
+
757
+ ```ts
758
+ engine.createInstance('parent', {
759
+ interfaceBindings: [{
760
+ interface: { name: 'report', version: '1.0.0' },
761
+ target: 'acme/report@2.3.1',
762
+ digest: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
763
+ signature: {
764
+ inputs: [{ name: 'source', schema: { type: 'object' } }],
765
+ outputs: [{ name: 'report', schema: { type: 'object' } }],
766
+ },
767
+ }],
768
+ });
769
+ ```
770
+
771
+ `target` must be an exact installed workflow coordinate and `digest` must be that
772
+ bundle's canonical lowercase SHA-256 digest. The target must carry a matching valid
773
+ `x.implements` claim, its declared input and output schemas must be structurally
774
+ compatible with the supplied signature, and every wired child input must exist in both
775
+ the signature and target. A missing, duplicate, malformed, stale, or incompatible
776
+ binding throws the named `InterfaceBindingRefusalError` before any workflow or artifact
777
+ row is inserted.
778
+
779
+ The root's normalized bindings are inherited unchanged by every child. At spawn time
780
+ the engine resolves the implementation by its exact digest again and transactionally
781
+ compares it with the persisted target and digest. A missing or repointed implementation
782
+ becomes visible structural debt on the parent call output; the engine does not fall
783
+ back, reselect, or rebind. Updates to installed implementations therefore affect only
784
+ new instances whose host selects them. Selection, ranking, and receipt authorship belong
785
+ to the host; the engine accepts, validates, persists, and enforces the resulting pin.
786
+
719
787
  ## `effect:` — re-running steps with side effects
720
788
 
721
789
  By default a step is **idempotent** — safe to re-run if its inputs move, which is what
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
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.10",
3
+ "version": "0.5.11",
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.10"
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.11"
11
11
  }
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
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.10"
9
+ "OWENLOOP_PLUGIN_VERSION": "0.5.11"
10
10
  },
11
11
  "env_vars": [
12
12
  "HOME",