@ashx-j/lunr-ai 0.2.9 → 0.2.11

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/dist/index.d.ts CHANGED
@@ -30,5 +30,5 @@ export * from "./utils/overflow.ts";
30
30
  export * from "./utils/retry.ts";
31
31
  export * from "./utils/typebox-helpers.ts";
32
32
  export * from "./utils/validation.ts";
33
- export { parseXaiGrok4Minor, withXaiEffortMetadata, XAI_GROK45_THINKING_LEVEL_MAP, XAI_GROK46_THINKING_LEVEL_MAP, } from "./xai-effort.ts";
33
+ export { parseXaiGrok4Minor, shouldUseXaiResponsesApi, withXaiEffortMetadata, XAI_GROK45_THINKING_LEVEL_MAP, XAI_GROK46_THINKING_LEVEL_MAP, XAI_RESPONSES_COMPAT, XAI_RESPONSES_EXCLUDED_MODEL_IDS, XAI_RESPONSES_MIN_MINOR, } from "./xai-effort.ts";
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC/G,YAAY,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACnH,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxG,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,YAAY,EACX,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,GAC7B,MAAM,iBAAiB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@ashx-j/lunr-ai/providers/*\", API implementations under\n// \"@ashx-j/lunr-ai/api/*\", the old global API under\n// \"@ashx-j/lunr-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport * from \"./types.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport * from \"./utils/overflow.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport * from \"./utils/validation.ts\";\nexport {\n\tparseXaiGrok4Minor,\n\twithXaiEffortMetadata,\n\tXAI_GROK45_THINKING_LEVEL_MAP,\n\tXAI_GROK46_THINKING_LEVEL_MAP,\n} from \"./xai-effort.ts\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC/G,YAAY,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACnH,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxG,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,YAAY,EACX,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,EAC7B,oBAAoB,EACpB,gCAAgC,EAChC,uBAAuB,GACvB,MAAM,iBAAiB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@ashx-j/lunr-ai/providers/*\", API implementations under\n// \"@ashx-j/lunr-ai/api/*\", the old global API under\n// \"@ashx-j/lunr-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport * from \"./types.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport * from \"./utils/overflow.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport * from \"./utils/validation.ts\";\nexport {\n\tparseXaiGrok4Minor,\n\tshouldUseXaiResponsesApi,\n\twithXaiEffortMetadata,\n\tXAI_GROK45_THINKING_LEVEL_MAP,\n\tXAI_GROK46_THINKING_LEVEL_MAP,\n\tXAI_RESPONSES_COMPAT,\n\tXAI_RESPONSES_EXCLUDED_MODEL_IDS,\n\tXAI_RESPONSES_MIN_MINOR,\n} from \"./xai-effort.ts\";\n"]}
package/dist/index.js CHANGED
@@ -17,5 +17,5 @@ export * from "./utils/overflow.js";
17
17
  export * from "./utils/retry.js";
18
18
  export * from "./utils/typebox-helpers.js";
19
19
  export * from "./utils/validation.js";
20
- export { parseXaiGrok4Minor, withXaiEffortMetadata, XAI_GROK45_THINKING_LEVEL_MAP, XAI_GROK46_THINKING_LEVEL_MAP, } from "./xai-effort.js";
20
+ export { parseXaiGrok4Minor, shouldUseXaiResponsesApi, withXaiEffortMetadata, XAI_GROK45_THINKING_LEVEL_MAP, XAI_GROK46_THINKING_LEVEL_MAP, XAI_RESPONSES_COMPAT, XAI_RESPONSES_EXCLUDED_MODEL_IDS, XAI_RESPONSES_MIN_MINOR, } from "./xai-effort.js";
21
21
  //# 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":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAa/B,cAAc,eAAe,CAAC;AAM9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAShC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,GAC7B,MAAM,iBAAiB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@ashx-j/lunr-ai/providers/*\", API implementations under\n// \"@ashx-j/lunr-ai/api/*\", the old global API under\n// \"@ashx-j/lunr-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport * from \"./types.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport * from \"./utils/overflow.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport * from \"./utils/validation.ts\";\nexport {\n\tparseXaiGrok4Minor,\n\twithXaiEffortMetadata,\n\tXAI_GROK45_THINKING_LEVEL_MAP,\n\tXAI_GROK46_THINKING_LEVEL_MAP,\n} from \"./xai-effort.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAa/B,cAAc,eAAe,CAAC;AAM9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAShC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACN,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,6BAA6B,EAC7B,6BAA6B,EAC7B,oBAAoB,EACpB,gCAAgC,EAChC,uBAAuB,GACvB,MAAM,iBAAiB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@ashx-j/lunr-ai/providers/*\", API implementations under\n// \"@ashx-j/lunr-ai/api/*\", the old global API under\n// \"@ashx-j/lunr-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport * from \"./types.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport * from \"./utils/overflow.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport * from \"./utils/validation.ts\";\nexport {\n\tparseXaiGrok4Minor,\n\tshouldUseXaiResponsesApi,\n\twithXaiEffortMetadata,\n\tXAI_GROK45_THINKING_LEVEL_MAP,\n\tXAI_GROK46_THINKING_LEVEL_MAP,\n\tXAI_RESPONSES_COMPAT,\n\tXAI_RESPONSES_EXCLUDED_MODEL_IDS,\n\tXAI_RESPONSES_MIN_MINOR,\n} from \"./xai-effort.ts\";\n"]}
@@ -1,12 +1,23 @@
1
1
  /**
2
- * xAI Grok 4.x thinking overlays.
2
+ * xAI Grok 4.x thinking and transport overlays.
3
3
  * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.
4
4
  *
5
5
  * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):
6
6
  * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.
7
7
  * - grok-4.6+: low / medium / high / xhigh (cannot disable).
8
+ * - grok-4.5+ uses the Responses API (encrypted thinking, streamed summaries).
9
+ * Older grok-4.x stays on Chat Completions. Named Completions exceptions go in
10
+ * XAI_RESPONSES_EXCLUDED_MODEL_IDS, not a frozen allowlist of current ids.
8
11
  */
