@pmate/chat-sdk 0.13.0-profile.10 → 0.13.0-profile.12
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 +22 -0
- package/lib/runtime/profileCoordinator.js +1 -0
- package/lib/runtime/profileMemoryStore.d.ts +4 -0
- package/lib/runtime/profileMemoryStore.js +27 -0
- package/lib/runtime/profileWindows.d.ts +2 -0
- package/lib/runtime/profileWindows.js +13 -3
- package/lib/runtime/profileWorkerClient.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -399,3 +399,25 @@ Thread assignment carries group controls and metadata, child discussions, readin
|
|
|
399
399
|
The upgrade regression starts with an obsolete cached projection containing inaccessible discussion children, a locally played voice and a failed outgoing message. It interrupts the rebuild with HTTP 503, reopens the owner, resumes the same generation and verifies group/discussion metadata, reading and the exact durable outgoing message without clearing any store. Full SDK suite: 766 passed, one production-only test skipped.
|
|
400
400
|
|
|
401
401
|
Duplicate Inbox events, registrations and already-read observations are rejected as no-op batches before opening an IndexedDB write transaction; queue and store tests verify zero transactions as well as unchanged revisions.
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
### Profile disposal (0.13.0-profile.11)
|
|
405
|
+
|
|
406
|
+
Final `ProfileCoordinator.close()` releases its UI memory entities, page caches,
|
|
407
|
+
reading indexes and subscriptions after pending startup/recovery settles. It also
|
|
408
|
+
terminates the Worker. Previously, retaining a closed coordinator retained its
|
|
409
|
+
full UI projection. Already published message/page objects remain unchanged.
|
|
410
|
+
Worker recovery keeps the same prepared UI store until its replacement snapshot
|
|
411
|
+
is validated; it must not call the final disposal path. Direct memory-store users
|
|
412
|
+
may call `dispose()` when permanently discarding that Profile. This release does
|
|
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.
|
|
@@ -48,6 +48,10 @@ export declare class ProfileMemoryStore {
|
|
|
48
48
|
private readingIndices;
|
|
49
49
|
private presentedPages;
|
|
50
50
|
constructor(onError?: (error: unknown) => void, profileId?: string);
|
|
51
|
+
/** Release a disposed Profile without mutating snapshots held by React.
|
|
52
|
+
* Worker replacement deliberately keeps this store alive; only final close
|
|
53
|
+
* may discard its entities and subscriptions. */
|
|
54
|
+
dispose(): void;
|
|
51
55
|
private notify;
|
|
52
56
|
getStatus(): {
|
|
53
57
|
phase: "ready" | "restoring";
|
|
@@ -35,6 +35,33 @@ export class ProfileMemoryStore {
|
|
|
35
35
|
this.onError = onError;
|
|
36
36
|
this.profileId = profileId;
|
|
37
37
|
}
|
|
38
|
+
/** Release a disposed Profile without mutating snapshots held by React.
|
|
39
|
+
* Worker replacement deliberately keeps this store alive; only final close
|
|
40
|
+
* may discard its entities and subscriptions. */
|
|
41
|
+
dispose() {
|
|
42
|
+
this.windowRows.clear();
|
|
43
|
+
this.messageWindows.clear();
|
|
44
|
+
this.windowPages.clear();
|
|
45
|
+
this.windowAccess.clear();
|
|
46
|
+
this.windowIds.clear();
|
|
47
|
+
this.windowListeners.clear();
|
|
48
|
+
this.windowListListeners.clear();
|
|
49
|
+
this.dirtyWindows.clear();
|
|
50
|
+
this.entities.clear();
|
|
51
|
+
this.threads.clear();
|
|
52
|
+
this.directories.clear();
|
|
53
|
+
this.listeners.clear();
|
|
54
|
+
this.listListeners.clear();
|
|
55
|
+
this.messageListeners.clear();
|
|
56
|
+
this.pageCache.clear();
|
|
57
|
+
this.epochs.clear();
|
|
58
|
+
this.presented.clear();
|
|
59
|
+
this.readingIndices.clear();
|
|
60
|
+
this.presentedPages = new WeakMap();
|
|
61
|
+
this.list = [];
|
|
62
|
+
this.current = undefined;
|
|
63
|
+
this.phase = "restoring";
|
|
64
|
+
}
|
|
38
65
|
notify(listener) { try {
|
|
39
66
|
listener();
|
|
40
67
|
}
|
|
@@ -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