polygram 0.10.0-rc.7 → 0.10.0-rc.8

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.7",
4
+ "version": "0.10.0-rc.8",
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",
@@ -109,12 +109,24 @@ function parseLine(line) {
109
109
  if (obj.type === 'assistant' && obj.message) {
110
110
  const content = obj.message.content;
111
111
  if (Array.isArray(content)) {
112
+ // Cross-backend parity (rc.8): SDK's extractAssistantText
113
+ // (lib/process/sdk-process.js:62-73) joins all text blocks of
114
+ // one assistant message into a single string and applies a
115
+ // trailing-colon → ellipsis transform: "Listing deps:" →
116
+ // "Listing deps…". This keeps streamed-but-not-final text from
117
+ // reading as half-formed during the pause while a tool runs.
118
+ // The CLI/tmux backend previously emitted one assistant-chunk
119
+ // per text block with no normalisation — Telegram bubbles
120
+ // would briefly show "files are in place:" while the agent
121
+ // ran follow-up tools. Now we mirror SDK byte-for-byte.
122
+ const textParts = [];
123
+ const toolUses = [];
112
124
  for (const block of content) {
113
125
  if (!block || typeof block !== 'object') continue;
114
126
  if (block.type === 'text' && typeof block.text === 'string' && block.text.length > 0) {
115
- out.push({ type: 'assistant-chunk', text: block.text });
127
+ textParts.push(block.text);
116
128
  } else if (block.type === 'tool_use' && block.name) {
117
- out.push({
129
+ toolUses.push({
118
130
  type: 'tool-use',
119
131
  name: block.name,
120
132
  input: block.input ?? null,
@@ -122,6 +134,16 @@ function parseLine(line) {
122
134
  });
123
135
  }
124
136
  }
137
+ // Emit text FIRST then tool-uses — matches the pre-rc.8 order
138
+ // (when the per-block iteration interleaved them in source
139
+ // order, but text-then-tool is the dominant real-world shape).
140
+ if (textParts.length > 0) {
141
+ const joined = textParts.join('\n\n').trim().replace(/([^:]):\s*$/, '$1…');
142
+ if (joined.length > 0) {
143
+ out.push({ type: 'assistant-chunk', text: joined });
144
+ }
145
+ }
146
+ for (const t of toolUses) out.push(t);
125
147
  }
126
148
  // Token-usage telemetry. Every assistant message carries the
127
149
  // cumulative usage snapshot — input_tokens + cache_creation +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.10.0-rc.7",
3
+ "version": "0.10.0-rc.8",
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": {