agent-afk 5.59.3 → 5.61.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/providers/anthropic-direct/compact.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query/auto-compact.d.ts +1 -1
- package/dist/agent/providers/openai-compatible/compact.d.ts +3 -0
- package/dist/agent/providers/shared/auto-compact.d.ts +1 -0
- package/dist/agent/providers/shared/compaction.d.ts +4 -0
- package/dist/agent/tools/subagent/foreground-promotion.d.ts +2 -0
- package/dist/agent/tools/subagent/input-parse.d.ts +1 -0
- package/dist/agent/types/config-types.d.ts +1 -0
- package/dist/cli.mjs +491 -487
- package/dist/config/env.d.ts +1 -0
- package/dist/index.mjs +163 -161
- package/dist/telegram.mjs +214 -210
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ 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
7
|
export declare function findCompactionBoundary(messages: ReadonlyArray<MessageParam>, keepLastN: number): number;
|
|
8
|
+
export declare function findCompactionBoundaryAdaptive(messages: ReadonlyArray<MessageParam>, keepLastN: number, usedFraction: number, shrinkAtFraction: number): number;
|
|
8
9
|
export declare function buildSummarizationRequest(olderMessages: ReadonlyArray<MessageParam>, model: string, maxTokens: number): AnthropicMessagesCreateParams;
|
|
9
10
|
export declare function applyCompaction(messages: ReadonlyArray<MessageParam>, boundary: number, summaryText: string): MessageParam[];
|
|
10
11
|
export declare function estimateTokensSaved(before: ReadonlyArray<MessageParam>, boundary: number, summaryText: string): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { computeUsedTokens, contextWindowTokensUsed, buildContextUsageFields, shouldAutoCompact, } from '../../shared/auto-compact.js';
|
|
1
|
+
export { computeUsedTokens, contextWindowTokensUsed, contextFullnessFraction, buildContextUsageFields, shouldAutoCompact, } from '../../shared/auto-compact.js';
|
|
2
2
|
export type { ContextUsageApiBreakdown, ContextUsageFields, } from '../../shared/auto-compact.js';
|
|
@@ -6,6 +6,7 @@ import type { OpenAIMessage } from './messages.js';
|
|
|
6
6
|
export declare function isFreshUserTurn(msg: OpenAIMessage): boolean;
|
|
7
7
|
export declare const openaiCompactionOps: CompactionOps<OpenAIMessage>;
|
|
8
8
|
export declare function readKeepLastN(): number;
|
|
9
|
+
export declare function readShrinkFraction(): number;
|
|
9
10
|
export interface CompactOpenAIHistoryDeps {
|
|
10
11
|
priorTurns: OpenAIMessage[];
|
|
11
12
|
summarize: (transcript: string, signal: AbortSignal) => Promise<string>;
|
|
@@ -15,5 +16,7 @@ export interface CompactOpenAIHistoryDeps {
|
|
|
15
16
|
clearAbort: (controller: AbortController) => void;
|
|
16
17
|
trigger?: CompactionTrigger;
|
|
17
18
|
traceWriter?: TraceWriter;
|
|
19
|
+
usedFraction?: number;
|
|
20
|
+
shrinkAtFraction?: number;
|
|
18
21
|
}
|
|
19
22
|
export declare function compactOpenAIHistory(deps: CompactOpenAIHistoryDeps): Promise<ProviderCompactResult>;
|
|
@@ -14,5 +14,6 @@ export interface ContextUsageFields {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function buildContextUsageFields(last: ProviderUsage | null | undefined): ContextUsageFields;
|
|
16
16
|
export declare function shouldAutoCompact(usedTokens: number, contextLimit: number, threshold: number): boolean;
|
|
17
|
+
export declare function contextFullnessFraction(usedTokens: number, contextLimit: number): number;
|
|
17
18
|
export declare const DEFAULT_AUTO_COMPACT_THRESHOLD = 0.9;
|
|
18
19
|
export declare function resolveAutoCompactThreshold(autoCompact: AgentConfig['autoCompact']): number | undefined;
|
|
@@ -4,6 +4,7 @@ export declare const COMPACT_SUMMARY_HEADER = "[Compacted summary of earlier con
|
|
|
4
4
|
export declare const COMPACT_ACK_TEXT = "Acknowledged. Continuing from the summary above.";
|
|
5
5
|
export declare function wrapTranscriptForSummary(transcript: string): string;
|
|
6
6
|
export declare const DEFAULT_COMPACT_TIMEOUT_MS = 60000;
|
|
7
|
+
export declare const DEFAULT_COMPACT_SHRINK_THRESHOLD = 0.7;
|
|
7
8
|
export interface CompactionOps<M> {
|
|
8
9
|
isFreshUserTurn(msg: M): boolean;
|
|
9
10
|
renderMessage(msg: M): string;
|
|
@@ -11,6 +12,7 @@ export interface CompactionOps<M> {
|
|
|
11
12
|
countChars(msg: M): number;
|
|
12
13
|
}
|
|
13
14
|
export declare function findCompactionBoundary<M>(messages: ReadonlyArray<M>, keepLastN: number, ops: CompactionOps<M>): number;
|
|
15
|
+
export declare function findCompactionBoundaryAdaptive<M>(messages: ReadonlyArray<M>, keepLastN: number, ops: CompactionOps<M>, usedFraction: number, shrinkAtFraction?: number): number;
|
|
14
16
|
export declare function renderTranscript<M>(messages: ReadonlyArray<M>, ops: CompactionOps<M>): string;
|
|
15
17
|
export declare function applyCompaction<M>(messages: ReadonlyArray<M>, boundary: number, summaryText: string, ops: CompactionOps<M>): M[];
|
|
16
18
|
export declare function estimateTokensSaved<M>(before: ReadonlyArray<M>, boundary: number, summaryText: string, ops: CompactionOps<M>): number;
|
|
@@ -27,6 +29,8 @@ export interface CompactionCoreDeps<M> {
|
|
|
27
29
|
messages: M[];
|
|
28
30
|
ops: CompactionOps<M>;
|
|
29
31
|
keepLastN: number;
|
|
32
|
+
usedFraction?: number;
|
|
33
|
+
shrinkAtFraction?: number;
|
|
30
34
|
summarize(transcript: string): Promise<string>;
|
|
31
35
|
isAborted(): boolean;
|
|
32
36
|
abortInFlight?(): void;
|
|
@@ -14,6 +14,7 @@ export interface RunForegroundArgs {
|
|
|
14
14
|
prompt: string;
|
|
15
15
|
idPrefix: string | undefined;
|
|
16
16
|
model: string | undefined;
|
|
17
|
+
parentModel?: string;
|
|
17
18
|
childManager: SubagentManager | undefined;
|
|
18
19
|
identity: {
|
|
19
20
|
origin?: TraceOrigin;
|
|
@@ -31,5 +32,6 @@ export interface RunForegroundArgs {
|
|
|
31
32
|
worktreePath: string;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
export declare function withProvenanceHeader(content: string, model: string | undefined, parentModel: string | undefined): string;
|
|
34
36
|
export declare function runForegroundWithPromotion(args: RunForegroundArgs): Promise<ToolResult>;
|
|
35
37
|
export {};
|