@ikonai/sdk-ui 1.0.80 → 1.1.1

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.
@@ -41,6 +41,11 @@ export interface LiveSnapshotState {
41
41
  * The key embeds the user id, and sibling keys for other users of the same app are pruned on
42
42
  * construction so a shared device never paints one user's UI for another. A missing user id
43
43
  * disables the live snapshot rather than falling back to a shared key.
44
+ *
45
+ * The snapshot is bound to the server instance it was captured from (see
46
+ * {@link setServerSessionId}): it only resumes when the next connection lands on that same
47
+ * instance, and a server-signaled shutdown ({@link handleServerShutdown}) clears it and stops
48
+ * capture — a dead instance's UI must never be painted as if it were alive.
44
49
  */
45
50
  export declare class LiveSnapshotCache {
46
51
  private readonly key;
@@ -52,10 +57,28 @@ export declare class LiveSnapshotCache {
52
57
  private readonly debounceMs;
53
58
  private writeTimer;
54
59
  private pending;
60
+ private serverSessionId;
61
+ private suppressed;
55
62
  /** Remove every stored live snapshot (all apps and users) from localStorage. Call on logout. */
56
63
  static clearAll(): void;
57
64
  constructor(config: LiveSnapshotConfig);
58
65
  load(): LiveSnapshotState | null;
66
+ /**
67
+ * Record the session id of the server instance the client is now connected to. Future writes
68
+ * are stamped with it, and a stored envelope captured against a DIFFERENT instance is removed:
69
+ * that UI can never resume, so seeding it on the next load would paint a dead-looking page.
70
+ * Called on every 'connected' transition — a soft reconnect (same instance) keeps the envelope,
71
+ * a re-authentication that lands on a new instance drops it. An envelope with no stamp (older
72
+ * schema, or captured before the id was known) is treated as stale.
73
+ */
74
+ setServerSessionId(serverSessionId: string): void;
75
+ /**
76
+ * The server signaled shutdown: the stored envelope depicts an instance that is going away, so
77
+ * a return visit must never paint it. Removes the stored snapshot, drops any pending write, and
78
+ * suppresses all further capture for the rest of this cache's lifetime — after this call
79
+ * localStorage deterministically holds no live snapshot for this app/user.
80
+ */
81
+ handleServerShutdown(): void;
59
82
  /**
60
83
  * Schedule a throttled write of the current UI state (at most one write per window, captured at
61
84
  * the trailing edge). Streams with no root are skipped. The actual write runs at idle time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk-ui",
3
- "version": "1.0.80",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,4 +1,4 @@
1
- import { UIUpdate } from '../../../shared/protocol/src/index.ts';
1
+ import { UIUpdate } from '../shared/protocol/src/index.ts';
2
2
  import { ParsedUiUpdate } from './ui-types';
3
3
  export declare class UiUpdateParseError extends Error {
4
4
  readonly causeError?: unknown | undefined;
package/ui-store-ops.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { UIPayload } from '../../../shared/protocol/src/index.ts';
1
+ import { UIPayload } from '../shared/protocol/src/index.ts';
2
2
  import { UiNode } from './ui-types';
3
3
  export interface UiStreamSnapshotWire {
4
4
  streamId: string;
package/ui-types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { UIPayload } from '../../../shared/protocol/src/index.ts';
1
+ import { UIPayload } from '../shared/protocol/src/index.ts';
2
2
  export type UiUpdateType = 'full' | 'diff';
3
3
  export type UiNodeProps = Record<string, unknown>;
4
4
  export interface UiNode {
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;