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.
Files changed (86) hide show
  1. package/CHANGELOG.md +51 -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 +1200 -166
  28. package/dist/src/defs.d.ts +41 -1
  29. package/dist/src/defs.js +461 -92
  30. package/dist/src/engine.d.ts +108 -22
  31. package/dist/src/engine.js +573 -85
  32. package/dist/src/factory.js +5 -3
  33. package/dist/src/hub.d.ts +77 -0
  34. package/dist/src/hub.js +162 -0
  35. package/dist/src/implements.d.ts +37 -0
  36. package/dist/src/implements.js +790 -0
  37. package/dist/src/index.d.ts +12 -10
  38. package/dist/src/index.js +7 -6
  39. package/dist/src/mcp/serve.js +254 -45
  40. package/dist/src/mcp/server.d.ts +10 -7
  41. package/dist/src/mcp/server.js +53 -8
  42. package/dist/src/model.d.ts +46 -10
  43. package/dist/src/model.js +224 -78
  44. package/dist/src/order-resolver.js +1 -0
  45. package/dist/src/store/def-source.d.ts +19 -0
  46. package/dist/src/store/def-source.js +87 -17
  47. package/dist/src/store/gc-recovery.d.ts +46 -0
  48. package/dist/src/store/gc-recovery.js +258 -0
  49. package/dist/src/store/gc.d.ts +94 -0
  50. package/dist/src/store/gc.js +563 -0
  51. package/dist/src/store/index.d.ts +3 -1
  52. package/dist/src/store/index.js +2 -0
  53. package/dist/src/store/install.d.ts +34 -5
  54. package/dist/src/store/install.js +73 -11
  55. package/dist/src/store/pre-commit-verifier.js +42 -2
  56. package/dist/src/store/snapshot-guard.d.ts +18 -0
  57. package/dist/src/store/snapshot-guard.js +94 -0
  58. package/dist/src/store.d.ts +66 -4
  59. package/dist/src/store.js +333 -12
  60. package/dist/src/types.d.ts +97 -17
  61. package/dist/src/types.js +4 -0
  62. package/dist/src/util.js +4 -1
  63. package/docs/authoring.md +214 -9
  64. package/docs/bundles.md +19 -0
  65. package/docs/cli.md +270 -30
  66. package/docs/crypto.md +13 -7
  67. package/docs/design.md +107 -46
  68. package/docs/evals/mcp-charter-baseline.json +428 -0
  69. package/docs/mcp-charter-eval.md +124 -0
  70. package/docs/shift-logs.md +18 -0
  71. package/docs/wire-contracts.md +28 -7
  72. package/examples/workflows/compile-dev-playbook.yaml +1 -1
  73. package/examples/workflows/ship.yaml +28 -2
  74. package/package.json +2 -1
  75. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
  76. package/plugins/claude-code/plugin/.mcp.json +1 -1
  77. package/plugins/claude-code/plugin/skills/author/SKILL.md +22 -0
  78. package/plugins/claude-code/plugin/skills/ephemeral/SKILL.md +95 -0
  79. package/plugins/claude-code/plugin/skills/graduate/SKILL.md +156 -0
  80. package/plugins/claude-code/plugin/skills/plan/SKILL.md +236 -0
  81. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
  82. package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
  83. package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +22 -0
  84. package/plugins/codex/plugins/owenloop/skills/ephemeral/SKILL.md +95 -0
  85. package/plugins/codex/plugins/owenloop/skills/graduate/SKILL.md +156 -0
  86. package/plugins/codex/plugins/owenloop/skills/plan/SKILL.md +236 -0
