agent-afk 5.43.0 → 5.44.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.
@@ -109,6 +109,12 @@ export type ProviderEvent = {
109
109
  } | {
110
110
  type: 'stream.retry';
111
111
  sessionId?: string;
112
+ } | {
113
+ type: 'rate_limit';
114
+ sessionId: string;
115
+ retryAfterMs?: number;
116
+ status?: number;
117
+ attempt?: number;
112
118
  } | {
113
119
  type: 'error';
114
120
  error: Error;
@@ -33,6 +33,7 @@ export interface AnthropicDirectQueryOptions {
33
33
  mcpManager?: import('../../mcp/index.js').McpManager;
34
34
  autoCompactThreshold?: number;
35
35
  hookRegistry?: HookRegistry;
36
+ throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
36
37
  }
37
38
  export declare class AnthropicDirectQuery implements ProviderQuery {
38
39
  private readonly initSessionId;
@@ -52,6 +53,7 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
52
53
  private readonly onPermissionMode?;
53
54
  private readonly mcpManager?;
54
55
  private readonly hookRegistry?;
56
+ private readonly throttleQueue?;
55
57
  constructor(opts: AnthropicDirectQueryOptions);
56
58
  [Symbol.asyncIterator](): AsyncIterator<ProviderEvent>;
57
59
  private composeSystem;
@@ -0,0 +1,17 @@
1
+ export interface ThrottleSignal {
2
+ status: number;
3
+ retryAfterMs?: number;
4
+ attempt: number;
5
+ }
6
+ export declare class ThrottleQueue {
7
+ private readonly items;
8
+ private waiter;
9
+ private attempts;
10
+ push(info: {
11
+ status: number;
12
+ retryAfterMs?: number;
13
+ }): void;
14
+ takeAll(): ThrottleSignal[];
15
+ waitForItem(): Promise<void>;
16
+ resetAttempts(): void;
17
+ }
@@ -1,2 +1,6 @@
1
1
  import type { TraceWriter } from '../../trace/index.js';
2
- export declare function makeTracingFetch(writer: TraceWriter | undefined, baseFetch?: typeof fetch): typeof fetch;
2
+ export interface ThrottleInfo {
3
+ status: number;
4
+ retryAfterMs?: number;
5
+ }
6
+ export declare function makeTracingFetch(writer: TraceWriter | undefined, baseFetch?: typeof fetch, onThrottle?: (info: ThrottleInfo) => void): typeof fetch;
@@ -60,6 +60,7 @@ export interface RunTurnInput {
60
60
  baseUrl?: string;
61
61
  traceWriter?: import('../../trace/index.js').TraceWriter;
62
62
  onUsageProgress?: (usage: ProviderUsage) => void;
63
+ throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
63
64
  }
64
65
  export interface AnthropicClientLike {
65
66
  messages: {
@@ -62,6 +62,9 @@ export type OutputEvent = {
62
62
  suggestion: string;
63
63
  } | {
64
64
  type: 'stream_retry';
65
+ } | {
66
+ type: 'rate_limit';
67
+ retryAfterMs?: number;
65
68
  } | {
66
69
  type: 'panel';
67
70
  spec: PanelSpec;
@@ -2,6 +2,7 @@ import type { SubagentCompleteInfo } from '../../../agent/default-hook-registry.
2
2
  import type { ProgressEvent } from '../../../agent/types.js';
3
3
  import type { CompletionWriter } from './shared.js';
4
4
  export declare function deriveProgressActivity(thinkingBuffer: string, columns?: number): string | undefined;
5
+ export declare function formatRateLimitActivity(retryAfterMs?: number): string;
5
6
  export declare function formatProgressBanner(event: ProgressEvent, columns?: number, activity?: string): string[];
6
7
  export declare function formatProgressSummary(event: ProgressEvent, columns?: number): string;
7
8
  export declare function formatSubagentCompletion(info: SubagentCompleteInfo, columns?: number): string;
@@ -15,7 +15,6 @@ export interface ReplElicitationDeps {
15
15
  }) => Promise<readonly string[] | null>;
16
16
  readTextOverlay?: (opts: {
17
17
  header: readonly string[];
18
- initial?: string;
19
18
  help?: string;
20
19
  validate?: (value: string) => string | null;
21
20
  signal: AbortSignal;