madeonsol-x402 2.0.0 → 2.2.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/stream.d.ts CHANGED
@@ -7,26 +7,220 @@
7
7
  * not expire: `getToken()` is called on every (re)connect and returns the
8
8
  * same value until the subscription lapses or you explicitly rotate it.
9
9
  *
10
+ * Recovery (v1 resume): the client remembers a cursor `{instance, seq, ts}` —
11
+ * the last frame whose handlers finished — and on every reconnect asks the
12
+ * server to resume after it (`subscribe {…, resume}`); against an older server
13
+ * it falls back to `replay_since_seq` (same process) / `replay_since_ts`
14
+ * (restarted). Delivery is at-least-once, de-duplicated by event `id`; a
15
+ * `"gap"` event says what could NOT be recovered. `seq` gaps are normal and
16
+ * never mean loss. Close codes: 4001 re-fetches the token (bounded, then
17
+ * `"fatal"`), 4002 (connection limit) waits ≥ 60 s, 4003 stops with
18
+ * `"fatal"`, 4008 (slow consumer) reconnects and resumes.
19
+ *
10
20
  * Works in Node (uses the global `WebSocket` on Node 22+, else lazily imports
11
21
  * the optional `ws` package) and the browser (native WebSocket). Zero required
12
22
  * dependencies.
13
23
  */
14
- import type { StreamToken } from "./types";
15
- /** Channels you can subscribe to. */
16
- export type StreamChannel = "kol:trades" | "kol:coordination" | "kol:first_touches" | "deployer:alerts" | "wallet_tracker:events" | "copytrade:signals" | "price_alert:events" | "sniper:deploys" | "token:graduations" | "token:locks" | "token:fee_claims" | "token:surges";
24
+ import type { StreamToken } from "./types.js";
25
+ /** Channels you can subscribe to (mirrors the server registry, services/shared/stream-channels.mjs). */
26
+ export type StreamChannel = "kol:trades" | "kol:coordination" | "kol:first_touches" | "deployer:alerts" | "wallet_tracker:events" | "copytrade:signals" | "price_alert:events" | "sniper:deploys" | "token:graduations" | "token:prices" | "token:locks" | "token:fee_claims" | "token:surges";
27
+ /** Every Solana channel, in the server's order. */
28
+ export declare const STREAM_CHANNELS: readonly StreamChannel[];
17
29
  /** Event names delivered on those channels (subscribe to a channel, receive these). */
18
- export type StreamEventName = "kol:trade" | "kol:coordination" | "kol:first_touch" | "deployer:alert" | "deployer:bond" | "wallet_tracker:event" | "copytrade:signal" | "price_alert:dip" | "price_alert:recovery" | "sniper:deploy" | "token:graduation" | "token:lock" | "token:fee_claim" | "token:surge" | "token:revival";
30
+ export type StreamEventName = "kol:trade" | "kol:coordination" | "kol:first_touch" | "deployer:alert" | "deployer:bond" | "wallet_tracker:event" | "copytrade:signal" | "price_alert:dip" | "price_alert:recovery" | "sniper:deploy" | "token:graduation" | "token:price" | "token:lock" | "token:fee_claim" | "token:surge" | "token:revival";
19
31
  /** Lifecycle events you can also listen for. */
