@llblab/pi-telegram 0.9.4 → 0.9.6

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/queue.ts CHANGED
@@ -1023,20 +1023,28 @@ export async function handleTelegramAgentEndRuntime<
1023
1023
  if (finalText) deps.setPreviewPendingText(finalText);
1024
1024
  if (!finalText && hasOutboundArtifacts) await deps.clearPreview(turn.chatId);
1025
1025
  if (endPlan.kind === "text" && finalText) {
1026
- const finalized = await deps.finalizeMarkdownPreview(
1027
- turn.chatId,
1028
- finalText,
1029
- turn.replyToMessageId,
1030
- { replyMarkup },
1031
- );
1032
- if (!finalized) {
1033
- await deps.clearPreview(turn.chatId);
1034
- await deps.sendMarkdownReply(
1026
+ try {
1027
+ const finalized = await deps.finalizeMarkdownPreview(
1035
1028
  turn.chatId,
1036
- turn.replyToMessageId,
1037
1029
  finalText,
1030
+ turn.replyToMessageId,
1038
1031
  { replyMarkup },
1039
1032
  );
1033
+ if (!finalized) {
1034
+ await deps.clearPreview(turn.chatId);
1035
+ await deps.sendMarkdownReply(
1036
+ turn.chatId,
1037
+ turn.replyToMessageId,
1038
+ finalText,
1039
+ { replyMarkup },
1040
+ );
1041
+ }
1042
+ } catch (error) {
1043
+ deps.recordRuntimeEvent?.("delivery", error, {
1044
+ phase: "final-text",
1045
+ chatId: turn.chatId,
1046
+ replyToMessageId: turn.replyToMessageId,
1047
+ });
1040
1048
  }
1041
1049
  }
1042
1050
  if (outboundReply && deps.sendOutboundReplyArtifacts) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@llblab/pi-telegram",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "private": false,
5
- "description": "Better Telegram DM bridge extension for π",
5
+ "description": "Telegram Runtime Adapter for π",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "pi-package",