@pmate/chat-sdk 0.13.0-profile.12 → 0.13.0-profile.13

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 CHANGED
@@ -421,3 +421,12 @@ now indexes only nonempty blocks. Reading a small page no longer walks interveni
421
421
  empty block contents. A 10,002-Window regression with only two populated blocks
422
422
  checks older/newer anchors, retained block identities and forked directories.
423
423
  No storage schema or Window merge behavior changes.
424
+
425
+
426
+ ### Empty Window display directory (0.13.0-profile.13)
427
+
428
+ Prepared `getWindowIds()` now returns only nonempty display blocks. Durable empty
429
+ sealed Windows still retain their identities and remain directly readable for
430
+ historical routing; they no longer consume load-older steps. Empty/refilled
431
+ transitions notify Window-list subscribers. Message-only changes retain the same
432
+ published ID array, and previously published arrays stay unchanged.
@@ -32,6 +32,7 @@ export declare class ProfileMemoryStore {
32
32
  private windowListeners;
33
33
  private windowListListeners;
34
34
  private dirtyWindows;
35
+ private dirtyWindowLists;
35
36
  private readonly emptyWindowIds;
36
37
  private current?;
37
38
  private entities;
@@ -16,6 +16,7 @@ export class ProfileMemoryStore {
16
16
  windowListeners = new Map();
17
17
  windowListListeners = new Map();
18
18
  dirtyWindows = new Set();
19
+ dirtyWindowLists = new Set();
19
20
  emptyWindowIds = [];
20
21
  current;
21
22
  entities = new Map();
@@ -47,6 +48,7 @@ export class ProfileMemoryStore {
47
48
  this.windowListeners.clear();
48
49
  this.windowListListeners.clear();
49
50
  this.dirtyWindows.clear();
51
+ this.dirtyWindowLists.clear();
50
52
  this.entities.clear();
51
53
  this.threads.clear();
52
54
  this.directories.clear();
@@ -100,6 +102,9 @@ export class ProfileMemoryStore {
100
102
  windowKey(threadId, windowId) { return JSON.stringify([threadId, windowId]); }
101
103
  installWindow(window) {
102
104
  const key = this.windowKey(window.threadId, window.windowId);
105
+ const previous = this.windowRows.get(key);
106
+ if (!previous || (previous.count === 0) !== (window.count === 0))
107
+ this.dirtyWindowLists.add(window.threadId);
103
108
  for (const ref of this.windowRows.get(key)?.refs ?? [])
104
109
  if (this.messageWindows.get(ref.messageId) === key)
105
110
  this.messageWindows.delete(ref.messageId);
@@ -350,12 +355,16 @@ export class ProfileMemoryStore {
350
355
  for (const threadId of affected) {
351
356
  const blocks = this.directories.get(threadId)?.blocks ?? [];
352
357
  const previous = this.windowIds.get(threadId);
353
- // Window sequence and IDs never shift on body/reading updates. Only a
354
- // newly appended block or a full restoration changes this directory.
355
- if (!previous || previous.length !== blocks.length) {
356
- this.windowIds.set(threadId, blocks.map(window => window.windowId));
357
- changedLists.add(threadId);
358
+ // Durable empty blocks keep their IDs and routing boundaries, but are
359
+ // omitted from the display directory. Entity-only updates keep its array.
360
+ if (!previous || this.dirtyWindowLists.has(threadId)) {
361
+ const ids = blocks.filter(window => window.count > 0).map(window => window.windowId);
362
+ if (!previous || ids.length !== previous.length || ids.some((id, index) => id !== previous[index])) {
363
+ this.windowIds.set(threadId, ids);
364
+ changedLists.add(threadId);
365
+ }
358
366
  }
367
+ this.dirtyWindowLists.delete(threadId);
359
368
  const available = this.isThreadAvailable(threadId);
360
369
  if (this.windowAccess.get(threadId) !== available) {
361
370
  this.windowAccess.set(threadId, available);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.13.0-profile.12",
3
+ "version": "0.13.0-profile.13",
4
4
  "description": "Local-first chat SDK, message subscriptions, reading state, and shared chat UI primitives",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",