@genesislcap/foundation-ai 14.489.1-alpha-0babe6c0f.0 → 14.490.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ai-provider.d.ts","sourceRoot":"","sources":["../../src/ai-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAU/D,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,QAAQ,EAIb,KAAK,4BAA4B,EAIlC,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI3F;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,iBAAiB,CAAC,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;IAEhD;;OAEG;IACH,SAAS,CAAC,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;OAGG;IACH,IAAI,CAAC,CACH,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,CACT,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,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AE9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACrC,OAAO,GAAE,0BAA+B,GACvC,yBAAyB,CAyB3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,kBAAkB,GAC3B,IAAI,CAEN"}
@@ -8,6 +8,12 @@ export interface AnthropicTransportConfig {
8
8
  */
9
9
  model?: AnthropicModelId;
10
10
  timeout?: number;
11
+ /**
12
+ * Inactivity window (ms) on the server-proxied heartbeat path: once the framed
13
+ * body starts streaming, the request aborts when no frame/chunk arrives for this
14
+ * long. Ignored on direct API calls and legacy JSON responses. Defaults to 30_000.
15
+ */
16
+ stallTimeout?: number;
11
17
  /**
12
18
  * API key for direct calls to the Anthropic API.
13
19
  * Must be provided explicitly; callers are responsible for reading it from
@@ -89,6 +95,7 @@ export declare class ResponseTruncatedError extends Error {
89
95
  export declare class AnthropicTransport implements AITransport, ChatTransport, CostReportingTransport {
90
96
  private readonly model;
91
97
  private readonly timeout;
98
+ private readonly stallTimeout;
92
99
  private readonly apiKey;
93
100
  private readonly serverEndpoint;
94
101
  private readonly maxTokens;
@@ -162,7 +169,6 @@ export declare class AnthropicTransport implements AITransport, ChatTransport, C
162
169
  private toAnthropicMessages;
163
170
  private fromAnthropicResponse;
164
171
  private buildEndpoint;
165
- private static readonly MAX_RETRIES;
166
172
  private static readonly RATE_LIMIT_STATUS;
167
173
  private static readonly SERVICE_UNAVAILABLE_STATUS;
168
174
  private static readonly OVERLOADED_STATUS;
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-transport.d.ts","sourceRoot":"","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,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAqDrB;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IA0E3B,OAAO,CAAC,qBAAqB;IAwF7B,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;CAenB"}
@@ -7,6 +7,12 @@ export interface GeminiTransportConfig {
7
7
  */
8
8
  model?: GeminiModelId;
9
9
  timeout?: number;
10
+ /**
11
+ * Inactivity window (ms) on the server-proxied heartbeat path: once the framed
12
+ * body starts streaming, the request aborts when no frame/chunk arrives for this
13
+ * long. Ignored on direct API calls and legacy JSON responses. Defaults to 30_000.
14
+ */
15
+ stallTimeout?: number;
10
16
  /**
11
17
  * API key for direct calls to the Gemini API.
12
18
  * Must be provided explicitly; callers are responsible for reading it from
@@ -43,6 +49,7 @@ export declare class MalformedFunctionCallError extends Error {
43
49
  export declare class GeminiTransport implements AITransport, ChatTransport, CostReportingTransport {
44
50
  private readonly model;
45
51
  private readonly timeout;
52
+ private readonly stallTimeout;
46
53
  private readonly apiKey;
47
54
  private readonly serverEndpoint;
48
55
  /**
@@ -108,7 +115,6 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
108
115
  */
109
116
  private logAbnormalResponse;
110
117
  private buildEndpoint;
111
- private static readonly MAX_RETRIES;
112
118
  private static readonly RATE_LIMIT_STATUS;
113
119
  private static readonly SERVICE_UNAVAILABLE_STATUS;
114
120
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"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AAO,CAAC,MAAM,CAAC;IAgBvE,eAAe,CACnB,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IAsEvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,gBAAgB;IAmFxB,OAAO,CAAC,kBAAkB;IAsJ1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgBlB,OAAO,CAAC,eAAe;CAexB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Shared reader for the ai-service proxy's NDJSON heartbeat protocol (v1),
3
+ * used by the server-proxied transports (Anthropic, Gemini). The proxy streams
4
+ * `ping` frames while the upstream call runs and ends the body with exactly one
5
+ * terminal `ok`/`err` frame, one JSON object per LF-terminated line.
6
+ */
7
+ /**
8
+ * Terminal frames of the heartbeat protocol. `ping` frames and unknown `t`
9
+ * values are consumed by the reader as activity and never surface here.
10
+ * `body` is untyped at this level — each transport casts it to its own
11
+ * response shape.
12
+ */
13
+ export interface NdjsonOkFrame {
14
+ t: 'ok';
15
+ body: unknown;
16
+ }
17
+ export interface NdjsonErrFrame {
18
+ t: 'err';
19
+ status: number;
20
+ code?: string;
21
+ error?: string;
22
+ details?: unknown;
23
+ }
24
+ /**
25
+ * Read an NDJSON heartbeat body to its terminal frame. Buffers partial lines
26
+ * across chunks, tolerates blank lines, and skips unknown frame types — pings
27
+ * matter only as activity, which `onChunk` reports to the caller's stall
28
+ * timer. An abort (stall timer or caller signal) rejects the pending `read()`
29
+ * with the abort reason, which propagates to the caller's finally cleanup.
30
+ * `vendorLabel` (e.g. `'Anthropic'`) prefixes the protocol-violation messages.
31
+ *
32
+ * `stallTimeout` (ms) arms a client-side backstop: the proxy's own pings re-arm
33
+ * the caller's inactivity timer, so a proxy whose upstream has wedged but which
34
+ * keeps pinging would never trip it. Each ping stamps `sinceLastEventMs` (time
35
+ * since the last upstream event); when that exceeds `stallTimeout` we treat it
36
+ * as a stall and throw the tagged `TimeoutError`, independent of the proxy
37
+ * noticing its own stall. `<= 0` disables the backstop (inactivity detection off).
38
+ */
39
+ export declare function readFramedBody(stream: ReadableStream<Uint8Array>, onChunk: () => void, vendorLabel: string, stallTimeout: number): Promise<NdjsonOkFrame | NdjsonErrFrame>;
40
+ //# sourceMappingURL=ndjson-frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson-frames.d.ts","sourceRoot":"","sources":["../../../src/transports/ndjson-frames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,EAAE,OAAO,CAAC;CACf;AACD,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,KAAK,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,OAAO,EAAE,MAAM,IAAI,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,cAAc,CAAC,CAyFzC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The retry/stall/framing envelope shared by the server-proxied transports
3
+ * (Anthropic, Gemini). Both `post()` bodies were byte-identical modulo the
4
+ * vendor label, the retryable-status set, the request body, and the result
5
+ * cast — so the loop, timers, signal combination, NDJSON branch and abort-reason
6
+ * handling live here once. Each transport builds its endpoint, delegates, and
7
+ * casts the `unknown` result to its own response shape.
8
+ */
9
+ export interface PostWithRetryOptions {
10
+ url: string;
11
+ headers: Record<string, string>;
12
+ /**
13
+ * The request body to send, JSON-stringified here. Anthropic passes its
14
+ * message body directly; Gemini passes the payload its `buildEndpoint` built.
15
+ */
16
+ body: unknown;
17
+ credentials: RequestCredentials;
18
+ /** Prefixes thrown messages, retry logs and frame diagnostics (e.g. `'Anthropic'`). */
19
+ vendorLabel: string;
20
+ /** Statuses (HTTP and err-frame alike) that join the backoff ladder. */
21
+ retryableStatuses: readonly number[];
22
+ /** Wall-clock cap (ms) for connect/headers — and the whole body on the legacy JSON path. */
23
+ timeout: number;
24
+ /** Inactivity window (ms) on the framed path; `<= 0` disables stall detection. */
25
+ stallTimeout: number;
26
+ /** Base backoff (ms); the ladder is `base * 2^attempt`. */
27
+ backoffBaseMs: number;
28
+ /** Optional caller cancel signal (user cancel / sub-agent dispose). */
29
+ signal?: AbortSignal;
30
+ }
31
+ /**
32
+ * POST with the shared retry ladder, wall-clock timeout, framed-mode stall
33
+ * detection and abort-reason preservation. Returns the terminal `ok` frame body
34
+ * (framed proxy) or the parsed JSON (legacy proxy / direct API) as `unknown` —
35
+ * the caller casts. Throws a tagged `TimeoutError` on a stall (local inactivity,
36
+ * the proxy's `sinceLastEventMs` backstop, or an `UPSTREAM_STALLED` frame), the
37
+ * caller's reason on a caller abort, or a plain `Error` otherwise.
38
+ */
39
+ export declare function postWithRetry(options: PostWithRetryOptions): Promise<unknown>;
40
+ //# sourceMappingURL=post-with-retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-with-retry.d.ts","sourceRoot":"","sources":["../../../src/transports/post-with-retry.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,kBAAkB,CAAC;IAChC,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,4FAA4F;IAC5F,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAID;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CA4InF"}
@@ -422,7 +422,8 @@ export interface InteractionRequestOptions {
422
422
  * - `unknown_tool_limit` — the model repeatedly called tools that aren't
423
423
  * available to it.
424
424
  * - `timeout` — the sub-agent did not finish within
425
- * {@link SubAgentRequestOptions.timeoutMs}; its run was aborted.
425
+ * {@link SubAgentRequestOptions.timeoutMs} (its run was aborted), or a
426
+ * transport request timed out inside the child's own run.
426
427
  * - `response_truncated` — a turn stopped at the provider's output-token cap with
427
428
  * an incomplete tool call; deterministic, so it is not retried.
428
429
  *
@@ -1 +1 @@
1
- {"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":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AED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,iFAAiF;IACjF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,gEAAgE;IAChE,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IACE,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+CAA+C;IAC/C,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE;;;OAGG;IACH,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -32,6 +32,13 @@ export declare const SUPPORTED_ANTHROPIC_MODEL_IDS: readonly AnthropicModelId[];
32
32
  export interface AIProviderConfig {
33
33
  model?: string;
34
34
  timeout?: number;
35
+ /**
36
+ * Inactivity window (ms) between streamed frames before a request is treated
37
+ * as stalled. Only meaningful for server-proxied transports with heartbeat
38
+ * framing (the Anthropic and Gemini NDJSON proxy paths); direct API calls
39
+ * ignore it.
40
+ */
41
+ stallTimeout?: number;
35
42
  /** Optional override for criteria interpretation capability. */
36
43
  criteriaInstructions?: string;
37
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/types/config.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAEnF;;;;GAI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AoB,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,YAAY,EAAE,QAAQ,CAAC;IACvB,4GAA4G;IAC5G,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,YAAY,EAAE,WAAW,CAAC;IAC1B,mHAAmH;IACnH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Resolve the authoritative reason behind an abort-shaped rejection.
3
+ *
4
+ * Chromium/Firefox reject an aborted fetch/body read with the signal's
5
+ * `reason`, but older WebKit rejects with a generic `AbortError` — which would
6
+ * send a transport timeout down a caller's user-cancel path. Node and jsdom
7
+ * test environments can raise the same shape as a plain `Error` rather than a
8
+ * `DOMException`, so both are accepted (gated on the exact abort names).
9
+ *
10
+ * When `error` is abort-shaped the CALLER signal wins a same-tick tie: if the
11
+ * user hits Stop in the same tick a stall/timeout fires, their intent takes
12
+ * precedence, so the turn still routes to the user-cancel path and keeps its
13
+ * "Stopped." marker (first-cancel-wins, matching the pre-refactor behaviour).
14
+ * A pure timeout — caller not aborted — still yields the timeout signal's
15
+ * tagged `TimeoutError`, which is the WebKit fix. Anything not abort-shaped
16
+ * passes through untouched.
17
+ */
18
+ export declare function authoritativeAbortReason(error: unknown, timeoutSignal: AbortSignal, callerSignal?: AbortSignal): unknown;
19
+ //# sourceMappingURL=abort-reason.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-reason.d.ts","sourceRoot":"","sources":["../../../src/utils/abort-reason.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,WAAW,EAC1B,YAAY,CAAC,EAAE,WAAW,GACzB,OAAO,CAQT"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A `setTimeout`-based delay that rejects as soon as `signal` aborts, with the
3
+ * signal's reason — so retry backoffs unwind immediately on a caller cancel or
4
+ * dispose instead of waiting out the full wait. Resolves normally when `ms`
5
+ * elapses first (the abort listener is detached, so a long-lived signal reused
6
+ * across many delays does not accumulate dead listeners).
7
+ */
8
+ export declare function abortableDelay(ms: number, signal?: AbortSignal): Promise<void>;
9
+ //# sourceMappingURL=abortable-delay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abortable-delay.d.ts","sourceRoot":"","sources":["../../../src/utils/abortable-delay.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB9E"}
@@ -47,6 +47,7 @@ export function createAIProvider(config) {
47
47
  const transport = new GeminiTransport({
48
48
  model: config.model,
49
49
  timeout: config.timeout,
50
+ stallTimeout: config.stallTimeout,
50
51
  serverEndpoint: config.serverEndpoint,
51
52
  apiKey: config.apiKey,
52
53
  });
@@ -57,6 +58,7 @@ export function createAIProvider(config) {
57
58
  const transport = new AnthropicTransport({
58
59
  model: config.model,
59
60
  timeout: config.timeout,
61
+ stallTimeout: config.stallTimeout,
60
62
  serverEndpoint: config.serverEndpoint,
61
63
  apiKey: config.apiKey,
62
64
  maxTokens: config.maxTokens,
@@ -1,12 +1,13 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { SUPPORTED_ANTHROPIC_MODEL_IDS, } from '../types';
3
- import { combineSignals } from '../utils/combine-signals';
4
3
  import { logger } from '../utils/logger';
5
4
  import { scaleTemperature } from '../utils/temperature';
5
+ import { postWithRetry } from './post-with-retry';
6
6
  const ANTHROPIC_DIRECT_URL = 'https://api.anthropic.com/v1/messages';
7
7
  const ANTHROPIC_API_VERSION = '2023-06-01';
8
8
  const DEFAULT_MODEL = 'claude-haiku-4-5-20251001';
9
- const DEFAULT_TIMEOUT = 180000; // 3 minutes
9
+ const DEFAULT_TIMEOUT = 300000; // healthy >200s generations observed at 128k max_tokens; wall clock is a last resort
10
+ const DEFAULT_STALL_TIMEOUT = 30000; // inactivity window on the framed proxy path; pings arrive every 5s
10
11
  const DEFAULT_MAX_TOKENS = 4096;
11
12
  /** Anthropic's native default + ceiling temperature — https://docs.claude.com/en/api/messages */
12
13
  const ANTHROPIC_DEFAULT_TEMPERATURE = 1;
@@ -154,7 +155,7 @@ export class ResponseTruncatedError extends Error {
154
155
  */
155
156
  export class AnthropicTransport {
156
157
  constructor(config = {}) {
157
- var _a, _b, _c;
158
+ var _a, _b, _c, _d;
158
159
  /**
159
160
  * Estimated USD cost accumulated across every successful request on this
160
161
  * transport instance. Convenience accessor for non-chat consumers
@@ -181,9 +182,10 @@ export class AnthropicTransport {
181
182
  logger.warn('AnthropicTransport: using claude-opus-4-7 — significantly higher cost; reserve for tasks where Sonnet reliability is insufficient.');
182
183
  }
183
184
  this.timeout = (_b = config.timeout) !== null && _b !== void 0 ? _b : DEFAULT_TIMEOUT;
185
+ this.stallTimeout = (_c = config.stallTimeout) !== null && _c !== void 0 ? _c : DEFAULT_STALL_TIMEOUT;
184
186
  this.apiKey = config.apiKey;
185
187
  this.serverEndpoint = config.serverEndpoint;
186
- this.maxTokens = (_c = config.maxTokens) !== null && _c !== void 0 ? _c : DEFAULT_MAX_TOKENS;
188
+ this.maxTokens = (_d = config.maxTokens) !== null && _d !== void 0 ? _d : DEFAULT_MAX_TOKENS;
187
189
  }
188
190
  getConfig() {
189
191
  return {
@@ -570,7 +572,9 @@ export class AnthropicTransport {
570
572
  if (this.serverEndpoint) {
571
573
  return {
572
574
  url: this.serverEndpoint,
573
- headers: { 'Content-Type': 'application/json' },
575
+ // Opt in to the proxy's NDJSON heartbeat framing. An old proxy ignores
576
+ // this and returns plain JSON — see the Content-Type branch in `post`.
577
+ headers: { 'Content-Type': 'application/json', Accept: 'application/x-ndjson' },
574
578
  credentials: 'include',
575
579
  };
576
580
  }
@@ -580,60 +584,24 @@ export class AnthropicTransport {
580
584
  post(body, signal) {
581
585
  return __awaiter(this, void 0, void 0, function* () {
582
586
  const { url, headers, credentials } = this.buildEndpoint();
583
- // Sequential retries are intentional — each attempt depends on the previous response.
584
- /* oxlint-disable no-await-in-loop */
585
- for (let attempt = 0; attempt <= AnthropicTransport.MAX_RETRIES; attempt += 1) {
586
- const timeoutController = new AbortController();
587
- const timeoutId = setTimeout(() => timeoutController.abort(new DOMException('Anthropic request timed out', 'TimeoutError')), this.timeout);
588
- // Combine so BOTH the local timeout and an optional caller signal can
589
- // abort the fetch. A plain `signal ?? timeoutController.signal` would
590
- // silently disarm the timeout whenever a caller signal was supplied.
591
- // The tagged `TimeoutError` lets callers distinguish a timeout from a
592
- // caller-initiated cancellation by inspecting the abort reason.
593
- const { signal: combinedSignal, dispose } = combineSignals([
594
- signal,
595
- timeoutController.signal,
596
- ]);
597
- let response;
598
- try {
599
- response = yield fetch(url, {
600
- method: 'POST',
601
- headers,
602
- body: JSON.stringify(body),
603
- signal: combinedSignal,
604
- credentials,
605
- });
606
- }
607
- catch (e) {
608
- clearTimeout(timeoutId);
609
- dispose();
610
- throw e;
611
- }
612
- clearTimeout(timeoutId);
613
- dispose();
614
- if (AnthropicTransport.RETRYABLE_STATUSES.includes(response.status) &&
615
- attempt < AnthropicTransport.MAX_RETRIES) {
616
- // Exponential backoff: 1s, 2s, 4s, 8s, 16s
617
- yield new Promise((resolve) => {
618
- setTimeout(resolve, AnthropicTransport.BACKOFF_BASE_MS * (1 << attempt));
619
- });
620
- continue;
621
- }
622
- if (!response.ok) {
623
- const err = yield response.text();
624
- throw new Error(`Anthropic request error ${response.status}: ${err}`);
625
- }
626
- return (yield response.json());
627
- }
628
- /* oxlint-enable no-await-in-loop */
629
- throw new Error('Anthropic request failed: max retries exceeded');
587
+ return (yield postWithRetry({
588
+ url,
589
+ headers,
590
+ body,
591
+ credentials,
592
+ vendorLabel: 'Anthropic',
593
+ retryableStatuses: AnthropicTransport.RETRYABLE_STATUSES,
594
+ timeout: this.timeout,
595
+ stallTimeout: this.stallTimeout,
596
+ backoffBaseMs: AnthropicTransport.BACKOFF_BASE_MS,
597
+ signal,
598
+ }));
630
599
  });
631
600
  }
632
601
  }
633
602
  // ── Private helpers ────────────────────────────────────────────────────
634
603
  AnthropicTransport.TOKENS_PER_MILLION = 1000000;
635
604
  AnthropicTransport.COST_DECIMAL_PLACES = 6;
636
- AnthropicTransport.MAX_RETRIES = 5;
637
605
  AnthropicTransport.RATE_LIMIT_STATUS = 429;
638
606
  AnthropicTransport.SERVICE_UNAVAILABLE_STATUS = 503;
639
607
  AnthropicTransport.OVERLOADED_STATUS = 529;
@@ -642,4 +610,5 @@ AnthropicTransport.RETRYABLE_STATUSES = [
642
610
  AnthropicTransport.SERVICE_UNAVAILABLE_STATUS,
643
611
  AnthropicTransport.OVERLOADED_STATUS,
644
612
  ];
613
+ // Base backoff for the shared retry ladder (1s, 2s, 4s, 8s, 16s).
645
614
  AnthropicTransport.BACKOFF_BASE_MS = 1000;
@@ -1,13 +1,14 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { SUPPORTED_GEMINI_MODEL_IDS, } from '../types';
3
- import { combineSignals } from '../utils/combine-signals';
4
3
  import { logger } from '../utils/logger';
5
4
  import { scaleTemperature } from '../utils/temperature';
6
5
  import { ResponseTruncatedError } from './anthropic-transport';
7
6
  import { repairMalformedFunctionCall } from './gemini-malformed-call';
7
+ import { postWithRetry } from './post-with-retry';
8
8
  const GEMINI_DIRECT_URL = (model) => `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent`;
9
9
  const DEFAULT_MODEL = 'gemini-2.5-flash-lite';
10
- const DEFAULT_TIMEOUT = 180000; // 3 minutes
10
+ const DEFAULT_TIMEOUT = 300000; // healthy >200s generations observed at 128k max_tokens; wall clock is a last resort
11
+ const DEFAULT_STALL_TIMEOUT = 30000; // inactivity window on the framed proxy path; pings arrive every 5s
11
12
  /**
12
13
  * Maximum input context window (tokens) per supported Gemini model.
13
14
  * Source: https://ai.google.dev/gemini-api/docs/models
@@ -142,7 +143,7 @@ export class MalformedFunctionCallError extends Error {
142
143
  */
143
144
  export class GeminiTransport {
144
145
  constructor(config = {}) {
145
- var _a, _b;
146
+ var _a, _b, _c;
146
147
  /**
147
148
  * Estimated USD cost accumulated across every successful request on this
148
149
  * transport instance. Convenience accessor for non-chat consumers
@@ -164,6 +165,7 @@ export class GeminiTransport {
164
165
  logger.warn(warning);
165
166
  }
166
167
  this.timeout = (_b = config.timeout) !== null && _b !== void 0 ? _b : DEFAULT_TIMEOUT;
168
+ this.stallTimeout = (_c = config.stallTimeout) !== null && _c !== void 0 ? _c : DEFAULT_STALL_TIMEOUT;
167
169
  this.apiKey = config.apiKey;
168
170
  this.serverEndpoint = config.serverEndpoint;
169
171
  }
@@ -548,6 +550,7 @@ export class GeminiTransport {
548
550
  return {
549
551
  url: `${GEMINI_DIRECT_URL(this.model)}?key=${this.apiKey}`,
550
552
  payload: this.toDirectPayload(body),
553
+ headers: { 'Content-Type': 'application/json' },
551
554
  credentials: 'omit',
552
555
  };
553
556
  }
@@ -555,6 +558,9 @@ export class GeminiTransport {
555
558
  return {
556
559
  url: this.serverEndpoint,
557
560
  payload: body,
561
+ // Opt in to the proxy's NDJSON heartbeat framing. An old proxy ignores
562
+ // this and returns plain JSON — see the Content-Type branch in `post`.
563
+ headers: { 'Content-Type': 'application/json', Accept: 'application/x-ndjson' },
558
564
  credentials: 'include',
559
565
  };
560
566
  }
@@ -563,64 +569,19 @@ export class GeminiTransport {
563
569
  }
564
570
  post(body, signal) {
565
571
  return __awaiter(this, void 0, void 0, function* () {
566
- const { url, payload, credentials } = this.buildEndpoint(body);
567
- // Sequential retries are intentional — each attempt depends on the previous response.
568
- /* oxlint-disable no-await-in-loop -- intentional sequential retries with backoff */
569
- for (let attempt = 0; attempt <= GeminiTransport.MAX_RETRIES; attempt += 1) {
570
- const timeoutController = new AbortController();
571
- const timeoutId = setTimeout(() => timeoutController.abort(new DOMException('Gemini request timed out', 'TimeoutError')), this.timeout);
572
- // Combine so BOTH the local timeout and an optional caller signal can
573
- // abort the fetch. A plain `signal ?? timeoutController.signal` would
574
- // silently disarm the timeout whenever a caller signal was supplied.
575
- // The tagged `TimeoutError` lets callers distinguish a timeout from a
576
- // caller-initiated cancellation by inspecting the abort reason.
577
- const { signal: combinedSignal, dispose } = combineSignals([
578
- signal,
579
- timeoutController.signal,
580
- ]);
581
- let response;
582
- try {
583
- response = yield fetch(url, {
584
- method: 'POST',
585
- headers: { 'Content-Type': 'application/json' },
586
- body: JSON.stringify(payload),
587
- signal: combinedSignal,
588
- credentials,
589
- });
590
- }
591
- catch (e) {
592
- clearTimeout(timeoutId);
593
- dispose();
594
- throw e;
595
- }
596
- clearTimeout(timeoutId);
597
- dispose();
598
- if (GeminiTransport.RETRYABLE_STATUSES.includes(response.status) &&
599
- attempt < GeminiTransport.MAX_RETRIES) {
600
- // Exponential backoff: 1s, 2s, 4s, 8s, 16s — abortable, so a caller cancel
601
- // mid-wait rejects promptly instead of being ignored until the next fetch.
602
- yield new Promise((resolve, reject) => {
603
- const timer = setTimeout(resolve, GeminiTransport.BACKOFF_BASE_MS * (1 << attempt));
604
- const onAbort = () => {
605
- var _a;
606
- clearTimeout(timer);
607
- reject((_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : new DOMException('The operation was aborted.', 'AbortError'));
608
- };
609
- if (signal === null || signal === void 0 ? void 0 : signal.aborted)
610
- onAbort();
611
- else
612
- signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
613
- });
614
- continue;
615
- }
616
- if (!response.ok) {
617
- const err = yield response.text();
618
- throw new Error(`Gemini request error ${response.status}: ${err}`);
619
- }
620
- return (yield response.json());
621
- }
622
- /* oxlint-enable no-await-in-loop */
623
- throw new Error('Gemini request failed: max retries exceeded');
572
+ const { url, payload, headers, credentials } = this.buildEndpoint(body);
573
+ return (yield postWithRetry({
574
+ url,
575
+ headers,
576
+ body: payload,
577
+ credentials,
578
+ vendorLabel: 'Gemini',
579
+ retryableStatuses: GeminiTransport.RETRYABLE_STATUSES,
580
+ timeout: this.timeout,
581
+ stallTimeout: this.stallTimeout,
582
+ backoffBaseMs: GeminiTransport.BACKOFF_BASE_MS,
583
+ signal,
584
+ }));
624
585
  });
625
586
  }
626
587
  toDirectPayload(body) {
@@ -636,7 +597,6 @@ export class GeminiTransport {
636
597
  // ── Private helpers ────────────────────────────────────────────────────
637
598
  GeminiTransport.TOKENS_PER_MILLION = 1000000;
638
599
  GeminiTransport.COST_DECIMAL_PLACES = 6;
639
- GeminiTransport.MAX_RETRIES = 5;
640
600
  GeminiTransport.RATE_LIMIT_STATUS = 429;
641
601
  GeminiTransport.SERVICE_UNAVAILABLE_STATUS = 503;
642
602
  /**
@@ -656,4 +616,5 @@ GeminiTransport.RETRYABLE_STATUSES = [
656
616
  GeminiTransport.SERVICE_UNAVAILABLE_STATUS,
657
617
  GeminiTransport.BAD_GATEWAY_STATUS,
658
618
  ];
619
+ // Base backoff for the shared retry ladder (1s, 2s, 4s, 8s, 16s).
659
620
  GeminiTransport.BACKOFF_BASE_MS = 1000;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Shared reader for the ai-service proxy's NDJSON heartbeat protocol (v1),
3
+ * used by the server-proxied transports (Anthropic, Gemini). The proxy streams
4
+ * `ping` frames while the upstream call runs and ends the body with exactly one
5
+ * terminal `ok`/`err` frame, one JSON object per LF-terminated line.
6
+ */
7
+ import { __awaiter } from "tslib";
8
+ /** Cap on how much of a malformed proxy frame is quoted in the error message. */
9
+ const MALFORMED_FRAME_PREVIEW_CHARS = 120;
10
+ /**
11
+ * Read an NDJSON heartbeat body to its terminal frame. Buffers partial lines
12
+ * across chunks, tolerates blank lines, and skips unknown frame types — pings
13
+ * matter only as activity, which `onChunk` reports to the caller's stall
14
+ * timer. An abort (stall timer or caller signal) rejects the pending `read()`
15
+ * with the abort reason, which propagates to the caller's finally cleanup.
16
+ * `vendorLabel` (e.g. `'Anthropic'`) prefixes the protocol-violation messages.
17
+ *
18
+ * `stallTimeout` (ms) arms a client-side backstop: the proxy's own pings re-arm
19
+ * the caller's inactivity timer, so a proxy whose upstream has wedged but which
20
+ * keeps pinging would never trip it. Each ping stamps `sinceLastEventMs` (time
21
+ * since the last upstream event); when that exceeds `stallTimeout` we treat it
22
+ * as a stall and throw the tagged `TimeoutError`, independent of the proxy
23
+ * noticing its own stall. `<= 0` disables the backstop (inactivity detection off).
24
+ */
25
+ export function readFramedBody(stream, onChunk, vendorLabel, stallTimeout) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const reader = stream.getReader();
28
+ const decoder = new TextDecoder();
29
+ let buffer = '';
30
+ const malformedFrame = (line) => new Error(`${vendorLabel} proxy sent a malformed frame: ${line.slice(0, MALFORMED_FRAME_PREVIEW_CHARS)}`);
31
+ const parseLine = (line) => {
32
+ if (!line)
33
+ return undefined;
34
+ let parsed;
35
+ try {
36
+ parsed = JSON.parse(line);
37
+ }
38
+ catch (_a) {
39
+ throw malformedFrame(line);
40
+ }
41
+ // JSON.parse also accepts null/scalars/arrays — a frame must be an object
42
+ // (dereferencing `.t` on null would otherwise throw a raw TypeError).
43
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
44
+ throw malformedFrame(line);
45
+ }
46
+ const frame = parsed;
47
+ if (frame.t === 'ok') {
48
+ if (frame.body == null) {
49
+ throw new Error(`${vendorLabel} proxy sent an ok frame without a body`);
50
+ }
51
+ return frame;
52
+ }
53
+ if (frame.t === 'err') {
54
+ // The cast below promises a numeric status; hold the proxy to it rather
55
+ // than letting `undefined` leak into the retry/status checks downstream.
56
+ if (typeof frame.status !== 'number') {
57
+ throw new Error(`${vendorLabel} proxy sent an err frame without a numeric status`);
58
+ }
59
+ return frame;
60
+ }
61
+ if (frame.t === 'ping') {
62
+ // Client-side stall backstop: the proxy stamps how long its upstream has
63
+ // been silent. Its pings keep the caller's inactivity timer alive, so
64
+ // this is the only signal that catches a wedged upstream behind a proxy
65
+ // that is itself still healthy. Surface the same tagged TimeoutError a
66
+ // local inactivity fire would.
67
+ if (stallTimeout > 0 &&
68
+ typeof frame.sinceLastEventMs === 'number' &&
69
+ frame.sinceLastEventMs > stallTimeout) {
70
+ throw new DOMException(`${vendorLabel} request stalled: proxy reported ${frame.sinceLastEventMs}ms since the last upstream event (exceeds ${stallTimeout}ms)`, 'TimeoutError');
71
+ }
72
+ return undefined;
73
+ }
74
+ return undefined; // unknown frame types (forward compat)
75
+ };
76
+ try {
77
+ for (;;) {
78
+ // oxlint-disable-next-line no-await-in-loop -- sequential stream reads
79
+ const { done, value } = yield reader.read();
80
+ if (done)
81
+ break;
82
+ onChunk();
83
+ buffer += decoder.decode(value, { stream: true });
84
+ let newline = buffer.indexOf('\n');
85
+ while (newline !== -1) {
86
+ const line = buffer.slice(0, newline).trim();
87
+ buffer = buffer.slice(newline + 1);
88
+ const frame = parseLine(line);
89
+ if (frame)
90
+ return frame;
91
+ newline = buffer.indexOf('\n');
92
+ }
93
+ }
94
+ // Tolerate a final terminal frame missing its LF.
95
+ const frame = parseLine((buffer + decoder.decode()).trim());
96
+ if (frame)
97
+ return frame;
98
+ throw new Error(`${vendorLabel} proxy stream ended without a terminal frame`);
99
+ }
100
+ finally {
101
+ // Stop the stream on early return, error, or abort; cancel rejects on an
102
+ // already-errored stream, which is fine to ignore.
103
+ void reader.cancel().catch(() => { });
104
+ }
105
+ });
106
+ }
@@ -0,0 +1,112 @@
1
+ import { __awaiter } from "tslib";
2
+ import { authoritativeAbortReason } from '../utils/abort-reason';
3
+ import { abortableDelay } from '../utils/abortable-delay';
4
+ import { combineSignals } from '../utils/combine-signals';
5
+ import { logger } from '../utils/logger';
6
+ import { readFramedBody } from './ndjson-frames';
7
+ const MAX_RETRIES = 5;
8
+ /**
9
+ * POST with the shared retry ladder, wall-clock timeout, framed-mode stall
10
+ * detection and abort-reason preservation. Returns the terminal `ok` frame body
11
+ * (framed proxy) or the parsed JSON (legacy proxy / direct API) as `unknown` —
12
+ * the caller casts. Throws a tagged `TimeoutError` on a stall (local inactivity,
13
+ * the proxy's `sinceLastEventMs` backstop, or an `UPSTREAM_STALLED` frame), the
14
+ * caller's reason on a caller abort, or a plain `Error` otherwise.
15
+ */
16
+ export function postWithRetry(options) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ var _a, _b, _c, _d;
19
+ const { url, headers, body, credentials, vendorLabel, retryableStatuses, timeout, stallTimeout, backoffBaseMs, signal, } = options;
20
+ // Exponential backoff between retries: base, 2×, 4×, 8×, 16×. Abortable on the
21
+ // CALLER signal only — the timeout is cleared before each backoff, so a caller
22
+ // cancel mid-wait unwinds immediately while a timeout does not.
23
+ const backoff = (attempt) => abortableDelay(backoffBaseMs * (1 << attempt), signal);
24
+ // Sequential retries are intentional — each attempt depends on the previous response.
25
+ /* oxlint-disable no-await-in-loop -- intentional sequential retries with backoff */
26
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt += 1) {
27
+ const timeoutController = new AbortController();
28
+ // Wall clock for connect/headers (and the whole body on the legacy JSON
29
+ // path). The framed path swaps it for the inactivity timer below once the
30
+ // heartbeat body starts streaming.
31
+ let timeoutId = setTimeout(() => timeoutController.abort(new DOMException(`${vendorLabel} request timed out`, 'TimeoutError')), timeout);
32
+ // Re-armed on every received chunk. With proxy pings every 5s it only fires
33
+ // when the proxy/network actually dies — a framed body that keeps streaming
34
+ // has no wall cap (max_tokens bounds generation; the proxy watches upstream).
35
+ // A non-positive stallTimeout disables inactivity detection: leave the wall
36
+ // clock armed as the only cap (and the sinceLastEventMs backstop stays off).
37
+ const rearmStallTimer = () => {
38
+ if (stallTimeout <= 0)
39
+ return;
40
+ clearTimeout(timeoutId);
41
+ timeoutId = setTimeout(() => timeoutController.abort(new DOMException(`${vendorLabel} request stalled (no data for ${stallTimeout}ms)`, 'TimeoutError')), stallTimeout);
42
+ };
43
+ // Combine so BOTH the local timeout and an optional caller signal can abort
44
+ // the fetch. A plain `signal ?? timeoutController.signal` would silently
45
+ // disarm the timeout whenever a caller signal was supplied. The tagged
46
+ // `TimeoutError` lets callers distinguish a timeout from a caller-initiated
47
+ // cancellation by inspecting the abort reason.
48
+ const { signal: combinedSignal, dispose } = combineSignals([signal, timeoutController.signal]);
49
+ // The finally guards the WHOLE attempt — body reads included. Disarming on
50
+ // headers alone left `response.json()` with no deadline and no caller abort.
51
+ try {
52
+ const response = yield fetch(url, {
53
+ method: 'POST',
54
+ headers,
55
+ body: JSON.stringify(body),
56
+ signal: combinedSignal,
57
+ credentials,
58
+ });
59
+ if (retryableStatuses.includes(response.status) && attempt < MAX_RETRIES) {
60
+ logger.warn(`${vendorLabel}Transport: retryable status ${response.status}, retrying (attempt ${attempt + 1}/${MAX_RETRIES})`);
61
+ clearTimeout(timeoutId); // this attempt is over — don't let its timer tick through the backoff
62
+ yield backoff(attempt);
63
+ continue;
64
+ }
65
+ if (!response.ok) {
66
+ const err = yield response.text();
67
+ throw new Error(`${vendorLabel} request error ${response.status}: ${err}`);
68
+ }
69
+ // The proxy streams NDJSON heartbeat frames when it supports them; an old
70
+ // proxy ignores our Accept header and returns plain JSON, so branch on
71
+ // what actually came back.
72
+ if (((_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get('content-type')) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('application/x-ndjson')) &&
73
+ response.body) {
74
+ rearmStallTimer();
75
+ const frame = yield readFramedBody(response.body, rearmStallTimer, vendorLabel, stallTimeout);
76
+ if (frame.t === 'ok')
77
+ return frame.body;
78
+ // Classify a stall by `code` BEFORE the retryable-status ladder: a stall
79
+ // paired with a retryable status must surface as the non-retried
80
+ // TimeoutError, not get retried 5× as that status.
81
+ if (frame.code === 'UPSTREAM_STALLED') {
82
+ // The proxy watchdog saw no upstream data — same tagged shape as a
83
+ // local stall, so the driver's TimeoutError branch handles both.
84
+ throw new DOMException(`${vendorLabel} request stalled: ${(_c = frame.error) !== null && _c !== void 0 ? _c : 'no upstream data'}`, 'TimeoutError');
85
+ }
86
+ // An in-band retryable status joins the same attempt/backoff ladder as
87
+ // its HTTP-status equivalent (shared attempt counter).
88
+ if (retryableStatuses.includes(frame.status) && attempt < MAX_RETRIES) {
89
+ logger.warn(`${vendorLabel}Transport: retryable status ${frame.status} (err frame), retrying (attempt ${attempt + 1}/${MAX_RETRIES})`);
90
+ clearTimeout(timeoutId); // disarm the stall timer — the stream is done, only the backoff remains
91
+ yield backoff(attempt);
92
+ continue;
93
+ }
94
+ throw new Error(`${vendorLabel} request error ${frame.status}: ${(_d = frame.error) !== null && _d !== void 0 ? _d : JSON.stringify(frame.details)}`);
95
+ }
96
+ return (yield response.json());
97
+ }
98
+ catch (e) {
99
+ // Some engines reject an aborted read with a generic AbortError instead of
100
+ // the signal's reason — rethrow the authoritative one so a timeout stays a
101
+ // tagged TimeoutError rather than looking like a user cancel.
102
+ throw authoritativeAbortReason(e, timeoutController.signal, signal);
103
+ }
104
+ finally {
105
+ clearTimeout(timeoutId);
106
+ dispose();
107
+ }
108
+ }
109
+ /* oxlint-enable no-await-in-loop */
110
+ throw new Error(`${vendorLabel} request failed: max retries exceeded`);
111
+ });
112
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Resolve the authoritative reason behind an abort-shaped rejection.
3
+ *
4
+ * Chromium/Firefox reject an aborted fetch/body read with the signal's
5
+ * `reason`, but older WebKit rejects with a generic `AbortError` — which would
6
+ * send a transport timeout down a caller's user-cancel path. Node and jsdom
7
+ * test environments can raise the same shape as a plain `Error` rather than a
8
+ * `DOMException`, so both are accepted (gated on the exact abort names).
9
+ *
10
+ * When `error` is abort-shaped the CALLER signal wins a same-tick tie: if the
11
+ * user hits Stop in the same tick a stall/timeout fires, their intent takes
12
+ * precedence, so the turn still routes to the user-cancel path and keeps its
13
+ * "Stopped." marker (first-cancel-wins, matching the pre-refactor behaviour).
14
+ * A pure timeout — caller not aborted — still yields the timeout signal's
15
+ * tagged `TimeoutError`, which is the WebKit fix. Anything not abort-shaped
16
+ * passes through untouched.
17
+ */
18
+ export function authoritativeAbortReason(error, timeoutSignal, callerSignal) {
19
+ const abortShaped = (error instanceof DOMException || error instanceof Error) &&
20
+ (error.name === 'AbortError' || error.name === 'TimeoutError');
21
+ if (!abortShaped)
22
+ return error;
23
+ if (callerSignal === null || callerSignal === void 0 ? void 0 : callerSignal.aborted)
24
+ return callerSignal.reason;
25
+ if (timeoutSignal.aborted)
26
+ return timeoutSignal.reason;
27
+ return error;
28
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A `setTimeout`-based delay that rejects as soon as `signal` aborts, with the
3
+ * signal's reason — so retry backoffs unwind immediately on a caller cancel or
4
+ * dispose instead of waiting out the full wait. Resolves normally when `ms`
5
+ * elapses first (the abort listener is detached, so a long-lived signal reused
6
+ * across many delays does not accumulate dead listeners).
7
+ */
8
+ export function abortableDelay(ms, signal) {
9
+ return new Promise((resolve, reject) => {
10
+ const abortReason = () => { var _a; return (_a = signal === null || signal === void 0 ? void 0 : signal.reason) !== null && _a !== void 0 ? _a : new DOMException('The operation was aborted.', 'AbortError'); };
11
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
12
+ reject(abortReason());
13
+ return;
14
+ }
15
+ const onAbort = () => {
16
+ clearTimeout(timer);
17
+ reject(abortReason());
18
+ };
19
+ const timer = setTimeout(() => {
20
+ signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort);
21
+ resolve();
22
+ }, ms);
23
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
24
+ });
25
+ }
@@ -9171,7 +9171,7 @@
9171
9171
  {
9172
9172
  "kind": "TypeAlias",
9173
9173
  "canonicalReference": "@genesislcap/foundation-ai!SubAgentFailureReason:type",
9174
- "docComment": "/**\n * Why a sub-agent run ended without producing a structured result via `completeSubAgent`. Surfaced on the `{ ok: false }` branch of `requestSubAgent` so the parent tool handler can decide how to recover.\n *\n * - `max_iterations` — the sub-agent's tool loop ended without calling its completion tool (hit the iteration cap, or — defensively — a provider ignored forced tool use and returned a free-text turn). - `malformed_tool_call` — the provider repeatedly returned an unparseable tool call (e.g. Gemini `MALFORMED_FUNCTION_CALL`) after retries. - `empty_response` — the model repeatedly returned an empty response after retries. - `unknown_tool_limit` — the model repeatedly called tools that aren't available to it. - `timeout` — the sub-agent did not finish within {@link SubAgentRequestOptions.timeoutMs}; its run was aborted. - `response_truncated` — a turn stopped at the provider's output-token cap with an incomplete tool call; deterministic, so it is not retried.\n *\n * @beta\n */\n",
9174
+ "docComment": "/**\n * Why a sub-agent run ended without producing a structured result via `completeSubAgent`. Surfaced on the `{ ok: false }` branch of `requestSubAgent` so the parent tool handler can decide how to recover.\n *\n * - `max_iterations` — the sub-agent's tool loop ended without calling its completion tool (hit the iteration cap, or — defensively — a provider ignored forced tool use and returned a free-text turn). - `malformed_tool_call` — the provider repeatedly returned an unparseable tool call (e.g. Gemini `MALFORMED_FUNCTION_CALL`) after retries. - `empty_response` — the model repeatedly returned an empty response after retries. - `unknown_tool_limit` — the model repeatedly called tools that aren't available to it. - `timeout` — the sub-agent did not finish within {@link SubAgentRequestOptions.timeoutMs} (its run was aborted), or a transport request timed out inside the child's own run. - `response_truncated` — a turn stopped at the provider's output-token cap with an incomplete tool call; deterministic, so it is not retried.\n *\n * @beta\n */\n",
9175
9175
  "excerptTokens": [
9176
9176
  {
9177
9177
  "kind": "Content",
@@ -82,6 +82,13 @@ export declare interface AIProvider {
82
82
  declare interface AIProviderConfig {
83
83
  model?: string;
84
84
  timeout?: number;
85
+ /**
86
+ * Inactivity window (ms) between streamed frames before a request is treated
87
+ * as stalled. Only meaningful for server-proxied transports with heartbeat
88
+ * framing (the Anthropic and Gemini NDJSON proxy paths); direct API calls
89
+ * ignore it.
90
+ */
91
+ stallTimeout?: number;
85
92
  /** Optional override for criteria interpretation capability. */
86
93
  criteriaInstructions?: string;
87
94
  }
@@ -256,6 +263,7 @@ declare interface AnthropicProviderConfig {
256
263
  export declare class AnthropicTransport implements AITransport, ChatTransport, CostReportingTransport {
257
264
  private readonly model;
258
265
  private readonly timeout;
266
+ private readonly stallTimeout;
259
267
  private readonly apiKey;
260
268
  private readonly serverEndpoint;
261
269
  private readonly maxTokens;
@@ -329,7 +337,6 @@ export declare class AnthropicTransport implements AITransport, ChatTransport, C
329
337
  private toAnthropicMessages;
330
338
  private fromAnthropicResponse;
331
339
  private buildEndpoint;
332
- private static readonly MAX_RETRIES;
333
340
  private static readonly RATE_LIMIT_STATUS;
334
341
  private static readonly SERVICE_UNAVAILABLE_STATUS;
335
342
  private static readonly OVERLOADED_STATUS;
@@ -345,6 +352,12 @@ declare interface AnthropicTransportConfig {
345
352
  */
346
353
  model?: AnthropicModelId;
347
354
  timeout?: number;
355
+ /**
356
+ * Inactivity window (ms) on the server-proxied heartbeat path: once the framed
357
+ * body starts streaming, the request aborts when no frame/chunk arrives for this
358
+ * long. Ignored on direct API calls and legacy JSON responses. Defaults to 30_000.
359
+ */
360
+ stallTimeout?: number;
348
361
  /**
349
362
  * API key for direct calls to the Anthropic API.
350
363
  * Must be provided explicitly; callers are responsible for reading it from
@@ -1464,6 +1477,7 @@ declare interface GeminiProviderConfig {
1464
1477
  export declare class GeminiTransport implements AITransport, ChatTransport, CostReportingTransport {
1465
1478
  private readonly model;
1466
1479
  private readonly timeout;
1480
+ private readonly stallTimeout;
1467
1481
  private readonly apiKey;
1468
1482
  private readonly serverEndpoint;
1469
1483
  /**
@@ -1529,7 +1543,6 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
1529
1543
  */
1530
1544
  private logAbnormalResponse;
1531
1545
  private buildEndpoint;
1532
- private static readonly MAX_RETRIES;
1533
1546
  private static readonly RATE_LIMIT_STATUS;
1534
1547
  private static readonly SERVICE_UNAVAILABLE_STATUS;
1535
1548
  /**
@@ -1556,6 +1569,12 @@ declare interface GeminiTransportConfig {
1556
1569
  */
1557
1570
  model?: GeminiModelId;
1558
1571
  timeout?: number;
1572
+ /**
1573
+ * Inactivity window (ms) on the server-proxied heartbeat path: once the framed
1574
+ * body starts streaming, the request aborts when no frame/chunk arrives for this
1575
+ * long. Ignored on direct API calls and legacy JSON responses. Defaults to 30_000.
1576
+ */
1577
+ stallTimeout?: number;
1559
1578
  /**
1560
1579
  * API key for direct calls to the Gemini API.
1561
1580
  * Must be provided explicitly; callers are responsible for reading it from
@@ -1996,7 +2015,8 @@ declare interface StructuredPromptOptions {
1996
2015
  * - `unknown_tool_limit` — the model repeatedly called tools that aren't
1997
2016
  * available to it.
1998
2017
  * - `timeout` — the sub-agent did not finish within
1999
- * {@link SubAgentRequestOptions.timeoutMs}; its run was aborted.
2018
+ * {@link SubAgentRequestOptions.timeoutMs} (its run was aborted), or a
2019
+ * transport request timed out inside the child's own run.
2000
2020
  * - `response_truncated` — a turn stopped at the provider's output-token cap with
2001
2021
  * an incomplete tool call; deterministic, so it is not retried.
2002
2022
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ai",
3
3
  "description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
4
- "version": "14.489.1-alpha-0babe6c0f.0",
4
+ "version": "14.490.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -52,17 +52,17 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@genesislcap/foundation-testing": "14.489.1-alpha-0babe6c0f.0",
56
- "@genesislcap/genx": "14.489.1-alpha-0babe6c0f.0",
57
- "@genesislcap/rollup-builder": "14.489.1-alpha-0babe6c0f.0",
58
- "@genesislcap/ts-builder": "14.489.1-alpha-0babe6c0f.0",
59
- "@genesislcap/uvu-playwright-builder": "14.489.1-alpha-0babe6c0f.0",
60
- "@genesislcap/vite-builder": "14.489.1-alpha-0babe6c0f.0",
61
- "@genesislcap/webpack-builder": "14.489.1-alpha-0babe6c0f.0"
55
+ "@genesislcap/foundation-testing": "14.490.0",
56
+ "@genesislcap/genx": "14.490.0",
57
+ "@genesislcap/rollup-builder": "14.490.0",
58
+ "@genesislcap/ts-builder": "14.490.0",
59
+ "@genesislcap/uvu-playwright-builder": "14.490.0",
60
+ "@genesislcap/vite-builder": "14.490.0",
61
+ "@genesislcap/webpack-builder": "14.490.0"
62
62
  },
63
63
  "dependencies": {
64
- "@genesislcap/foundation-logger": "14.489.1-alpha-0babe6c0f.0",
65
- "@genesislcap/foundation-utils": "14.489.1-alpha-0babe6c0f.0",
64
+ "@genesislcap/foundation-logger": "14.490.0",
65
+ "@genesislcap/foundation-utils": "14.490.0",
66
66
  "@microsoft/fast-foundation": "2.50.0"
67
67
  },
68
68
  "repository": {
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "ac776b63e71183eeccae92de893cb77797e751c1"
76
+ "gitHead": "2c5e250d11742abd582e39a370b003ef8d04a5fb"
77
77
  }