@cotal-ai/core 0.171.3 → 0.171.5
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/control-exchange.d.ts.map +1 -1
- package/dist/control-exchange.js +3 -4
- package/dist/control-exchange.js.map +1 -1
- package/dist/endpoint-anycast.d.ts +110 -0
- package/dist/endpoint-anycast.d.ts.map +1 -0
- package/dist/endpoint-anycast.js +316 -0
- package/dist/endpoint-anycast.js.map +1 -0
- package/dist/endpoint-connection.d.ts +363 -0
- package/dist/endpoint-connection.d.ts.map +1 -0
- package/dist/endpoint-connection.js +741 -0
- package/dist/endpoint-connection.js.map +1 -0
- package/dist/endpoint-consumers.d.ts +147 -0
- package/dist/endpoint-consumers.d.ts.map +1 -0
- package/dist/endpoint-consumers.js +459 -0
- package/dist/endpoint-consumers.js.map +1 -0
- package/dist/endpoint-dial.d.ts +3 -1
- package/dist/endpoint-dial.d.ts.map +1 -1
- package/dist/endpoint-dial.js +5 -2
- package/dist/endpoint-dial.js.map +1 -1
- package/dist/endpoint-durable.d.ts +82 -0
- package/dist/endpoint-durable.d.ts.map +1 -0
- package/dist/endpoint-durable.js +164 -0
- package/dist/endpoint-durable.js.map +1 -0
- package/dist/endpoint-principal-serve.d.ts +110 -0
- package/dist/endpoint-principal-serve.d.ts.map +1 -0
- package/dist/endpoint-principal-serve.js +233 -0
- package/dist/endpoint-principal-serve.js.map +1 -0
- package/dist/endpoint-reconnect.d.ts +129 -0
- package/dist/endpoint-reconnect.d.ts.map +1 -0
- package/dist/endpoint-reconnect.js +166 -0
- package/dist/endpoint-reconnect.js.map +1 -0
- package/dist/endpoint.d.ts +44 -241
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +403 -1740
- package/dist/endpoint.js.map +1 -1
- package/dist/launch-artifacts.d.ts.map +1 -1
- package/dist/launch-artifacts.js +17 -9
- package/dist/launch-artifacts.js.map +1 -1
- package/dist/websocket-dial.d.ts +9 -0
- package/dist/websocket-dial.d.ts.map +1 -0
- package/dist/websocket-dial.js +121 -0
- package/dist/websocket-dial.js.map +1 -0
- package/package.json +1 -1
package/dist/endpoint.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
146
146
|
* reported itself connected again. */
|
|
147
147
|
private readonly taps;
|
|
148
148
|
/** The liveness responders {@link serveLiveness} was asked for, by plane. This is INTENT, re-bound
|
|
149
|
-
* by {@link bindLiveness} on every (re)connect: a rebuild closes the old connection and every
|
|
149
|
+
* by {@link EndpointLiveness.bindLiveness} on every (re)connect: a rebuild closes the old connection and every
|
|
150
150
|
* subscription on it, so a responder bound once would leave its plane to the broker's
|
|
151
151
|
* no-responders answer, which a peer grades `unbound`, while this endpoint is connected and serving. */
|
|
152
152
|
private readonly livenessResponders;
|
|
@@ -173,7 +173,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
173
173
|
* so this in-memory mirror is kept, not rebuilt. Cleared only on full stop. */
|
|
174
174
|
private readonly plane3Channels;
|
|
175
175
|
/** Channels whose live sub was REFUSED while they held a Plane-3 durable membership, whose §7
|
|
176
|
-
* tombstone has not yet confirmed (channel → join generation). {@link closeRefusedMembership} retries
|
|
176
|
+
* tombstone has not yet confirmed (channel → join generation). {@link EndpointDurable.closeRefusedMembership} retries
|
|
177
177
|
* the tombstone until it lands; until then this is a `durable-unclosed` state surfaced via
|
|
178
178
|
* {@link pendingDurableLeaves} (the connector shows it in `cotal_channels`, never as ordinary
|
|
179
179
|
* absence). Persists across reconnect; cleared on tombstone success or full stop. */
|
|
@@ -186,7 +186,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
186
186
|
private readonly pendingBootJoins;
|
|
187
187
|
/** The refusals a channel's live subscription callback received. nats.js hands a subscription
|
|
188
188
|
* refusal to the refused subscription's callback and then dispatches that same instance on the
|
|
189
|
-
* connection status, so the callback owns it (see {@link subscribeChat}) and watchStatus skips it. */
|
|
189
|
+
* connection status, so the callback owns it (see {@link EndpointConsumers.subscribeChat}) and watchStatus skips it. */
|
|
190
190
|
private readonly chatSubRefusals;
|
|
191
191
|
/** Service iterators and connection status can receive the same subscription denial. */
|
|
192
192
|
private readonly reportedSubRefusals;
|
|
@@ -205,7 +205,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
205
205
|
/** Bumped by every connection-scoped teardown and by {@link stop}. A presence or lease-watch bind
|
|
206
206
|
* that was awaiting the broker when the epoch moved belongs to a retired epoch: it releases the
|
|
207
207
|
* iterator it got and installs nothing (see {@link startPresenceWatch} and
|
|
208
|
-
* {@link bindDeliveryLeaseWatch}). */
|
|
208
|
+
* {@link EndpointDeliveryLease.bindDeliveryLeaseWatch}). */
|
|
209
209
|
private presenceEpoch;
|
|
210
210
|
private stopped;
|
|
211
211
|
private stopPromise?;
|
|
@@ -230,7 +230,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
230
230
|
* now instead of awaiting the full retryMs. */
|
|
231
231
|
private backoffResolve?;
|
|
232
232
|
private backoffTimer?;
|
|
233
|
-
/** Wakes for the membership retry loops' pauses (see {@link membershipPause}); stop() runs them all. */
|
|
233
|
+
/** Wakes for the membership retry loops' pauses (see {@link EndpointReconnect.membershipPause}); stop() runs them all. */
|
|
234
234
|
private readonly membershipPauses;
|
|
235
235
|
private readonly retryMs;
|
|
236
236
|
/** Consecutive failed rebuilds, driving {@link nextRetryDelayMs}. Reset on every success. */
|
|
@@ -317,24 +317,14 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
317
317
|
private readonly credentials;
|
|
318
318
|
/** Forwards to the credentials component's {@link EndpointCredentials.refreshBearer}. */
|
|
319
319
|
private refreshBearer;
|
|
320
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.bearerForWire}. */
|
|
321
|
-
private bearerForWire;
|
|
322
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.presentCreds}. */
|
|
323
|
-
private presentCreds;
|
|
324
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.presentBearer}. */
|
|
325
|
-
private presentBearer;
|
|
326
320
|
/** The credential this endpoint presents on its next connect, checked as {@link credsForWire}
|
|
327
321
|
* checks it. A second connection under the same identity reads it on every attempt, so it
|
|
328
322
|
* presents each credential this endpoint adopts and never an expired one. */
|
|
329
323
|
wireCreds(): string;
|
|
330
324
|
/** Forwards to the credentials component's {@link EndpointCredentials.disableLibraryReconnect}. */
|
|
331
325
|
private disableLibraryReconnect;
|
|
332
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.closeWithoutLibraryReconnect}. */
|
|
333
|
-
private closeWithoutLibraryReconnect;
|
|
334
326
|
/** Forwards to the credentials component's {@link EndpointCredentials.armAuthExpiryReconnectFence}. */
|
|
335
327
|
private armAuthExpiryReconnectFence;
|
|
336
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.refreshCreds}. */
|
|
337
|
-
private refreshCreds;
|
|
338
328
|
/** Forwards to the credentials component's {@link EndpointCredentials.renewCredsOnTimer}. */
|
|
339
329
|
private renewCredsOnTimer;
|
|
340
330
|
/** Fetch, broker-prove and adopt the source credential, then refresh the same connection
|
|
@@ -363,48 +353,20 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
363
353
|
iat?: number;
|
|
364
354
|
exp?: number;
|
|
365
355
|
}>;
|
|
366
|
-
/** Forwards to the credentials component's {@link EndpointCredentials.scheduleResidentSwap}. */
|
|
367
|
-
private scheduleResidentSwap;
|
|
368
356
|
private armCredsRefresh;
|
|
369
357
|
/** Open the connection and bind everything that hangs off it: status watch, presence
|
|
370
358
|
* watch + heartbeat, channel registry, and the durable consumers. Re-runnable — a
|
|
371
|
-
* reconnect calls it again after {@link clearConnectionScoped}; every binding is
|
|
359
|
+
* reconnect calls it again after {@link EndpointConnection.clearConnectionScoped}; every binding is
|
|
372
360
|
* idempotent (durables bind by name, JetStream dedups by msgID, KV opens are idempotent). */
|
|
373
361
|
private connectAndBind;
|
|
362
|
+
/** The connection bind and teardown of this endpoint. Every dependency is read when it is used, so a
|
|
363
|
+
* field assigned after construction is seen. */
|
|
364
|
+
private readonly connection;
|
|
365
|
+
/** Forwards to the connection component's {@link EndpointConnection.bindConnection}. */
|
|
374
366
|
private bindConnection;
|
|
375
|
-
/**
|
|
376
|
-
* second heartbeat, double-pump a consumer, or keep stale roster ghosts. Caller-owned
|
|
377
|
-
* subs (tap/serve) are left alone — they aren't rebuilt here. */
|
|
378
|
-
private clearConnectionScoped;
|
|
379
|
-
/** A transport can connect before a later JetStream/KV/subscription bind fails. The caller will
|
|
380
|
-
* retry the whole start, so release that partial epoch first instead of overwriting `nc` and
|
|
381
|
-
* leaving one established socket behind per retry. `close()` is deliberate: a failed bind has no
|
|
382
|
-
* graceful delivery contract to drain, and cleanup itself must not extend the retry failure.
|
|
383
|
-
*
|
|
384
|
-
* A throwing `close()` is not hypothetical: nats.js `NatsConnectionImpl.close()` awaits the
|
|
385
|
-
* protocol close, which itself flushes outbound + tears down subscription state; any of those
|
|
386
|
-
* that reject leaves the underlying TCP transport ESTABLISHED even though every client handle
|
|
387
|
-
* on this endpoint has been cleared. The next `start()` on the same object then dials a fresh
|
|
388
|
-
* connection while the old socket stays live on the broker (`/varz.connections` climbs once per
|
|
389
|
-
* failed attempt). The recovery path is layered, from most graceful to most surgical, matching
|
|
390
|
-
* nats-core's public surface (nats.d.ts: `close`, `drain`, `isClosed`; protocol.d.ts owns the
|
|
391
|
-
* `transport` handle whose `close(err?)` is the socket teardown; transport.d.ts exposes a
|
|
392
|
-
* synchronous `disconnect()` for the case where even close rejects). We only touch a private
|
|
393
|
-
* (`nc.protocol.transport`) when the public API has already refused, and the ORIGINAL bind
|
|
394
|
-
* error is re-raised at every layer. The close error is diagnostic noise. The bind error is
|
|
395
|
-
* what the caller must see.
|
|
396
|
-
*
|
|
397
|
-
* The delivery-serve subs and `this.subs` array are handles created by a successful
|
|
398
|
-
* `armDeliveryControl` on a PREVIOUS epoch; a bind failure on the retry never rewrites them
|
|
399
|
-
* because arming is a late step. Left in place they point at a dead protocol and survive into
|
|
400
|
-
* the next retry. The reviewer flagged this as an untested handle class. Zero them here so a
|
|
401
|
-
* retry starts with the same empty state as a first attempt. */
|
|
367
|
+
/** Forwards to the connection component's {@link EndpointConnection.closeFailedBind}. */
|
|
402
368
|
private closeFailedBind;
|
|
403
|
-
/**
|
|
404
|
-
* heartbeat + supervisor would be left live on a stopped endpoint. Tear that fresh
|
|
405
|
-
* connection back down and report it. Reads `this.nc` in its own scope (a bare `this.nc`
|
|
406
|
-
* in doRebuild narrows to `never` via TS inlining connectAndBind's assignment). Returns
|
|
407
|
-
* true iff it tore something down (caller bails out of the rebuild). */
|
|
369
|
+
/** Forwards to the connection component's {@link EndpointConnection.tearDownIfStopped}. */
|
|
408
370
|
private tearDownIfStopped;
|
|
409
371
|
/** Watch for a terminal close (nats.js has exhausted its own reconnect) and rebuild.
|
|
410
372
|
* Our own stop()/drain also resolves closed(), so the `stopped` guard keeps a clean
|
|
@@ -413,26 +375,15 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
413
375
|
* close of the CURRENT connection triggers a rebuild. The rebuild itself is serialized
|
|
414
376
|
* with the manual path via {@link rebuild}. */
|
|
415
377
|
private superviseConnection;
|
|
416
|
-
/**
|
|
417
|
-
*
|
|
418
|
-
|
|
419
|
-
|
|
378
|
+
/** The rebuild and retry pacing of this endpoint. Every dependency is read when it is used, so a field
|
|
379
|
+
* assigned after construction is seen. */
|
|
380
|
+
private readonly reconnection;
|
|
381
|
+
/** Forwards to the reconnect component's {@link EndpointReconnect.rebuild}. */
|
|
420
382
|
private rebuild;
|
|
421
|
-
/**
|
|
422
|
-
* this.nc during the null window), drop the connection refs, close the old nc, then
|
|
423
|
-
* rebind + re-arm the supervisor on the fresh connection. clearConnectionScoped is
|
|
424
|
-
* idempotent, so connectAndBind's own call here is a noop. */
|
|
425
|
-
private doRebuild;
|
|
426
|
-
/** The ceiling {@link nextRetryDelayMs} grows to. A failure that outlives a couple of retries is
|
|
427
|
-
* a standing one (a down broker, a credential nothing can renew), and retrying it every few
|
|
428
|
-
* seconds forever is what turns one stuck client into a permanent flat load on the broker and its
|
|
429
|
-
* auth callout. */
|
|
430
|
-
private static readonly RETRY_BACKOFF_CAP_MS;
|
|
431
|
-
/** The wait before the next rebuild attempt: {@link retryMs}, doubling per consecutive failure up
|
|
432
|
-
* to {@link RETRY_BACKOFF_CAP_MS}, then a random half of it taken off. A transient drop still
|
|
433
|
-
* recovers within retryMs, and endpoints refused together, as a broker restart or an auth limit
|
|
434
|
-
* refuses a host's agents, spread their retries instead of arriving at the callout at once. */
|
|
383
|
+
/** Forwards to the reconnect component's {@link EndpointReconnect.nextRetryDelayMs}. */
|
|
435
384
|
private nextRetryDelayMs;
|
|
385
|
+
/** Forwards to the reconnect component's {@link EndpointReconnect.kickBackoff}. */
|
|
386
|
+
private kickBackoff;
|
|
436
387
|
/** Rebuild with backoff until it sticks or we're stopped. Interruptible: a manual
|
|
437
388
|
* {@link reconnect} kicks the backoff so the next attempt runs immediately instead of
|
|
438
389
|
* awaiting the full delay. One loop at a time ({@link reestablishing}); concurrent
|
|
@@ -445,12 +396,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
445
396
|
* a rebuild in flight is already the attempt, and a link nats.js is still reconnecting keeps
|
|
446
397
|
* its buffered publishes. */
|
|
447
398
|
retryNow(): void;
|
|
448
|
-
/** Cut an in-flight reestablish backoff short so the next attempt runs immediately, and
|
|
449
|
-
* clear its timer so it can't fire later on a stopped/restarted loop. */
|
|
450
|
-
private kickBackoff;
|
|
451
|
-
/** Capped exponential pause between membership retries. stop() ends it early, so a loop waiting
|
|
452
|
-
* on an absent delivery daemon never holds a stopped endpoint's process open for the delay. */
|
|
453
|
-
private membershipPause;
|
|
454
399
|
/** Manual reconnect: tear down the current connection and rebuild, WITHOUT the permanent
|
|
455
400
|
* stop (stopped/stopping stay false). Serialized with the self-heal supervisor via
|
|
456
401
|
* {@link rebuild}, and interruptible — if a backoff is in flight, kick it so the attempt
|
|
@@ -469,6 +414,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
469
414
|
* before any await below gives it a window to install a watch on a stopped endpoint
|
|
470
415
|
* (see {@link startPresenceWatch}). */
|
|
471
416
|
stop(): Promise<void>;
|
|
417
|
+
/** Forwards to the connection component's {@link EndpointConnection.stopOnce}. */
|
|
472
418
|
private stopOnce;
|
|
473
419
|
/** The native binding of every connection this endpoint holds. A host compares the list with a
|
|
474
420
|
* complete native census of the account to show that no other connection uses it. The list
|
|
@@ -986,8 +932,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
986
932
|
watchMembership(onChange: (change: MembershipChange) => void, onClosed?: (err: Error) => void): Promise<{
|
|
987
933
|
stop(): Promise<void>;
|
|
988
934
|
}>;
|
|
989
|
-
/** Forwards to the subscriptions component's {@link EndpointSubscriptions.deleteRetainedMembershipConsumer}. */
|
|
990
|
-
private deleteRetainedMembershipConsumer;
|
|
991
935
|
/** Record the consumer behind one of this connection's own KV watches or membership scans, and
|
|
992
936
|
* return the delete-subject prefix it recorded. nats.js names it `<prefix>_<serial>` and,
|
|
993
937
|
* rebuilding it after a stall or a sequence gap, deletes the predecessor itself with no hook before
|
|
@@ -1012,8 +956,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1012
956
|
private deleteMembershipConsumer;
|
|
1013
957
|
/** Forwards to the subscriptions component's {@link EndpointSubscriptions.disarmMembershipWatch}. */
|
|
1014
958
|
private disarmMembershipWatch;
|
|
1015
|
-
/** Forwards to the subscriptions component's {@link EndpointSubscriptions.rearmMembershipWatches}. */
|
|
1016
|
-
private rearmMembershipWatches;
|
|
1017
959
|
/** Fetch recent messages from a channel's JetStream backlog. `signal` cancels the active pull and
|
|
1018
960
|
* reclaims its ephemeral consumer before the promise rejects. Returns `HistoryMessage[]`
|
|
1019
961
|
* (#1413): every field present on a row was checked by the drain before the row was
|
|
@@ -1159,7 +1101,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1159
1101
|
* failing call — so without this an over-tight ACL silently drops the agent's
|
|
1160
1102
|
* traffic and it just looks "absent". A denied request is the exception: nats.js also
|
|
1161
1103
|
* rejects that request with the denial, so its caller owns it (see {@link trackRequestDenials}).
|
|
1162
|
-
* So is a refused channel subscription, whose callback owns it (see {@link subscribeChat}).
|
|
1104
|
+
* So is a refused channel subscription, whose callback owns it (see {@link EndpointConsumers.subscribeChat}).
|
|
1163
1105
|
* We annotate permission denials explicitly so a denial is never mistaken for absence
|
|
1164
1106
|
* (which already has a benign cause: MCP reconnect).
|
|
1165
1107
|
*/
|
|
@@ -1198,8 +1140,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1198
1140
|
/** Stream creation and the privileged DM, DELIVER and TASK durable provisioning of this endpoint.
|
|
1199
1141
|
* Every dependency is read when it is used, so a field assigned after construction is seen. */
|
|
1200
1142
|
private readonly provisioning;
|
|
1201
|
-
/** Forwards to the provisioning component's {@link EndpointProvisioning.ensureStreams}. */
|
|
1202
|
-
private ensureStreams;
|
|
1203
1143
|
/** Create this open space's message streams if they are not there yet, as a consuming endpoint
|
|
1204
1144
|
* does when it starts. For a sender that consumes nothing and may be the space's first
|
|
1205
1145
|
* participant (#7045). An authenticated broker's streams come from its setup, and its agents may
|
|
@@ -1213,8 +1153,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1213
1153
|
* safe to call again on manager restart. The caller must be permissive on DM_<space>.
|
|
1214
1154
|
*/
|
|
1215
1155
|
provisionDmInbox(owner: string, actor: string, lifecycleUid: string): Promise<void>;
|
|
1216
|
-
/** Forwards to the provisioning component's {@link EndpointProvisioning.ensureDmDurable}. */
|
|
1217
|
-
private ensureDmDurable;
|
|
1218
1156
|
/**
|
|
1219
1157
|
* Privileged: pre-create an agent's bind-only Plane-3 DELIVER durable (`dlv_<id>`, filtered to
|
|
1220
1158
|
* `dlv.<id>`), so the agent can BIND its per-member durable handoff without holding CONSUMER.CREATE
|
|
@@ -1343,7 +1281,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1343
1281
|
* bucket's current last-per-subject state, so a change that landed during the null window is
|
|
1344
1282
|
* delivered on the fresh watch. Resolves a stop handle. */
|
|
1345
1283
|
watchDeliveryLease(shardIndex: number, onEvent: (info: DeliveryLeaseInfo | undefined) => void): Promise<() => void>;
|
|
1346
|
-
private stopDeliveryLeaseWatch;
|
|
1347
1284
|
/** Wait for the lease-watch binds still in flight, then for every retired watch's consumer delete.
|
|
1348
1285
|
* {@link stop} and a live-epoch rebuild run this before they close the connection those deletes
|
|
1349
1286
|
* need (#3966). */
|
|
@@ -1364,10 +1301,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1364
1301
|
* replaced it binds its own through {@link connectAndBind}. A stopped endpoint binds nothing,
|
|
1365
1302
|
* because its teardown may already have settled the flights it waits for. */
|
|
1366
1303
|
private bindKvWatch;
|
|
1367
|
-
/** Bind the lease watch on the current connection. A bind that lands after a newer watch replaced
|
|
1368
|
-
* its intent, or after a stop or connection teardown moved the epoch, retires its watch instead of
|
|
1369
|
-
* installing it: the epoch it was bound for is gone, and a rebuilt one binds its own. */
|
|
1370
|
-
private bindDeliveryLeaseWatch;
|
|
1371
1304
|
/** The principal recorded as holding a shard's delivery lease, read by THIS process from the row,
|
|
1372
1305
|
* or `undefined` when no row is live or the read failed.
|
|
1373
1306
|
*
|
|
@@ -1479,12 +1412,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1479
1412
|
* `live`→`durable` flip is seen by fan-out without a cache-propagation gap (red-team MED-3), and a
|
|
1480
1413
|
* reader just started need not wait for the cache to fill. */
|
|
1481
1414
|
deliveryClassFresh(channel: string): Promise<DeliveryClass>;
|
|
1482
|
-
/** Forwards to the durable backstop's {@link EndpointDurableBackstop.resolveOwnerByName}. */
|
|
1483
|
-
private resolveOwnerByName;
|
|
1484
|
-
/** Forwards to the durable backstop's {@link EndpointDurableBackstop.plane3MsgId}. */
|
|
1485
|
-
private plane3MsgId;
|
|
1486
|
-
/** Forwards to the durable backstop's {@link EndpointDurableBackstop.publishDinbox}. */
|
|
1487
|
-
private publishDinbox;
|
|
1488
1415
|
/**
|
|
1489
1416
|
* Privileged durable-JOIN write (v3: the delivery daemon calls this from its `ctl.delivery` handler
|
|
1490
1417
|
* after validating channel ⊆ the caller's read ACL): capture `joinCursor`, commit a `durable-active`
|
|
@@ -1513,24 +1440,14 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1513
1440
|
reason?: string;
|
|
1514
1441
|
generation?: number;
|
|
1515
1442
|
}>;
|
|
1516
|
-
/**
|
|
1517
|
-
*
|
|
1518
|
-
|
|
1443
|
+
/** The agent-side durable membership of this endpoint. Every dependency is read when it is used, so a
|
|
1444
|
+
* field assigned after construction is seen. */
|
|
1445
|
+
private readonly durable;
|
|
1446
|
+
/** Forwards to the durable-membership component's {@link EndpointDurable.aclAllows}. */
|
|
1519
1447
|
private aclAllows;
|
|
1520
1448
|
/** Privileged durable-LEAVE write: tombstone the membership at `leaveCursor = frontier` so the
|
|
1521
1449
|
* backstop denies `seq > leaveCursor` while a pre-leave entry stays deliverable (SPEC §7 interval). */
|
|
1522
1450
|
durableLeaveFor(owner: string, channel: string, lifecycleUid: string, expectedGeneration?: number): Promise<void>;
|
|
1523
|
-
/** Idempotently copy the eligible chat messages in `(fromSeqExcl, toSeqIncl]` for `channel` into the
|
|
1524
|
-
* owner inbox, via a DEDICATED per-(owner,join) ephemeral consumer (NOT the agent-scoped
|
|
1525
|
-
* `chathist_<id>`/`histLock` — red-team HIGH-8). It copies what the stream still holds in that
|
|
1526
|
-
* window; a post the history limit removed first is not copied and is not reported (SPEC §4).
|
|
1527
|
-
*
|
|
1528
|
-
* A FAMILY row (`review.>`, #5404) reads the window on every channel under it and copies a post only
|
|
1529
|
-
* when that post's own channel is durable-class. Each copy names the post's own channel, never the
|
|
1530
|
-
* family, and it skips nothing another row of the lifecycle covers: two joins can both be pending
|
|
1531
|
-
* when a post lands, so neither proves the other copied it. The per-message, per-lifecycle dedupe id
|
|
1532
|
-
* keeps one copy. */
|
|
1533
|
-
private catchupCopy;
|
|
1534
1451
|
/** Start the Plane-3 fan-out writer + trusted reader on THIS (privileged, server-side delivery-daemon)
|
|
1535
1452
|
* endpoint, AND serve the `ctl.delivery` control service (runtime durable join/leave/list). `aclFor`
|
|
1536
1453
|
* maps an owner id to its current read ACL for the reader's re-authorization — read FRESH per entry
|
|
@@ -1583,36 +1500,11 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1583
1500
|
* That is a readiness lie surviving a transient broker error, the daemon claims a responder it does
|
|
1584
1501
|
* not have, which is the #1318 outage wearing the readiness flag instead of the exit path. */
|
|
1585
1502
|
rearmPlane3(): Promise<void>;
|
|
1586
|
-
/** Forwards to the delivery plane's {@link EndpointDeliveryPlane.plane3MayAct}. */
|
|
1587
|
-
private plane3MayAct;
|
|
1588
1503
|
/** Forwards to the delivery plane's {@link EndpointDeliveryPlane.armPlane3}. */
|
|
1589
1504
|
private armPlane3;
|
|
1590
|
-
/**
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
* connection (SPEC §8.1). The records bucket is created here as well as at space setup, so a mesh
|
|
1594
|
-
* that predates it gets one when its daemon restarts at this version. */
|
|
1595
|
-
private armAnycastRequests;
|
|
1596
|
-
private dropAnycastRequests;
|
|
1597
|
-
/** Serve takes on `take.*.*.*`, each in its own time: a take reads one request and writes one row,
|
|
1598
|
-
* and shares nothing with any other take but the row's CAS. The reply is bound to the caller's own
|
|
1599
|
-
* request subtree, as `serveControl`'s `boundReply` binds it. */
|
|
1600
|
-
private serveTakes;
|
|
1601
|
-
private answerTake;
|
|
1602
|
-
/** Check one take's caller and arguments, then record it. The role and the caller come from the
|
|
1603
|
-
* broker-policed subject; the payload's `from.id` must match, as on every control rail. */
|
|
1604
|
-
private takeFor;
|
|
1605
|
-
/** DM one notice to a request's sender from this daemon's own principal. The event key is the
|
|
1606
|
-
* message id, so a resend after a crash is dropped by the DM stream's duplicate window and by
|
|
1607
|
-
* the receiving connector. */
|
|
1608
|
-
private sendAnycastNotice;
|
|
1609
|
-
/** DM a post's sender that its mentions of `names` reached no one, because each of those agents
|
|
1610
|
-
* may not read `channel`. The id carries the post's stream seq, so a fan-out redelivered after a
|
|
1611
|
-
* crash sends the notice again under the same id and the DM stream drops the duplicate. */
|
|
1612
|
-
private sendMentionNotice;
|
|
1613
|
-
/** Answer a sender's status or cancel for one of its own requests. The caller is the
|
|
1614
|
-
* authenticated subject sender, checked against the request's stored subject. */
|
|
1615
|
-
private deliveryAnycast;
|
|
1505
|
+
/** The anycast request rail of this endpoint. Every dependency is read when it is used, so a field
|
|
1506
|
+
* assigned after construction is seen. */
|
|
1507
|
+
private readonly anycastRail;
|
|
1616
1508
|
/** The peer-readable liveness responders and the probe, of this endpoint. Every dependency is read
|
|
1617
1509
|
* when it is used, so a field assigned after construction is seen. */
|
|
1618
1510
|
private readonly liveness;
|
|
@@ -1658,8 +1550,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1658
1550
|
* the plane answered by the broker's no-responders status while this endpoint is serving. A second
|
|
1659
1551
|
* call for the same plane replaces the first. */
|
|
1660
1552
|
serveLiveness(plane: LivenessPlane, readState: () => Promise<ResponderState> | ResponderState): void;
|
|
1661
|
-
/** Forwards to the liveness component's {@link EndpointLiveness.bindLiveness}. */
|
|
1662
|
-
private bindLiveness;
|
|
1663
1553
|
/** Bind the liveness responder for the DELIVERY plane, grading itself from its own shard-0 lease
|
|
1664
1554
|
* through the shared classifier. The daemon is the one process that can answer this honestly: it
|
|
1665
1555
|
* knows its own incarnation, so a predecessor's `ready:true` corpse in the bucket classifies
|
|
@@ -1708,28 +1598,18 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1708
1598
|
servePrincipal(spec: {
|
|
1709
1599
|
handlers: EpPrincipalCommandDef[];
|
|
1710
1600
|
}): PrincipalServe;
|
|
1711
|
-
/**
|
|
1601
|
+
/** The principal serve and prompts of this endpoint. Every dependency is read when it is used, and
|
|
1602
|
+
* every endpoint method is looked up at call time, so a member a caller replaced on the endpoint runs. */
|
|
1603
|
+
private readonly principalServe;
|
|
1604
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.bindPrincipalHandle}. */
|
|
1712
1605
|
private bindPrincipalHandle;
|
|
1713
|
-
/**
|
|
1714
|
-
* subscription or a reply read. Only a reply publish is left, which no call or serve awaits. */
|
|
1606
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.ownedPrincipalRouteRefusal}. */
|
|
1715
1607
|
private ownedPrincipalRouteRefusal;
|
|
1716
|
-
/**
|
|
1717
|
-
* connection shows the presence field. */
|
|
1608
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.armPrincipalServe}. */
|
|
1718
1609
|
private armPrincipalServe;
|
|
1719
|
-
/**
|
|
1720
|
-
* ready there. */
|
|
1721
|
-
private principalServeConfirmed;
|
|
1722
|
-
/** Re-bind every principal serve on a replaced connection (a rebuild), or re-run the check on the
|
|
1723
|
-
* connection the library reconnected and re-subscribed itself. */
|
|
1610
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.rebindPrincipalServes}. */
|
|
1724
1611
|
private rebindPrincipalServes;
|
|
1725
|
-
/**
|
|
1726
|
-
private endPrincipalServe;
|
|
1727
|
-
/** Mark `intent` ended and release what it holds in this endpoint and in this process. */
|
|
1728
|
-
private forgetPrincipalServe;
|
|
1729
|
-
/** Stop serving `intent` and wait for its handlers in flight, each until its request's deadline
|
|
1730
|
-
* at most. The ending is synchronous, so a
|
|
1731
|
-
* `ready` still waiting for the broker rejects before the caller's next step. `republish` writes
|
|
1732
|
-
* presence without the `prompts` field; the endpoint's own stop writes it offline instead. */
|
|
1612
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.stopPrincipalServe}. */
|
|
1733
1613
|
private stopPrincipalServe;
|
|
1734
1614
|
/**
|
|
1735
1615
|
* Set this process's `prompts` presence field and write presence at once (SPEC §6): how many
|
|
@@ -1746,7 +1626,7 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1746
1626
|
* prompt desk takes every `seq` it shows from here. Throws without a lifecycle UID.
|
|
1747
1627
|
*/
|
|
1748
1628
|
nextPromptsSeq(): number;
|
|
1749
|
-
/**
|
|
1629
|
+
/** Forwards to the principal-serve component's {@link EndpointPrincipalServe.servedPrompts}. */
|
|
1750
1630
|
private servedPrompts;
|
|
1751
1631
|
/**
|
|
1752
1632
|
* Call one command of a principal's own endpoint on the principal route (SPEC 13.21), as this
|
|
@@ -1787,29 +1667,14 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1787
1667
|
* it) AND this incarnation's lifecycleUid — membership rows are lifecycle-keyed (SPEC 13.1), and a
|
|
1788
1668
|
* leave must resolve the selected principal-owned row even after the ACL row was narrowed or purged. */
|
|
1789
1669
|
durableLeaveChannel(channel: string, generation?: number, lifecycleUid?: string): Promise<void>;
|
|
1790
|
-
/** Fail-closed async cleanup for a channel forced out by a LATE sub.allow refusal (the broker revoked
|
|
1791
|
-
* the live read). The sync sub callback can't await, so this RETRIES the Plane-3 tombstone with capped
|
|
1792
|
-
* backoff UNTIL IT SUCCEEDS (or the endpoint stops) — the §7 boundary always closes once the manager
|
|
1793
|
-
* is reachable, never a silent give-up. While pending, the channel is tracked in
|
|
1794
|
-
* {@link pendingDurableLeave} and surfaced via {@link pendingDurableLeaves} (the connector shows it in
|
|
1795
|
-
* `cotal_channels` as `durable-unclosed`, never ordinary absence). The generation is kept the whole
|
|
1796
|
-
* time. Authoritative closure of a revoked membership is also handled by revocation (rotate creds + tear down). */
|
|
1797
|
-
private closeRefusedMembership;
|
|
1798
1670
|
/** Channels with a Plane-3 durable membership whose §7 tombstone is still pending after a refused live
|
|
1799
|
-
* sub (see {@link closeRefusedMembership}) — surfaced by the connector as a `durable-unclosed` state so
|
|
1671
|
+
* sub (see {@link EndpointDurable.closeRefusedMembership}) — surfaced by the connector as a `durable-unclosed` state so
|
|
1800
1672
|
* it is never presented as ordinary "not subscribed". */
|
|
1801
1673
|
pendingDurableLeaves(): string[];
|
|
1802
|
-
/**
|
|
1803
|
-
* distinct from a responder that errored. nats.js surfaces it as NoRespondersError, or a RequestError
|
|
1804
|
-
* whose `isNoResponders()` is true. */
|
|
1674
|
+
/** Forwards to the anycast component's {@link EndpointAnycast.isNoResponders}. */
|
|
1805
1675
|
private isNoResponders;
|
|
1806
|
-
/**
|
|
1807
|
-
* request at `seq`, for the copy with `count` deliveries. Never throws; a take the daemon could
|
|
1808
|
-
* not decide is reported as held, with what the operator has to do when that is anything. */
|
|
1676
|
+
/** Forwards to the anycast component's {@link EndpointAnycast.takeAnycast}. */
|
|
1809
1677
|
private takeAnycast;
|
|
1810
|
-
/** No responder on the take rail: an older daemon answers the probe op as unsupported, and a
|
|
1811
|
-
* stopped one does not answer at all. */
|
|
1812
|
-
private takeResponderMissing;
|
|
1813
1678
|
/** The status of one of this endpoint's own anycast requests, from the delivery daemon's record
|
|
1814
1679
|
* or, with no record, from the queue (SPEC §8.1). `id` narrows the answer to that request. Throws
|
|
1815
1680
|
* on an open mesh, which runs no delivery daemon. */
|
|
@@ -1817,7 +1682,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1817
1682
|
/** Cancel one of this endpoint's own anycast requests while it waits. A request a holder already
|
|
1818
1683
|
* took is refused, and the returned status names the taker. */
|
|
1819
1684
|
cancelAnycast(seq: number, id?: string): Promise<AnycastStatus>;
|
|
1820
|
-
private anycastRequest;
|
|
1821
1685
|
/** The boot durable self-join and its reconcile, and the membership read the leave path uses, of
|
|
1822
1686
|
* this endpoint. Every dependency is read when it is used, and every endpoint method is looked up
|
|
1823
1687
|
* at call time, so a test that replaces one on the endpoint is seen here. */
|
|
@@ -1832,62 +1696,15 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1832
1696
|
activated: boolean;
|
|
1833
1697
|
lifecycleUid?: string;
|
|
1834
1698
|
}[] | undefined>;
|
|
1835
|
-
/** Forwards to the boot-membership component's {@link EndpointBootMemberships.armBootDurableMemberships}. */
|
|
1836
|
-
private armBootDurableMemberships;
|
|
1837
1699
|
/** True if this session holds an established Plane-3 durable membership for `channel` (in `plane3Channels`).
|
|
1838
1700
|
* Drives the membership-aware delivery-health surface: a joined durable channel that is NOT yet a member
|
|
1839
1701
|
* (boot self-join pending / daemon down) must render degraded, never "active" off a live lease alone. */
|
|
1840
1702
|
hasDurableMembership(channel: string): boolean;
|
|
1841
|
-
/**
|
|
1842
|
-
*
|
|
1703
|
+
/** The durable consumers of this endpoint. Every dependency is read when it is used, so a field
|
|
1704
|
+
* assigned after construction is seen. */
|
|
1705
|
+
private readonly consumers;
|
|
1706
|
+
/** Forwards to the consumers component's {@link EndpointConsumers.manager}. */
|
|
1843
1707
|
private manager;
|
|
1844
|
-
/** Bind this endpoint's durable consumers: DM inbox, chat, and (if a role) the task queue. */
|
|
1845
|
-
private startConsumers;
|
|
1846
|
-
/** Drive one consumer: decode and hand each message to listeners with ack control. Our own sends are
|
|
1847
|
-
* delivered too: on the DM inbox and the role queue they were addressed to us, so none is an echo,
|
|
1848
|
-
* and acking one unseen on the work queue would delete the only copy of the request. */
|
|
1849
|
-
private pump;
|
|
1850
|
-
/** Bind the role consumer and read the TASK stream's creation time on both sides of the bind, so
|
|
1851
|
-
* the time belongs to the stream the consumer was bound on (SPEC §8.1). */
|
|
1852
|
-
private bindTaskConsumer;
|
|
1853
|
-
/** Read the TASK stream's creation time into {@link taskEpoch}. */
|
|
1854
|
-
private readTaskEpoch;
|
|
1855
|
-
/** Warn once when the broker reports this endpoint's own DM inbox missing while the connection is
|
|
1856
|
-
* up, as after a store reset that the client's reconnect rode through, or after a manager restart
|
|
1857
|
-
* deletes the inbox. nats.js keeps checking and resumes pulling if the inbox comes back, so this
|
|
1858
|
-
* only reports. A `consumer_deleted` status is the consumer going away, so it warns at once. A
|
|
1859
|
-
* not-found can be a passing state, so that warning waits for a second report; the several 409s a
|
|
1860
|
-
* delete answers pending pulls with count once. A pull means the consumer was found again, which
|
|
1861
|
-
* re-arms the warning. The loop ends when the consumer is stopped, by `stop()` or by a rebuild
|
|
1862
|
-
* replacing this connection. */
|
|
1863
|
-
private watchInbox;
|
|
1864
|
-
/** Decode one stream copy and apply the authenticity guard (fail closed): the sender is encoded in
|
|
1865
|
-
* the subject, which the server policed who could publish. The payload `from` is advisory — it
|
|
1866
|
-
* must match, and a missing `from` or an unparseable subject on a delivery is itself an anomaly.
|
|
1867
|
-
* A rejected copy is `term()`ed (permanently invalid, never redelivered) and reported, and
|
|
1868
|
-
* `undefined` returns, so no handler ever sees it. */
|
|
1869
|
-
private authenticateStreamMsg;
|
|
1870
|
-
/** Bind this endpoint's own existing DM durable and drive it serially (EndpointOptions.dmOnly).
|
|
1871
|
-
* The bind is one CONSUMER.INFO on `dm_<owner>-<actor>-<uid>`; reading is MSG.NEXT with a batch
|
|
1872
|
-
* of one, and the next copy reaches the handler only after the previous handler settles. */
|
|
1873
|
-
private bindDmOnly;
|
|
1874
|
-
/** Open a native core subscription to a channel's live feed (the manager-free live read path,
|
|
1875
|
-
* broker-enforced by `sub.allow`). At-most-once — no replay, no ack; it is the live delivery for
|
|
1876
|
-
* every channel (boot + runtime). For a `durable` channel it is also the low-latency wake-hint
|
|
1877
|
-
* alongside the Plane-3 durable copy, coalesced by the receiver's id-dedup. Drops our own echo +
|
|
1878
|
-
* spoofed senders. */
|
|
1879
|
-
private subscribeChat;
|
|
1880
|
-
/** Close a channel's core subscription (manager-free leave). */
|
|
1881
|
-
private unsubscribeChat;
|
|
1882
|
-
/** Confirm a just-opened core subscription was accepted by the broker. A `sub.allow` violation is
|
|
1883
|
-
* async in NATS, so flush (round-trips the SUB) then settle briefly to let the refusal land — a
|
|
1884
|
-
* denied subscribe must not read as a successful join (SPEC conformance #13). */
|
|
1885
|
-
private confirmChatSub;
|
|
1886
|
-
/** The durable's info (rebind) or null (fresh — 404). Gates create/backfill to the join event
|
|
1887
|
-
* and exposes the current `filter_subjects` for restart reconciliation. */
|
|
1888
|
-
private consumerInfo;
|
|
1889
|
-
/** Delete one named consumer, swallowing ONLY structured consumer/stream absence. */
|
|
1890
|
-
private deleteConsumerIfPresent;
|
|
1891
1708
|
/** Current frontier (last sequence) of the chat stream — a channel's join watermark, the
|
|
1892
1709
|
* focus-watermark a connector captures on entering `focus` (recall reads ambient after it), and
|
|
1893
1710
|
* the backfill floor a preservation cut records for each retained seat. The manager reads it in
|
|
@@ -1979,16 +1796,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
1979
1796
|
* A hole behind a retained older post, as a channel-filtered purge leaves, sets neither. */
|
|
1980
1797
|
private chatMayHaveLost;
|
|
1981
1798
|
private publishPresence;
|
|
1982
|
-
/** #1356: drop the presence-refusal record when the connection that OBSERVED those refusals goes
|
|
1983
|
-
* away. "This bucket is refusing writes" is a claim about a specific broker connection; once that
|
|
1984
|
-
* connection is torn down or rebuilt the claim has no remaining basis, and a later failure on a
|
|
1985
|
-
* fresh connection must establish it again from its own evidence.
|
|
1986
|
-
*
|
|
1987
|
-
* Cleared at the SOURCE rather than guarded at each reader, because a guard protects one consumer
|
|
1988
|
-
* and clearing protects every consumer, including ones not yet written. Measured: without this, a
|
|
1989
|
-
* failed bind against an unreachable server still reported the presence-refusal sentence while the
|
|
1990
|
-
* endpoint's own `connectionIssue` already said "connection refused". */
|
|
1991
|
-
private clearPresenceWriteFailure;
|
|
1992
1799
|
/** #1356: the presence bucket has been refusing writes since this time, or `undefined` when the
|
|
1993
1800
|
* last publish succeeded. Cleared by a successful write that is the latest evidence on its
|
|
1994
1801
|
* epoch (#1461), so a survived blip reads as healthy and only a SUSTAINED failure carries a
|
|
@@ -2016,10 +1823,6 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
2016
1823
|
/** {@link EndpointOptions.readOnce}: fill the roster from one read of the presence bucket. Stale
|
|
2017
1824
|
* and offline records resolve as they do in a watch's initial replay. */
|
|
2018
1825
|
private readPresenceOnce;
|
|
2019
|
-
/** Forwards to the channel discovery component's {@link EndpointChannelDiscovery.startChannelWatch}. */
|
|
2020
|
-
private startChannelWatch;
|
|
2021
|
-
/** Forwards to the channel discovery component's {@link EndpointChannelDiscovery.readChannelsOnce}. */
|
|
2022
|
-
private readChannelsOnce;
|
|
2023
1826
|
private sweep;
|
|
2024
1827
|
}
|
|
2025
1828
|
//# sourceMappingURL=endpoint.d.ts.map
|