@namzu/openrouter 2.3.0 → 2.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,164 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 15f8ee4: Bound provider stream silence, including query-owned advisory calls and
8
+ RouterAgent routing decisions, compaction verifiers and model-graded eval
9
+ judges, to five minutes by default and abort the stalled provider transport,
10
+ with network-classified retry and fallback recovery where those policies
11
+ apply. This changes the previous default, under which a provider iterator could
12
+ remain silent forever. Set `streamIdleTimeoutMs: 0` on the run, agent, manual
13
+ compaction, verifier, or judge config to keep the old unbounded behavior, or set
14
+ a positive millisecond value to choose a different bound.
15
+
16
+ Queries whose caller signal is already aborted now settle as cancelled before
17
+ starting provider, provider-metadata, or tool work. A later cancellation also
18
+ settles while an optional context-window resolver remains pending, even when
19
+ that resolver ignores its signal. With no caller cancellation, `timeoutMs`
20
+ bounds the optional metadata lookup, aborts its private transport signal, and
21
+ falls back to the static context-window table instead of blocking the run.
22
+
23
+ The OpenRouter context-window lookup now forwards cancellation to its model-list
24
+ transport. Only fulfilled listings are cached, so cancelling one concurrent
25
+ query cannot abort another query's shared metadata request or force that query
26
+ onto the static context-window table.
27
+
28
+ `runExperiment({ timeoutMs })` now applies one validated wall-clock deadline to
29
+ both case execution and scoring. Scorers receive its optional cancellation
30
+ signal; a non-cooperative scorer is detached, and `judgeScorer` forwards the
31
+ signal to its bounded provider transport. Values outside the positive platform
32
+ timer range are refused before a case starts; omit the field for the prior
33
+ unbounded case behavior.
34
+
35
+ Compaction verification inside a query now carries the run cancellation cause
36
+ to its provider transport without placing a second idle timer around retry and
37
+ fallback. Public `buildVerifiedSummary`, `compactNow`, and `compactRegion`
38
+ calls bound raw provider silence themselves and accept optional `signal` and
39
+ `streamIdleTimeoutMs`; malformed values and pre-cancelled manual work are
40
+ refused before provider work or a no-op result.
41
+
42
+ HTTP embedding batches now have a 30-second whole-request default, including
43
+ response-body reads, where the previous default could wait forever. Set
44
+ `requestTimeoutMs: 0` on `HttpEmbeddingProvider` to keep the former unbounded
45
+ behavior. Invalid timeout values and non-positive or fractional `batchSize`
46
+ or `dimensions` values are refused at construction instead of silently
47
+ disabling the bound or entering a non-progressing batch loop. Successful HTTP
48
+ responses must contain exactly one unique, in-range result per input and finite
49
+ vectors of the configured dimension; malformed or incomplete batches are
50
+ refused atomically instead of reaching ingestion with missing embeddings.
51
+
52
+ Public RAG operations accept optional cancellation context. The shipped
53
+ `knowledge_search` tool forwards its run-owned signal through
54
+ `KnowledgeBase`, retrieval or ingestion, and the embedding provider. The HTTP
55
+ provider preserves the caller's exact cancellation reason while aborting only
56
+ its private fetch transport. Custom embedding providers receive the signal as
57
+ a cooperative request; callers still own their wait boundary if a custom
58
+ implementation ignores it. Default retrieval and ingestion recheck authority
59
+ after that custom call settles, so a late result cannot start a vector search
60
+ or persist chunks after cancellation. `VectorStore.search` and `upsert` now
61
+ receive the same optional operation context. The default pipelines also race
62
+ those store promises against cancellation, so a non-cooperative custom store
63
+ cannot leave the public query or ingestion call pending forever.
64
+
65
+ A2A agent-card discovery now has a 30-second whole fetch-and-body default and
66
+ accepts an optional caller signal and `timeoutMs`; set `timeoutMs: 0` to retain
67
+ the former unbounded behavior. `A2ADelegate.timeoutMs` now starts before
68
+ `message/send` and bounds the whole delegation instead of polling only. A
69
+ pre-cancelled dispatch starts no remote work, pending fetch and body promises
70
+ cannot hold `waitForTask`, and caller cancellation preserves its exact cause on
71
+ the private transport. Poll and delegation timers are validated at
72
+ construction. Once a safe task id exists, cancellation or timeout sends one
73
+ independently bounded `tasks/cancel`; during initial task creation the client
74
+ keeps a short cleanup grace and explicitly reports an unknown remote outcome if
75
+ the peer never returns an addressable id. Poll replies are bound to that initial
76
+ id, and transport or protocol failures after it is known make the same bounded
77
+ cleanup attempt before the original failure is returned. An `input-required`
78
+ task is also bounded-cancelled before the delegate reports that it cannot
79
+ supply the requested input.
80
+
81
+ Connector execution now carries optional operation authority through the
82
+ manager, every connector-tool adapter, real query runs, tenant/environment
83
+ facades, health checks, and `MCPConnectorBridge.callTool`. Custom connectors
84
+ receive the signal; if they ignore it, the manager settles with an honest
85
+ unknown remote outcome and rejects a late success that does not identify a
86
+ received response. A tenant call cancelled before admission no longer spends a
87
+ rate-limit slot.
88
+
89
+ `HttpConnector` and `WebhookConnector` now apply one validated 30-second
90
+ fetch-and-body deadline and a streaming 2 MiB response limit by default. Set
91
+ positive `timeoutMs` and `maxResponseBytes` values to choose different bounds.
92
+ Cancellation, deadline, or response-size failure aborts only the private
93
+ transport/body reader and preserves the caller's exact cause. Result metadata
94
+ distinguishes `not_started`, `unknown`, and `response_received`, includes retry
95
+ safety, and keeps a received status visible when its body is unavailable.
96
+
97
+ Dynamic HTTP paths and webhook URL overrides must remain on the configured
98
+ origin. Model-authored routing headers are refused, redirects are not followed,
99
+ and 3xx responses are no longer reported as success. Configure a separate
100
+ connector instance for each authorized origin; callers that previously used a
101
+ cross-origin webhook override must migrate to that instance.
102
+
103
+ `GuardedFetchProvider` now applies one validated 30-second deadline across DNS
104
+ resolution, every manually admitted redirect fetch, and the final response
105
+ body, while preserving a caller's exact cancellation cause on a private
106
+ transport signal. Its 2 MiB default response cap is enforced from streamed
107
+ bytes rather than after `response.text()` allocates the whole body; overflow
108
+ cancels the reader and returns a valid UTF-8 prefix. Redirect bodies are
109
+ cancelled when abandoned, and a spent redirect budget causes no DNS lookup for
110
+ the next target. Set positive `timeoutMs` and `maxBytes` values or a
111
+ non-negative integer `maxRedirects` to choose other bounds. Custom
112
+ `GuardedFetchConfig.resolve` functions may now accept the operation signal as
113
+ a second argument. IPv4-mapped IPv6 literals are canonicalized back to their
114
+ IPv4 address before range checks, closing the hexadecimal mapped loopback and
115
+ link-local bypass; the full IPv6 link-local and multicast ranges are also
116
+ refused.
117
+
118
+ MCP request methods now accept optional cancellation authority, and generated
119
+ MCP tool and prompt adapters forward the run-owned tool signal. A pre-aborted
120
+ request starts no transport work; a pending request preserves the caller's
121
+ exact cause, aborts a private transport, removes its correlated pending id, and
122
+ makes a one-second best-effort `notifications/cancelled` attempt. The
123
+ notification does not prove that an already-started remote side effect stopped.
124
+ Paged list calls recheck the same signal before each page.
125
+
126
+ `MCPClient.requestTimeoutMs` and HTTP MCP transport `timeoutMs` values must now
127
+ be positive platform-range integers. A shorter transport deadline remains a
128
+ request-timeout terminal and emits the same correlated cancellation. HTTP
129
+ fetches and response-body reads share operation authority; disconnect owns
130
+ active requests and cancellation cleanup. Reconnects fence late POST responses
131
+ and SSE batches from prior generations, clear Streamable session state, and
132
+ accept session ids only from successful `initialize` responses. Per-send
133
+ failure no longer marks a Streamable client connection-wide errored or rejects
134
+ unrelated concurrent calls. `MCPTransport.send` now accepts optional
135
+ `MCPTransportSendOptions`; custom transports should refuse pre-aborted work and
136
+ stop their per-send I/O when its signal fires.
137
+
138
+ Provider model listings and credential probes now accept optional cancellation
139
+ signals. Retry, fallback, stream-idle and instrumentation decorators preserve
140
+ that authority, and every bundled CLI driver forwards it to the underlying
141
+ transport where supported or refuses a result that arrived after cancellation.
142
+ Existing zero-argument provider implementations remain valid.
143
+
144
+ The interactive provider picker now cancels model discovery, credential checks
145
+ and subscription sign-in when the operator backs out, supersedes the work, or
146
+ leaves the screen. Late results cannot reopen an old model step, accept a
147
+ credential, re-probe the application, or persist a subscription credential
148
+ after cancellation. Model listing and credential probing both settle after a
149
+ three-second bound even when a custom provider ignores its signal.
150
+
151
+ Between-turn and durable-resume subscription refreshes now settle on caller
152
+ cancellation and apply one 30-second bound across the token request and response
153
+ body. Refreshes in one session are serialized and re-read their source at the
154
+ head of the queue, preventing a later stale caller from downgrading a token
155
+ published by an earlier one. Namzu's credential file uses an exact conditional
156
+ replacement under a cross-process, atomically published lock; an external
157
+ rotation or logout wins, and an uncertain publication refuses instead of using
158
+ an uncommitted refresh. Borrowed macOS Keychain credentials are read-only: a
159
+ changed or removed entry wins, and a successful refresh of an unchanged entry
160
+ remains session-local.
161
+
3
162
  ## 2.3.0