@@ -1,18 +1,23 @@
1
1
  /**
2
2
  * Routing capabilities: composition at offer time, and the claim-side match.
3
3
  *
4
- * Three vocabularies meet here and must not be confused:
4
+ * Four vocabularies meet here and must not be confused:
5
5
  *
6
6
  * - **Authored capability** — what a def writes on a step (`wise`). Never
7
7
  * contains the separator; the parser rejects one that does.
8
+ * - **Org capability** — the name this org actually routes on, which for a
9
+ * def installed from elsewhere may be a scoped form of the authored name.
10
+ * Substituted for the authored one BEFORE composition, and only when the
11
+ * caller supplies a mapping; absent a mapping the two are the same string.
8
12
  * - **Modifier** — the ONE plain name a run carries (`deep`). Optional. The
9
13
  * engine attaches no meaning, no order and no arithmetic to it.
10
- * - **Compound capability** — `<authored>:<modifier>` (`wise:deep`), composed
11
- * by the engine when it builds an order. Only the engine composes it.
14
+ * - **Compound capability** — `<org>:<modifier>` (`wise:deep`), composed by
15
+ * the engine when it builds an order. Only the engine composes it.
12
16
  *
13
- * Nothing here reads the store, the def or the clock. Composition is a pure
14
- * function of (authored capabilities, modifier); matching is a pure function of
15
- * (offered capabilities, caller capabilities, per-capability match mode).
17
+ * Nothing here reads the store, the def or the clock. Mapping is a pure
18
+ * function of (authored capabilities, mappings); composition is a pure function
19
+ * of (capabilities, modifier); matching is a pure function of (offered
20
+ * capabilities, caller capabilities, per-capability match mode).
16
21
  */
17
22
  /**
18
23
  * The character the engine reserves as the capability/modifier separator.
@@ -62,6 +67,41 @@ export declare function capabilityName(capability: string): string;
62
67
  * compose onto, and inventing a lone `:deep` would be meaningless.
63
68
  */
64
69
  export declare function composeCapabilities(authored: readonly string[] | undefined, modifier: string | undefined): string[];
70
+ /**
71
+ * A per-run substitution from an AUTHORED capability to the capability string
72
+ * this org actually routes on, applied BEFORE composition.
73
+ *
74
+ * `{ coding: 'repo-a-flow.coding' }` means: wherever a step of this run
75
+ * authored `coding`, offer the org's `repo-a-flow.coding` instead — so under
76
+ * modifier `deep` the offer composes to `repo-a-flow.coding:deep`, never
77
+ * `coding:deep`. Two vocabularies meet in one entry: the KEY is the authored
78
+ * name a def wrote, the VALUE is the name the org's crews are bound to.
79
+ *
80
+ * The reason it exists: a def that entered the org from a third party must be
81
+ * scoped by default, because two unrelated defs may both author `coding` and
82
+ * nothing should make them share crews by accident. Scoping is expressed as a
83
+ * mapping rather than a def edit so the def content stays byte-exact with its
84
+ * source and re-installs cleanly.
85
+ *
86
+ * The engine ENFORCES a mapping, it never CHOOSES one — same doctrine as
87
+ * `matchModes` and `capabilityRewrites`, and for the same reason: choosing
88
+ * means reading an install-scoped routing table the pure engine has never seen.
89
+ * The caller that owns that table hands the map down per tick.
90
+ *
91
+ * DISTINCT FROM `CapabilityRewrites`, which must not be reused for this. A
92
+ * mapping is applied BEFORE composition and is keyed by the AUTHORED name, so
93
+ * one entry covers every modifier including escalation targets and the
94
+ * no-modifier case. A rewrite is applied AFTER composition and is keyed by the
95
+ * COMPOSED string, so the same intent would need one entry per
96
+ * (capability x modifier) pair, and would collide with the reroute decisions
97
+ * that already own that key space. Both may apply within a single tick, in
98
+ * that order: authored → mapped → composed → rewritten → offered.
99
+ *
100
+ * SINGLE HOP, BY CONTRACT, exactly as for a rewrite: a mapped value is never
101
+ * itself looked up in the map, and is never inspected or validated. The caller
102
+ * resolves any chain and validates any target before calling.
103
+ */
104
+ export type CapabilityMappings = Readonly<Record<string, string>>;
65
105
  /**
66
106
  * A reroute decision the caller has already made, keyed by the composed
67
107
  * capability the engine would otherwise offer.
@@ -85,6 +125,30 @@ export type CapabilityRewrites = Readonly<Record<string, string>>;
85
125
  * names in match order. Hub → worker; unrelated to `serve_crews`.
86
126
  */
87
127
  export type CrewStamps = Readonly<Record<string, readonly string[]>>;
