stashes 0.1.30 → 0.1.32

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/dist/cli.js CHANGED
@@ -1618,6 +1618,7 @@ class StashService {
1618
1618
  this.isProcessingMessage = false;
1619
1619
  }
1620
1620
  async processMessage(projectId, chatId, message, referenceStashIds, componentContext) {
1621
+ const preExistingStashIds = new Set(this.persistence.listStashes(projectId).map((s) => s.id));
1621
1622
  const component = componentContext ? { name: componentContext.name, filePath: this.selectedComponent?.filePath || "" } : this.selectedComponent;
1622
1623
  let sourceCode = "";
1623
1624
  const filePath = component?.filePath || "";
@@ -1776,7 +1777,7 @@ ${sourceCode.substring(0, 3000)}
1776
1777
  await aiProcess.process.exited;
1777
1778
  flushThinking();
1778
1779
  flushText();
1779
- this.syncStashesFromDisk(projectId, chatId);
1780
+ this.syncStashesFromDisk(projectId, chatId, preExistingStashIds);
1780
1781
  } catch (err) {
1781
1782
  this.broadcast({
1782
1783
  type: "ai_stream",
@@ -1789,9 +1790,12 @@ ${sourceCode.substring(0, 3000)}
1789
1790
  killAiProcess("chat");
1790
1791
  }
1791
1792
  }
1792
- syncStashesFromDisk(projectId, chatId) {
1793
+ syncStashesFromDisk(projectId, chatId, preExistingIds) {
1793
1794
  const diskStashes = this.persistence.listStashes(projectId);
1794
1795
  for (const stash of diskStashes) {
1796
+ const isNew = preExistingIds ? !preExistingIds.has(stash.id) : !this.knownStashIds.has(stash.id);
1797
+ if (!isNew)
1798
+ continue;
1795
1799
  if (chatId && !stash.originChatId) {
1796
1800
  this.persistence.saveStash({ ...stash, originChatId: chatId });
1797
1801
  }
@@ -1824,7 +1828,7 @@ ${sourceCode.substring(0, 3000)}
1824
1828
  for (const stash of stashes) {
1825
1829
  const prev = lastStatus.get(stash.id);
1826
1830
  if (!prev || prev !== stash.status) {
1827
- if (chatId && !stash.originChatId) {
1831
+ if (chatId && !stash.originChatId && !prev) {
1828
1832
  this.persistence.saveStash({ ...stash, originChatId: chatId });
1829
1833
  }
1830
1834
  this.broadcast({
package/dist/mcp.js CHANGED
@@ -1814,6 +1814,7 @@ class StashService {
1814
1814
  this.isProcessingMessage = false;
1815
1815
  }
1816
1816
  async processMessage(projectId, chatId, message, referenceStashIds, componentContext) {
1817
+ const preExistingStashIds = new Set(this.persistence.listStashes(projectId).map((s) => s.id));
1817
1818
  const component = componentContext ? { name: componentContext.name, filePath: this.selectedComponent?.filePath || "" } : this.selectedComponent;
1818
1819
  let sourceCode = "";
1819
1820
  const filePath = component?.filePath || "";
@@ -1972,7 +1973,7 @@ ${sourceCode.substring(0, 3000)}
1972
1973
  await aiProcess.process.exited;
1973
1974
  flushThinking();
1974
1975
  flushText();
1975
- this.syncStashesFromDisk(projectId, chatId);
1976
+ this.syncStashesFromDisk(projectId, chatId, preExistingStashIds);
1976
1977
  } catch (err) {
1977
1978
  this.broadcast({
1978
1979
  type: "ai_stream",
@@ -1985,9 +1986,12 @@ ${sourceCode.substring(0, 3000)}
1985
1986
  killAiProcess("chat");
1986
1987
  }
1987
1988
  }
1988
- syncStashesFromDisk(projectId, chatId) {
1989
+ syncStashesFromDisk(projectId, chatId, preExistingIds) {
1989
1990
  const diskStashes = this.persistence.listStashes(projectId);
1990
1991
  for (const stash of diskStashes) {
1992
+ const isNew = preExistingIds ? !preExistingIds.has(stash.id) : !this.knownStashIds.has(stash.id);
1993
+ if (!isNew)
1994
+ continue;
1991
1995
  if (chatId && !stash.originChatId) {
1992
1996
  this.persistence.saveStash({ ...stash, originChatId: chatId });
1993
1997
  }
@@ -2020,7 +2024,7 @@ ${sourceCode.substring(0, 3000)}
2020
2024
  for (const stash of stashes) {
2021
2025
  const prev = lastStatus.get(stash.id);
2022
2026
  if (!prev || prev !== stash.status) {
2023
- if (chatId && !stash.originChatId) {
2027
+ if (chatId && !stash.originChatId && !prev) {
2024
2028
  this.persistence.saveStash({ ...stash, originChatId: chatId });
2025
2029
  }
2026
2030
  this.broadcast({