polygram 0.8.0-rc.30 → 0.8.0-rc.32

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.30",
4
+ "version": "0.8.0-rc.32",
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.30",
3
+ "version": "0.8.0-rc.32",
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
@@ -948,27 +948,9 @@ function buildSdkOptions(sessionKey, ctx) {
948
948
  })
949
949
  : null;
950
950
 
951
- // rc.29 (refined): map effort → thinking. SDK's `effort` knob alone
952
- // does NOT enable extended thinking — it only "works WITH" thinking.
953
- // Without an explicit `thinking` config, the model emits no thinking
954
- // content blocks, our onThinking callback never fires, and the
955
- // reactor stays at 👀 until first text/tool. Mapping:
956
- // low → disabled (fastest replies)
957
- // medium → adaptive (Claude decides when to think)
958
- // high → adaptive (same; effort biases depth)
959
- // xhigh → adaptive
960
- // max → adaptive
961
- // Chat configs can override by setting `thinking` directly in
962
- // chatConfig (composeSdkOptions passes it through).
963
- const effortValue = chatConfig.effort || config.defaults.effort;
964
- const derivedThinking = effortValue === 'low'
965
- ? { type: 'disabled' }
966
- : { type: 'adaptive' };
967
-
968
951
  const baseOpts = {
969
952
  model: chatConfig.model || config.defaults.model,
970
- effort: effortValue,
971
- thinking: derivedThinking,
953
+ effort: chatConfig.effort || config.defaults.effort,
972
954
  cwd: chatConfig.cwd,
973
955
  env: childEnv,
974
956
  // permissionMode 'default' when canUseTool is wired (so the SDK
@@ -977,14 +959,6 @@ function buildSdkOptions(sessionKey, ctx) {
977
959
  permissionMode: useCanUseTool ? 'default' : 'bypassPermissions',
978
960
  allowDangerouslySkipPermissions: !useCanUseTool,
979
961
  ...(useCanUseTool && { canUseTool: makeCanUseTool(sessionKey) }),
980
- // rc.29: enable partial messages so pm-sdk can detect thinking
981
- // blocks during the extended-thinking phase (before any text or
982
- // tool_use arrives). Without this, the reactor stays at 👀 for
983
- // the full thinking duration. With this, pm-sdk's onThinking
984
- // callback fires within ~100-500ms of pm.send, giving the user
985
- // a fast 👀 → 🤔 transition matching Claude Code CLI's
986
- // "Thinking..." spinner.
987
- includePartialMessages: true,
988
962
  hooks: {
989
963
  PostToolBatch: [{ hooks: [postToolBatchHook] }],
990
964
  ...(sessionStartHook && {
@@ -2440,16 +2414,23 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
2440
2414
  availableEmojis,
2441
2415
  logError: (m) => console.error(`[${label}] ${m}`),
2442
2416
  });
2443
- // Start at QUEUED (👀) so user sees their message was received but
2444
- // not yet being worked on. pm calls context.onActivate when this
2445
- // pending becomes the queue head (Claude is actually starting it),
2446
- // at which point we flip to THINKING (🤔).
2447
- // 0.7.4 (item G): if voice ack (👂) was just emitted by
2448
- // transcribeVoiceAttachments, skip QUEUED — its 👀 would overwrite the
2449
- // ack within milliseconds, wasting an API call and flickering. Let 👂
2450
- // stay until THINKING flips it to 🤔 when Claude actually starts work.
2417
+ // rc.32: skip QUEUED (👀) entirely for first-message-in-chain. Go
2418
+ // straight to THINKING (🤔). The 👀 🤔 two-hop didn't add
2419
+ // user-readable signal Telegram's ✓✓ already conveys "delivered",
2420
+ // and the technical "received-but-not-started vs thinking"
2421
+ // distinction is operator-debugging context, not user UX.
2422
+ //
2423
+ // Follow-up messages during an in-flight turn still go through the
2424
+ // autosteer path (✍ AUTOSTEERED state) that's the visual that
2425
+ // means "captured while bot is busy, will incorporate." This
2426
+ // change ONLY affects the trigger message of a fresh turn:
2427
+ // previously 👀 → (300ms timer) → 🤔, now just 🤔 immediately.
2428
+ //
2429
+ // 0.7.4 (item G) voice-ack guard preserved: if 👂 is up from
2430
+ // voice transcription, don't overwrite it. Let onFirstStream
2431
+ // promote to 🤔 when Claude actually starts work.
2451
2432
  if (!voiceAck.ackEmitted) {
2452
- reactor.setState('QUEUED');
2433
+ reactor.setState('THINKING');
2453
2434
  }
2454
2435
 
2455
2436
  // Mark the inbound row terminal so boot replay doesn't pick it up
@@ -3610,20 +3591,13 @@ async function main() {
3610
3591
  const r = head?.context?.reactor;
3611
3592
  if (r && typeof r.heartbeat === 'function') r.heartbeat();
3612
3593
  },
3613
- // rc.29: extended-thinking 🤔 transition. Fires the moment the
3614
- // model's first content_block_start with type='thinking' arrives
3615
- // via stream_event. Pre-rc.29 we waited for first text/tool_use,
3616
- // which under effort=high means the reactor sat at 👀 for 10+ s
3617
- // before flipping. Now the user sees 👀 🤔 within ~100-500ms
3618
- // of pm.send, matching Claude Code CLI's "Thinking..." UX.
3619
- onThinking: (sessionKey, entry) => {
3620
- const head = entry.pendingQueue?.[0];
3621
- const r = head?.context?.reactor;
3622
- if (r && typeof r.setState === 'function') r.setState('THINKING');
3623
- logEvent('thinking-started', {
3624
- chat_id: entry.chatId, session_key: sessionKey,
3625
- });
3626
- },
3594
+ // rc.29 onThinking removed replaced by simpler timer-based
3595
+ // approach in handleMessage (post-QUEUED setState). The
3596
+ // SDK-thinking-block detection added complexity (partial-message
3597
+ // bandwidth, thinking config mapping) without solving the actual
3598
+ // user-visible problem ("show me the bot is working"). The lib-
3599
+ // side handler in pm-sdk stays for any future caller; polygram
3600
+ // doesn't wire it.
3627
3601
  // 0.8.0 Phase 2 step 5: SDK auto-compaction observability. Fires
3628
3602
  // when SDK emits SDKCompactBoundaryMessage (between turns or
3629
3603
  // mid-turn — see Phase 0 gate 8.5). Surfaces a quiet system