polygram 0.8.0-rc.3 → 0.8.0-rc.4
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/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/polygram.js +13 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "polygram",
|
|
4
|
-
"version": "0.8.0-rc.
|
|
4
|
+
"version": "0.8.0-rc.4",
|
|
5
5
|
"description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Multi-bot, multi-chat, per-topic isolation; SQLite transcripts; inline-keyboard approvals. Bundles /polygram:status|logs|pair-code|approvals admin commands and a history skill.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"telegram",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polygram",
|
|
3
|
-
"version": "0.8.0-rc.
|
|
3
|
+
"version": "0.8.0-rc.4",
|
|
4
4
|
"description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
|
|
5
5
|
"main": "lib/ipc-client.js",
|
|
6
6
|
"bin": {
|
package/polygram.js
CHANGED
|
@@ -1903,13 +1903,18 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
|
|
|
1903
1903
|
}
|
|
1904
1904
|
try {
|
|
1905
1905
|
const u = await q.getContextUsage();
|
|
1906
|
-
|
|
1906
|
+
// SDK returns percentage in 0-100 scale (verified rc.3 prod
|
|
1907
|
+
// — saw "77" for a 77%-used context). Display directly.
|
|
1908
|
+
const pct = (u?.percentage ?? 0).toFixed(0);
|
|
1907
1909
|
const total = (u?.totalTokens ?? 0).toLocaleString();
|
|
1908
1910
|
const max = (u?.maxTokens ?? 0).toLocaleString();
|
|
1909
1911
|
const lines = [`📚 Context: ${total} / ${max} tokens (${pct}%)`];
|
|
1910
1912
|
if (u?.model) lines.push(`Model: ${u.model}`);
|
|
1911
1913
|
if (u?.isAutoCompactEnabled && u?.autoCompactThreshold) {
|
|
1912
|
-
|
|
1914
|
+
// autoCompactThreshold scale is currently unverified; assume
|
|
1915
|
+
// matches percentage (0-100). If it turns out to be 0-1 we'll
|
|
1916
|
+
// see something like "Auto-compact at 0%" and can flip back.
|
|
1917
|
+
const thrPct = u.autoCompactThreshold.toFixed(0);
|
|
1913
1918
|
lines.push(`Auto-compact at ${thrPct}%.`);
|
|
1914
1919
|
}
|
|
1915
1920
|
// Top-3 categories by token cost so the user knows where the
|
|
@@ -2523,11 +2528,15 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
|
|
|
2523
2528
|
const q = entry?.query;
|
|
2524
2529
|
if (q && typeof q.getContextUsage === 'function') {
|
|
2525
2530
|
q.getContextUsage().then((usage) => {
|
|
2531
|
+
// SDK returns percentage in 0-100 scale, not 0-1.
|
|
2532
|
+
// Pre-rc.4 we treated it as a 0-1 ratio and multiplied
|
|
2533
|
+
// by 100, which displayed "7700% full" for a 77%-used
|
|
2534
|
+
// context (and fired below the intended 85% threshold).
|
|
2526
2535
|
const pct = usage?.percentage ?? 0;
|
|
2527
|
-
if (pct <
|
|
2536
|
+
if (pct < 85) return;
|
|
2528
2537
|
return tg(bot, 'sendMessage', {
|
|
2529
2538
|
chat_id: chatId,
|
|
2530
|
-
text: `📚 Context window ${
|
|
2539
|
+
text: `📚 Context window ${pct.toFixed(0)}% full. Send /new to start fresh — older messages will start dropping soon.`,
|
|
2531
2540
|
...(threadId ? { message_thread_id: threadId } : {}),
|
|
2532
2541
|
}, { source: 'context-full-hint', botName: BOT_NAME });
|
|
2533
2542
|
}).catch((err) => {
|