@llblab/pi-telegram 0.25.2 β 0.25.3
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 +4 -0
- package/README.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/outbound.md +1 -1
- package/docs/public-api.md +1 -1
- package/docs/ui-style.md +1 -1
- package/index.ts +1 -0
- package/lib/activity-verbosity.ts +17 -9
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -89,7 +89,7 @@ The core product loop is mobile continuation: start or supervise work in the ter
|
|
|
89
89
|
- Instance thread names are provisioner-authored identity metadata, not model-authored output. Fresh Threaded Mode threads select one of five curated compact 4-6 letter Latin names for the assigned slot letter using provisioning timestamp entropy, then create the Telegram thread with that thread name immediately. The title is the thread name itself, not `{slot} {threadName}` or `{slot} β {threadName}`. Do not register or reintroduce an agent-facing thread rename tool; removing the extra rename prompt/tool turn is an intentional simplicity constraint. Thread names must mirror into terminal status, live diagnostics, and `[telegram|thread:name]` through one target-aware current-instance identity resolver. Registered follower/leader metadata takes precedence over a stale shared record for the same target, with the record used only as fallback; do not hide a valid baked/custom thread name behind old slot-prefix validation. A follower that later becomes leader keeps its existing name; leadership changes are transport role changes, not identity resets.
|
|
90
90
|
- Telegram private-chat Threaded Mode treats `All` as an aggregate/control surface, not a durable `General` thread or process launcher, and leader activation proactively creates or reuses its private-DM thread. When the owner writes in an unknown thread, the leader reclaims and routes the first one only if it lacks an active binding; later unknown threads remain intact and receive an in-thread chooser to reroute the captured prompt or restore a stale binding. Destructive cleanup requires explicit confirmation through `thread-reconciler`; another Pi instance still requires a manually started process followed by `/telegram-connect`. Without Threaded Mode, process the message through classic routing.
|
|
91
91
|
- Telegram extension work should not hold Pi's core agent lifecycle hostage once Pi has produced the semantic result. For Telegram-originated turns, final Telegram delivery, attachment upload, and transport cleanup are extension-owned side effects; schedule them off the critical `agent_end` path when ordering can still be preserved, record failures as runtime events, and keep dispatch of the next Telegram turn behind the delivery task when needed to avoid interleaving previews/finals. Treat a low-level error `agent_end` as retryable while its Telegram turn remains active; only a later successful `agent_end` or Pi's `agent_settled` boundary may finalize and release that turn. Public activity handlers run through isolated asynchronous per-handler queues; lifecycle hooks enqueue normalized events and never await consumer work. Proactive push defaults enabled and requires explicit `assistant.proactivePush: false` to opt out. While enabled, core delivery projects each completed Pi-visible assistant text block from local/autonomous work once and in order; bind admitted blocks to the exact target, profile/token transport stamp, direct leader epoch or follower registration generation, and session generation. Token deltas, hidden reasoning, tool traffic, stale authority, and Telegram-owned turns never enter that projection.
|
|
92
|
-
- Core thinking/tool visibility is controlled by `assistant.activity: "quiet" | "thinking" | "tools" | "verbose"`. It remains separate from proactive public prose and assistant Markdown: provider-exposed thinking and completed executed tools use durable ordinary HTML messages with standard expandable blockquotes and never use Rich Messages. Thinking uses the `π§ ` header, tools use `π `, `verbose` enables both, and every activity send/edit disables Telegram link previews. Keep it quiet by default, exact-target/transport-generation fenced, start-order preserving, boundary-aware, memory/transport bounded, and non-blocking; final delivery waits for admitted technical activity only inside the extension-owned background task, and session replacement abandons queued old-generation work without waiting on old transport. Read legacy `assistant.activityVerbosity` only when `assistant.activity` is absent and remove it on the next Settings write. Never invent unavailable provider-private thinking or replay a possibly committed technical message.
|
|
92
|
+
- Core thinking/tool visibility is controlled by `assistant.activity: "quiet" | "thinking" | "tools" | "verbose"`. It remains separate from proactive public prose and assistant Markdown: provider-exposed thinking and completed executed tools use durable ordinary HTML messages with standard expandable blockquotes and never use Rich Messages. Thinking uses the `π§ ` header with the current Pi thinking level instead of a generic lifecycle status, tools use `π `, `verbose` enables both, and every activity send/edit disables Telegram link previews. Keep it quiet by default, exact-target/transport-generation fenced, start-order preserving, boundary-aware, memory/transport bounded, and non-blocking; final delivery waits for admitted technical activity only inside the extension-owned background task, and session replacement abandons queued old-generation work without waiting on old transport. Read legacy `assistant.activityVerbosity` only when `assistant.activity` is absent and remove it on the next Settings write. Never invent unavailable provider-private thinking or replay a possibly committed technical message.
|
|
93
93
|
- Telegram runtime state should be treated as event-driven reconciliation of extension assumptions against observable Telegram signals, not as a full Telegram bot read-model and not as a reason to query Telegram on every action. Keep a local assumption model for bot identity/capabilities, pairing assumptions, thread support, known thread lifecycle, bound instance targets, reservations, and transport health. Invalidate and reconcile the relevant slice on meaningful events: startup/reload, lifecycle service messages, stale-send/API errors, setup/pairing changes, follower register/prune, explicit status/debug requests, and bounded low-frequency leader health ticks. `lib/sync.ts` owns sync slices, observation intake, invalidation triggers, status/debug freshness, and reconciliation scheduling; it must not promise complete bot-state mirroring because Bot API lacks a complete topic listing surface. `lib/thread-reconciler.ts` owns pure Threaded Mode lifecycle planning and should become the only policy authority for destructive thread cleanup decisions. `threads` owns current Telegram UI thread/tab binding primitives and thread-name helpers mapped to Bot API topic transport, `status` renders projections, and `index.ts` only wires ports. `tmp/telegram/logs.jsonl` is a session-local redacted runtime evidence stream for race debugging and resets on extension start / runtime scope changes; it is diagnostics only, not routing/provisioning authority. `state.json` should be an observable/debug snapshot aligned with `/telegram-status` (extension runtime, bot capabilities including `bot.lastSlot`, runtime role, live roster projection, reservations, diagnostics), not routing/provisioning authority. Because every process on one Telegram profile shares this file, only the active transport lock owner may persist it; followers read current state and gain write authority only after promotion. Status-only writes must refresh disk-backed bindings before serialization so a stale loaded snapshot cannot erase newer leader state. Live bus/runtime state is authoritative; file reservations and fresh capability observations may be startup hints/collision guards only; stale snapshots must re-probe before suppressing bus/topic behavior. Do not persist stale/offline/failed thread target history as source of truth.
|
|
94
94
|
- Thread bindings are bidirectional. From the Pi-instance side, an instance knows and preserves its target, slot, thread name, lifecycle state, and direct-delivery defaults. From the Telegram-client/bot side, the bridge observes thread creation/close/reopen/stale-send signals and reconciles them into instance binding state. Lifecycle transitions that affect operator understanding should be Telegram-visible when a live transport remains: every successful follower registration/re-registration gets a compact connected notice in the assigned thread, while heartbeat pruning stays silent because it is only liveness suspicion. These notices should use the instance thread name when known and fall back to the slot letter only while the thread is still unnamed. New unknown or command-created temporary threads receive the complete forward plus replace/restore control set and remain preserved until the user chooses one. Successful forward deletes the chooser and temporary thread; successful replace/restore always deletes the chooser, rebinds the temporary thread, and deletes only the replaced old thread. Any destructive cleanup must go through `thread-reconciler`. Unknown `forum_topic_created` service events are observations, not destructive cleanup proof.
|
|
95
95
|
- The multi-instance bus uses private bot DMs with Telegram private-chat Threaded Mode enabled for the bot. No supergroup, group, or forum configuration is needed; the thread chat is always the private chat with the paired owner. Threaded capability checks must use bot/private-chat evidence such as `getMe.has_topics_enabled`, incoming `message_thread_id`, and topic operation success/failure; do not use group chat metadata as the control-plane truth for Telegram private-chat Threaded Mode.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.25.3: Thinking Density Header Hotfix
|
|
4
|
+
|
|
5
|
+
- `Thinking Activity`: Replaced the generic `running`/`done` thinking header state with the current Pi thinking level, such as `high`, and stopped finalizing an already-current disclosure with a no-op completion edit. Impact: each persistent thinking block carries useful reasoning-density context instead of redundant lifecycle noise.
|
|
6
|
+
|
|
3
7
|
## 0.25.2: Persistent Thinking Activity Hotfix
|
|
4
8
|
|
|
5
9
|
- `Activity Modes`: Expanded `assistant.activity` to `quiet`, `thinking`, `tools`, and `verbose`; thinking now uses persistent ordinary HTML messages with a `π§ ` header and collapsed bounded disclosure instead of ephemeral Rich drafts, while tools retain `π ` disclosures. Every activity send/edit disables Telegram link previews. Impact: operators can inspect thinking-only, tools-only, or combined technical history without Telegram removing thinking when the final answer arrives or URL-like evidence expanding into distracting previews.
|
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ The first Telegram user to message the bot becomes the allowed owner. Other user
|
|
|
101
101
|
| Model and thinking | Switch model or thinking level from Telegram through safe continuation flows. | Mobile control can adjust execution strategy without tearing down the current session. |
|
|
102
102
|
| Compaction | Confirm `/compact`, show native active status during compaction, and preserve Telegram-owned turn semantics. | Context maintenance is visible and safe from the phone. |
|
|
103
103
|
| Draft previews | Show Telegram's native `β¦typing` indicator whenever the connected instance is doing agent work, or enable Rich Draft previews for streamed answer text. | Local prompts, Telegram turns, and autonomous continuations remain visibly active while draft visibility stays independent from final rendering. |
|
|
104
|
-
| Activity | Keep the default `quiet` answer-only surface, show only `thinking`, show only `tools`, or select `verbose` for both. | Persistent collapsed technical activity stays bounded, redacted, target-fenced, and visually separate from semantic assistant answers. |
|
|
104
|
+
| Activity | Keep the default `quiet` answer-only surface, show only `thinking`, show only `tools`, or select `verbose` for both. Thinking headers report the current Pi thinking level instead of a generic completion state. | Persistent collapsed technical activity stays bounded, redacted, target-fenced, density-aware, and visually separate from semantic assistant answers. |
|
|
105
105
|
| Assistant rendering | Choose Native Rich Markdown or legacy Markdown-to-HTML for final assistant replies. | Renderer compatibility is explicit instead of being conflated with draft previews. |
|
|
106
106
|
| Bridge UI rendering | Render thinking and tool activity through ordinary expandable HTML messages, and menus, queue controls, status, settings, diagnostics, and sections through Telegram HTML/plain UI. | Harness-owned surfaces remain operationally predictable and visually distinct from model-authored answers. |
|
|
107
107
|
| Inbound files | Download inbound files to the Pi agent temp directory with size limits. | Screenshots, PDFs, datasets, and artifacts enter Pi as inspectable local files. |
|
package/docs/architecture.md
CHANGED
|
@@ -315,7 +315,7 @@ Queue reactions are shortcut controls for waiting turns. Promotion reactions (`
|
|
|
315
315
|
|
|
316
316
|
When `assistant.proactivePush` is enabled and this instance has exact direct or follower transport authority, completed public assistant text blocks from local/autonomous work are sent once and in source order to the instance's authorized target. Visible commentary/checkpoints and the final block use the configured Rich or HTML renderer. Proactive projection excludes reasoning, tool traffic, token deltas, local prompt text, Telegram-owned turns, and stale generations. Each admitted block remains fenced to its exact target, profile/token stamp, leader epoch or follower registration generation, and session generation; non-idempotent acknowledgement ambiguity never authorizes replay.
|
|
317
317
|
|
|
318
|
-
`assistant.activity` is an independent bridge-owned projection over normalized Activity events. Omitted or invalid values resolve to `quiet`, which emits no thinking or tool traffic; `thinking` and `tools` select one technical class, while `verbose` enables both. Provider-exposed thinking and completed executed tools use persistent ordinary HTML messages with standard expandable blockquotes and never use Rich Messages. Thinking uses a `π§ ` header and bounded redacted latest-text window; tools use `π ` headers and bounded redacted execution evidence. 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, 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.
|
|
318
|
+
`assistant.activity` is an independent bridge-owned projection over normalized Activity events. Omitted or invalid values resolve to `quiet`, which emits no thinking or tool traffic; `thinking` and `tools` select one technical class, while `verbose` enables both. Provider-exposed thinking and completed executed tools use persistent ordinary HTML messages with standard expandable blockquotes and never use Rich Messages. Thinking uses a `π§ ` header carrying the current Pi thinking level and a bounded redacted latest-text window; tools use `π ` headers and bounded redacted execution evidence. 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, 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.
|
|
319
319
|
|
|
320
320
|
Telegram prompt guidance is context- and authority-aware. Only an exact direct owner or live registered follower exposes the three pi-telegram model tools, their active-tool metadata, and the compact local bridge suffix. Disconnect or authority loss removes those 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 receive a compact pointer to `telegram_help` plus dynamic prompt blocks such as `[voice] delivery: automatic voice`; full voice/button/direct-delivery/Threaded Mode syntax stays in the help tool rather than every system prompt.
|
|
321
321
|
|
package/docs/outbound.md
CHANGED
|
@@ -16,7 +16,7 @@ Proactive blocks use `assistant.rendering` independently of voice policy. Rich m
|
|
|
16
16
|
|
|
17
17
|
`assistant.activity` defaults to `quiet` and accepts four modes: `quiet`, `thinking`, `tools`, and `verbose`. `thinking` shows only provider-exposed thinking, `tools` shows only completed executed tools, and `verbose` shows both without mixing technical UI into assistant Markdown.
|
|
18
18
|
|
|
19
|
-
- Provider-exposed thinking updates one persistent ordinary HTML message. Its `π§ thinking:
|
|
19
|
+
- Provider-exposed thinking updates one persistent ordinary HTML message. Its `π§ thinking: <level>` header reports the current Pi thinking level, such as `high`, above a standard Telegram `<blockquote expandable>` containing a bounded redacted latest-text window. The bridge sends the message once, edits it only as thinking grows, and leaves the disclosure in chat; it never replaces useful density metadata with a generic completion state or uses Rich drafts/Rich Messages. Providers that expose no thinking produce none.
|
|
20
20
|
- Completed executed tools use ordinary `sendMessage` HTML, never `sendRichMessage`. Each tool header renders as `π <tool>: <status>`, with a stable two-space visual gap after the icon and the `running`, `done`, or `failed` status in monospace. One standard Telegram `<blockquote expandable>` then contains bounded redacted evidence in chronological order. JSON-style labels share a line with their serialized value opening, for example `"arguments": {`, `"update 1": {`, and `"result": {` or `"error": {`; arrays of object entries use the denser `[{ ... }, { ... }]` layout while retaining indented fields.
|
|
21
21
|
- Every thinking/tool `sendMessage` and `editMessageText` sets `link_preview_options.is_disabled: true`, so URL-like evidence never expands into a web preview. Consecutive tools coalesce by editing one message only while target, activity, generation, ordering boundary, tool count, and serialized-size bounds still match. Assistant or thinking content closes the batch. A non-idempotent send with unknown commit state is never replayed; failed or ambiguous edits start no fallback send.
|
|
22
22
|
|
package/docs/public-api.md
CHANGED
|
@@ -119,7 +119,7 @@ Hidden/default semantics are represented by absence:
|
|
|
119
119
|
|
|
120
120
|
- `threads.automaticCleanup` defaults to `true`; graceful Pi quit deletes the instance's bound Threaded Mode tab without prompting. Set it to `false`, or use `π§Ή Thread cleanup` in Telegram Settings, to preserve the tab as a restart hint. Settings views and cleanup reload shared config before evaluating this switch, so another live Pi instance's update takes effect without restarting. Confirmed leader/follower teardown persists an exact target/runtime-generation cleanup intent before Telegram deletion; an interrupted attempt remains retryable by the current or successor leader under current authority and clears only after confirmed deletion. If a follower's graceful envelope is missed, the leader may create the same fenced cleanup only after its heartbeat is stale, the OS confirms the exact registered PID no longer exists, cleanup remains enabled, and no replacement registration can overtake deletion. Heartbeat loss alone, live/unknown process liveness, IPC failure, and auth failure remain non-destructive. Invalid-config recovery makes the setting unresolved and therefore skips destructive cleanup. Manual `/telegram-disconnect` keeps its confirmation and teardown behavior regardless of this setting.
|
|
121
121
|
- `assistant.proactivePush` defaults to `true`; omit it to keep projection enabled, or set it explicitly to `false` to disable it. When enabled, each completed public assistant text block from local or autonomous work is projected to the authorized Telegram target once and in source order. This includes visible intermediate commentary/checkpoints and the final block. It excludes token deltas, hidden reasoning, tool calls/arguments/results, Telegram-owned turns, empty blocks, and stale authority. Projection uses the configured Rich or HTML assistant renderer and binds admitted work to the exact target, profile/token transport generation, direct leader epoch or follower registration generation, and session generation. The old top-level `proactivePush` key is ignored; move the setting manually under `assistant`.
|
|
122
|
-
- `assistant.activity` accepts exactly `"quiet"`, `"thinking"`, `"tools"`, or `"verbose"` and resolves omitted or invalid values to `"quiet"`. `thinking` shows only provider-exposed thinking, `tools` shows only completed tool activity, and `verbose` shows both. Thinking and tools use persistent ordinary HTML `sendMessage`/`editMessageText` disclosures with standard expandable blockquotes; thinking carries a `π§ ` header and bounded redacted text, while each tool contains bounded redacted arguments, retained updates, results, and errors. Activity output never uses Rich Messages and disables link previews on every send/edit. Consecutive tools coalesce only inside the same ordered activity segment and bounded message. Legacy `assistant.activityVerbosity` is read only when `assistant.activity` is absent and is removed by the next Activity Settings write.
|
|
122
|
+
- `assistant.activity` accepts exactly `"quiet"`, `"thinking"`, `"tools"`, or `"verbose"` and resolves omitted or invalid values to `"quiet"`. `thinking` shows only provider-exposed thinking, `tools` shows only completed tool activity, and `verbose` shows both. Thinking and tools use persistent ordinary HTML `sendMessage`/`editMessageText` disclosures with standard expandable blockquotes; thinking carries a `π§ ` header with the current Pi thinking level and bounded redacted text, while each tool contains bounded redacted arguments, retained updates, results, and errors. Activity output never uses Rich Messages and disables link previews on every send/edit. Consecutive tools coalesce only inside the same ordered activity segment and bounded message. Legacy `assistant.activityVerbosity` is read only when `assistant.activity` is absent and is removed by the next Activity Settings write.
|
|
123
123
|
- Voice Reply `hidden`: no `voice.replyMode` key is persisted; legacy `manual` resolves to this silent default. `mirror` adds `[voice] delivery: automatic voice` only to voice/audio-input turns, while `always` adds the same effective line to every Telegram turn.
|
|
124
124
|
- Agent activity status is not configurable in this release. Telegram uses native `sendChatAction(typing)` / product `...active` status as the only automatic in-chat work signal before the final reply.
|
|
125
125
|
- `assistant.timeInjection` accepts `hidden`, `always`, or `interval` and defaults to `hidden`. Settings writes the selected value there, including `hidden`; the old `time.injectionMode` key is ignored and is not migrated. `time.interval` remains the optional interval duration in milliseconds.
|
package/docs/ui-style.md
CHANGED
|
@@ -34,7 +34,7 @@ Use emoji as stable semantic markers, not decoration. Emoji carry transportable
|
|
|
34
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
35
|
| `π` | Proactive push / pinned behavior | Proactive push settings row and detail card | Not generic active/selected state. |
|
|
36
36
|
| `π¬` | Activity / technical detail | Activity settings row and detail card | Chooses quiet, thinking, tools, or verbose bridge activity; not a generic diagnostics marker. |
|
|
37
|
-
| `π§ ` | Model thinking activity | Collapsed persistent thinking disclosure summaries | One marker per thinking message;
|
|
37
|
+
| `π§ ` | Model thinking activity | Collapsed persistent thinking disclosure summaries | One marker per thinking message; header text reports the current thinking level such as `high`. |
|
|
38
38
|
| `π ` | Executed tool activity | Collapsed tool disclosure summaries | One marker per tool summary; tool result state remains text (`done`/`failed`). |
|
|
39
39
|
| `π` | Attachment | Attachment summaries, queue rows for attachment-only turns | Not for thread binding. |
|
|
40
40
|
|
package/index.ts
CHANGED
|
@@ -507,6 +507,7 @@ export default function (pi: Pi.ExtensionAPI) {
|
|
|
507
507
|
activityVerbosityRuntime =
|
|
508
508
|
ActivityVerbosity.createTelegramActivityVerbosityRuntime({
|
|
509
509
|
getActivityMode: configControls.getActivityVerbosity,
|
|
510
|
+
getThinkingLevel,
|
|
510
511
|
resolveTarget(event) {
|
|
511
512
|
return event.target ?? proactivePushTargetGetter();
|
|
512
513
|
},
|
|
@@ -183,10 +183,10 @@ function toolMessageSize(tools: readonly ToolActivity[]): number {
|
|
|
183
183
|
|
|
184
184
|
export function renderTelegramThinkingActivityHtml(
|
|
185
185
|
text: string,
|
|
186
|
-
|
|
186
|
+
thinkingLevel: string,
|
|
187
187
|
): string {
|
|
188
188
|
return [
|
|
189
|
-
`<b>${TELEGRAM_THINKING_ACTIVITY_ICON}  thinking:</b> <code>${
|
|
189
|
+
`<b>${TELEGRAM_THINKING_ACTIVITY_ICON}  thinking:</b> <code>${escapeHtml(thinkingLevel)}</code>`,
|
|
190
190
|
`<blockquote expandable>${escapeHtml(text)}</blockquote>`,
|
|
191
191
|
].join("\n");
|
|
192
192
|
}
|
|
@@ -200,6 +200,7 @@ export interface TelegramActivityVerbosityRuntime {
|
|
|
200
200
|
|
|
201
201
|
export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
202
202
|
getActivityMode: () => "quiet" | "thinking" | "tools" | "verbose";
|
|
203
|
+
getThinkingLevel: () => string;
|
|
203
204
|
resolveTarget: (event: TelegramActivityEvent) => TelegramTarget | undefined;
|
|
204
205
|
captureAuthority: () => TAuthority;
|
|
205
206
|
isAuthorityActive: (authority: TAuthority) => boolean;
|
|
@@ -262,7 +263,6 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
262
263
|
const publishReasoning = async (
|
|
263
264
|
event: TelegramActivityEvent,
|
|
264
265
|
acceptedGeneration: number,
|
|
265
|
-
complete: boolean,
|
|
266
266
|
) => {
|
|
267
267
|
if (
|
|
268
268
|
generation !== acceptedGeneration ||
|
|
@@ -281,7 +281,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
281
281
|
? `β¦ [${omitted} earlier chars omitted]\n${retained}`
|
|
282
282
|
: retained,
|
|
283
283
|
);
|
|
284
|
-
body = renderTelegramThinkingActivityHtml(text,
|
|
284
|
+
body = renderTelegramThinkingActivityHtml(text, deps.getThinkingLevel());
|
|
285
285
|
if (body.length <= TELEGRAM_ACTIVITY_MESSAGE_MAX_CHARS) break;
|
|
286
286
|
retained = retained.slice(-Math.max(1, Math.floor(retained.length * 0.75)));
|
|
287
287
|
} while (retained.length > 1);
|
|
@@ -410,7 +410,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
410
410
|
(reasoningMessageFrames === 0 ||
|
|
411
411
|
reasoningChars - lastReasoningMessageChars >= 160)
|
|
412
412
|
) {
|
|
413
|
-
await publishReasoning(event, acceptedGeneration
|
|
413
|
+
await publishReasoning(event, acceptedGeneration);
|
|
414
414
|
}
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
@@ -422,8 +422,12 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
422
422
|
-TELEGRAM_REASONING_BUFFER_MAX_CHARS,
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
|
-
if (
|
|
426
|
-
|
|
425
|
+
if (
|
|
426
|
+
reasoningChars > 0 &&
|
|
427
|
+
reasoningChars > lastReasoningMessageChars &&
|
|
428
|
+
!reasoningBlocked
|
|
429
|
+
) {
|
|
430
|
+
await publishReasoning(event, acceptedGeneration);
|
|
427
431
|
}
|
|
428
432
|
reasoningBuffer = "";
|
|
429
433
|
reasoningChars = 0;
|
|
@@ -483,8 +487,12 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
483
487
|
return;
|
|
484
488
|
}
|
|
485
489
|
if (event.type === "agent-end" || event.type === "agent-settled") {
|
|
486
|
-
if (
|
|
487
|
-
|
|
490
|
+
if (
|
|
491
|
+
reasoningMessage &&
|
|
492
|
+
reasoningChars > lastReasoningMessageChars &&
|
|
493
|
+
!reasoningBlocked
|
|
494
|
+
) {
|
|
495
|
+
await publishReasoning(event, acceptedGeneration);
|
|
488
496
|
}
|
|
489
497
|
clearActivity();
|
|
490
498
|
}
|