owenloop 0.5.1 → 0.5.3

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 (88) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +9 -2
  3. package/dist/packages/work/src/agent/brief.d.ts +21 -0
  4. package/dist/packages/work/src/agent/brief.js +42 -1
  5. package/dist/packages/work/src/agent/capability-model.d.ts +123 -0
  6. package/dist/packages/work/src/agent/capability-model.js +148 -0
  7. package/dist/packages/work/src/agent/loop.d.ts +47 -4
  8. package/dist/packages/work/src/agent/loop.js +83 -53
  9. package/dist/packages/work/src/exec/loop.d.ts +17 -0
  10. package/dist/packages/work/src/exec/loop.js +195 -34
  11. package/dist/packages/work/src/exec/runner.js +15 -5
  12. package/dist/packages/work/src/harness/claude.js +69 -9
  13. package/dist/packages/work/src/harness/codex.js +56 -8
  14. package/dist/packages/work/src/harness/contract.d.ts +65 -1
  15. package/dist/packages/work/src/harness/contract.js +56 -0
  16. package/dist/packages/work/src/harness/session-store.d.ts +3 -1
  17. package/dist/packages/work/src/harness/session-store.js +46 -22
  18. package/dist/packages/work/src/hold/mcp.js +9 -2
  19. package/dist/packages/work/src/hub/client.d.ts +7 -1
  20. package/dist/packages/work/src/hub/client.js +1 -0
  21. package/dist/packages/work/src/hub/types.d.ts +71 -3
  22. package/dist/packages/work/src/roles/agent-run.js +8 -9
  23. package/dist/packages/work/src/roles/hold.d.ts +2 -0
  24. package/dist/packages/work/src/roles/hold.js +39 -8
  25. package/dist/packages/work/src/roles/settings.js +18 -6
  26. package/dist/packages/work/src/roles/shift.js +13 -1
  27. package/dist/packages/work/src/settings/settings.d.ts +60 -7
  28. package/dist/packages/work/src/settings/settings.js +69 -22
  29. package/dist/packages/work/src/shift/logretention.d.ts +253 -0
  30. package/dist/packages/work/src/shift/logretention.js +407 -0
  31. package/dist/packages/work/src/shift/logsink.d.ts +14 -0
  32. package/dist/packages/work/src/shift/logsink.js +98 -0
  33. package/dist/packages/work/src/shift/loop.d.ts +18 -1
  34. package/dist/packages/work/src/shift/loop.js +250 -12
  35. package/dist/packages/work/src/shift/protocol.d.ts +124 -1
  36. package/dist/packages/work/src/shift/protocol.js +14 -0
  37. package/dist/packages/work/src/shift/runtime.d.ts +14 -0
  38. package/dist/packages/work/src/shift/runtime.js +229 -6
  39. package/dist/packages/work/src/shift/server.d.ts +13 -0
  40. package/dist/packages/work/src/shift/server.js +61 -36
  41. package/dist/packages/work/src/shift/spawn.d.ts +78 -5
  42. package/dist/packages/work/src/shift/spawn.js +158 -12
  43. package/dist/packages/work/src/shift/state.d.ts +25 -0
  44. package/dist/packages/work/src/shift/state.js +29 -5
  45. package/dist/packages/work/src/shift/truncate.d.ts +35 -0
  46. package/dist/packages/work/src/shift/truncate.js +73 -0
  47. package/dist/packages/work/src/submit-proof.d.ts +31 -6
  48. package/dist/packages/work/src/submit-proof.js +33 -7
  49. package/dist/packages/work/src/submit-value.d.ts +48 -0
  50. package/dist/packages/work/src/submit-value.js +118 -0
  51. package/dist/packages/work/src/usage.d.ts +1 -1
  52. package/dist/packages/work/src/usage.js +11 -0
  53. package/dist/src/bundle/runtime.d.ts +1 -1
  54. package/dist/src/bundle/runtime.js +9 -0
  55. package/dist/src/capabilities.d.ts +93 -0
  56. package/dist/src/capabilities.js +101 -0
  57. package/dist/src/cli.js +37 -11
  58. package/dist/src/crypto/records.d.ts +3 -0
  59. package/dist/src/crypto/records.js +11 -0
  60. package/dist/src/defs.js +192 -4
  61. package/dist/src/engine.d.ts +112 -3
  62. package/dist/src/engine.js +224 -28
  63. package/dist/src/hub.d.ts +27 -11
  64. package/dist/src/hub.js +24 -18
  65. package/dist/src/index.d.ts +3 -1
  66. package/dist/src/index.js +4 -1
  67. package/dist/src/mcp/serve.js +11 -4
  68. package/dist/src/model.d.ts +36 -0
  69. package/dist/src/model.js +46 -0
  70. package/dist/src/schemas/index.d.ts +17 -0
  71. package/dist/src/schemas/order.v1.schema.json +17 -3
  72. package/dist/src/store.d.ts +33 -1
  73. package/dist/src/store.js +57 -4
  74. package/dist/src/types.d.ts +102 -2
  75. package/docs/agent-runner.md +26 -1
  76. package/docs/authoring.md +7 -0
  77. package/docs/bundles.md +103 -3
  78. package/docs/cli.md +127 -9
  79. package/docs/crypto.md +23 -7
  80. package/docs/shift-logs.md +642 -0
  81. package/docs/wire-contracts.md +34 -19
  82. package/package.json +1 -1
  83. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
  84. package/plugins/claude-code/plugin/.mcp.json +1 -1
  85. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
  86. package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
  87. package/dist/packages/work/src/agent/model-policy.d.ts +0 -49
  88. package/dist/packages/work/src/agent/model-policy.js +0 -138
