@cotal-ai/delivery 0.13.1 → 0.14.0

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.
@@ -15,11 +15,12 @@ export { DELIVERY_CREDS_KEY };
15
15
  * seam ships, operating sharded delivery is deferred to the channel-prefix grammar; see core-sub-fabric.md).
16
16
  *
17
17
  * `store` is the hosted-composition seam: a closed composition root calls this export directly and
18
- * injects its own {@link SecretStore} (KMS/Vault…) holding the cred under {@link DELIVERY_CREDS_KEY};
19
- * the registered `deliver` command passes none and gets the workstation FS store (or `--creds`).
20
- * Injection currently covers the daemon READ path only: the renewal owner's write side
21
- * (`remintDaemonCreds(root, store?)`) accepts the same store but is not yet threaded through the
22
- * manager, so hosted end-to-end renewal on an injected store is NOT wired yet.
18
+ * injects its own {@link SecretStore} (KMS/Vault…) holding the daemon cred under
19
+ * {@link DELIVERY_CREDS_KEY} AND the membership feed's rw cred under `membership-rw.creds`; the
20
+ * registered `deliver` command passes none and gets the workstation FS store (or `--creds`). The
21
+ * renewal owner's write side (`remintDaemonCreds`) is threaded through the manager's
22
+ * `ManagerOptions.secretStore` too, so a hosted composition renews both daemon kinds end-to-end when
23
+ * the manager and this daemon are handed the SAME store.
23
24
  */
24
25
  export declare function runDelivery(args: ParsedArgs, store?: SecretStore): Promise<void>;
25
26
  //# sourceMappingURL=delivery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAA8E,MAAM,qBAAqB,CAAC;AAMrI;;;yBAGyB;AACzB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAoF9B;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0ItF"}
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAA2F,MAAM,qBAAqB,CAAC;AAMlJ;;;yBAGyB;AACzB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAuF9B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuJtF"}
package/dist/delivery.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { basename, dirname, join, resolve } from "node:path";
2
2
  import { CotalEndpoint, DEFAULT_SERVER, LEASE_TTL_MS, credsClaims, idFromCreds, isReachable, mintCreds, newIdentity, } from "@cotal-ai/core";
3
- import { DELIVERY_CREDS_KEY, FsSecretStore, authDir, findCotalRoot, loadSpaceAuth, workspaceSecretStore } from "@cotal-ai/workspace";
3
+ import { DELIVERY_CREDS_KEY, FsSecretStore, authDir, findCotalRoot, loadSpaceAuth, soleSpaceOf, workspaceSecretStore } from "@cotal-ai/workspace";
4
4
  import { startMembership } from "./membership.js";
5
5
  import { executeEviction, executePlaneLiveness } from "./evict-exec.js";
6
6
  /** Re-exported for hosted compositions: the {@link SecretStore} key a store injected into
@@ -70,7 +70,10 @@ async function loadDeliveryCreds(src, v) {
70
70
  if (src.injected)
71
71
  throw new Error(`delivery: no cred in the injected secret store under key "${DELIVERY_CREDS_KEY}" — the hosted composition must put it before starting the daemon (local sources are never consulted when a store is injected)`);
72
72
  if (v["dev-mint"] !== undefined) {
73
- const auth = loadSpaceAuth(authDir(findCotalRoot()));
73
+ // Space-blind dev path: the root must name exactly one space (soleSpaceOf fails loud on several).
74
+ const devRoot = authDir(findCotalRoot());
75
+ const devSpace = soleSpaceOf(devRoot);
76
+ const auth = devSpace ? loadSpaceAuth(devRoot, devSpace) : undefined;
74
77
  if (!auth)
75
78
  throw new Error("delivery --dev-mint: no .cotal/auth here to mint from");
76
79
  console.error("⚠ delivery: --dev-mint — minting a scoped delivery cred from the LOCAL SIGNER (DEV ONLY; production mounts a pre-minted delivery.creds and the daemon never sees the signer)");
@@ -91,11 +94,12 @@ async function loadDeliveryCreds(src, v) {
91
94
  * seam ships, operating sharded delivery is deferred to the channel-prefix grammar; see core-sub-fabric.md).
92
95
  *
93
96
  * `store` is the hosted-composition seam: a closed composition root calls this export directly and
94
- * injects its own {@link SecretStore} (KMS/Vault…) holding the cred under {@link DELIVERY_CREDS_KEY};
95
- * the registered `deliver` command passes none and gets the workstation FS store (or `--creds`).
96
- * Injection currently covers the daemon READ path only: the renewal owner's write side
97
- * (`remintDaemonCreds(root, store?)`) accepts the same store but is not yet threaded through the
98
- * manager, so hosted end-to-end renewal on an injected store is NOT wired yet.
97
+ * injects its own {@link SecretStore} (KMS/Vault…) holding the daemon cred under
98
+ * {@link DELIVERY_CREDS_KEY} AND the membership feed's rw cred under `membership-rw.creds`; the
99
+ * registered `deliver` command passes none and gets the workstation FS store (or `--creds`). The
100
+ * renewal owner's write side (`remintDaemonCreds`) is threaded through the manager's
101
+ * `ManagerOptions.secretStore` too, so a hosted composition renews both daemon kinds end-to-end when
102
+ * the manager and this daemon are handed the SAME store.
99
103
  */