20
- export type StreamLifecycleEvent = "open" | "close" | "reconnect" | "subscribed" | "heartbeat" | "error";
32
+ export type StreamLifecycleEvent = "open" | "close" | "reconnect" | "subscribed" | "heartbeat" | "warning" | "cursor" | "replay" | "gap" | "fatal" | "error";
33
+ /**
34
+ * A server `type: "warning"` frame, surfaced as the `"warning"` lifecycle
35
+ * event. Known codes: `channels_rejected` (a subscribe named a channel that
36
+ * does not exist or that your tier cannot hold — each with a reason, plus the
37
+ * full list of channels it accepts) and `channels_revoked` (the server dropped
38
+ * channels you held, e.g. after a plan downgrade). A rejected or revoked
39
+ * channel is silent, so never ignore these.
40
+ */
41
+ export interface StreamWarning {
42
+ /** Machine-readable code, e.g. `"channels_rejected"` or `"channels_revoked"`. */
43
+ code?: string;
44
+ /** Channels the server refused, each with a human-readable reason. */
45
+ rejected?: Array<{
46
+ channel: string;
47
+ reason: string;
48
+ }>;
49
+ /** Channels the server removed from this connection (channels_revoked). */
50
+ revoked?: Array<{
51
+ channel: string;
52
+ reason: string;
53
+ }> | string[];
54
+ /** Every channel the server accepts. */
55
+ valid_channels?: string[];
56
+ /** Optional human-readable message (not sent on every warning). */
57
+ message?: string;
58
+ /** Server timestamp (ms). */
59
+ ts?: number;
60
+ [key: string]: unknown;
61
+ }
62
+ /**
63
+ * Resume cursor = the last SAFE point: every event up to it has been
64
+ * processed ("processed" = every handler for that frame returned, or the
65
+ * promise it returned settled). Two positions are kept:
66
+ * - `getProgress()` — what has been received and handled, including replayed frames;
67
+ * - `getCursor()` — the COMMITTED cursor, the only one to persist and resume from.
68
+ * Live frames commit as they are processed. During a resume, replayed frames
69
+ * are delivered but do NOT commit (the server replays channel by channel): the
70
+ * cursor moves to the server's `last_seq` / `last_ts` only when
71
+ * `replay_end` says `complete: true` with no incomplete / best-effort
72
+ * channel. After an INCOMPLETE recovery (or a close mid-replay) it stays at
73
+ * the pre-resume point, and later live frames are delivered but not committed
74
+ * until a recovery completes — so the next reconnect re-requests the
75
+ * unrecovered range (duplicates are dropped by id). Call `acceptGap()` once
76
+ * you have backfilled (or decided to skip) the range. `instance` identifies the server process
77
+ * (seq restarts when it changes), `seq` is the server's global ordinal and
78
+ * `ts` the frame time in ms. Delivery is at-least-once: after a resume you may
79
+ * see a frame again — dedupe by `evt.id` (the client already drops ids it saw
80
+ * recently). Persist it (on the `"cursor"` event or via `getCursor()`) and pass
81
+ * it back as the `resume` option to continue after a process restart.
82
+ */
83
+ export interface StreamCursor {
84
+ instance: string;
85
+ seq: number;
86
+ ts: number;
87
+ }
21
88
  export interface StreamEvent<T = unknown> {
22
89
  channel: StreamChannel;
23
90
  event: StreamEventName;
24
91
  data: T;
25
92
  ts: number;
93
+ /** Stable event id — the same event carries the same id live and in replay. Dedupe on it. */
94
+ id?: string;
95
+ /**
96
+ * Server-global ordinal. Gaps are NORMAL (it counts every channel and every
97
+ * user) and are never evidence of loss — only a `"gap"` event is.
98
+ */
99
+ seq?: number | null;
100
+ /** true when the frame was re-sent by a replay/backfill rather than live. */
101
+ replayed?: boolean;
102
+ /**
103
+ * Where a replayed frame came from: "ring" (the server's in-memory buffer) or
104
+ * "durable" (rebuilt from storage — `seq` is then null).
105
+ */
106
+ mode?: "ring" | "durable";
107
+ /** true when a durable frame could not reproduce every live field — see `missing`. */
108
+ partial?: boolean;
109
+ /** Live payload keys a durable frame could not reproduce (they are absent, never guessed). */
110
+ missing?: string[];
111
+ /** "bus" for a live-path frame the server re-sent after its own event-bus reconnect. */
112
+ recovered?: string;
113
+ /** true on a token:price state snapshot sent at resume time. */
114
+ snapshot?: boolean;
115
+ }
116
+ /** Outcome of a resume, emitted as `"replay"` after the server's `replay_end`. */
117
+ export interface StreamReplayResult {
118
+ /** "resume" = the server answered the v1 `resume` request; "legacy" = the
119
+ * client fell back to `replay_since_seq` / `replay_since_ts` (older server). */
120
+ protocol: "resume" | "legacy";
121
+ /** The cursor the client resumed from. */
122
+ from: StreamCursor | null;
123
+ /** The resume fields the client sent. */
124
+ request: Record<string, unknown>;
125
+ /** Replayed frames received. */
126
+ received: number;
127
+ /** Replayed frames handed to your handlers (received minus duplicates). */
128
+ delivered: number;
129
+ /** Replayed frames dropped because their id was already delivered. */
130
+ duplicates: number;
131
+ /** false when anything could not be recovered — a `"gap"` event follows. */
132
+ complete: boolean;
133
+ /** Server's replay mode ("ring" | "durable"), null on an older server. */
134
+ mode: string | null;
135
+ /** Why the server could not use its ring (e.g. "instance_changed", "ring_truncated"), or null. */
136
+ resumeReason: string | null;
137
+ /** Raw `replay_start` frame (null if none arrived). */
138
+ start: Record<string, unknown> | null;
139
+ /** Raw `replay_end` frame (null on a client-side timeout). */
140
+ end: Record<string, unknown> | null;
141
+ }
142
+ /**
143
+ * Part of a resume could not be recovered. It says what is KNOWN: which
144
+ * channels the server could not fully rebuild, the RANGE that may be
145
+ * incomplete (`skipped.from` → `skipped.to`, or from `from` onwards while the
146
+ * cursor stays), the server's reason and whether it is final, and the bounds
147
+ * the server reported (`limits`, and per-channel entries in `channels`:
148
+ * `time_basis`, `truncated_at_ts`, `retry_after_ms`, …). Events in that range
149
+ * MAY be missing — how many, nobody can say, so this never claims a count.
150
+ * Backfill the range from REST if you need certainty. `reasons` uses the
151
+ * server's vocabulary (`backpressure`, `closed`, `source_busy`,
152
+ * `source_error`, `late_ingest_possible`, `row_cap`, `ring_truncated`,
153
+ * `instance_changed`, `window_exceeded`, `not_reconstructable`) plus the
154
+ * client-side `replay_timeout`.
155
+ */
156
+ export interface StreamGap {
157
+ /** The first reason (convenience). */
158
+ reason: string;
159
+ reasons: string[];
160
+ /**
161
+ * true when EVERY reason is permanent — asking again can never fill it
162
+ * (`not_reconstructable`, `state_stream`, `window_exceeded`, or an older
163
+ * server's `ring_truncated` / `instance_changed`). The client reports it
164
+ * once and commits as if complete. false = transient (`backpressure`,
165
+ * `row_cap`, `source_busy`, `source_error`, `late_ingest` / `best_effort`,
166
+ * `incomplete`, `replay_timeout`, …): the committed cursor stays and the
167
+ * range is requested again on the next reconnect.
168
+ */
169
+ permanent: boolean;
170
+ /** Per-channel entries the server reported as incomplete / not reconstructable. */
171
+ channels: Record<string, unknown>;
172
+ /** The cursor the resume started from (the committed cursor stays there). */
173
+ from: StreamCursor | null;
174
+ /** true when the server says the gap is transient and worth asking again (`retryable`). */
175
+ retryable: boolean;
176
+ /** How long the server wants you to wait before resuming again (ms), when it says. */
177
+ retryAfterMs: number | null;
178
+ /** For `row_cap`: the ts to resume from next (the client uses it automatically). */
179
+ resumeTsHint: number | null;
180
+ /**
181
+ * true when the CLIENT decided to continue past this gap and move the
182
+ * committed cursor beyond it — the events in `skipped` are not coming back.
183
+ * This is the SDK's own decision (see `onUnrecoverableGap`), never a user
184
+ * approval. false = the cursor stayed put.
185
+ */
186
+ advancedPastGap: boolean;
187
+ /** "auto" = the client's own decision; "manual" = you called `acceptGap()`. */
188
+ source: "auto" | "manual";
189
+ /**
190
+ * The range that may be incomplete: the channels the server could not fully
191
+ * rebuild and the cursor positions the client jumped between (`to` is null
192
+ * when the cursor did not move). Events in that range may be missing.
193
+ */
194
+ skipped: {
195
+ channels: string[];
196
+ from: StreamCursor | null;
197
+ to: StreamCursor | null;
198
+ };
199
+ /** Bounds the server reported for this resume (max age, row caps, slack), when it sends them. */
200
+ limits: Record<string, unknown> | null;
201
+ /**
202
+ * true when this gap is retryable but the automatic re-resume budget
203
+ * (`maxResumeRetries`) is spent: the client stops asking again on this
204
+ * connection and the committed cursor stays put until the next reconnect
205
+ * resumes (or you call `acceptGap()`).
206
+ */
207
+ exhausted: boolean;
208
+ replay: StreamReplayResult;
209
+ }
210
+ /** The stream stopped and will not reconnect on its own. */
211
+ export interface StreamFatal {
212
+ code: number | null;
213
+ reason: string;
214
+ /** The unrecoverable gap that stopped it (`onUnrecoverableGap: "stop"` only). */
215
+ gap?: StreamGap;
26
216
  }
