@namzu/openai 1.3.0 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,173 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 780a471: Expand `ReasoningEffort` with `none`, `minimal`, and `ultra`, while making the vocabulary explicitly model-specific rather than a universal capability claim. The OpenAI Chat Completions driver now carries a requested effort to `reasoning_effort`, refuses levels outside each recognized model family's published set before transport, and exposes `openAIReasoningEffortLevels()` with an honest `undefined` result for unknown compatible-endpoint model ids.
8
+ - 94d3306: Add the chain-aware `reasoningEffortLevelsFor(model, thinking)` provider capability while retaining `effortLevelsFor` as a deprecated compatibility member. The four capability states now distinguish a driver with no menu, an unknown model, an explicitly unsupported model, and an exact selectable set; fallback chains expose only levels every reachable member accepts.
9
+
10
+ The TUI adds session-scoped `/effort [level|default]`, sends the selection to later main-query turns, and resets it atomically when a provider/model replacement succeeds. Failed or cancelled replacements preserve the current selection.
11
+
12
+ OpenAI publishes exact known-model menus and keeps unknown compatible-endpoint models unknown. DeepSeek explicitly publishes no supported levels. Anthropic now refuses unsupported effort levels before transport instead of silently dropping them; callers upgrading Anthropic must choose a level returned by `reasoningEffortLevelsFor()` or omit `effort` to retain the provider default.
13
+
14
+ ### Patch Changes
15
+
16
+ - 15f8ee4: Bound provider stream silence, including query-owned advisory calls and
17
+ RouterAgent routing decisions, compaction verifiers and model-graded eval
18
+ judges, to five minutes by default and abort the stalled provider transport,
19
+ with network-classified retry and fallback recovery where those policies
20
+ apply. This changes the previous default, under which a provider iterator could
21
+ remain silent forever. Set `streamIdleTimeoutMs: 0` on the run, agent, manual
22
+ compaction, verifier, or judge config to keep the old unbounded behavior, or set
23
+ a positive millisecond value to choose a different bound.
24
+
25
+ Queries whose caller signal is already aborted now settle as cancelled before
26
+ starting provider, provider-metadata, or tool work. A later cancellation also
27
+ settles while an optional context-window resolver remains pending, even when
28
+ that resolver ignores its signal. With no caller cancellation, `timeoutMs`
29
+ bounds the optional metadata lookup, aborts its private transport signal, and
30
+ falls back to the static context-window table instead of blocking the run.
31
+
32
+ The OpenRouter context-window lookup now forwards cancellation to its model-list
33
+ transport. Only fulfilled listings are cached, so cancelling one concurrent
34
+ query cannot abort another query's shared metadata request or force that query
35
+ onto the static context-window table.
36
+
37
+ `runExperiment({ timeoutMs })` now applies one validated wall-clock deadline to
38
+ both case execution and scoring. Scorers receive its optional cancellation
39
+ signal; a non-cooperative scorer is detached, and `judgeScorer` forwards the
40
+ signal to its bounded provider transport. Values outside the positive platform
41
+ timer range are refused before a case starts; omit the field for the prior
42
+ unbounded case behavior.
43
+
44
+ Compaction verification inside a query now carries the run cancellation cause
45
+ to its provider transport without placing a second idle timer around retry and
46
+ fallback. Public `buildVerifiedSummary`, `compactNow`, and `compactRegion`
47
+ calls bound raw provider silence themselves and accept optional `signal` and
48
+ `streamIdleTimeoutMs`; malformed values and pre-cancelled manual work are
49
+ refused before provider work or a no-op result.
50
+
51
+ HTTP embedding batches now have a 30-second whole-request default, including
52
+ response-body reads, where the previous default could wait forever. Set
53
+ `requestTimeoutMs: 0` on `HttpEmbeddingProvider` to keep the former unbounded
54
+ behavior. Invalid timeout values and non-positive or fractional `batchSize`
55
+ or `dimensions` values are refused at construction instead of silently
56
+ disabling the bound or entering a non-progressing batch loop. Successful HTTP
57
+ responses must contain exactly one unique, in-range result per input and finite
58
+ vectors of the configured dimension; malformed or incomplete batches are
59
+ refused atomically instead of reaching ingestion with missing embeddings.
60
+
61
+ Public RAG operations accept optional cancellation context. The shipped
62
+ `knowledge_search` tool forwards its run-owned signal through
63
+ `KnowledgeBase`, retrieval or ingestion, and the embedding provider. The HTTP
64
+ provider preserves the caller's exact cancellation reason while aborting only
65
+ its private fetch transport. Custom embedding providers receive the signal as
66
+ a cooperative request; callers still own their wait boundary if a custom
67
+ implementation ignores it. Default retrieval and ingestion recheck authority
68
+ after that custom call settles, so a late result cannot start a vector search
69
+ or persist chunks after cancellation. `VectorStore.search` and `upsert` now
70
+ receive the same optional operation context. The default pipelines also race
71
+ those store promises against cancellation, so a non-cooperative custom store
72
+ cannot leave the public query or ingestion call pending forever.
73
+
74
+ A2A agent-card discovery now has a 30-second whole fetch-and-body default and
75
+ accepts an optional caller signal and `timeoutMs`; set `timeoutMs: 0` to retain
76
+ the former unbounded behavior. `A2ADelegate.timeoutMs` now starts before
77
+ `message/send` and bounds the whole delegation instead of polling only. A
78
+ pre-cancelled dispatch starts no remote work, pending fetch and body promises
79
+ cannot hold `waitForTask`, and caller cancellation preserves its exact cause on
80
+ the private transport. Poll and delegation timers are validated at
81
+ construction. Once a safe task id exists, cancellation or timeout sends one
82
+ independently bounded `tasks/cancel`; during initial task creation the client
83
+ keeps a short cleanup grace and explicitly reports an unknown remote outcome if
84
+ the peer never returns an addressable id. Poll replies are bound to that initial
85
+ id, and transport or protocol failures after it is known make the same bounded
86
+ cleanup attempt before the original failure is returned. An `input-required`
87
+ task is also bounded-cancelled before the delegate reports that it cannot
88
+ supply the requested input.
89
+
90
+ Connector execution now carries optional operation authority through the
91
+ manager, every connector-tool adapter, real query runs, tenant/environment
92
+ facades, health checks, and `MCPConnectorBridge.callTool`. Custom connectors
93
+ receive the signal; if they ignore it, the manager settles with an honest
94
+ unknown remote outcome and rejects a late success that does not identify a
95
+ received response. A tenant call cancelled before admission no longer spends a
96
+ rate-limit slot.
97
+
98
+ `HttpConnector` and `WebhookConnector` now apply one validated 30-second
99
+ fetch-and-body deadline and a streaming 2 MiB response limit by default. Set
100
+ positive `timeoutMs` and `maxResponseBytes` values to choose different bounds.
101
+ Cancellation, deadline, or response-size failure aborts only the private
102
+ transport/body reader and preserves the caller's exact cause. Result metadata
103
+ distinguishes `not_started`, `unknown`, and `response_received`, includes retry
104
+ safety, and keeps a received status visible when its body is unavailable.
105
+
106
+ Dynamic HTTP paths and webhook URL overrides must remain on the configured
107
+ origin. Model-authored routing headers are refused, redirects are not followed,
108
+ and 3xx responses are no longer reported as success. Configure a separate
109
+ connector instance for each authorized origin; callers that previously used a
110
+ cross-origin webhook override must migrate to that instance.
111
+
112
+ `GuardedFetchProvider` now applies one validated 30-second deadline across DNS
113
+ resolution, every manually admitted redirect fetch, and the final response
114
+ body, while preserving a caller's exact cancellation cause on a private
115
+ transport signal. Its 2 MiB default response cap is enforced from streamed
116
+ bytes rather than after `response.text()` allocates the whole body; overflow
117
+ cancels the reader and returns a valid UTF-8 prefix. Redirect bodies are
118
+ cancelled when abandoned, and a spent redirect budget causes no DNS lookup for
119
+ the next target. Set positive `timeoutMs` and `maxBytes` values or a
120
+ non-negative integer `maxRedirects` to choose other bounds. Custom
121
+ `GuardedFetchConfig.resolve` functions may now accept the operation signal as
122
+ a second argument. IPv4-mapped IPv6 literals are canonicalized back to their
123
+ IPv4 address before range checks, closing the hexadecimal mapped loopback and
124
+ link-local bypass; the full IPv6 link-local and multicast ranges are also
125
+ refused.
126
+
127
+ MCP request methods now accept optional cancellation authority, and generated
128
+ MCP tool and prompt adapters forward the run-owned tool signal. A pre-aborted
129
+ request starts no transport work; a pending request preserves the caller's
130
+ exact cause, aborts a private transport, removes its correlated pending id, and
131
+ makes a one-second best-effort `notifications/cancelled` attempt. The
132
+ notification does not prove that an already-started remote side effect stopped.
133
+ Paged list calls recheck the same signal before each page.
134
+
135
+ `MCPClient.requestTimeoutMs` and HTTP MCP transport `timeoutMs` values must now
136
+ be positive platform-range integers. A shorter transport deadline remains a
137
+ request-timeout terminal and emits the same correlated cancellation. HTTP
138
+ fetches and response-body reads share operation authority; disconnect owns
139
+ active requests and cancellation cleanup. Reconnects fence late POST responses
140
+ and SSE batches from prior generations, clear Streamable session state, and
141
+ accept session ids only from successful `initialize` responses. Per-send
142
+ failure no longer marks a Streamable client connection-wide errored or rejects
143
+ unrelated concurrent calls. `MCPTransport.send` now accepts optional
144
+ `MCPTransportSendOptions`; custom transports should refuse pre-aborted work and
145
+ stop their per-send I/O when its signal fires.
146
+
147
+ Provider model listings and credential probes now accept optional cancellation
148
+ signals. Retry, fallback, stream-idle and instrumentation decorators preserve
149
+ that authority, and every bundled CLI driver forwards it to the underlying
150
+ transport where supported or refuses a result that arrived after cancellation.
151
+ Existing zero-argument provider implementations remain valid.
152
+
153
+ The interactive provider picker now cancels model discovery, credential checks
154
+ and subscription sign-in when the operator backs out, supersedes the work, or
155
+ leaves the screen. Late results cannot reopen an old model step, accept a
156
+ credential, re-probe the application, or persist a subscription credential
157
+ after cancellation. Model listing and credential probing both settle after a
158
+ three-second bound even when a custom provider ignores its signal.
159
+
160
+ Between-turn and durable-resume subscription refreshes now settle on caller
161
+ cancellation and apply one 30-second bound across the token request and response
162
+ body. Refreshes in one session are serialized and re-read their source at the
163
+ head of the queue, preventing a later stale caller from downgrading a token
164
+ published by an earlier one. Namzu's credential file uses an exact conditional
165
+ replacement under a cross-process, atomically published lock; an external
166
+ rotation or logout wins, and an uncertain publication refuses instead of using
167
+ an uncommitted refresh. Borrowed macOS Keychain credentials are read-only: a
168
+ changed or removed entry wins, and a successful refresh of an unchanged entry
169
+ remains session-local.
170
+
3
171
  ## 1.3.0
