polygram 0.8.0-rc.30 → 0.8.0-rc.31
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.
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/polygram.js +27 -41
|
@@ -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.
|
|
4
|
+
"version": "0.8.0-rc.31",
|
|
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.
|
|
3
|
+
"version": "0.8.0-rc.31",
|
|
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:
|
|
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 && {
|
|
@@ -2452,6 +2426,25 @@ async function handleMessage(sessionKey, chatId, msg, bot) {
|
|
|
2452
2426
|
reactor.setState('QUEUED');
|
|
2453
2427
|
}
|
|
2454
2428
|
|
|
2429
|
+
// rc.31: timer-based 👀 → 🤔 transition. After 300ms in QUEUED,
|
|
2430
|
+
// promote to THINKING regardless of whether the SDK has emitted
|
|
2431
|
+
// any stream events yet. Reasoning: THINKING is "the bot is
|
|
2432
|
+
// working on your reply" — a generic processing signal, NOT
|
|
2433
|
+
// specifically about extended-thinking content blocks. Pre-rc.31
|
|
2434
|
+
// we waited for first text/tool_use, which under effort=high
|
|
2435
|
+
// could mean 10+ s sitting at 👀 with no visible progress.
|
|
2436
|
+
//
|
|
2437
|
+
// Guarded on `currentState === 'QUEUED'` so we don't downgrade
|
|
2438
|
+
// a more-specific state (CODING/TOOL/...) if a tool fires
|
|
2439
|
+
// within 300ms of pm.send.
|
|
2440
|
+
//
|
|
2441
|
+
// unref() so a long-pending timer doesn't keep the event loop
|
|
2442
|
+
// alive past shutdown drain.
|
|
2443
|
+
const thinkingPromote = setTimeout(() => {
|
|
2444
|
+
if (reactor.currentState === 'QUEUED') reactor.setState('THINKING');
|
|
2445
|
+
}, 300);
|
|
2446
|
+
thinkingPromote.unref?.();
|
|
2447
|
+
|
|
2455
2448
|
// Mark the inbound row terminal so boot replay doesn't pick it up
|
|
2456
2449
|
// again. Must fire down EVERY non-throwing exit path (early returns
|
|
2457
2450
|
// for error / NO_REPLY, streamed-reply preview-becomes-final, the
|
|
@@ -3610,20 +3603,13 @@ async function main() {
|
|
|
3610
3603
|
const r = head?.context?.reactor;
|
|
3611
3604
|
if (r && typeof r.heartbeat === 'function') r.heartbeat();
|
|
3612
3605
|
},
|
|
3613
|
-
// rc.29
|
|
3614
|
-
//
|
|
3615
|
-
//
|
|
3616
|
-
//
|
|
3617
|
-
//
|
|
3618
|
-
//
|
|
3619
|
-
|
|
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
|
-
},
|
|
3606
|
+
// rc.29 onThinking removed — replaced by simpler timer-based
|
|
3607
|
+
// approach in handleMessage (post-QUEUED setState). The
|
|
3608
|
+
// SDK-thinking-block detection added complexity (partial-message
|
|
3609
|
+
// bandwidth, thinking config mapping) without solving the actual
|
|
3610
|
+
// user-visible problem ("show me the bot is working"). The lib-
|
|
3611
|
+
// side handler in pm-sdk stays for any future caller; polygram
|
|
3612
|
+
// doesn't wire it.
|
|
3627
3613
|
// 0.8.0 Phase 2 step 5: SDK auto-compaction observability. Fires
|
|
3628
3614
|
// when SDK emits SDKCompactBoundaryMessage (between turns or
|
|
3629
3615
|
// mid-turn — see Phase 0 gate 8.5). Surfaces a quiet system
|