4
163
 
5
164
  ### Minor Changes
package/dist/client.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare class OpenRouterProvider implements LLMProvider {
32
32
  * requires the credential and returns its metadata, so a 401 here means the
33
33
  * key is genuinely refused.
34
34
  */
35
- probeCredential(): Promise<void>;
35
+ probeCredential(signal?: AbortSignal): Promise<void>;
36
36
  /**
37
37
  * The vendor's own `context_length` for this model.
38
38
  *
@@ -49,15 +49,17 @@ export declare class OpenRouterProvider implements LLMProvider {
49
49
  * authoritative as it was, while a substituted number would present a
50
50
  * guess as a vendor answer.
51
51
  *
52
- * Cached for the process, because a listing of several hundred models is
53
- * a real payload and a model's window does not change under a running
54
- * run. A failure is NOT cached — the next run asks again rather than
55
- * inheriting one bad minute forever.
52
+ * A fulfilled listing is cached for this driver, because a payload of
53
+ * several hundred models does not change under a running run. Pending
54
+ * requests stay caller-owned, so concurrent cold misses may duplicate the
55
+ * request rather than letting one caller's cancellation own both. A
56
+ * failure is NOT cached — the next run asks again rather than inheriting
57
+ * one bad minute forever.
56
58
  */
57
59
  resolveContextWindow(model: string, signal?: AbortSignal): Promise<number | undefined>;
58
- /** Resolved once per process; see the note on `resolveContextWindow`. */
60
+ /** First fulfilled listing; see the note on `resolveContextWindow`. */
59
61
  private contextWindows?;
60
- listModels(): Promise<ModelInfo[]>;
62
+ listModels(signal?: AbortSignal): Promise<ModelInfo[]>;
61
63
  healthCheck(): Promise<boolean>;
62
64
  }
