@llblab/pi-telegram 0.17.5 β†’ 0.18.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.
Files changed (61) hide show
  1. package/AGENTS.md +67 -32
  2. package/BACKLOG.md +59 -19
  3. package/CHANGELOG.md +42 -15
  4. package/README.md +63 -35
  5. package/docs/README.md +3 -1
  6. package/docs/architecture.md +55 -23
  7. package/docs/callback-namespaces.md +1 -1
  8. package/docs/inbound.md +1 -1
  9. package/docs/locks.md +0 -2
  10. package/docs/multi-instance-bus.md +410 -0
  11. package/docs/outbound.md +4 -3
  12. package/docs/public-api.md +12 -10
  13. package/docs/sections.md +2 -2
  14. package/docs/ui-style.md +76 -0
  15. package/index.ts +789 -32
  16. package/lib/bindings.ts +68 -12
  17. package/lib/bus-api.ts +314 -0
  18. package/lib/bus-follower.ts +853 -0
  19. package/lib/bus-leader.ts +915 -0
  20. package/lib/bus.ts +866 -0
  21. package/lib/command-templates.ts +9 -11
  22. package/lib/commands.ts +133 -47
  23. package/lib/config.ts +53 -5
  24. package/lib/lifecycle.ts +23 -7
  25. package/lib/locks.ts +230 -66
  26. package/lib/media.ts +30 -2
  27. package/lib/menu-model.ts +48 -17
  28. package/lib/menu-queue.ts +51 -20
  29. package/lib/menu-settings.ts +9 -5
  30. package/lib/menu-status.ts +3 -0
  31. package/lib/menu-thinking.ts +3 -0
  32. package/lib/menu.ts +67 -26
  33. package/lib/outbound-attachments.ts +102 -17
  34. package/lib/outbound-buttons.ts +6 -2
  35. package/lib/outbound-voice.ts +31 -11
  36. package/lib/outbound.ts +6 -4
  37. package/lib/ownership.ts +119 -0
  38. package/lib/pi.ts +26 -3
  39. package/lib/polling.ts +477 -7
  40. package/lib/preview.ts +141 -88
  41. package/lib/prompt-templates.ts +3 -3
  42. package/lib/prompts.ts +80 -30
  43. package/lib/queue.ts +193 -91
  44. package/lib/rendering.ts +0 -25
  45. package/lib/replies.ts +187 -55
  46. package/lib/routing.ts +1673 -9
  47. package/lib/runtime-log.ts +123 -0
  48. package/lib/runtime.ts +84 -12
  49. package/lib/sections.ts +28 -21
  50. package/lib/setup.ts +9 -2
  51. package/lib/status.ts +532 -9
  52. package/lib/sync.ts +618 -0
  53. package/lib/target.ts +49 -0
  54. package/lib/telegram-api.ts +409 -41
  55. package/lib/text-groups.ts +5 -1
  56. package/lib/thread-reconciler.ts +915 -0
  57. package/lib/threads.ts +2205 -0
  58. package/lib/turns.ts +48 -3
  59. package/lib/updates.ts +355 -32
  60. package/package.json +24 -2
  61. package/docs/telegram-bot-api-rich-messages.md +0 -890
package/docs/ui-style.md CHANGED
@@ -11,6 +11,82 @@ Small standard for inline buttons, menu rows, state controls, cards, and confirm
11
11
  - Prefer minimal, clear configuration UI over exhaustive explanation.
12
12
  - Preserve domain-owned callback prefixes and behavior in the owning module.
13
13
 