128
+ /**
129
+ * Substitute a caller's capability mappings into a step's AUTHORED list, before
130
+ * that list is composed with the run's modifier. See `CapabilityMappings` for
131
+ * what a mapping is and why it is not a rewrite.
132
+ *
133
+ * An authored list no entry applies to is returned BY REFERENCE — the identical
134
+ * array, not a copy — and `undefined` and `[]` fall straight through. That is
135
+ * what makes an absent or empty map exact identity rather than merely
136
+ * equivalent: with `{}` the composition downstream receives byte-for-byte what
137
+ * it received before this pass existed, so no caller can observe the pass at
138
+ * all. It also preserves multiplicity, which matters: a step may author
139
+ * `capabilities: ['a', 'a']` (the parser validates each entry but never rejects
140
+ * a duplicate) and an untouched offer must still stamp both.
141
+ *
142
+ * Duplicates ARE removed once an entry actually fires, mirroring
143
+ * `applyCapabilityRewrites`: two authored names may map onto one org name, and
144
+ * an offer listing it twice would read as a mistake. Dedup is a consequence of
145
+ * mapping, never a tidy-up applied on the way past.
146
+ *
147
+ * Lookup is by OWN property. Keys here are arbitrary authored words, so a step
148
+ * authoring `constructor` or `toString` must resolve to "no entry" rather than
149
+ * to an inherited `Object.prototype` member.
150
+ */
151
+ export declare function applyCapabilityMappings(authored: readonly string[] | undefined, mappings: CapabilityMappings): readonly string[] | undefined;
88
152
  /**
89
153
  * Substitute a caller's reroute decisions into a composed offer.
90
154
  *
@@ -1,18 +1,23 @@
1
1
  /**
2
2
  * Routing capabilities: composition at offer time, and the claim-side match.
3
3
  *
4
- * Three vocabularies meet here and must not be confused:
4
+ * Four vocabularies meet here and must not be confused:
5
5
  *
6
6
  * - **Authored capability** — what a def writes on a step (`wise`). Never
7
7
  * contains the separator; the parser rejects one that does.
8
+ * - **Org capability** — the name this org actually routes on, which for a
9
+ * def installed from elsewhere may be a scoped form of the authored name.
10
+ * Substituted for the authored one BEFORE composition, and only when the
11
+ * caller supplies a mapping; absent a mapping the two are the same string.
8
12
  * - **Modifier** — the ONE plain name a run carries (`deep`). Optional. The
9
13
  * engine attaches no meaning, no order and no arithmetic to it.
10
- * - **Compound capability** — `<authored>:<modifier>` (`wise:deep`), composed
11
- * by the engine when it builds an order. Only the engine composes it.
14
+ * - **Compound capability** — `<org>:<modifier>` (`wise:deep`), composed by
15
+ * the engine when it builds an order. Only the engine composes it.
12
16
  *
13
- * Nothing here reads the store, the def or the clock. Composition is a pure
14
- * function of (authored capabilities, modifier); matching is a pure function of
15
- * (offered capabilities, caller capabilities, per-capability match mode).
17
+ * Nothing here reads the store, the def or the clock. Mapping is a pure
18
+ * function of (authored capabilities, mappings); composition is a pure function
19
+ * of (capabilities, modifier); matching is a pure function of (offered
20
+ * capabilities, caller capabilities, per-capability match mode).
16
21
  */
