polygram 0.10.0-rc.32 → 0.10.0-rc.33

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.10.0-rc.32",
4
+ "version": "0.10.0-rc.33",
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",
@@ -20,6 +20,9 @@
20
20
 
21
21
  'use strict';
22
22
 
23
+ const { getTopicConfig } = require('../session-key');
24
+ const { pickBackend } = require('../process/factory');
25
+
23
26
  function createSdkCallbacks({
24
27
  db,
25
28
  dbWrite,
@@ -97,15 +100,35 @@ function createSdkCallbacks({
97
100
 
98
101
  return {
99
102
  onInit: (sessionKey, event, entry) => {
103
+ // Resolve the spawn-time identity the SAME way the backends do
104
+ // (topic override merged over chat-level + factory's
105
+ // pickBackend) — must match what `buildSpawnContext` in
106
+ // polygram.js compares against, otherwise every spawn re-poisons
107
+ // the row with chat-level values and S2 drift fires forever.
108
+ //
109
+ // The shumorobot 2026-05-21 Music topic bug was this: chat-
110
+ // level agent='shumabit' + cwd=$HOME got written into the row
111
+ // every turn, but the topic-level resolved to
112
+ // music-curation:music-curator + .../Music/rekordbox. Next turn
113
+ // → drift → drop row → fresh sid → context lost. Forever.
114
+ //
115
+ // pm_backend MUST also be persisted explicitly; otherwise
116
+ // db.upsertSession defaults it to 'sdk' for every spawn,
117
+ // making historical telemetry meaningless.
118
+ const chatConfig = config.chats[entry.chatId] || {};
119
+ const topicConfig = getTopicConfig(chatConfig, entry.threadId || null);
100
120
  dbWrite(() => db.upsertSession({
101
121
  session_key: sessionKey,
102
122
  chat_id: entry.chatId,
103
123
  thread_id: entry.threadId,
104
124
  claude_session_id: event.session_id,
105
- agent: config.chats[entry.chatId]?.agent || null,
106
- cwd: config.chats[entry.chatId]?.cwd || null,
107
- model: config.chats[entry.chatId]?.model || null,
108
- effort: config.chats[entry.chatId]?.effort || null,
125
+ agent: topicConfig.agent || chatConfig.agent || null,
126
+ cwd: topicConfig.cwd || chatConfig.cwd || null,
127
+ model: topicConfig.model || chatConfig.model || null,
128
+ effort: topicConfig.effort || chatConfig.effort || null,
129
+ pm_backend: pickBackend({
130
+ config, chatId: entry.chatId, threadId: entry.threadId || null,
131
+ }),
109
132
  }), `upsert session ${sessionKey}`);
110
133
  },
111
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.10.0-rc.32",
3
+ "version": "0.10.0-rc.33",
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": {