14
+ ## Emoji Semantics
15
+
16
+ Use emoji as stable semantic markers, not decoration. Emoji carry transportable meaning across command descriptions, inline menu rows, message headings, status copy, and tests. Before adding a new UI emoji, either reuse one below or extend this registry in the same change.
17
+
18
+ ### Domain Markers
19
+
20
+ | Emoji | Meaning | Canonical surfaces | Notes |
21
+ | --- | --- | --- | --- |
22
+ | `🧡` | Telegram/Pi thread routing | Thread chooser headings, unbound-thread warnings, thread lifecycle/status copy | Canonical thread marker. Do not add it to every concrete target button; target buttons use `threadName` or slot fallback. |
23
+ | `πŸ“‘` | Telegram transport / bridge connection | Instance connected notices, polling/transport role, bridge online copy | Transport is not thread identity; use `🧡` for thread concepts. |
24
+ | `πŸ“Š` | Status / overview | `/status` command description, status cards or status rows | Use for status summaries, not queue priority. |
25
+ | `πŸ€–` | Model selection | `/model`, model menu headings, model status rows | Keep model-control surfaces visually distinct from thinking. |
26
+ | `🧠` | Thinking level | `/thinking`, thinking menu headings, thinking status rows | Use only for reasoning/thinking controls. |
27
+ | `πŸ”’` | Queue list / ordered work | `/queue`, queue menu entrypoints | Queue item rows may also use numeric labels. |
28
+ | `⏱️` | Queue is ticking / current work is active | Inline main-menu Queue row only | Running-clock queue state: the narrow present moment is being worked now. |
29
+ | `⏳` | Queue has waiting prompts | Inline main-menu Queue row only | Hourglass queue state: sand above the neck is future work still waiting. |
30
+ | `βŒ›` | Queue is empty / standing idle | Inline main-menu Queue row only | Standing hourglass queue state: no future work is waiting above the neck. |
31
+ | `βš™οΈ` | Settings / configuration | Settings menu headings and Settings navigation rows | Extension-injected rows appear before the built-in `βš™οΈ Settings` row. |
32
+ | `🧩` | Extension-provided surface | Extension command examples, extension section examples | Companion extensions may choose their own emoji, but `🧩` means generic extension/plugin. |
33
+ | `πŸ‘„` | Voice reply policy | Voice reply settings row and detail card | Not a generic audio attachment marker. |
34
+ | `πŸ•’` | Time injection / wall-clock context | Time injection settings row and detail card | Clock-face marker with hands; not a generic duration/progress marker. |
35
+ | `πŸ“Œ` | Proactive push / pinned behavior | Proactive push settings row and detail card | Not generic active/selected state. |
36
+ | `πŸ“Ž` | Attachment | Attachment summaries, queue rows for attachment-only turns | Not for thread binding. |
37
+
38
+ ### Command And Control Actions
39
+
40
+ | Emoji | Meaning | Canonical surfaces | Notes |
41
+ | --- | --- | --- | --- |
42
+ | `🟒` | Start / active / current positive state | `/start`, active row, current selected option, active `On` toggle | In command context it means β€œopen/start menu”; in state context it means selected/active. |
43
+ | `πŸ—œ` | Compact session | `/compact`, compact confirmation action | Do not use for generic cleanup/delete. |
44
+ | `⏩` | Force next queued turn | `/next` command and matching menu action | Means skip/advance to next waiting item. |
45
+ | `▢️` | Continue/resume generation | `/continue` command and matching menu action | Means resume/continue current session flow, not force-next. |
46
+ | `⏹️` | Abort current Pi work | `/abort` command description | Stops active work but is not a destructive queue clear by itself. |
47
+ | `πŸŸ₯` | Stop / abort-and-clear danger | `/stop` command description | Stronger than `⏹️`; use for disruptive stop/clear semantics. |
48
+ | `πŸ†•` | New session / fresh start | Reserved visible extension command example for `/new`-like flows | Same-thread Telegram `/new` is currently blocked by Pi core API; keep this meaning reserved. |
49
+ | `πŸŒ€` | Refresh | Queue refresh row and future refresh buttons | Re-fetch/re-render current surface, not transport reconnect. |
50
+ | `β†ͺ️` | Reroute to an existing target | Thread chooser buttons that send a captured command/message from one thread to another live thread | Curved arrow means the message arrived here but bends to another target. |
51
+ | `πŸ”` | Replace/restore mode | Thread replace/restore chooser entrypoints | Opens a second step for moving a Pi instance binding to the current source thread. |
52
+ | `➑️` | 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. |
53
+ | `β˜‘οΈ` | Activate / choose this item | Model detail activation action | Positive action; use `🟒 Active` for already-current state. |
54
+ | `❌` | No / cancel | Confirmation cancel buttons | Use for safe cancellation, not destructive removal. |
55
+ | `πŸ—‘` | Delete / remove | Queue delete actions, destructive confirmations, remove reaction | Use only when something is removed/closed/deleted. |
56
+
57
+ ### State Indicators And Button Grammars
58
+
59
+ | Emoji | Meaning | Canonical surfaces | Notes |
60
+ | --- | --- | --- | --- |
61
+ | `🟒` | Current/active/enabled `On` | Current option in vertical lists, active state rows, active `On` toggle | One strong current marker per option list. |
62
+ | `🟑` | Active `Off` or elevated/filter state | Active `Off` toggle, Priority/Scoped active tab | Yellow means intentionally not-normal or off/default-caution, not error. |
63
+ | `🟣` | Normal/default active tab | Normal priority tab, All/default scope tab, active page picker | Use for neutral active tabs. |
64
+ | `⚫️` | Inactive placeholder | Inactive toggle values and inactive tabs | Keeps row width stable. |
65
+ | `⬆️` | Navigate upward | `⬆️ Main menu`, `⬆️ Back` | Always first row in submenus. |
66
+
67
+ ### Queue Reaction Shortcuts
68
+
69
+ Queue reactions are shortcut controls for waiting turns. Preserve their semantics across Telegram reactions, queue-menu rows, status previews, and tests.
70
+
71
+ | Emoji | Meaning | Canonical surfaces | Notes |
72
+ | --- | --- | --- | --- |
73
+ | `πŸ‘` | Promote to priority | Queue reaction shortcut | Normalized from variants like `πŸ‘οΈ`. |
74
+ | `⚑` | Promote to priority / fast lane | Queue reaction shortcut, priority fallback badge | Also used as the default priority badge when no specific priority emoji is stored. |
75
+ | `❀` / `❀️` | Promote to priority | Queue reaction shortcut | Normalize display consistently where code normalizes reactions. |
76
+ | `πŸ•Š` / `πŸ•ŠοΈ` | Promote to priority | Queue reaction shortcut | Soft/peaceful promotion gesture. |
77
+ | `πŸ”₯` | Promote to priority | Queue reaction shortcut | Urgent/hot promotion gesture. |
78
+ | `πŸ‘Ž` | Remove waiting turn | Queue reaction shortcut | Removal, not negative feedback to the agent. |
79
+ | `πŸ‘»` | Remove waiting turn | Queue reaction shortcut | Disappear/remove metaphor. |
80
+ | `πŸ’”` | Remove waiting turn | Queue reaction shortcut | Removal/cancel metaphor. |
81
+ | `πŸ’©` | Remove waiting turn | Queue reaction shortcut | Removal/reject metaphor. |
82
+ | `πŸ—‘` | Remove/delete waiting turn | Queue reaction shortcut and queue delete UI | Same destructive semantics as delete buttons. |
83
+
84
+ ### Decorative Or Local-Example Emoji
85
+
86
+ Some emoji are intentionally local examples or decorative variants, not global semantics. Empty-queue rotating messages (`πŸ«™`, `πŸƒ`, `πŸ•³`, `πŸ¦—`, `πŸŒ™`, `🧘`, `πŸͺ`, `🧺`, `πŸ”­`, `🫧`, `πŸ›Έ`) are copy flavor only and must not become controls. Example extension icons such as `πŸ§ͺ`, `πŸ”§`, and `πŸ—‚` are documentation fixtures for companion extensions, not built-in pi-telegram meanings.
87
+
88
+ Thread UI rule: when a message heading, chooser, or status line is specifically about Telegram/Pi threads or target thread selection, start the heading with `🧡`. Button labels for concrete thread targets should stay clean (`threadName` or slot fallback) and should not add `🧡` to every target button unless the row would otherwise be ambiguous.
89
+
14
90
  ## Action Buttons
15
91
 
16
92
  Action buttons perform an operation.