claude-threads 0.57.3 → 0.57.5

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51294,9 +51294,11 @@ function formatLogEntries(entries) {
51294
51294
  case "lifecycle":
51295
51295
  summary = `lifecycle:${entry.action}${entry.username ? ` by ${anonymizer.anonymize(entry.username)}` : ""}`;
51296
51296
  break;
51297
- case "user_message":
51298
- summary = `user_message: ${anonymizer.anonymize(entry.username)} - [message redacted]`;
51297
+ case "user_message": {
51298
+ const msgPreview = entry.message ? sanitizeText(entry.message.slice(0, 50)) + (entry.message.length > 50 ? "..." : "") : "[empty]";
51299
+ summary = `${anonymizer.anonymize(entry.username)}: ${msgPreview}`;
51299
51300
  break;
51301
+ }
51300
51302
  case "command": {
51301
51303
  let args = entry.args || "";
51302
51304
  if (entry.command === "invite" || entry.command === "kick") {
@@ -51319,23 +51321,34 @@ function formatLogEntries(entries) {
51319
51321
  const msg = entry.event;
51320
51322
  const content = msg.message?.content?.[0];
51321
51323
  if (content?.type === "text") {
51322
- summary = `assistant: [text]`;
51324
+ const len = content.text?.length || 0;
51325
+ summary = `text (${len} chars)`;
51323
51326
  } else if (content?.type === "tool_use") {
51324
51327
  summary = `tool_use: ${content.name}`;
51325
51328
  } else if (content?.type === "thinking") {
51326
- summary = `assistant: [thinking]`;
51329
+ const len = content.thinking?.length || 0;
51330
+ summary = `thinking (${len} chars)`;
51327
51331
  } else {
51328
51332
  summary = `assistant: [${content?.type || "response"}]`;
51329
51333
  }
51330
51334
  } else if (eventType === "user") {
51331
- summary = `tool_result`;
51335
+ const toolResult = entry.event;
51336
+ const content = toolResult.message?.content?.[0];
51337
+ if (content?.is_error) {
51338
+ summary = `tool_result: error`;
51339
+ } else {
51340
+ summary = `tool_result: ok`;
51341
+ }
51332
51342
  } else if (eventType === "system") {
51333
51343
  const sysEvent = entry.event;
51334
- summary = `system:${sysEvent.subtype || "init"}`;
51344
+ summary = `system: ${sysEvent.subtype || "init"}`;
51335
51345
  } else if (eventType === "result") {
51336
- summary = `result: completed`;
51346
+ const resultEvent = entry.event;
51347
+ const cost = resultEvent.cost_usd ? `$${resultEvent.cost_usd.toFixed(3)}` : "";
51348
+ const duration = resultEvent.duration_ms ? `${Math.round(resultEvent.duration_ms / 1000)}s` : "";
51349
+ summary = `result: completed${cost ? ` ${cost}` : ""}${duration ? ` [${duration}]` : ""}`;
51337
51350
  } else {
51338
- summary = `claude_event:${eventType}`;
51351
+ summary = `claude: ${eventType}`;
51339
51352
  }
51340
51353
  break;
51341
51354
  }
@@ -51844,6 +51857,7 @@ function formatContextBar(percent) {
51844
51857
  async function cancelSession(session, username, ctx) {
51845
51858
  sessionLog2(session).info(`\uD83D\uDED1 Cancelled by @${username}`);
51846
51859
  session.threadLogger?.logCommand("stop", undefined, username);
51860
+ session.isCancelled = true;
51847
51861
  const formatter = session.platform.getFormatter();
51848
51862
  await postCancelled(session, `${formatter.formatBold("Session cancelled")} by ${formatter.formatUserMention(username)}`);
51849
51863
  await ctx.ops.killSession(session.threadId);
@@ -54359,6 +54373,7 @@ ${CHAT_PLATFORM_PROMPT}`;
54359
54373
  subagentUpdateTimer: null,
54360
54374
  timeoutWarningPosted: false,
54361
54375
  isRestarting: false,
54376
+ isCancelled: false,
54362
54377
  isResumed: false,
54363
54378
  resumeFailCount: 0,
54364
54379
  wasInterrupted: false,
@@ -54511,6 +54526,7 @@ ${CHAT_PLATFORM_PROMPT}`;
54511
54526
  subagentUpdateTimer: null,
54512
54527
  timeoutWarningPosted: false,
54513
54528
  isRestarting: false,
54529
+ isCancelled: false,
54514
54530
  isResumed: true,
54515
54531
  resumeFailCount: state.resumeFailCount ?? 0,
54516
54532
  wasInterrupted: false,
@@ -54647,6 +54663,10 @@ async function handleExit(sessionId, code, ctx) {
54647
54663
  session.isRestarting = false;
54648
54664
  return;
54649
54665
  }
54666
+ if (session.isCancelled) {
54667
+ sessionLog6(session).debug(`Cancelled, skipping cleanup (handled by killSession)`);
54668
+ return;
54669
+ }
54650
54670
  if (ctx.state.isShuttingDown) {
54651
54671
  sessionLog6(session).debug(`Bot shutting down, preserving persistence`);
54652
54672
  ctx.ops.stopTyping(session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-threads",
3
- "version": "0.57.3",
3
+ "version": "0.57.5",
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",