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 CHANGED
@@ -4240,6 +4240,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4240
4240
  saveSoon();
4241
4241
  }
4242
4242
  function markDirty(card) {
4243
+ hydratePending = false;
4243
4244
  if (disposed) return;
4244
4245
  dirty.add(card);
4245
4246
  if (frame) return;
@@ -4923,6 +4924,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4923
4924
  }
4924
4925
  function save() {
4925
4926
  if (disposed || suppressSave) return;
4927
+ if (hydratePending) return;
4926
4928
  try {
4927
4929
  const payload = layoutPayload();
4928
4930
  localUpdatedAt = payload.updatedAt;
@@ -4949,8 +4951,14 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
4949
4951
  }
4950
4952
  approvals?.setEnabled?.(state.settings.inlineApprovals);
4951
4953
  if (!saved || !Array.isArray(saved.cards)) {
4954
+ hydratePending = true;
4952
4955
  syncApprovalSessions();
4953
- void syncFromRemote().then(() => startRemoteSync());
4956
+ void syncFromRemote().then((applied) => {
4957
+ hydratePending = false;
4958
+ if (!applied && !saveTimer) {
4959
+ }
4960
+ startRemoteSync();
4961
+ });
4954
4962
  void loadCanvases();
4955
4963
  return false;
4956
4964
  }
@@ -5084,6 +5092,7 @@ function createBoard({ host, adapter, approvals, t: t2, onOpenSession }) {
5084
5092
  let interactionActive = false;
5085
5093
  let remoteRev = 0;
5086
5094
  let localUpdatedAt = 0;
5095
+ let hydratePending = false;
5087
5096
  let applyingRemote = false;
5088
5097
  let firstRemoteSync = true;
5089
5098
  const clientId = Math.random().toString(36).slice(2) + Date.now().toString(36);
@@ -5615,9 +5624,11 @@ function fold(entries) {
5615
5624
  }
5616
5625
  if (liveReasoning.trim()) push({ k: "reasoning", text: liveReasoning.trim() });
5617
5626
  if (liveText.trim()) push({ k: "assistant", text: liveText, live: true });
5627
+ const placed = /* @__PURE__ */ new Set();
5618
5628
  for (let index = 0; index < items.length; index += 1) {
5619
5629
  const entry = items[index];
5620
- if (entry.k !== "turnProcess") continue;
5630
+ if (entry.k !== "turnProcess" || placed.has(entry)) continue;
5631
+ placed.add(entry);
5621
5632
  const first = items.findIndex((candidate) => candidate.k !== "turnProcess" && candidate.turn === entry.turn);
5622
5633
  if (first < 0) continue;
5623
5634
  let anchor = first;
@@ -5629,8 +5640,9 @@ function fold(entries) {
5629
5640
  }
5630
5641
  if (anchor === index) continue;
5631
5642
  items.splice(index, 1);
5632
- items.splice(index < anchor ? anchor - 1 : anchor, 0, entry);
5633
- index = Math.max(0, index < anchor ? anchor - 1 : anchor);
5643
+ const insertAt = index < anchor ? anchor - 1 : anchor;
5644
+ items.splice(insertAt, 0, entry);
5645
+ index = Math.max(index, insertAt);
5634
5646
  }
5635
5647
  const truncated = items.length > MAX_ITEMS;
5636
5648
  return {