4
172
 
5
173
  ### Minor Changes
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ChatCompletionParams, LLMProvider, ModelInfo, ProviderCapabilities, StreamChunk } from '@namzu/sdk';
1
+ import type { ChatCompletionParams, LLMProvider, ModelInfo, ProviderCapabilities, ReasoningEffort, StreamChunk } from '@namzu/sdk';
2
2
  import type { ChatCompletionMessageParam, ChatCompletionTool } from 'openai/resources/chat/completions';
3
3
  import type { OpenAIConfig } from './types.js';
4
4
  /**
@@ -7,6 +7,15 @@ import type { OpenAIConfig } from './types.js';
7
7
  * content parts with base64 data URIs (`toOpenAIMessages`).
8
8
  */
9
9
  export declare const OPENAI_CAPABILITIES: ProviderCapabilities;
10
+ /**
11
+ * Exact reasoning-effort levels published for a recognized OpenAI model id.
12
+ *
13
+ * `undefined` is deliberately different from an empty array. This driver also
14
+ * serves compatible endpoints with model identifiers OpenAI does not publish;
15
+ * claiming that such a model has no effort levels would be as false as claiming
16
+ * that it accepts every level in the SDK vocabulary.
17
+ */
18
+ export declare function openAIReasoningEffortLevels(model: string): readonly ReasoningEffort[] | undefined;
10
19
  /**
11
20
  * Refuse an extended-thinking request this driver does not implement.
12
21
  *
@@ -43,6 +52,7 @@ export declare class OpenAIProvider implements LLMProvider {
43
52
  private defaultModel?;
44
53
  constructor(config: OpenAIConfig);
45
54
  private resolveModel;
55
+ reasoningEffortLevelsFor(model: string): readonly ReasoningEffort[] | undefined;
46
56
  chatStream(params: ChatCompletionParams): AsyncIterable<StreamChunk>;
47
57
  /**
48
58
  * Declared even though this driver's listing already fails correctly on a
@@ -51,8 +61,8 @@ export declare class OpenAIProvider implements LLMProvider {
51
61
  * question has to say so — otherwise it is reported unverifiable, which is
52
62
  * the honest default and would be a regression here.
53
63
  */
