polygram 0.8.0-rc.45 → 0.8.0-rc.46

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.45",
4
+ "version": "0.8.0-rc.46",
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.45",
3
+ "version": "0.8.0-rc.46",
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
@@ -1947,6 +1947,38 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
1947
1947
  }
1948
1948
  return;
1949
1949
  }
1950
+ // 0.8.0-rc.46: /reload — close + respawn the SDK Query while
1951
+ // PRESERVING the persisted claude_session_id. The next user
1952
+ // message resumes the conversation (model has prior context via
1953
+ // SDK resume) but the spawn re-reads agent / skill / plugin files
1954
+ // from disk, so any local edits to ~/.claude/agents/<name>.md or
1955
+ // skill files take effect.
1956
+ //
1957
+ // Difference vs /new:
1958
+ // /new → resetSession clears session_id → fresh conversation
1959
+ // /reload → kill closes Query, session_id preserved → same
1960
+ // conversation continues with fresh agent/skill code
1961
+ //
1962
+ // Mechanism: pm.kill drains the pending queue (with code 'KILLED')
1963
+ // and closes the SDK Query. Crucially it does NOT call
1964
+ // db.clearSessionId — the contract test
1965
+ // 'pm.kill does NOT call db.clearSessionId' pins this invariant.
1966
+ // The next user message hits getOrSpawn → no warm Query → spawn
1967
+ // fresh with `resume: <session_id>` from sessions table → SDK
1968
+ // restores conversation history → fresh files loaded.
1969
+ if (botAllowsCommands && text === '/reload') {
1970
+ if (pm.has(sessionKey)) {
1971
+ try { await pm.kill(sessionKey); }
1972
+ catch (err) { console.error(`[${label}] kill on /reload: ${err.message}`); }
1973
+ }
1974
+ logEvent('session-reload-command', {
1975
+ chat_id: chatId, command: text,
1976
+ user: cmdUser, user_id: cmdUserId,
1977
+ });
1978
+ await sendReply('🔄 Reloaded. Next message picks up the conversation with fresh skills/agents.');
1979
+ return;
1980
+ }
1981
+
1950
1982
  if (botAllowsCommands && (text === '/new' || text === '/reset')) {
1951
1983
  let drained = 0;
1952
1984
  const target = pm.pickFor(sessionKey);