@voltro/client 0.62.0 → 0.62.2

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/CHANGELOG.md CHANGED
@@ -39,6 +39,41 @@ _Changes staged for the next release accumulate here (rolled up from
39
39
 
40
40
  ---
41
41
 
42
+ ## [0.62.2] — 2026-09-03
43
+
44
+ ### Added
45
+
46
+ - **@voltro/client, @voltro/web, @voltro/runtime, @voltro/cli, @voltro/devtools, @voltro/workflow** — Reconnect incidents now have one bounded, payload-free evidence path: browser diagnostics retain runtime/socket/protocol/subscription transitions across a reload, the subscriptions panel exposes recovery progress and stuck re-issues, and `voltro support collect` joins that export to inspect snapshots and exact browser-to-replica socket ids. The opt-in browser fault harness can reproduce a bounded transport cut without a proxy; logs and traces remain excluded from the support bundle unless explicitly requested.
47
+
48
+ Workflow admission rows now retain queue-time app/schema provenance. `voltro workflows flow validate` checks queued payloads against the current release without returning them, while `flow retry <intentId>` re-arms one retained dead letter after its fix. Support bundles also inventory project `conflictColumns` callsites, and `voltro support sentry <eventId>` delegates source-map resolution diagnosis to Sentry's own CLI.
49
+ - **@voltro/runtime** — Successful rpc WebSocket upgrades now emit structured open and close records carrying the serving `replicaId` and a stable per-socket `connectionId`, so connection cuts can be correlated to an api replica without debug traffic.
50
+
51
+ ### Fixed
52
+
53
+ - **@voltro/client, @voltro/web, @voltro/react-native** — Subscription recovery now re-issues transport-failed active subscriptions only after the rpc protocol has cleared the previous socket error. A longer outage could previously reopen the WebSocket, immediately reject every re-issued subscription against the stale error, and leave the screen degraded until a reload.
54
+ - **@voltro/workflow, @voltro/cli, @voltro/devtools-ui** — Queued workflow starts whose stored payload no longer decodes now signal `onFailure` once and remain visible as dead-letter intents instead of retrying forever. Inspect or remove them with `voltro workflows flow` and `voltro workflows flow discard <intentId>`; a valid later debounce arrival for the same key replaces the obsolete payload and resumes normal draining.
55
+
56
+ ---
57
+
58
+ ## [0.62.1] — 2026-09-02
59
+
60
+ ### Fixed
61
+
62
+ - **@voltro/client, @voltro/web, @voltro/react-native** — `useSubscriptionHealth` now clears failures when replacement subscriptions succeed after a reconnect; each api keeps one error bus across transport, auth-refresh, and subject-reconnect generations.
63
+ - **@voltro/client, @voltro/web, @voltro/react-native** — Active subscriptions whose fibers ended in a transport failure are now re-issued when the rpc socket opens again, preserving their last rows and resume revision; `useConnectionStatus` stays degraded until every affected subscription delivers a later snapshot or delta.
64
+
65
+ **Correction:** In 0.62.1 that reissue runs on the raw WebSocket `open`, before
66
+ the rpc protocol clears the previous socket error. After a longer outage the
67
+ reissued fibers can therefore fail immediately and remain terminal. The next
68
+ patch moves recovery behind the protocol-ready `onOpen` effect.
69
+
70
+ ### Internal (no consumer-facing effect)
71
+
72
+ - **@voltro/local-first** — Release dependency floors now exclude the vulnerable `fast-uri` and `@xmldom/xmldom` ranges, and the local-first test toolchain uses the patched Tiptap release.
73
+ - **@voltro/cli** — The source-map Debug-ID regression test now resolves the installed `sentry-cli` executable through the package entry instead of assuming a pnpm-internal binary layout.
74
+
75
+ ---
76
+
42
77
  ## [0.62.0] — 2026-09-01
43
78
 
44
79
  ### ⚠ BREAKING
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import { RpcClient } from '@effect/rpc';
14
14
  import { RpcClientError } from '@effect/rpc';
15
15
  import { RpcGroup } from '@effect/rpc';
16
16
  import { Schema } from 'effect';
17
+ import * as Socket from '@effect/platform/Socket';
17
18
  import { Stream } from 'effect';
18
19
  import { SubscriptionEvent } from '@voltro/protocol';
19
20
  import { TargetRelations } from '@voltro/protocol';
@@ -334,14 +335,19 @@ export declare interface AutoApplyTarget {
334
335
  * different thing and is safe: see `SubscriptionCache.seedStaleFrom`, which
335
336
  * copies rows (never fibers) and is gated by the caller to same-subject swaps.
336
337
  *
337
- * Rejects if the runtime fails to resolve the client (e.g. the socket never
338
- * opens); the caller's reconnect logic decides what to do with that.
338
+ * Resolving this function means the rpc client exists; it does NOT prove the
339
+ * background socket loop has opened. Active subscription fibers that fail
340
+ * before a later `open` are resumed by the cache after the rpc protocol has
341
+ * cleared the previous transport error and marked that socket send-capable.
342
+ * Construction failures still reject and are left to the caller's supervisor.
339
343
  */
340
344
  export declare const buildApiRuntime: (options: BuildApiRuntimeOptions) => Promise<BuiltApiRuntime>;
341
345
 
342
346
  export declare interface BuildApiRuntimeOptions {
343
347
  /** Stable api name — used only to tag the client's Context. */
344
348
  readonly name: string;
349
+ /** Supervisor transport generation; 0 for a standalone runtime. */
350
+ readonly generation?: number;
345
351
  /** WebSocket URL of the api (`ws(s)://host:port/ws`). */
346
352
  readonly wsUrl: string;
347
353
  /**
@@ -362,9 +368,18 @@ export declare interface BuildApiRuntimeOptions {
362
368
  * tracking + a connect-timeout; RN passes a plain `globalThis.WebSocket`.
363
369
  * Injected so this module touches no environment global directly. */
364
370
  readonly webSocketConstructor: (url: string, protocols?: string | ReadonlyArray<string>) => globalThis.WebSocket;
371
+ /**
372
+ * Error channel owned by the logical api mount. A reconnect supervisor passes
373
+ * the SAME instance to every transport generation so a failure emitted by the
374
+ * outgoing socket can be cleared by a success from the replacement socket.
375
+ * Omit only when building a standalone, unsupervised runtime.
376
+ */
377
+ readonly errorBus?: RpcErrorBus;
365
378
  }
366
379
 
367
- export declare type BuildClient = (api: MountedApi, generation: number, onSocketOpen: () => void, onSocketIssue: (kind: SocketIssueKind) => void) => Promise<ResolvedClient>;
380
+ export declare type BuildClient = (api: MountedApi, generation: number, onSocketOpen: () => void, onSocketIssue: (kind: SocketIssueKind) => void,
381
+ /** Stable for this logical api across every transport generation. */
382
+ errorBus?: RpcErrorBus) => Promise<ResolvedClient>;
368
383
 
369
384
  /** The transport-level pieces of one api's client stack. Combined with the
370
385
  * api's descriptor map + inspect base URL, this is an `ApiHandle`. */
@@ -387,6 +402,16 @@ declare interface CacheEntry {
387
402
  subscribers: Set<() => void>;
388
403
  /** Fiber running the underlying stream. */
389
404
  fiber: Fiber.RuntimeFiber<unknown, unknown> | null;
405
+ /** The last fiber ended because the rpc transport failed. A later socket
406
+ * `open` re-issues active entries with their last-known-good base intact. */
407
+ resumeAfterTransportOpen: boolean;
408
+ recoveryPhase: 'steady' | 'awaiting-protocol' | 'awaiting-delivery' | 'stuck';
409
+ recoveryAttempt: number;
410
+ lastTransportFailureAt: number | undefined;
411
+ lastReissueAt: number | undefined;
412
+ lastDeliveryAt: number | undefined;
413
+ recoveryBasePreserved: boolean;
414
+ recoveryTimer: ReturnType<typeof setTimeout> | null;
390
415
  /** Pending eviction (last subscriber gone, TTL countdown). */
391
416
  evictionTimer: NodeJS.Timeout | null;
392
417
  /** Source table(s) this entry reads (from the rpc descriptor). Used by
@@ -434,6 +459,15 @@ export declare interface CacheEntrySnapshot {
434
459
  /** True after the last subscriber left and the eviction TTL is
435
460
  * counting down — a quick remount within the window resurrects. */
436
461
  readonly evicting: boolean;
462
+ /** Recovery of a transport-terminal stream, without exposing its input. */
463
+ readonly recovery: {
464
+ readonly phase: 'steady' | 'awaiting-protocol' | 'awaiting-delivery' | 'stuck';
465
+ readonly attempt: number;
466
+ readonly lastTransportFailureAt: number | undefined;
467
+ readonly lastReissueAt: number | undefined;
468
+ readonly lastDeliveryAt: number | undefined;
469
+ readonly basePreserved: boolean;
470
+ };
437
471
  readonly snapshot: CacheSnapshot<unknown>;
438
472
  }
439
473
 
@@ -546,6 +580,8 @@ export declare interface CapabilityTable {
546
580
  readonly editable?: boolean;
547
581
  }
548
582
 
583
+ export declare const clearClientDiagnostics: () => void;
584
+
549
585
  /** Clear the buffer (devtools "Clear" button). */
550
586
  export declare const clearMutations: () => void;
551
587
 
@@ -571,6 +607,36 @@ export declare const CLIENT_NAME: "framework-client";
571
607
  */
572
608
  export declare type ClientDescriptorMap = Readonly<Record<string, ClientDescriptor>>;
573
609
 
610
+ export declare interface ClientDiagnosticEvent {
611
+ readonly sequence: number;
612
+ readonly at: number;
613
+ readonly elapsedMs: number;
614
+ readonly api: string;
615
+ readonly kind: ClientDiagnosticKind;
616
+ readonly fields: Readonly<Record<string, ClientDiagnosticValue>>;
617
+ }
618
+
619
+ export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.health-cleared' | 'connection.status' | 'fault.transport-cut';
620
+
621
+ export declare interface ClientDiagnosticsSnapshot {
622
+ readonly version: 1;
623
+ readonly generatedAt: number;
624
+ readonly sessionStartedAt: number;
625
+ readonly persisted: boolean;
626
+ readonly dropped: number;
627
+ readonly events: ReadonlyArray<ClientDiagnosticEvent>;
628
+ }
629
+
630
+ export declare const clientDiagnosticsSnapshot: (api?: string) => ClientDiagnosticsSnapshot;
631
+
632
+ export declare interface ClientDiagnosticsStorage {
633
+ getItem(key: string): string | null;
634
+ setItem(key: string, value: string): void;
635
+ removeItem(key: string): void;
636
+ }
637
+
638
+ export declare type ClientDiagnosticValue = string | number | boolean | null;
639
+
574
640
  export declare interface ClientErrorEvent {
575
641
  /** The thrown value (Error | anything). */
576
642
  readonly error: unknown;
@@ -686,10 +752,12 @@ export declare interface ConnectionState {
686
752
  readonly status: ConnectionStatus;
687
753
  /** `navigator.onLine` (true during SSR — nothing better is knowable there). */
688
754
  readonly online: boolean;
689
- /** Consecutive transport failures with no server response or rpc success in between. */
755
+ /** Transport failures not yet cleared by recovery evidence. */
690
756
  readonly failureCount: number;
691
757
  /** When the most recent failure was observed. */
692
758
  readonly lastFailureAt: number | undefined;
759
+ /** Subscription tags still waiting for their own post-reconnect delivery. */
760
+ readonly failedSubscriptions: ReadonlyArray<string>;
693
761
  }
694
762
 
695
763
  export declare type ConnectionStatus = 'connected' | 'degraded' | 'offline';
@@ -836,6 +904,8 @@ export declare const defineTracking: <P = Record<string, unknown>>(name: string,
836
904
  */
837
905
  export declare const deriveEntityAdmins: (manifest: CapabilityManifest) => ReadonlyArray<EntityAdminSpec>;
838
906
 
907
+ export declare const disableClientDiagnosticsPersistence: () => void;
908
+
839
909
  /** The document's locale per the framework contract (`<html lang>`); `'en'`
840
910
  * outside a browser. Primary subtag only (`de-AT` → `de`). */
841
911
  export declare const documentLocale: () => string;
@@ -843,6 +913,13 @@ export declare const documentLocale: () => string;
843
913
  /** The empty value — what an unfilled rich-text field holds. */
844
914
  export declare const emptyRichTextDocument: RichTextDocument;
845
915
 
916
+ /**
917
+ * Persist diagnostics for the current browser session. Calling this more than
918
+ * once is safe. Previously persisted events are loaded before current-memory
919
+ * events and de-duplicated by sequence.
920
+ */
921
+ export declare const enableClientDiagnosticsPersistence: (storage: ClientDiagnosticsStorage) => void;
922
+
846
923
  export declare const enqueueEntry: (queue: Outbox, id: string, tag: string, input: unknown) => Outbox;
847
924
 
848
925
  /**
@@ -1940,6 +2017,9 @@ export declare const readPreloadedSeedOutcome: (api: string, rpcTag: string, inp
1940
2017
  */
1941
2018
  export declare const readPreloadedSnapshot: (api: string, rpcTag: string, input: Readonly<Record<string, unknown>>) => unknown;
1942
2019
 
2020
+ /** Record one payload-free transition. Safe to call on every production path. */
2021
+ export declare const recordClientDiagnostic: (api: string, kind: ClientDiagnosticKind, fields?: Readonly<Record<string, ClientDiagnosticValue | undefined>>) => ClientDiagnosticEvent;
2022
+
1943
2023
  export declare interface RecordState<R> {
1944
2024
  readonly record: R | undefined;
1945
2025
  readonly loading: boolean;
@@ -3037,6 +3117,8 @@ export declare interface StoreUseOptions<T> {
3037
3117
  readonly retain?: boolean;
3038
3118
  }
3039
3119
 
3120
+ export declare const subscribeClientDiagnostics: (listener: () => void) => (() => void);
3121
+
3040
3122
  /** Subscribe to client errors. Returns an unsubscribe fn. */
3041
3123
  export declare const subscribeClientErrors: (listener: ClientErrorListener) => (() => void);
3042
3124
 
@@ -3055,16 +3137,20 @@ export declare class SubscriptionCache {
3055
3137
  private readonly errorBus;
3056
3138
  private readonly mirror;
3057
3139
  private readonly mergeCell;
3140
+ private readonly apiName;
3141
+ private readonly recoveryStuckMs;
3058
3142
  constructor(options?: SubscriptionCacheOptions);
3143
+ private diagnose;
3059
3144
  /**
3060
3145
  * Register a subscriber. The cache forks the underlying fiber on the
3061
3146
  * first subscriber and re-uses it for the rest. Returns the snapshot
3062
3147
  * getter, the per-subscriber notify-on-change hook, and an unsubscribe
3063
3148
  * function.
3064
3149
  *
3065
- * `fetch` is invoked at most once per cache-entry lifetime (it builds
3066
- * the Effect Stream against the runtime). Subsequent subscribers piggy-
3067
- * back on the same stream.
3150
+ * `fetch` is invoked once per live stream attempt (it builds the Effect
3151
+ * Stream against the runtime). Concurrent subscribers piggy-back on that
3152
+ * stream; a transport recovery may invoke it again to replace the terminal
3153
+ * fiber left by the failed socket.
3068
3154
  */
3069
3155
  subscribe(keyArr: ReadonlyArray<unknown>, fetch: () => Stream.Stream<SubscriptionEvent<unknown>, unknown, never>, runtime: AnyRuntime, onChange: () => void, options?: {
3070
3156
  readonly source?: string | ReadonlyArray<string>;
@@ -3205,6 +3291,7 @@ export declare class SubscriptionCache {
3205
3291
  * promote naturally on their next subscriber.
3206
3292
  */
3207
3293
  refreshAll(runtime: AnyRuntime): void;
3294
+ /* Excluded from this release type: resumeTransportFailures */
3208
3295
  /**
3209
3296
  * Re-issue ONE entry's subscription: interrupt the fiber, reset the base,
3210
3297
  * re-fork through the saved `fetch`.
@@ -3290,6 +3377,10 @@ export declare interface SubscriptionCacheOptions {
3290
3377
  * cache reports it to the bus so global listeners (e.g. auto-logout
3291
3378
  * on Unauthenticated) can react. */
3292
3379
  readonly errorBus?: RpcErrorBus;
3380
+ /** Logical api name for payload-free diagnostics. Omit for standalone caches. */
3381
+ readonly apiName?: string;
3382
+ /** Time after a transport reissue with no delivery before one stuck event. */
3383
+ readonly recoveryStuckMs?: number;
3293
3384
  }
3294
3385
 
3295
3386
  /**
@@ -3567,6 +3658,12 @@ export declare interface SupervisorHandle {
3567
3658
  export declare interface SupervisorOptions {
3568
3659
  readonly apis: ReadonlyArray<MountedApi>;
3569
3660
  readonly buildClient: BuildClient;
3661
+ /**
3662
+ * Resolve the bus owned by an api mount. Hosts whose supervisor can be
3663
+ * recreated while the provider stays mounted supply a provider-scoped bus;
3664
+ * otherwise the supervisor creates one bus per api slot.
3665
+ */
3666
+ readonly errorBusFor?: (apiName: string) => RpcErrorBus;
3570
3667
  /**
3571
3668
  * Called whenever the resolved-clients map changes (initial resolve,
3572
3669
  * reconnect swap, api removed). The React layer mirrors this into
@@ -3941,10 +4038,11 @@ export declare const useConnections: (apiName: string) => ConnectedAccountsContr
3941
4038
  * {status !== 'connected' && <OfflineBanner status={status} />}
3942
4039
  * ```
3943
4040
  *
3944
- * `degraded` clears as soon as any rpc on that api succeeds or returns a
3945
- * declared handler failure — both prove a server round trip. Call
3946
- * `reportSuccess()` when another signal proves reachability (the hook also
3947
- * clears when the browser comes back online).
4041
+ * `degraded` clears after a server round trip, except that every subscription
4042
+ * which failed with `kind: 'transport'` must deliver its own later snapshot.
4043
+ * An unrelated action cannot declare a dead screen healthy. Call
4044
+ * `reportSuccess()` when another signal proves reachability; it likewise does
4045
+ * not override outstanding subscription failures.
3948
4046
  */
3949
4047
  export declare const useConnectionStatus: (apiName: string) => ConnectionState & {
3950
4048
  /** Clear the degraded state — call after a known-good round trip. */
@@ -4337,7 +4435,8 @@ export declare function useSubscription<T = unknown>(apiName: string, rpcTag: st
4337
4435
  * A tag enters the list when a call for it fails and LEAVES it when a call for
4338
4436
  * the same tag succeeds — keyed by tag rather than counted, because the
4339
4437
  * question a screen asks is "is this working now", and two failures of one tag
4340
- * are one broken thing.
4438
+ * are one broken thing. The api owns this history across reconnects: a success
4439
+ * from a replacement client removes a failure emitted by the outgoing client.
4341
4440
  *
4342
4441
  * const { healthy, failed } = useSubscriptionHealth('app')
4343
4442
  * if (!healthy) return <Banner tags={failed.map((f) => f.tag)} />
@@ -4555,6 +4654,8 @@ export declare type WithOptimistic<T> = T extends ReadonlyArray<infer Element> ?
4555
4654
  readonly optimistic?: boolean;
4556
4655
  } : Element> : T;
4557
4656
 
4657
+ /* Excluded from this release type: withProtocolOpenRecovery */
4658
+
4558
4659
  export declare interface WorkflowClientMessages {
4559
4660
  readonly signals?: Readonly<Record<string, unknown>>;
4560
4661
  readonly updates?: Readonly<Record<string, {