9
12
  export declare function parseXaiGrok4Minor(modelId: string): number | undefined;
13
+ /** First Grok 4 minor that uses Responses. grok-4.3 and earlier stay on Completions. */
14
+ export declare const XAI_RESPONSES_MIN_MINOR = 5;
15
+ /** Completions-only exceptions among grok-4.5+ ids. Empty: new flagships default to Responses. */
16
+ export declare const XAI_RESPONSES_EXCLUDED_MODEL_IDS: Set<string>;
17
+ export declare const XAI_RESPONSES_COMPAT: {
18
+ readonly supportsLongCacheRetention: false;
19
+ };
20
+ export declare function shouldUseXaiResponsesApi(modelId: string): boolean;
10
21
  /** off/minimal unsupported; no native xhigh. */
11
22
  export declare const XAI_GROK45_THINKING_LEVEL_MAP: {
12
23
  readonly off: null;
@@ -18,7 +29,10 @@ export declare const XAI_GROK46_THINKING_LEVEL_MAP: {
18
29
  readonly minimal: null;
19
30
  readonly xhigh: "xhigh";
20
31
  };
21
- /** Stamp Grok 4.x effort maps onto any catalog layer so a stale shard cannot hide xhigh. */
32
+ /**
33
+ * Stamp Grok 4.x effort maps and Responses transport onto any catalog layer so a
34
+ * stale shard cannot hide xhigh or keep grok-4.5+ on Chat Completions.
35
+ */
22
36
  export declare function withXaiEffortMetadata<T extends {
23
37
  id: string;
24
38
  provider?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"xai-effort.d.ts","sourceRoot":"","sources":["../src/xai-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKtE;AAED,gDAAgD;AAChD,eAAO,MAAM,6BAA6B;;;CAGhC,CAAC;AAEX,6CAA6C;AAC7C,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC;AAEX,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAsB5G","sourcesContent":["/**\n * xAI Grok 4.x thinking overlays.\n * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.\n *\n * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):\n * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.\n * - grok-4.6+: low / medium / high / xhigh (cannot disable).\n */\nexport function parseXaiGrok4Minor(modelId: string): number | undefined {\n\tconst match = /^grok-(\\d+)\\.(\\d+)/i.exec(modelId);\n\tif (!match) return undefined;\n\tif (Number(match[1]) !== 4) return undefined;\n\treturn Number(match[2]);\n}\n\n/** off/minimal unsupported; no native xhigh. */\nexport const XAI_GROK45_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n} as const;\n\n/** off/minimal unsupported; native xhigh. */\nexport const XAI_GROK46_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n\txhigh: \"xhigh\",\n} as const;\n\n/** Stamp Grok 4.x effort maps onto any catalog layer so a stale shard cannot hide xhigh. */\nexport function withXaiEffortMetadata<T extends { id: string; provider?: string; api?: string }>(model: T): T {\n\tif (model.provider !== \"xai\") return model;\n\tconst minor = parseXaiGrok4Minor(model.id);\n\tconst current = model as T & { thinkingLevelMap?: object; compat?: object };\n\tif (minor === 5) {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },\n\t\t};\n\t}\n\tif (minor !== undefined && minor >= 6) {\n\t\tconst thinkingLevelMap = { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP };\n\t\tif (model.api === \"openai-completions\") {\n\t\t\treturn {\n\t\t\t\t...model,\n\t\t\t\tthinkingLevelMap,\n\t\t\t\tcompat: { ...current.compat, supportsReasoningEffort: true },\n\t\t\t};\n\t\t}\n\t\treturn { ...model, thinkingLevelMap };\n\t}\n\treturn model;\n}\n"]}
1
+ {"version":3,"file":"xai-effort.d.ts","sourceRoot":"","sources":["../src/xai-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKtE;AAED,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,kGAAkG;AAClG,eAAO,MAAM,gCAAgC,aAAoB,CAAC;AAElE,eAAO,MAAM,oBAAoB;;CAEvB,CAAC;AAEX,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIjE;AAED,gDAAgD;AAChD,eAAO,MAAM,6BAA6B;;;CAGhC,CAAC;AAEX,6CAA6C;AAC7C,eAAO,MAAM,6BAA6B;;;;CAIhC,CAAC;AAeX;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAmC5G","sourcesContent":["/**\n * xAI Grok 4.x thinking and transport overlays.\n * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.\n *\n * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):\n * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.\n * - grok-4.6+: low / medium / high / xhigh (cannot disable).\n * - grok-4.5+ uses the Responses API (encrypted thinking, streamed summaries).\n * Older grok-4.x stays on Chat Completions. Named Completions exceptions go in\n * XAI_RESPONSES_EXCLUDED_MODEL_IDS, not a frozen allowlist of current ids.\n */\nexport function parseXaiGrok4Minor(modelId: string): number | undefined {\n\tconst match = /^grok-(\\d+)\\.(\\d+)/i.exec(modelId);\n\tif (!match) return undefined;\n\tif (Number(match[1]) !== 4) return undefined;\n\treturn Number(match[2]);\n}\n\n/** First Grok 4 minor that uses Responses. grok-4.3 and earlier stay on Completions. */\nexport const XAI_RESPONSES_MIN_MINOR = 5;\n\n/** Completions-only exceptions among grok-4.5+ ids. Empty: new flagships default to Responses. */\nexport const XAI_RESPONSES_EXCLUDED_MODEL_IDS = new Set<string>();\n\nexport const XAI_RESPONSES_COMPAT = {\n\tsupportsLongCacheRetention: false,\n} as const;\n\nexport function shouldUseXaiResponsesApi(modelId: string): boolean {\n\tif (XAI_RESPONSES_EXCLUDED_MODEL_IDS.has(modelId)) return false;\n\tconst minor = parseXaiGrok4Minor(modelId);\n\treturn minor !== undefined && minor >= XAI_RESPONSES_MIN_MINOR;\n}\n\n/** off/minimal unsupported; no native xhigh. */\nexport const XAI_GROK45_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n} as const;\n\n/** off/minimal unsupported; native xhigh. */\nexport const XAI_GROK46_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n\txhigh: \"xhigh\",\n} as const;\n\ntype XaiOverlayModel = {\n\tid: string;\n\tprovider?: string;\n\tapi?: string;\n\tthinkingLevelMap?: object;\n\tcompat?: object;\n};\n\nfunction thinkingLevelMapForMinor(minor: number): object {\n\tif (minor === 5) return XAI_GROK45_THINKING_LEVEL_MAP;\n\treturn XAI_GROK46_THINKING_LEVEL_MAP;\n}\n\n/**\n * Stamp Grok 4.x effort maps and Responses transport onto any catalog layer so a\n * stale shard cannot hide xhigh or keep grok-4.5+ on Chat Completions.\n */\nexport function withXaiEffortMetadata<T extends { id: string; provider?: string; api?: string }>(model: T): T {\n\tif (model.provider !== \"xai\") return model;\n\tconst minor = parseXaiGrok4Minor(model.id);\n\tconst current = model as T & XaiOverlayModel;\n\tif (shouldUseXaiResponsesApi(model.id) && minor !== undefined) {\n\t\tconst thinkingLevelMap = { ...current.thinkingLevelMap, ...thinkingLevelMapForMinor(minor) };\n\t\tif (model.api === \"openai-responses\") {\n\t\t\treturn {\n\t\t\t\t...model,\n\t\t\t\tthinkingLevelMap,\n\t\t\t\tcompat: { ...current.compat, ...XAI_RESPONSES_COMPAT },\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...model,\n\t\t\tapi: \"openai-responses\",\n\t\t\tthinkingLevelMap,\n\t\t\t// Completions compat (supportsDeveloperRole: false, ) must not leak onto Responses.\n\t\t\tcompat: { ...XAI_RESPONSES_COMPAT },\n\t\t};\n\t}\n\tif (minor !== undefined && minor >= 6 && model.api === \"openai-completions\") {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP },\n\t\t\tcompat: { ...current.compat, supportsReasoningEffort: true },\n\t\t};\n\t}\n\tif (minor === 5) {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },\n\t\t};\n\t}\n\treturn model;\n}\n"]}
@@ -1,10 +1,13 @@
1
1
  /**
2
- * xAI Grok 4.x thinking overlays.
2
+ * xAI Grok 4.x thinking and transport overlays.
3
3
  * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.
4
4
  *
5
5
  * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):
6
6
  * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.
7
7
  * - grok-4.6+: low / medium / high / xhigh (cannot disable).
8
+ * - grok-4.5+ uses the Responses API (encrypted thinking, streamed summaries).
9
+ * Older grok-4.x stays on Chat Completions. Named Completions exceptions go in
10
+ * XAI_RESPONSES_EXCLUDED_MODEL_IDS, not a frozen allowlist of current ids.
8
11
  */
9
12
  export function parseXaiGrok4Minor(modelId) {
10
13
  const match = /^grok-(\d+)\.(\d+)/i.exec(modelId);
@@ -14,6 +17,19 @@ export function parseXaiGrok4Minor(modelId) {
14
17
  return undefined;
15
18
  return Number(match[2]);
16
19
  }
20
+ /** First Grok 4 minor that uses Responses. grok-4.3 and earlier stay on Completions. */
21
+ export const XAI_RESPONSES_MIN_MINOR = 5;
22
+ /** Completions-only exceptions among grok-4.5+ ids. Empty: new flagships default to Responses. */
23
+ export const XAI_RESPONSES_EXCLUDED_MODEL_IDS = new Set();
24
+ export const XAI_RESPONSES_COMPAT = {
25
+ supportsLongCacheRetention: false,
26
+ };
27
+ export function shouldUseXaiResponsesApi(modelId) {
28
+ if (XAI_RESPONSES_EXCLUDED_MODEL_IDS.has(modelId))
29
+ return false;
30
+ const minor = parseXaiGrok4Minor(modelId);
31
+ return minor !== undefined && minor >= XAI_RESPONSES_MIN_MINOR;
32
+ }
17
33
  /** off/minimal unsupported; no native xhigh. */
18
34
  export const XAI_GROK45_THINKING_LEVEL_MAP = {
19
35
  off: null,
@@ -25,28 +41,49 @@ export const XAI_GROK46_THINKING_LEVEL_MAP = {
25
41
  minimal: null,
26
42
  xhigh: "xhigh",
27
43
  };
28
- /** Stamp Grok 4.x effort maps onto any catalog layer so a stale shard cannot hide xhigh. */
44
+ function thinkingLevelMapForMinor(minor) {
45
+ if (minor === 5)
46
+ return XAI_GROK45_THINKING_LEVEL_MAP;
47
+ return XAI_GROK46_THINKING_LEVEL_MAP;
48
+ }
49
+ /**
50
+ * Stamp Grok 4.x effort maps and Responses transport onto any catalog layer so a
51
+ * stale shard cannot hide xhigh or keep grok-4.5+ on Chat Completions.
52
+ */
29
53
  export function withXaiEffortMetadata(model) {
30
54
  if (model.provider !== "xai")
31
55
  return model;
32
56
  const minor = parseXaiGrok4Minor(model.id);
33
57
  const current = model;
34
- if (minor === 5) {
35
- return {
36
- ...model,
37
- thinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },
38
- };
39
- }
40
- if (minor !== undefined && minor >= 6) {
41
- const thinkingLevelMap = { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP };
42
- if (model.api === "openai-completions") {
58
+ if (shouldUseXaiResponsesApi(model.id) && minor !== undefined) {
59
+ const thinkingLevelMap = { ...current.thinkingLevelMap, ...thinkingLevelMapForMinor(minor) };
60
+ if (model.api === "openai-responses") {
43
61
  return {
44
62
  ...model,
45
63
  thinkingLevelMap,
46
- compat: { ...current.compat, supportsReasoningEffort: true },
64
+ compat: { ...current.compat, ...XAI_RESPONSES_COMPAT },
47
65
  };
48
66
  }
49
- return { ...model, thinkingLevelMap };
67
+ return {
68
+ ...model,
69
+ api: "openai-responses",
70
+ thinkingLevelMap,
71
+ // Completions compat (supportsDeveloperRole: false, …) must not leak onto Responses.
72
+ compat: { ...XAI_RESPONSES_COMPAT },
73
+ };
74
+ }
75
+ if (minor !== undefined && minor >= 6 && model.api === "openai-completions") {
76
+ return {
77
+ ...model,
78
+ thinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP },
79
+ compat: { ...current.compat, supportsReasoningEffort: true },
80
+ };
81
+ }
82
+ if (minor === 5) {
83
+ return {
84
+ ...model,
85
+ thinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },
86
+ };
50
87
  }
51
88
  return model;
52
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"xai-effort.js","sourceRoot":"","sources":["../src/xai-effort.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAsB;IACvE,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAAA,CACxB;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,IAAI;CACJ,CAAC;AAEX,6CAA6C;AAC7C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,OAAO;CACL,CAAC;AAEX,4FAA4F;AAC5F,MAAM,UAAU,qBAAqB,CAA4D,KAAQ,EAAK;IAC7G,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,KAA2D,CAAC;IAC5E,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO;YACN,GAAG,KAAK;YACR,gBAAgB,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,6BAA6B,EAAE;SACnF,CAAC;IACH,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,gBAAgB,GAAG,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,6BAA6B,EAAE,CAAC;QAC3F,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,EAAE,CAAC;YACxC,OAAO;gBACN,GAAG,KAAK;gBACR,gBAAgB;gBAChB,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE;aAC5D,CAAC;QACH,CAAC;QACD,OAAO,EAAE,GAAG,KAAK,EAAE,gBAAgB,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AAAA,CACb","sourcesContent":["/**\n * xAI Grok 4.x thinking overlays.\n * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.\n *\n * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):\n * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.\n * - grok-4.6+: low / medium / high / xhigh (cannot disable).\n */\nexport function parseXaiGrok4Minor(modelId: string): number | undefined {\n\tconst match = /^grok-(\\d+)\\.(\\d+)/i.exec(modelId);\n\tif (!match) return undefined;\n\tif (Number(match[1]) !== 4) return undefined;\n\treturn Number(match[2]);\n}\n\n/** off/minimal unsupported; no native xhigh. */\nexport const XAI_GROK45_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n} as const;\n\n/** off/minimal unsupported; native xhigh. */\nexport const XAI_GROK46_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n\txhigh: \"xhigh\",\n} as const;\n\n/** Stamp Grok 4.x effort maps onto any catalog layer so a stale shard cannot hide xhigh. */\nexport function withXaiEffortMetadata<T extends { id: string; provider?: string; api?: string }>(model: T): T {\n\tif (model.provider !== \"xai\") return model;\n\tconst minor = parseXaiGrok4Minor(model.id);\n\tconst current = model as T & { thinkingLevelMap?: object; compat?: object };\n\tif (minor === 5) {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },\n\t\t};\n\t}\n\tif (minor !== undefined && minor >= 6) {\n\t\tconst thinkingLevelMap = { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP };\n\t\tif (model.api === \"openai-completions\") {\n\t\t\treturn {\n\t\t\t\t...model,\n\t\t\t\tthinkingLevelMap,\n\t\t\t\tcompat: { ...current.compat, supportsReasoningEffort: true },\n\t\t\t};\n\t\t}\n\t\treturn { ...model, thinkingLevelMap };\n\t}\n\treturn model;\n}\n"]}
1
+ {"version":3,"file":"xai-effort.js","sourceRoot":"","sources":["../src/xai-effort.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * xAI Grok 4.x thinking and transport overlays.\n * Used by generate-models.ts. Do not hand-edit catalog JSON for these maps.\n *\n * Docs (https://docs.x.ai/developers/model-capabilities/text/reasoning):\n * - grok-4.5: low / medium / high (cannot disable). xhigh is treated as high.\n * - grok-4.6+: low / medium / high / xhigh (cannot disable).\n * - grok-4.5+ uses the Responses API (encrypted thinking, streamed summaries).\n * Older grok-4.x stays on Chat Completions. Named Completions exceptions go in\n * XAI_RESPONSES_EXCLUDED_MODEL_IDS, not a frozen allowlist of current ids.\n */\nexport function parseXaiGrok4Minor(modelId: string): number | undefined {\n\tconst match = /^grok-(\\d+)\\.(\\d+)/i.exec(modelId);\n\tif (!match) return undefined;\n\tif (Number(match[1]) !== 4) return undefined;\n\treturn Number(match[2]);\n}\n\n/** First Grok 4 minor that uses Responses. grok-4.3 and earlier stay on Completions. */\nexport const XAI_RESPONSES_MIN_MINOR = 5;\n\n/** Completions-only exceptions among grok-4.5+ ids. Empty: new flagships default to Responses. */\nexport const XAI_RESPONSES_EXCLUDED_MODEL_IDS = new Set<string>();\n\nexport const XAI_RESPONSES_COMPAT = {\n\tsupportsLongCacheRetention: false,\n} as const;\n\nexport function shouldUseXaiResponsesApi(modelId: string): boolean {\n\tif (XAI_RESPONSES_EXCLUDED_MODEL_IDS.has(modelId)) return false;\n\tconst minor = parseXaiGrok4Minor(modelId);\n\treturn minor !== undefined && minor >= XAI_RESPONSES_MIN_MINOR;\n}\n\n/** off/minimal unsupported; no native xhigh. */\nexport const XAI_GROK45_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n} as const;\n\n/** off/minimal unsupported; native xhigh. */\nexport const XAI_GROK46_THINKING_LEVEL_MAP = {\n\toff: null,\n\tminimal: null,\n\txhigh: \"xhigh\",\n} as const;\n\ntype XaiOverlayModel = {\n\tid: string;\n\tprovider?: string;\n\tapi?: string;\n\tthinkingLevelMap?: object;\n\tcompat?: object;\n};\n\nfunction thinkingLevelMapForMinor(minor: number): object {\n\tif (minor === 5) return XAI_GROK45_THINKING_LEVEL_MAP;\n\treturn XAI_GROK46_THINKING_LEVEL_MAP;\n}\n\n/**\n * Stamp Grok 4.x effort maps and Responses transport onto any catalog layer so a\n * stale shard cannot hide xhigh or keep grok-4.5+ on Chat Completions.\n */\nexport function withXaiEffortMetadata<T extends { id: string; provider?: string; api?: string }>(model: T): T {\n\tif (model.provider !== \"xai\") return model;\n\tconst minor = parseXaiGrok4Minor(model.id);\n\tconst current = model as T & XaiOverlayModel;\n\tif (shouldUseXaiResponsesApi(model.id) && minor !== undefined) {\n\t\tconst thinkingLevelMap = { ...current.thinkingLevelMap, ...thinkingLevelMapForMinor(minor) };\n\t\tif (model.api === \"openai-responses\") {\n\t\t\treturn {\n\t\t\t\t...model,\n\t\t\t\tthinkingLevelMap,\n\t\t\t\tcompat: { ...current.compat, ...XAI_RESPONSES_COMPAT },\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...model,\n\t\t\tapi: \"openai-responses\",\n\t\t\tthinkingLevelMap,\n\t\t\t// Completions compat (supportsDeveloperRole: false, ) must not leak onto Responses.\n\t\t\tcompat: { ...XAI_RESPONSES_COMPAT },\n\t\t};\n\t}\n\tif (minor !== undefined && minor >= 6 && model.api === \"openai-completions\") {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK46_THINKING_LEVEL_MAP },\n\t\t\tcompat: { ...current.compat, supportsReasoningEffort: true },\n\t\t};\n\t}\n\tif (minor === 5) {\n\t\treturn {\n\t\t\t...model,\n\t\t\tthinkingLevelMap: { ...current.thinkingLevelMap, ...XAI_GROK45_THINKING_LEVEL_MAP },\n\t\t};\n\t}\n\treturn model;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ashx-j/lunr-ai",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",