@llblab/pi-telegram 0.39.0 → 0.39.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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  > Each release keeps at most 8 outcome records of at most 512 characters.
4
4
 
5
+ ## 0.39.1: Compaction Failure Formatting Hotfix
6
+
7
+ - `Compaction Failure Formatting`: Preserves the HTML parse mode when a confirmed `/compact` callback reports asynchronous failure, preventing bold standalone failure headings from appearing as literal `<b>…</b>` markup in Telegram.
8
+
5
9
  ## 0.39.0: Session-Owned Queue Lifecycle
6
10
 
7
11
  - `Queue Counters`: Excludes Skip-marked prompts immediately from the shared executable queue count used by the Pi status bar and Telegram main menu while preserving physical queue position, deferred drop semantics, and reversible Keep behavior.
package/docs/ui-style.md CHANGED
@@ -53,7 +53,7 @@ Use emoji as stable semantic markers, not decoration. Emoji carry transportable
53
53
  | `🔁` | Replace/restore mode | Thread replace/restore chooser entrypoints | Opens a second step for moving a Pi instance binding to the current source thread. |
54
54
  | `➡️` | Choose replacement target | Thread replace/restore target buttons that select which Pi instance should move to the current thread | Use inside the second replace/restore chooser, not for ordinary reroutes. |
55
55
  | `☑️` | Activate / choose this item | Model detail activation action, generated button-only choice heading | Positive selection cue; use `🟢 Active` for already-current state. |
56
- | `❌` | No / cancel / failed | Confirmation cancel buttons and failure notices | Use for safe cancellation or operation failure, not destructive removal. |
56
+ | `❌` | No / cancel / terminal failure | Confirmation cancel buttons and terminal failure notices | Do not use for a recoverable operation failure that leaves session state intact. |
57
57
  | `🗑` | Delete / defer removal | Destructive confirmations and removal reaction | In the queue menu, reversible Keep/Skip selectors replace immediate deletion. |
58
58
 
59
59
  ### Informational Feedback
@@ -63,6 +63,7 @@ Use emoji as stable semantic markers, not decoration. Emoji carry transportable
63
63
  | `💤` | Nothing active | No-active-turn notices | Neutral idle result, not an error. |
64
64
  | `✅` | Completed successfully | Compaction and other completion notices | Use only after the operation has completed. |
65
65
  | `🚫` | Unavailable, denied, or cancelled operation | Missing capability/auth notices, access denial, and compaction cancellation | Callback alerts use the same emoji without bold markup. |
66
+ | `⚠️` | Recoverable operation failure | Compaction failure notice | The attempted operation failed, but the original session state remains usable. |
66
67
 
67
68
  ### State Indicators And Button Grammars
68
69
 
package/lib/commands.ts CHANGED
@@ -1133,6 +1133,25 @@ function getTelegramCommandErrorMessage(error: unknown): string {
1133
1133
  return error instanceof Error ? error.message : String(error);
1134
1134
  }
1135
1135
 
1136
+ function formatTelegramCompactionFailure(error: unknown): string {
1137
+ let message = getTelegramCommandErrorMessage(error).trim();
1138
+ const redundantPrefixes = [
1139
+ "Compaction failed: ",
1140
+ "Turn prefix summarization failed: ",
1141
+ ];
1142
+ let stripped = true;
1143
+ while (stripped) {
1144
+ stripped = false;
1145
+ for (const prefix of redundantPrefixes) {
1146
+ if (!message.startsWith(prefix)) continue;
1147
+ message = message.slice(prefix.length).trim();
1148
+ stripped = true;
1149
+ }
1150
+ }
1151
+ const sentence = /[.!?]$/u.test(message) ? message : `${message}.`;
1152
+ return `Compaction failed! ${sentence}`;
1153
+ }
1154
+
1136
1155
  export function parseTelegramCommand(
1137
1156
  text: string,
1138
1157
  ): ParsedTelegramCommand | undefined {
@@ -1432,11 +1451,10 @@ export async function handleTelegramCompactCommand(
1432
1451
  deps.updateStatus();
1433
1452
  dispatchNextQueuedTelegramTurnAfterCompact(deps);
1434
1453
  deps.recordRuntimeEvent?.("compact", error);
1435
- const errorMessage = getTelegramCommandErrorMessage(error);
1436
1454
  void deps.sendTextReply(
1437
1455
  formatTelegramInformationHeading(
1438
- "",
1439
- `Compaction failed: ${errorMessage}`,
1456
+ "⚠️",
1457
+ formatTelegramCompactionFailure(error),
1440
1458
  ),
1441
1459
  { parseMode: "HTML" },
1442
1460
  );
@@ -1447,11 +1465,10 @@ export async function handleTelegramCompactCommand(
1447
1465
  deps.setCompactionInProgress(false);
1448
1466
  deps.updateStatus();
1449
1467
  deps.recordRuntimeEvent?.("compact", error);
1450
- const errorMessage = getTelegramCommandErrorMessage(error);
1451
1468
  await deps.sendTextReply(
1452
1469
  formatTelegramInformationHeading(
1453
- "",
1454
- `Compaction failed: ${errorMessage}`,
1470
+ "⚠️",
1471
+ formatTelegramCompactionFailure(error),
1455
1472
  ),
1456
1473
  { parseMode: "HTML" },
1457
1474
  );
package/lib/routing.ts CHANGED
@@ -1677,9 +1677,12 @@ export function createTelegramInboundRouteRuntime<
1677
1677
  })
1678
1678
  : undefined,
1679
1679
  stopTypingLoop: deps.stopTypingLoop,
1680
- sendTextReply: (text) =>
1680
+ sendTextReply: (text, options) =>
1681
1681
  deps
1682
- .sendTextReply(chatId, replyToMessageId, text, { target })
1682
+ .sendTextReply(chatId, replyToMessageId, text, {
1683
+ target,
1684
+ parseMode: options?.parseMode,
1685
+ })
1683
1686
  .then(() => {}),
1684
1687
  suppressStartNotice: true,
1685
1688
  recordRuntimeEvent: deps.recordRuntimeEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-telegram",
3
- "version": "0.39.0",
3
+ "version": "0.39.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"