@@ -85,12 +85,24 @@ lowercase SHA-256 `valueDigest`.
85
85
  A driver signs only when the driver can name the exact artifact version without
86
86
  inferring mutable coordinator state. A judge approval can use the judged path's
87
87
  claim-time `consumedFingerprint` entry because the approval attests that existing
88
- version and does not allocate a new version. A producer submit requires an exact
89
- target version issued by a retry-safe hub protocol. Immutable `owes[].version`
90
- metadata is not sufficient: the metadata becomes stale after a refinement, a
91
- committed submit whose response is lost, an unsigned commit, or a client process
92
- restart. Without explicit producer-version authority, built-in clients submit
93
- the producer value without a proof rather than sign a process-local guess.
88
+ version and does not allocate a new version. A producer submit uses
89
+ `owes[].version`, the target version the hub issues for that owed output: the
90
+ version the next successful commit lands (claim-time committed version + 1), and
91
+ therefore the version the consumer supplies to `verifyConsumed` as
92
+ `expectedVersion`.
93
+
94
+ The target is retry-safe because the engine computes it inside the claim
95
+ transaction and persists it with the immutable order. Every read of that claim
96
+ returns the same number, so a refinement, a committed submit whose response was
97
+ lost, an unsigned commit, or a client process restart cannot move it. Refusal
98
+ paths that leave the run open do not bump the artifact, and a refinement is a
99
+ new claim with a newly issued target. A stale target fails the consumer's
100
+ version check — a refusal, never an admitted unverified value.
101
+
102
+ A target counts as authoritative only when it is a positive integer, since the
103
+ smallest commit a producer can land is v1. Given an absent target, a `0`, or a
104
+ non-integer, built-in clients submit the producer value without a proof rather
105
+ than sign a number the consumer is guaranteed to reject.
94
106
 
95
107
  A consuming driver verifies the envelope before trusting the value. The
96
108
  verified signer key must equal `producerKeyId`; the signed `produced[]` entry
@@ -111,19 +123,21 @@ follow-up, not hub-side trust.
111
123
  ### Deployed hub compatibility
112
124
 
113
125
  The schema above is the target wire contract, not evidence that every deployed
