owenloop 0.5.9 → 0.5.10

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +77 -37
  3. package/bin/owenloop.mjs +16 -1
  4. package/dist/packages/work/src/agent/loop.js +7 -0
  5. package/dist/packages/work/src/bundle/pull.d.ts +21 -0
  6. package/dist/packages/work/src/bundle/pull.js +118 -0
  7. package/dist/packages/work/src/exec/instructions.d.ts +4 -1
  8. package/dist/packages/work/src/exec/instructions.js +3 -0
  9. package/dist/packages/work/src/exec/loop.d.ts +1 -1
  10. package/dist/packages/work/src/exec/loop.js +92 -14
  11. package/dist/packages/work/src/harness/claude.js +16 -0
  12. package/dist/packages/work/src/harness/codex.d.ts +8 -0
  13. package/dist/packages/work/src/harness/codex.js +27 -1
  14. package/dist/packages/work/src/harness/contract.d.ts +9 -0
  15. package/dist/packages/work/src/roles/agent-run.js +38 -10
  16. package/dist/packages/work/src/roles/exec.js +25 -8
  17. package/dist/packages/work/src/shift/loop.js +118 -4
  18. package/dist/packages/work/src/shift/runtime.d.ts +3 -0
  19. package/dist/packages/work/src/shift/runtime.js +10 -1
  20. package/dist/packages/work/src/submit-proof.d.ts +11 -8
  21. package/dist/packages/work/src/submit-proof.js +11 -8
  22. package/dist/src/capabilities.d.ts +70 -6
  23. package/dist/src/capabilities.js +49 -6
  24. package/dist/src/capability-mapping-client.d.ts +29 -0
  25. package/dist/src/capability-mapping-client.js +160 -0
  26. package/dist/src/cli.d.ts +2 -2
  27. package/dist/src/cli.js +1196 -164
  28. package/dist/src/defs.d.ts +32 -1
  29. package/dist/src/defs.js +391 -79
  30. package/dist/src/engine.d.ts +62 -19
  31. package/dist/src/engine.js +180 -70
  32. package/dist/src/hub.d.ts +77 -0
  33. package/dist/src/hub.js +162 -0
  34. package/dist/src/implements.d.ts +56 -0
  35. package/dist/src/implements.js +790 -0
  36. package/dist/src/index.d.ts +8 -6
  37. package/dist/src/index.js +4 -3
  38. package/dist/src/mcp/serve.js +254 -45
  39. package/dist/src/mcp/server.d.ts +10 -7
  40. package/dist/src/mcp/server.js +53 -8
  41. package/dist/src/model.d.ts +46 -10
  42. package/dist/src/model.js +220 -74
  43. package/dist/src/store/def-source.d.ts +19 -0
  44. package/dist/src/store/def-source.js +87 -17
  45. package/dist/src/store/gc-recovery.d.ts +46 -0
  46. package/dist/src/store/gc-recovery.js +258 -0
  47. package/dist/src/store/gc.d.ts +94 -0
  48. package/dist/src/store/gc.js +562 -0
  49. package/dist/src/store/index.d.ts +3 -1
  50. package/dist/src/store/index.js +2 -0
  51. package/dist/src/store/install.d.ts +34 -5
  52. package/dist/src/store/install.js +73 -11
  53. package/dist/src/store/pre-commit-verifier.js +42 -2
  54. package/dist/src/store/snapshot-guard.d.ts +18 -0
  55. package/dist/src/store/snapshot-guard.js +94 -0
  56. package/dist/src/store.d.ts +64 -4
  57. package/dist/src/store.js +211 -8
  58. package/dist/src/types.d.ts +61 -17
  59. package/dist/src/util.js +4 -1
  60. package/docs/authoring.md +145 -8
  61. package/docs/bundles.md +19 -0
  62. package/docs/cli.md +270 -30
  63. package/docs/crypto.md +13 -7
  64. package/docs/design.md +107 -46
  65. package/docs/evals/mcp-charter-baseline.json +428 -0
  66. package/docs/mcp-charter-eval.md +124 -0
  67. package/docs/shift-logs.md +18 -0
  68. package/docs/wire-contracts.md +28 -7
  69. package/examples/workflows/compile-dev-playbook.yaml +1 -1
  70. package/examples/workflows/ship.yaml +28 -2
  71. package/package.json +2 -1
  72. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
  73. package/plugins/claude-code/plugin/.mcp.json +1 -1
  74. package/plugins/claude-code/plugin/skills/author/SKILL.md +22 -0
  75. package/plugins/claude-code/plugin/skills/ephemeral/SKILL.md +95 -0
  76. package/plugins/claude-code/plugin/skills/graduate/SKILL.md +156 -0
  77. package/plugins/claude-code/plugin/skills/plan/SKILL.md +236 -0
  78. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
  79. package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
  80. package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +22 -0
  81. package/plugins/codex/plugins/owenloop/skills/ephemeral/SKILL.md +95 -0
  82. package/plugins/codex/plugins/owenloop/skills/graduate/SKILL.md +156 -0
  83. package/plugins/codex/plugins/owenloop/skills/plan/SKILL.md +236 -0
