agent-afk 5.84.2 → 5.84.4
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/loop/outcomes.d.ts +16 -0
- package/dist/agent/providers/anthropic-direct/loop/retry-budget.d.ts +15 -0
- package/dist/agent/providers/anthropic-direct/loop/round-request.d.ts +28 -0
- package/dist/agent/providers/anthropic-direct/loop/round-retry.d.ts +12 -0
- package/dist/agent/providers/anthropic-direct/loop/stream-consumer.d.ts +18 -0
- package/dist/agent/providers/anthropic-direct/loop/thinking-diagnostic.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/loop/throttle-signals.d.ts +3 -0
- package/dist/agent/providers/anthropic-direct/loop/tool-dispatch.d.ts +12 -0
- package/dist/agent/providers/anthropic-direct/loop/tool-results.d.ts +4 -0
- package/dist/agent/providers/anthropic-direct/loop/tool-round.d.ts +5 -0
- package/dist/agent/providers/anthropic-direct/loop/turn-accumulator.d.ts +13 -0
- package/dist/agent/providers/anthropic-direct/loop/turn-terminal.d.ts +4 -0
- package/dist/agent/providers/anthropic-direct/loop/turn-trace.d.ts +9 -0
- package/dist/agent/providers/anthropic-direct/loop.d.ts +1 -7
- package/dist/agent/providers/anthropic-direct/query/retry-layer.d.ts +1 -0
- package/dist/cli/slash/commands/retry.d.ts +2 -0
- package/dist/cli.mjs +530 -530
- package/dist/index.mjs +186 -186
- package/dist/telegram.mjs +246 -246
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TurnResult } from '../types.js';
|
|
2
|
+
export type RetryReason = 'ttfb' | 'overload' | 'stream-incomplete';
|
|
3
|
+
export type RoundOutcome = {
|
|
4
|
+
kind: 'terminated';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'retry';
|
|
7
|
+
reason: RetryReason;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'overload-exhausted';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'translator-errored';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'streamed';
|
|
14
|
+
turnResult: TurnResult | null;
|
|
15
|
+
};
|
|
16
|
+
export type RetryOutcome = 'continue' | 'terminated';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const OVERLOAD_MAX_RETRIES = 3;
|
|
2
|
+
export declare const OVERLOAD_BASE_DELAY_MS = 5000;
|
|
3
|
+
export declare const STREAM_INCOMPLETE_MAX_RETRIES = 2;
|
|
4
|
+
export declare const STREAM_INCOMPLETE_BASE_DELAY_MS = 1000;
|
|
5
|
+
export declare function isTransientServerError(err: Error): boolean;
|
|
6
|
+
export declare function isOverloadedErrorEvent(err: unknown): boolean;
|
|
7
|
+
export declare class RoundRetryBudget {
|
|
8
|
+
overloadRetries: number;
|
|
9
|
+
streamIncompleteRetries: number;
|
|
10
|
+
ttfbRetried: boolean;
|
|
11
|
+
canRetryOverload(): boolean;
|
|
12
|
+
canRetryStreamIncomplete(): boolean;
|
|
13
|
+
canRetryTtfb(): boolean;
|
|
14
|
+
reset(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { AnthropicToolDef, RunTurnInput, WireToolDef } from '../types.js';
|
|
3
|
+
import { type FirstByteTimeoutHandle } from '../../shared/first-byte-timeout.js';
|
|
4
|
+
import { type StreamStallHandle } from '../../shared/stream-stall-timeout.js';
|
|
5
|
+
import { type RoundRetryBudget } from './retry-budget.js';
|
|
6
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
7
|
+
export declare function toWireTool(tool: AnthropicToolDef): WireToolDef;
|
|
8
|
+
export interface OpenRoundTransport {
|
|
9
|
+
kind: 'opened';
|
|
10
|
+
events: AsyncIterable<unknown>;
|
|
11
|
+
ttfb: FirstByteTimeoutHandle;
|
|
12
|
+
stall: StreamStallHandle;
|
|
13
|
+
requestStartedAt: number;
|
|
14
|
+
}
|
|
15
|
+
export type OpenRoundResult = OpenRoundTransport | {
|
|
16
|
+
kind: 'retry-ttfb';
|
|
17
|
+
requestStartedAt: number;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'terminated';
|
|
20
|
+
};
|
|
21
|
+
export interface OpenRoundContext {
|
|
22
|
+
input: RunTurnInput;
|
|
23
|
+
turn: TurnAccumulator;
|
|
24
|
+
retry: RoundRetryBudget;
|
|
25
|
+
ttfbTimeoutMs: number;
|
|
26
|
+
stallTimeoutMs: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function openRound({ input, turn, retry, ttfbTimeoutMs, stallTimeoutMs, }: OpenRoundContext): AsyncGenerator<ProviderEvent, OpenRoundResult, void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput } from '../types.js';
|
|
3
|
+
import type { RetryOutcome, RetryReason } from './outcomes.js';
|
|
4
|
+
import { type RoundRetryBudget } from './retry-budget.js';
|
|
5
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
6
|
+
export interface RoundRetryContext {
|
|
7
|
+
input: RunTurnInput;
|
|
8
|
+
turn: TurnAccumulator;
|
|
9
|
+
retry: RoundRetryBudget;
|
|
10
|
+
requestStartedAt: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function handleRoundRetry(reason: RetryReason, { input, turn, retry, requestStartedAt }: RoundRetryContext): AsyncGenerator<ProviderEvent, RetryOutcome, void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput } from '../types.js';
|
|
3
|
+
import type { FirstByteTimeoutHandle } from '../../shared/first-byte-timeout.js';
|
|
4
|
+
import { type StreamStallHandle } from '../../shared/stream-stall-timeout.js';
|
|
5
|
+
import type { RoundRetryBudget } from './retry-budget.js';
|
|
6
|
+
import type { RoundOutcome } from './outcomes.js';
|
|
7
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
8
|
+
export interface StreamConsumerContext {
|
|
9
|
+
events: AsyncIterable<unknown>;
|
|
10
|
+
input: RunTurnInput;
|
|
11
|
+
turn: TurnAccumulator;
|
|
12
|
+
retry: RoundRetryBudget;
|
|
13
|
+
ttfb: FirstByteTimeoutHandle;
|
|
14
|
+
stall: StreamStallHandle;
|
|
15
|
+
stallTimeoutMs: number;
|
|
16
|
+
requestStartedAt: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function consumeRoundStream({ events, input, turn, retry, ttfb, stall, stallTimeoutMs, requestStartedAt, }: StreamConsumerContext): AsyncGenerator<ProviderEvent, RoundOutcome, void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput } from '../types.js';
|
|
3
|
+
export declare function awaitCreateWithThrottleSignals(createPromise: Promise<AsyncIterable<unknown>>, input: RunTurnInput): AsyncGenerator<ProviderEvent, AsyncIterable<unknown>, void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput, ToolCall, ToolResult, TurnResult } from '../types.js';
|
|
3
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
4
|
+
export type DispatchResult = {
|
|
5
|
+
kind: 'dispatched';
|
|
6
|
+
calls: ToolCall[];
|
|
7
|
+
results: ToolResult[];
|
|
8
|
+
startTimes: Map<string, number>;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'aborted';
|
|
11
|
+
};
|
|
12
|
+
export declare function dispatchToolCalls(turnResult: TurnResult, input: RunTurnInput, turn: TurnAccumulator): AsyncGenerator<ProviderEvent, DispatchResult, void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput, ToolCall, ToolResult } from '../types.js';
|
|
3
|
+
export type ToolResultsOutcome = 'committed' | 'denial-tripped';
|
|
4
|
+
export declare function emitAndCommitToolResults(calls: ToolCall[], results: ToolResult[], startTimes: Map<string, number>, input: RunTurnInput): AsyncGenerator<ProviderEvent, ToolResultsOutcome, void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput, TurnResult } from '../types.js';
|
|
3
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
4
|
+
export type ToolRoundOutcome = 'continue' | 'terminated';
|
|
5
|
+
export declare function runToolRound(turnResult: TurnResult, input: RunTurnInput, turn: TurnAccumulator, maxIterations: number): AsyncGenerator<ProviderEvent, ToolRoundOutcome, void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProviderUsage } from '../../../provider.js';
|
|
2
|
+
export declare class TurnAccumulator {
|
|
3
|
+
usage: ProviderUsage;
|
|
4
|
+
iterations: number;
|
|
5
|
+
toolCallCount: number;
|
|
6
|
+
capReached: boolean;
|
|
7
|
+
readonly taskId: string;
|
|
8
|
+
readonly startedAt: number;
|
|
9
|
+
elapsedMs(): number;
|
|
10
|
+
withDuration(usage: ProviderUsage): ProviderUsage;
|
|
11
|
+
terminalUsage(): ProviderUsage;
|
|
12
|
+
addRoundUsage(roundUsage: ProviderUsage): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { RunTurnInput, TurnResult } from '../types.js';
|
|
3
|
+
import type { TurnAccumulator } from './turn-accumulator.js';
|
|
4
|
+
export declare function emitNonToolUseTerminal(turnResult: TurnResult, input: RunTurnInput, turn: TurnAccumulator): Generator<ProviderEvent, void, void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TraceWriter } from '../../../trace/index.js';
|
|
2
|
+
export declare class TurnTrace {
|
|
3
|
+
private readonly signal;
|
|
4
|
+
private readonly traceWriter;
|
|
5
|
+
private interruptedAt;
|
|
6
|
+
constructor(signal: AbortSignal, traceWriter: TraceWriter | undefined);
|
|
7
|
+
private readonly onInterrupt;
|
|
8
|
+
finish(turnElapsedMs: number): void;
|
|
9
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { ProviderEvent } from '../../provider.js';
|
|
2
|
-
import type {
|
|
3
|
-
export { DEFAULT_MAX_TOOL_USE_ITERATIONS } from '../shared/tool-loop-cap.js';
|
|
4
|
-
export declare function toWireTool(tool: AnthropicToolDef): WireToolDef;
|
|
5
|
-
export declare const OVERLOAD_MAX_RETRIES = 3;
|
|
6
|
-
export declare const STREAM_INCOMPLETE_MAX_RETRIES = 2;
|
|
7
|
-
export declare function isTransientServerError(err: Error): boolean;
|
|
8
|
-
export declare function isOverloadedErrorEvent(err: unknown): boolean;
|
|
2
|
+
import type { RunTurnInput } from './types.js';
|
|
9
3
|
export declare function runTurn(input: RunTurnInput): AsyncGenerator<ProviderEvent, void, void>;
|