claude-threads 0.62.0 → 0.62.1

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/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.62.1] - 2026-01-11
11
+
12
+ ### Fixed
13
+ - **Slack/Mattermost message accumulation** - Fixed bug where `pendingContent` was not cleared after flushing, causing messages to accumulate all previous content (#196)
14
+ - Introduced `clearFlushedContent()` helper to safely remove only flushed content while preserving content added during async operations
15
+ - Added race condition protection: content appended during `createPost`/`updatePost` is no longer lost
16
+ - Added comprehensive regression tests for the accumulation bug and race condition scenarios
17
+
10
18
  ## [0.62.0] - 2026-01-11
11
19
 
12
20
  ### Fixed
package/dist/index.js CHANGED
@@ -51585,6 +51585,13 @@ function scheduleUpdate(session, onFlush) {
51585
51585
  onFlush(session);
51586
51586
  }, 500);
51587
51587
  }
51588
+ function clearFlushedContent(session, flushedContent) {
51589
+ if (session.pendingContent.startsWith(flushedContent)) {
51590
+ session.pendingContent = session.pendingContent.slice(flushedContent.length);
51591
+ } else if (session.pendingContent === flushedContent) {
51592
+ session.pendingContent = "";
51593
+ }
51594
+ }
51588
51595
  async function buildMessageContent(text, platform, files, debug = false) {
51589
51596
  const imageFiles = files?.filter((f) => f.mimeType.startsWith("image/") && ["image/jpeg", "image/png", "image/gif", "image/webp"].includes(f.mimeType)) || [];
51590
51597
  if (imageFiles.length === 0) {
@@ -51721,8 +51728,9 @@ async function flush(session, registerPost) {
51721
51728
  if (!session.pendingContent.trim()) {
51722
51729
  return;
51723
51730
  }
51731
+ const pendingAtFlushStart = session.pendingContent;
51724
51732
  const formatter = session.platform.getFormatter();
51725
- let content = formatter.formatMarkdown(session.pendingContent).trim();
51733
+ let content = formatter.formatMarkdown(pendingAtFlushStart).trim();
51726
51734
  const { maxLength: MAX_POST_LENGTH, hardThreshold: HARD_CONTINUATION_THRESHOLD } = session.platform.getMessageLimits();
51727
51735
  const shouldBreakEarly = session.currentPostId && content.length > MIN_BREAK_THRESHOLD && shouldFlushEarly(content);
51728
51736
  if (session.currentPostId && (content.length > HARD_CONTINUATION_THRESHOLD || shouldBreakEarly)) {
@@ -51821,6 +51829,7 @@ async function flush(session, registerPost) {
51821
51829
  const postId = session.currentPostId;
51822
51830
  try {
51823
51831
  await session.platform.updatePost(postId, content);
51832
+ clearFlushedContent(session, pendingAtFlushStart);
51824
51833
  } catch {
51825
51834
  sessionLog2(session).debug("Update failed, will create new post on next flush");
51826
51835
  session.currentPostId = null;
@@ -51830,6 +51839,7 @@ async function flush(session, registerPost) {
51830
51839
  if (hasActiveTasks) {
51831
51840
  const postId = await bumpTasksToBottomWithContent(session, content, registerPost);
51832
51841
  session.currentPostId = postId;
51842
+ clearFlushedContent(session, pendingAtFlushStart);
51833
51843
  } else {
51834
51844
  const post = await withErrorHandling(() => session.platform.createPost(content, session.threadId), { action: "Create new post", session });
51835
51845
  if (post) {
@@ -51837,6 +51847,7 @@ async function flush(session, registerPost) {
51837
51847
  sessionLog2(session).debug(`Created post ${post.id.substring(0, 8)}`);
51838
51848
  registerPost(post.id, session.threadId);
51839
51849
  updateLastMessage(session, post);
51850
+ clearFlushedContent(session, pendingAtFlushStart);
51840
51851
  }
51841
51852
  }
51842
51853
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-threads",
3
- "version": "0.62.0",
3
+ "version": "0.62.1",
4
4
  "description": "Share Claude Code sessions live in a Mattermost channel with interactive features",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",