agent-afk 5.20.4 → 5.20.5

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.
@@ -5,12 +5,13 @@ export declare const EFFORT_BETA_HEADER = "effort-2025-11-24";
5
5
  export declare const CLI_USER_AGENT = "claude-cli/1.0.0 (external, cli)";
6
6
  export declare const BILLING_HEADER_TEXT = "x-anthropic-billing-header: cc_version=1.0.0.test; cc_entrypoint=cli; cch=00000;";
7
7
  export declare function detectAuthMode(token: string): AuthMode;
8
- export declare function buildClientOptions(token: string, mode: AuthMode, baseUrl?: string): ({
8
+ export declare function buildClientOptions(token: string, mode: AuthMode, baseUrl?: string, fetchImpl?: typeof fetch): ({
9
9
  authToken: string;
10
10
  } | {
11
11
  apiKey: string;
12
12
  }) & {
13
13
  baseURL?: string;
14
+ fetch?: typeof fetch;
14
15
  };
15
16
  export declare function buildRequestHeaders(mode: AuthMode, sessionId: string, requestId: string, withEffort?: boolean): Record<string, string>;
16
17
  export declare function buildSystemPrefix(mode: AuthMode): ContentBlockParam[] | null;
@@ -15,6 +15,7 @@ export type AnthropicClientFactory = (opts: ({
15
15
  apiKey: string;
16
16
  }) & {
17
17
  baseURL?: string;
18
+ fetch?: typeof fetch;
18
19
  }) => Anthropic;
19
20
  export declare function __setAnthropicClientFactory(factory: AnthropicClientFactory | null): void;
20
21
  export interface AnthropicDirectProviderOptions {
@@ -0,0 +1,2 @@
1
+ import type { TraceWriter } from '../../trace/index.js';
2
+ export declare function makeTracingFetch(writer: TraceWriter | undefined, baseFetch?: typeof fetch): typeof fetch;
@@ -3,9 +3,13 @@ export type UsageLimitClassification = {
3
3
  resetsAt: Date;
4
4
  } | {
5
5
  kind: 'oauth-limit-no-ts';
6
+ } | {
7
+ kind: 'rate-limit-transient';
8
+ retryAfterMs?: number;
6
9
  } | {
7
10
  kind: 'credit-exhausted';
8
11
  };
12
+ export declare function parseRetryAfterMs(error: unknown): number | undefined;
9
13
  export declare function classifyUsageLimitError(error: Error): UsageLimitClassification | null;
10
14
  export interface WaitForResetOpts {
11
15
  resetsAt: Date;
@@ -446,6 +446,7 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
446
446
  loop_start: "loop_start";
447
447
  loop_end: "loop_end";
448
448
  model_ttfb: "model_ttfb";
449
+ rate_limit: "rate_limit";
449
450
  }>;
450
451
  export declare const SessionPhasePayloadSchema: z.ZodObject<{
451
452
  phase: z.ZodEnum<{
@@ -460,6 +461,7 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
460
461
  loop_start: "loop_start";
461
462
  loop_end: "loop_end";
462
463
  model_ttfb: "model_ttfb";
464
+ rate_limit: "rate_limit";
463
465
  }>;
464
466
  durationMs: z.ZodOptional<z.ZodNumber>;
465
467
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -763,6 +765,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
763
765
  loop_start: "loop_start";
764
766
  loop_end: "loop_end";
765
767
  model_ttfb: "model_ttfb";
768
+ rate_limit: "rate_limit";
766
769
  }>;
767
770
  durationMs: z.ZodOptional<z.ZodNumber>;
768
771
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -1074,6 +1077,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1074
1077
  loop_start: "loop_start";
1075
1078
  loop_end: "loop_end";
1076
1079
  model_ttfb: "model_ttfb";
1080
+ rate_limit: "rate_limit";
1077
1081
  }>;
1078
1082
  durationMs: z.ZodOptional<z.ZodNumber>;
1079
1083
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -194,7 +194,7 @@ export interface BrowserEventPayload {
194
194
  };
195
195
  durationMs: number;
196
196
  }
197
- export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb';
197
+ export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'rate_limit';
198
198
  export interface SessionPhasePayload {
199
199
  phase: SessionPhaseName;
200
200
  durationMs?: number;