17
22
  /**
18
23
  * The character the engine reserves as the capability/modifier separator.
@@ -55,6 +60,44 @@ export function composeCapabilities(authored, modifier) {
55
60
  return [...authored];
56
61
  return authored.map((c) => `${c}${MODIFIER_SEPARATOR}${modifier}`);
57
62
  }
63
+ /**
64
+ * Substitute a caller's capability mappings into a step's AUTHORED list, before
65
+ * that list is composed with the run's modifier. See `CapabilityMappings` for
66
+ * what a mapping is and why it is not a rewrite.
67
+ *
68
+ * An authored list no entry applies to is returned BY REFERENCE — the identical
69
+ * array, not a copy — and `undefined` and `[]` fall straight through. That is
70
+ * what makes an absent or empty map exact identity rather than merely
71
+ * equivalent: with `{}` the composition downstream receives byte-for-byte what
72
+ * it received before this pass existed, so no caller can observe the pass at
73
+ * all. It also preserves multiplicity, which matters: a step may author
74
+ * `capabilities: ['a', 'a']` (the parser validates each entry but never rejects
75
+ * a duplicate) and an untouched offer must still stamp both.
76
+ *
77
+ * Duplicates ARE removed once an entry actually fires, mirroring
78
+ * `applyCapabilityRewrites`: two authored names may map onto one org name, and
79
+ * an offer listing it twice would read as a mistake. Dedup is a consequence of
80
+ * mapping, never a tidy-up applied on the way past.
81
+ *
82
+ * Lookup is by OWN property. Keys here are arbitrary authored words, so a step
83
+ * authoring `constructor` or `toString` must resolve to "no entry" rather than
84
+ * to an inherited `Object.prototype` member.
85
+ */
86
+ export function applyCapabilityMappings(authored, mappings) {
87
+ if (authored === undefined || authored.length === 0)
88
+ return authored;
89
+ let changed = false;
90
+ const out = [];
91
+ for (const c of authored) {
92
+ const target = Object.prototype.hasOwnProperty.call(mappings, c) ? mappings[c] : undefined;
93
+ const next = target ?? c;
94
+ if (target !== undefined && target !== c)
95
+ changed = true;
96
+ if (!out.includes(next))
97
+ out.push(next);
98
+ }
99
+ return changed ? out : authored;
100
+ }
58
101
  /**
59
102
  * Substitute a caller's reroute decisions into a composed offer.
60
103
  *
@@ -0,0 +1,29 @@
1
+ /** `GET`/`POST` against the resolved hub with a bearer credential already applied. */
2
+ export interface CapabilityMappingTransport {
3
+ get(path: string): Promise<Response>;
4
+ post(path: string, body: unknown): Promise<Response>;
5
+ }
6
+ /** Read half of the contract — shipped. */
7
+ export declare const CAPABILITY_MAPPINGS_READ_PATH = "/api/capability_mappings";
8
+ /** Write half of the contract — the PLURAL verb no shipped hub has yet. */
9
+ export declare const CAPABILITY_MAPPINGS_WRITE_PATH = "/api/set_capability_mappings";
10
+ /**
11
+ * Read the `authored → org` mappings already recorded for `defName`.
12
+ *
13
+ * Returns `'unsupported'` — a sentinel, not an empty map — when the hub has no
14
+ * such endpoint. The distinction is load-bearing: an empty map means "this def
15
+ * has no mapping recorded", so nothing needs carrying forward, while
16
+ * `'unsupported'` means "this hub cannot tell you", and the caller must warn
17
+ * before it asks the operator about capabilities that may already be linked.
18
+ */
19
+ export declare function fetchCapabilityMappings(transport: CapabilityMappingTransport, defName: string, origin: string): Promise<Record<string, string> | 'unsupported'>;
20
+ /**
21
+ * Record `authored → org` mappings for `defName`, replacing what is stored for
22
+ * the authored names it names.
23
+ *
24
+ * A hub without the endpoint is a **hard, exit-2 failure naming the missing
25
+ * verb** — never a warning and never a silent skip. `install` calls this BEFORE
26
+ * it publishes precisely so this failure leaves nothing half-applied: no def
27
+ * has been pushed, so the org vocabulary is untouched.
28
+ */
29
+ export declare function recordCapabilityMappings(transport: CapabilityMappingTransport, defName: string, mappings: Record<string, string>, origin: string): Promise<void>;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * The two hub endpoints `owenloop install` needs, deliberately confined to this
3
+ * one file.
4
+ *
5
+ * ## Read this before changing a path or a body key
6
+ *
7
+ * The READ half is LIVE. `owenloop-service` ships
8
+ * `GET /api/capability_mappings` (optional `?def=<name>`), backed by the
9
+ * `capability_mappings` table PR #222 built and the offer-time resolver that
10
+ * consumes it. Its body is a ROW ARRAY, not the compact map this file first
11
+ * proposed — `asCapabilityMappings` accepts both and the difference is
12
+ * explained there, not here.
13
+ *
14
+ * The WRITE half `install` needs is STILL MISSING, and the gap is narrower than
15
+ * it looks. The hub ships `POST /api/set_capability_mapping` — SINGULAR, ONE
16
+ * ROW per call, `{defName, authored, target}` — which is the right shape for an
17
+ * operator repointing one capability by hand. `install` needs the PLURAL
18
+ * `POST /api/set_capability_mappings` `{def, mappings}` instead, and the plural
19
+ * is not sugar over N singular calls:
20
+ *
21
+ * - **One transaction or none.** `install` publishes the def the instant this
22
+ * returns. A loop that fails on its fourth capability leaves three rows
23
+ * written and then either publishes a half-scoped def or must unwind writes
24
+ * it cannot unwind atomically. The whole reason the mapping is recorded
25
+ * BEFORE the publish is that a failure must leave NOTHING applied.
26
+ * - **One audit act.** An install remaps a def's whole vocabulary in one
27
+ * operator decision. N audit rows for one act is a worse record of it.
28
+ *
29
+ * `POST /api/create_workflow`'s input surface is `yaml`, `bundle_digest`,
30
+ * `owner_crew_id`. An extra body key on it would be **silently ignored, not
31
+ * rejected** — the mapping would vanish with no error, the worst available
32
+ * failure mode. That is why the mapping travels as its own call and why this
33
+ * module is a single reconciliation point.
34
+ *
35
+ * ## Contract
36
+ *
37
+ * ```
38
+ * GET /api/capability_mappings?def=<name> ← LIVE
39
+ * 200 { mappings: [ { defName, authored, target, … }, … ] }
40
+ * 200 { ok: true, mappings: { <authored>: <orgName>, … } } (older hubs)
41
+ * 404 | 501 → the hub does not implement it
42
+ *
43
+ * POST /api/set_capability_mappings ← NOT YET SHIPPED
44
+ * body { def: <name>, mappings: { <authored>: <orgName>, … } }
45
+ * 200 { ok: true }
46
+ * 404 | 501 → the hub does not implement it
47
+ * ```
48
+ *
49
+ * Identity entries (`orgName === authored`) are dropped hub-side by the
50
+ * resolver, so a caller whose every entry is the identity must skip the write
51
+ * entirely rather than post a no-op — see `dispatchInstall`.
52
+ *
53
+ * ## Transport
54
+ *
55
+ * Both calls take an injected `CapabilityMappingTransport` rather than
56
+ * importing a fetch helper: `cli.ts` builds it from `authedGet` / `authedPost`,
57
+ * so these calls inherit `ensureFreshOAuth`, the single 401-refresh-and-retry,
58
+ * `hubFetch`'s 30s deadline, its bounded body read and `redirect: 'error'`,
59
+ * without this module importing `cli.ts` (which would be an import cycle and a
60
+ * boundary violation).
61
+ *
62
+ * Error discipline mirrors `dispatchCapability`: a 401 that survived the retry
63
+ * is the "credential rejected" wording the caller upgrades to exit 3; any other
64
+ * non-2xx surfaces the hub's typed `message` VERBATIM and never raw body text;
65
+ * a malformed JSON body is a FIXED string, never V8's `SyntaxError` (which
66
+ * embeds a snippet of the body).
67
+ */
68
+ import { asCapabilityMappings } from "./hub.js";
69
+ import { CliError } from "./util.js";
70
+ /** Read half of the contract — shipped. */
71
+ export const CAPABILITY_MAPPINGS_READ_PATH = '/api/capability_mappings';
72
+ /** Write half of the contract — the PLURAL verb no shipped hub has yet. */
73
+ export const CAPABILITY_MAPPINGS_WRITE_PATH = '/api/set_capability_mappings';
74
+ /**
75
+ * A status that means "this hub build does not have the endpoint at all",
76
+ * as distinct from "the endpoint rejected this request".
77
+ *
78
+ * `404` is what a hub edge with no such route answers; `501` is what one that
79
+ * knows the route but has not implemented the verb would answer. Both are
80
+ * capability probes, never request-level failures — no other status is treated
81
+ * as one, so a `400` or `403` stays a loud error.
82
+ */
83
+ function isUnimplemented(status) {
84
+ return status === 404 || status === 501;
85
+ }
86
+ /** The hub's typed `message`, or `undefined` when the body carries none. */
87
+ async function hubMessage(res) {
88
+ try {
89
+ const body = (await res.json());
90
+ if (typeof body === 'object' && body !== null) {
91
+ const m = body.message;
92
+ if (typeof m === 'string' && m !== '')
93
+ return m;
94
+ }
95
+ }
96
+ catch {
97
+ // Non-JSON body — the caller falls through to a generic status message.
98
+ }
99
+ return undefined;
100
+ }
101
+ /** The 401-then-non-2xx ladder both calls share, worded per endpoint. */
102
+ async function assertCallOk(res, origin) {
103
+ if (res.status === 401) {
104
+ // Survived the transport's one refresh-and-retry. The caller's catch
105
+ // upgrades this exact wording to exit 3, the way `dispatchCapability` does.
106
+ throw new CliError('credential rejected by the hub — run `owenloop login`');
107
+ }
108
+ if (!res.ok) {
109
+ throw new CliError((await hubMessage(res)) ?? `hub ${origin} rejected the request (HTTP ${res.status})`);
110
+ }
111
+ }
112
+ /**
113
+ * Read the `authored → org` mappings already recorded for `defName`.
114
+ *
115
+ * Returns `'unsupported'` — a sentinel, not an empty map — when the hub has no
116
+ * such endpoint. The distinction is load-bearing: an empty map means "this def
117
+ * has no mapping recorded", so nothing needs carrying forward, while
118
+ * `'unsupported'` means "this hub cannot tell you", and the caller must warn
119
+ * before it asks the operator about capabilities that may already be linked.
120
+ */
121
+ export async function fetchCapabilityMappings(transport, defName, origin) {
122
+ const res = await transport.get(`${CAPABILITY_MAPPINGS_READ_PATH}?def=${encodeURIComponent(defName)}`);
123
+ if (isUnimplemented(res.status))
124
+ return 'unsupported';
125
+ await assertCallOk(res, origin);
126
+ let body;
127
+ try {
128
+ body = (await res.json());
129
+ }
130
+ catch {
131
+ throw new CliError('capability_mappings: malformed success response — body is not valid JSON');
132
+ }
133
+ try {
134
+ return asCapabilityMappings(body, defName);
135
+ }
136
+ catch (e) {
137
+ throw new CliError(e.message);
138
+ }
139
+ }
140
+ /**
141
+ * Record `authored → org` mappings for `defName`, replacing what is stored for
142
+ * the authored names it names.
143
+ *
144
+ * A hub without the endpoint is a **hard, exit-2 failure naming the missing
145
+ * verb** — never a warning and never a silent skip. `install` calls this BEFORE
146
+ * it publishes precisely so this failure leaves nothing half-applied: no def
147
+ * has been pushed, so the org vocabulary is untouched.
148
+ */
149
+ export async function recordCapabilityMappings(transport, defName, mappings, origin) {
150
+ const res = await transport.post(CAPABILITY_MAPPINGS_WRITE_PATH, { def: defName, mappings });
151
+ if (isUnimplemented(res.status)) {
152
+ throw new CliError(`hub ${origin} does not implement POST ${CAPABILITY_MAPPINGS_WRITE_PATH} (HTTP ${res.status}) — ` +
153
+ 'it cannot record a def\'s mapping in one transaction, so this def was NOT published. ' +
154
+ 'This hub may still have the SINGULAR /api/set_capability_mapping, which writes one row per ' +
155
+ 'call; install does not use it, because a partial write followed by a publish is exactly the ' +
156
+ 'half-applied state recording-before-publishing exists to prevent. Until the batch verb ships, ' +
157
+ 'only an identity mapping (every capability keeping its authored name) can be installed.', { exitCode: 2 });
158
+ }
159
+ await assertCallOk(res, origin);
160
+ }
package/dist/src/cli.d.ts CHANGED
@@ -27,10 +27,10 @@
27
27
  * owenloop retract <wf> <path> --by <author> --text <msg>
28
28
  * owenloop skip <wf> <path> --by <author> --text <msg>
29
29
  * owenloop retry <wf> <path> [--by <author>] [--text <guidance>] clear a stall
30
- * owenloop close <wf> <run> [--outcome ok|no_work|failed|skipped] [--summary s]
30
+ * owenloop close <wf> <run> [--outcome ok|no_work|released|failed|skipped] [--summary s]
31
31
  * owenloop delete <wf> [--recursive]
32
32
  *
33
- * Global: --db <path> (env OWENLOOP_DB), --defs <dir> (env OWENLOOP_DEFS).
33
+ * Global: --db <path> (env OWENLOOP_DB), --defs <dir> (env OWENLOOP_DEFS), --verbose.
34
34
  */
35
35
  import { hasDefiniteCheckDefect } from './model.ts';
36
36
  import { PrincipalKeyManager } from './crypto/keys.ts';