@llblab/pi-telegram 0.2.6 → 0.2.7

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,7 @@
2
2
 
3
3
  ## Current
4
4
 
5
+ - `[Queue UI]` Marked liked high-priority queued Telegram turns with `⬆` in the pi status-bar queue preview. Impact: operators can now distinguish reaction-promoted turns from normal queued prompts at a glance.
5
6
  - `[Docs]` Added short responsibility header comments to every project `.ts` file. Impact: file boundaries are easier to understand while navigating the growing `/lib` split.
6
7
  - `[Naming]` Renamed extracted domain modules and mirrored regression suites to use repo-scoped bare domain filenames such as `api.ts`, `queue.ts`, and `queue.test.ts` instead of repeating `telegram-*` in every path. Impact: the internal topology is easier to scan and stays aligned with the repository-level Telegram scope.
7
8
  - `[Controls]` Expanded Telegram session controls with a richer `/status` view, inline model selection, and thinking-level controls, and fixed the callback-selection path so idle model and thinking picks apply immediately instead of only becoming visible after a later Telegram interaction. Impact: more bridge configuration can be managed directly from Telegram with more predictable immediate feedback.
package/README.md CHANGED
@@ -24,7 +24,7 @@ Compared to upstream commit `cb34008`, this fork significantly extends and harde
24
24
  - Markdown and reply rendering improvements, with richer formatting support, narrow-client-friendly table/list rendering, quote compatibility fixes, and multiple fixes for incorrect Telegram rendering and chunking edge cases
25
25
  - Streaming, attachment, and delivery workflow hardening, including more robust preview updates and file handling
26
26
  - General runtime polish, bug fixes, and refactors across pairing, command handling, and Telegram session behavior
27
- - Cleaner internal domain layout, with flat `/lib/*.ts` modules and mirrored `/tests/*.test.ts` suites that use repo-scoped domain names instead of redundant `telegram-*` filename prefixes
27
+ - Cleaner internal domain layout, with flat `/lib/*.ts` modules and mirrored `/tests/*.test.ts` suites that use repo-scoped domain names
28
28
 
29
29
  In short: this fork is no longer just a repackaged copy of upstream; it is a feature-expanded and bug-fixed Telegram frontend for pi.
30
30
 
@@ -162,9 +162,11 @@ If you send more Telegram messages while pi is busy, they are queued and process
162
162
  The pi status bar shows queued Telegram turns as compact previews, for example:
163
163
 
164
164
  ```text
165
- +3: [summarize this image…, write a shell script…, 📎 2 attachments]
165
+ +3: [ write a shell script…, summarize this image…, 📎 2 attachments]
166
166
  ```
167
167
 
168
+ Priority turns promoted with 👍 are marked with `⬆` in that queue preview.
169
+
168
170
  Each preview is limited to at most 4 words or 32 characters.
169
171
 
170
172
  ### Reprioritize or discard queued messages
@@ -68,7 +68,7 @@ Queued items now use two explicit dimensions:
68
68
  - `kind`: prompt vs control
69
69
  - `queueLane`: control vs priority vs default
70
70
 
71
- This lets synthetic control actions and Telegram prompts share one stable ordering model while still rendering distinctly in status output.
71
+ This lets synthetic control actions and Telegram prompts share one stable ordering model while still rendering distinctly in status output. In the pi status bar queue preview, priority prompts are marked with `⬆` while control items keep their own control-specific summary markers such as `⚡`.
72
72
 
73
73
  A dispatched prompt remains in the queue until `agent_start` consumes it. That keeps the active Telegram turn bound correctly for previews, attachments, abort handling, and final reply delivery.
74
74
 
package/lib/queue.ts CHANGED
@@ -189,6 +189,13 @@ export function consumeDispatchedTelegramPrompt(
189
189
  return { activeTurn: nextItem, remainingItems: items.slice(1) };
190
190
  }
191
191
 
