polygram 0.8.0-rc.63 → 0.8.0-rc.64

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.
@@ -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.63",
4
+ "version": "0.8.0-rc.64",
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 plus history (transcript queries) and polygram-send (out-of-turn IPC sends with file-upload validation) skills.",
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.63",
3
+ "version": "0.8.0-rc.64",
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
@@ -2172,11 +2172,37 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
2172
2172
  await sendReply('🗜️ /compact requires the SDK pm. This chat is on the CLI pm path.');
2173
2173
  return;
2174
2174
  }
2175
- if (!pm.has(sessionKey)) {
2176
- await sendReply('🗜️ No active session /compact only works once a turn has started.');
2177
- return;
2175
+ // rc.64: if the in-memory session was evicted (LRU cap pressure)
2176
+ // but there's a saved Claude session_id in DB, auto-spawn the
2177
+ // Query with --resume so /compact has something to work with.
2178
+ // Pre-rc.64 we returned "🗜️ No active session" — confusing
2179
+ // because the user just had a conversation 5 minutes ago, the
2180
+ // session went idle, LRU evicted it, and "No active session"
2181
+ // reads as "I never knew you" instead of "I unloaded your
2182
+ // session, hold on."
2183
+ let entry = pm.get(sessionKey);
2184
+ if (!entry) {
2185
+ const savedSessionId = getClaudeSessionId(db, sessionKey);
2186
+ if (!savedSessionId) {
2187
+ await sendReply('🗜️ No conversation to compact yet. Send a message first, then /compact.');
2188
+ return;
2189
+ }
2190
+ try {
2191
+ entry = await getOrSpawnForChat(sessionKey);
2192
+ } catch (err) {
2193
+ console.error(`[${label}] /compact spawn-resume: ${err.message}`);
2194
+ await sendReply(`🗜️ Couldn't load session for compaction: ${err.message}`);
2195
+ return;
2196
+ }
2197
+ if (!entry) {
2198
+ await sendReply('🗜️ Session not loadable (config missing).');
2199
+ return;
2200
+ }
2201
+ logEvent('compact-spawn-resumed', {
2202
+ chat_id: chatId, thread_id: threadIdStr, session_key: sessionKey,
2203
+ resumed_session_id: savedSessionId,
2204
+ });
2178
2205
  }
2179
- const entry = pm.get(sessionKey);
2180
2206
  if (!entry?.inputController?.push) {
2181
2207
  await sendReply('🗜️ Session not ready for /compact (no input controller).');
2182
2208
  return;