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