@cotal-ai/delivery 0.16.0 → 0.17.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.
- package/dist/delivery.d.ts.map +1 -1
- package/dist/delivery.js +29 -6
- package/dist/delivery.js.map +1 -1
- package/dist/evict-exec.d.ts.map +1 -1
- package/dist/evict-exec.js +8 -4
- package/dist/evict-exec.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/membership.d.ts +12 -1
- package/dist/membership.d.ts.map +1 -1
- package/dist/membership.js +57 -27
- package/dist/membership.js.map +1 -1
- package/package.json +3 -3
package/dist/delivery.d.ts.map
CHANGED
|
@@ -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,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,
|
|
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,CAgLtF"}
|
package/dist/delivery.js
CHANGED
|
@@ -118,13 +118,21 @@ export async function runDelivery(args, store) {
|
|
|
118
118
|
const server = v.server ?? DEFAULT_SERVER;
|
|
119
119
|
const creds = await loadDeliveryCreds(credsSrc, v); // pre-minted scoped cred; NO signer/loadSpaceAuth in this path
|
|
120
120
|
let latestCreds = creds.initial; // freshest renewal — the broker-reachability poll below presents it
|
|
121
|
-
|
|
121
|
+
// REQUIRE TLS when the operator said to. This daemon holds a STANDING credential and reconnects
|
|
122
|
+
// unattended, so a downgrade here is not a one-shot exposure like a human running `cotal status`
|
|
123
|
+
// - it is repeated, on every reconnect, with nobody watching. `tls: true` makes the client refuse
|
|
124
|
+
// rather than fall back, which is the only behaviour that survives a forged plaintext INFO.
|
|
125
|
+
// Boolean flags arrive as presence in this Values map (`Record<string, string | undefined>`),
|
|
126
|
+
// matching how `--dev-mint` is read below. Comparing to `true` would silently never match.
|
|
127
|
+
const tls = v.tls !== undefined;
|
|
128
|
+
if (!(await isReachable(server, { creds: latestCreds, ...(tls ? { tls: true } : {}) }))) {
|
|
122
129
|
console.error(`✗ delivery: can't reach NATS at ${server}. Run: cotal up`);
|
|
123
130
|
process.exit(1);
|
|
124
131
|
}
|
|
125
132
|
const ep = new CotalEndpoint({
|
|
126
133
|
space,
|
|
127
134
|
servers: server,
|
|
135
|
+
...(tls ? { tls: true } : {}),
|
|
128
136
|
// The RELOAD seam (D5 slice 5 class 2): the endpoint re-invokes the source at 75% of each JWT's
|
|
129
137
|
// lifetime and swaps the connection onto the re-signed file — bounded delivery creds renew with
|
|
130
138
|
// no daemon restart. The explicit card.id pins the daemon's nkey across renewals.
|
|
@@ -153,6 +161,10 @@ export async function runDelivery(args, store) {
|
|
|
153
161
|
// Broker-sourced graph membership handle — declared BEFORE Plane-3 so the delivery-admin reload
|
|
154
162
|
// hook below can close over it (it starts further down; the closure reads it live).
|
|
155
163
|
let membership;
|
|
164
|
+
// WHY the feed is down, carried from `startMembership` so the adoption refusal below names the real
|
|
165
|
+
// fault instead of its symptom. Without it, an expired $SYS observer cred surfaces to the operator
|
|
166
|
+
// only as "membership feed is not running" (#338).
|
|
167
|
+
let membershipDown;
|
|
156
168
|
// Host Plane-3 (fan-out writer + trusted reader) AND serve the ctl.delivery runtime durable ops. The
|
|
157
169
|
// reader re-authorizes each entry against the durable ACL registry, read FRESH per entry. The
|
|
158
170
|
// delivery-admin rail's `reloadCreds` (explicit class-2 adoption) also reloads the membership feed's
|
|
@@ -164,8 +176,8 @@ export async function runDelivery(args, store) {
|
|
|
164
176
|
// membership-rw.creds but the feed that must adopt it is not running), else n/a — a
|
|
165
177
|
// delivery-only renewal must never be falsely failed by an unprovisioned feed.
|
|
166
178
|
if (expected !== undefined)
|
|
167
|
-
throw new Error(
|
|
168
|
-
return { skipped:
|
|
179
|
+
throw new Error(`membership feed is not running, but a membership generation was expected - nothing adopted${membershipDown ? `: ${membershipDown}` : ""}`);
|
|
180
|
+
return { skipped: `membership feed not running (nothing to reload)${membershipDown ? `: ${membershipDown}` : ""}` };
|
|
169
181
|
}
|
|
170
182
|
// Symmetric with delivery: claim broker acceptance (the preflight), not verified resident reauth.
|
|
171
183
|
return { brokerAccepted: await membership.reloadRwCreds(expected), residentSwap: "best-effort" };
|
|
@@ -192,10 +204,12 @@ export async function runDelivery(args, store) {
|
|
|
192
204
|
// Pass the INJECTED store (hosted KMS/Vault), NOT credsSrc.store — that one may be an FS store over
|
|
193
205
|
// an arbitrary `--creds` path, whereas membership-rw lives under the workstation `.cotal/` key. With
|
|
194
206
|
// no injected store, startMembership falls back to the workstation FS store.
|
|
195
|
-
|
|
207
|
+
// Fail-soft, but never fault-FORGETFUL: whichever way the feed fails to come up, keep the reason.
|
|
208
|
+
({ handle: membership, down: membershipDown } = await startMembership({ space, server }, store));
|
|
196
209
|
}
|
|
197
210
|
catch (e) {
|
|
198
|
-
|
|
211
|
+
membershipDown = e.message;
|
|
212
|
+
console.error(`! membership: failed to start (${membershipDown}); graph membership degraded, delivery unaffected`);
|
|
199
213
|
}
|
|
200
214
|
let stopping = false;
|
|
201
215
|
const shutdown = (code) => {
|
|
@@ -242,7 +256,16 @@ export async function runDelivery(args, store) {
|
|
|
242
256
|
const brokerWatch = setInterval(() => {
|
|
243
257
|
if (stopping)
|
|
244
258
|
return;
|
|
245
|
-
|
|
259
|
+
// THE SAME TRANSPORT AS EVERY OTHER DIAL IN THIS PROCESS. This poll carries `latestCreds` — a
|
|
260
|
+
// standing credential — and `isReachable` performs a real authenticated connect whenever creds
|
|
261
|
+
// are supplied, every 2 seconds, for the life of the daemon. It is the most repeated credential
|
|
262
|
+
// presentation in the system, and it was the one dial here that did not name its transport.
|
|
263
|
+
//
|
|
264
|
+
// The poll predates TLS and is identical on `main`, where nothing is encrypted and it is at
|
|
265
|
+
// least consistent. What is new is the ASYMMETRY: with the two dials above upgraded, an operator
|
|
266
|
+
// who enables TLS would get a protected main path and an unprotected watchdog. An inconsistent
|
|
267
|
+
// guarantee is worse than a uniformly absent one, because the operator now believes something.
|
|
268
|
+
void isReachable(server, { creds: latestCreds, ...(tls ? { tls: true } : {}) })
|
|
246
269
|
.then((ok) => {
|
|
247
270
|
if (ok) {
|
|
248
271
|
lastReachable = Date.now();
|
package/dist/delivery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery.js","sourceRoot":"","sources":["../src/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,GAIZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,M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M,gBAAgB,CAAC;AAGxB;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"evict-exec.d.ts","sourceRoot":"","sources":["../src/evict-exec.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,cAAc,EAEnB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA+BhG;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsBvG"}
|
package/dist/evict-exec.js
CHANGED
|
@@ -24,8 +24,10 @@ export async function executeEviction(server, principal) {
|
|
|
24
24
|
const obsPath = join(dir, "membership-observer.creds");
|
|
25
25
|
const evPath = join(dir, "connection-evictor.creds");
|
|
26
26
|
const cfgPath = join(dir, "membership.json");
|
|
27
|
-
if (!existsSync(obsPath) || !existsSync(evPath)
|
|
28
|
-
throw new Error("evictPrincipal: the $SYS observer/evictor creds are not provisioned here (a space created before live eviction)
|
|
27
|
+
if (!existsSync(obsPath) || !existsSync(evPath))
|
|
28
|
+
throw new Error("evictPrincipal: the $SYS observer/evictor creds are not provisioned here (a space created before live eviction); mint them with `cotal down` then `cotal up --rotate-sys`. Until then removal is deny-new-only (durable reauth)");
|
|
29
|
+
if (!existsSync(cfgPath))
|
|
30
|
+
throw new Error(`evictPrincipal: ${cfgPath} is missing, so the account to scan is unknown; until then removal is deny-new-only (durable reauth)`);
|
|
29
31
|
const accountId = JSON.parse(readFileSync(cfgPath, "utf8")).accountId;
|
|
30
32
|
if (!accountId)
|
|
31
33
|
throw new Error("evictPrincipal: .cotal/membership.json has no accountId");
|
|
@@ -55,8 +57,10 @@ export async function executePlaneLiveness(server, query) {
|
|
|
55
57
|
const dir = join(findCotalRoot(), ".cotal");
|
|
56
58
|
const obsPath = join(dir, "membership-observer.creds");
|
|
57
59
|
const cfgPath = join(dir, "membership.json");
|
|
58
|
-
if (!existsSync(obsPath)
|
|
59
|
-
throw new Error("planeConnLiveness: the $SYS observer creds are not provisioned here (a space created before live observation)
|
|
60
|
+
if (!existsSync(obsPath))
|
|
61
|
+
throw new Error("planeConnLiveness: the $SYS observer creds are not provisioned here (a space created before live observation); mint them with `cotal down` then `cotal up --rotate-sys`");
|
|
62
|
+
if (!existsSync(cfgPath))
|
|
63
|
+
throw new Error(`planeConnLiveness: ${cfgPath} is missing, so the account to scan is unknown`);
|
|
60
64
|
const accountId = JSON.parse(readFileSync(cfgPath, "utf8")).accountId;
|
|
61
65
|
if (!accountId)
|
|
62
66
|
throw new Error("planeConnLiveness: .cotal/membership.json has no accountId");
|
package/dist/evict-exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evict-exec.js","sourceRoot":"","sources":["../src/evict-exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,iBAAiB,GAIlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,SAAiB;IACrE,+FAA+F;IAC/F,iGAAiG;IACjG,4FAA4F;IAC5F,6FAA6F;IAC7F,2FAA2F;IAC3F,uFAAuF;IACvF,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC5C,I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AC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA4CzD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const deliveryCommands = [
|
|
|
17
17
|
flags: [
|
|
18
18
|
{ name: "space", type: "string", value: "<s>", description: "space to serve (required; the scoped cred doesn't encode it)" },
|
|
19
19
|
{ name: "server", type: "string", value: "<url>", description: "broker URL (default: the local mesh)" },
|
|
20
|
+
{ name: "tls", type: "boolean", description: "REQUIRE TLS to the broker - refuse to connect if it is not offered" },
|
|
20
21
|
{ name: "creds", type: "string", value: "<file>", description: "pre-minted scoped delivery cred" },
|
|
21
22
|
{ name: "shard", type: "string", value: "<n>", description: "shard index (N=1 only; non-zero is rejected)" },
|
|
22
23
|
{ name: "shards", type: "string", value: "<n>", description: "shard count (N=1 only; >1 is rejected)" },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,gBAAgB,GAAc;IAClC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,OAAO,EACL,0IAA0I;QAC5I,K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O,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/membership.d.ts
CHANGED
|
@@ -18,8 +18,19 @@ import { type MembershipFeedHandle, type SecretStore } from "@cotal-ai/core";
|
|
|
18
18
|
* They are a static $SYS cred and non-secret config, respectively — the renewable rw kind is what 3b
|
|
19
19
|
* migrates; the manager re-signs only it.
|
|
20
20
|
*/
|
|
21
|
+
/** Why the feed is, or is not, running. `down` carries the DIAGNOSIS to the caller, because the
|
|
22
|
+
* daemon's log line is not the only place it is needed: an adoption reply that says only "the feed is
|
|
23
|
+
* not running" sends an operator hunting for a feed fault when the real one is an expired $SYS cred
|
|
24
|
+
* three layers down (the failure reported in #338). Exactly one of the two members is set. */
|
|
25
|
+
export type MembershipStart = {
|
|
26
|
+
handle: MembershipFeedHandle;
|
|
27
|
+
down?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
handle?: undefined;
|
|
30
|
+
down: string;
|
|
31
|
+
};
|
|
21
32
|
export declare function startMembership(opts: {
|
|
22
33
|
space: string;
|
|
23
34
|
server: string;
|
|
24
|
-
}, store?: SecretStore): Promise<
|
|
35
|
+
}, store?: SecretStore): Promise<MembershipStart>;
|
|
25
36
|
//# sourceMappingURL=membership.d.ts.map
|
package/dist/membership.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../src/membership.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuD,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlI;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;+FAG+F;AAC/F,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAExH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CA0F5H"}
|
package/dist/membership.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { startMembershipFeed } from "@cotal-ai/core";
|
|
3
|
+
import { credsClaims, inspectCredHealth, startMembershipFeed } from "@cotal-ai/core";
|
|
4
4
|
import { findCotalRoot, MEMBERSHIP_RW_CREDS_KEY, workspaceSecretStore } from "@cotal-ai/workspace";
|
|
5
|
-
/**
|
|
6
|
-
* The delivery daemon's thin composition root for the broker-sourced graph-membership feed. It loads the
|
|
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).
|
|
14
|
-
*
|
|
15
|
-
* Deliberately ISOLATED from Plane-3: a separate module, separate connections, and a fail-soft contract —
|
|
16
|
-
* if the creds aren't provisioned (a pre-feature space) or the feed can't start, it logs and returns
|
|
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.
|
|
23
|
-
*/
|
|
24
5
|
export async function startMembership(opts, store) {
|
|
25
6
|
const root = findCotalRoot();
|
|
26
7
|
const dir = join(root, ".cotal");
|
|
@@ -28,14 +9,63 @@ export async function startMembership(opts, store) {
|
|
|
28
9
|
const cfgPath = join(dir, "membership.json");
|
|
29
10
|
const secrets = store ?? workspaceSecretStore(root);
|
|
30
11
|
const rw = await secrets.get(MEMBERSHIP_RW_CREDS_KEY);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
const missing = [
|
|
13
|
+
rw === undefined ? MEMBERSHIP_RW_CREDS_KEY : undefined,
|
|
14
|
+
existsSync(obsPath) ? undefined : "membership-observer.creds",
|
|
15
|
+
existsSync(cfgPath) ? undefined : "membership.json",
|
|
16
|
+
].filter((f) => f !== undefined);
|
|
17
|
+
if (missing.length) {
|
|
18
|
+
// Name the missing piece AND a repair that reaches it. `cotal up --rotate-sys` re-mints the $SYS
|
|
19
|
+
// pair, since it holds a system-account signing seed for exactly that moment, but it writes neither
|
|
20
|
+
// the DATA-account rw cred nor the account-id config: those are written once, when a space is
|
|
21
|
+
// first provisioned. So a rotation repairs a missing OBSERVER and nothing else, and pointing a
|
|
22
|
+
// pre-feature space at one would send an operator through a stop/start that cannot help it.
|
|
23
|
+
const down = missing.length === 1 && missing[0] === "membership-observer.creds"
|
|
24
|
+
? "the $SYS observer cred is missing - re-mint it with `cotal down` then `cotal up --rotate-sys`"
|
|
25
|
+
: `the membership bundle is incomplete here (missing ${missing.join(", ")}) - a space created before broker-sourced membership gains the feed only when its auth is regenerated; \`cotal up --rotate-sys\` re-mints the $SYS pair but writes neither the rw cred nor the account id`;
|
|
26
|
+
console.error(`• membership: ${down}. The graph falls back to traffic-only; delivery is unaffected.`);
|
|
27
|
+
return { down };
|
|
34
28
|
}
|
|
35
29
|
const accountId = JSON.parse(readFileSync(cfgPath, "utf8")).accountId;
|
|
36
30
|
if (!accountId) {
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const down = ".cotal/membership.json has no accountId";
|
|
32
|
+
console.error(`• membership: ${down}; membership disabled (delivery unaffected)`);
|
|
33
|
+
return { down };
|
|
34
|
+
}
|
|
35
|
+
// Check the OBSERVER's own expiry before connecting. It is `rotation-renewed`, so unlike every
|
|
36
|
+
// renewable cred here nothing re-signs it: at its 30-day horizon the broker simply answers
|
|
37
|
+
// "Authorization Violation", which names neither the credential nor the repair. Reading the JWT
|
|
38
|
+
// costs nothing and turns the daemon's one loud line into the actual diagnosis: the difference
|
|
39
|
+
// between an operator finding this in minutes and finding it in a support thread.
|
|
40
|
+
const obsCreds = readFileSync(obsPath, "utf8");
|
|
41
|
+
// A TORN rotation is the other way this cred goes broker-dead without a byte of its own changing:
|
|
42
|
+
// `rotateSystemCreds` commits the trust record, then writes both $SYS creds, so a crash between the
|
|
43
|
+
// two leaves one file on the retired system account. The broker answers the same bare
|
|
44
|
+
// "Authorization Violation" either way. The daemon cannot ask the trust record which account is
|
|
45
|
+
// current (it deliberately never loads the signer), but it does not need to: the pair is written
|
|
46
|
+
// by one rotation, so two DIFFERENT issuers prove one of them is stale, with no signer read at all.
|
|
47
|
+
// (`doctor auth`, which legitimately holds the record, checks each file against it directly.)
|
|
48
|
+
const evPath = join(dir, "connection-evictor.creds");
|
|
49
|
+
if (existsSync(evPath)) {
|
|
50
|
+
let obsIss, evIss;
|
|
51
|
+
try {
|
|
52
|
+
obsIss = credsClaims(obsCreds).iss;
|
|
53
|
+
evIss = credsClaims(readFileSync(evPath, "utf8")).iss;
|
|
54
|
+
}
|
|
55
|
+
catch { /* an unreadable file is the health check's case just below */ }
|
|
56
|
+
if (obsIss !== undefined && evIss !== undefined && obsIss !== evIss) {
|
|
57
|
+
const down = `the two $SYS creds are signed by DIFFERENT system accounts (observer ${obsIss.slice(0, 12)}…, evictor ${evIss.slice(0, 12)}…) - a system-account rotation did not finish, so one of them is broker-dead: re-run \`cotal down\` then \`cotal up --rotate-sys\` to land a complete generation`;
|
|
58
|
+
console.error(`! membership: ${down}; graph membership degraded, delivery unaffected`);
|
|
59
|
+
return { down };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const obs = inspectCredHealth(obsCreds);
|
|
63
|
+
if (obs.state === "expired" || obs.state === "unreadable") {
|
|
64
|
+
const down = obs.state === "expired"
|
|
65
|
+
? `the $SYS observer cred (${obsPath}) EXPIRED ${new Date((obs.exp ?? 0) * 1000).toISOString()} and the broker denies it - it is rotation-renewed, so nothing re-signs it: run \`cotal down\` then \`cotal up --rotate-sys\` (agents, creds and data are untouched)`
|
|
66
|
+
: `the $SYS observer cred (${obsPath}) is unreadable (${obs.error})`;
|
|
67
|
+
console.error(`! membership: ${down}; graph membership degraded, delivery unaffected`);
|
|
68
|
+
return { down };
|
|
39
69
|
}
|
|
40
70
|
const intervalMs = Number(process.env.COTAL_MEMBERSHIP_INTERVAL_MS) || undefined; // test/ops override
|
|
41
71
|
const handle = await startMembershipFeed({
|
|
@@ -43,7 +73,7 @@ export async function startMembership(opts, store) {
|
|
|
43
73
|
space: opts.space,
|
|
44
74
|
accountId,
|
|
45
75
|
// Observer is rotation-renewed ($SYS): a static read — its renewal is a system rotation + restart.
|
|
46
|
-
observerCreds:
|
|
76
|
+
observerCreds: obsCreds,
|
|
47
77
|
// rw is class-2 standing-renewable: read through the store seam and renewed on a 75% timer that
|
|
48
78
|
// preflight-proves each candidate the manager re-signs into the store (D5 slice 5). The daemon
|
|
49
79
|
// never sees the signer; the manager owns the re-sign.
|
|
@@ -56,6 +86,6 @@ export async function startMembership(opts, store) {
|
|
|
56
86
|
intervalMs,
|
|
57
87
|
});
|
|
58
88
|
console.log(`✓ membership feed up (broker-sourced channel membership) — space ${opts.space}`);
|
|
59
|
-
return handle;
|
|
89
|
+
return { handle };
|
|
60
90
|
}
|
|
61
91
|
//# sourceMappingURL=membership.js.map
|
package/dist/membership.js.map
CHANGED
|
@@ -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,EAA+C,MAAM,gBAAgB,CAAC;
|
|
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,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAA+C,MAAM,gBAAgB,CAAC;AAClI,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AA4BnG,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAuC,EAAE,KAAmB;IAChG,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAEpD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG;QACd,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS;QACtD,UA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EAAE,CAAC;IAClB,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,SAAS,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,QAAQ;QACvB,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,EAAE,MAAM,EAAE,CAAC;AACpB,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.
|
|
4
|
+
"version": "0.17.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.
|
|
22
|
-
"@cotal-ai/workspace": "0.
|
|
21
|
+
"@cotal-ai/core": "0.17.0",
|
|
22
|
+
"@cotal-ai/workspace": "0.17.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|