polygram 0.7.8 → 0.7.9
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/lib/telegram-chunk.js +25 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "polygram",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.9",
|
|
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/lib/telegram-chunk.js
CHANGED
|
@@ -276,7 +276,31 @@ function chunkMarkdownText(text, limit) {
|
|
|
276
276
|
remaining = next;
|
|
277
277
|
}
|
|
278
278
|
if (remaining.length) chunks.push(remaining);
|
|
279
|
-
|
|
279
|
+
// 0.7.x defensive post-pass: enforce limit on every chunk. The
|
|
280
|
+
// fence-splitting "force the break" path (line ~250) can produce
|
|
281
|
+
// a chunk whose length = breakIdx + closeLine.length + 1, which
|
|
282
|
+
// may overflow when there's no safe break. Same for the
|
|
283
|
+
// hard-cut path when no progress is possible. Production saw
|
|
284
|
+
// chunks of 4097-4500 chars hitting Telegram's 400 "message is
|
|
285
|
+
// too long". Splitting again byte-wise here is uglier than
|
|
286
|
+
// markdown-aware, but it's better than the user getting a
|
|
287
|
+
// failed-out row + missing reply.
|
|
288
|
+
const safe = [];
|
|
289
|
+
for (const c of chunks) {
|
|
290
|
+
if (c.length <= limit) { safe.push(c); continue; }
|
|
291
|
+
let rest = c;
|
|
292
|
+
while (rest.length > limit) {
|
|
293
|
+
// Prefer a newline cut within the last 200 chars of the
|
|
294
|
+
// limit (cheap heuristic — much better than mid-word).
|
|
295
|
+
const window = rest.slice(0, limit);
|
|
296
|
+
const lastNl = window.lastIndexOf('\n', limit - 1);
|
|
297
|
+
const cutAt = lastNl > limit - 200 ? lastNl + 1 : limit;
|
|
298
|
+
safe.push(rest.slice(0, cutAt));
|
|
299
|
+
rest = rest.slice(cutAt);
|
|
300
|
+
}
|
|
301
|
+
if (rest.length) safe.push(rest);
|
|
302
|
+
}
|
|
303
|
+
return safe;
|
|
280
304
|
}
|
|
281
305
|
|
|
282
306
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polygram",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
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": {
|