192
+ function formatTelegramQueueItemStatusSummary(item: TelegramQueueItem): string {
193
+ if (item.queueLane === "priority") {
194
+ return `⬆ ${item.statusSummary}`;
195
+ }
196
+ return item.statusSummary;
197
+ }
198
+
192
199
  export function formatQueuedTelegramItemsStatus(
193
200
  items: TelegramQueueItem[],
194
201
  ): string {
@@ -196,7 +203,7 @@ export function formatQueuedTelegramItemsStatus(
196
203
  const previewCount = 4;
197
204
  const summaries = items
198
205
  .slice(0, previewCount)
199
- .map((item) => item.statusSummary)
206
+ .map(formatTelegramQueueItemStatusSummary)
200
207
  .filter(Boolean);
201
208
  if (summaries.length === 0) return ` +${items.length}`;
202
209
  const suffix = items.length > summaries.length ? ", …" : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llblab/pi-telegram",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "private": false,
5
5
  "description": "Better Telegram DM bridge extension for pi",
6
6
  "type": "module",
@@ -29,7 +29,8 @@
29
29
  "pi": {
30
30
  "extensions": [
31
31
  "./index.ts"
32
- ]
32
+ ],
33
+ "image": "https://github.com/llblab/pi-telegram/raw/main/screenshot.png"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "@mariozechner/pi-ai": "*",
package/screenshot.png CHANGED
Binary file
@@ -16,6 +16,7 @@ import {
16
16
  buildTelegramSessionStartState,
17
17
  executeTelegramControlItemRuntime,
18
18
  executeTelegramQueueDispatchPlan,
19
+ formatQueuedTelegramItemsStatus,
19
20
  getNextTelegramToolExecutionCount,
20
21
  shouldStartTelegramPolling,
21
22
  } from "../lib/queue.ts";
@@ -169,6 +170,57 @@ test("Queue mutation helpers apply and clear prompt priority without touching co
169
170
  assert.equal(cleared.items[1]?.queueLane, "control");
170
171
  });
171
172
 
173
+ test("Queued status formatting marks priority prompts in the pi status bar", () => {
174
+ const queueItemType = undefined as
175
+ | Parameters<typeof formatQueuedTelegramItemsStatus>[0][number]
176
+ | undefined;
177
+ const priorityPrompt: typeof queueItemType = {
178
+ kind: "prompt",
179
+ chatId: 1,
180
+ replyToMessageId: 1,
181
+ sourceMessageIds: [11],
182
+ queueOrder: 4,
183
+ queueLane: "priority",
184
+ laneOrder: 0,
185
+ queuedAttachments: [],
186
+ content: [{ type: "text", text: "prompt" }],
187
+ historyText: "prompt history",
188
+ statusSummary: "prompt",
189
+ };
190
+ const defaultPrompt: typeof queueItemType = {
191
+ kind: "prompt",
192
+ chatId: 1,
193
+ replyToMessageId: 2,
194
+ sourceMessageIds: [12],
195
+ queueOrder: 5,
196
+ queueLane: "default",
197
+ laneOrder: 5,
198
+ queuedAttachments: [],
199
+ content: [{ type: "text", text: "default" }],
200
+ historyText: "default history",
201
+ statusSummary: "default",
202
+ };
203
+ const controlItem: typeof queueItemType = {
204
+ kind: "control",
205
+ controlType: "status",
206
+ chatId: 1,
207
+ replyToMessageId: 3,
208
+ queueOrder: 6,
209
+ queueLane: "control",
210
+ laneOrder: 0,
211
+ statusSummary: "⚡ status",
212
+ execute: async () => {},
213
+ };
214
+ assert.equal(
215
+ formatQueuedTelegramItemsStatus([
216
+ controlItem,
217
+ priorityPrompt,
218
+ defaultPrompt,
219
+ ]),
220
+ " +3: [⚡ status, ⬆ prompt, default]",
221
+ );
222
+ });
223
+
172
224
  test("History partition keeps control items queued and extracts prompt items", () => {
173
225
  const queueItemType = undefined as
174
226
  | Parameters<