polygram 0.5.10 → 0.5.11
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/lib/prompt.js +11 -3
- package/package.json +1 -1
- package/polygram.js +9 -1
package/lib/prompt.js
CHANGED
|
@@ -121,9 +121,17 @@ function buildChannelAttrs({ chatId, msgId, user, userId, ts, threadId, topicNam
|
|
|
121
121
|
|
|
122
122
|
function buildAttachmentTags(attachments) {
|
|
123
123
|
if (!attachments?.length) return '';
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
// Failed downloads (no `path`, has `error`) get a separate tag so claude
|
|
125
|
+
// can mention them to the user instead of pretending nothing was sent.
|
|
126
|
+
// The actual failure reason is included so claude can offer a useful
|
|
127
|
+
// recovery hint ("looks like the file is too large", "Telegram CDN had
|
|
128
|
+
// a 410 — could you resend?").
|
|
129
|
+
return attachments.map((a) => {
|
|
130
|
+
if (a.error || !a.path) {
|
|
131
|
+
return `<attachment-failed kind="${xmlEscape(a.kind)}" name="${xmlEscape(a.name)}" mime="${xmlEscape(a.mime_type)}" reason="${xmlEscape(a.error || 'no local path')}" />`;
|
|
132
|
+
}
|
|
133
|
+
return `<attachment kind="${xmlEscape(a.kind)}" name="${xmlEscape(a.name)}" mime="${xmlEscape(a.mime_type)}" size="${a.size || 0}" path="${xmlEscape(a.path)}" />`;
|
|
134
|
+
}).join('\n');
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
function buildVoiceTags(attachments) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polygram",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
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
|
@@ -415,7 +415,15 @@ async function downloadAttachments(bot, token, chatId, msg, attachments) {
|
|
|
415
415
|
results.push({ ...att, path: localPath, size: att.size || buf.length });
|
|
416
416
|
console.log(`[attach] ${chatId} ← ${att.kind} ${safeName} (${buf.length} bytes) → ${localPath}`);
|
|
417
417
|
} catch (err) {
|
|
418
|
-
|
|
418
|
+
// Don't drop the attachment silently — push it through with the
|
|
419
|
+
// failure noted. buildAttachmentTags renders this as
|
|
420
|
+
// <attachment-failed reason="..." /> so claude tells the user
|
|
421
|
+
// "I couldn't see your <kind>" instead of pretending it received
|
|
422
|
+
// text only. Pre-0.5.11 these were logged to console and dropped,
|
|
423
|
+
// so claude got the prompt as if no attachment was sent.
|
|
424
|
+
const reason = (err.message || 'unknown').slice(0, 200);
|
|
425
|
+
console.error(`[attach] download failed for ${att.name}: ${reason}`);
|
|
426
|
+
results.push({ ...att, path: null, error: reason });
|
|
419
427
|
}
|
|
420
428
|
}
|
|
421
429
|
return results;
|