agent-afk 5.312.6 → 5.312.8
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/dist/cli/commands/interactive/turn-handler.setup.d.ts +45 -0
- package/dist/cli.mjs +370 -370
- package/dist/index.mjs +186 -186
- package/dist/telegram/elicitation-handler.send.d.ts +1 -1
- package/dist/telegram/streaming.loop.d.ts +39 -0
- package/dist/telegram.mjs +196 -196
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function sendChoiceMessages(telegram: {
|
|
2
2
|
sendMessage: (chatId: number, text: string, opts: object) => Promise<unknown>;
|
|
3
|
-
}, chatId: number, preMessages: string[], keyboardText: string, threadOpts: object, keyboardOpts: object, onFailure: () => void, signal?: AbortSignal): void
|
|
3
|
+
}, chatId: number, preMessages: string[], keyboardText: string, threadOpts: object, keyboardOpts: object, onFailure: () => void, signal?: AbortSignal): Promise<void>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Context } from 'telegraf';
|
|
2
|
+
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
3
|
+
import type { IAgentSession, OutputEvent } from '../agent/types.js';
|
|
4
|
+
import type { StreamState } from './streaming.handlers.js';
|
|
5
|
+
import { type HandlerParams } from './streaming.handlers.js';
|
|
6
|
+
import type { WatchdogState } from './streaming.watchdog.js';
|
|
7
|
+
export interface ContentRunState {
|
|
8
|
+
contentRunStartAccumulated: number;
|
|
9
|
+
contentRunStartAnswer: number;
|
|
10
|
+
inContentRun: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildStream(session: IAgentSession, content: string | ContentBlockParam[]): AsyncIterable<OutputEvent>;
|
|
13
|
+
export declare function updateWatchdogForChunk(event: OutputEvent & {
|
|
14
|
+
type: 'chunk';
|
|
15
|
+
}, watchdog: WatchdogState): void;
|
|
16
|
+
export declare function processChunkContent(event: OutputEvent & {
|
|
17
|
+
type: 'chunk';
|
|
18
|
+
chunk: {
|
|
19
|
+
type: 'content';
|
|
20
|
+
content: string;
|
|
21
|
+
};
|
|
22
|
+
}, state: StreamState, run: ContentRunState, ctx: Context, chatId: number, livePreview: () => string): Promise<void>;
|
|
23
|
+
export declare function processInlineEvent(event: OutputEvent, state: StreamState, run: ContentRunState, ctx: Context, chatId: number, livePreview: () => string): Promise<boolean>;
|
|
24
|
+
export declare function runStreamLoop(params: {
|
|
25
|
+
nextWithTimeout: () => Promise<IteratorResult<OutputEvent>>;
|
|
26
|
+
state: StreamState;
|
|
27
|
+
watchdog: WatchdogState;
|
|
28
|
+
run: ContentRunState;
|
|
29
|
+
ctx: Context;
|
|
30
|
+
chatId: number;
|
|
31
|
+
livePreview: () => string;
|
|
32
|
+
finalBody: () => string;
|
|
33
|
+
progressGateOpen: boolean;
|
|
34
|
+
progressDelayMs: number;
|
|
35
|
+
setProgressGateOpen: (v: boolean) => void;
|
|
36
|
+
clearProgressTimer: () => void;
|
|
37
|
+
handlerParams: HandlerParams;
|
|
38
|
+
logger?: (...args: unknown[]) => void;
|
|
39
|
+
}): Promise<void>;
|