dsh-plugin-inspiration-workbench 0.9.0 → 0.10.0
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/lib/client.js +16 -4
- package/lib/client.js.map +2 -2
- package/package.json +1 -1
- package/src/client/board.js +16 -1
- package/src/client/sessions.js +12 -3
package/package.json
CHANGED
package/src/client/board.js
CHANGED
|
@@ -29,6 +29,8 @@ function formatElapsed(ms) {
|
|
|
29
29
|
return Math.floor(seconds / 60) + 'm' + String(seconds % 60).padStart(2, '0') + 's';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
|
|
33
|
+
|
|
32
34
|
export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
33
35
|
const { appendMarkdownLite } = createMarkdown({ t });
|
|
34
36
|
const state = {
|
|
@@ -1903,6 +1905,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
1903
1905
|
}
|
|
1904
1906
|
|
|
1905
1907
|
function markDirty(card) {
|
|
1908
|
+
hydratePending = false;
|
|
1906
1909
|
if (disposed) return;
|
|
1907
1910
|
dirty.add(card);
|
|
1908
1911
|
if (frame) return;
|
|
@@ -2666,6 +2669,7 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2666
2669
|
|
|
2667
2670
|
function save() {
|
|
2668
2671
|
if (disposed || suppressSave) return;
|
|
2672
|
+
if (hydratePending) return;
|
|
2669
2673
|
try {
|
|
2670
2674
|
const payload = layoutPayload();
|
|
2671
2675
|
localUpdatedAt = payload.updatedAt;
|
|
@@ -2694,8 +2698,16 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2694
2698
|
}
|
|
2695
2699
|
approvals?.setEnabled?.(state.settings.inlineApprovals);
|
|
2696
2700
|
if (!saved || !Array.isArray(saved.cards)) {
|
|
2701
|
+
hydratePending = true;
|
|
2697
2702
|
syncApprovalSessions();
|
|
2698
|
-
void syncFromRemote().then(() =>
|
|
2703
|
+
void syncFromRemote().then((applied) => {
|
|
2704
|
+
hydratePending = false;
|
|
2705
|
+
if (!applied && !saveTimer) {
|
|
2706
|
+
// Host had nothing (or was unreachable): the empty board is legitimately
|
|
2707
|
+
// ours now, so the next interaction may persist it.
|
|
2708
|
+
}
|
|
2709
|
+
startRemoteSync();
|
|
2710
|
+
});
|
|
2699
2711
|
void loadCanvases();
|
|
2700
2712
|
return false;
|
|
2701
2713
|
}
|
|
@@ -2841,6 +2853,9 @@ export function createBoard({ host, adapter, approvals, t, onOpenSession }) {
|
|
|
2841
2853
|
let interactionActive = false;
|
|
2842
2854
|
let remoteRev = 0;
|
|
2843
2855
|
let localUpdatedAt = 0;
|
|
2856
|
+
// True between "no local cache" and the first Host sync: saving in that window
|
|
2857
|
+
// would push an empty board over the Host copy (real data loss).
|
|
2858
|
+
let hydratePending = false;
|
|
2844
2859
|
let applyingRemote = false;
|
|
2845
2860
|
let firstRemoteSync = true;
|
|
2846
2861
|
// Own writes echo back over the event stream; the id lets us ignore them so a
|
package/src/client/sessions.js
CHANGED
|
@@ -221,6 +221,8 @@ function noticeOfTurnEnd(reason) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/** Fold one loaded event window into flat transcript items. */
|
|
224
|
+
|
|
225
|
+
|
|
224
226
|
function fold(entries) {
|
|
225
227
|
const items = [];
|
|
226
228
|
const tools = new Map();
|
|
@@ -373,9 +375,14 @@ function fold(entries) {
|
|
|
373
375
|
// process row at the tail of its turn. The native conversation renders
|
|
374
376
|
// [user bubble] → [process row] → [reply], so anchor each row right after the
|
|
375
377
|
// last user message that precedes its own turn's first content.
|
|
378
|
+
// Each process row is moved at most once. Moving one row shifts the others,
|
|
379
|
+
// and recomputing an anchor after every move used to bounce the same row
|
|
380
|
+
// between two slots forever on long, steered transcripts (host freeze).
|
|
381
|
+
const placed = new Set();
|
|
376
382
|
for (let index = 0; index < items.length; index += 1) {
|
|
377
383
|
const entry = items[index];
|
|
378
|
-
if (entry.k !== 'turnProcess') continue;
|
|
384
|
+
if (entry.k !== 'turnProcess' || placed.has(entry)) continue;
|
|
385
|
+
placed.add(entry);
|
|
379
386
|
const first = items.findIndex((candidate) => candidate.k !== 'turnProcess' && candidate.turn === entry.turn);
|
|
380
387
|
if (first < 0) continue;
|
|
381
388
|
let anchor = first;
|
|
@@ -387,8 +394,10 @@ function fold(entries) {
|
|
|
387
394
|
}
|
|
388
395
|
if (anchor === index) continue;
|
|
389
396
|
items.splice(index, 1);
|
|
390
|
-
|
|
391
|
-
|
|
397
|
+
const insertAt = index < anchor ? anchor - 1 : anchor;
|
|
398
|
+
items.splice(insertAt, 0, entry);
|
|
399
|
+
// Resume scanning from the row we just placed; do not jump backwards past it.
|
|
400
|
+
index = Math.max(index, insertAt);
|
|
392
401
|
}
|
|
393
402
|
|
|
394
403
|
const truncated = items.length > MAX_ITEMS;
|