agent-afk 5.61.0 → 5.62.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/dist/agent/provider.d.ts +4 -0
- package/dist/agent/providers/anthropic-direct/compact.d.ts +3 -1
- package/dist/agent/providers/openai-compatible/compact.d.ts +3 -1
- package/dist/agent/providers/shared/compaction.d.ts +25 -0
- package/dist/cli.mjs +480 -480
- package/dist/config/env.d.ts +2 -0
- package/dist/index.mjs +170 -170
- package/dist/telegram/formatter.d.ts +4 -0
- package/dist/telegram.mjs +211 -211
- package/package.json +1 -1
package/dist/agent/provider.d.ts
CHANGED
|
@@ -202,6 +202,10 @@ export interface ProviderCompactResult {
|
|
|
202
202
|
messagesBefore: number;
|
|
203
203
|
messagesAfter: number;
|
|
204
204
|
tokensSavedEstimate?: number;
|
|
205
|
+
microcompaction?: {
|
|
206
|
+
blocksCleared: number;
|
|
207
|
+
bytesReclaimed: number;
|
|
208
|
+
};
|
|
205
209
|
}
|
|
206
210
|
export interface ProviderCompleteArgs {
|
|
207
211
|
system: string;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { MessageParam } from '@anthropic-ai/sdk/resources';
|
|
2
2
|
import type { AnthropicMessagesCreateParams } from './types.js';
|
|
3
|
-
import { COMPACT_ACK_TEXT, COMPACT_SUMMARY_HEADER, COMPACT_SYSTEM_PROMPT, type CompactionOps } from '../shared/compaction.js';
|
|
3
|
+
import { COMPACT_ACK_TEXT, COMPACT_SUMMARY_HEADER, COMPACT_SYSTEM_PROMPT, type CompactionOps, type MicrocompactOps, type MicrocompactOptions, type MicrocompactResult } from '../shared/compaction.js';
|
|
4
4
|
export { COMPACT_ACK_TEXT, COMPACT_SUMMARY_HEADER, COMPACT_SYSTEM_PROMPT };
|
|
5
5
|
export declare function isFreshUserTurn(msg: MessageParam): boolean;
|
|
6
6
|
export declare const anthropicCompactionOps: CompactionOps<MessageParam>;
|
|
7
|
+
export declare const anthropicMicrocompactOps: MicrocompactOps<MessageParam>;
|
|
8
|
+
export declare function microcompactToolResults(messages: ReadonlyArray<MessageParam>, opts?: MicrocompactOptions): MicrocompactResult;
|
|
7
9
|
export declare function findCompactionBoundary(messages: ReadonlyArray<MessageParam>, keepLastN: number): number;
|
|
8
10
|
export declare function findCompactionBoundaryAdaptive(messages: ReadonlyArray<MessageParam>, keepLastN: number, usedFraction: number, shrinkAtFraction: number): number;
|
|
9
11
|
export declare function buildSummarizationRequest(olderMessages: ReadonlyArray<MessageParam>, model: string, maxTokens: number): AnthropicMessagesCreateParams;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ProviderCompactResult } from '../../provider.js';
|
|
2
2
|
import type { TraceWriter } from '../../trace/index.js';
|
|
3
3
|
import type { CompactionTrigger } from '../../trace/types.js';
|
|
4
|
-
import { type CompactionOps } from '../shared/compaction.js';
|
|
4
|
+
import { type CompactionOps, type MicrocompactOps, type MicrocompactOptions, type MicrocompactResult } from '../shared/compaction.js';
|
|
5
5
|
import type { OpenAIMessage } from './messages.js';
|
|
6
6
|
export declare function isFreshUserTurn(msg: OpenAIMessage): boolean;
|
|
7
|
+
export declare const openaiMicrocompactOps: MicrocompactOps<OpenAIMessage>;
|
|
8
|
+
export declare function microcompactToolResults(messages: ReadonlyArray<OpenAIMessage>, opts?: MicrocompactOptions): MicrocompactResult;
|
|
7
9
|
export declare const openaiCompactionOps: CompactionOps<OpenAIMessage>;
|
|
8
10
|
export declare function readKeepLastN(): number;
|
|
9
11
|
export declare function readShrinkFraction(): number;
|
|
@@ -5,6 +5,31 @@ export declare const COMPACT_ACK_TEXT = "Acknowledged. Continuing from the summa
|
|
|
5
5
|
export declare function wrapTranscriptForSummary(transcript: string): string;
|
|
6
6
|
export declare const DEFAULT_COMPACT_TIMEOUT_MS = 60000;
|
|
7
7
|
export declare const DEFAULT_COMPACT_SHRINK_THRESHOLD = 0.7;
|
|
8
|
+
export declare const DEFAULT_MICROCOMPACT_TOOL_RESULT_BYTES = 2048;
|
|
9
|
+
export declare const DEFAULT_MICROCOMPACT_KEEP_LAST = 4;
|
|
10
|
+
export declare const MICROCOMPACT_PLACEHOLDER_SENTINEL = "[tool result cleared to reclaim context";
|
|
11
|
+
export declare function buildMicrocompactPlaceholder(bytes: number): string;
|
|
12
|
+
export declare function isMicrocompactPlaceholder(text: string): boolean;
|
|
13
|
+
export interface ToolResultRef {
|
|
14
|
+
byteLength: number;
|
|
15
|
+
isPlaceholder: boolean;
|
|
16
|
+
clear(placeholder: string): void;
|
|
17
|
+
}
|
|
18
|
+
export interface MicrocompactOps<M> {
|
|
19
|
+
listToolResults(messages: ReadonlyArray<M>): ToolResultRef[];
|
|
20
|
+
}
|
|
21
|
+
export interface MicrocompactOptions {
|
|
22
|
+
thresholdBytes?: number;
|
|
23
|
+
keepLast?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface MicrocompactResult {
|
|
26
|
+
blocksCleared: number;
|
|
27
|
+
bytesReclaimed: number;
|
|
28
|
+
blocksScanned: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function microcompactToolResults<M>(messages: ReadonlyArray<M>, ops: MicrocompactOps<M>, opts?: MicrocompactOptions): MicrocompactResult;
|
|
31
|
+
export declare function byteLengthOf(text: string): number;
|
|
32
|
+
export declare function resolveMicrocompactOptions(rawBytes: string | undefined, rawKeepLast: string | undefined): Required<MicrocompactOptions>;
|
|
8
33
|
export interface CompactionOps<M> {
|
|
9
34
|
isFreshUserTurn(msg: M): boolean;
|
|
10
35
|
renderMessage(msg: M): string;
|