63
65
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,WAAW,EAGX,MAAM,YAAY,CAAA;AAUnB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAwClD;;;;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C,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,gBAAgB;IAQpC,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,gBAAgB;IAqCjB,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC;IAmI3E;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB1D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAyB5F,uEAAuE;IACvE,OAAO,CAAC,cAAc,CAAC,CAAqB;IAEtC,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAkCtD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAWrC"}
package/dist/client.js CHANGED
@@ -258,8 +258,13 @@ export class OpenRouterProvider {
258
258
  * requires the credential and returns its metadata, so a 401 here means the
259
259
  * key is genuinely refused.
260
260
  */
261
- async probeCredential() {
262
- const response = await fetch(`${this.baseUrl}/key`, { headers: this.getHeaders() });
261
+ async probeCredential(signal) {
262
+ signal?.throwIfAborted();
263
+ const response = await fetch(`${this.baseUrl}/key`, {
264
+ headers: this.getHeaders(),
265
+ ...(signal ? { signal } : {}),
266
+ });
267
+ signal?.throwIfAborted();
263
268
  if (!response.ok) {
264
269
  const err = new Error(`Credential check failed: ${response.status}`);
265
270
  err.status = response.status;
@@ -282,41 +287,48 @@ export class OpenRouterProvider {
282
287
  * authoritative as it was, while a substituted number would present a
283
288
  * guess as a vendor answer.
284
289
  *
285
- * Cached for the process, because a listing of several hundred models is
286
- * a real payload and a model's window does not change under a running
287
- * run. A failure is NOT cached — the next run asks again rather than
288
- * inheriting one bad minute forever.
290
+ * A fulfilled listing is cached for this driver, because a payload of
291
+ * several hundred models does not change under a running run. Pending
292
+ * requests stay caller-owned, so concurrent cold misses may duplicate the
293
+ * request rather than letting one caller's cancellation own both. A
294
+ * failure is NOT cached — the next run asks again rather than inheriting
295
+ * one bad minute forever.
289
296
  */
290
297
  async resolveContextWindow(model, signal) {
291
- const pending = this.contextWindows ??
292
- (async () => {
293
- const models = await this.listModels();
294
- return new Map(models
295
- .filter((m) => typeof m.contextWindow === 'number')
296
- .map((m) => [m.id, m.contextWindow]));
297
- })().catch((err) => {
298
- // Not cached. A listing endpoint that was down for a minute must
299
- // not leave every later run answering from that minute.
300
- this.contextWindows = undefined;
301
- throw err;
302
- });
303
- this.contextWindows = pending;
304
- const windows = await pending;
305
298
  if (signal?.aborted)
306
299
  return undefined;
300
+ let windows = this.contextWindows;
301
+ if (!windows) {
302
+ const models = await this.listModels(signal);
303
+ if (signal?.aborted)
304
+ return undefined;
305
+ windows = new Map(models
306
+ .filter((m) => typeof m.contextWindow === 'number')
307
+ .map((m) => [m.id, m.contextWindow]));
308
+ // Cache only a fulfilled value. Sharing a pending request would make
309
+ // its first caller's AbortSignal the owner of every concurrent query's
310
+ // metadata transport; cancelling that caller would then degrade still-
311
+ // authorized runs to the static table. Concurrent cold misses may issue
312
+ // duplicate listings, and converge here after either succeeds.
313
+ this.contextWindows ??= windows;
314
+ windows = this.contextWindows;
315
+ }
307
316
  const reported = windows.get(model);
308
317
  return typeof reported === 'number' && reported > 0 ? reported : undefined;
309
318
  }
310
- /** Resolved once per process; see the note on `resolveContextWindow`. */
319
+ /** First fulfilled listing; see the note on `resolveContextWindow`. */
311
320
  contextWindows;
312
- async listModels() {
321
+ async listModels(signal) {
322
+ signal?.throwIfAborted();
313
323
  const response = await fetch(`${this.baseUrl}/models`, {
314
324
  headers: this.getHeaders(),
325
+ ...(signal ? { signal } : {}),
315
326
  });
316
327
  if (!response.ok) {
317
328
  throw new Error(`Failed to list models: ${response.status}`);
318
329
  }
319
330
  const data = (await response.json());
331
+ signal?.throwIfAborted();
320
332
  return data.data.map((m) => ({
321
333
  id: m.id,
322
334
  name: m.name,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,EACN,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAG/C,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,8BAA8B,CAAA;AAc7F,SAAS,UAAU,CAAC,GAAc;IACjC,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,OAAO;YACN,YAAY,EAAE,CAAC;YACf,gBAAgB,EAAE,CAAC;YACnB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,gBAAgB,EAAE,CAAC;SACnB,CAAA;IACF,CAAC;IACD,OAAO;QACN,YAAY,EAAE,GAAG,CAAC,aAAa;QAC/B,gBAAgB,EAAE,GAAG,CAAC,iBAAiB;QACvC,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,YAAY,EAAE,GAAG,CAAC,qBAAqB,EAAE,aAAa,IAAI,GAAG,CAAC,uBAAuB,IAAI,CAAC;QAC1F,gBAAgB,EAAE,GAAG,CAAC,2BAA2B,IAAI,CAAC;KACtD,CAAA;AACF,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAc;IACvC,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAA;IACrC,OAAO,EAAE,CAAA;AACV,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC5D,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,uBAAuB,EAAE,IAAI;IAC7B,cAAc,EAAE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O,EAAE,IAAI,CAAC,UAAU,EAAE;gBAC1B,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;aACjC,CAAC,CAAA;YACF,OAAO,QAAQ,CAAC,EAAE,CAAA;QACnB,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/openrouter",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "OpenRouter LLM provider for @namzu/sdk. Access to 200+ models (Claude, GPT-4, Llama, Mixtral) via OpenRouter's unified API.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "engines": {
@@ -55,7 +55,7 @@
55
55
  "@types/node": "^22.19.17",
56
56
  "typescript": "^5.5.0",
57
57
  "vitest": "^3.2.6",
58
- "@namzu/sdk": "^30.1.0"
58
+ "@namzu/sdk": "^31.0.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsc --build",
package/src/client.ts CHANGED
@@ -311,8 +311,13 @@ export class OpenRouterProvider implements LLMProvider {
311
311
  * requires the credential and returns its metadata, so a 401 here means the
312
312
  * key is genuinely refused.
313
313
  */
314
- async probeCredential(): Promise<void> {
315
- const response = await fetch(`${this.baseUrl}/key`, { headers: this.getHeaders() })
314
+ async probeCredential(signal?: AbortSignal): Promise<void> {
315
+ signal?.throwIfAborted()
316
+ const response = await fetch(`${this.baseUrl}/key`, {
317
+ headers: this.getHeaders(),
318
+ ...(signal ? { signal } : {}),
319
+ })
320
+ signal?.throwIfAborted()
316
321
  if (!response.ok) {
317
322
  const err = new Error(`Credential check failed: ${response.status}`) as Error & {
318
323
  status?: number
@@ -338,43 +343,46 @@ export class OpenRouterProvider implements LLMProvider {
338
343
  * authoritative as it was, while a substituted number would present a
339
344
  * guess as a vendor answer.
340
345
  *
341
- * Cached for the process, because a listing of several hundred models is
342
- * a real payload and a model's window does not change under a running
343
- * run. A failure is NOT cached — the next run asks again rather than
344
- * inheriting one bad minute forever.
346
+ * A fulfilled listing is cached for this driver, because a payload of
347
+ * several hundred models does not change under a running run. Pending
348
+ * requests stay caller-owned, so concurrent cold misses may duplicate the
349
+ * request rather than letting one caller's cancellation own both. A
350
+ * failure is NOT cached — the next run asks again rather than inheriting
351
+ * one bad minute forever.
345
352
  */
346
353
  async resolveContextWindow(model: string, signal?: AbortSignal): Promise<number | undefined> {
347
- const pending =
348
- this.contextWindows ??
349
- (async () => {
350
- const models = await this.listModels()
351
- return new Map<string, number>(
352
- models
353
- .filter(
354
- (m): m is typeof m & { contextWindow: number } => typeof m.contextWindow === 'number',
355
- )
356
- .map((m) => [m.id, m.contextWindow]),
357
- )
358
- })().catch((err: unknown) => {
359
- // Not cached. A listing endpoint that was down for a minute must
360
- // not leave every later run answering from that minute.
361
- this.contextWindows = undefined
362
- throw err
363
- })
364
- this.contextWindows = pending
365
-
366
- const windows = await pending
367
354
  if (signal?.aborted) return undefined
355
+ let windows = this.contextWindows
356
+ if (!windows) {
357
+ const models = await this.listModels(signal)
358
+ if (signal?.aborted) return undefined
359
+ windows = new Map<string, number>(
360
+ models
361
+ .filter(
362
+ (m): m is typeof m & { contextWindow: number } => typeof m.contextWindow === 'number',
363
+ )
364
+ .map((m) => [m.id, m.contextWindow]),
365
+ )
366
+ // Cache only a fulfilled value. Sharing a pending request would make
367
+ // its first caller's AbortSignal the owner of every concurrent query's
368
+ // metadata transport; cancelling that caller would then degrade still-
369
+ // authorized runs to the static table. Concurrent cold misses may issue
370
+ // duplicate listings, and converge here after either succeeds.
371
+ this.contextWindows ??= windows
372
+ windows = this.contextWindows
373
+ }
368
374
  const reported = windows.get(model)
369
375
  return typeof reported === 'number' && reported > 0 ? reported : undefined
370
376
  }
371
377
 
372
- /** Resolved once per process; see the note on `resolveContextWindow`. */
373
- private contextWindows?: Promise<Map<string, number>>
378
+ /** First fulfilled listing; see the note on `resolveContextWindow`. */
379
+ private contextWindows?: Map<string, number>
374
380
 
375
- async listModels(): Promise<ModelInfo[]> {
381
+ async listModels(signal?: AbortSignal): Promise<ModelInfo[]> {
382
+ signal?.throwIfAborted()
376
383
  const response = await fetch(`${this.baseUrl}/models`, {
377
384
  headers: this.getHeaders(),
385
+ ...(signal ? { signal } : {}),
378
386
  })
379
387
 
380
388
  if (!response.ok) {
@@ -390,6 +398,7 @@ export class OpenRouterProvider implements LLMProvider {
390
398
  pricing?: { prompt: string; completion: string }
391
399
  }>
392
400
  }
401
+ signal?.throwIfAborted()
393
402
 
394
403
  return data.data.map((m) => ({
395
404
  id: m.id,