@llblab/pi-telegram 0.29.0 → 0.30.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/AGENTS.md +1 -1
- package/CHANGELOG.md +5 -0
- package/README.md +3 -3
- package/docs/architecture.md +2 -2
- package/docs/outbound.md +5 -5
- package/docs/public-api.md +1 -1
- package/lib/outbound-markup.ts +2 -2
- package/package.json +1 -1
- package/skills/control-surface/SKILL.md +177 -0
- package/skills/telegram-bridge/SKILL.md +2 -2
- package/skills/button-console/SKILL.md +0 -139
package/AGENTS.md
CHANGED
|
@@ -43,7 +43,7 @@ Keep each fact in one authoritative layer:
|
|
|
43
43
|
- `/lib/*.ts`: Flat, cohesive runtime domains; package-private unless re-exported through `/api`.
|
|
44
44
|
- `/tests/*.test.ts`: Domain-mirrored suites; `tests/integration.test.ts` owns cross-domain runtime flows.
|
|
45
45
|
- `/skills/telegram-bridge`: Stable agent operating protocol for Telegram turns, delivery, actions, Threaded Mode, and diagnosis.
|
|
46
|
-
- `/skills/
|
|
46
|
+
- `/skills/control-surface`: Optional agent-generated cybernetic control surface over truthful domain evidence, workflows, and choices; it remains independent from the bridge skill and owns no parallel state.
|
|
47
47
|
- `/.agents/skills/telegram-bot`: Bot API lookup guidance and vendored `api.md`; keep the reference intact.
|
|
48
48
|
- `/.agents/skills/domain-dag`: Repository architecture guidance and validator.
|
|
49
49
|
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> Each release keeps at most 8 outcome records of at most 512 characters.
|
|
4
4
|
|
|
5
|
+
## 0.30.0: Generated Control Surfaces
|
|
6
|
+
|
|
7
|
+
- `Generated Control Surface`: Replaced the CLI-bound Button Console with a transport-aware Control Surface Skill that proactively generates truthful contextual controls when they shorten feedback for workflows, stateful systems, navigation, Actor supervision, and decisions while preserving domain ownership, ordinary prompt authority, confirmation boundaries, and stateless regeneration.
|
|
8
|
+
- `Action Markup`: Standardized `telegram_button` and `telegram_voice` on one colon-free action marker for both JSON and attribute payloads. Colon-prefixed forms are rejected instead of remaining a redundant compatibility syntax.
|
|
9
|
+
|
|
5
10
|
## 0.29.0: Skill-First Agent Operation
|
|
6
11
|
|
|
7
12
|
- `Bundled Skills`: Added discoverable `telegram-bridge` and `button-console` Skills through package metadata and source-checkout resource discovery. Stable turn, delivery, action, Threaded Mode, formatting, handler, and diagnosis guidance now lives in the bridge Skill, while Button Console provides optional evidence-backed CLI navigation.
|
package/README.md
CHANGED
|
@@ -188,11 +188,11 @@ Inbound files land under `<agent-dir>/tmp/telegram` and default to a 50 MiB limi
|
|
|
188
188
|
|
|
189
189
|
### Voice And Media
|
|
190
190
|
|
|
191
|
-
Voice notes, audio, images, PDFs, and other media can pass through configured inbound handlers, programmatic handlers, or registered STT providers. Outbound voice can use configured `outboundHandlers` or registered TTS providers; `pi-telegram` owns reply policy and Telegram transport, while providers own synthesis. Explicit `telegram_voice` actions accept either a JSON object or compact double-quoted attributes, with equivalent `text` and `value` payload keys and
|
|
191
|
+
Voice notes, audio, images, PDFs, and other media can pass through configured inbound handlers, programmatic handlers, or registered STT providers. Outbound voice can use configured `outboundHandlers` or registered TTS providers; `pi-telegram` owns reply policy and Telegram transport, while providers own synthesis. Explicit `telegram_voice` actions accept either a JSON object or compact double-quoted attributes, with equivalent `text` and `value` payload keys and one colon-free action marker.
|
|
192
192
|
|
|
193
193
|
### Buttons And Callbacks
|
|
194
194
|
|
|
195
|
-
Assistant replies can include top-level hidden `telegram_button` comments using either a JSON object or compact double-quoted attributes. Buttons use `label` plus `prompt`, or the compact `value` key when both are identical. The
|
|
195
|
+
Assistant replies can include top-level hidden `telegram_button` comments using either a JSON object or compact double-quoted attributes. Buttons use `label` plus `prompt`, or the compact `value` key when both are identical. The action marker is colon-free for both payload forms. The bridge strips the comments from visible text, renders inline buttons, and routes callbacks back into Pi as queued prompts or extension-owned callback actions. Button-only replies receive the standard `☑️ **Choose an option:**` heading as automatic visible fallback text. Once a generated prompt button is accepted, only that exact button switches to its optional `selected_style` (`primary` blue by default, `success` green, or `danger` red) without altering its agent-authored label or emoji; every style still queues the selected prompt.
|
|
196
196
|
|
|
197
197
|
### Threaded Mode And Multi-Instance Bus
|
|
198
198
|
|
|
@@ -257,7 +257,7 @@ Durable inbound admission is a **process-crash recovery** guarantee. Atomic priv
|
|
|
257
257
|
|
|
258
258
|
Telegram is a companion surface around a live Pi runtime, not a second runtime. It can compact the current session, but it cannot create, resume, fork, browse, or switch sessions until Pi exposes safe public extension APIs for those operations.
|
|
259
259
|
|
|
260
|
-
A Telegram prompt is a normal model turn in the active Pi session and therefore inherits that session's active post-compaction context; the bridge does not make token cost proportional only to the new mobile message. The bundled `telegram-bridge` Skill owns agent operation and `
|
|
260
|
+
A Telegram prompt is a normal model turn in the active Pi session and therefore inherits that session's active post-compaction context; the bridge does not make token cost proportional only to the new mobile message. The bundled `telegram-bridge` Skill owns agent operation and `control-surface` provides optional evidence-backed controls for workflows, stateful systems, navigation, supervision, and decisions—not only terminal operations. Disconnecting removes pi-telegram's delivery tools and transient routing guidance from later requests until direct ownership or follower registration returns, without changing other active Pi tools. Pi session JSONL contains model history; profile-scoped pi-telegram `logs*.jsonl` contains redacted operational events and is never model context.
|
|
261
261
|
|
|
262
262
|
## Documentation Map
|
|
263
263
|
|
package/docs/architecture.md
CHANGED
|
@@ -324,7 +324,7 @@ Final delivery attaches reply metadata only where requested. Reply parameters ap
|
|
|
324
324
|
|
|
325
325
|
Outbound files staged during an active Telegram turn are delivered after that turn completes. They use `telegram_attach`, are checked atomically per tool call, and use configurable size limits before photo/document upload. When no Telegram turn is active, `telegram_attach` sends files immediately to the paired/default chat, an assigned follower thread, or an explicit `chat_id` plus optional `thread_id`; `telegram_message` provides direct local/TUI Markdown text delivery for explicit user requests and runs the same `telegram_button` markup planner so buttons attach to that text message. Direct local/TUI delivery is singleton-controlled: classic mode requires this Pi instance to own `/telegram-connect`, while Threaded Mode followers must be registered and route through the leader-owned transport. Already accepted active-turn reply/attachment delivery remains session-local.
|
|
326
326
|
|
|
327
|
-
Assistant-authored final-message actions use hidden top-level comments. Both actions accept a JSON object or double-quoted HTML-like attributes
|
|
327
|
+
Assistant-authored final-message actions use hidden top-level comments. Both actions accept a JSON object or double-quoted HTML-like attributes after one colon-free action marker; colon-prefixed payloads are rejected:
|
|
328
328
|
|
|
329
329
|
- `telegram_voice` creates voice reply artifacts through configured outbound handlers, programmatic voice handlers, or registered synthesis providers.
|
|
330
330
|
- `telegram_button` creates inline buttons whose callbacks enqueue the configured prompt text as a normal Telegram prompt turn.
|
|
@@ -362,7 +362,7 @@ Complete intermediate assistant text blocks from Telegram-originated activity ar
|
|
|
362
362
|
|
|
363
363
|
`assistant.activity` is an independent bridge-owned projection over normalized Activity events. Each process reloads the shared file-backed setting at `agent-start` before activity admission, so multi-instance mode cannot continue projecting a stale broader process-local selection. Omitted values resolve to `verbose`, while invalid values fail closed to `quiet`; `thinking` and `tools` select one technical class, while `verbose` enables both. Provider-exposed thinking uses persistent ordinary HTML containing only a standard expandable blockquote with a bounded redacted latest-text window and inline Markdown rendered as Telegram HTML. Completed executed tools use native Rich Messages: each closed `<Tool>: <status>` root details node renders snake-case names as title words while preserving an uppercase two- or three-letter repeated prefix per word, then the native disclosure chevron reveals an open-by-default `arguments` child plus closed retained `update N` and `result`/`error` child details with lowercase monospaced, marker-free summaries and JSON pre blocks; known-safe Rich rejections fall back to the previous HTML disclosure. The projection captures the exact target and transport stamp at activity admission, serializes updates, preserves tool-start order, closes coalescing across assistant/thinking boundaries, bounds retained text/update memory plus edit frames and message/tool size, disables previews and HTTP(S) auto-link recognition inside technical evidence, and never replays a possibly committed send. Session generations own independent queues, so replacement drops queued old work without waiting on an old call. Both proactive prose and active-turn final delivery wait for the admitted activity queue inside their extension-owned delivery tasks, preserving technical-before-semantic ordering without delaying Pi lifecycle completion. Settlement, replacement, disconnect, failure, or stale authority clears only local ownership; already-sent activity messages remain in chat.
|
|
364
364
|
|
|
365
|
-
Telegram prompt guidance is context- and authority-aware. The package and source-checkout extension both contribute `telegram-bridge` plus the optional `
|
|
365
|
+
Telegram prompt guidance is context- and authority-aware. The package and source-checkout extension both contribute `telegram-bridge` plus the optional `control-surface` Skill through Pi resource discovery. The latter generates transient evidence-backed controls over domain-owned workflows, systems, navigation, supervision, and decisions without creating parallel application state. Only an exact direct owner or live registered follower exposes the two pi-telegram delivery tools, their active-tool metadata, and the compact routing suffix. Disconnect or authority loss removes those tool surfaces for subsequent requests without touching foreign tools; reconnect/recovery restores only the pi-telegram subset that was active before suspension, including across same-process reload. Telegram-originated turns route to the stable Skill contract and retain dynamic blocks such as `[voice] delivery: automatic voice`; the Skill and public documentation own syntax, target routing, Threaded Mode behavior, and diagnostics.
|
|
366
366
|
|
|
367
367
|
## In-Flight Model Switching
|
|
368
368
|
|
package/docs/outbound.md
CHANGED
|
@@ -135,12 +135,12 @@ Assistant replies can include hidden voice actions in either supported payload f
|
|
|
135
135
|
```md
|
|
136
136
|
Full text answer stays here.
|
|
137
137
|
|
|
138
|
-
<!-- telegram_voice
|
|
138
|
+
<!-- telegram_voice {"value":"Short spoken companion summary.","lang":"ru","rate":"+30%"} -->
|
|
139
139
|
|
|
140
140
|
<!-- telegram_voice text="Short spoken companion summary." lang="ru" rate="+30%" -->
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
The bridge strips the comment from Telegram text. On `agent_end`, it maps each `telegram_voice` action to a provider call, generates one file per action, and sends each file as an independent Telegram-native voice message. Equivalent `text` or `value` supplies the spoken payload, with explicit `text` taking precedence when both appear; `lang` and `rate` are optional.
|
|
143
|
+
The bridge strips the comment from Telegram text. On `agent_end`, it maps each `telegram_voice` action to a provider call, generates one file per action, and sends each file as an independent Telegram-native voice message. Equivalent `text` or `value` supplies the spoken payload, with explicit `text` taking precedence when both appear; `lang` and `rate` are optional. A colon after `telegram_voice` is rejected so both payload forms share one unambiguous action marker. Use JSON for long or escaped text and encode line breaks inside JSON strings as `\n`. The opening marker must start at column zero on a top-level line outside fenced code, quotes, lists, and indented examples; otherwise it remains literal Markdown.
|
|
144
144
|
|
|
145
145
|
## Buttons Markup
|
|
146
146
|
|
|
@@ -149,17 +149,17 @@ Assistant replies can include independent button actions in the same two payload
|
|
|
149
149
|
```md
|
|
150
150
|
I can continue.
|
|
151
151
|
|
|
152
|
-
<!-- telegram_button
|
|
152
|
+
<!-- telegram_button {"label":"Continue","prompt":"Continue with the current plan.","selected_style":"primary"} -->
|
|
153
153
|
|
|
154
154
|
<!-- telegram_button label="Show risks" prompt="List the main risks first." selected_style="danger" -->
|
|
155
155
|
|
|
156
|
-
<!-- telegram_button
|
|
156
|
+
<!-- telegram_button {"value":"Done"} -->
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
Rules:
|
|
160
160
|
|
|
161
161
|
- JSON objects and double-quoted HTML-like attributes are the only accepted payload forms; shorthand, body, paired-comment, unquoted-attribute, and single-quoted-attribute forms are rejected.
|
|
162
|
-
-
|
|
162
|
+
- A colon after `telegram_button` is rejected so both payload forms share one unambiguous action marker.
|
|
163
163
|
- Use `label` plus `prompt`, or the compact `value` key when both strings are identical. Explicit `label` or `prompt` takes precedence over its `value` fallback. Use JSON with `\n` escapes for multiline prompts.
|
|
164
164
|
- The opening marker must start at column zero on a top-level line outside fenced code, quotes, lists, and indented examples; otherwise it remains literal Markdown.
|
|
165
165
|
- Use one comment per button; this mirrors HTML's singular element model and avoids a nested button DSL.
|
package/docs/public-api.md
CHANGED
|
@@ -65,7 +65,7 @@ This command surface is a mobile companion subset, not a raw terminal-command br
|
|
|
65
65
|
- `telegram_message(text, chat_id?, thread_id?)` sends a direct Telegram Markdown message when this Pi instance owns `/telegram-connect` or is registered with the multi-instance bus. During an active Telegram turn, omitted targeting and an explicit target equal to that turn are rejected so the ordinary final-reply path remains the sole current-target response; an explicit different chat/thread target remains allowed for requested cross-target delivery. Outside active turns, paired/default local/TUI delivery remains unchanged. Top-level `telegram_button` comments inside `text` are parsed with the same planner used for normal replies and attached to that message; buttons are never standalone Telegram messages.
|
|
66
66
|
- The bundled `telegram-bridge` Skill owns action syntax, target routing, Threaded Mode, formatting, and profile-specific debugging guidance. The regular prompt routes applicable turns to that Skill. `telegram_attach` and `telegram_message` remain registered but are model-active only while this instance owns direct transport or holds a live follower registration; disconnect/loss suppresses their schemas and prompt metadata, and recovery restores only the operator's previously active pi-telegram subset.
|
|
67
67
|
- `telegram_voice` hidden comments request Telegram-native voice delivery through either a JSON object or double-quoted attributes. Equivalent `text` or `value` supplies the spoken payload; explicit `text` takes precedence.
|
|
68
|
-
- `telegram_button` hidden comments create inline buttons whose taps enqueue prompts through the same two payload forms. Use `label` plus `prompt`, or `value` when both strings are identical.
|
|
68
|
+
- `telegram_button` hidden comments create inline buttons whose taps enqueue prompts through the same two payload forms. Use `label` plus `prompt`, or `value` when both strings are identical. Both action names use one colon-free marker; colon-prefixed payloads are rejected. Use top-level column-zero comments outside code, quotes, lists, and indented examples; do not emit standalone button actions.
|
|
69
69
|
|
|
70
70
|
Prompt guidance is context-aware: local/TUI prompts see only explicit direct-delivery guidance, while Telegram-originated turns receive the full action-comment syntax and phone-width output contract.
|
|
71
71
|
|
package/lib/outbound-markup.ts
CHANGED
|
@@ -176,11 +176,11 @@ export function parseTelegramActionPayload(
|
|
|
176
176
|
): Record<string, unknown> | undefined {
|
|
177
177
|
const parsed = parseTopLevelTelegramComment(comment, command);
|
|
178
178
|
if (!parsed) return undefined;
|
|
179
|
+
if (parsed.head.trimStart().startsWith(":")) return undefined;
|
|
179
180
|
const source = [parsed.head, parsed.body]
|
|
180
181
|
.filter((part): part is string => part !== undefined)
|
|
181
182
|
.join("\n")
|
|
182
|
-
.trim()
|
|
183
|
-
.replace(/^:\s*/, "");
|
|
183
|
+
.trim();
|
|
184
184
|
if (!source) return undefined;
|
|
185
185
|
if (source.startsWith("{")) {
|
|
186
186
|
try {
|
package/package.json
CHANGED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: control-surface
|
|
3
|
+
description: Generates contextual, evidence-backed prompt-button interfaces as transient control surfaces for workflows, tools, stateful systems, choices, navigation, and operator actions—not only terminals. Use when a user asks the agent to generate buttons or a contextual operating surface through Telegram or another prompt-button transport. Existing transport menus and callback interfaces remain with their runtime owners.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Control Surface
|
|
7
|
+
|
|
8
|
+
Generate a temporary, truthful interface that turns the agent's current understanding and available capabilities into useful controls. The agent remains the interpreter, authority boundary, and interface generator; buttons are contextual prompts, not a second application, hidden daemon, or direct grant of capability.
|
|
9
|
+
|
|
10
|
+
## Concept
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
User intent + current evidence → compact state projection → contextual controls
|
|
14
|
+
→ next prompt → authorized act → fresh projection
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Each response is one generated control surface. Reinspect mutable reality after actions and regenerate the surface instead of maintaining a parallel UI model.
|
|
18
|
+
|
|
19
|
+
## Scope
|
|
20
|
+
|
|
21
|
+
Use this Skill only to synthesize an agent-generated prompt-button surface. Operating or modifying an existing Telegram bridge menu, callback interface, or runtime-owned control stays with that subsystem and does not route here merely because it contains buttons.
|
|
22
|
+
|
|
23
|
+
A control surface may expose:
|
|
24
|
+
|
|
25
|
+
- Observation: status, evidence, progress, diagnostics, or summaries.
|
|
26
|
+
- Navigation: files, concepts, projects, artifacts, media, threads, or Actor Runs.
|
|
27
|
+
- Action: safe next operations over tools, workflows, services, or project state.
|
|
28
|
+
- Choice: alternatives, filters, priorities, approvals, or design decisions.
|
|
29
|
+
- Supervision: pause, continue, inspect, redirect, retry, or stop bounded work.
|
|
30
|
+
|
|
31
|
+
Console programs are one capability source, not the defining boundary. Use the real owner of each capability: a tool, API, repository, Actor runtime, filesystem, media system, documented workflow, or the explicit state of the conversation.
|
|
32
|
+
|
|
33
|
+
## Core Contract
|
|
34
|
+
|
|
35
|
+
- Generate controls from current evidence, an explicit contract, or clearly labeled conversational state.
|
|
36
|
+
- Keep domain state with its real owner; never invent a shadow navigation tree, task database, or application session.
|
|
37
|
+
- Make every button prompt self-contained: identify the target, intended result, relevant constraints, and freshness requirement.
|
|
38
|
+
- Treat a click as an ordinary user request subject to the same authority, validation, and safety rules as typed text.
|
|
39
|
+
- Never infer permission for destructive, privileged, credential-bearing, external, or irreversible work merely because a button exists.
|
|
40
|
+
- Do not encode secrets, hidden reasoning, credentials, private keys, tokens, cookies, wallet material, or sensitive content in labels or prompts.
|
|
41
|
+
- Show uncertainty, unavailable state, truncation, filtering, and stale evidence honestly.
|
|
42
|
+
- Prefer a few high-value controls over exhaustive action enumeration.
|
|
43
|
+
|
|
44
|
+
## Control Admission
|
|
45
|
+
|
|
46
|
+
Buttons are optional, but bias toward offering them when they materially shorten a likely feedback loop. If the user can approve, reject, refine, prioritize, redirect, inspect, or choose a concrete next step faster by tapping than by composing a reply, proactively expose the smallest useful control set without waiting to be asked for buttons.
|
|
47
|
+
|
|
48
|
+
Zero buttons remains preferable when controls would only decorate the answer, restate visible prose, solicit generic “What next?” input, expose an unclear consequence, or save negligible effort. A button earns its place by reducing response effort, ambiguity, turnaround time, or supervision cost while preserving an ordinary typed reply as a first-class option.
|
|
49
|
+
|
|
50
|
+
For status requests, show a compact `Refresh` control and bounded inspect/drill-down controls only when work is active, blocked, stale-sensitive, or otherwise actionable. A completed static status needs no buttons. Do not add destructive shortcuts or actions whose target and consequence are not yet clear.
|
|
51
|
+
|
|
52
|
+
## Feedback Leverage
|
|
53
|
+
|
|
54
|
+
Treat feedback compression as the primary reason to make controls more visible and proactive:
|
|
55
|
+
|
|
56
|
+
- Offer 2–6 high-confidence choices when they cover likely responses without pretending to be exhaustive.
|
|
57
|
+
- Prefer controls for approval gates, bounded alternatives, priority changes, review verdicts, correction direction, and active-work supervision.
|
|
58
|
+
- Put the most likely or highest-leverage response first, while keeping labels neutral enough to avoid steering the decision dishonestly.
|
|
59
|
+
- Include an explicit free-form path in visible text when the listed choices cannot represent the full answer.
|
|
60
|
+
- Regenerate controls after feedback so the next surface reflects the new decision rather than repeating stale options.
|
|
61
|
+
- Omit controls when the user is already expressing a clear command and no immediate follow-up decision is needed.
|
|
62
|
+
|
|
63
|
+
## Surface Model
|
|
64
|
+
|
|
65
|
+
A surface normally contains:
|
|
66
|
+
|
|
67
|
+
1. A short title naming the controlled object or decision.
|
|
68
|
+
2. A compact projection of relevant state, evidence, choices, or output.
|
|
69
|
+
3. Provenance when it matters: target, source, timestamp, run identity, status, or truncation note.
|
|
70
|
+
4. Buttons for likely next intents.
|
|
71
|
+
5. `Back` or `Up` for hierarchy navigation when meaningful.
|
|
72
|
+
6. `Refresh` when the projected state can change.
|
|
73
|
+
|
|
74
|
+
Prefer 2–6 controls for feedback and decisions; navigation collections may use up to 12 when the additional entries remain scannable. Split larger sets by category or page instead of building a button wall. Do not add navigation controls when the surface is a one-step decision.
|
|
75
|
+
|
|
76
|
+
## Truth Modes
|
|
77
|
+
|
|
78
|
+
Name the basis of the surface when ambiguity matters:
|
|
79
|
+
|
|
80
|
+
- Live: freshly inspected mutable state.
|
|
81
|
+
- Contract: stable documented capabilities or choices.
|
|
82
|
+
- Conversation: alternatives or intents established in the current dialogue.
|
|
83
|
+
- Adapted: bounded or transformed output whose omissions are stated.
|
|
84
|
+
|
|
85
|
+
Do not present remembered or inferred state as live. After a mutation, refresh affected state before claiming success or generating dependent controls.
|
|
86
|
+
|
|
87
|
+
## Evidence Fidelity
|
|
88
|
+
|
|
89
|
+
Preserve material identities, values, ordering, warnings, errors, and status. Adaptation may group, translate, label, paginate, rank, or collapse repeated successful detail, but it must not:
|
|
90
|
+
|
|
91
|
+
- Convert failure into success.
|
|
92
|
+
- Hide material warnings or unavailable evidence.
|
|
93
|
+
- Present a subset as complete.
|
|
94
|
+
- Change identifiers, values, causal order, or authority.
|
|
95
|
+
- Turn a proposal into completed state.
|
|
96
|
+
|
|
97
|
+
State adaptation explicitly, for example: `Показаны 20 из 184 записей, по размеру`.
|
|
98
|
+
|
|
99
|
+
## Safety And Confirmation
|
|
100
|
+
|
|
101
|
+
Classify each action as read-only, ordinary mutation, privileged, destructive, secret-bearing, external, or irreversible.
|
|
102
|
+
|
|
103
|
+
Use a two-stage flow for high-impact actions:
|
|
104
|
+
|
|
105
|
+
1. An action button opens a confirmation surface naming the exact target, effect, and recovery boundary.
|
|
106
|
+
2. A distinct confirmation button requests the exact operation.
|
|
107
|
+
|
|
108
|
+
Re-check mutable targets immediately before execution. Access denial never authorizes automatic privilege escalation. If evidence may expose secrets, stop before display and offer metadata-only or redacted alternatives.
|
|
109
|
+
|
|
110
|
+
## Prompt Buttons
|
|
111
|
+
|
|
112
|
+
Use the transport's canonical prompt-button syntax. For pi-telegram, emit a top-level hidden comment:
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<!-- telegram_button {"label":"🔍 Inspect run","prompt":"Inspect Run run:example read-only, summarize its current status and latest material evidence, then regenerate relevant supervision controls."} -->
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Button prompts must:
|
|
119
|
+
|
|
120
|
+
- Preserve the user's language.
|
|
121
|
+
- Name exact targets where possible.
|
|
122
|
+
- Express one coherent next intent.
|
|
123
|
+
- Carry material safety and scope restrictions.
|
|
124
|
+
- Request fresh inspection when state may have changed.
|
|
125
|
+
- Avoid embedding volatile output that should be rediscovered.
|
|
126
|
+
|
|
127
|
+
Labels stay short, distinct, and scannable. Emoji are optional semantic markers; do not rely on color alone. If buttons are unavailable, render the same control surface as a numbered choice list.
|
|
128
|
+
|
|
129
|
+
## Capability Adapters
|
|
130
|
+
|
|
131
|
+
### Console And System
|
|
132
|
+
|
|
133
|
+
Use normal console programs as the capability owner. Check exit status and stderr before rendering success. Preserve complete output when reasonably sized; otherwise label pagination, filtering, head/tail, or ranked subsets. High-impact process, service, package, permission, shutdown, disk, and deletion actions require confirmation.
|
|
134
|
+
|
|
135
|
+
### Filesystem
|
|
136
|
+
|
|
137
|
+
Resolve paths before listing. Directory navigation may show safe names and metadata without reading contents. Never preview credential stores, private keys, browser profiles, cookies, tokens, wallets, or other secret-bearing files. Use unambiguous paths in prompts and offer safe operations before mutations.
|
|
138
|
+
|
|
139
|
+
### Workflows And Actor Runs
|
|
140
|
+
|
|
141
|
+
Keep exact workflow, Recipe, Run, artifact, or task identity visible. Controls may inspect, pause, continue, redirect, retry, or stop only through the owning runtime contract. Never simulate lifecycle state, bypass Control semantics, or treat a generated button as direct execution authority.
|
|
142
|
+
|
|
143
|
+
### Decisions And Design
|
|
144
|
+
|
|
145
|
+
Buttons may represent explicit alternatives without live system inspection. State the decision being made, preserve meaningful trade-offs in visible text, and ensure each prompt records the selected intent rather than silently executing downstream consequences.
|
|
146
|
+
|
|
147
|
+
## Action Procedure
|
|
148
|
+
|
|
149
|
+
1. Identify the controlled object, user goal, and capability owner.
|
|
150
|
+
2. Decide whether the surface needs live, contract, conversational, or adapted evidence.
|
|
151
|
+
3. Inspect only the state required for a truthful projection.
|
|
152
|
+
4. Classify candidate controls by authority and impact.
|
|
153
|
+
5. Render compact state plus context-relevant controls.
|
|
154
|
+
6. On the next turn, interpret the click as a new request and execute only what it authorizes.
|
|
155
|
+
7. Validate the result and regenerate from retained reality.
|
|
156
|
+
|
|
157
|
+
## Failure And Empty States
|
|
158
|
+
|
|
159
|
+
- Show concise failure evidence and offer diagnosis, retry, refresh, back, or a narrower action.
|
|
160
|
+
- If a target disappears, return to the nearest valid parent or owner instead of reusing stale controls.
|
|
161
|
+
- If no action is currently valid, say so rather than generating decorative buttons.
|
|
162
|
+
- Mark unsupported, sentinel, inferred, or unreliable values explicitly.
|
|
163
|
+
- Keep safe navigation and refresh controls in empty collections when useful.
|
|
164
|
+
|
|
165
|
+
## Quality Check
|
|
166
|
+
|
|
167
|
+
Before sending a surface, verify:
|
|
168
|
+
|
|
169
|
+
- State and controls share one clear owner and target.
|
|
170
|
+
- Live claims come from current evidence.
|
|
171
|
+
- Complete versus filtered or adapted output is labeled honestly.
|
|
172
|
+
- No secret appears in visible text or button payloads.
|
|
173
|
+
- Every button carries a valid self-contained next intent and measurably shortens likely feedback.
|
|
174
|
+
- The surface preserves free-form feedback when choices are not exhaustive.
|
|
175
|
+
- High-impact operations route through confirmation.
|
|
176
|
+
- Back/Up and Refresh appear only when useful.
|
|
177
|
+
- The surface remains readable on a mobile screen.
|
|
@@ -51,7 +51,7 @@ Use `telegram_attach` outside Telegram turns only when the user explicitly reque
|
|
|
51
51
|
Button forms:
|
|
52
52
|
|
|
53
53
|
```html
|
|
54
|
-
<!-- telegram_button
|
|
54
|
+
<!-- telegram_button {"label":"Continue","prompt":"Continue with the current plan."} -->
|
|
55
55
|
<!-- telegram_button value="Continue" -->
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -65,7 +65,7 @@ Button forms:
|
|
|
65
65
|
Voice forms:
|
|
66
66
|
|
|
67
67
|
```html
|
|
68
|
-
<!-- telegram_voice
|
|
68
|
+
<!-- telegram_voice {"text":"Short spoken message","lang":"en"} -->
|
|
69
69
|
<!-- telegram_voice text="Short spoken message" lang="en" -->
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: button-console
|
|
3
|
-
description: Turns terminal programs, filesystem navigation, system inspection, and operator workflows into contextual agent-generated button interfaces while preserving full or faithfully adapted console output. Use when a user asks for controls, menus, navigation, actions, or an operating-system/CLI interface through Telegram or another prompt-button transport.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Button Console
|
|
7
|
-
|
|
8
|
-
Build a temporary, truthful button interface over terminal and operating-system capabilities. The agent remains the interpreter and safety boundary; buttons are contextual prompts, not a second shell, static application, or hidden automation daemon.
|
|
9
|
-
|
|
10
|
-
## Concept
|
|
11
|
-
|
|
12
|
-
```text
|
|
13
|
-
User intent → narrow inspection/action → console evidence → readable output → contextual buttons → next user intent
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Each response is one generated screen. Reinspect current reality and regenerate controls after every action rather than maintaining a parallel navigation model.
|
|
17
|
-
|
|
18
|
-
## Core Contract
|
|
19
|
-
|
|
20
|
-
- Inspect reality before rendering entries or controls that depend on current state.
|
|
21
|
-
- Use normal console programs as capability owners.
|
|
22
|
-
- Show complete output when reasonably sized; otherwise adapt it without changing material facts and offer pagination, filtering, raw output, or drill-down.
|
|
23
|
-
- Make every button prompt self-contained: name the exact target, operation, output expectation, and safety restriction.
|
|
24
|
-
- Treat button clicks as ordinary user requests subject to the same authority and validation rules as typed requests.
|
|
25
|
-
- Never infer permission for destructive, privileged, credential-bearing, external, or irreversible work merely because a button exists.
|
|
26
|
-
- Do not read secrets to populate navigation. Names and safe metadata may be listed; contents require justified, explicit authorization.
|
|
27
|
-
- Never place credentials, private keys, tokens, cookies, wallet material, or sensitive file contents in labels or prompts.
|
|
28
|
-
|
|
29
|
-
## Screen Model
|
|
30
|
-
|
|
31
|
-
A screen normally contains:
|
|
32
|
-
|
|
33
|
-
1. A short title naming the current target.
|
|
34
|
-
2. Console output or a faithful adaptation.
|
|
35
|
-
3. Optional provenance such as path, command class, timestamp, exit status, or truncation note.
|
|
36
|
-
4. Buttons for likely next actions.
|
|
37
|
-
5. `Back` or `Up` for hierarchy navigation.
|
|
38
|
-
6. `Refresh` when state may change.
|
|
39
|
-
|
|
40
|
-
Prefer 4–12 useful buttons. Split larger sets into categories or pages rather than creating a dense button wall.
|
|
41
|
-
|
|
42
|
-
## Console Fidelity
|
|
43
|
-
|
|
44
|
-
Complete output preserves ordering, names, identifiers, numeric values, units, warnings, errors, and relevant exit status. Use a code block only when formatting is semantically meaningful; use compact records for simple listings.
|
|
45
|
-
|
|
46
|
-
Adaptation may:
|
|
47
|
-
|
|
48
|
-
- Replace columns with labeled records.
|
|
49
|
-
- Normalize human-readable sizes.
|
|
50
|
-
- Group entries by type.
|
|
51
|
-
- Collapse repeated successful lines.
|
|
52
|
-
- Show a bounded head, tail, page, or ranked subset.
|
|
53
|
-
- Translate labels into the user's language.
|
|
54
|
-
|
|
55
|
-
Adaptation must not:
|
|
56
|
-
|
|
57
|
-
- Convert failure into success.
|
|
58
|
-
- Omit material warnings.
|
|
59
|
-
- Change identities, values, or ordering claims.
|
|
60
|
-
- Present a filtered subset as complete.
|
|
61
|
-
- Hide truncation, filtering, or an unavailable measurement.
|
|
62
|
-
|
|
63
|
-
State adaptation explicitly, for example: `Показаны 20 из 184 записей, по размеру`.
|
|
64
|
-
|
|
65
|
-
## Filesystem Navigation
|
|
66
|
-
|
|
67
|
-
- Resolve the requested path before listing it.
|
|
68
|
-
- List directories without reading file contents.
|
|
69
|
-
- Include every ordinary entry unless the user requested a filter.
|
|
70
|
-
- Do not silently omit a sensitive-looking entry; show its name when listing is safe, then handle its contents conservatively.
|
|
71
|
-
- Hidden directories default to names and metadata only.
|
|
72
|
-
- Use absolute or otherwise unambiguous paths in button prompts.
|
|
73
|
-
- Keep `Up`, `Home`, and `Refresh` where useful.
|
|
74
|
-
- Offer safe file operations first: metadata, non-sensitive preview, attach/send, or open with an appropriate application.
|
|
75
|
-
|
|
76
|
-
Never expose credential-file contents through a preview button. This includes `*.keys`, private SSH keys, credential stores, browser profiles, cookies, tokens, and wallets.
|
|
77
|
-
|
|
78
|
-
## System And Process Controls
|
|
79
|
-
|
|
80
|
-
Read-only controls may directly request system status, uptime, load, memory, temperatures, disk use, process ranking, service state, network state, application discovery, and bounded redacted logs.
|
|
81
|
-
|
|
82
|
-
Use a two-stage flow for high-impact actions:
|
|
83
|
-
|
|
84
|
-
1. An action button opens a confirmation screen naming the exact target and consequences.
|
|
85
|
-
2. A distinct confirmation button requests the exact operation.
|
|
86
|
-
|
|
87
|
-
This applies to shutdown, reboot, process termination, package removal, file deletion, permission changes, service mutation, disk operations, and similar work. Use danger styling when available. Re-check the target immediately before execution and report resulting console evidence.
|
|
88
|
-
|
|
89
|
-
## Button Generation
|
|
90
|
-
|
|
91
|
-
When the transport supports prompt buttons, emit its canonical button action syntax. For pi-telegram this is a top-level hidden `telegram_button` comment:
|
|
92
|
-
|
|
93
|
-
```html
|
|
94
|
-
<!-- telegram_button: {"label":"📂 Downloads","prompt":"Show the current contents of /home/user/Downloads without reading file contents, then provide contextual navigation buttons."} -->
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Button prompts must:
|
|
98
|
-
|
|
99
|
-
- Use an exact target where possible.
|
|
100
|
-
- Describe one coherent intent.
|
|
101
|
-
- Preserve the user's language.
|
|
102
|
-
- State important exclusions such as not reading secrets.
|
|
103
|
-
- Request fresh state after mutations.
|
|
104
|
-
- Avoid embedding volatile output that should be reinspected.
|
|
105
|
-
|
|
106
|
-
Labels stay short, distinct, and scannable. Emoji are optional semantic markers; do not rely on color alone. If buttons are unavailable, render the same interface as a numbered choice list.
|
|
107
|
-
|
|
108
|
-
## Action Procedure
|
|
109
|
-
|
|
110
|
-
1. Identify the current target and capability.
|
|
111
|
-
2. Classify the action as read-only, ordinary mutation, privileged, destructive, secret-bearing, or external.
|
|
112
|
-
3. Run the narrowest console inspection needed for a truthful screen.
|
|
113
|
-
4. Check exit status and stderr; never build a success menu from failed evidence.
|
|
114
|
-
5. Render complete or explicitly adapted output.
|
|
115
|
-
6. Generate only context-relevant next-action buttons.
|
|
116
|
-
7. On the next turn, reinspect when freshness matters and execute only the newly authorized action.
|
|
117
|
-
8. Report outcome evidence and regenerate the screen from retained reality.
|
|
118
|
-
|
|
119
|
-
## Failure And Empty States
|
|
120
|
-
|
|
121
|
-
- On command failure, show the concise error and offer diagnosis, retry, Back, or a narrower action.
|
|
122
|
-
- For an empty directory, say so and retain Up, Home, and Refresh.
|
|
123
|
-
- If a target disappeared, return to its nearest valid parent rather than reusing stale evidence.
|
|
124
|
-
- On access denial, do not escalate privileges automatically.
|
|
125
|
-
- If output may contain secrets, stop before display and offer metadata-only or redacted alternatives.
|
|
126
|
-
- Mark unsupported, sentinel, or obviously invalid sensor values as unreliable instead of reporting them as facts.
|
|
127
|
-
|
|
128
|
-
## Quality Check
|
|
129
|
-
|
|
130
|
-
Before sending a screen, verify:
|
|
131
|
-
|
|
132
|
-
- Displayed state comes from current console evidence.
|
|
133
|
-
- Complete versus filtered output is labeled honestly.
|
|
134
|
-
- No ordinary entry was accidentally omitted.
|
|
135
|
-
- No secret appears in text or button payloads.
|
|
136
|
-
- Every button has a valid self-contained next intent.
|
|
137
|
-
- Destructive actions lead to confirmation rather than immediate execution.
|
|
138
|
-
- Back/Up and Refresh exist when materially useful.
|
|
139
|
-
- The response remains readable on a mobile screen.
|