@llblab/pi-telegram 0.36.5 → 0.36.6
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 +6 -1
- package/README.md +1 -1
- package/docs/voice.md +11 -1
- package/lib/journal.ts +24 -0
- package/package.json +1 -1
- package/skills/telegram-bridge/SKILL.md +3 -1
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.36.6: Orphan Journal Guard
|
|
6
|
+
|
|
7
|
+
- `Orphan Journal Guard`: Rejects a missing journal snapshot when immutable revision segments still exist, preventing later admission from replacing uncertain durable authority with a new revisionless snapshot while preserving snapshot-first compaction and fail-closed recovery.
|
|
8
|
+
- `Voice Configuration Guidance`: Guides agents from voice-configuration requests to provider-neutral `telegram.json` command templates, ordered STT fallbacks, OGG/Opus validation, and companion-provider alternatives while preserving `hidden` as the useful default for explicit `telegram_voice` delivery.
|
|
9
|
+
|
|
5
10
|
## 0.36.5: Separated Tool Errors
|
|
6
11
|
|
|
7
12
|
- `Separated Tool Errors`: Prefixes Telegram attachment and direct-message Tool failures with one normalized leading newline so Pi renders error evidence on a visually separated line beneath the Tool name without changing the underlying diagnostic text.
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
- `Destructive Skip State`: Changes the active queue Skip selector from yellow to red and records the indicator in the UI registry, making deferred prompt removal visually distinct from Priority, Scoped, and other elevated but non-destructive states.
|
|
29
34
|
- `Worker Cancellation Fence`: Makes Generative App workers acknowledge child-process abort handling before parent termination, with a bounded forced fallback for synchronously blocked methods, preventing Linux CI load from orphaning a cancelled process long enough to commit its delayed side effect.
|
|
30
35
|
- `Capability App Routing`: Telegram interaction now prefers an already-advertised capability-owned Generative App for repeated controls before synthesizing one-shot prompt buttons, while the bridge remains generic and neither discovers capability-specific apps nor owns their state or identities.
|
|
31
|
-
- `Hybrid Surface
|
|
36
|
+
- `Hybrid Surface Routing`: Generated Control Surface and Generative Apps now cross-route over one logical button matrix and shared JSON/CML runtime notation: ephemeral agent composition stays separate from reusable scripts, while one app view may combine deterministic bound methods with ordinary model-mediated prompts and no third button Skill is introduced.
|
|
32
37
|
|
|
33
38
|
## 0.36.0: Generative Apps
|
|
34
39
|
|
package/README.md
CHANGED
|
@@ -218,7 +218,7 @@ Inbound files land under `<agent-dir>/tmp/telegram` and default to a 50 MiB limi
|
|
|
218
218
|
|
|
219
219
|
### Voice And Media
|
|
220
220
|
|
|
221
|
-
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.
|
|
221
|
+
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. Configure provider-neutral local/API pipelines and ordered fallbacks through [`telegram.json` command templates](./docs/voice.md#choose-an-integration-path). The default `hidden` reply mode still supports intentional voice delivery through explicit `telegram_voice` actions; `mirror` and `always` add automatic voice policy. Explicit actions accept either a JSON object or compact double-quoted attributes, with equivalent `text` and `value` payload keys and one colon-free action marker.
|
|
222
222
|
|
|
223
223
|
### Buttons And Callbacks
|
|
224
224
|
|
package/docs/voice.md
CHANGED
|
@@ -6,10 +6,20 @@ Voice messages flow through an **inbound transcription → outbound voice reply*
|
|
|
6
6
|
|
|
7
7
|
1. **Inbound:** A voice message arrives via Telegram. Inbound handlers transcribe it to text.
|
|
8
8
|
2. **Processing:** The transcription becomes the agent prompt. The bridge tags the turn if it originated from voice.
|
|
9
|
-
3. **Outbound:**
|
|
9
|
+
3. **Outbound:** When automatic voice delivery is selected or the agent emits an explicit `telegram_voice` action, the agent's text is converted to voice and sent back.
|
|
10
10
|
|
|
11
11
|
The bridge owns Telegram transport, queue integration, reply-mode policy, preview suppression, fallback text delivery, and Settings UI. Provider extensions own STT/TTS calls, speech rewriting, provider-specific menus, transcript preference, and OGG/Opus conversion.
|
|
12
12
|
|
|
13
|
+
### Choose an integration path
|
|
14
|
+
|
|
15
|
+
Use the smallest path that fits the operator's available capabilities:
|
|
16
|
+
|
|
17
|
+
1. **`telegram.json` command templates:** Compose trusted local executables through `inboundHandlers` and `outboundHandlers`. This works equally well for local models and API-backed scripts, supports ordered STT fallbacks, and requires no companion extension.
|
|
18
|
+
2. **Companion extension:** Register programmatic STT/TTS providers when installation, provider-owned settings, lifecycle integration, or zero-config reuse justifies code.
|
|
19
|
+
3. **Hybrid:** Keep explicit operator command templates first and let installed providers supply progressive fallbacks.
|
|
20
|
+
|
|
21
|
+
pi-telegram does not catalog speech providers. Configuration agents should discover applicable Skills or trusted local executables, verify required environment variables by presence without exposing values, preserve unrelated `telegram.json` state, ensure TTS ends as OGG/Opus, and test each stage before the live Telegram path. `hidden` remains the safe and useful default: it disables only automatic voice replies, while explicit `telegram_voice` actions continue to use the configured synthesis pipeline.
|
|
22
|
+
|
|
13
23
|
## Voice Detection
|
|
14
24
|
|
|
15
25
|
Voice messages arrive as `message.voice` in Telegram updates. The bridge's media processing detects these and sets `kind: "voice"` on the downloaded file. Regular audio files (`message.audio`) get `kind: "audio"`; `mirror` mode treats both voice notes and audio uploads as voice input for reply-policy tagging.
|
package/lib/journal.ts
CHANGED
|
@@ -1757,6 +1757,30 @@ export function createTelegramUpdateJournalStore(
|
|
|
1757
1757
|
} catch (error) {
|
|
1758
1758
|
if (error instanceof TelegramUpdateJournalError) throw error;
|
|
1759
1759
|
if ((error as { code?: unknown })?.code === "ENOENT") {
|
|
1760
|
+
const segmentDirectory = getTelegramUpdateJournalSegmentDirectory(path);
|
|
1761
|
+
let orphanedSegmentNames: string[];
|
|
1762
|
+
try {
|
|
1763
|
+
orphanedSegmentNames = readdirSync(segmentDirectory).filter((name) =>
|
|
1764
|
+
/^\d{16}\.json$/u.test(name),
|
|
1765
|
+
);
|
|
1766
|
+
} catch (segmentError) {
|
|
1767
|
+
if ((segmentError as { code?: unknown })?.code === "ENOENT") {
|
|
1768
|
+
return { file: emptyFile(), exists: false, serializedBytes: 0 };
|
|
1769
|
+
}
|
|
1770
|
+
throw createJournalError(
|
|
1771
|
+
"io",
|
|
1772
|
+
segmentDirectory,
|
|
1773
|
+
"could not be read while the journal snapshot is missing",
|
|
1774
|
+
segmentError,
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
if (orphanedSegmentNames.length > 0) {
|
|
1778
|
+
throw createJournalError(
|
|
1779
|
+
"invalid",
|
|
1780
|
+
path,
|
|
1781
|
+
`is missing while ${segmentDirectory} retains revision segments`,
|
|
1782
|
+
);
|
|
1783
|
+
}
|
|
1760
1784
|
return { file: emptyFile(), exists: false, serializedBytes: 0 };
|
|
1761
1785
|
}
|
|
1762
1786
|
throw createJournalError("io", path, "could not be read", error);
|
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@ Use `telegram_attach` outside Telegram turns only when the user explicitly reque
|
|
|
46
46
|
|
|
47
47
|
## Assistant-Authored Actions
|
|
48
48
|
|
|
49
|
-
Before compiling assistant-authored controls, inspect already-loaded capability guidance for an advertised maintained Generative App or view/controller adapter. When that owner-provided view exists and the current intent concerns repeated interaction, load and follow the bundled `generative-apps` Skill and prefer binding or invoking the existing app over synthesizing one-shot prompt buttons. This
|
|
49
|
+
Before compiling assistant-authored controls, inspect already-loaded capability guidance for an advertised maintained Generative App or view/controller adapter. When that owner-provided view exists and the current intent concerns repeated interaction, load and follow the bundled `generative-apps` Skill and prefer binding or invoking the existing app over synthesizing one-shot prompt buttons. This routing guidance is not permission for the bridge to discover capability-specific apps, own their state, or hard-code their identities.
|
|
50
50
|
|
|
51
51
|
Otherwise, on Telegram turns, proactively load `generated-control-surface` when a likely next decision or action may benefit from prompt buttons; do not wait for an explicit button request, and accept zero controls when its admission rules reject decorative or low-value UI.
|
|
52
52
|
|
|
@@ -116,6 +116,8 @@ Prefer no-code command-template configuration in `telegram.json` before adding a
|
|
|
116
116
|
- `outboundHandlers` transforms final replies.
|
|
117
117
|
- Voice transcription handlers can match `type: "voice"` or `mime: "audio/*"`; stdout becomes `[outputs]`.
|
|
118
118
|
|
|
119
|
+
When asked to configure voice rather than merely operate it, follow the provider-neutral contracts in `docs/voice.md`, `docs/inbound.md`, `docs/outbound.md`, and `docs/command-templates.md` from the pi-telegram package or repository. Inspect the available Skill catalog and trusted local executables for STT, TTS, and media conversion capabilities; check only whether required environment variables exist, never reveal their values. Preserve unrelated `telegram.json` fields, order multiple matching inbound handlers as fallbacks, require OGG/Opus output for native voice delivery, and validate each stage before a live Telegram smoke test. Keep `voice.replyMode` at its existing value unless the user requests a policy change: the default `hidden` mode is fully functional because explicit top-level `telegram_voice` actions still use the configured synthesis pipeline.
|
|
120
|
+
|
|
119
121
|
When configuration is insufficient, use documented `@llblab/pi-telegram/*` public API subpaths. Never import package-private `lib/*`, start another polling loop, or bypass bridge ownership with raw Bot API access.
|
|
120
122
|
|
|
121
123
|
## Safety
|