@cotal-ai/manager 0.166.3 → 0.168.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.
Files changed (42) hide show
  1. package/dist/attach-endpoint.d.ts.map +1 -1
  2. package/dist/attach-endpoint.js +2 -0
  3. package/dist/attach-endpoint.js.map +1 -1
  4. package/dist/console/app.js +12 -1
  5. package/dist/console/session-bundle.js +2 -0
  6. package/dist/lease-keeper.d.ts +98 -0
  7. package/dist/lease-keeper.d.ts.map +1 -0
  8. package/dist/lease-keeper.js +257 -0
  9. package/dist/lease-keeper.js.map +1 -0
  10. package/dist/managed-static-lifecycle.d.ts +247 -0
  11. package/dist/managed-static-lifecycle.d.ts.map +1 -0
  12. package/dist/managed-static-lifecycle.js +926 -0
  13. package/dist/managed-static-lifecycle.js.map +1 -0
  14. package/dist/manager-timeout.d.ts +5 -0
  15. package/dist/manager-timeout.d.ts.map +1 -0
  16. package/dist/manager-timeout.js +11 -0
  17. package/dist/manager-timeout.js.map +1 -0
  18. package/dist/manager.d.ts +201 -508
  19. package/dist/manager.d.ts.map +1 -1
  20. package/dist/manager.js +337 -3086
  21. package/dist/manager.js.map +1 -1
  22. package/dist/names-capacity.d.ts +125 -0
  23. package/dist/names-capacity.d.ts.map +1 -0
  24. package/dist/names-capacity.js +236 -0
  25. package/dist/names-capacity.js.map +1 -0
  26. package/dist/retirement.d.ts +221 -0
  27. package/dist/retirement.d.ts.map +1 -0
  28. package/dist/retirement.js +480 -0
  29. package/dist/retirement.js.map +1 -0
  30. package/dist/seat-custody.d.ts +100 -0
  31. package/dist/seat-custody.d.ts.map +1 -0
  32. package/dist/seat-custody.js +320 -0
  33. package/dist/seat-custody.js.map +1 -0
  34. package/dist/serve-plane.d.ts +228 -0
  35. package/dist/serve-plane.d.ts.map +1 -0
  36. package/dist/serve-plane.js +664 -0
  37. package/dist/serve-plane.js.map +1 -0
  38. package/dist/session-recovery.d.ts +115 -0
  39. package/dist/session-recovery.d.ts.map +1 -0
  40. package/dist/session-recovery.js +350 -0
  41. package/dist/session-recovery.js.map +1 -0
  42. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"attach-endpoint.d.ts","sourceRoot":"","sources":["../src/attach-endpoint.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAW9D;AAED,sEAAsE;AACtE,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;oGAGoG;AACpG,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;qDAIqD;AACrD,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,cAAc;;IAQvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB;6EACyE;IACzE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAMlC,4FAA4F;IAC5F,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAbL,IAAI,EAAE,MAAM,OAAO;IACpC,2FAA2F;IAC1E,QAAQ,EAAE,MAAM,SAAS,EAAE,EAC5C,IAAI,SAAI;IACR;6EACyE;IACxD,gBAAgB,CAAC,EAAE,kBAAkB,YAAA;IACtD;;;yBAGqB;IACrB,IAAI,SAAc;IAClB,4FAA4F;IAC3E,KAAK,GAAE,MAAwC;IAsC5D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,2DAA2D;IAC3D,OAAO,CA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;IAC3D,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IAW3C;;;;sCAIkC;IAClC,UAAU,IAAI,MAAM;CAgJrB"}
