@cotal-ai/core 0.169.0 → 0.170.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/agent-file.d.ts +9 -5
- package/dist/agent-file.d.ts.map +1 -1
- package/dist/agent-file.js +18 -8
- package/dist/agent-file.js.map +1 -1
- package/dist/anycast-requests.d.ts +8 -1
- package/dist/anycast-requests.d.ts.map +1 -1
- package/dist/anycast-requests.js +47 -0
- package/dist/anycast-requests.js.map +1 -1
- package/dist/backup-config.d.ts +5 -2
- package/dist/backup-config.d.ts.map +1 -1
- package/dist/backup-config.js +7 -2
- package/dist/backup-config.js.map +1 -1
- package/dist/backup.d.ts +6 -0
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +11 -4
- package/dist/backup.js.map +1 -1
- package/dist/endpoint-binding.d.ts.map +1 -1
- package/dist/endpoint-binding.js +2 -0
- package/dist/endpoint-binding.js.map +1 -1
- package/dist/endpoint-channel-discovery.d.ts +102 -0
- package/dist/endpoint-channel-discovery.d.ts.map +1 -0
- package/dist/endpoint-channel-discovery.js +170 -0
- package/dist/endpoint-channel-discovery.js.map +1 -0
- package/dist/endpoint-control-plane.d.ts +204 -0
- package/dist/endpoint-control-plane.d.ts.map +1 -0
- package/dist/endpoint-control-plane.js +627 -0
- package/dist/endpoint-control-plane.js.map +1 -0
- package/dist/endpoint-durable-backstop.d.ts +249 -0
- package/dist/endpoint-durable-backstop.d.ts.map +1 -0
- package/dist/endpoint-durable-backstop.js +485 -0
- package/dist/endpoint-durable-backstop.js.map +1 -0
- package/dist/endpoint-liveness.d.ts +105 -0
- package/dist/endpoint-liveness.d.ts.map +1 -0
- package/dist/endpoint-liveness.js +223 -0
- package/dist/endpoint-liveness.js.map +1 -0
- package/dist/endpoint-messaging.d.ts +229 -0
- package/dist/endpoint-messaging.d.ts.map +1 -0
- package/dist/endpoint-messaging.js +420 -0
- package/dist/endpoint-messaging.js.map +1 -0
- package/dist/endpoint-presence.d.ts +15 -0
- package/dist/endpoint-presence.d.ts.map +1 -1
- package/dist/endpoint-presence.js +35 -0
- package/dist/endpoint-presence.js.map +1 -1
- package/dist/endpoint-subscriptions.d.ts +199 -0
- package/dist/endpoint-subscriptions.d.ts.map +1 -0
- package/dist/endpoint-subscriptions.js +543 -0
- package/dist/endpoint-subscriptions.js.map +1 -0
- package/dist/endpoint.d.ts +32 -91
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +246 -1744
- package/dist/endpoint.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/provision-jwt.d.ts.map +1 -1
- package/dist/provision-jwt.js +1 -0
- package/dist/provision-jwt.js.map +1 -1
- package/dist/provision-permissions.d.ts +1 -1
- package/dist/provision-permissions.d.ts.map +1 -1
- package/dist/provision-permissions.js +3 -0
- package/dist/provision-permissions.js.map +1 -1
- package/dist/run-host.d.ts +4 -1
- package/dist/run-host.d.ts.map +1 -1
- package/dist/run-record.d.ts +4 -0
- package/dist/run-record.d.ts.map +1 -1
- package/dist/run-record.js +36 -0
- package/dist/run-record.js.map +1 -1
- package/dist/space-quiescence-resources.d.ts +30 -0
- package/dist/space-quiescence-resources.d.ts.map +1 -0
- package/dist/space-quiescence-resources.js +45 -0
- package/dist/space-quiescence-resources.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// The peer-readable liveness responder and probe of CotalEndpoint, as an internal component. Moved
|
|
2
|
+
// verbatim from endpoint.ts; the endpoint keeps the public methods and forwards to them. Not
|
|
3
|
+
// re-exported by the index.
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { AuthorizationError, PermissionViolationError, TimeoutError } from "@nats-io/transport-node";
|
|
6
|
+
import { parseLivenessAnswer, responderFromProbe, isLivenessPlane, LIVENESS_PLANES, } from "./liveness.js";
|
|
7
|
+
import { livenessServeFilter, livenessSubject } from "./subjects.js";
|
|
8
|
+
/** One endpoint's peer-readable liveness surface: the responder it binds per plane, re-bound on
|
|
9
|
+
* every connection, and the probe that grades another responder. Internal: `CotalEndpoint` keeps
|
|
10
|
+
* the public methods and forwards to it. */
|
|
11
|
+
export class EndpointLiveness {
|
|
12
|
+
deps;
|
|
13
|
+
constructor(deps) {
|
|
14
|
+
this.deps = deps;
|
|
15
|
+
}
|
|
16
|
+
get nc() { return this.deps.nc(); }
|
|
17
|
+
get space() { return this.deps.space(); }
|
|
18
|
+
get owner() { return this.deps.owner(); }
|
|
19
|
+
get actor() { return this.deps.actor(); }
|
|
20
|
+
get subs() { return this.deps.subs(); }
|
|
21
|
+
get livenessResponders() { return this.deps.livenessResponders(); }
|
|
22
|
+
notLiveMsg() { return this.deps.notLiveMsg(); }
|
|
23
|
+
requestBoundReply(nc, subject, body, reply, timeoutMs) { return this.deps.requestBoundReply(nc, subject, body, reply, timeoutMs); }
|
|
24
|
+
isNoResponders(e) { return this.deps.isNoResponders(e); }
|
|
25
|
+
emitRecoverable(err) { this.deps.emitRecoverable(err); }
|
|
26
|
+
emit(event, ...args) { return this.deps.emit(event, ...args); }
|
|
27
|
+
/** Bind this endpoint as the liveness RESPONDER for one plane, answering presence and nothing
|
|
28
|
+
* else to any credentialed peer that asks (`live.<plane>.<owner>.<actor>`).
|
|
29
|
+
*
|
|
30
|
+
* THE HANDLER IS THE PRIVACY BOUNDARY, and that is the entire reason this is a request/reply
|
|
31
|
+
* probe rather than a KV read grant. `readState` returns the responder's OWN verdict, derived
|
|
32
|
+
* from the lease it can already read; the LEASE ROW NEVER LEAVES THIS PROCESS. A peer therefore
|
|
33
|
+
* learns one enum about one plane and cannot learn the holder, the workspace root, the pid, the
|
|
34
|
+
* instance id, the runtime, or that any of those exist. Handing a peer the manager bucket instead
|
|
35
|
+
* would have handed it the operator's filesystem path and a pid to signal.
|
|
36
|
+
*
|
|
37
|
+
* `queue`-grouped by plane, so several manager instances in one space answer a probe ONCE rather
|
|
38
|
+
* than N times. A queue group is correct here and would be wrong on a roster-style surface: the
|
|
39
|
+
* question is "is ANY responder bound", which any one member can answer.
|
|
40
|
+
*
|
|
41
|
+
* THE ANSWER NAMES WHICH RESPONDER GAVE IT (`instance`), and that field exists because the queue
|
|
42
|
+
* group alone leaves a real ambiguity. Manager instances coexist per instance id by design, each
|
|
43
|
+
* member answers only about ITSELF, and the group delivers one probe to an arbitrary member. So
|
|
44
|
+
* when two instances hold opposite verdicts, identical probes alternate between them, and without
|
|
45
|
+
* a discriminator the two answers are indistinguishable from one instance changing state. With
|
|
46
|
+
* the field, a caller that probes more than once can see that two DIFFERENT responders answered
|
|
47
|
+
* and that the verdicts disagree. The field is the responder's own endpoint-scoped instance
|
|
48
|
+
* token, never the lease row's `instanceId`, its holder, its pid or its root: see
|
|
49
|
+
* {@link LivenessAnswer} for why none of those may cross the wire.
|
|
50
|
+
*
|
|
51
|
+
* ONE PROBE STILL SAMPLES ONE MEMBER. This does not aggregate N instances, and a single probe
|
|
52
|
+
* cannot report a split; it makes the split OBSERVABLE to a caller that asks again, where before
|
|
53
|
+
* it was not observable at all.
|
|
54
|
+
*
|
|
55
|
+
* BOUNDED REPLY, for the same confused-deputy reason `serveControl` documents: this responder
|
|
56
|
+
* holds a wildcard publish grant over `live.<plane>.*.*.reply.>`, so without the bound check an
|
|
57
|
+
* authenticated caller could name a PEER's reply lane as its reply target and have us publish
|
|
58
|
+
* into it. The broker does not permission-check a requester's embedded reply subject; we do.
|
|
59
|
+
*
|
|
60
|
+
* A HANDLER THAT THROWS ANSWERS `unknown`, never silence and never health. Silence would reach
|
|
61
|
+
* the prober as a timeout, which it correctly grades `unknown` anyway — but only after burning
|
|
62
|
+
* the full deadline, and an operator staring at a hung probe learns less than one told plainly
|
|
63
|
+
* that the axis could not be checked.
|
|
64
|
+
*
|
|
65
|
+
* THE BINDING IS KEPT AS INTENT and re-bound on every (re)connect, so a reconnect does not leave
|
|
66
|
+
* the plane answered by the broker's no-responders status while this endpoint is serving. A second
|
|
67
|
+
* call for the same plane replaces the first. */
|
|
68
|
+
serveLiveness(plane, readState) {
|
|
69
|
+
if (!this.nc)
|
|
70
|
+
throw new Error(this.notLiveMsg());
|
|
71
|
+
const held = this.livenessResponders.get(plane);
|
|
72
|
+
if (held)
|
|
73
|
+
held.readState = readState;
|
|
74
|
+
else
|
|
75
|
+
this.livenessResponders.set(plane, { readState });
|
|
76
|
+
this.bindLiveness(plane);
|
|
77
|
+
}
|
|
78
|
+
/** (Re)bind one plane's liveness responder on the CURRENT connection, dropping the stale sub first
|
|
79
|
+
* as {@link armDeliveryControl} does. */
|
|
80
|
+
bindLiveness(plane) {
|
|
81
|
+
const held = this.livenessResponders.get(plane);
|
|
82
|
+
if (!held || !this.nc)
|
|
83
|
+
return;
|
|
84
|
+
if (held.sub) {
|
|
85
|
+
try {
|
|
86
|
+
held.sub.unsubscribe();
|
|
87
|
+
}
|
|
88
|
+
catch { /* dead with the old connection */ }
|
|
89
|
+
const i = this.subs.indexOf(held.sub);
|
|
90
|
+
if (i >= 0)
|
|
91
|
+
this.subs.splice(i, 1);
|
|
92
|
+
}
|
|
93
|
+
const { readState } = held;
|
|
94
|
+
const sub = this.nc.subscribe(livenessServeFilter(this.space, plane), { queue: `live.${plane}` });
|
|
95
|
+
held.sub = sub;
|
|
96
|
+
this.subs.push(sub);
|
|
97
|
+
// The responder token this bind answers under: AN OPAQUE VALUE MINTED HERE, and deliberately
|
|
98
|
+
// not any name this process already has. It is what makes "which responder answered" askable
|
|
99
|
+
// without making "who is this responder" answerable — the two properties the surface has to
|
|
100
|
+
// hold at once. The endpoint's own `card.id` would be its principal, the lease row's
|
|
101
|
+
// `instanceId` is a field of a bucket an agent holds no grant on, and either would turn a
|
|
102
|
+
// presence probe into an identity read for every credentialed peer in the space. A fresh
|
|
103
|
+
// random token correlates with nothing but this plane's other answers, which is the whole job:
|
|
104
|
+
// two answers carrying two different tokens came from two different responders.
|
|
105
|
+
//
|
|
106
|
+
// Per BIND rather than per process, so a responder that goes away and comes back answers under
|
|
107
|
+
// a new token. That is the honest reading: a caller comparing answers across a restart is
|
|
108
|
+
// comparing two different incarnations, and a token that survived the restart would say
|
|
109
|
+
// otherwise. A re-bind after a reconnect is such a return: the plane had no responder here for
|
|
110
|
+
// the gap.
|
|
111
|
+
const instance = randomUUID();
|
|
112
|
+
void (async () => {
|
|
113
|
+
for await (const m of sub) {
|
|
114
|
+
// Sender-bound reply guard. Drop silently rather than publishing somewhere else: a reply
|
|
115
|
+
// aimed outside the sender's own subtree is not a request we can answer safely.
|
|
116
|
+
//
|
|
117
|
+
// REPORTED ON `warning`, NOT ON `error`, AND THAT IS A SAFETY PROPERTY RATHER THAN A CHOICE
|
|
118
|
+
// OF CHANNEL. A rejected probe is a condition this responder is already surviving: it drops
|
|
119
|
+
// the frame and keeps serving. `error` cannot carry such a notice on this class, because
|
|
120
|
+
// Node's `EventEmitter` RETHROWS an `error` emit that has no listener attached, so the
|
|
121
|
+
// notice would end the process of any embedder that had not attached one — and the plane
|
|
122
|
+
// would then genuinely be unbound, which a peer's next probe reports as `unbound`. The
|
|
123
|
+
// condition would have manufactured the state it described. `warning` is observable and
|
|
124
|
+
// never fatal without a listener (see {@link emitRecoverable} and #891, where retry notices
|
|
125
|
+
// on `error` killed hosts the endpoint intended to keep running).
|
|
126
|
+
//
|
|
127
|
+
// Since ANY credentialed peer may publish a probe, and the reply target inside it is chosen
|
|
128
|
+
// by that peer and not permission-checked by the broker, reaching this branch is a peer's
|
|
129
|
+
// decision, not an operator's. Safety here must therefore hold with no listener attached,
|
|
130
|
+
// which is what CELL F1 runs.
|
|
131
|
+
if (!m.reply || !m.reply.startsWith(`${m.subject}.reply.`)) {
|
|
132
|
+
this.emitRecoverable(new Error(`rejected liveness probe on ${m.subject}: reply target "${m.reply ?? "(none)"}" is not under the sender's own reply subtree`));
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
let responder;
|
|
136
|
+
try {
|
|
137
|
+
responder = await readState();
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
responder = "unknown";
|
|
141
|
+
}
|
|
142
|
+
const answer = { plane, responder, instance };
|
|
143
|
+
try {
|
|
144
|
+
m.respond(JSON.stringify(answer));
|
|
145
|
+
}
|
|
146
|
+
catch { /* the requester is gone */ }
|
|
147
|
+
}
|
|
148
|
+
// The loop itself ends only on a SUBSCRIPTION-level fault (the connection went away), which
|
|
149
|
+
// is not something a peer's probe can cause: the guard above `continue`s, `readState` is
|
|
150
|
+
// caught, and the respond is caught. So this arm stays on `error` — it reports that this
|
|
151
|
+
// responder has stopped answering at all, which is a fault an embedder should not be able to
|
|
152
|
+
// miss, and no credentialed peer can reach it.
|
|
153
|
+
})().catch((e) => this.emit("error", e));
|
|
154
|
+
}
|
|
155
|
+
/** Ask whether a responder is bound for `plane`, as a credentialed peer that need not own it.
|
|
156
|
+
*
|
|
157
|
+
* EVERY WAY THIS CAN END IS CLASSIFIED, and the classification lives in ONE place
|
|
158
|
+
* ({@link responderFromProbe}) so no call site can invent its own mapping. Only the broker's own
|
|
159
|
+
* no-responders 503 becomes `unbound`. A timeout, a permission refusal, a transport failure and
|
|
160
|
+
* an unreadable reply ALL become `unknown`, because each is a failure to find out, and this
|
|
161
|
+
* issue exists because failures to find out were being reported as findings.
|
|
162
|
+
*
|
|
163
|
+
* `noMux` with a named reply subject is required rather than stylistic: the muxed inbox would
|
|
164
|
+
* swallow the 503 into an ordinary timeout, and the 503 is the only outcome that carries a
|
|
165
|
+
* positive verdict. Collapsing it would leave a probe that can say `bound` or `unknown` and
|
|
166
|
+
* never `unbound` — an instrument that cannot report the failure it was built to report.
|
|
167
|
+
*
|
|
168
|
+
* The reply rides `<request>.reply.<uuid>`, the sender's own subtree, so the responder's bound
|
|
169
|
+
* reply guard accepts it and the responder needs no broad inbox-publish grant to answer. */
|
|
170
|
+
async probeLiveness(plane, timeoutMs = 2_000) {
|
|
171
|
+
if (!isLivenessPlane(plane))
|
|
172
|
+
// A closed set, refused loudly. Answering an unknown plane at all would make this a probe
|
|
173
|
+
// that returns something for every input, which is indistinguishable from one that is not
|
|
174
|
+
// measuring anything.
|
|
175
|
+
throw new Error(`liveness: "${plane}" is not a plane this surface answers for (${[...LIVENESS_PLANES].join(", ")})`);
|
|
176
|
+
if (!this.nc)
|
|
177
|
+
throw new Error(this.notLiveMsg());
|
|
178
|
+
const reqSubject = livenessSubject(this.space, plane, this.owner, this.actor);
|
|
179
|
+
const reply = `${reqSubject}.reply.${randomUUID()}`;
|
|
180
|
+
let outcome;
|
|
181
|
+
let answered;
|
|
182
|
+
let instance;
|
|
183
|
+
try {
|
|
184
|
+
const m = await this.requestBoundReply(this.nc, reqSubject, "", reply, timeoutMs);
|
|
185
|
+
let body;
|
|
186
|
+
try {
|
|
187
|
+
body = m.json();
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
body = undefined;
|
|
191
|
+
}
|
|
192
|
+
const parsed = parseLivenessAnswer(body, plane);
|
|
193
|
+
// A reply we cannot read is `malformed`, which grades `unknown`. It is NOT promoted to
|
|
194
|
+
// `bound` on the strength of having replied at all: that promotion is the `pgrep` error,
|
|
195
|
+
// where evidence a process exists was read as evidence it works.
|
|
196
|
+
outcome = parsed ? "replied" : "malformed";
|
|
197
|
+
answered = parsed?.responder;
|
|
198
|
+
instance = parsed?.instance;
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
outcome = this.isNoResponders(e) ? "noResponders" : this.probeFailureOutcome(e);
|
|
202
|
+
}
|
|
203
|
+
// `instance` rides ONLY a reply that was read. Every other outcome means no responder answered,
|
|
204
|
+
// so there is no responder to name, and a token attached to an `unbound` or an `unknown` would
|
|
205
|
+
// claim one had. It stays absent on those arms by construction: nothing assigns it.
|
|
206
|
+
const verdict = { plane, responder: responderFromProbe(outcome, answered) };
|
|
207
|
+
return instance === undefined ? verdict : { ...verdict, instance };
|
|
208
|
+
}
|
|
209
|
+
/** Grade a failed probe that was NOT a no-responders answer. Both arms return an outcome that
|
|
210
|
+
* maps to `unknown`; they are told apart so the distinction stays legible at the call site and so
|
|
211
|
+
* a future caller can render the two differently (a refusal is about YOUR credential, a timeout
|
|
212
|
+
* is about something being wedged). Neither may ever mean health. */
|
|
213
|
+
probeFailureOutcome(e) {
|
|
214
|
+
if (e instanceof AuthorizationError || e instanceof PermissionViolationError)
|
|
215
|
+
return "refused";
|
|
216
|
+
if (e instanceof TimeoutError)
|
|
217
|
+
return "timeout";
|
|
218
|
+
// Anything else is a transport or client failure: it says something about our link, not about
|
|
219
|
+
// the plane, so it is graded like a refusal rather than guessed at.
|
|
220
|
+
return "refused";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=endpoint-liveness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-liveness.js","sourceRoot":"","sources":["../src/endpoint-liveness.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,6FAA6F;AAC7F,4BAA4B;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,YAAY,EAAoD,MAAM,yBAAyB,CAAC;AACvJ,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAKhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAkBrE;;6CAE6C;AAC7C,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,IAAY,EAAE,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3C,IAAY,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACjD,IAAY,KAAK,KAAK,OAAO,IAAI,CAAC,IAAI,C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F,iEAAiE;YACjE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;YAC3C,QAAQ,GAAG,MAAM,EAAE,SAAS,CAAC;YAC7B,QAAQ,GAAG,MAAM,EAAE,QAAQ,CAAC;QAC9B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAClF,CAAC;QACD,gGAAgG;QAChG,+FAA+F;QAC/F,oFAAoF;QACpF,MAAM,OAAO,GAAmB,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5F,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC;IACrE,CAAC;IAED;;;0EAGsE;IAC9D,mBAAmB,CAAC,CAAU;QACpC,IAAI,CAAC,YAAY,kBAAkB,IAAI,CAAC,YAAY,wBAAwB;YAAE,OAAO,SAAS,CAAC;QAC/F,IAAI,CAAC,YAAY,YAAY;YAAE,OAAO,SAAS,CAAC;QAChD,8FAA8F;QAC9F,oEAAoE;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { type NatsConnection } from "@nats-io/transport-node";
|
|
2
|
+
import { type JetStreamClient, type JetStreamManager } from "@nats-io/jetstream";
|
|
3
|
+
import type { CotalMessage, EndpointRef, HistoryMessage, Part } from "./types.js";
|
|
4
|
+
/** What the messaging component reads from its endpoint. State is read when it is used, never
|
|
5
|
+
* copied, and every method is looked up on the endpoint at call time. */
|
|
6
|
+
export interface EndpointMessagingDeps {
|
|
7
|
+
nc: () => NatsConnection | undefined;
|
|
8
|
+
js: () => JetStreamClient | undefined;
|
|
9
|
+
jsm: () => JetStreamManager | undefined;
|
|
10
|
+
space: () => string;
|
|
11
|
+
owner: () => string;
|
|
12
|
+
actor: () => string;
|
|
13
|
+
channels: () => string[];
|
|
14
|
+
notLiveMsg: () => string;
|
|
15
|
+
ref: () => EndpointRef;
|
|
16
|
+
publishMsg: (subject: string, msg: CotalMessage) => Promise<void>;
|
|
17
|
+
streamHistory: (stream: string, subjects: string[], limit: number, before?: number, signal?: AbortSignal) => Promise<{
|
|
18
|
+
seq: number;
|
|
19
|
+
subject: string;
|
|
20
|
+
msg: HistoryMessage;
|
|
21
|
+
}[]>;
|
|
22
|
+
emitRecoverable: (err: Error) => void;
|
|
23
|
+
}
|
|
24
|
+
/** The messaging verbs of one endpoint: multicast (plain and serialized), unicast, anycast, and the
|
|
25
|
+
* event-payload channel. Internal: `CotalEndpoint` keeps the public methods and forwards to it. */
|
|
26
|
+
export declare class EndpointMessaging {
|
|
27
|
+
private readonly deps;
|
|
28
|
+
constructor(deps: EndpointMessagingDeps);
|
|
29
|
+
private get nc();
|
|
30
|
+
private get js();
|
|
31
|
+
private get jsm();
|
|
32
|
+
private get space();
|
|
33
|
+
private get owner();
|
|
34
|
+
private get actor();
|
|
35
|
+
private get channels();
|
|
36
|
+
private notLiveMsg;
|
|
37
|
+
private ref;
|
|
38
|
+
private publishMsg;
|
|
39
|
+
private streamHistory;
|
|
40
|
+
private emitRecoverable;
|
|
41
|
+
/** Multicast: broadcast to everyone on a channel. */
|
|
42
|
+
multicast(text: string, opts?: {
|
|
43
|
+
channel?: string;
|
|
44
|
+
parts?: Part[];
|
|
45
|
+
replyTo?: string;
|
|
46
|
+
contextId?: string;
|
|
47
|
+
mentions?: string[];
|
|
48
|
+
}): Promise<CotalMessage>;
|
|
49
|
+
/** The broker's live `max_payload` — the CEILING a frame is measured against, not a budget for a
|
|
50
|
+
* caller's own payload.
|
|
51
|
+
*
|
|
52
|
+
* Exposed because the connection is private and callers outside core (a connector assembling a
|
|
53
|
+
* batched payload) otherwise have no way to learn the ceiling except by failing a publish.
|
|
54
|
+
* Throws rather than guessing a default: a wrong ceiling is worse than none, because it splits
|
|
55
|
+
* either too eagerly or too late and both look like working code.
|
|
56
|
+
*
|
|
57
|
+
* THIS ALONE CANNOT SIZE A MESSAGE. The envelope this endpoint adds after the publish call, and
|
|
58
|
+
* the client's own headers, are charged against the same ceiling and the caller never sees them.
|
|
59
|
+
* Use {@link encodedSize}, which measures what will actually be sent. */
|
|
60
|
+
get maxPayload(): number;
|
|
61
|
+
/**
|
|
62
|
+
* Verify the PRECONDITION {@link multicastExpecting} depends on: that the chat stream evaluates
|
|
63
|
+
* the subject expectation BEFORE the `Nats-Msg-Id` dedup cache. **Throws if it cannot be
|
|
64
|
+
* guaranteed.** Call before the first serialized append on a given endpoint.
|
|
65
|
+
*
|
|
66
|
+
* **The ordering follows the stream's REPLICATION FACTOR, not the deployment.** A standalone R1
|
|
67
|
+
* stream and an R1 stream inside a real 3-node cluster both refuse a stale expectation with a CAS
|
|
68
|
+
* error; only an R3 stream evaluates dedup first and answers a retry with `duplicate: true`. A
|
|
69
|
+
* check written against cluster size would pass on exactly the deployment that breaks.
|
|
70
|
+
*
|
|
71
|
+
* Every stream Cotal creates is `num_replicas: 1`, from the same canonical config the restore path
|
|
72
|
+
* uses, so the property holds by construction today. This exists because "by construction" is an
|
|
73
|
+
* observation until something checks it: nothing in the wire contract reserves the replica factor.
|
|
74
|
+
* A caller appending under a stale assumption does not fail loudly; it accepts a retry as success
|
|
75
|
+
* and drops a message.
|
|
76
|
+
*
|
|
77
|
+
* Evidence is `smoke:cas-preflight-cluster`, which records the server version it measured against
|
|
78
|
+
* rather than naming one here — the suites resolve `nats-server` from `PATH`, so a hardcoded
|
|
79
|
+
* provenance ages into a claim about a machine that no longer exists.
|
|
80
|
+
*
|
|
81
|
+
* @throws if the stream is unreadable (no `STREAM.INFO` grant, or absent) or reports more than
|
|
82
|
+
* one replica. Never degrades to a warning: the failure it prevents is silent.
|
|
83
|
+
*/
|
|
84
|
+
assertExpectationSemantics(): Promise<void>;
|
|
85
|
+
/** The envelope {@link multicastExpecting} publishes, built in ONE place so that a frame and any
|
|
86
|
+
* measurement of that frame cannot describe different messages. The fields this adds — `ts`,
|
|
87
|
+
* `space`, `from`, `channel` and the normalized `mentions` — are exactly the ones a caller
|
|
88
|
+
* holding only its parts cannot account for. */
|
|
89
|
+
private casEnvelope;
|
|
90
|
+
/**
|
|
91
|
+
* The bytes this frame will ACTUALLY put on the wire, to compare against {@link maxPayload}.
|
|
92
|
+
*
|
|
93
|
+
* Caller-side arithmetic is wrong in the dangerous direction: a split sized against the caller's
|
|
94
|
+
* own payload produces a frame the broker REJECTS, and a rejected truncation makes the loss silent
|
|
95
|
+
* again — the failure splitting exists to prevent.
|
|
96
|
+
*
|
|
97
|
+
* It lives on the surface that BUILDS the envelope so measurement and construction cannot drift
|
|
98
|
+
* apart unnoticed: it shares {@link casEnvelope} with the publish path, sets the same two headers,
|
|
99
|
+
* and lets the client's own encoder encode them rather than re-implementing the wire format.
|
|
100
|
+
* `frame-size.smoke.ts` binary-searches a real broker's ceiling and requires this number to land
|
|
101
|
+
* on it exactly.
|
|
102
|
+
*
|
|
103
|
+
* `expectedLastSubjectSeq` is a parameter because it is a header VALUE: sizing at 0 and publishing
|
|
104
|
+
* at 123456 differ by five bytes.
|
|
105
|
+
* `expectedLastMsgId` is measured when given, so a caller that may send it can size for it.
|
|
106
|
+
*
|
|
107
|
+
* Residual: `ts` is re-stamped at publish, so the two differ in value — not in length until
|
|
108
|
+
* epoch-millis needs a 14th digit.
|
|
109
|
+
*/
|
|
110
|
+
encodedSize(opts: {
|
|
111
|
+
channel: string;
|
|
112
|
+
parts: Part[];
|
|
113
|
+
id: string;
|
|
114
|
+
expectedLastSubjectSeq: number;
|
|
115
|
+
expectedLastMsgId?: string;
|
|
116
|
+
mentions?: string[];
|
|
117
|
+
replyTo?: string;
|
|
118
|
+
contextId?: string;
|
|
119
|
+
}): number;
|
|
120
|
+
/**
|
|
121
|
+
* Multicast with an OPTIMISTIC-CONCURRENCY expectation and a caller-chosen dedup id, returning
|
|
122
|
+
* the `PubAck` fields instead of discarding them. The serialized-append primitive: two writers
|
|
123
|
+
* racing one subject cannot interleave, because the loser's expectation no longer holds.
|
|
124
|
+
*
|
|
125
|
+
* **Why a separate method rather than options on {@link multicast}.** `multicast` mints a fresh
|
|
126
|
+
* `id` per call and drops the ack; both are right for ordinary chat and both are fatal to a
|
|
127
|
+
* caller that must retry an append idempotently. Keeping them apart means no existing caller
|
|
128
|
+
* changes behaviour, and the stricter validation below applies only where a caller opted in.
|
|
129
|
+
*
|
|
130
|
+
* - `id` becomes the JetStream `Nats-Msg-Id`, so the SAME id may be republished on retry and the
|
|
131
|
+
* server dedups it within the stream's duplicate window. It is validated rather than trusted:
|
|
132
|
+
* it lands in a wire header, and the dedup cache is **stream-wide**, so a caller-supplied id is
|
|
133
|
+
* both an injection surface and a way to suppress another publisher's message.
|
|
134
|
+
* - `expectedLastSubjectSeq` is the sequence this publisher believes is the subject's tip; `0`
|
|
135
|
+
* means "the subject must be empty". A mismatch throws, and the throw stays classifiable by the
|
|
136
|
+
* already-public {@link isCasLoss} — the error is deliberately **not wrapped**, since wrapping
|
|
137
|
+
* would hide the `err_code` that classification reads.
|
|
138
|
+
* - `expectedLastMsgId`, when given, becomes `Nats-Expected-Last-Msg-Id`. The broker checks it after
|
|
139
|
+
* its dedup cache, so a fresh value nobody has published turns a publish into a probe: an id the
|
|
140
|
+
* cache holds answers `duplicate: true` with the stored sequence, and any other id is refused
|
|
141
|
+
* with error 10070 before anything is stored.
|
|
142
|
+
*
|
|
143
|
+
* @throws if the endpoint is not live, the channel is not concrete, `id` is malformed, `parts` is
|
|
144
|
+
* empty, or `expectedLastSubjectSeq` is not a non-negative safe integer.
|
|
145
|
+
*/
|
|
146
|
+
multicastExpecting(opts: {
|
|
147
|
+
channel: string;
|
|
148
|
+
parts: Part[];
|
|
149
|
+
id: string;
|
|
150
|
+
expectedLastSubjectSeq: number;
|
|
151
|
+
expectedLastMsgId?: string;
|
|
152
|
+
mentions?: string[];
|
|
153
|
+
replyTo?: string;
|
|
154
|
+
contextId?: string;
|
|
155
|
+
}): Promise<{
|
|
156
|
+
message: CotalMessage;
|
|
157
|
+
ack: {
|
|
158
|
+
seq: number;
|
|
159
|
+
duplicate: boolean;
|
|
160
|
+
};
|
|
161
|
+
}>;
|
|
162
|
+
/** Publish a payload frame on this principal's forge-locked sibling event rail. */
|
|
163
|
+
publishEventPayload(opts: {
|
|
164
|
+
parts: Part[];
|
|
165
|
+
id: string;
|
|
166
|
+
expectedLastSubjectSeq: number;
|
|
167
|
+
}): Promise<{
|
|
168
|
+
ack: {
|
|
169
|
+
seq: number;
|
|
170
|
+
duplicate: boolean;
|
|
171
|
+
};
|
|
172
|
+
}>;
|
|
173
|
+
/** Read payload history through a single native-filtered consumer, never through CHAT. */
|
|
174
|
+
eventPayloadHistory(owner: string, actor: string, opts?: {
|
|
175
|
+
limit?: number;
|
|
176
|
+
signal?: AbortSignal;
|
|
177
|
+
}): Promise<HistoryMessage[]>;
|
|
178
|
+
/** Verify the sibling stream and learn its actual message ceiling. A pre-upgrade space without
|
|
179
|
+
* the stream or its info-read permission returns null and emits a warning. Other authorization,
|
|
180
|
+
* transport and config errors throw. */
|
|
181
|
+
eventPayloadLimit(): Promise<number | null>;
|
|
182
|
+
/** Unicast: direct message to one specific instance. */
|
|
183
|
+
unicast(instanceId: string, text: string, opts?: {
|
|
184
|
+
parts?: Part[];
|
|
185
|
+
replyTo?: string;
|
|
186
|
+
contextId?: string;
|
|
187
|
+
}): Promise<CotalMessage>;
|
|
188
|
+
/** Unicast, returning the JetStream publish ack alongside the message: the only truthful proof
|
|
189
|
+
* a sender has is that the broker stored the message at a sequence, never that anyone read it. */
|
|
190
|
+
unicastAttributed(instanceId: string, text: string, opts?: {
|
|
191
|
+
parts?: Part[];
|
|
192
|
+
replyTo?: string;
|
|
193
|
+
contextId?: string;
|
|
194
|
+
}): Promise<{
|
|
195
|
+
msg: CotalMessage;
|
|
196
|
+
ack: {
|
|
197
|
+
seq: number;
|
|
198
|
+
duplicate: boolean;
|
|
199
|
+
};
|
|
200
|
+
}>;
|
|
201
|
+
/** Anycast: deliver to ANY one instance of a service (role) — queue-group load balancing. */
|
|
202
|
+
anycast(service: string, text: string, opts?: {
|
|
203
|
+
parts?: Part[];
|
|
204
|
+
replyTo?: string;
|
|
205
|
+
contextId?: string;
|
|
206
|
+
}): Promise<CotalMessage>;
|
|
207
|
+
/** Anycast, returning the JetStream publish ack alongside the message: the broker stored the
|
|
208
|
+
* request on the role's work queue at a sequence, which proves neither a holder nor a read. */
|
|
209
|
+
anycastAttributed(service: string, text: string, opts?: {
|
|
210
|
+
parts?: Part[];
|
|
211
|
+
replyTo?: string;
|
|
212
|
+
contextId?: string;
|
|
213
|
+
}): Promise<{
|
|
214
|
+
msg: CotalMessage;
|
|
215
|
+
ack: {
|
|
216
|
+
seq: number;
|
|
217
|
+
duplicate: boolean;
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
220
|
+
}
|
|
221
|
+
/** Refuse, at publish, a `data` part `JSON.stringify` would silently rewrite. The guard is the
|
|
222
|
+
* runtime half of `Part`'s `data: JsonValue` arm: with it, a non-JSON value at any depth never
|
|
223
|
+
* reaches the wire, so every reader (live core-sub, Plane-3 durable, history) gives one answer —
|
|
224
|
+
* the message was never sent — instead of the old split where history returned a rewritten row
|
|
225
|
+
* while Plane-3 terminated a keyless one as malformed. The error names the path to the offending
|
|
226
|
+
* value (e.g. `data[2].at`), so a caller learns which member to fix rather than that stringify
|
|
227
|
+
* would have mangled something. Throws rather than coercing: no fallback. */
|
|
228
|
+
export declare function assertPartsSerializable(parts: readonly Part[]): void;
|
|
229
|
+
//# sourceMappingURL=endpoint-messaging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-messaging.d.ts","sourceRoot":"","sources":["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