@@ -11,7 +11,7 @@
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
17
  import type { Author, Fingerprint, Order, WorkflowDef } from './types.ts';
@@ -227,7 +227,7 @@ export type EngineEvent = {
227
227
  type: 'closed';
228
228
  workflow: string;
229
229
  run: string;
230
- outcome: 'ok' | 'no_work' | 'failed' | 'skipped';
230
+ outcome: 'ok' | 'no_work' | 'released' | 'failed' | 'skipped';
231
231
  } | {
232
232
  type: 'settled';
233
233
  workflow: string;
@@ -383,11 +383,11 @@ export declare class Engine {
383
383
  */
384
384
  private static readonly CHILD_OUTCOME_PIN_KEY;
385
385
  /**
386
- * F4: the single place that computes "what child-outcome version is this
387
- * calls: artifact currently resting on" — used both when machine-greening
388
- * (STEP 6) and when stamping the pin at verdict time (reject propagation,
389
- * human skip). Returns undefined if no child has ever been spawned (nothing
390
- * to pin to).
386
+ * F4: the single verdict-time helper that computes "what child-outcome
387
+ * version is this calls: artifact currently resting on" for reject
388
+ * propagation and human skip. STEP 6 publication reads and stamps the version
389
+ * from its authoritative in-transaction snapshot instead. Returns undefined
390
+ * if no child has ever been spawned (nothing to pin to).
391
391
  */
392
392
  private childOutcomePin;
393
393
  /**
@@ -475,7 +475,8 @@ export declare class Engine {
475
475
  * Called at the top of tick (outside any tx) and as cascade-up prompt.
476
476
  * For each calls: step: spawn the child if gate is ready and no child exists;
477
477
  * 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.
478
+ * the parent artifact when the child's declared output is green and the
479
+ * whole child workflow is done.
479
480
  */
480
481
  private maintainCalls;
481
482
  /**
@@ -505,11 +506,12 @@ export declare class Engine {
505
506
  /**
506
507
  * STEP 6 re-arm as the mirror-image atomic guard. maintainCalls' optimistic
507
508
  * pre-read decides only WHETHER to call this; the parent artifact AND the
508
- * child outcome are re-read inside the write lock, and the re-arm happens only
509
- * if the parent is still green AND the child outcome is still NOT green in-tx.
510
- * If the child went green between the optimistic read and the tx, this does
511
- * nothing (returns false) and the next maintainCalls pass publishes normally.
512
- * Returns true only when it wrote.
509
+ * child definition/artifacts are re-read inside the write lock, and the
510
+ * re-arm happens only if the parent is still green AND either the child
511
+ * outcome is non-green or the whole child is unfinished in-tx. If the outcome
512
+ * is green and the child is done by then, this does nothing (returns false)
513
+ * and the next maintainCalls pass publishes normally. Returns true only when
514
+ * it wrote.
513
515
  */
514
516
  private rearmCallsGreen;
515
517
  /**
@@ -548,6 +550,23 @@ export declare class Engine {
548
550
  * decides a mode, it only enforces the one it is handed.
549
551
  */
550
552
  matchModes?: Record<string, MatchMode>;
553
+ /**
554
+ * Per-AUTHORED-capability substitution, applied BEFORE the offer composes
555
+ * with the modifier, so one entry covers every grade a step can be
556
+ * offered at. Supplied by the same caller that supplies `matchModes` and
557
+ * for the same reason — deciding what an authored name means in this org
558
+ * requires reading an install-scoped table the pure engine cannot see.
559
+ * Substitution is a single hop and the value is never validated; the
560
+ * caller resolves any chain first. See `applyCapabilityMappings`.
561
+ *
562
+ * Absent or empty is exact identity: the offer is composed from the
563
+ * authored list itself, byte for byte, as before this input existed.
564
+ *
565
+ * Distinct from `capabilityRewrites` below, which is keyed by the
566
+ * COMPOSED string and applied AFTER composition. Both may apply in one
567
+ * tick, in that order.
568
+ */
569
+ capabilityMappings?: CapabilityMappings;
551
570
  /**
552
571
  * Per-offered-capability reroute, keyed by the COMPOSED capability the
553
572
  * offer would otherwise carry. Supplied by the same caller that supplies
@@ -641,9 +660,11 @@ export declare class Engine {
641
660
  * Per-step cadence + daily budget + parallel cap over the eligible firings.
642
661
  *
643
662
  * A2: `capabilities` is the tick caller's claim filter, matched against the
644
- * step's OFFERED capabilities — the authored list composed with the modifier
645
- * this firing will actually be offered under (`wise` + `deep` → `wise:deep`),
646
- * which is the same list the order will carry. `claimMatches` owns the rule;
663
+ * step's OFFERED capabilities — the authored list mapped onto the caller's
664
+ * own capability names, composed with the modifier this firing will actually
665
+ * be offered under (`wise` + `deep` → `wise:deep`), then rewritten by any
666
+ * reroute the caller decided on, which is the same list the order will carry.
667
+ * `claimMatches` owns the rule;
647
668
  * see it for the four cases (no filter presented, capability-silent step,
648
669
  * empty caller list, both non-empty) and for what `matchModes` changes.
649
670
  * A firing this caller may not claim is deferred as `'capability-mismatch'`.
@@ -880,7 +901,7 @@ export declare class Engine {
880
901
  */
881
902
  retry(workflow: string, path: string, by?: Author, text?: string): void;
882
903
  /** 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;
904
+ close(workflow: string, run: string, outcome?: 'ok' | 'no_work' | 'released' | 'failed' | 'skipped', summary?: string): void;
884
905
  /**
885
906
  * Touch the liveness timestamp on an open run's task. A run that periodically
886
907
  * calls heartbeat() will never be falsely reaped as long as beats arrive within
@@ -961,10 +982,32 @@ export declare class Engine {
961
982
  private settle;
962
983
  private applyOp;
963
984
  /**
964
- * §12.2 born-reject lease release: close the run (`no_work`) and re-arm its
985
+ * Re-stamp the owed version target for `path` on any OPEN claim that owes it.
986
+ *
987
+ * The target frozen at claim issue is `committed + 1`. That stays correct for
988
+ * every refusal that leaves the run open WITHOUT bumping the artifact (the
989
+ * schema reject and the artifact-bind reject in `green()`). It goes stale for
990
+ * a judgment/human reject, which is preceded by a commit that already bumped
991
+ * the artifact and which leaves the SAME claim live to retry: the next commit
992
+ * lands `committed + 1` from the new committed version, while the producer is
993
+ * still signing the old number into its proof's `produced[].version`. The
994
+ * proof row is then stored under a key the envelope does not name, and the
995
+ * consumer's version check refuses the artifact.
996
+ *
997
+ * Matching is by owed path, not by task key, so it is correct for map
998
+ * elements without re-deriving the binding key. Runs inside the caller's open
999
+ * tx (plain store writes, no nested tx).
1000
+ */
1001
+ private restampOwedTarget;
1002
+ /**
1003
+ * §12.2 born-reject lease release: close the run (`released`) and re-arm its
965
1004
  * task to `idle` so the firing is immediately re-claimable next tick. Runs
966
1005
  * 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. The
1006
+ * it does NOT bump attempts — a CAS-stale born-reject is not lease churn. For
1007
+ * the same reason the outcome is `released` and not `no_work`: the step never
1008
+ * ran, so the run must not spend the daily budget or restart the cadence
1009
+ * clock either. `no_work` is reserved for a step that DID run and had nothing
1010
+ * to produce, which is a firing and does spend both. The
968
1011
  * `closed` event is fired by the caller AFTER the tx commits (post-commit
969
1012
  * ordering), matching public close().
970
1013
  */