54
- probeCredential(): Promise<void>;
55
- listModels(): Promise<ModelInfo[]>;
64
+ probeCredential(signal?: AbortSignal): Promise<void>;
65
+ listModels(signal?: AbortSignal): Promise<ModelInfo[]>;
56
66
  healthCheck(): Promise<boolean>;
57
67
  }
58
68
  //# 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,EAEpB,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,WAAW,EAGX,MAAM,YAAY,CAAA;AAYnB,OAAO,KAAK,EAEX,0BAA0B,EAC1B,kBAAkB,EAElB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,oBAMjC,CAAA;AAyDD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC/C,QAAQ,CAAC,E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AAS,eAAe,EAAE,GAAG,SAAS,CAqBjG;AAqFD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC/C,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAAA;KAAE,CAAA;CACxD,GAAG,IAAI,CAOP;AAuBD,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,GACxC,0BAA0B,EAAE,CA8E9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,GAAG,SAAS,CAY5F;AAED,qBAAa,cAAe,YAAW,WAAW;IACjD,QAAQ,CAAC,EAAE,YAAW;IACtB,QAAQ,CAAC,IAAI,YAAW;IACxB,QAAQ,CAAC,YAAY,uBAAsB;IAE3C,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,YAAY,CAAC,CAAQ;gBAEjB,MAAM,EAAE,YAAY;IAwBhC,OAAO,CAAC,YAAY;IAUpB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE,GAAG,SAAS;IAIxE,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC;IAiG3E;;;;;;OAMG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAMpD,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IActD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAQrC"}
