@llblab/pi-telegram 0.26.13 → 0.26.14
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 +4 -0
- package/lib/activity-verbosity.ts +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.14: Reasoning Activity Throttle
|
|
4
|
+
|
|
5
|
+
- `Reasoning Throttle`: Added a minimum interval between reasoning-block edits (`TELEGRAM_REASONING_MIN_INTERVAL_MS = 1_200`) so the first frame publishes immediately while later frames wait until both the interval and the 160-char delta threshold pass. The final `reasoning-end`/`agent-end` flush stays unconditional, and the 24-frame cap is unchanged. Impact: fast-token models with very large reasoning blocks no longer push an edit per character burst, so parallel threads stop saturating the bus and inbound Telegram messages arrive without multi-second delay.
|
|
6
|
+
|
|
3
7
|
## 0.26.13: Entrypoint Compression And BotFather Prerequisites
|
|
4
8
|
|
|
5
9
|
- `Entrypoint Compression`: Moved low-level policy out of `index.ts` into owning domains: the deferred queue dispatch delay defaults in the queue domain, the delivery generation seed is built by the delivery domain, the `target-bindings` sync slice key and the default profile name resolve from their domains, and bus-runtime capability answers come from the thread capability state. Removed a redundant follower client timeout literal that duplicated the domain default. Impact: the composition root wires ports while constants, generations, and capability decisions stay with their owning domains.
|
|
@@ -24,6 +24,7 @@ export const TELEGRAM_ACTIVITY_MESSAGE_MAX_CHARS = 3_900;
|
|
|
24
24
|
export const TELEGRAM_ACTIVITY_MESSAGE_MAX_TOOLS = 6;
|
|
25
25
|
export const TELEGRAM_REASONING_MESSAGE_MAX_FRAMES = 24;
|
|
26
26
|
export const TELEGRAM_REASONING_BUFFER_MAX_CHARS = 1_200;
|
|
27
|
+
export const TELEGRAM_REASONING_MIN_INTERVAL_MS = 1_200;
|
|
27
28
|
export const TELEGRAM_TOOL_UPDATE_MAX_ENTRIES = 4;
|
|
28
29
|
|
|
29
30
|
interface ToolActivity {
|
|
@@ -291,6 +292,7 @@ export interface TelegramActivityVerbosityRuntime {
|
|
|
291
292
|
export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
292
293
|
getActivityMode: () => "quiet" | "thinking" | "tools" | "verbose";
|
|
293
294
|
refreshActivityMode?: () => Promise<void>;
|
|
295
|
+
getNowMs?: () => number;
|
|
294
296
|
resolveTarget: (event: TelegramActivityEvent) => TelegramTarget | undefined;
|
|
295
297
|
captureAuthority: () => TAuthority;
|
|
296
298
|
isAuthorityActive: (authority: TAuthority) => boolean;
|
|
@@ -315,6 +317,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
315
317
|
let active = true;
|
|
316
318
|
let generation = 0;
|
|
317
319
|
let tail = Promise.resolve();
|
|
320
|
+
const getNowMs = deps.getNowMs ?? Date.now;
|
|
318
321
|
let activityId: string | undefined;
|
|
319
322
|
let authority: TAuthority | undefined;
|
|
320
323
|
let target: TelegramTarget | undefined;
|
|
@@ -324,6 +327,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
324
327
|
let lastReasoningMessageChars = 0;
|
|
325
328
|
let reasoningMessage: ReasoningMessage | undefined;
|
|
326
329
|
let reasoningBlocked = false;
|
|
330
|
+
let lastReasoningPublishMs = 0;
|
|
327
331
|
let toolMessage: ToolMessage | undefined;
|
|
328
332
|
const tools = new Map<string, ToolActivity>();
|
|
329
333
|
const toolOrder: string[] = [];
|
|
@@ -338,6 +342,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
338
342
|
lastReasoningMessageChars = 0;
|
|
339
343
|
reasoningMessage = undefined;
|
|
340
344
|
reasoningBlocked = false;
|
|
345
|
+
lastReasoningPublishMs = 0;
|
|
341
346
|
toolMessage = undefined;
|
|
342
347
|
tools.clear();
|
|
343
348
|
toolOrder.length = 0;
|
|
@@ -412,6 +417,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
412
417
|
if (generation !== acceptedGeneration) return;
|
|
413
418
|
reasoningMessageFrames += 1;
|
|
414
419
|
lastReasoningMessageChars = reasoningChars;
|
|
420
|
+
lastReasoningPublishMs = getNowMs();
|
|
415
421
|
} catch (error) {
|
|
416
422
|
deps.recordFailure?.(
|
|
417
423
|
canEdit ? "reasoning-edit" : "reasoning-send",
|
|
@@ -552,10 +558,11 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
552
558
|
reasoningBuffer = `${reasoningBuffer}${event.delta}`.slice(
|
|
553
559
|
-TELEGRAM_REASONING_BUFFER_MAX_CHARS,
|
|
554
560
|
);
|
|
555
|
-
if (
|
|
556
|
-
reasoningMessageFrames < TELEGRAM_REASONING_MESSAGE_MAX_FRAMES &&
|
|
561
|
+
if (reasoningMessageFrames < TELEGRAM_REASONING_MESSAGE_MAX_FRAMES &&
|
|
557
562
|
(reasoningMessageFrames === 0 ||
|
|
558
|
-
|
|
563
|
+
(getNowMs() - lastReasoningPublishMs >=
|
|
564
|
+
TELEGRAM_REASONING_MIN_INTERVAL_MS &&
|
|
565
|
+
reasoningChars - lastReasoningMessageChars >= 160))
|
|
559
566
|
) {
|
|
560
567
|
await publishReasoning(event, acceptedGeneration);
|
|
561
568
|
}
|
|
@@ -580,6 +587,7 @@ export function createTelegramActivityVerbosityRuntime<TAuthority>(deps: {
|
|
|
580
587
|
reasoningChars = 0;
|
|
581
588
|
reasoningMessageFrames = 0;
|
|
582
589
|
lastReasoningMessageChars = 0;
|
|
590
|
+
lastReasoningPublishMs = 0;
|
|
583
591
|
reasoningMessage = undefined;
|
|
584
592
|
reasoningBlocked = false;
|
|
585
593
|
return;
|