polygram 0.8.0-rc.42 → 0.8.0-rc.44

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.42",
4
+ "version": "0.8.0-rc.44",
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",
@@ -67,7 +67,11 @@
67
67
  *
68
68
  * Optional (only one of the two pms implements these — feature-detect):
69
69
  * @property {((sessionKey: string, text: string, opts?: object) => boolean)=} steer
70
- * — SDK pm only (rc.9 PostToolBatch hook drains buffer).
70
+ * — SDK pm only (rc.9 priority='now' direct push, opt-in shouldQuery).
71
+ * @property {((sessionKey: string, opts: {content: string, priority?: 'now'|'next'|'later', shouldQuery?: boolean, parent_tool_use_id?: string|null}) => boolean)=} injectUserMessage
72
+ * — SDK pm only (rc.42 native autosteer / queue via SDKUserMessage
73
+ * priority hint). Returns false on CLI pm (no inputController
74
+ * surface) or when sessionKey not found.
71
75
  * @property {((sessionKey: string, model: string) => Promise<boolean>)=} setModel
72
76
  * — SDK pm only (Query.setModel live).
73
77
  * @property {((sessionKey: string, settings: {effortLevel?: string}) => Promise<boolean>)=} applyFlagSettings
package/lib/pm-router.js CHANGED
@@ -149,6 +149,16 @@ function createPmRouter({ cliPm, sdkPm = null, pickPmKindFor } = {}) {
149
149
  const target = routedPm(sessionKey);
150
150
  return typeof target.steer === 'function' ? target.steer(sessionKey, ...args) : false;
151
151
  },
152
+ // rc.42: native autosteer / queue. CLI pm doesn't have an
153
+ // input-controller push primitive (the binary's stream-json
154
+ // input is one-shot per pm.send), so it returns false. SDK pm
155
+ // forwards to its inject implementation.
156
+ injectUserMessage(sessionKey, opts) {
157
+ const target = routedPm(sessionKey);
158
+ return typeof target.injectUserMessage === 'function'
159
+ ? target.injectUserMessage(sessionKey, opts)
160
+ : false;
161
+ },
152
162
  resetSession(sessionKey, opts) {
153
163
  const target = routedPm(sessionKey);
154
164
  return typeof target.resetSession === 'function'
@@ -55,6 +55,14 @@ function createStreamer({
55
55
  schedule = setTimeout,
56
56
  cancel = clearTimeout,
57
57
  logger = console,
58
+ // rc.44: by default, KEEP intermediate "thinking out loud" bubbles
59
+ // when forceNewMessage transitions to a fresh bubble for a new
60
+ // top-level assistant message. Pre-rc.44 those were pushed onto
61
+ // archived[] and deleted at turn-end, leaving only the final
62
+ // answer visible — but users wanted the full reasoning trail
63
+ // visible, especially in DM debugging contexts. Set to false to
64
+ // restore the 0.7.2 "delete intermediate" behaviour.
65
+ preserveIntermediateBubbles = true,
58
66
  } = {}) {
59
67
  throttleMs = Math.max(THROTTLE_FLOOR_MS, throttleMs);
60
68
  let state = 'idle'; // 'idle' | 'live' | 'finalized'
@@ -158,15 +166,26 @@ function createStreamer({
158
166
  // emits a new top-level assistant message mid-turn (post tool-result):
159
167
  // we want it in its own bubble below the previous one, not appended
160
168
  // via editMessageText to the original.
169
+ //
170
+ // rc.44: by default, the previous bubble is PRESERVED (not archived
171
+ // for end-of-turn deletion). Users wanted the full reasoning trail
172
+ // visible — "thinking out loud" + tool-use intermediates document
173
+ // what the agent actually did, which is valuable transparency. The
174
+ // 0.7.2 deletion behaviour assumed users wanted only the final
175
+ // answer; for chat-style DM debugging that's wrong. Opt back into
176
+ // the old behaviour with `preserveIntermediateBubbles: false`.
177
+ //
178
+ // When preserving, we still cancel the pending throttled edit (it
179
+ // wouldn't fire after we transition to a new bubble anyway) but
180
+ // there may be a recently-flushed edit in flight whose result we
181
+ // don't await — the bubble will display whatever its last
182
+ // successful edit landed, which is typically very close to the
183
+ // segment's final text (throttle is 250ms; segments take seconds).
161
184
  function forceNewMessage() {
162
185
  if (pendingEdit) { cancel(pendingEdit); pendingEdit = null; }
163
- // Don't await flushPromise the caller has decided to start a new
164
- // message; whatever the old bubble shows is "done".
165
- // 0.7.2: track the previous bubble's msgId for end-of-turn cleanup.
166
- // Without this, every intermediate "thinking out loud" assistant
167
- // message in a tool-heavy turn leaves a permanent bubble in the
168
- // chat — the user wants only the final answer's bubble visible.
169
- if (msgId != null) archived.push(msgId);
186
+ if (msgId != null && !preserveIntermediateBubbles) {
187
+ archived.push(msgId);
188
+ }
170
189
  msgId = null;
171
190
  currentText = '';
172
191
  latestText = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.8.0-rc.42",
3
+ "version": "0.8.0-rc.44",
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
@@ -2303,6 +2303,15 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
2303
2303
  },
2304
2304
  minChars: botCfg.streamMinChars,
2305
2305
  throttleMs: botCfg.streamThrottleMs,
2306
+ // rc.44: preserve intermediate "thinking out loud" bubbles by
2307
+ // default. Per-chat / per-bot opt-out via
2308
+ // `preserveIntermediateBubbles: false` for chats where the
2309
+ // partner-facing UX wants only the final answer (e.g. UMI Group).
2310
+ preserveIntermediateBubbles: chatConfig.preserveIntermediateBubbles != null
2311
+ ? chatConfig.preserveIntermediateBubbles
2312
+ : (botCfg.preserveIntermediateBubbles != null
2313
+ ? botCfg.preserveIntermediateBubbles
2314
+ : true),
2306
2315
  logger: { error: (m) => console.error(`[${label}] ${m}`) },
2307
2316
  });
2308
2317
  // streamer is registered with this turn via pm.send's context (below)