@pmate/chat-sdk 0.13.0-profile.11 → 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
|
@@ -411,3 +411,22 @@ Worker recovery keeps the same prepared UI store until its replacement snapshot
|
|
|
411
411
|
is validated; it must not call the final disposal path. Direct memory-store users
|
|
412
412
|
may call `dispose()` when permanently discarding that Profile. This release does
|
|
413
413
|
not claim that process RSS immediately falls or resolve all recovery peak memory.
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
### Sparse Window paging (0.13.0-profile.12)
|
|
417
|
+
|
|
418
|
+
Organizing messages may leave many empty sealed Windows. Their identities and
|
|
419
|
+
historical routing boundaries remain durable, while the in-memory page directory
|
|
420
|
+
now indexes only nonempty blocks. Reading a small page no longer walks intervening
|
|
421
|
+
empty block contents. A 10,002-Window regression with only two populated blocks
|
|
422
|
+
checks older/newer anchors, retained block identities and forked directories.
|
|
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.
|
|
@@ -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
|
-
//
|
|
354
|
-
//
|
|
355
|
-
if (!previous ||
|
|
356
|
-
|
|
357
|
-
|
|
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);
|
|
@@ -15,6 +15,8 @@ export declare class ProfileWindowDirectory {
|
|
|
15
15
|
private baseLookup?;
|
|
16
16
|
private removed;
|
|
17
17
|
private offsets;
|
|
18
|
+
private pageWindows;
|
|
19
|
+
private pageOffsets;
|
|
18
20
|
private size;
|
|
19
21
|
constructor(generation: string, threadId: string, windows?: readonly ProfileWindow[]);
|
|
20
22
|
get count(): number;
|
|
@@ -28,6 +28,8 @@ export class ProfileWindowDirectory {
|
|
|
28
28
|
baseLookup;
|
|
29
29
|
removed = new Set();
|
|
30
30
|
offsets = [];
|
|
31
|
+
pageWindows = [];
|
|
32
|
+
pageOffsets = [];
|
|
31
33
|
size = 0;
|
|
32
34
|
constructor(generation, threadId, windows = []) {
|
|
33
35
|
this.generation = generation;
|
|
@@ -138,8 +140,14 @@ export class ProfileWindowDirectory {
|
|
|
138
140
|
reindex() {
|
|
139
141
|
this.size = 0;
|
|
140
142
|
this.offsets = [];
|
|
143
|
+
this.pageWindows = [];
|
|
144
|
+
this.pageOffsets = [];
|
|
141
145
|
for (const window of this.windows) {
|
|
142
146
|
this.offsets.push(this.size);
|
|
147
|
+
if (window.refs.length) {
|
|
148
|
+
this.pageWindows.push(window);
|
|
149
|
+
this.pageOffsets.push(this.size);
|
|
150
|
+
}
|
|
143
151
|
this.size += window.refs.length;
|
|
144
152
|
}
|
|
145
153
|
}
|
|
@@ -163,10 +171,12 @@ export class ProfileWindowDirectory {
|
|
|
163
171
|
const end = direction === "older" ? position : Math.min(this.size, start + limit);
|
|
164
172
|
if (start >= end)
|
|
165
173
|
return [];
|
|
166
|
-
|
|
174
|
+
// Empty sealed blocks keep historical routing boundaries, but must not
|
|
175
|
+
// turn a small page into a scan across all previously organized windows.
|
|
176
|
+
let block = Math.max(0, lowerBound(this.pageOffsets, offset => offset - (start + 1)) - 1);
|
|
167
177
|
const result = [];
|
|
168
|
-
while (block < this.
|
|
169
|
-
const offset = this.
|
|
178
|
+
while (block < this.pageWindows.length && this.pageOffsets[block] < end) {
|
|
179
|
+
const offset = this.pageOffsets[block], refs = this.pageWindows[block].refs;
|
|
170
180
|
result.push(...refs.slice(Math.max(0, start - offset), Math.min(refs.length, end - offset)));
|
|
171
181
|
block++;
|
|
172
182
|
}
|
package/package.json
CHANGED