owenloop 0.5.9 → 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/CHANGELOG.md +51 -0
- package/README.md +77 -37
- package/bin/owenloop.mjs +16 -1
- package/dist/packages/work/src/agent/loop.js +7 -0
- package/dist/packages/work/src/bundle/pull.d.ts +21 -0
- package/dist/packages/work/src/bundle/pull.js +118 -0
- package/dist/packages/work/src/exec/instructions.d.ts +4 -1
- package/dist/packages/work/src/exec/instructions.js +3 -0
- package/dist/packages/work/src/exec/loop.d.ts +1 -1
- package/dist/packages/work/src/exec/loop.js +92 -14
- package/dist/packages/work/src/harness/claude.js +16 -0
- package/dist/packages/work/src/harness/codex.d.ts +8 -0
- package/dist/packages/work/src/harness/codex.js +27 -1
- package/dist/packages/work/src/harness/contract.d.ts +9 -0
- package/dist/packages/work/src/roles/agent-run.js +38 -10
- package/dist/packages/work/src/roles/exec.js +25 -8
- package/dist/packages/work/src/shift/loop.js +118 -4
- package/dist/packages/work/src/shift/runtime.d.ts +3 -0
- package/dist/packages/work/src/shift/runtime.js +10 -1
- package/dist/packages/work/src/submit-proof.d.ts +11 -8
- package/dist/packages/work/src/submit-proof.js +11 -8
- package/dist/src/capabilities.d.ts +70 -6
- package/dist/src/capabilities.js +49 -6
- package/dist/src/capability-mapping-client.d.ts +29 -0
- package/dist/src/capability-mapping-client.js +160 -0
- package/dist/src/cli.d.ts +2 -2
- package/dist/src/cli.js +1200 -166
- package/dist/src/defs.d.ts +41 -1
- package/dist/src/defs.js +461 -92
- package/dist/src/engine.d.ts +108 -22
- package/dist/src/engine.js +573 -85
- package/dist/src/factory.js +5 -3
- package/dist/src/hub.d.ts +77 -0
- package/dist/src/hub.js +162 -0
- package/dist/src/implements.d.ts +37 -0
- package/dist/src/implements.js +790 -0
- package/dist/src/index.d.ts +12 -10
- package/dist/src/index.js +7 -6
- package/dist/src/mcp/serve.js +254 -45
- package/dist/src/mcp/server.d.ts +10 -7
- package/dist/src/mcp/server.js +53 -8
- package/dist/src/model.d.ts +46 -10
- package/dist/src/model.js +224 -78
- package/dist/src/order-resolver.js +1 -0
- package/dist/src/store/def-source.d.ts +19 -0
- package/dist/src/store/def-source.js +87 -17
- package/dist/src/store/gc-recovery.d.ts +46 -0
- package/dist/src/store/gc-recovery.js +258 -0
- package/dist/src/store/gc.d.ts +94 -0
- package/dist/src/store/gc.js +563 -0
- package/dist/src/store/index.d.ts +3 -1
- package/dist/src/store/index.js +2 -0
- package/dist/src/store/install.d.ts +34 -5
- package/dist/src/store/install.js +73 -11
- package/dist/src/store/pre-commit-verifier.js +42 -2
- package/dist/src/store/snapshot-guard.d.ts +18 -0
- package/dist/src/store/snapshot-guard.js +94 -0
- package/dist/src/store.d.ts +66 -4
- package/dist/src/store.js +333 -12
- package/dist/src/types.d.ts +97 -17
- package/dist/src/types.js +4 -0
- package/dist/src/util.js +4 -1
- package/docs/authoring.md +214 -9
- package/docs/bundles.md +19 -0
- package/docs/cli.md +270 -30
- package/docs/crypto.md +13 -7
- package/docs/design.md +107 -46
- package/docs/evals/mcp-charter-baseline.json +428 -0
- package/docs/mcp-charter-eval.md +124 -0
- package/docs/shift-logs.md +18 -0
- package/docs/wire-contracts.md +28 -7
- package/examples/workflows/compile-dev-playbook.yaml +1 -1
- package/examples/workflows/ship.yaml +28 -2
- package/package.json +2 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/claude-code/plugin/skills/author/SKILL.md +22 -0
- package/plugins/claude-code/plugin/skills/ephemeral/SKILL.md +95 -0
- package/plugins/claude-code/plugin/skills/graduate/SKILL.md +156 -0
- package/plugins/claude-code/plugin/skills/plan/SKILL.md +236 -0
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +22 -0
- package/plugins/codex/plugins/owenloop/skills/ephemeral/SKILL.md +95 -0
- package/plugins/codex/plugins/owenloop/skills/graduate/SKILL.md +156 -0
- package/plugins/codex/plugins/owenloop/skills/plan/SKILL.md +236 -0
package/dist/src/engine.d.ts
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { WorkflowStatus } from './model.ts';
|
|
13
13
|
import type { SchemaIssue } from './schema.ts';
|
|
14
|
-
import type { CapabilityRewrites, CrewStamps } from './capabilities.ts';
|
|
14
|
+
import type { CapabilityMappings, CapabilityRewrites, CrewStamps } from './capabilities.ts';
|
|
15
15
|
import type { MatchMode } from './capabilities.ts';
|
|
16
16
|
import type { Store } from './store.ts';
|
|
17
|
-
import type { Author, Fingerprint, Order, WorkflowDef } from './types.ts';
|
|
17
|
+
import type { Author, Fingerprint, InterfaceCallBinding, Order, WorkflowDef, WorkflowInterfaceClaim } from './types.ts';
|
|
18
18
|
import { OrderResolver } from './order-resolver.ts';
|
|
19
19
|
import type { OrderInstructionSource, ResolvedInstructions } from './order-resolver.ts';
|
|
20
20
|
export type { Order } from './types.ts';
|
|
@@ -60,6 +60,32 @@ export declare class CallsPinError extends Error {
|
|
|
60
60
|
readonly detail: string;
|
|
61
61
|
constructor(target: string, detail: string);
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* A caller-supplied start binding is missing, malformed, unresolved, or
|
|
65
|
+
* incompatible. This is a named 400-class refusal: no workflow row exists when
|
|
66
|
+
* it is thrown from the public start path.
|
|
67
|
+
*/
|
|
68
|
+
export declare class InterfaceBindingRefusalError extends Error {
|
|
69
|
+
readonly name = "InterfaceBindingRefusalError";
|
|
70
|
+
readonly workflow: string;
|
|
71
|
+
readonly step: string;
|
|
72
|
+
readonly interfaceName?: string;
|
|
73
|
+
readonly interfaceVersion?: string;
|
|
74
|
+
readonly detail: string;
|
|
75
|
+
constructor(workflow: string, step: string, claim: Partial<WorkflowInterfaceClaim> | undefined, detail: string);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A persisted interface binding no longer agrees with the optimistically
|
|
79
|
+
* resolved child at spawn time. The provision transaction rolls back and the
|
|
80
|
+
* parent call artifact receives one visible structural refusal.
|
|
81
|
+
*/
|
|
82
|
+
export declare class InterfaceCallPinError extends Error {
|
|
83
|
+
readonly name = "InterfaceCallPinError";
|
|
84
|
+
readonly interface: WorkflowInterfaceClaim;
|
|
85
|
+
readonly target: string;
|
|
86
|
+
readonly detail: string;
|
|
87
|
+
constructor(claim: WorkflowInterfaceClaim, target: string, detail: string);
|
|
88
|
+
}
|
|
63
89
|
/**
|
|
64
90
|
* §tick-deferred: an eligible firing the tick did NOT promote to an order, tagged
|
|
65
91
|
* with why. `'in-flight'` — the step's task is already claimed by an open run;
|
|
@@ -172,6 +198,12 @@ export interface CreateOpts {
|
|
|
172
198
|
* rewriting this stored value.
|
|
173
199
|
*/
|
|
174
200
|
modifier?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Hub-selected interface implementations. Every entry is validated and the
|
|
203
|
+
* complete normalized set is pinned immutably before the root row is written,
|
|
204
|
+
* then inherited by calls children.
|
|
205
|
+
*/
|
|
206
|
+
interfaceBindings?: InterfaceCallBinding[];
|
|
175
207
|
}
|
|
176
208
|
/**
|
|
177
209
|
* Thrown by `createInstance` when the requested modifier is not in the def's
|
|
@@ -196,9 +228,14 @@ export declare class ModifierRefusalError extends Error {
|
|
|
196
228
|
* unrelated `build` from bundle B). Because the parameter is optional, every
|
|
197
229
|
* existing single-argument resolver — including a host's hand-written one —
|
|
198
230
|
* keeps today's exact behavior with no change: a resolver that ignores `from`
|
|
199
|
-
* simply performs the flat lookup it always did.
|
|
231
|
+
* simply performs the flat lookup it always did. Interface bindings add the
|
|
232
|
+
* optional third `bundleDigest`: store-backed resolvers use it to prefer the
|
|
233
|
+
* exact digest-scoped alias, while the engine independently verifies the
|
|
234
|
+
* returned definition's digest before accepting or spawning it.
|
|
200
235
|
*/
|
|
201
|
-
export type DefResolver = (defName: string, from?: WorkflowDef
|
|
236
|
+
export type DefResolver = (defName: string, from?: WorkflowDef,
|
|
237
|
+
/** Exact CAS bundle digest requested by a persisted interface binding. */
|
|
238
|
+
bundleDigest?: string) => WorkflowDef;
|
|
202
239
|
/**
|
|
203
240
|
* A push notification of a committed engine change, delivered to observers
|
|
204
241
|
* registered via {@link Engine.subscribe}. Lets an in-process host react the
|
|
@@ -227,7 +264,7 @@ export type EngineEvent = {
|
|
|
227
264
|
type: 'closed';
|
|
228
265
|
workflow: string;
|
|
229
266
|
run: string;
|
|
230
|
-
outcome: 'ok' | 'no_work' | 'failed' | 'skipped';
|
|
267
|
+
outcome: 'ok' | 'no_work' | 'released' | 'failed' | 'skipped';
|
|
231
268
|
} | {
|
|
232
269
|
type: 'settled';
|
|
233
270
|
workflow: string;
|
|
@@ -311,6 +348,10 @@ export declare class Engine {
|
|
|
311
348
|
* its siblings. See {@link EngineEvent}.
|
|
312
349
|
*/
|
|
313
350
|
subscribe(listener: EngineListener): () => void;
|
|
351
|
+
/** Validate, resolve, and JSON-normalize every supplied start binding. */
|
|
352
|
+
private normalizeInterfaceBindings;
|
|
353
|
+
/** Pure child-insert guard over an already-normalized inherited binding set. */
|
|
354
|
+
private assertDirectInterfaceBindings;
|
|
314
355
|
/** Start a workflow instance: persist it, seed its declared inputs, settle. */
|
|
315
356
|
createInstance(defName: string, opts?: CreateOpts): string;
|
|
316
357
|
/**
|
|
@@ -383,11 +424,11 @@ export declare class Engine {
|
|
|
383
424
|
*/
|
|
384
425
|
private static readonly CHILD_OUTCOME_PIN_KEY;
|
|
385
426
|
/**
|
|
386
|
-
* F4: the single
|
|
387
|
-
* calls: artifact currently resting on"
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* to pin to).
|
|
427
|
+
* F4: the single verdict-time helper that computes "what child-outcome
|
|
428
|
+
* version is this calls: artifact currently resting on" for reject
|
|
429
|
+
* propagation and human skip. STEP 6 publication reads and stamps the version
|
|
430
|
+
* from its authoritative in-transaction snapshot instead. Returns undefined
|
|
431
|
+
* if no child has ever been spawned (nothing to pin to).
|
|
391
432
|
*/
|
|
392
433
|
private childOutcomePin;
|
|
393
434
|
/**
|
|
@@ -470,12 +511,15 @@ export declare class Engine {
|
|
|
470
511
|
* matter what moved concurrently.
|
|
471
512
|
*/
|
|
472
513
|
private recordCallsDigestReject;
|
|
514
|
+
/** Persist one interface-binding/pin refusal with the unchanged-gate guard. */
|
|
515
|
+
private recordInterfaceCallPinReject;
|
|
473
516
|
/**
|
|
474
517
|
* M2B: Maintain all `calls:` steps for a parent workflow.
|
|
475
518
|
* Called at the top of tick (outside any tx) and as cascade-up prompt.
|
|
476
519
|
* For each calls: step: spawn the child if gate is ready and no child exists;
|
|
477
520
|
* re-attach if it exists; re-provide if parent inputs moved; machine-green
|
|
478
|
-
* the parent artifact when the child's declared output is green
|
|
521
|
+
* the parent artifact when the child's declared output is green and the
|
|
522
|
+
* whole child workflow is done.
|
|
479
523
|
*/
|
|
480
524
|
private maintainCalls;
|
|
481
525
|
/**
|
|
@@ -505,11 +549,12 @@ export declare class Engine {
|
|
|
505
549
|
/**
|
|
506
550
|
* STEP 6 re-arm as the mirror-image atomic guard. maintainCalls' optimistic
|
|
507
551
|
* pre-read decides only WHETHER to call this; the parent artifact AND the
|
|
508
|
-
* child
|
|
509
|
-
* if the parent is still green AND the child
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
* Returns true only when
|
|
552
|
+
* child definition/artifacts are re-read inside the write lock, and the
|
|
553
|
+
* re-arm happens only if the parent is still green AND either the child
|
|
554
|
+
* outcome is non-green or the whole child is unfinished in-tx. If the outcome
|
|
555
|
+
* is green and the child is done by then, this does nothing (returns false)
|
|
556
|
+
* and the next maintainCalls pass publishes normally. Returns true only when
|
|
557
|
+
* it wrote.
|
|
513
558
|
*/
|
|
514
559
|
private rearmCallsGreen;
|
|
515
560
|
/**
|
|
@@ -548,6 +593,23 @@ export declare class Engine {
|
|
|
548
593
|
* decides a mode, it only enforces the one it is handed.
|
|
549
594
|
*/
|
|
550
595
|
matchModes?: Record<string, MatchMode>;
|
|
596
|
+
/**
|
|
597
|
+
* Per-AUTHORED-capability substitution, applied BEFORE the offer composes
|
|
598
|
+
* with the modifier, so one entry covers every grade a step can be
|
|
599
|
+
* offered at. Supplied by the same caller that supplies `matchModes` and
|
|
600
|
+
* for the same reason — deciding what an authored name means in this org
|
|
601
|
+
* requires reading an install-scoped table the pure engine cannot see.
|
|
602
|
+
* Substitution is a single hop and the value is never validated; the
|
|
603
|
+
* caller resolves any chain first. See `applyCapabilityMappings`.
|
|
604
|
+
*
|
|
605
|
+
* Absent or empty is exact identity: the offer is composed from the
|
|
606
|
+
* authored list itself, byte for byte, as before this input existed.
|
|
607
|
+
*
|
|
608
|
+
* Distinct from `capabilityRewrites` below, which is keyed by the
|
|
609
|
+
* COMPOSED string and applied AFTER composition. Both may apply in one
|
|
610
|
+
* tick, in that order.
|
|
611
|
+
*/
|
|
612
|
+
capabilityMappings?: CapabilityMappings;
|
|
551
613
|
/**
|
|
552
614
|
* Per-offered-capability reroute, keyed by the COMPOSED capability the
|
|
553
615
|
* offer would otherwise carry. Supplied by the same caller that supplies
|
|
@@ -641,9 +703,11 @@ export declare class Engine {
|
|
|
641
703
|
* Per-step cadence + daily budget + parallel cap over the eligible firings.
|
|
642
704
|
*
|
|
643
705
|
* A2: `capabilities` is the tick caller's claim filter, matched against the
|
|
644
|
-
* step's OFFERED capabilities — the authored list
|
|
645
|
-
*
|
|
646
|
-
*
|
|
706
|
+
* step's OFFERED capabilities — the authored list mapped onto the caller's
|
|
707
|
+
* own capability names, composed with the modifier this firing will actually
|
|
708
|
+
* be offered under (`wise` + `deep` → `wise:deep`), then rewritten by any
|
|
709
|
+
* reroute the caller decided on, which is the same list the order will carry.
|
|
710
|
+
* `claimMatches` owns the rule;
|
|
647
711
|
* see it for the four cases (no filter presented, capability-silent step,
|
|
648
712
|
* empty caller list, both non-empty) and for what `matchModes` changes.
|
|
649
713
|
* A firing this caller may not claim is deferred as `'capability-mismatch'`.
|
|
@@ -880,7 +944,7 @@ export declare class Engine {
|
|
|
880
944
|
*/
|
|
881
945
|
retry(workflow: string, path: string, by?: Author, text?: string): void;
|
|
882
946
|
/** Close a run (audit/budget) and release its lease so the task can re-arm. */
|
|
883
|
-
close(workflow: string, run: string, outcome?: 'ok' | 'no_work' | 'failed' | 'skipped', summary?: string): void;
|
|
947
|
+
close(workflow: string, run: string, outcome?: 'ok' | 'no_work' | 'released' | 'failed' | 'skipped', summary?: string): void;
|
|
884
948
|
/**
|
|
885
949
|
* Touch the liveness timestamp on an open run's task. A run that periodically
|
|
886
950
|
* calls heartbeat() will never be falsely reaped as long as beats arrive within
|
|
@@ -961,10 +1025,32 @@ export declare class Engine {
|
|
|
961
1025
|
private settle;
|
|
962
1026
|
private applyOp;
|
|
963
1027
|
/**
|
|
964
|
-
*
|
|
1028
|
+
* Re-stamp the owed version target for `path` on any OPEN claim that owes it.
|
|
1029
|
+
*
|
|
1030
|
+
* The target frozen at claim issue is `committed + 1`. That stays correct for
|
|
1031
|
+
* every refusal that leaves the run open WITHOUT bumping the artifact (the
|
|
1032
|
+
* schema reject and the artifact-bind reject in `green()`). It goes stale for
|
|
1033
|
+
* a judgment/human reject, which is preceded by a commit that already bumped
|
|
1034
|
+
* the artifact and which leaves the SAME claim live to retry: the next commit
|
|
1035
|
+
* lands `committed + 1` from the new committed version, while the producer is
|
|
1036
|
+
* still signing the old number into its proof's `produced[].version`. The
|
|
1037
|
+
* proof row is then stored under a key the envelope does not name, and the
|
|
1038
|
+
* consumer's version check refuses the artifact.
|
|
1039
|
+
*
|
|
1040
|
+
* Matching is by owed path, not by task key, so it is correct for map
|
|
1041
|
+
* elements without re-deriving the binding key. Runs inside the caller's open
|
|
1042
|
+
* tx (plain store writes, no nested tx).
|
|
1043
|
+
*/
|
|
1044
|
+
private restampOwedTarget;
|
|
1045
|
+
/**
|
|
1046
|
+
* §12.2 born-reject lease release: close the run (`released`) and re-arm its
|
|
965
1047
|
* task to `idle` so the firing is immediately re-claimable next tick. Runs
|
|
966
1048
|
* inside the caller's open tx (plain store write, no nested tx). Unlike reap()
|
|
967
|
-
* it does NOT bump attempts — a CAS-stale born-reject is not lease churn.
|
|
1049
|
+
* it does NOT bump attempts — a CAS-stale born-reject is not lease churn. For
|
|
1050
|
+
* the same reason the outcome is `released` and not `no_work`: the step never
|
|
1051
|
+
* ran, so the run must not spend the daily budget or restart the cadence
|
|
1052
|
+
* clock either. `no_work` is reserved for a step that DID run and had nothing
|
|
1053
|
+
* to produce, which is a firing and does spend both. The
|
|
968
1054
|
* `closed` event is fired by the caller AFTER the tx commits (post-commit
|
|
969
1055
|
* ordering), matching public close().
|
|
970
1056
|
*/
|