@llblab/pi-telegram 0.42.3 → 0.43.0
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/BACKLOG.md +3 -0
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/docs/README.md +1 -1
- package/docs/architecture.md +5 -3
- package/docs/compact-matrix-literal.md +39 -11
- package/docs/generative-apps.md +2 -2
- package/docs/multi-instance-bus.md +17 -5
- package/docs/outbound.md +6 -4
- package/docs/public-api.md +1 -1
- package/index.ts +13 -1
- package/lib/bindings.ts +12 -3
- package/lib/bus-follower.ts +29 -18
- package/lib/bus-leader.ts +15 -6
- package/lib/bus.ts +11 -4
- package/lib/keyboard.ts +5 -3
- package/lib/outbound-buttons.ts +72 -15
- package/lib/outbound-markup.ts +81 -9
- package/lib/outbound.ts +2 -0
- package/lib/replies.ts +1 -1
- package/lib/routing.ts +89 -32
- package/lib/sync.ts +74 -15
- package/lib/telegram-api.ts +32 -1
- package/lib/thread-reconciler.ts +17 -0
- package/lib/threads.ts +123 -15
- package/package.json +1 -1
- package/skills/generated-control-surface/SKILL.md +4 -2
- package/skills/generated-control-surface/references/layout-and-state.md +4 -2
- package/skills/generative-apps/SKILL.md +4 -3
- package/skills/telegram-bridge/SKILL.md +19 -8
|
@@ -15,7 +15,8 @@ Use Telegram as a mobile companion to the current Pi session. Preserve the exact
|
|
|
15
15
|
| Attach a requested file to the current turn | `telegram_attach(path)` without targeting |
|
|
16
16
|
| Explicitly send from local/TUI to Telegram | `telegram_message` or `telegram_attach` |
|
|
17
17
|
| Explicitly send to a different live Thread | `telegram_message(thread=...)` |
|
|
18
|
-
| Add
|
|
18
|
+
| Add buttons | Hidden comment for footer; `telegram_button` fence for in-body rows |
|
|
19
|
+
| Add explicit voice | Top-level hidden action comment |
|
|
19
20
|
| Build a repeated deterministic interaction | Follow `generative-apps` |
|
|
20
21
|
|
|
21
22
|
A connected Telegram session proves capability, not user intent. Use Telegram features on Telegram-originated turns or explicit Telegram delivery requests only. Never call `telegram_message` for the current active target.
|
|
@@ -39,7 +40,7 @@ Reply in concise, phone-width Telegram Rich Markdown. Use `$...$` and `$$...$$`
|
|
|
39
40
|
|
|
40
41
|
## Assistant Actions
|
|
41
42
|
|
|
42
|
-
`telegram_button` and `telegram_voice` are
|
|
43
|
+
`telegram_button` and `telegram_voice` are markup, not tools. Emit action comments at column zero outside lists, quotes, code, and indentation. Comments create footer buttons or voice artifacts. For buttons between paragraphs, use a column-zero triple-backtick `telegram_button` block. Both button wrappers accept the same singleton JSON/CML cell or mixed matrix; the wrapper determines placement. Telegram removes every assistant-authored HTML comment from previews and final replies regardless of owner or Markdown position; only recognized top-level wrappers activate actions; comment-only output sends no text message.
|
|
43
44
|
|
|
44
45
|
### Shared Encoding Rule
|
|
45
46
|
|
|
@@ -48,25 +49,35 @@ Choose the least verbose sufficient representation:
|
|
|
48
49
|
1. Positional CML — default.
|
|
49
50
|
2. JSON — only when multiline content, named fields, or escaping earns it.
|
|
50
51
|
|
|
51
|
-
CML trims atom boundaries and decodes `\|`, `\}`, and `\\`. Keep
|
|
52
|
+
CML trims atom boundaries and decodes `\|`, `\}`, and `\\`. Keep each payload inside one complete wrapper.
|
|
52
53
|
|
|
53
54
|
### Prompt Buttons
|
|
54
55
|
|
|
55
|
-
Every button has a self-contained prompt and an optional selection style. Use a short distinct `emoji + space + text` label when separate human-readable labeling adds meaning; established coordinates or symbolic tokens may use the prompt itself as visible text. A click creates an ordinary user request; it never grants authority or bypasses confirmation.
|
|
56
|
+
Every enabled button has a self-contained prompt and an optional selection style. Use a short distinct `emoji + space + text` label when separate human-readable labeling adds meaning; established coordinates or symbolic tokens may use the prompt itself as visible text. A click creates an ordinary user request; it never grants authority or bypasses confirmation.
|
|
56
57
|
|
|
57
58
|
- `{prompt}` uses the same text for label and prompt.
|
|
58
59
|
- `{|prompt}` omits a separately authored label and uses the prompt as both visible text and queued prompt.
|
|
59
60
|
- `{label|prompt}` separates visible label from queued prompt.
|
|
60
61
|
- `{label|prompt|selected_style}` and `{|prompt|selected_style}` accept `primary`, `success`, or `danger`.
|
|
62
|
+
- Fourth-position `1`/`true` disables, `0`/`false` enables; omission means enabled. JSON uses boolean `disabled`. `{|Next||1}` omits label/style; `{Next|||1}` omits prompt/style; `{|||1}` is blank (Telegram receives a non-breaking space). Prefer meaningful labels and retain a useful enabled action. Enabled CML requires a prompt. Disabled controls stay visible but have no callback, queued prompt, or bound-method invocation.
|
|
61
63
|
- Top-level cells form vertical rows; one nested row groups horizontal peers.
|
|
62
|
-
- Prefer one matrix
|
|
64
|
+
- Prefer one matrix per related group. Fenced blocks stay in place in Rich mode; HTML compatibility moves them to the footer. Native rows allow eight buttons. Malformed/oversized/unclosed blocks activate nothing; drafts hide them. Outer code fences and quoted/indented examples remain literal.
|
|
65
|
+
- Both placements share prompt/app routing. In-body clicks acknowledge without recoloring; selected-style highlighting remains footer-only.
|
|
66
|
+
|
|
67
|
+
A single in-body button (the four-backtick wrapper below makes this a literal example):
|
|
68
|
+
|
|
69
|
+
````markdown
|
|
70
|
+
```telegram_button
|
|
71
|
+
{📖 Details|Explain this section.}
|
|
72
|
+
```
|
|
73
|
+
````
|
|
63
74
|
|
|
64
75
|
```html
|
|
65
76
|
<!-- telegram_button [{▶️ Continue|Continue the current plan.}[{✅ Approve|Approve this.}{❌ Reject|Reject this.}]] -->
|
|
66
77
|
<!-- telegram_button {"label":"💡 Explain","prompt":"Explain this.\nInclude the risks."} -->
|
|
67
78
|
```
|
|
68
79
|
|
|
69
|
-
Proactively use `generated-control-surface` whenever controls can materially shorten likely feedback; once active, it must emit useful buttons rather than prose alone. That Skill owns action composition; this Skill owns Telegram serialization and delivery.
|
|
80
|
+
Proactively use `generated-control-surface` whenever controls can materially shorten likely feedback; once active, it must emit useful buttons rather than prose alone. That Skill owns action composition; this Skill owns Telegram serialization and delivery. Footer-only replies receive the standard choice heading.
|
|
70
81
|
|
|
71
82
|
### Voice
|
|
72
83
|
|
|
@@ -113,6 +124,6 @@ Before replying:
|
|
|
113
124
|
|
|
114
125
|
- Use the ordinary path for the current target and direct tools only for explicit other delivery.
|
|
115
126
|
- Attach requested files rather than only mentioning them.
|
|
116
|
-
- Keep action comments top-level, complete, and canonical: CML first, JSON when necessary.
|
|
117
|
-
- Give every button a self-contained prompt; preserve confirmation for dangerous actions.
|
|
127
|
+
- Keep action comments and button fences top-level, complete, and canonical: CML first, JSON when necessary; either syntax may coexist within one matrix.
|
|
128
|
+
- Give every enabled button a self-contained prompt; preserve confirmation for dangerous actions.
|
|
118
129
|
- Expose no secret or hidden reasoning.
|