polygram 0.27.0 → 0.27.1
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/rich.js +27 -2
- 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.27.
|
|
4
|
+
"version": "0.27.1",
|
|
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",
|
package/lib/telegram/rich.js
CHANGED
|
@@ -675,7 +675,7 @@ function blockFromToken(token, ctx = FLAT) {
|
|
|
675
675
|
const out = [];
|
|
676
676
|
const prefix = src.slice(0, m.index).replace(HTML_TAG_STRIP_RE, '').trim();
|
|
677
677
|
if (prefix) out.push({ type: 'paragraph', text: prefix });
|
|
678
|
-
const summary = (m[1] || '').replace(HTML_TAG_STRIP_RE, '').trim();
|
|
678
|
+
const summary = flattenSummaryMarkdown((m[1] || '').replace(HTML_TAG_STRIP_RE, '').trim());
|
|
679
679
|
const innerMarkdown = (m[2] || '').trim();
|
|
680
680
|
const blocks = innerMarkdown ? blocksFromTokens(_lexer.lexer(innerMarkdown), ctx) : [];
|
|
681
681
|
out.push({
|
|
@@ -718,6 +718,22 @@ function blockFromToken(token, ctx = FLAT) {
|
|
|
718
718
|
// checkbox the has_checkbox flag renders. Strip it from the leader.
|
|
719
719
|
const TASK_MARKER_RE = /^\s*\[[ xX]\]\s*/;
|
|
720
720
|
|
|
721
|
+
// A <summary> is authored as markdown like everything else — "**Логи** с
|
|
722
|
+
// `кодом`" must flatten to its text, not ship its markers into the chip.
|
|
723
|
+
// The summary field is a plain string in the block schema, so styling
|
|
724
|
+
// does not apply here; flattening through the lexer is the summary
|
|
725
|
+
// counterpart of plainTextOf on inline runs.
|
|
726
|
+
function flattenSummaryMarkdown(s) {
|
|
727
|
+
if (!s || !/[*_`~[\]]/.test(s)) return s;
|
|
728
|
+
try {
|
|
729
|
+
const tokens = _lexer.lexer(s);
|
|
730
|
+
const flat = tokens.map((t) => plainTextOf(t.tokens || [t])).join(' ').trim();
|
|
731
|
+
return flat || s;
|
|
732
|
+
} catch {
|
|
733
|
+
return s;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
721
737
|
// Strips it from either text representation. A styled run keeps the marker in
|
|
722
738
|
// its leading string, so the array form has to be handled explicitly — and a
|
|
723
739
|
// leading string that was ONLY the marker leaves an empty run behind.
|
|
@@ -751,6 +767,15 @@ function listItemFromToken(item, listToken, index, ctx = FLAT) {
|
|
|
751
767
|
}
|
|
752
768
|
blocks.push(...nestedBlocks);
|
|
753
769
|
|
|
770
|
+
// A LOOSE task item (blank line between items) carries its content as
|
|
771
|
+
// nested paragraph BLOCK tokens with an empty inline leader, so the
|
|
772
|
+
// leader-branch strip above never sees the marker. Strip it from the
|
|
773
|
+
// item's first paragraph wherever it came from — idempotent for tight
|
|
774
|
+
// items whose leader was already stripped.
|
|
775
|
+
if (item.task === true && blocks[0]?.type === 'paragraph') {
|
|
776
|
+
blocks[0] = { ...blocks[0], text: stripTaskMarker(blocks[0].text, true) };
|
|
777
|
+
}
|
|
778
|
+
|
|
754
779
|
const out = { blocks };
|
|
755
780
|
if (item.task) {
|
|
756
781
|
out.has_checkbox = true;
|
|
@@ -802,7 +827,7 @@ function blocksFromTokens(tokens, ctx = FLAT) {
|
|
|
802
827
|
const raw = t.raw || t.text || '';
|
|
803
828
|
if (t.type === 'html' && DETAILS_OPEN_RE.test(raw) && !DETAILS_CLOSE_RE.test(raw)) {
|
|
804
829
|
const summaryMatch = SUMMARY_TAG_RE.exec(raw);
|
|
805
|
-
const summary = summaryMatch ? summaryMatch[1].replace(HTML_TAG_STRIP_RE, '').trim() : '';
|
|
830
|
+
const summary = summaryMatch ? flattenSummaryMarkdown(summaryMatch[1].replace(HTML_TAG_STRIP_RE, '').trim()) : '';
|
|
806
831
|
const inner = [];
|
|
807
832
|
let closeRaw = null;
|
|
808
833
|
let j = i + 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polygram",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.1",
|
|
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": {
|