27
217
  export interface StreamClientOptions {
28
- /** Returns your stream token (the SDK wires this to getStreamToken()). Called on every
29
- * (re)connect; the token does not expire, so it returns the same value each time. */
218
+ /**
219
+ * Returns your stream token (the SDK wires this to the stream-token
220
+ * endpoint). Called on every (re)connect — including after a 4001 close,
221
+ * which is how a rotated/lapsed token gets replaced. Tokens never expire, so
222
+ * it is never called on a timer.
223
+ */
30
224
  getToken: () => Promise<StreamToken>;
31
225
  /** Reconnect automatically on drop (default: true). */
32
226
  autoReconnect?: boolean;
@@ -36,34 +230,135 @@ export interface StreamClientOptions {
36
230
  heartbeatTimeoutMs?: number;
37
231
  /** Override the WebSocket implementation (e.g. inject `ws` explicitly). */
38
232
  WebSocketImpl?: unknown;
233
+ /**
234
+ * A cursor you persisted earlier (from `getCursor()` or the `"cursor"`
235
+ * event). The first subscribe then asks the server to resume after it.
236
+ */
237
+ resume?: StreamCursor | null;
238
+ /** How many recent event ids to remember for de-duplication (default: 10000). */
239
+ dedupeSize?: number;
240
+ /** Consecutive 4001 closes (token rejected) before `"fatal"` (default: 3). */
241
+ maxAuthRetries?: number;
242
+ /** Minimum wait after a 4002 connection-limit close, in ms (default: 60000). */
243
+ connectionLimitBackoffMs?: number;
244
+ /**
245
+ * After a resume subscribe is acked, how long to wait for the server's
246
+ * `replay_start` before assuming an older server that does not understand
247
+ * `resume`, and retrying with `replay_since_seq` / `replay_since_ts`
248
+ * (default: 3000). A live event arriving first triggers the fallback at once.
249
+ */
250
+ resumeDetectMs?: number;
251
+ /** Give up waiting for a fallback replay's `replay_end` after this many ms (default: 15000). */
252
+ legacyReplayTimeoutMs?: number;
253
+ /**
254
+ * How often to resume again after a RETRYABLE gap before giving up on the
255
+ * automatic retry (default: 5). The next reconnect resumes again anyway.
256
+ */
257
+ maxResumeRetries?: number;
258
+ /** Wait before an automatic re-resume when the server names none (default: 30000 ms). */
259
+ resumeRetryDelayMs?: number;
260
+ /**
261
+ * What to do when the server reports a gap that asking again can never fill
262
+ * (`retryable: false`).
263
+ * - `"advance"` (default): report it on the `"gap"` event with
264
+ * `advancedPastGap: true` and the skipped range, commit past it and keep
265
+ * streaming. The skipped events are not delivered — backfill them from
266
+ * REST if you need them.
267
+ * - `"stop"`: do not move the cursor, stop the stream and emit `"fatal"`
268
+ * with the gap, so YOU decide. `acceptGap()` then `connect()` continues.
269
+ */
270
+ onUnrecoverableGap?: "advance" | "stop";
39
271
  }
40
- type Listener = (data: unknown, evt?: StreamEvent) => void;
272
+ type Listener = (data: unknown, evt?: StreamEvent) => unknown;
41
273
  export declare class MadeOnSolStream {
42
274
  private opts;
43
275
  private ws;
44
276
  private listeners;
45
277
  private desired;
46
278
  private closedByUser;
279
+ private stopped;
47
280
  private attempt;
281
+ private authFailures;
48
282
  private hbTimer;
49
283
  private reconnectTimer;
50
284
  private connecting;
285
+ /** Server process id of the CURRENT connection (from connected/subscribed). */
286
+ private serverInstance;
287
+ /** Whether this connection already sent its first subscribe (the only one that resumes). */
288
+ private firstSubscribeSent;
289
+ /** COMMITTED (safe) cursor — the one to persist and resume from. */
290
+ private cursor;
291
+ /** Received progress — every handled frame, including replayed ones. */
292
+ private progress;
293
+ /** true after an incomplete recovery: live frames are not committed until one completes. */
294
+ private unsafe;
295
+ private seen;
296
+ private inflight;
297
+ private recovery;
298
+ /** Automatic re-resume after a retryable gap. */
299
+ private retryTimer;
300
+ private resumeRetries;
301
+ /** The last gap reported (for acceptGap()'s report). */
302
+ private lastGap;
51
303
  constructor(opts: StreamClientOptions);
52
- /** Register a handler. Use an event name, `"*"` for every event, or a lifecycle event. */
304
+ /** Register a handler. Use an event name, `"*"` for every event, or a lifecycle event.
305
+ * An event handler may return a promise: the cursor only advances past a frame once
306
+ * every handler for it (and for every earlier frame) has settled. */
307
+ on(event: "warning", fn: (warning: StreamWarning) => unknown): this;
308
+ on(event: "cursor", fn: (cursor: StreamCursor) => unknown): this;
309
+ on(event: "replay", fn: (result: StreamReplayResult) => unknown): this;
310
+ on(event: "gap", fn: (gap: StreamGap) => unknown): this;
311
+ on(event: "fatal", fn: (fatal: StreamFatal) => unknown): this;
53
312
  on(event: StreamEventName | StreamLifecycleEvent | "*", fn: Listener): this;
54
313
  /** Remove a handler (or all handlers for an event when `fn` is omitted). */
55
- off(event: string, fn?: Listener): this;
314
+ off(event: string, fn?: (...args: never[]) => unknown): this;
315
+ /** The COMMITTED resume cursor (last safe point) — persist this one. Null before the first. */
316
+ getCursor(): StreamCursor | null;
317
+ /** Received progress: the last handled frame, replayed ones included (NOT safe to resume from). */
318
+ getProgress(): StreamCursor | null;
319
+ /** true while an incomplete recovery holds the committed cursor back. */
320
+ isRecoveryIncomplete(): boolean;
321
+ /**
322
+ * Accept the last reported gap: commit the received progress as the cursor
323
+ * and let live frames commit again. Call it after you backfilled the range
324
+ * the `"gap"` event named (or decided you do not need it). It re-reports the
325
+ * gap first, with `source: "manual"` and the range being skipped.
326
+ */
327
+ acceptGap(): void;
56
328
  private emit;
329
+ /** Call every handler for a data frame; collect what they returned (for completion tracking). */
330
+ private callHandlers;
57
331
  /** Subscribe to one or more channels (connects on first call). Optional server-side filters. */
58
332
  subscribe(channels: StreamChannel[], filters?: Record<string, unknown>): this;
59
333
  /** Stop receiving the given channels. */
60
334
  unsubscribe(channels: StreamChannel[]): this;
61
- /** Open the connection (also called implicitly by subscribe). */
335
+ /** Open the connection (also called implicitly by subscribe). Restarts a stream that went `"fatal"`. */
62
336
  connect(): Promise<void>;
63
337
  /** Close the connection and stop reconnecting. */
64
338
  close(): void;
339
+ private handleClose;
340
+ /** `onUnrecoverableGap: "stop"`: stop the stream and hand the decision to the caller. */
341
+ private haltForGap;
342
+ private fatal;
65
343
  private sendSubscribe;
344
+ /** The server did not answer `resume` (older deployment): retry with the legacy fields. */
345
+ private fallbackToLegacy;
346
+ private dropRecovery;
347
+ /**
348
+ * A retryable gap: ask the server again on this connection after its
349
+ * retry_after_ms (row_cap resumes from resume_ts_hint). Bounded — the next
350
+ * reconnect resumes anyway.
351
+ */
352
+ private scheduleResumeRetry;
353
+ private finishRecovery;
66
354
  private handleMessage;
355
+ /** Dedupe by id, hand the frame to the handlers, track completion for the cursor. */
356
+ private deliver;
357
+ private drainInflight;
358
+ /** Queue a position behind every frame still being handled (or apply it now). */
359
+ private enqueue;
360
+ /** Move `progress` (always) and the committed cursor (when `commit`) to `pos`. */
361
+ private apply;
67
362
  private scheduleReconnect;
68
363
  private resetHeartbeat;
69
364
  private clearHeartbeat;
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,qCAAqC;AACrC,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,iBAAiB,GACjB,uBAAuB,GACvB,mBAAmB,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,GACnB,aAAa,GACb,kBAAkB,GAClB,cAAc,CAAC;AAEnB,uFAAuF;AACvF,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,sBAAsB,GACtB,kBAAkB,GAClB,iBAAiB,GACjB,sBAAsB,GACtB,eAAe,GACf,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,eAAe,CAAC;AAEpB,gDAAgD;AAChD,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,OAAO,GACP,WAAW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