114
- hub carries every optional field. As of 2026-08-10, the production hub drops
115
- `consumedFingerprint`, `owes[].version`, `owes[].proof`, and `consumesProof` from
116
- served orders. The production REST and MCP submit paths also do not carry a
117
- client-supplied `proof` through hub-core. A current client therefore cannot claim
118
- that a submit proof was accepted, persisted beside a committed artifact version,
119
- or relayed to a downstream consumer.
126
+ hub carries every optional field. As of 2026-08-12, hub-core projects
127
+ `consumedFingerprint`, `owes[].proof`, and `consumesProof` onto served orders and
128
+ persists a client-supplied submit `proof` beside the committed artifact. It still
129
+ omits `owes[].version`, for two independent reasons: the pinned engine copy under
130
+ `packages/engine-do/vendor/` predates the field, and the served-order projection
131
+ in `packages/hub-core/src/reference-order.ts` allow-lists `path`,
132
+ `judgmentRejects`, `schemaRejects`, `reasons`, and `proof` without it. Both must
133
+ change, and the change must be deployed, before a served order names a target
134
+ version.
120
135
 
121
136
  Client transport types keep these fields optional so one client remains
122
- compatible with both the deployed hub and a future version-aware hub. End-to-end
123
- proof support requires service changes: preserve all four order fields, accept
124
- and persist submit proofs, return proof-acceptance and committed-version data,
125
- and provide retry idempotency (running the same submission again changes
126
- nothing) that survives a lost response and client restart.
137
+ compatible with both a pre-target-semantics hub and a version-aware hub. Against
138
+ a hub that serves no `owes[].version`, a producer submit carries no proof, and a
139
+ command step consuming that artifact refuses it — the hard rule for command
140
+ steps is never relaxed to admit an unverified value.
127
141
 
128
142
  ## Publication record
129
143
 
@@ -288,8 +302,9 @@ as a literal `workdir:` or resolved by the engine from a consumed artifact's
288
302
  `defDigest` is a non-empty opaque reference. `inputs` and `outputs` are string
289
303
  arrays. `consumes` is an open artifact-path map; `spec` and `x` are opaque
290
304
  objects carried through without engine interpretation. `owes` contains the owed
291
- path, an optional claim-time `version`, judgment/schema rejection counters,
292
- reason entries, and an optional opaque `proof` string. `cause`, when present, is
305
+ path, an optional target `version` (the version the next successful commit for
306
+ that path lands, issued inside the claim transaction), judgment/schema rejection
307
+ counters, reason entries, and an optional opaque `proof` string. `cause`, when present, is
293
308
  `inputsGreen`, `allGreen`, or `idle`.
294
309
 
295
310
  **Decision A — version cross-check without fingerprint recomputation.** The
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
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.1",
3
+ "version": "0.5.3",
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.1"
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.3"
11
11
  }
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
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.1"
9
+ "OWENLOOP_PLUGIN_VERSION": "0.5.3"
10
10
  },