100
104
  export async function runDelivery(args, store) {
101
105
  const v = args.values;
@@ -108,7 +112,7 @@ export async function runDelivery(args, store) {
108
112
  // store rejects local-source flags before anything can read the workstation signer.
109
113
  const credsSrc = resolveCredsStore(v, store);
110
114
  // Space comes from --space (the CLI passes it). Only --dev-mint may derive it from the local signer.
111
- const space = v.space ?? (v["dev-mint"] !== undefined ? loadSpaceAuth(authDir(findCotalRoot()))?.space : undefined);
115
+ const space = v.space ?? (v["dev-mint"] !== undefined ? soleSpaceOf(authDir(findCotalRoot())) : undefined);
112
116
  if (!space)
113
117
  throw new Error("delivery: --space is required (the scoped creds file does not encode it)");
114
118
  const server = v.server ?? DEFAULT_SERVER;
@@ -154,7 +158,18 @@ export async function runDelivery(args, store) {
154
158
  // delivery-admin rail's `reloadCreds` (explicit class-2 adoption) also reloads the membership feed's
155
159
  // rw connection via this hook.
156
160
  await ep.startPlane3((owner, lifecycleUid) => ep.aclForOwner(owner, lifecycleUid), {
157
- reloadMembershipCreds: async () => membership ? membership.reloadRwCreds() : "membership feed not running (nothing to reload)",
161
+ reloadMembershipCreds: async (expected) => {
162
+ if (!membership) {
163
+ // Absent feed: a FAILURE when the renewal owner EXPECTED a membership generation (it re-signed
164
+ // membership-rw.creds but the feed that must adopt it is not running), else n/a — a
165
+ // delivery-only renewal must never be falsely failed by an unprovisioned feed.
166
+ if (expected !== undefined)
167
+ throw new Error("membership feed is not running, but a membership generation was expected - nothing adopted");
168
+ return { skipped: "membership feed not running (nothing to reload)" };
169
+ }
170
+ // Symmetric with delivery: claim broker acceptance (the preflight), not verified resident reauth.
171
+ return { brokerAccepted: await membership.reloadRwCreds(expected), residentSwap: "best-effort" };
172
+ },
158
173
  // Live-eviction executor (D5 slice 6): per-call $SYS observer/evictor connections; refuses
159
174
  // loudly on a pre-evictor space. Rare repair/flip step — never a standing $SYS conn here.
160
175
  evictPrincipal: (principal) => executeEviction(server, principal),
@@ -174,7 +189,10 @@ export async function runDelivery(args, store) {
174
189
  // reader + data-account feed writer), isolated from Plane-3. Fail-soft — a missing cred / start error
175
190
  // logs and the graph degrades to traffic-only; Plane-3 delivery is never affected.
176
191
  try {
177
- membership = await startMembership({ space, server });
192
+ // Pass the INJECTED store (hosted KMS/Vault), NOT credsSrc.store — that one may be an FS store over
193
+ // an arbitrary `--creds` path, whereas membership-rw lives under the workstation `.cotal/` key. With
194
+ // no injected store, startMembership falls back to the workstation FS store.
195
+ membership = await startMembership({ space, server }, store);
178
196
  }
179
197
  catch (e) {
180
198
  console.error(`! membership: failed to start (${e.message}) — graph membership degraded, del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,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACrB,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,sBAAsB;AAC3D,CAAC"}
@@ -1,16 +1,25 @@
1
- import { type MembershipFeedHandle } from "@cotal-ai/core";
1
+ import { type MembershipFeedHandle, type SecretStore } from "@cotal-ai/core";
2
2
  /**
3
3
  * The delivery daemon's thin composition root for the broker-sourced graph-membership feed. It loads the
4
- * two PRE-MINTED scoped creds + the DATA account id from `.cotal/` (written by `cotal up`; the daemon
5
- * never holds the signer) and hands them to the core feed engine ({@link startMembershipFeed}, which owns
6
- * the two connections + the poll loop).
4
+ * DATA account id + the SYSTEM-account observer cred from `.cotal/` (written by `cotal up`; the daemon
5
+ * never holds the signer) and reads the DATA-account rw cred through the {@link SecretStore} seam — the
6
+ * SAME seam the renewal owner (the manager) re-signs into — so a hosted composition can renew the feed's
7
+ * writer end-to-end (KMS/Vault) without a daemon restart. `store` is that hosted injection point; with
8
+ * none, the workstation FS store (keys = the filenames under `.cotal/`) is used, so a local `cotal up`
9
+ * is byte-for-byte unchanged. It hands the two creds + the account id to the core feed engine
10
+ * ({@link startMembershipFeed}, which owns the two connections + the poll loop + the rw 75% renewal).
7
11
  *
8
12
  * Deliberately ISOLATED from Plane-3: a separate module, separate connections, and a fail-soft contract —
9
13
  * if the creds aren't provisioned (a pre-feature space) or the feed can't start, it logs and returns
10
14
  * `undefined`; the graph degrades to traffic-only and delivery is untouched.
15
+ *
16
+ * Residual (deferred, non-blocking): the observer cred + `membership.json` (the account id) are still
17
+ * read from `.cotal/` files, so a fully hosted feed on an injected store also needs those two threaded.
18
+ * They are a static $SYS cred and non-secret config, respectively — the renewable rw kind is what 3b
19
+ * migrates; the manager re-signs only it.
11
20
  */
12
21
  export declare function startMembership(opts: {
13
22
  space: string;
14
23
  server: string;
15
- }): Promise<MembershipFeedHandle | undefined>;
24
+ }, store?: SecretStore): Promise<MembershipFeedHandle | undefined>;
16
25
  //# sourceMappingURL=membership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGhF;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAiCxH"}
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlG;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAyC7I"}
@@ -1,23 +1,34 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { startMembershipFeed } from "@cotal-ai/core";
4
- import { findCotalRoot } from "@cotal-ai/workspace";
4
+ import { findCotalRoot, MEMBERSHIP_RW_CREDS_KEY, workspaceSecretStore } from "@cotal-ai/workspace";
5
5
  /**
6
6
  * The delivery daemon's thin composition root for the broker-sourced graph-membership feed. It loads the
7
- * two PRE-MINTED scoped creds + the DATA account id from `.cotal/` (written by `cotal up`; the daemon
8
- * never holds the signer) and hands them to the core feed engine ({@link startMembershipFeed}, which owns
9
- * the two connections + the poll loop).
7
+ * DATA account id + the SYSTEM-account observer cred from `.cotal/` (written by `cotal up`; the daemon
8
+ * never holds the signer) and reads the DATA-account rw cred through the {@link SecretStore} seam — the
9
+ * SAME seam the renewal owner (the manager) re-signs into — so a hosted composition can renew the feed's
10
+ * writer end-to-end (KMS/Vault) without a daemon restart. `store` is that hosted injection point; with
11
+ * none, the workstation FS store (keys = the filenames under `.cotal/`) is used, so a local `cotal up`
12
+ * is byte-for-byte unchanged. It hands the two creds + the account id to the core feed engine
13
+ * ({@link startMembershipFeed}, which owns the two connections + the poll loop + the rw 75% renewal).
10
14
  *
11
15
  * Deliberately ISOLATED from Plane-3: a separate module, separate connections, and a fail-soft contract —
12
16
  * if the creds aren't provisioned (a pre-feature space) or the feed can't start, it logs and returns
13
17
  * `undefined`; the graph degrades to traffic-only and delivery is untouched.
18
+ *
19
+ * Residual (deferred, non-blocking): the observer cred + `membership.json` (the account id) are still
20
+ * read from `.cotal/` files, so a fully hosted feed on an injected store also needs those two threaded.
21
+ * They are a static $SYS cred and non-secret config, respectively — the renewable rw kind is what 3b
22
+ * migrates; the manager re-signs only it.
14
23
  */
15
- export async function startMembership(opts) {
16
- const dir = join(findCotalRoot(), ".cotal");
24
+ export async function startMembership(opts, store) {
25
+ const root = findCotalRoot();
26
+ const dir = join(root, ".cotal");
17
27
  const obsPath = join(dir, "membership-observer.creds");
18
- const rwPath = join(dir, "membership-rw.creds");
19
28
  const cfgPath = join(dir, "membership.json");
20
- if (!existsSync(obsPath) || !existsSync(rwPath) || !existsSync(cfgPath)) {
29
+ const secrets = store ?? workspaceSecretStore(root);
30
+ const rw = await secrets.get(MEMBERSHIP_RW_CREDS_KEY);
31
+ if (rw === undefined || !existsSync(obsPath) || !existsSync(cfgPath)) {
21
32
  console.error("• membership: scoped creds not provisioned here — broker-sourced graph membership disabled (the graph falls back to traffic-only). Provisioned on a fresh `cotal up`; a space created before this feature needs its auth regenerated. Delivery is unaffected.");
22
33
  return undefined;
23
34
  }
@@ -33,9 +44,15 @@ export async function startMembership(opts) {
33
44
  accountId,
34
45
  // Observer is rotation-renewed ($SYS): a static read — its renewal is a system rotation + restart.
35
46
  observerCreds: readFileSync(obsPath, "utf8"),
36
- // rw is class-2 standing-renewable: re-read per (re)connect attempt, so the manager's re-signed
37
- // file renews the feed's data connection across the broker's expiry-close (D5 slice 5).
38
- rwCreds: () => readFileSync(rwPath, "utf8"),
47
+ // rw is class-2 standing-renewable: read through the store seam and renewed on a 75% timer that
48
+ // preflight-proves each candidate the manager re-signs into the store (D5 slice 5). The daemon
49
+ // never sees the signer; the manager owns the re-sign.
50
+ rwCreds: async () => {
51
+ const cur = await secrets.get(MEMBERSHIP_RW_CREDS_KEY);
52
+ if (cur === undefined)
53
+ throw new Error(`membership: the scoped rw cred is gone (key "${MEMBERSHIP_RW_CREDS_KEY}") — restore it (locally: re-run \`cotal up\`) before the current JWT expires`);
54
+ return cur;
55
+ },
39
56
  intervalMs,
40
57
  });
41
58
  console.log(`✓ membership feed up (broker-sourced channel membership) — space ${opts.space}`);
@@ -1 +1 @@
1
- {"version":3,"file":"membership.js","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAA6B,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAuC;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,G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AAS,CAAC,CAAC,oBAAoB;IACtG,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC;QACvC,OAAO,EAAE,IAAI,CAAC,MAAM;QACpB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS;QACT,mGAAmG;QACnG,aAAa,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC;QAC5C,gGAAgG;QAChG,+FAA+F;QAC/F,uDAAuD;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACvD,IAAI,GAAG,KAAK,SAAS;gBACnB,MAAM,IAAI,KAAK,CAAC,gDAAgD,uBAAuB,+EAA+E,CAAC,CAAC;YAC1K,OAAO,GAAG,CAAC;QACb,CAAC;QACD,UAAU;KACX,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,oEAAoE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9F,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/delivery",
3
3
  "description": "Cotal delivery daemon: the server-side Plane-3 durable backstop (fan-out writer + trusted reader + membership/ACL authority), a scoped least-privilege NATS client co-located with the broker.",
4
- "version": "0.13.1",
4
+ "version": "0.14.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -18,8 +18,8 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@cotal-ai/core": "0.13.1",
22
- "@cotal-ai/workspace": "0.13.1"
21
+ "@cotal-ai/core": "0.14.0",
22
+ "@cotal-ai/workspace": "0.14.0"
23
23
  },
24
24
  "files": [
25
25
  "dist"