claude-threads 0.26.1 → 0.27.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,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.27.1] - 2026-01-02
11
+
12
+ ### Fixed
13
+ - **Context bar crash when tokens exceed context window** - Fixed crash when usage tokens exceeded the context window limit, causing negative remaining tokens and percentage values over 100%
14
+ - **Wait for shutdown message before exiting** - Bot now waits for the "session ended" message to be posted before shutting down, ensuring users see the final status
15
+
16
+ ## [0.27.0] - 2026-01-02
17
+
18
+ ### Added
19
+ - **Version in system prompt** - Claude Code now knows which version of Claude Threads it's running under, enabling version-specific behavior and self-reporting
20
+
10
21
  ### Fixed
11
22
  - **Sticky message status bar layout** - Moved status bar above the "Active Claude Threads" header for better visual hierarchy
12
23
  - **Shorter status bar** - Removed hostname from status bar to reduce clutter
package/dist/index.js CHANGED
@@ -15300,6 +15300,7 @@ function updateUsageStats(session, event, ctx) {
15300
15300
  let primaryModel = "";
15301
15301
  let highestCost = 0;
15302
15302
  let contextWindowSize = 200000;
15303
+ let contextTokens = 0;
15303
15304
  const modelUsage = {};
15304
15305
  let totalTokensUsed = 0;
15305
15306
  for (const [modelId, usage] of Object.entries(result.modelUsage)) {
@@ -15316,12 +15317,14 @@ function updateUsageStats(session, event, ctx) {
15316
15317
  highestCost = usage.costUSD;
15317
15318
  primaryModel = modelId;
15318
15319
  contextWindowSize = usage.contextWindow;
15320
+ contextTokens = usage.inputTokens + usage.cacheReadInputTokens;
15319
15321
  }
15320
15322
  }
15321
15323
  const usageStats = {
15322
15324
  primaryModel,
15323
15325
  modelDisplayName: getModelDisplayName(primaryModel),
15324
15326
  contextWindowSize,
15327
+ contextTokens,
15325
15328
  totalTokensUsed,
15326
15329
  totalCostUSD: result.total_cost_usd || 0,
15327
15330
  modelUsage,
@@ -19438,7 +19441,7 @@ var keepAlive = new KeepAliveManager;
19438
19441
  // src/session/commands.ts
19439
19442
  function formatContextBar(percent) {
19440
19443
  const totalBlocks = 10;
19441
- const filledBlocks = Math.round(percent / 100 * totalBlocks);
19444
+ const filledBlocks = Math.min(totalBlocks, Math.max(0, Math.round(percent / 100 * totalBlocks)));
19442
19445
  const emptyBlocks = totalBlocks - filledBlocks;
19443
19446
  let indicator;
19444
19447
  if (percent < 50) {
@@ -19640,7 +19643,7 @@ async function updateSessionHeader(session, ctx) {
19640
19643
  if (session.usageStats) {
19641
19644
  const stats = session.usageStats;
19642
19645
  statusItems.push(`\`\uD83E\uDD16 ${stats.modelDisplayName}\``);
19643
- const contextPercent = Math.round(stats.totalTokensUsed / stats.contextWindowSize * 100);
19646
+ const contextPercent = Math.round(stats.contextTokens / stats.contextWindowSize * 100);
19644
19647
  const contextBar = formatContextBar(contextPercent);
19645
19648
  statusItems.push(`\`${contextBar} ${contextPercent}%\``);
19646
19649
  statusItems.push(`\`\uD83D\uDCB0 $${stats.totalCostUSD.toFixed(2)}\``);
@@ -19718,6 +19721,8 @@ function findPersistedByThreadId(persisted, threadId) {
19718
19721
  var CHAT_PLATFORM_PROMPT = `
19719
19722
  You are running inside a chat platform (like Mattermost or Slack). Users interact with you through chat messages in a thread.
19720
19723
 
19724
+ **Claude Threads Version:** ${VERSION}
19725
+
19721
19726
  ## How This Works
19722
19727
  - You are Claude Code running as a bot via "Claude Threads"
19723
19728
  - Your responses appear as messages in a chat thread
@@ -21998,13 +22003,12 @@ Release notes not available. See [GitHub releases](https://github.com/anneschuth
21998
22003
  }
21999
22004
  session.killAllSessions();
22000
22005
  mattermost.disconnect();
22001
- process.exit(0);
22002
22006
  };
22003
22007
  process.on("SIGINT", () => {
22004
- shutdown();
22008
+ shutdown().finally(() => process.exit(0));
22005
22009
  });
22006
22010
  process.on("SIGTERM", () => {
22007
- shutdown();
22011
+ shutdown().finally(() => process.exit(0));
22008
22012
  });
22009
22013
  }
22010
22014
  main().catch((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-threads",
3
- "version": "0.26.1",
3
+ "version": "0.27.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",