11
11
  "env_vars": [
12
12
  "HOME",
@@ -1,49 +0,0 @@
1
- /** Quality-tier resolution and retry escalation for agent orders. */
2
- /** Shipped quality tiers. A settings tierMap may override any entry. */
3
- export declare const DEFAULT_TIER_MAP: {
4
- readonly fast: "haiku";
5
- readonly standard: "sonnet";
6
- readonly strong: "opus";
7
- readonly strongest: "fable";
8
- };
9
- /** Reasoning rungs accepted by the neutral start contract. */
10
- export declare const EFFORT_LADDER: readonly ["low", "medium", "high", "xhigh", "max"];
11
- export type ModelLane = 'express' | 'standard' | 'deep';
12
- export interface ModelEscalation {
13
- model?: string;
14
- attempts?: number;
15
- }
16
- export interface ModelPolicy {
17
- /** Resolved tier names; this map is merged with DEFAULT_TIER_MAP by createModelPolicy. */
18
- tierMap: Readonly<Record<string, string>>;
19
- /** Reject count at which the default policy escalates. */
20
- escalateAt: number;
21
- /** Extension namespace containing the authored escalation object. */
22
- escalationExtensionKey: string;
23
- }
24
- export interface PickModelResult {
25
- model: string;
26
- effort?: string;
27
- }
28
- export interface ModelPolicyOptions {
29
- tierMap?: Record<string, string>;
30
- escalateAt?: number;
31
- escalationExtensionKey?: string;
32
- }
33
- export declare const DEFAULT_MODEL_POLICY: ModelPolicy;
34
- /** Build a normalized policy from optional machine-local settings. */
35
- export declare function createModelPolicy(options?: ModelPolicyOptions): ModelPolicy;
36
- /** Resolve a tier name, passing through a literal model id unchanged. */
37
- export declare function resolveModelTier(model: string, tierMap?: Readonly<Record<string, string>>): string;
38
- /** Split a trailing positive integer effort suffix from a model string. */
39
- export declare function parseModelEffort(raw: string): {
40
- modelPart: string;
41
- effortIndex?: number;
42
- };
43
- /**
44
- * Pick the model and effort for one agent order.
45
- *
46
- * The fourth argument accepts a ModelPolicy. A numeric value is also accepted as
47
- * the reject threshold for compatibility with the reference function's shape.
48
- */
49
- export declare function pickModel(stepYamlModel: string, lane: ModelLane | undefined, judgmentRejects: number, policyOrAt?: ModelPolicy | number, override?: string, escalation?: ModelEscalation): PickModelResult;
@@ -1,138 +0,0 @@
1
- /** Quality-tier resolution and retry escalation for agent orders. */
2
- /** Shipped quality tiers. A settings tierMap may override any entry. */
3
- export const DEFAULT_TIER_MAP = {
4
- fast: 'haiku',
5
- standard: 'sonnet',
6
- strong: 'opus',
7
- strongest: 'fable',
8
- };
9
- /** Reasoning rungs accepted by the neutral start contract. */
10
- export const EFFORT_LADDER = ['low', 'medium', 'high', 'xhigh', 'max'];
11
- const TIER_INDEX = {
12
- fast: 0,
13
- standard: 1,
14
- strong: 2,
15
- strongest: 3,
16
- };
17
- /** Tier index -> tier name, so a clamp can resolve to an id at the very end. */
18
- const TIER_NAMES = ['fast', 'standard', 'strong', 'strongest'];
19
- export const DEFAULT_MODEL_POLICY = {
20
- tierMap: DEFAULT_TIER_MAP,
21
- escalateAt: 3,
22
- escalationExtensionKey: 'delivery',
23
- };
24
- /** Build a normalized policy from optional machine-local settings. */
25
- export function createModelPolicy(options = {}) {
26
- return {
27
- tierMap: { ...DEFAULT_TIER_MAP, ...(options.tierMap ?? {}) },
28
- escalateAt: options.escalateAt ?? DEFAULT_MODEL_POLICY.escalateAt,
29
- escalationExtensionKey: options.escalationExtensionKey ?? DEFAULT_MODEL_POLICY.escalationExtensionKey,
30
- };
31
- }
32
- /** Resolve a tier name, passing through a literal model id unchanged. */
33
- export function resolveModelTier(model, tierMap = DEFAULT_TIER_MAP) {
34
- return tierMap[model] ?? model;
35
- }
36
- /** Split a trailing positive integer effort suffix from a model string. */
37
- export function parseModelEffort(raw) {
38
- const separator = raw.lastIndexOf(':');
39
- if (separator === -1)
40
- return { modelPart: raw };
41
- const tail = raw.slice(separator + 1);
42
- if (!/^[1-9]\d*$/.test(tail))
43
- return { modelPart: raw };
44
- return { modelPart: raw.slice(0, separator), effortIndex: Number(tail) };
45
- }
46
- function tierForInput(modelPart) {
47
- return TIER_INDEX[modelPart];
48
- }
49
- /**
50
- * Apply the lane to a tier index, in tier space.
51
- *
52
- * express caps at `standard` and deep floors at `strong`, with one exception:
53
- * the express cap never touches the TOP tier. A step authored at the top tier
54
- * is there because the judgment it makes is hard, so the lane's cost heuristic
55
- * must not downgrade it — the lane scales cost, it does not overrule an
56
- * explicit escalation of quality. The reference implementation gets this for
57
- * free by leaving the top tier out of its rank table; ranking in tier space
58
- * gives the top tier a rank, so the exclusion has to be stated here.
59
- */
60
- function clampTierForLane(tier, lane) {
61
- if (lane === 'express' && tier > TIER_INDEX['standard'] && tier !== TIER_INDEX['strongest']) {
62
- return TIER_INDEX['standard'];
63
- }
64
- if (lane === 'deep' && tier < TIER_INDEX['strong'])
65
- return TIER_INDEX['strong'];
66
- return tier;
67
- }
68
- /** Resolve a tier index back to a concrete model id through the policy map. */
69
- function modelForTier(tier, tierMap) {
70
- const name = TIER_NAMES[tier];
71
- return tierMap[name] ?? name;
72
- }
73
- function effortName(index) {
74
- const clamped = Math.min(Math.max(index, 1), EFFORT_LADDER.length) - 1;
75
- return EFFORT_LADDER[clamped];
76
- }
77
- function withEffort(model, effortIndex) {
78
- return effortIndex === undefined ? { model } : { model, effort: effortName(effortIndex) };
79
- }
80
- function normalizePolicy(policyOrAt) {
81
- if (typeof policyOrAt === 'number') {
82
- return createModelPolicy({ escalateAt: policyOrAt });
83
- }
84
- if (policyOrAt === undefined)
85
- return DEFAULT_MODEL_POLICY;
86
- return createModelPolicy({
87
- tierMap: { ...policyOrAt.tierMap },
88
- escalateAt: policyOrAt.escalateAt,
89
- escalationExtensionKey: policyOrAt.escalationExtensionKey,
90
- });
91
- }
92
- /**
93
- * Pick the model and effort for one agent order.
94
- *
95
- * The fourth argument accepts a ModelPolicy. A numeric value is also accepted as
96
- * the reject threshold for compatibility with the reference function's shape.
97
- */
98
- export function pickModel(stepYamlModel, lane, judgmentRejects, policyOrAt = DEFAULT_MODEL_POLICY, override, escalation) {
99
- const policy = normalizePolicy(policyOrAt);
100
- const pinned = typeof override === 'string' && override !== '';
101
- const rawInput = pinned ? override : stepYamlModel;
102
- const { modelPart, effortIndex } = parseModelEffort(rawInput);
103
- let model = resolveModelTier(modelPart, policy.tierMap);
104
- const inputTier = tierForInput(modelPart);
105
- if (escalation !== undefined) {
106
- const attempts = escalation.attempts ?? policy.escalateAt;
107
- if (judgmentRejects >= attempts) {
108
- const rung2Raw = typeof escalation.model === 'string' && escalation.model !== '' ? escalation.model : 'strong';
109
- const { modelPart: rung2Part, effortIndex: rung2Effort } = parseModelEffort(rung2Raw);
110
- return withEffort(resolveModelTier(rung2Part, policy.tierMap), rung2Effort);
111
- }
112
- if (inputTier !== undefined && !pinned) {
113
- model = modelForTier(clampTierForLane(inputTier, lane), policy.tierMap);
114
- }
115
- return withEffort(model, effortIndex);
116
- }
117
- const escalate = judgmentRejects >= policy.escalateAt;
118
- const nextEffort = effortIndex === undefined ? undefined : escalate ? effortIndex + 1 : effortIndex;
119
- // The lane adjusts the BASE. Track the resulting tier, because escalation
120
- // below is decided on the CLAMPED tier, not the authored one.
121
- let currentTier = inputTier;
122
- if (inputTier !== undefined && !pinned) {
123
- currentTier = clampTierForLane(inputTier, lane);
124
- model = modelForTier(currentTier, policy.tierMap);
125
- }
126
- // Model escalation fires when there was no effort suffix to bump instead, or
127
- // once the reject count reaches twice the threshold. It is upward-only and
128
- // ALWAYS wins over an express cap: a producer stuck on repeated rejects needs
129
- // more capability more than the lane needs the cheaper tier. Gating this on
130
- // the POST-clamp tier is what makes escalation beat the cap — gating it on
131
- // the authored tier would let an express-clamped `strong` step sit at the
132
- // standard tier forever, however many rejects accumulate.
133
- const modelEscalates = escalate && (effortIndex === undefined || judgmentRejects >= policy.escalateAt * 2);
134
- if (modelEscalates && currentTier !== undefined && currentTier < TIER_INDEX['strong']) {
135
- model = policy.tierMap['strong'] ?? 'strong';
136
- }
137
- return withEffort(model, nextEffort);
138
- }