@@ -203,7 +203,9 @@ export class AttachEndpoint {
203
203
  if (PAGE[path]) {
204
204
  res.setHeader("cache-control", "no-store");
205
205
  res.setHeader("referrer-policy", "no-referrer");
206
+ res.setHeader("content-security-policy", "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self' ws: wss:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'");
206
207
  }
208
+ res.setHeader("x-content-type-options", "nosniff");
207
209
  // Every DATA route is credentialed. The roster and the live feed describe real agents, and
208
210
  // `POST /session/` MINTS a §13.6 grant plus a per-session caller credential — the most
209
211
  // sensitive thing this face does. Loopback alone stopped being the trust boundary once the
@@ -1 +1 @@
1
- {"version":3,"file":"attach-endpoint.js","sourceRoot":"","sources":["../src/attach-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAA0D,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD,gFAAgF;AAChF,MAAM,MAAM,G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AAW,CAAC,GAAmB,EAAE,KAAa,EAAE,IAAa;QAC3D,IAAI,GAAG,CAAC,aAAa;YAAE,OAAO;QAC9B,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -13,7 +13,7 @@ const empty = document.getElementById("empty");
13
13
  const meta = document.getElementById("meta");
14
14
  const panes = new Map(); // name -> { el, term, fit, session, status }
15
15
 
16
- // The console token, taken once from this page's own URL and kept only in memory. Deliberately not
16
+ // The console token, taken from the launch URL or this tab's history state. Deliberately not
17
17
  // stored in a cookie: cookies are host-scoped and not port-scoped, so a cookie set here would be
18
18
  // sent to every other HTTP service on this host, and two managers on one host would clobber each
19
19
  // other's. The manager serves the static shell openly and requires this on every route that carries
@@ -24,7 +24,18 @@ const panes = new Map(); // name -> { el, term, fit, session, status }
24
24
  const TOKEN =
25
25
  new URLSearchParams(location.hash.replace(/^#/, "")).get("t") ??
26
26
  new URLSearchParams(location.search).get("t") ??
27
+ history.state?.cotalConsoleToken ??
27
28
  "";
29
+ if (TOKEN) {
30
+ const address = new URL(location.href);
31
+ address.searchParams.delete("t");
32
+ const fragment = new URLSearchParams(address.hash.slice(1));
33
+ if (fragment.has("t")) {
34
+ fragment.delete("t");
35
+ address.hash = fragment.toString();
36
+ }
37
+ history.replaceState({ cotalConsoleToken: TOKEN }, "", address);
38
+ }
28
39
  const withToken = (path) => `${path}${path.includes("?") ? "&" : "?"}t=${encodeURIComponent(TOKEN)}`;
29
40
 
30
41
  function layout() {
@@ -9369,6 +9369,8 @@ ${stack}`;
9369
9369
  }
9370
9370
  var EP_AUTHZ_MODES = Object.freeze(["self", "owner", "any", "child", "ledger", "handle", "exact"]);
9371
9371
  var AUTHZ_SET = new Set(EP_AUTHZ_MODES);
9372
+ var EP_PRINCIPAL_AUTHORITIES = Object.freeze(["owner", "grant"]);
9373
+ var PRINCIPAL_AUTHORITY_SET = new Set(EP_PRINCIPAL_AUTHORITIES);
9372
9374
  function epsSubject(space, endpoint, sessionId, epoch, dir) {
9373
9375
  return assertSized(`${spacePrefix(space)}.eps.${endpointToken(endpoint)}.${assertIdToken(sessionId, "sessionId")}.${assertEpoch(epoch)}.${dir}`);
9374
9376
  }
@@ -0,0 +1,98 @@
1
+ import type { CotalEndpoint, ManagerLeaseInfo } from "@cotal-ai/core";
2
+ /** `start()`'s refusal when this manager instance's lease is held (#3915): by another live process
3
+ * on this workspace root, or by a holder on another root. A restart whose predecessor on this root
4
+ * is dead, this process's own earlier start included, waits the key out instead (#4092). The
5
+ * message is the operator copy; `held` and `sameRoot` are the data, so no caller parses it. A
6
+ * lease that could not be read or written is a plain `Error`. */
7
+ export declare class ManagerInstanceLeaseHeld extends Error {
8
+ readonly instanceId: string;
9
+ readonly space: string;
10
+ readonly held: ManagerLeaseInfo;
11
+ readonly sameRoot: boolean;
12
+ readonly name = "ManagerInstanceLeaseHeld";
13
+ constructor(message: string, instanceId: string, space: string, held: ManagerLeaseInfo, sameRoot: boolean);
14
+ }
15
+ /** What the lease keeper reads from its manager. Each is read when a call runs: `start()` assigns
16
+ * the endpoint and the instance id after construction, and `stopping` is the manager's stop fence. */
17
+ export interface LeaseKeeperDeps {
18
+ endpoint: () => CotalEndpoint;
19
+ instanceId: () => string;
20
+ space: () => string;
21
+ stopping: () => boolean;
22
+ }
23
+ /** This manager instance's liveness lease key: acquire it at start, renew it on a timer, release it
24
+ * on a clean stop. */
25
+ export declare class LeaseKeeper {
26
+ private readonly deps;
27
+ leaseInfo?: Omit<ManagerLeaseInfo, "since">;
28
+ leaseRevision?: number;
29
+ leaseTimer?: ReturnType<typeof setInterval>;
30
+ /** What the last renew tick learned about this instance's key. Only a CHANGE of state is printed
31
+ * (see {@link noteLease}), so an outage of hours is one line going in and one line coming out. */
32
+ private leaseState;
33
+ /** A renew is in flight. The tick must not start a second one: both would read the same cached
34
+ * revision, so whichever lands second CASes against a sequence the first already moved. */
35
+ private leaseRenewInFlight;
36
+ /** The promise a currently in-flight `renewLease()` is running, so `stop()` can await it before
37
+ * releasing the key instead of racing it: a renew that lands after the cached revision was read
38
+ * for release would otherwise move the row out from under a same-cached-revision CAS delete. */
39
+ leaseRenewTask?: Promise<void>;
40
+ constructor(deps: LeaseKeeperDeps);
41
+ private get ep();
42
+ private get managerInstanceId();
43
+ private get space();
44
+ private get leaseStopping();
45
+ /** Create THIS instance's lease key, waiting out a dead predecessor's row first (#4092).
46
+ *
47
+ * A manager SIGKILLed on this host cannot release its key, so a restart inside the key's TTL
48
+ * loses the create. When the row names this workspace root and a pid that is not running here
49
+ * (or is this process's own pid, which a live predecessor cannot hold), the holder is dead and
50
+ * the restart waits for the bucket TTL to remove the row, then creates again. It never writes
51
+ * over the row: a live holder renews it inside the TTL, and the wait then refuses on that write.
52
+ * Any other conflict refuses at once, as before. */
53
+ acquireInstanceLease(info: Omit<ManagerLeaseInfo, "since">): Promise<number>;
54
+ /** Release this instance's liveness lease key on a clean stop, at the broker's own revision
55
+ * rather than a cached one that a renew still in flight moments ago may have already moved past.
56
+ * Re-reads the row and releases only what is PROVABLY this process's (absent, or another pid's,
57
+ * is left alone — the same test {@link reconcileLease} uses).
58
+ *
59
+ * A read or delete that gets no answer, as during a reconnect, is tried again until the delete is
60
+ * acknowledged or {@link LEASE_RELEASE_BUDGET_MS} has passed (#3916). Nothing here throws: a stop
61
+ * must complete either way, and a row that could not be released is left for the bucket TTL, with
62
+ * one line of warning so the cost (a same-root restart waiting out the TTL) is not silent. */
63
+ releaseOwnManagerLease(): Promise<void>;
64
+ /** Keep this instance's liveness key fresh, and end the process only when another process holds it.
65
+ *
66
+ * A renew that throws is a question, not a verdict: the request may have timed out with the write
67
+ * landed and only its acknowledgement lost, the key may have expired during a stall, or a same-id
68
+ * process may hold it. The verdict comes from RE-READING the key ({@link reconcileLease}), and each
69
+ * answer has one response:
70
+ * - `held`: adopt the broker's revision and carry on.
71
+ * - `gone`: the key expired or was released while this process was still here, so put it back. The
72
+ * create is atomic, so a same-id process that got there first shows up as `taken` next tick.
73
+ * - `taken`: a different process holds this instance's key, so it took this instance over while
74
+ * this one stalled. This process is the superseded one and stops serving by exiting (SPEC 13.1).
75
+ * An open mesh has no barrier that would evict its serve connection, so nothing else stops it.
76
+ * - `unknown`: the broker could not be asked. Keep serving and ask again next tick, for as long as it
77
+ * takes. A manager that cannot reach its broker gains nothing by ending itself, and the seats it
78
+ * holds lose everything (a pty child dies with its parent).
79
+ *
80
+ * This replaces a fail-close that ended the process one tick past the lease TTL with no answer, which
81
+ * on a live mesh turned a ten-second broker or KV outage into a manager outage that lasted until an
82
+ * operator noticed. */
83
+ renewLease(): Promise<void>;
84
+ /** The renew attempt itself, split out from {@link renewLease} only so `stop()` can hold the
85
+ * promise a renew already in flight is running ({@link leaseRenewTask}) and await it before
86
+ * releasing the key: releasing against a cached revision a live renew has since moved is a CAS
87
+ * the broker correctly refuses, silently, forever. */
88
+ renewLeaseAttempt(): Promise<void>;
89
+ /** Print `what` only when the lease state CHANGES. The renew ticks every few seconds, so a long
90
+ * outage would otherwise print the same line thousands of times; an operator needs the line going
91
+ * in and the line coming out, with the instance and the space on both. */
92
+ private noteLease;
93
+ /** What the broker actually says about THIS instance's lease key, right now. `unknown` is a first-class
94
+ * answer and never collapses into `gone`: not being able to look is not the same fact as looking and
95
+ * finding nothing. */
96
+ private reconcileLease;
97
+ }
98
+ //# sourceMappingURL=lease-keeper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lease-keeper.d.ts","sourceRoot":"","sources":["../src/lease-keeper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAetE;;;;kEAIkE;AAClE,qBAAa,wBAAyB,SAAQ,KAAK;IAI/C,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,IAAI,EAAE,gBA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;2DAGuD;IACjD,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoDxC;;+EAE2E;IAC3E,OAAO,CAAC,SAAS;IAMjB;;2BAEuB;YACT,cAAc;CAkB7B"}
@@ -0,0 +1,257 @@
1
+ import { MANAGER_LEASE_TTL_MS, awaitLeaseExpiry, leaseRemainingMs, rejectionText } from "@cotal-ai/core";
2
+ import { probeLiveness } from "@cotal-ai/workspace";
3
+ /** How long a clean stop keeps trying to release its liveness lease when the broker does not answer
4
+ * (#3916). The client redials a lost broker every 2 s, so a connection dropped by an outage of up to
5
+ * about 3 s is back inside this budget. A longer outage is left to the row's TTL: the stop's other
6
+ * steps also wait on the broker, and the whole stop must still finish inside the 15 s a CLI stop
7
+ * waits before it sends SIGKILL. */
8
+ const LEASE_RELEASE_BUDGET_MS = 5_000;
9
+ /** The pause between lease release attempts that got no answer. An attempt that waits for its own
10
+ * deadline already spaces the retries; this only keeps one that fails at once, on a closed
11
+ * connection, from spinning. */
12
+ const LEASE_RELEASE_RETRY_MS = 250;
13
+ /** `start()`'s refusal when this manager instance's lease is held (#3915): by another live process
14
+ * on this workspace root, or by a holder on another root. A restart whose predecessor on this root
15
+ * is dead, this process's own earlier start included, waits the key out instead (#4092). The
16
+ * message is the operator copy; `held` and `sameRoot` are the data, so no caller parses it. A
17
+ * lease that could not be read or written is a plain `Error`. */
18
+ export class ManagerInstanceLeaseHeld extends Error {
19
+ instanceId;
20
+ space;
21
+ held;
22
+ sameRoot;
23
+ name = "ManagerInstanceLeaseHeld";
24
+ constructor(message, instanceId, space, held, sameRoot) {
25
+ super(message);
26
+ this.instanceId = instanceId;
27
+ this.space = space;
28
+ this.held = held;
29
+ this.sameRoot = sameRoot;
30
+ }
31
+ }
32
+ /** This manager instance's liveness lease key: acquire it at start, renew it on a timer, release it
33
+ * on a clean stop. */
34
+ export class LeaseKeeper {
35
+ deps;
36
+ leaseInfo;
37
+ leaseRevision;
38
+ leaseTimer;
39
+ /** What the last renew tick learned about this instance's key. Only a CHANGE of state is printed
40
+ * (see {@link noteLease}), so an outage of hours is one line going in and one line coming out. */
41
+ leaseState = "held";
42
+ /** A renew is in flight. The tick must not start a second one: both would read the same cached
43
+ * revision, so whichever lands second CASes against a sequence the first already moved. */
44
+ leaseRenewInFlight = false;
45
+ /** The promise a currently in-flight `renewLease()` is running, so `stop()` can await it before
46
+ * releasing the key instead of racing it: a renew that lands after the cached revision was read
47
+ * for release would otherwise move the row out from under a same-cached-revision CAS delete. */
48
+ leaseRenewTask;
49
+ constructor(deps) {
50
+ this.deps = deps;
51
+ }
52
+ get ep() { return this.deps.endpoint(); }
53
+ get managerInstanceId() { return this.deps.instanceId(); }
54
+ get space() { return this.deps.space(); }
55
+ get leaseStopping() { return this.deps.stopping(); }
56
+ /** Create THIS instance's lease key, waiting out a dead predecessor's row first (#4092).
57
+ *
58
+ * A manager SIGKILLed on this host cannot release its key, so a restart inside the key's TTL
59
+ * loses the create. When the row names this workspace root and a pid that is not running here
60
+ * (or is this process's own pid, which a live predecessor cannot hold), the holder is dead and
61
+ * the restart waits for the bucket TTL to remove the row, then creates again. It never writes
62
+ * over the row: a live holder renews it inside the TTL, and the wait then refuses on that write.
63
+ * Any other conflict refuses at once, as before. */
64
+ async acquireInstanceLease(info) {
65
+ const refuse = (held, e) => {
66
+ if (!held)
67
+ return new Error(`could not acquire the manager lease for space "${this.space}": ${rejectionText(e)}`);
68
+ const sameRoot = held.root === info.root;
69
+ return new ManagerInstanceLeaseHeld(`manager instance ${this.managerInstanceId} already serves space "${this.space}" from ${sameRoot ? "this" : "another"} workspace root (${held.runtime}, pid ${held.pid}, root ${held.root}) - stop it first before restarting the same instance`, this.managerInstanceId, this.space, held, sameRoot);
70
+ };
71
+ try {
72
+ return await this.ep.acquireManagerLease(info);
73
+ }
74
+ catch (e) {
75
+ // Our OWN instance id already holds a live key ⇒ refuse. Anything else (e.g. a KV/JS error) is a
76
+ // real failure to surface, not a silent "held" — keep the cause so it isn't misread as a conflict.
77
+ const held = await this.ep.readOwnManagerLease(this.managerInstanceId).catch(() => undefined);
78
+ if (!held || held.info.root !== info.root || (held.info.pid !== process.pid && probeLiveness(held.info.pid) !== "dead"))
79
+ throw refuse(held?.info, e);
80
+ console.error(`• manager instance ${this.managerInstanceId}: its lease is still held by pid ${held.info.pid}, which is not running on this host; ` +
81
+ `waiting ${Math.ceil(leaseRemainingMs(held.created, MANAGER_LEASE_TTL_MS) / 1000)}s for the lease to expire`);
82
+ const waited = await awaitLeaseExpiry({
83
+ read: async () => {
84
+ const row = await this.ep.readOwnManagerLease(this.managerInstanceId);
85
+ return row && { revision: row.revision, created: row.created };
86
+ },
87
+ revision: held.revision,
88
+ created: held.created,
89
+ ttlMs: MANAGER_LEASE_TTL_MS,
90
+ aborted: () => this.leaseStopping,
91
+ });
92
+ if (waited === "rewritten")
93
+ throw new Error(`manager instance ${this.managerInstanceId}: its lease was written again while waiting for pid ${held.info.pid}'s lease to expire, so a live process holds it - stop it first before restarting the same instance`);
94
+ if (waited !== "expired")
95
+ throw refuse(held.info, e);
96
+ try {
97
+ return await this.ep.acquireManagerLease(info);
98
+ }
99
+ catch (again) {
100
+ throw refuse((await this.ep.readOwnManagerLease(this.managerInstanceId).catch(() => undefined))?.info, again);
101
+ }
102
+ }
103
+ }
104
+ /** Release this instance's liveness lease key on a clean stop, at the broker's own revision
105
+ * rather than a cached one that a renew still in flight moments ago may have already moved past.
106
+ * Re-reads the row and releases only what is PROVABLY this process's (absent, or another pid's,
107
+ * is left alone — the same test {@link reconcileLease} uses).
108
+ *
109
+ * A read or delete that gets no answer, as during a reconnect, is tried again until the delete is
110
+ * acknowledged or {@link LEASE_RELEASE_BUDGET_MS} has passed (#3916). Nothing here throws: a stop
111
+ * must complete either way, and a row that could not be released is left for the bucket TTL, with
112
+ * one line of warning so the cost (a same-root restart waiting out the TTL) is not silent. */
113
+ async releaseOwnManagerLease() {
114
+ const deadline = Date.now() + LEASE_RELEASE_BUDGET_MS;
115
+ for (;;) {
116
+ let why;
117
+ try {
118
+ const own = await this.ep.readOwnManagerLease(this.managerInstanceId);
119
+ if (own === undefined || own.info.pid !== process.pid)
120
+ return;
121
+ await this.ep.releaseManagerLease(this.managerInstanceId, own.revision);
122
+ return;
123
+ }
124
+ catch (e) {
125
+ why = rejectionText(e);
126
+ }
127
+ if (Date.now() >= deadline) {
128
+ console.error(`! manager instance ${this.managerInstanceId} could not release its liveness lease (space "${this.space}"): ${why}; a same-root restart inside the bucket TTL will be refused`);
129
+ return;
130
+ }
131
+ await new Promise((r) => setTimeout(r, LEASE_RELEASE_RETRY_MS));
132
+ }
133
+ }
134
+ /** Keep this instance's liveness key fresh, and end the process only when another process holds it.
135
+ *
136
+ * A renew that throws is a question, not a verdict: the request may have timed out with the write
137
+ * landed and only its acknowledgement lost, the key may have expired during a stall, or a same-id
138
+ * process may hold it. The verdict comes from RE-READING the key ({@link reconcileLease}), and each
139
+ * answer has one response:
140
+ * - `held`: adopt the broker's revision and carry on.
141
+ * - `gone`: the key expired or was released while this process was still here, so put it back. The
142
+ * create is atomic, so a same-id process that got there first shows up as `taken` next tick.
143
+ * - `taken`: a different process holds this instance's key, so it took this instance over while
144
+ * this one stalled. This process is the superseded one and stops serving by exiting (SPEC 13.1).
145
+ * An open mesh has no barrier that would evict its serve connection, so nothing else stops it.
146
+ * - `unknown`: the broker could not be asked. Keep serving and ask again next tick, for as long as it
147
+ * takes. A manager that cannot reach its broker gains nothing by ending itself, and the seats it
148
+ * holds lose everything (a pty child dies with its parent).
149
+ *
150
+ * This replaces a fail-close that ended the process one tick past the lease TTL with no answer, which
151
+ * on a live mesh turned a ten-second broker or KV outage into a manager outage that lasted until an
152
+ * operator noticed. */
153
+ async renewLease() {
154
+ // A manager that is stopping never puts its own key back: a stop already fenced this loop, and
155
+ // any tick or explicit call landing after that must be a no-op, not a fresh acquire attempt.
156
+ if (this.leaseStopping)
157
+ return;
158
+ // A renew that runs long must not be overlapped by the next tick: both would CAS against the same
159
+ // cached revision, so whichever lands second is refused over a sequence the first legitimately
160
+ // moved, a conflict this instance manufactured itself.
161
+ if (this.leaseRenewInFlight)
162
+ return;
163
+ this.leaseRenewInFlight = true;
164
+ const task = this.renewLeaseAttempt();
165
+ this.leaseRenewTask = task;
166
+ return task;
167
+ }
168
+ /** The renew attempt itself, split out from {@link renewLease} only so `stop()` can hold the
169
+ * promise a renew already in flight is running ({@link leaseRenewTask}) and await it before
170
+ * releasing the key: releasing against a cached revision a live renew has since moved is a CAS
171
+ * the broker correctly refuses, silently, forever. */
172
+ async renewLeaseAttempt() {
173
+ try {
174
+ if (!this.leaseInfo || this.leaseRevision === undefined)
175
+ return;
176
+ try {
177
+ this.leaseRevision = await this.ep.renewManagerLease(this.leaseInfo, this.leaseRevision);
178
+ this.noteLease("held", `renews its liveness lease again (revision ${this.leaseRevision})`);
179
+ return;
180
+ }
181
+ catch (renewError) {
182
+ const why = rejectionText(renewError);
183
+ const verdict = await this.reconcileLease();
184
+ switch (verdict.kind) {
185
+ case "held":
186
+ // The re-read is the broker's truth about the revision: adopt it, whether our write landed
187
+ // with its acknowledgement lost (revision moved) or never landed (revision unchanged).
188
+ this.leaseRevision = verdict.revision;
189
+ this.noteLease("held-unrenewed", `could not renew its liveness lease (${why}) but the key is still its own at revision ${verdict.revision}; serving, retrying`);
190
+ return;
191
+ case "gone": {
192
+ // A stop that began while this renew was already in flight fences it here too: the
193
+ // await above can cross the point where `stop()` set the flag, and a re-acquire past
194
+ // that point would put a stopping process's key straight back.
195
+ if (this.leaseStopping)
196
+ return;
197
+ // The key being gone is a fact before the re-acquire is attempted, so a successful
198
+ // re-acquire is a change of state (gone to held) and prints, every time it happens.
199
+ const before = this.leaseState;
200
+ this.leaseState = "gone";
201
+ try {
202
+ this.leaseRevision = await this.ep.acquireManagerLease(this.leaseInfo);
203
+ this.noteLease("held", `found its liveness lease key gone (renew: ${why}) and re-acquired it at revision ${this.leaseRevision}`);
204
+ }
205
+ catch (e) {
206
+ this.leaseState = before;
207
+ this.noteLease("gone", `found its liveness lease key gone (renew: ${why}) and could not re-acquire it yet (${rejectionText(e)}); serving, retrying`);
208
+ }
209
+ return;
210
+ }
211
+ case "taken":
212
+ // No `stop()` on the way out: its deregistration deletes the instance's current
213
+ // registration, which is the other process's now. That process took over on the premise
214
+ // that this one was gone, so this exit leaves what a crash would, and seats a custodian or
215
+ // multiplexer owns outlive it the same way.
216
+ console.error(`! manager instance ${this.managerInstanceId} finds its liveness lease key held by ${verdict.by}, not by this process (renew: ${why}); that process serves this instance now, so this one stops serving and exits (space "${this.space}")`);
217
+ process.exit(1);
218
+ case "unknown":
219
+ this.noteLease("unknown", `could not renew its liveness lease (${why}) or re-read it (${verdict.why}); serving, retrying until the broker answers`);
220
+ return;
221
+ }
222
+ }
223
+ }
224
+ finally {
225
+ this.leaseRenewInFlight = false;
226
+ }
227
+ }
228
+ /** Print `what` only when the lease state CHANGES. The renew ticks every few seconds, so a long
229
+ * outage would otherwise print the same line thousands of times; an operator needs the line going
230
+ * in and the line coming out, with the instance and the space on both. */
231
+ noteLease(state, what) {
232
+ if (state === this.leaseState)
233
+ return;
234
+ this.leaseState = state;
235
+ console.error(`${state === "held" ? "✓" : "!"} manager instance ${this.managerInstanceId} ${what} (space "${this.space}")`);
236
+ }
237
+ /** What the broker actually says about THIS instance's lease key, right now. `unknown` is a first-class
238
+ * answer and never collapses into `gone`: not being able to look is not the same fact as looking and
239
+ * finding nothing. */
240
+ async reconcileLease() {
241
+ let current;
242
+ try {
243
+ current = await this.ep.readOwnManagerLease(this.managerInstanceId);
244
+ }
245
+ catch (e) {
246
+ return { kind: "unknown", why: rejectionText(e) };
247
+ }
248
+ if (current === undefined)
249
+ return { kind: "gone" };
250
+ // The pid is what distinguishes US from a same-id restart: the logical instance id and the serve
251
+ // identity both PERSIST across restart by design, so neither can tell the two processes apart.
252
+ if (current.info.pid !== process.pid)
253
+ return { kind: "taken", by: `pid ${current.info.pid} (${current.info.runtime}, root ${current.info.root})` };
254
+ return { kind: "held", revision: current.revision };
255
+ }
256
+ }
257
+ //# sourceMappingURL=lease-keeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lease-keeper.js","sourceRoot":"","sources":["../src/lease-keeper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;qCAIqC;AACrC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC;;iCAEiC;AACjC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC;;;;kEAIkE;AAClE,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAItC;IACA;IACA;IACA;IANO,IAAI,GAAG,0BAA0B,CAAC;IACpD,YACE,OAAe,EACN,UAAkB,EAClB,KAAa,EACb,IAAsB,EACtB,QAAiB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QALN,eAAU,GAAV,UAAU,CAAQ;QAClB,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAkB;QACtB,aAAQ,GAAR,QAAQ,CAAS;IAG5B,CAAC;CACF;AAaD;uBACuB;AACvB,MAAM,OAAO,WAAW;IAeO;IAd7B,SAAS,CAAmC;IAC5C,aAAa,CAAU;IACvB,UAAU,CAAkC;IAC5C;uGACmG;IAC3F,UAAU,GAAe,MAAM,CAAC;IACxC;gGAC4F;IACpF,kBAAkB,GAAG,KAAK,CAAC;IACnC;;qGAEiG;IACjG,cAAc,CAAiB;IAE/B,YAA6B,IAAqB;QAArB,SAAI,GAAJ,IAAI,CAAiB;IAAG,CAAC;IAEtD,IAAY,EAAE,KAAoB,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAChE,IAAY,iBAAiB,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC1E,IAAY,KAAK,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