@cotal-ai/core 0.3.2 → 0.5.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/README.md +11 -0
- package/dist/agent-file.d.ts +36 -5
- package/dist/agent-file.d.ts.map +1 -1
- package/dist/agent-file.js +91 -11
- package/dist/agent-file.js.map +1 -1
- package/dist/channels.d.ts +13 -2
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +24 -1
- package/dist/channels.js.map +1 -1
- package/dist/command.d.ts +21 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/connector-config.d.ts +42 -0
- package/dist/connector-config.d.ts.map +1 -0
- package/dist/connector-config.js +103 -0
- package/dist/connector-config.js.map +1 -0
- package/dist/connector.d.ts +11 -0
- package/dist/connector.d.ts.map +1 -1
- package/dist/endpoint.d.ts +331 -40
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +1280 -246
- package/dist/endpoint.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/members.d.ts +93 -0
- package/dist/members.d.ts.map +1 -0
- package/dist/members.js +193 -0
- package/dist/members.js.map +1 -0
- package/dist/provision.d.ts +49 -11
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +92 -31
- package/dist/provision.js.map +1 -1
- package/dist/resolve.d.ts +53 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +61 -0
- package/dist/resolve.js.map +1 -0
- package/dist/streams.d.ts +37 -0
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +91 -4
- package/dist/streams.js.map +1 -1
- package/dist/subjects.d.ts +80 -2
- package/dist/subjects.d.ts.map +1 -1
- package/dist/subjects.js +127 -3
- package/dist/subjects.js.map +1 -1
- package/dist/types.d.ts +111 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -2
package/dist/connector.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Extension } from "./registry.js";
|
|
2
|
+
import type { McpServerSpec } from "./connector-config.js";
|
|
2
3
|
/** Identity + mesh coordinates the manager hands a connector to launch an agent. */
|
|
3
4
|
export interface LaunchOpts {
|
|
4
5
|
space: string;
|
|
@@ -20,6 +21,16 @@ export interface LaunchOpts {
|
|
|
20
21
|
* that support an auto-submitted first prompt (Claude Code) deliver it; others
|
|
21
22
|
* ignore it. Used to make a driving session greet the operator on launch. */
|
|
22
23
|
prompt?: string;
|
|
24
|
+
/** Mirror this session's transcript to `tr-<name>` so peers/observers can read what
|
|
25
|
+
* the agent actually did (sets `COTAL_TRANSCRIPT`). Defaults to OFF; set `true` to
|
|
26
|
+
* opt in — surfaced as the `--transcript` flag on `cotal spawn` / `cotal start`. */
|
|
27
|
+
transcript?: boolean;
|
|
28
|
+
/** Operator MCP servers to SHARE with this agent, resolved from the cotal config by the caller
|
|
29
|
+
* (see {@link connectorServers}). Keyed by server name, `.mcp.json`-shaped, with `${VAR}`
|
|
30
|
+
* secret refs intact. A connector renders them into its own host format; the default is none
|
|
31
|
+
* (Claude launches isolated with `--strict-mcp-config`). Connectors that don't support sharing
|
|
32
|
+
* throw on a non-empty map rather than silently dropping it. */
|
|
33
|
+
mcpServers?: Record<string, McpServerSpec>;
|
|
23
34
|
}
|
|
24
35
|
/** A recipe for starting an agent as a mesh node — command, args, and extra env. */
|
|
25
36
|
export interface LaunchSpec {
|
package/dist/connector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;8EAE0E;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;mDAC+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;wEAEoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;kFAE8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;yFAEqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;qEAIiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC5C;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;;+CAG2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC1C;;;+DAG2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
package/dist/endpoint.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
|
-
import type { AgentCard, ChannelConfig, ControlReply, ControlRequest, ControlRequestInit, EndpointRef, Part, Presence, PresenceStatus, CotalMessage } from "./types.js";
|
|
2
|
+
import type { AgentCard, ChannelConfig, ControlReply, ControlRequest, ControlRequestInit, EndpointRef, Part, Presence, PresenceStatus, AttentionMode, ChannelMode, CotalMessage } from "./types.js";
|
|
3
3
|
export declare const DEFAULT_SERVER = "nats://127.0.0.1:4222";
|
|
4
4
|
/** Space joined when none is given on the CLI (the `cotal-<space>` cmux tab, etc.). */
|
|
5
5
|
export declare const DEFAULT_SPACE = "main";
|
|
@@ -33,6 +33,9 @@ export interface EndpointOptions {
|
|
|
33
33
|
watchPresence?: boolean;
|
|
34
34
|
/** Create inbound stream consumers (DM / chat / anycast). Default true; a pure observer sets false. */
|
|
35
35
|
consume?: boolean;
|
|
36
|
+
/** Initial per-channel attention overrides to publish in presence from the first heartbeat (the
|
|
37
|
+
* connector's file-default seed). Mirror only — never read back into delivery. */
|
|
38
|
+
channelModes?: Record<string, ChannelMode>;
|
|
36
39
|
/** How long an unacked (un-surfaced) message waits before redelivery (ms). */
|
|
37
40
|
ackWaitMs?: number;
|
|
38
41
|
/** Retire this instance's durable consumers after it's been gone this long (ms). */
|
|
@@ -47,14 +50,6 @@ export interface ChannelMember {
|
|
|
47
50
|
role?: string;
|
|
48
51
|
live: boolean;
|
|
49
52
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Events: "message" (CotalMessage), "presence" (PresenceEvent), "roster" (Presence[]), "error" (Error).
|
|
52
|
-
*
|
|
53
|
-
* Callers MUST attach an "error" listener before `start()`: async faults (incl. NATS
|
|
54
|
-
* permission denials, surfaced via `watchStatus`) are emitted as "error", and Node throws
|
|
55
|
-
* synchronously on an unhandled "error" — a missing listener turns any such fault into a
|
|
56
|
-
* process crash instead of a logged denial.
|
|
57
|
-
*/
|
|
58
53
|
export declare class CotalEndpoint extends EventEmitter {
|
|
59
54
|
readonly card: AgentCard;
|
|
60
55
|
readonly space: string;
|
|
@@ -77,6 +72,11 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
77
72
|
private jsm?;
|
|
78
73
|
private kv?;
|
|
79
74
|
private channelKv?;
|
|
75
|
+
/** Plane-3 durable-membership registry KV — lazily opened by the privileged (manager) endpoint. */
|
|
76
|
+
private membersKv?;
|
|
77
|
+
/** When set, this endpoint hosts the Plane-3 fan-out writer + trusted reader (the manager). `aclFor`
|
|
78
|
+
* maps an owner id to its current read ACL (`allowSubscribe`) for the reader's re-authorization. */
|
|
79
|
+
private plane3?;
|
|
80
80
|
/** Live local cache of the channel registry (key = channel token), kept by a KV watch. */
|
|
81
81
|
private readonly channelConfigs;
|
|
82
82
|
private channelDefaults;
|
|
@@ -85,17 +85,115 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
85
85
|
* a lagging joiner + dedups the backfill overlap). Keyed by the subscription pattern (may be
|
|
86
86
|
* wildcard), so the drop matches every concrete channel the pattern subsumes. */
|
|
87
87
|
private readonly joinSeq;
|
|
88
|
+
/** Serializes history reads ({@link collectHistory}): they share the fixed per-instance
|
|
89
|
+
* `chathist_<id>` consumer, so overlapping reads would delete/recreate it under one another. */
|
|
90
|
+
private histLock;
|
|
88
91
|
private readonly subs;
|
|
89
92
|
private readonly streamMsgs;
|
|
93
|
+
/** Per-channel native core subscriptions (SPEC v0.3) — the manager-free live read path for boot +
|
|
94
|
+
* runtime channels (there is no per-instance chat durable). Keyed by channel so leave unsubscribes
|
|
95
|
+
* just one. */
|
|
96
|
+
private readonly chatSubs;
|
|
97
|
+
/** Channels whose core-sub the broker refused (async sub.allow violation) — read by the
|
|
98
|
+
* broker-confirmed join: a denied subscribe is NOT a successful join (SPEC conformance #13). */
|
|
99
|
+
private readonly chatSubDenied;
|
|
100
|
+
/** Channels this session has a Plane-3 durable backstop for (per-channel join GENERATION, from
|
|
101
|
+
* durableJoin, so leave passes it back for the stale-leave guard). A durable channel's core-sub is
|
|
102
|
+
* NOT coverage-dropped — it stays a live wake-hint, dedup-coalesced with the Plane-3 durable copy by
|
|
103
|
+
* id-dedup. Drives the durable-state surface + routes leave to `durableLeave`. PERSISTS across
|
|
104
|
+
* reconnect (like `this.channels`): the membership record + the `dlv_<id>` durable are persistent so
|
|
105
|
+
* the backstop survives a reconnect on its own; the agent can't re-read the privileged members KV,
|
|
106
|
+
* so this in-memory mirror is kept, not rebuilt. Cleared only on full stop. */
|
|
107
|
+
private readonly plane3Channels;
|
|
108
|
+
/** Channels whose live sub was REFUSED while they held a Plane-3 durable membership, whose §7
|
|
109
|
+
* tombstone has not yet confirmed (channel → join generation). {@link closeRefusedMembership} retries
|
|
110
|
+
* the tombstone until it lands; until then this is a `durable-unclosed` state surfaced via
|
|
111
|
+
* {@link pendingDurableLeaves} (the connector shows it in `cotal_channels`, never as ordinary
|
|
112
|
+
* absence). Persists across reconnect; cleared on tombstone success or full stop. */
|
|
113
|
+
private readonly pendingDurableLeave;
|
|
114
|
+
/** Chat-join subjects currently being broker-confirmed. An out-of-ACL subscribe among these trips an
|
|
115
|
+
* EXPECTED async permission violation that joinChannel turns into a clean throw, so watchStatus
|
|
116
|
+
* suppresses it rather than surfacing a spurious connection error. */
|
|
117
|
+
private readonly confirmingChatSubs;
|
|
118
|
+
/** True until the first successful connect completes its boot backfill — distinguishes first-connect
|
|
119
|
+
* (backfill the boot channels' history) from a reconnect (reopen the core-subs, no re-backfill).
|
|
120
|
+
* Persists across reconnect (NOT connection-scoped). Replaces the legacy chat-durable consumed-cursor
|
|
121
|
+
* signal now that there is no per-instance chat durable. */
|
|
122
|
+
private firstConnect;
|
|
90
123
|
private heartbeatTimer?;
|
|
91
124
|
private sweepTimer?;
|
|
92
125
|
private readonly roster;
|
|
93
126
|
private status;
|
|
94
127
|
private activity?;
|
|
128
|
+
/** Mirror of the connector's authoritative attention state, published in presence (advisory). The
|
|
129
|
+
* endpoint never reads these back into delivery — they exist only to broadcast. */
|
|
130
|
+
private attentionMode?;
|
|
131
|
+
private channelModes?;
|
|
95
132
|
private stopped;
|
|
133
|
+
/** In-flight rebuild (drain+rebind) — serializes manual reconnect, the supervisor's
|
|
134
|
+
* closed(), and reestablishLoop so only ONE rebuild runs at a time (a second trigger
|
|
135
|
+
* coalesces onto the shared promise, never starts a parallel connectAndBind). */
|
|
136
|
+
private rebuildPromise?;
|
|
137
|
+
/** True only during the null window of a rebuild (this.nc unset) — user-facing ops then
|
|
138
|
+
* throw a "reconnecting" message instead of the misleading "endpoint not started". */
|
|
139
|
+
private reconnecting;
|
|
140
|
+
/** One reestablishLoop at a time; concurrent triggers coalesce via rebuild(). */
|
|
141
|
+
private reestablishing;
|
|
142
|
+
/** Interruptible backoff for reestablishLoop — reconnect()/stop() resolves this to retry
|
|
143
|
+
* now instead of awaiting the full retryMs. */
|
|
144
|
+
private backoffResolve?;
|
|
145
|
+
private backoffTimer?;
|
|
146
|
+
private readonly retryMs;
|
|
96
147
|
constructor(opts: EndpointOptions);
|
|
97
148
|
ref(): EndpointRef;
|
|
98
149
|
start(): Promise<void>;
|
|
150
|
+
/** Open the connection and bind everything that hangs off it: status watch, presence
|
|
151
|
+
* watch + heartbeat, channel registry, and the durable consumers. Re-runnable — a
|
|
152
|
+
* reconnect calls it again after {@link clearConnectionScoped}; every binding is
|
|
153
|
+
* idempotent (durables bind by name, JetStream dedups by msgID, KV opens are idempotent). */
|
|
154
|
+
private connectAndBind;
|
|
155
|
+
/** Tear down everything {@link connectAndBind} (re)creates, so a rebind can't leak a
|
|
156
|
+
* second heartbeat, double-pump a consumer, or keep stale roster ghosts. Caller-owned
|
|
157
|
+
* subs (tap/serve) are left alone — they aren't rebuilt here. */
|
|
158
|
+
private clearConnectionScoped;
|
|
159
|
+
/** If stop() ran during a rebuild's `await connectAndBind`, the just-bound connection +
|
|
160
|
+
* heartbeat + supervisor would be left live on a stopped endpoint. Tear that fresh
|
|
161
|
+
* connection back down and report it. Reads `this.nc` in its own scope (a bare `this.nc`
|
|
162
|
+
* in doRebuild narrows to `never` via TS inlining connectAndBind's assignment). Returns
|
|
163
|
+
* true iff it tore something down (caller bails out of the rebuild). */
|
|
164
|
+
private tearDownIfStopped;
|
|
165
|
+
/** Watch for a terminal close (nats.js has exhausted its own reconnect) and rebuild.
|
|
166
|
+
* Our own stop()/drain also resolves closed(), so the `stopped` guard keeps a clean
|
|
167
|
+
* shutdown from re-establishing. The identity guard (`this.nc !== nc`) no-ops a STALE
|
|
168
|
+
* supervisor — one whose connection reconnect()/rebuild already replaced — so only a
|
|
169
|
+
* close of the CURRENT connection triggers a rebuild. The rebuild itself is serialized
|
|
170
|
+
* with the manual path via {@link rebuild}. */
|
|
171
|
+
private superviseConnection;
|
|
172
|
+
/** Single serialized rebuild: drain the old connection and rebind via {@link connectAndBind},
|
|
173
|
+
* guarded so concurrent triggers (manual {@link reconnect}, the supervisor's closed(), the
|
|
174
|
+
* retry loop) coalesce onto ONE in-flight rebuild instead of racing two connectAndBinds and
|
|
175
|
+
* leaking a connection. Returns the shared promise; a second caller gets the in-flight one. */
|
|
176
|
+
private rebuild;
|
|
177
|
+
/** The transition: stop the connection-scoped timers FIRST (so nothing live touches
|
|
178
|
+
* this.nc during the null window), drop the connection refs, drain the old nc, then
|
|
179
|
+
* rebind + re-arm the supervisor on the fresh connection. clearConnectionScoped is
|
|
180
|
+
* idempotent, so connectAndBind's own call here is a noop. */
|
|
181
|
+
private doRebuild;
|
|
182
|
+
/** Rebuild with backoff until it sticks or we're stopped. Interruptible: a manual
|
|
183
|
+
* {@link reconnect} kicks the backoff so the next attempt runs immediately instead of
|
|
184
|
+
* awaiting the full retryMs. One loop at a time ({@link reestablishing}); concurrent
|
|
185
|
+
* triggers coalesce via {@link rebuild}. */
|
|
186
|
+
private reestablishLoop;
|
|
187
|
+
/** Cut an in-flight reestablish backoff short so the next attempt runs immediately, and
|
|
188
|
+
* clear its timer so it can't fire later on a stopped/restarted loop. */
|
|
189
|
+
private kickBackoff;
|
|
190
|
+
/** Manual reconnect: tear down the current connection and rebuild, WITHOUT the permanent
|
|
191
|
+
* stop (stopped/stopping stay false). Serialized with the self-heal supervisor via
|
|
192
|
+
* {@link rebuild}, and interruptible — if a backoff is in flight, kick it so the attempt
|
|
193
|
+
* is now, not in retryMs. Throws if stopped. On failure, leaves {@link reestablishLoop}
|
|
194
|
+
* running in the background so the endpoint never stays dead, and rethrows so the caller
|
|
195
|
+
* can report it. */
|
|
196
|
+
reconnect(): Promise<void>;
|
|
99
197
|
stop(): Promise<void>;
|
|
100
198
|
/** Multicast: broadcast to everyone on a channel. */
|
|
101
199
|
multicast(text: string, opts?: {
|
|
@@ -130,6 +228,18 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
130
228
|
getRoster(): Presence[];
|
|
131
229
|
setActivity(activity: string): Promise<void>;
|
|
132
230
|
setStatus(status: PresenceStatus): Promise<void>;
|
|
231
|
+
/** Publish the agent's global attention mode into presence (advisory observability). Mirror only —
|
|
232
|
+
* delivery decisions stay in the connector's authoritative state. */
|
|
233
|
+
setAttention(attention: AttentionMode): Promise<void>;
|
|
234
|
+
/** Publish the agent's per-channel attention overrides into presence (advisory). An empty map drops
|
|
235
|
+
* the field. Mirror only — never read back into delivery. */
|
|
236
|
+
setChannelModes(modes: Record<string, ChannelMode>): Promise<void>;
|
|
237
|
+
/** Overlay the host's live model onto the card's display-only `meta.model` and republish presence.
|
|
238
|
+
* For connectors that learn the actual model only *after* launch (e.g. Claude Code's `SessionStart`
|
|
239
|
+
* hook payload) rather than from an operator pin. Display-only discovery metadata; a no-op when the
|
|
240
|
+
* value is empty or already current (no redundant publish). The mutated card is read live by every
|
|
241
|
+
* later publish, so even a pre-connect call surfaces on the first presence write. */
|
|
242
|
+
setCardModel(model: string): Promise<void>;
|
|
133
243
|
/** This channel's registry config from the live local cache (undefined if unset). */
|
|
134
244
|
getChannelConfig(channel: string): ChannelConfig | undefined;
|
|
135
245
|
/** Effective replay-on-join policy for a channel: per-channel override ?? space default ??
|
|
@@ -138,19 +248,24 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
138
248
|
/** The channels this endpoint is currently subscribed to (live — reflects join/leave). */
|
|
139
249
|
joinedChannels(): string[];
|
|
140
250
|
/**
|
|
141
|
-
* Join a channel mid-session:
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* Idempotent: re-joining
|
|
145
|
-
* the
|
|
251
|
+
* Join a channel mid-session: open a native core subscription (manager-free live read, broker-
|
|
252
|
+
* confirmed against `sub.allow`), capture the stream frontier as the join watermark, backfill its
|
|
253
|
+
* history if replay is on, and — for a `durable`-class channel under a manager — request a Plane-3
|
|
254
|
+
* durable backstop. Idempotent: re-joining is a no-op (no re-backfill). Returns the backfill count +
|
|
255
|
+
* whether the durable backstop is active (+ a `reason` when a durable channel couldn't get one).
|
|
146
256
|
*/
|
|
147
257
|
joinChannel(channel: string): Promise<{
|
|
148
258
|
joined: boolean;
|
|
149
259
|
backfilled: number;
|
|
260
|
+
durable: boolean;
|
|
261
|
+
reason?: string;
|
|
150
262
|
}>;
|
|
151
|
-
/** Leave a channel mid-session
|
|
152
|
-
*
|
|
153
|
-
*
|
|
263
|
+
/** Leave a channel mid-session — MANAGER-FREE for the live read: close the core subscription. For a
|
|
264
|
+
* Plane-3 durable channel, the membership is tombstoned FIRST at the leave cursor (SPEC §7: leave is
|
|
265
|
+
* a hard read boundary for the backstop — a pre-leave entry stays deliverable, `seq > leaveCursor` is
|
|
266
|
+
* denied). FAIL-CLOSED: if the tombstone can't be confirmed the call throws and the leave is NOT
|
|
267
|
+
* applied (live sub stays up, local mirror intact) so the caller can retry — never close the live
|
|
268
|
+
* read while the backstop keeps delivering. */
|
|
154
269
|
leaveChannel(channel: string): Promise<{
|
|
155
270
|
left: boolean;
|
|
156
271
|
}>;
|
|
@@ -163,20 +278,15 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
163
278
|
config?: ChannelConfig;
|
|
164
279
|
}[]>;
|
|
165
280
|
/**
|
|
166
|
-
* Who is
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* `
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* Privileged read: `consumers.list` needs `$JS.API.CONSUMER.LIST.<chat stream>`, which only
|
|
177
|
-
* the allow-all manager profile holds today (agents, observer, and admin are all denied), so
|
|
178
|
-
* this is not an agent-facing capability — serving it from a dashboard profile is a one-line
|
|
179
|
-
* ACL grant away.
|
|
281
|
+
* Who is a durable member of a channel — read from the privileged members registry (Plane-3),
|
|
282
|
+
* joined with presence for liveness (a member whose peer is gone but lingering shows `live:false`,
|
|
283
|
+
* not a phantom). Only CURRENT, ACTIVATED members (non-tombstoned, and past activation catch-up — a
|
|
284
|
+
* join still completing or that failed catch-up reported durable:false and stays hidden here until
|
|
285
|
+
* confirmed, so this surface never overstates membership). A wildcard registry channel would count for
|
|
286
|
+
* the concrete channels it subsumes, but durable membership is per-concrete-channel, so records are
|
|
287
|
+
* concrete. `live`-class channels carry no durable record — membership there is the live core-sub,
|
|
288
|
+
* not tracked here. Privileged read (the members KV is manager-write/read; agents hold no grant), so
|
|
289
|
+
* it is served by the manager, not an agent capability.
|
|
180
290
|
*/
|
|
181
291
|
channelMembers(channel: string): Promise<ChannelMember[]>;
|
|
182
292
|
channelMembers(): Promise<Map<string, ChannelMember[]>>;
|
|
@@ -203,10 +313,29 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
203
313
|
* denial is never mistaken for absence (which already has a benign cause: MCP reconnect).
|
|
204
314
|
*/
|
|
205
315
|
private watchStatus;
|
|
316
|
+
/** The error message for a guard that finds the endpoint unbound: "reconnecting" during a
|
|
317
|
+
* rebuild's null window OR an inter-retry backoff (so a concurrent op reports the real
|
|
318
|
+
* reason, not "not started" — `reestablishing` spans the whole retry loop incl. backoff),
|
|
319
|
+
* else "endpoint not started" (genuine pre-start). */
|
|
320
|
+
private notLiveMsg;
|
|
206
321
|
private publishMsg;
|
|
207
322
|
/** Create the three backing streams for this space (idempotent). Open-mode lazy create;
|
|
208
323
|
* the same definitions are used by `cotal up` at privileged setup. */
|
|
209
324
|
private ensureStreams;
|
|
325
|
+
/**
|
|
326
|
+
* Privileged: write an agent's BOOT durable membership — each `durable`-class channel in its boot
|
|
327
|
+
* subscribe set gets a Plane-3 durable-active record (via {@link durableJoinFor}: cursor capture +
|
|
328
|
+
* activation catch-up), so it receives durable backstop copies from boot exactly like a runtime
|
|
329
|
+
* `durableJoin`. `live`-class (and non-concrete) channels are skipped. Idempotent.
|
|
330
|
+
*
|
|
331
|
+
* Writes the durable RECORDS with the caller's privileged creds — it does NOT require this endpoint
|
|
332
|
+
* to host the runtime fan-out/reader loops (a space-level manager service), so EVERY auth launcher
|
|
333
|
+
* provisions identically: the manager AND the short-lived `cotal spawn` provisioner both write boot
|
|
334
|
+
* records, which the space's manager then delivers (no silent no-op — that would hide a boot
|
|
335
|
+
* membership; AGENTS.md "no fallbacks"). A space running no manager is live-only for everyone (the
|
|
336
|
+
* records exist; nothing delivers them until a manager hosts the loops).
|
|
337
|
+
*/
|
|
338
|
+
provisionMembership(targetId: string, channels: string[]): Promise<void>;
|
|
210
339
|
/**
|
|
211
340
|
* Privileged: pre-create an agent's DM inbox durable (auth mode), so the agent can BIND
|
|
212
341
|
* it without holding CONSUMER.CREATE on DM_<space>. The creator sets the filter to
|
|
@@ -215,6 +344,14 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
215
344
|
* safe to call again on manager restart. The caller must be permissive on DM_<space>.
|
|
216
345
|
*/
|
|
217
346
|
provisionDmInbox(targetId: string): Promise<void>;
|
|
347
|
+
/**
|
|
348
|
+
* Privileged: pre-create an agent's bind-only Plane-3 DELIVER durable (`dlv_<id>`, filtered to
|
|
349
|
+
* `dlv.<id>`), so the agent can BIND its per-member durable handoff without holding CONSUMER.CREATE
|
|
350
|
+
* on the DLV stream. Same bind-only model as {@link provisionDmInbox}: the creator sets the filter,
|
|
351
|
+
* the agent never does. The trusted reader transfers re-authorized copies onto `dlv.<id>`; the agent
|
|
352
|
+
* acks them via native JetStream (SPEC §8). Idempotent. The caller must be permissive on DLV.
|
|
353
|
+
*/
|
|
354
|
+
provisionDlvInbox(targetId: string): Promise<void>;
|
|
218
355
|
/**
|
|
219
356
|
* Privileged: pre-create a role's shared TASK work-queue durable (auth mode), so agents
|
|
220
357
|
* of that role can BIND it without holding CONSUMER.CREATE on TASK_<space>. The creator
|
|
@@ -222,6 +359,124 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
222
359
|
* Idempotent per role. The caller must be permissive on TASK_<space>.
|
|
223
360
|
*/
|
|
224
361
|
provisionTaskQueue(role: string): Promise<void>;
|
|
362
|
+
/** Lazily open the privileged members registry KV (manager / open-mode self). */
|
|
363
|
+
private membersRegistry;
|
|
364
|
+
/** Privileged: one owner's NON-TOMBSTONED durable memberships as `{channel, generation, activated}` —
|
|
365
|
+
* the manager serves this to a connecting agent (via the `listMemberships` self-service op). The agent
|
|
366
|
+
* hydrates its leave mirror from the ACTIVATED ones (the confirmed backstops), but the non-activated
|
|
367
|
+
* ones are returned too so `leaveChannel` can discover + close a record that still routes under the
|
|
368
|
+
* pure-interval predicate (a crash-stuck pending activation) — without reading the privileged KV. */
|
|
369
|
+
ownerMemberships(owner: string): Promise<{
|
|
370
|
+
channel: string;
|
|
371
|
+
generation: number;
|
|
372
|
+
activated: boolean;
|
|
373
|
+
}[]>;
|
|
374
|
+
/** Effective delivery class read AUTHORITATIVELY from the registry KV (not the watch cache) — so a
|
|
375
|
+
* `live`→`durable` flip is seen by fan-out without a cache-propagation gap (red-team MED-3). */
|
|
376
|
+
private deliveryClassFresh;
|
|
377
|
+
/** Collision-safe `@mention` → owner-id resolution: a name that resolves to exactly one present
|
|
378
|
+
* peer wins; 0 or >1 matches drop (never fan a directed durable copy to an unrelated same-named
|
|
379
|
+
* bystander — red-team LOW; SPEC §4 unique instance id). */
|
|
380
|
+
private resolveOwnerByName;
|
|
381
|
+
/** Publish one fan-out entry into an owner's mixed inbox, idempotent via `Nats-Msg-Id`
|
|
382
|
+
* (`<msgId>:<owner>:<generation>`) so a catch-up copy and a racing fan-out copy collapse. */
|
|
383
|
+
private publishDinbox;
|
|
384
|
+
/** The fan-out consumer's delivered stream-seq — the activation-fence upper bound (red-team
|
|
385
|
+
* BLOCKER-1: the shared fan-out cursor advances independently of the stream frontier). */
|
|
386
|
+
private fanoutDeliveredSeq;
|
|
387
|
+
/**
|
|
388
|
+
* Privileged durable-JOIN write (the manager calls this after validating channel ⊆ allowSubscribe;
|
|
389
|
+
* {@link provisionMembership} calls it at provision time for boot channels): capture `joinCursor`,
|
|
390
|
+
* commit a `durable-active` record (CAS + generation bump), then ACTIVATION CATCH-UP idempotently
|
|
391
|
+
* copies `(joinCursor, fence]` into the owner inbox where `fence = max(frontier, fanoutDelivered)` —
|
|
392
|
+
* fan-out owns `seq > fence`. Idempotent against a timeout-retry (an already-activated membership
|
|
393
|
+
* no-ops). Returns `{durable:false}` (honest degrade) only if the catch-up window was evicted.
|
|
394
|
+
*
|
|
395
|
+
* This writes durable KV + dinbox state with the caller's privileged creds; it does NOT require THIS
|
|
396
|
+
* endpoint to host the fan-out/reader loops (those are a space-level manager service). So a
|
|
397
|
+
* short-lived provisioner can write a boot membership a separate long-lived manager then delivers.
|
|
398
|
+
*/
|
|
399
|
+
durableJoinFor(owner: string, channel: string): Promise<{
|
|
400
|
+
durable: boolean;
|
|
401
|
+
reason?: string;
|
|
402
|
+
generation?: number;
|
|
403
|
+
}>;
|
|
404
|
+
/** Privileged durable-LEAVE write: tombstone the membership at `leaveCursor = frontier` so the
|
|
405
|
+
* backstop denies `seq > leaveCursor` while a pre-leave entry stays deliverable (SPEC §7 interval). */
|
|
406
|
+
durableLeaveFor(owner: string, channel: string, expectedGeneration?: number): Promise<void>;
|
|
407
|
+
/** Idempotently copy the eligible chat messages in `(fromSeqExcl, toSeqIncl]` for `channel` into the
|
|
408
|
+
* owner inbox, via a DEDICATED per-(owner,join) ephemeral consumer (NOT the agent-scoped
|
|
409
|
+
* `chathist_<id>`/`histLock` — red-team HIGH-8). `evicted` ⇒ the oldest eligible seq aged out under
|
|
410
|
+
* `discard=Old` (the start seq could not be served), a durable shortfall the caller surfaces. */
|
|
411
|
+
private catchupCopy;
|
|
412
|
+
/** Start the Plane-3 fan-out writer + trusted reader on THIS (privileged) endpoint. `aclFor` maps an
|
|
413
|
+
* owner id to its current read ACL for the reader's re-authorization (the manager passes its managed
|
|
414
|
+
* set). Call once after connect; idempotent durable creation lets it resume on a manager restart. */
|
|
415
|
+
startPlane3(aclFor: (owner: string) => string[] | undefined): Promise<void>;
|
|
416
|
+
/** (Re)bind the Plane-3 fan-out writer + trusted reader. Idempotent — the durables resume from their
|
|
417
|
+
* cursor. Called by {@link startPlane3} once AND by {@link connectAndBind} on every (re)connect, so
|
|
418
|
+
* a manager-endpoint reconnect RE-ARMS the backstop. Without this, a broker blip would silently kill
|
|
419
|
+
* the loops while `durableJoinFor` kept reporting `durable:true` (the impl-review's BLOCKER-1). No-op
|
|
420
|
+
* unless this endpoint hosts Plane-3 (`this.plane3` set). */
|
|
421
|
+
private armPlane3;
|
|
422
|
+
/** Fan-out loop: bind the privileged `fanout` durable on CHAT and route each message (routing only —
|
|
423
|
+
* the trusted reader is the auth gate). */
|
|
424
|
+
private runFanout;
|
|
425
|
+
/** Route ONE chat message to eligible owners' mixed inboxes. `durable` channel → its `durable-active`
|
|
426
|
+
* members within interval; `live` channel → `@mention` targets authorized to read it (ACL only).
|
|
427
|
+
* Members KV is scanned FRESH per message (no cache — red-team BLOCKER-1 catch-up correctness). */
|
|
428
|
+
private fanOutMessage;
|
|
429
|
+
/** Trusted-reader loop: bind the single privileged `reader` durable over `dinbox.>` and re-authorize
|
|
430
|
+
* + transfer each entry. */
|
|
431
|
+
private runReader;
|
|
432
|
+
/** Re-authorize ONE mixed-inbox entry and transfer it to the owner's DELIVER store. Deny (drop) on a
|
|
433
|
+
* revoked/narrowed ACL or out-of-interval seq; on transfer success, ack the mixed entry (durability
|
|
434
|
+
* has moved to DLV — an §8 equivalent per-member at-least-once mechanism). The agent acks DLV. */
|
|
435
|
+
private readerHandle;
|
|
436
|
+
/** Agent-side: bind + pump our pre-created Plane-3 DELIVER durable (`dlv_<id>`). Every message here is
|
|
437
|
+
* manager-written (DLV is manager-write-only, broker-enforced) and is a CHANNEL message by contract
|
|
438
|
+
* (the backstop never carries DMs), so `kind=channel` is path-derived (SPEC §4) and the body is
|
|
439
|
+
* trusted (no spoof-guard). `durable:true` — real JetStream ack, coalesced with the core-sub live
|
|
440
|
+
* copy by `MeshAgent.ingest`. No-op when the durable isn't present (open mode / not provisioned). */
|
|
441
|
+
private pumpDlv;
|
|
442
|
+
/** Agent-side: request a Plane-3 durable backstop for a channel via the manager (ctl.self). Throws
|
|
443
|
+
* when no privileged writer is present (open / manager-less). 30s timeout — activation catch-up may
|
|
444
|
+
* run before the reply (the window is small, but a busy channel can take more than the 5s default). */
|
|
445
|
+
durableJoinChannel(channel: string): Promise<{
|
|
446
|
+
durable: boolean;
|
|
447
|
+
reason?: string;
|
|
448
|
+
generation?: number;
|
|
449
|
+
}>;
|
|
450
|
+
/** Agent-side: release a Plane-3 durable backstop (tombstone membership at the leave cursor). Passes
|
|
451
|
+
* the join generation so a stale leave can't tombstone a newer rejoin (the manager validates it). */
|
|
452
|
+
durableLeaveChannel(channel: string, generation?: number): Promise<void>;
|
|
453
|
+
/** Fail-closed async cleanup for a channel forced out by a LATE sub.allow refusal (the broker revoked
|
|
454
|
+
* the live read). The sync sub callback can't await, so this RETRIES the Plane-3 tombstone with capped
|
|
455
|
+
* backoff UNTIL IT SUCCEEDS (or the endpoint stops) — the §7 boundary always closes once the manager
|
|
456
|
+
* is reachable, never a silent give-up. While pending, the channel is tracked in
|
|
457
|
+
* {@link pendingDurableLeave} and surfaced via {@link pendingDurableLeaves} (the connector shows it in
|
|
458
|
+
* `cotal_channels` as `durable-unclosed`, never ordinary absence). The generation is kept the whole
|
|
459
|
+
* time. Authoritative closure of a revoked membership is also the manager's job (revocation). */
|
|
460
|
+
private closeRefusedMembership;
|
|
461
|
+
/** Channels with a Plane-3 durable membership whose §7 tombstone is still pending after a refused live
|
|
462
|
+
* sub (see {@link closeRefusedMembership}) — surfaced by the connector as a `durable-unclosed` state so
|
|
463
|
+
* it is never presented as ordinary "not subscribed". */
|
|
464
|
+
pendingDurableLeaves(): string[];
|
|
465
|
+
/** A control request that found NO responder — open / manager-less (no privileged control plane),
|
|
466
|
+
* distinct from a responder that errored. nats.js surfaces it as NoRespondersError, or a RequestError
|
|
467
|
+
* whose `isNoResponders()` is true. */
|
|
468
|
+
private isNoResponders;
|
|
469
|
+
/** Agent-side: this session's CURRENT durable memberships (channel + join generation) from the
|
|
470
|
+
* manager — the agent holds no read on the privileged members KV. `undefined` ⇒ NO control responder
|
|
471
|
+
* (open / manager-less, so there is no Plane-3 and no memberships). THROWS on a responder-present RPC
|
|
472
|
+
* failure, so a caller can FAIL-CLOSED rather than mistaking a transient error for "no membership". */
|
|
473
|
+
private fetchMemberships;
|
|
474
|
+
/** Agent-side: seed `plane3Channels` with this session's boot durable memberships + generations on
|
|
475
|
+
* first connect (the agent holds no read on the privileged members KV). A best-effort OPTIMIZATION: it
|
|
476
|
+
* pre-fills the leave-generation mirror + the durable-state surface. If it can't (a transient manager
|
|
477
|
+
* error), {@link leaveChannel} re-resolves the generation on demand and fails closed there — so a
|
|
478
|
+
* missed hydration never silently leaves a boot durable channel untombstonable. */
|
|
479
|
+
private hydrateMemberships;
|
|
225
480
|
/** Lazily obtain a JetStream manager — so a non-consuming endpoint (e.g. the supervisor,
|
|
226
481
|
* consume:false) can still pre-create others' durables. */
|
|
227
482
|
private manager;
|
|
@@ -229,6 +484,18 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
229
484
|
private startConsumers;
|
|
230
485
|
/** Drive one consumer: decode, drop our own echo, and hand each message to listeners with ack control. */
|
|
231
486
|
private pump;
|
|
487
|
+
/** Open a native core subscription to a channel's live feed (the manager-free live read path,
|
|
488
|
+
* broker-enforced by `sub.allow`). At-most-once — no replay, no ack; it is the live delivery for
|
|
489
|
+
* every channel (boot + runtime). For a `durable` channel it is also the low-latency wake-hint
|
|
490
|
+
* alongside the Plane-3 durable copy, coalesced by the receiver's id-dedup. Drops our own echo +
|
|
491
|
+
* spoofed senders. */
|
|
492
|
+
private subscribeChat;
|
|
493
|
+
/** Close a channel's core subscription (manager-free leave). */
|
|
494
|
+
private unsubscribeChat;
|
|
495
|
+
/** Confirm a just-opened core subscription was accepted by the broker. A `sub.allow` violation is
|
|
496
|
+
* async in NATS, so flush (round-trips the SUB) then settle briefly to let the refusal land — a
|
|
497
|
+
* denied subscribe must not read as a successful join (SPEC conformance #13). */
|
|
498
|
+
private confirmChatSub;
|
|
232
499
|
/** The highest join watermark among the joined subscriptions that cover `concreteChannel`
|
|
233
500
|
* (a wildcard sub like `team.>` covers `team.backend`), or undefined if none — the tail
|
|
234
501
|
* drops a chat message with `seq <= ` this. */
|
|
@@ -240,8 +507,8 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
240
507
|
* focus-watermark a connector captures on entering `focus` (recall reads ambient after it). */
|
|
241
508
|
chatFrontier(): Promise<number>;
|
|
242
509
|
/** Phase 1 of a join — arm each channel's tail-drop watermark at the current frontier. MUST run
|
|
243
|
-
* BEFORE the
|
|
244
|
-
*
|
|
510
|
+
* BEFORE opening the core subscription so the live tail can never carry a just-joined message
|
|
511
|
+
* un-watermarked — which would double-emit it (live + backfill).
|
|
245
512
|
* Returns the per-channel frontiers for {@link backfillArmed}. */
|
|
246
513
|
private armJoin;
|
|
247
514
|
/** Phase 2 of a join — backfill each armed channel's history up to its frontier (replay-gated),
|
|
@@ -251,11 +518,23 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
251
518
|
* — the authoritative read for a join decision (a join is infrequent, and at startup the async
|
|
252
519
|
* cache may not have caught up). Falls to the built-in default only with no registry open. */
|
|
253
520
|
private joinPolicyFresh;
|
|
254
|
-
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
521
|
+
/**
|
|
522
|
+
* Read retained chat history on ONE channel subject through a name-scoped, single-filter
|
|
523
|
+
* EPHEMERAL pull consumer — the broker-contained replacement for the removed Direct Get. The
|
|
524
|
+
* create rides `$JS.API.CONSUMER.CREATE.<CHAT>.<chathist_id>.<subject>`, whose trailing filter
|
|
525
|
+
* token nats-server pins to the request body (JSConsumerCreateFilterSubjectMismatchErr, code
|
|
526
|
+
* 10131) — so an agent can only ever replay a channel its `allowSubscribe` grants. Single filter
|
|
527
|
+
* only (plural isn't ACL-constrainable); `AckPolicy.None` + `mem_storage` so it leaves no durable
|
|
528
|
+
* state, and it is deleted right after. Returns raw messages in stream order from `start`,
|
|
529
|
+
* stopping once past `untilSeq` (exclusive of it) or after `limit`. The per-instance name means
|
|
530
|
+
* calls must be serial — every reader here awaits to completion, so they are.
|
|
531
|
+
*/
|
|
532
|
+
private collectHistory;
|
|
533
|
+
private collectHistoryInner;
|
|
534
|
+
/** Read a channel's retained history up to `upToSeq` (the join frontier) and emit each message
|
|
535
|
+
* as a `historical` "message" event. `sinceMs` bounds how far back via a native consumer
|
|
257
536
|
* `start_time` (now − window); unset ⇒ the full retained window. New messages (`seq > upToSeq`)
|
|
258
|
-
* are skipped — the live tail owns them.
|
|
537
|
+
* are skipped — the live tail owns them. Reads through the contained {@link collectHistory}. */
|
|
259
538
|
private backfillChannel;
|
|
260
539
|
/**
|
|
261
540
|
* Replay-gated pull of a channel's retained ambient from `sinceSeq` (exclusive) forward — the
|
|
@@ -266,8 +545,8 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
266
545
|
*
|
|
267
546
|
* Honors the **same** per-channel replay gate as join-backfill ({@link joinPolicyFresh}): a
|
|
268
547
|
* `replay=off` channel returns nothing, so `focus` can't become a history bypass for a channel
|
|
269
|
-
* that denies replay to everyone else (
|
|
270
|
-
* app gate
|
|
548
|
+
* that denies replay to everyone else (the read ACL bounds *which* channels recall can touch; this
|
|
549
|
+
* app gate bounds *whether* a permitted channel replays).
|
|
271
550
|
*/
|
|
272
551
|
recallChannel(channel: string, sinceSeq: number): Promise<{
|
|
273
552
|
messages: CotalMessage[];
|
|
@@ -282,7 +561,8 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
282
561
|
* traffic.) */
|
|
283
562
|
private channelDropped;
|
|
284
563
|
/** Sequence of the earliest message still retained on a channel subject (any sender), or
|
|
285
|
-
* undefined if nothing is retained. One
|
|
564
|
+
* undefined if nothing is retained. One message through the contained {@link collectHistory} —
|
|
565
|
+
* used for the recall drop marker. */
|
|
286
566
|
private channelOldestSeq;
|
|
287
567
|
private publishPresence;
|
|
288
568
|
private startPresenceWatch;
|
|
@@ -293,6 +573,10 @@ export declare class CotalEndpoint extends EventEmitter {
|
|
|
293
573
|
private handleChannelEntry;
|
|
294
574
|
private handleKvEntry;
|
|
295
575
|
private applyPresence;
|
|
576
|
+
/** Materialize an OFFLINE presence record: drop the advisory attention fields. An offline peer must
|
|
577
|
+
* not show a stale `[focus]` or "locally muted #x" hint — SPEC: attention removed on offline sweep,
|
|
578
|
+
* channel modes reset on restart. card/activity/ts are kept. */
|
|
579
|
+
private toOffline;
|
|
296
580
|
/** Mark a known peer offline (on KV delete/purge), keeping it in the roster. */
|
|
297
581
|
private markOffline;
|
|
298
582
|
private sweep;
|
|
@@ -305,6 +589,13 @@ interface AuthOpts {
|
|
|
305
589
|
creds?: string;
|
|
306
590
|
tls?: boolean;
|
|
307
591
|
}
|
|
592
|
+
/** True when a failure is a NATS *permission denial* — the subject is forbidden to this
|
|
593
|
+
* endpoint's creds — rather than a missing responder or a timeout. The two need opposite
|
|
594
|
+
* fixes (grant the capability vs. start/await the service), so callers (e.g. a control
|
|
595
|
+
* request that can't reach the manager) must tell them apart instead of defaulting to
|
|
596
|
+
* "service down". Unwraps a wrapped `cause` and falls back to the server's error text, since
|
|
597
|
+
* a denied publish can surface either as the typed error or inside a request rejection. */
|
|
598
|
+
export declare function isPermissionDenied(e: unknown): boolean;
|
|
308
599
|
/** Whether a NATS server is *running* at `servers`. True on a successful connect AND on an
|
|
309
600
|
* auth rejection — an auth error means a server is there, just refusing these creds (so the
|
|
310
601
|
* caller should surface the real auth failure, not a misleading "server down", and `up`
|
package/dist/endpoint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA8B3C,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EAEb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAElB,WAAW,EAEX,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,aAAa,EACb,WAAW,EACX,YAAY,EAIb,MAAM,YAAY,CAAC;AAqDpB,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,uFAAuF;AACvF,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;oFACgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,KAAK,CAAC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