claude-threads 0.27.0 → 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 +6 -0
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ 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
|
+
|
|
10
16
|
## [0.27.0] - 2026-01-02
|
|
11
17
|
|
|
12
18
|
### Added
|
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.
|
|
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)}\``);
|
|
@@ -22000,13 +22003,12 @@ Release notes not available. See [GitHub releases](https://github.com/anneschuth
|
|
|
22000
22003
|
}
|
|
22001
22004
|
session.killAllSessions();
|
|
22002
22005
|
mattermost.disconnect();
|
|
22003
|
-
process.exit(0);
|
|
22004
22006
|
};
|
|
22005
22007
|
process.on("SIGINT", () => {
|
|
22006
|
-
shutdown();
|
|
22008
|
+
shutdown().finally(() => process.exit(0));
|
|
22007
22009
|
});
|
|
22008
22010
|
process.on("SIGTERM", () => {
|
|
22009
|
-
shutdown();
|
|
22011
|
+
shutdown().finally(() => process.exit(0));
|
|
22010
22012
|
});
|
|
22011
22013
|
}
|
|
22012
22014
|
main().catch((e) => {
|