package/dist/client.js CHANGED
@@ -15,6 +15,87 @@ export const OPENAI_CAPABILITIES = {
15
15
  supportsVision: true,
16
16
  supportsDocuments: true,
17
17
  };
18
+ const GPT_5_EFFORT = [
19
+ 'minimal',
20
+ 'low',
21
+ 'medium',
22
+ 'high',
23
+ ];
24
+ const GPT_5_1_EFFORT = [
25
+ 'none',
26
+ 'low',
27
+ 'medium',
28
+ 'high',
29
+ ];
30
+ const GPT_5_2_TO_5_5_EFFORT = [
31
+ 'none',
32
+ 'low',
33
+ 'medium',
34
+ 'high',
35
+ 'xhigh',
36
+ ];
37
+ const GPT_5_6_EFFORT = [
38
+ 'none',
39
+ 'low',
40
+ 'medium',
41
+ 'high',
42
+ 'xhigh',
43
+ 'max',
44
+ ];
45
+ /**
46
+ * Exact reasoning-effort levels published for a recognized OpenAI model id.
47
+ *
48
+ * `undefined` is deliberately different from an empty array. This driver also
49
+ * serves compatible endpoints with model identifiers OpenAI does not publish;
50
+ * claiming that such a model has no effort levels would be as false as claiming
51
+ * that it accepts every level in the SDK vocabulary.
52
+ */
53
+ export function openAIReasoningEffortLevels(model) {
54
+ const normalized = model.toLowerCase();
55
+ if (/^gpt-5\.6(?:-(?:sol|terra|luna))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
56
+ return GPT_5_6_EFFORT;
57
+ }
58
+ if (/^gpt-5\.5(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
59
+ return GPT_5_2_TO_5_5_EFFORT;
60
+ }
61
+ if (/^gpt-5\.4(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
62
+ return GPT_5_2_TO_5_5_EFFORT;
63
+ }
64
+ if (/^gpt-5\.2(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
65
+ return GPT_5_2_TO_5_5_EFFORT;
66
+ }
67
+ if (/^gpt-5\.1(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
68
+ return GPT_5_1_EFFORT;
69
+ }
70
+ if (/^gpt-5(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
71
+ return GPT_5_EFFORT;
72
+ }
73
+ return undefined;
74
+ }
75
+ function assertOpenAIReasoningEffort(model, effort) {
76
+ if (effort === undefined)
77
+ return;
78
+ const supported = openAIReasoningEffortLevels(model);
79
+ if (supported === undefined || supported.includes(effort))
80
+ return;
81
+ throw new Error(`OpenAIProvider: effort "${effort}" is not supported by model "${model}". Supported levels: ${supported.join(', ')}. Choose one of those levels or omit \`effort\`.`);
82
+ }
83
+ /**
84
+ * Add the current effort vocabulary without widening any other vendor field.
85
+ *
86
+ * The installed vendor client declaration predates `max`, while the current
87
+ * API model catalogue already publishes it for GPT-5.6. `ultra` remains valid
88
+ * only for an unknown compatible endpoint here: every recognized official
89
+ * model rejects it above before this bounded cast is reached.
90
+ */
91
+ function withReasoningEffort(request, effort) {
92
+ if (effort === undefined)
93
+ return request;
94
+ return {
95
+ ...request,
96
+ reasoning_effort: effort,
97
+ };
98
+ }
18
99
  function mapFinishReason(reason) {
19
100
  switch (reason) {
20
101
  case 'length':
@@ -73,7 +154,7 @@ export function assertThinkingSupported(params) {
73
154
  // moved to the SDK where a new driver inherits it instead of re-deciding
74
155
  // it. Kept as a named export because it is one, and removing it would
75
156
  // break a caller for no gain.
76
- assertThinkingUnsupported('OpenAIProvider', params);
157
+ assertThinkingUnsupported('OpenAIProvider', { thinking: params.thinking });
77
158
  }
78
159
  /**
79
160
  * Refuse a document whose citations this wire cannot return.
@@ -219,7 +300,10 @@ export class OpenAIProvider {
219
300
  // Merged rather than replaced. Assigning `config.defaultHeaders`
220
301
  // straight over would drop attribution for exactly the hosts that
221
302
  // customise their transport.
222
- clientOptions.defaultHeaders = { ...attributionHeaders(), ...(config.defaultHeaders ?? {}) };
303
+ clientOptions.defaultHeaders = {
304
+ ...attributionHeaders(),
305
+ ...(config.defaultHeaders ?? {}),
306
+ };
223
307
  this.client = new OpenAI(clientOptions);
224
308
  this.defaultModel = config.model;
225
309
  }
@@ -230,12 +314,16 @@ export class OpenAIProvider {
230
314
  }
231
315
  return model;
232
316
  }
317
+ reasoningEffortLevelsFor(model) {
318
+ return openAIReasoningEffortLevels(model);
319
+ }
233
320
  async *chatStream(params) {
234
321
  const model = this.resolveModel(params);
235
322
  assertThinkingSupported(params);
323
+ assertOpenAIReasoningEffort(model, params.effort);
236
324
  let stream;
237
325
  try {
238
- stream = await this.client.chat.completions.create({
326
+ stream = await this.client.chat.completions.create(withReasoningEffort({
239
327
  model,
240
328
  messages: toOpenAIMessages(params.messages),
241
329
  stream: true,
@@ -250,7 +338,7 @@ export class OpenAIProvider {
250
338
  presence_penalty: params.presencePenalty,
251
339
  stop: params.stop,
252
340
  response_format: params.responseFormat,
253
- },
341
+ }, params.effort),
254
342
  // Per-request abort: a Stop tears the in-flight SSE request down.
255
343
  { signal: params.signal });
256
344
  }
@@ -329,11 +417,15 @@ export class OpenAIProvider {
329
417
  * question has to say so — otherwise it is reported unverifiable, which is
330
418
  * the honest default and would be a regression here.
331
419
  */
332
- async probeCredential() {
333
- await this.client.models.list();
420
+ async probeCredential(signal) {
421
+ signal?.throwIfAborted();
422
+ await this.client.models.list(signal ? { signal } : undefined);
423
+ signal?.throwIfAborted();
334
424
  }
335
- async listModels() {
336
- const page = await this.client.models.list();
425
+ async listModels(signal) {
426
+ signal?.throwIfAborted();
427
+ const page = await this.client.models.list(signal ? { signal } : undefined);
428
+ signal?.throwIfAborted();
337
429
  return page.data.map((m) => ({
338
430
  id: m.id,
339
431
  name: m.id,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,MAAM,MAAM,QAAQ,CAAA;AAS3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAyB;IACxD,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;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AI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAC3E,MAAM,EAAE,cAAc,EAAE,CAAA;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,EAAE;YACV,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,IAAI;YACrB,iBAAiB,EAAE,IAAI;SACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,WAAW;QAChB,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;YAC/B,OAAO,IAAI,CAAA;QACZ,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;CACD"}
package/dist/index.d.ts CHANGED
@@ -14,6 +14,6 @@ declare module '@namzu/sdk' {
14
14
  * Pass `{ replace: true }` to override.
15
15
  */
16
16
  export declare function registerOpenAI(options?: RegisterOptions): void;
17
- export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
17
+ export { OPENAI_CAPABILITIES, OpenAIProvider, openAIReasoningEffortLevels } from './client.js';
18
18
  export type { OpenAIConfig, OpenAIProviderConfig } from './types.js';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAItD,OAAO,QAAQ,YAAY,CAAC;IAC3B,UAAU,sBAAsB;QAC/B,MAAM,EAAE,oBAAoB,CAAA;KAC5B;CACD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAE9D;AAED,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjE,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAItD,OAAO,QAAQ,YAAY,CAAC;IAC3B,UAAU,sBAAsB;QAC/B,MAAM,EAAE,oBAAoB,CAAA;KAC5B;CACD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAE9D;AAED,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAC9F,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -11,5 +11,5 @@ import { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
11
11
  export function registerOpenAI(options) {
12
12
  ProviderRegistry.register('openai', OpenAIProvider, OPENAI_CAPABILITIES, options);
13
13
  }
14
- export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
14
+ export { OPENAI_CAPABILITIES, OpenAIProvider, openAIReasoningEffortLevels } from './client.js';
15
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAWjE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACvD,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAA;AAClF,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAWjE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACvD,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAA;AAClF,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/openai",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "OpenAI LLM provider for @namzu/sdk via the official `openai` npm SDK. Chat Completions API with streaming + tool-use.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "engines": {
@@ -57,7 +57,7 @@
57
57
  "@types/node": "^22.19.17",
58
58
  "typescript": "^5.5.0",
59
59
  "vitest": "^3.2.6",
60
- "@namzu/sdk": "^30.1.0"
60
+ "@namzu/sdk": "^31.0.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "tsc --build",
package/src/client.ts CHANGED
@@ -4,12 +4,12 @@ import type {
4
4
  LLMProvider,
5
5
  ModelInfo,
6
6
  ProviderCapabilities,
7
+ ReasoningEffort,
7
8
  StreamChunk,
8
9
  TokenUsage,
9
10
  ToolChoice,
10
11
  } from '@namzu/sdk'
11
12
  import { assertThinkingUnsupported } from '@namzu/sdk'
12
- import type { ThinkingConfig } from '@namzu/sdk'
13
13
  import { toolResultToText } from '@namzu/sdk'
14
14
  import {
15
15
  ProviderRequestError,
@@ -21,6 +21,7 @@ import { attributionHeaders } from '@namzu/sdk'
21
21
  import OpenAI from 'openai'
22
22
  import type {
23
23
  ChatCompletionContentPart,
24
+ ChatCompletionCreateParamsStreaming,
24
25
  ChatCompletionMessageParam,
25
26
  ChatCompletionTool,
26
27
  ChatCompletionToolChoiceOption,
@@ -40,6 +41,93 @@ export const OPENAI_CAPABILITIES: ProviderCapabilities = {
40
41
  supportsDocuments: true,
41
42
  }
42
43
 
44
+ const GPT_5_EFFORT = [
45
+ 'minimal',
46
+ 'low',
47
+ 'medium',
48
+ 'high',
49
+ ] as const satisfies readonly ReasoningEffort[]
50
+ const GPT_5_1_EFFORT = [
51
+ 'none',
52
+ 'low',
53
+ 'medium',
54
+ 'high',
55
+ ] as const satisfies readonly ReasoningEffort[]
56
+ const GPT_5_2_TO_5_5_EFFORT = [
57
+ 'none',
58
+ 'low',
59
+ 'medium',
60
+ 'high',
61
+ 'xhigh',
62
+ ] as const satisfies readonly ReasoningEffort[]
63
+ const GPT_5_6_EFFORT = [
64
+ 'none',
65
+ 'low',
66
+ 'medium',
67
+ 'high',
68
+ 'xhigh',
69
+ 'max',
70
+ ] as const satisfies readonly ReasoningEffort[]
71
+
72
+ /**
73
+ * Exact reasoning-effort levels published for a recognized OpenAI model id.
74
+ *
75
+ * `undefined` is deliberately different from an empty array. This driver also
76
+ * serves compatible endpoints with model identifiers OpenAI does not publish;
77
+ * claiming that such a model has no effort levels would be as false as claiming
78
+ * that it accepts every level in the SDK vocabulary.
79
+ */
80
+ export function openAIReasoningEffortLevels(model: string): readonly ReasoningEffort[] | undefined {
81
+ const normalized = model.toLowerCase()
82
+ if (/^gpt-5\.6(?:-(?:sol|terra|luna))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
83
+ return GPT_5_6_EFFORT
84
+ }
85
+ if (/^gpt-5\.5(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
86
+ return GPT_5_2_TO_5_5_EFFORT
87
+ }
88
+ if (/^gpt-5\.4(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
89
+ return GPT_5_2_TO_5_5_EFFORT
90
+ }
91
+ if (/^gpt-5\.2(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
92
+ return GPT_5_2_TO_5_5_EFFORT
93
+ }
94
+ if (/^gpt-5\.1(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
95
+ return GPT_5_1_EFFORT
96
+ }
97
+ if (/^gpt-5(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
98
+ return GPT_5_EFFORT
99
+ }
100
+ return undefined
101
+ }
102
+
103
+ function assertOpenAIReasoningEffort(model: string, effort: ReasoningEffort | undefined): void {
104
+ if (effort === undefined) return
105
+ const supported = openAIReasoningEffortLevels(model)
106
+ if (supported === undefined || supported.includes(effort)) return
107
+ throw new Error(
108
+ `OpenAIProvider: effort "${effort}" is not supported by model "${model}". Supported levels: ${supported.join(', ')}. Choose one of those levels or omit \`effort\`.`,
109
+ )
110
+ }
111
+
112
+ /**
113
+ * Add the current effort vocabulary without widening any other vendor field.
114
+ *
115
+ * The installed vendor client declaration predates `max`, while the current
116
+ * API model catalogue already publishes it for GPT-5.6. `ultra` remains valid
117
+ * only for an unknown compatible endpoint here: every recognized official
118
+ * model rejects it above before this bounded cast is reached.
119
+ */
120
+ function withReasoningEffort(
121
+ request: Omit<ChatCompletionCreateParamsStreaming, 'reasoning_effort'>,
122
+ effort: ReasoningEffort | undefined,
123
+ ): ChatCompletionCreateParamsStreaming {
124
+ if (effort === undefined) return request
125
+ return {
126
+ ...request,
127
+ reasoning_effort: effort,
128
+ } as ChatCompletionCreateParamsStreaming
129
+ }
130
+
43
131
  type OpenAIFinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call'
44
132
 
45
133
  type NamzuFinishReason = ChatCompletionResponse['finishReason']
@@ -112,7 +200,7 @@ export function assertThinkingSupported(params: {
112
200
  // moved to the SDK where a new driver inherits it instead of re-deciding
113
201
  // it. Kept as a named export because it is one, and removing it would
114
202
  // break a caller for no gain.
115
- assertThinkingUnsupported('OpenAIProvider', params as { thinking?: ThinkingConfig })
203
+ assertThinkingUnsupported('OpenAIProvider', { thinking: params.thinking })
116
204
  }
117
205
 
118
206
  /**
@@ -267,7 +355,10 @@ export class OpenAIProvider implements LLMProvider {
267
355
  // Merged rather than replaced. Assigning `config.defaultHeaders`
268
356
  // straight over would drop attribution for exactly the hosts that
269
357
  // customise their transport.
270
- clientOptions.defaultHeaders = { ...attributionHeaders(), ...(config.defaultHeaders ?? {}) }
358
+ clientOptions.defaultHeaders = {
359
+ ...attributionHeaders(),
360
+ ...(config.defaultHeaders ?? {}),
361
+ }
271
362
 
272
363
  this.client = new OpenAI(clientOptions)
273
364
  this.defaultModel = config.model
@@ -283,29 +374,37 @@ export class OpenAIProvider implements LLMProvider {
283
374
  return model
284
375
  }
285
376
 
377
+ reasoningEffortLevelsFor(model: string): readonly ReasoningEffort[] | undefined {
378
+ return openAIReasoningEffortLevels(model)
379
+ }
380
+
286
381
  async *chatStream(params: ChatCompletionParams): AsyncIterable<StreamChunk> {
287
382
  const model = this.resolveModel(params)
288
383
  assertThinkingSupported(params)
384
+ assertOpenAIReasoningEffort(model, params.effort)
289
385
 
290
386
  let stream: Awaited<ReturnType<typeof this.client.chat.completions.create>>
291
387
  try {
292
388
  stream = await this.client.chat.completions.create(
293
- {
294
- model,
295
- messages: toOpenAIMessages(params.messages),
296
- stream: true,
297
- stream_options: { include_usage: true },
298
- tools: toOpenAITools(params),
299
- tool_choice: formatToolChoice(params.toolChoice),
300
- parallel_tool_calls: params.parallelToolCalls,
301
- temperature: params.temperature,
302
- max_tokens: params.maxTokens,
303
- top_p: params.topP,
304
- frequency_penalty: params.frequencyPenalty,
305
- presence_penalty: params.presencePenalty,
306
- stop: params.stop,
307
- response_format: params.responseFormat,
308
- },
389
+ withReasoningEffort(
390
+ {
391
+ model,
392
+ messages: toOpenAIMessages(params.messages),
393
+ stream: true,
394
+ stream_options: { include_usage: true },
395
+ tools: toOpenAITools(params),
396
+ tool_choice: formatToolChoice(params.toolChoice),
397
+ parallel_tool_calls: params.parallelToolCalls,
398
+ temperature: params.temperature,
399
+ max_tokens: params.maxTokens,
400
+ top_p: params.topP,
401
+ frequency_penalty: params.frequencyPenalty,
402
+ presence_penalty: params.presencePenalty,
403
+ stop: params.stop,
404
+ response_format: params.responseFormat,
405
+ },
406
+ params.effort,
407
+ ),
309
408
  // Per-request abort: a Stop tears the in-flight SSE request down.
310
409
  { signal: params.signal },
311
410
  )
@@ -383,12 +482,16 @@ export class OpenAIProvider implements LLMProvider {
383
482
  * question has to say so — otherwise it is reported unverifiable, which is
384
483
  * the honest default and would be a regression here.
385
484
  */
386
- async probeCredential(): Promise<void> {
387
- await this.client.models.list()
485
+ async probeCredential(signal?: AbortSignal): Promise<void> {
486
+ signal?.throwIfAborted()
487
+ await this.client.models.list(signal ? { signal } : undefined)
488
+ signal?.throwIfAborted()
388
489
  }
389
490
 
390
- async listModels(): Promise<ModelInfo[]> {
391
- const page = await this.client.models.list()
491
+ async listModels(signal?: AbortSignal): Promise<ModelInfo[]> {
492
+ signal?.throwIfAborted()
493
+ const page = await this.client.models.list(signal ? { signal } : undefined)
494
+ signal?.throwIfAborted()
392
495
  return page.data.map((m) => ({
393
496
  id: m.id,
394
497
  name: m.id,
package/src/index.ts CHANGED
@@ -22,5 +22,5 @@ export function registerOpenAI(options?: RegisterOptions): void {
22
22
  ProviderRegistry.register('openai', OpenAIProvider, OPENAI_CAPABILITIES, options)
23
23
  }
24
24
 
25
- export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js'
25
+ export { OPENAI_CAPABILITIES, OpenAIProvider, openAIReasoningEffortLevels } from './client.js'
26
26
  export type { OpenAIConfig, OpenAIProviderConfig } from './types.js'