@theokit/sdk 4.13.0 → 4.14.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{cron-C7catiH8.d.ts → cron-DY0uC1ng.d.ts} +7 -0
  3. package/dist/{cron-DK1WVZnI.d.cts → cron-ElTj1cSH.d.cts} +7 -0
  4. package/dist/cron.cjs +183 -20
  5. package/dist/cron.cjs.map +1 -1
  6. package/dist/cron.d.cts +1 -1
  7. package/dist/cron.d.ts +1 -1
  8. package/dist/cron.js +183 -20
  9. package/dist/cron.js.map +1 -1
  10. package/dist/eval.cjs +183 -20
  11. package/dist/eval.cjs.map +1 -1
  12. package/dist/eval.js +183 -20
  13. package/dist/eval.js.map +1 -1
  14. package/dist/index.cjs +183 -20
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +183 -20
  19. package/dist/index.js.map +1 -1
  20. package/dist/internal/llm/openai.d.ts +1 -0
  21. package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
  22. package/dist/internal/providers/builtin/cohere.d.ts +6 -0
  23. package/dist/internal/providers/builtin/deepinfra.d.ts +2 -0
  24. package/dist/internal/providers/builtin/google.d.ts +6 -0
  25. package/dist/internal/providers/builtin/groq.d.ts +2 -0
  26. package/dist/internal/providers/builtin/mistral.d.ts +2 -0
  27. package/dist/internal/providers/builtin/openai-compatible.d.ts +1 -0
  28. package/dist/internal/providers/builtin/perplexity.d.ts +5 -0
  29. package/dist/internal/providers/builtin/together.d.ts +2 -0
  30. package/dist/internal/providers/builtin/xai.d.ts +2 -0
  31. package/dist/models.cjs +753 -17
  32. package/dist/models.cjs.map +1 -1
  33. package/dist/models.js +754 -18
  34. package/dist/models.js.map +1 -1
  35. package/dist/provider-catalog.json +473 -146
  36. package/dist/types/provider-profile.d.ts +7 -0
  37. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-gE8612p9.cjs';
2
2
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-gE8612p9.cjs';
3
- import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-DK1WVZnI.cjs';
4
- export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-DK1WVZnI.cjs';
3
+ import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-ElTj1cSH.cjs';
4
+ export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-ElTj1cSH.cjs';
5
5
  import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-DFM1H2jW.cjs';
6
6
  export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-DFM1H2jW.cjs';
7
7
  import * as zod from 'zod';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-CG2RpeW-.js';
2
2
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-CG2RpeW-.js';
3
- import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-C7catiH8.js';
4
- export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-C7catiH8.js';
3
+ import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, B as BudgetTracker, n as MemoryProvider, o as MemoryId, p as PreToolCallDecision, q as StepResult, r as SDKProvider } from './cron-DY0uC1ng.js';
4
+ export { s as ActiveMemoryPassArgs, t as ActiveMemoryPassResult, u as AgentMemory, v as BudgetCheck, w as BudgetTotal, x as BudgetUsageEvent, y as CloudEnv, z as CloudRepo, D as ContextBudget, E as ContextManagerKind, F as ContextSnapshot, H as ContextSource, J as ContextSourceStatus, K as CreateSkillSpec, N as Cron, O as CronCreateOptions, Q as CronGetOptions, R as CronJob, T as CronJobStatus, U as CronListOptions, V as CronOperationOptions, W as CronRunOptions, X as CronRuntime, Y as CronSchedulerStatus, Z as CronStartOptions, _ as GoalEvent, $ as GoalOptions, a0 as GoalResult, a1 as HookName, a2 as InvalidateCacheOptions, a3 as MemoryAdapter, a4 as MemoryAdapterCapabilities, a5 as MemoryContext, a6 as MemoryFact, a7 as MemoryProviderHandle, a8 as MemoryProviderInitOptions, a9 as MemoryRevision, aa as MemoryToolSchema, ab as MemoryTurnMessage, ac as PersonalityPreset, ad as PluginContext, ae as PostAssistantReplyContext, af as PreToolCallContext, ag as PreUserSendContext, ah as PreUserSendResult, ai as ProviderCapability, aj as ProviderRoute, ak as ProviderTransform, al as ProviderTransformContext, am as RecordSessionSummaryArgs, an as ResolvedProviderRoute, ao as RunUntilIterator, ap as SDKAgentPlugins, aq as SDKAgentSkillDetail, ar as SDKAgentSkills, as as SDKArtifact, at as SDKContextManager, au as SDKPluginMetadata, av as SDKProvidersManager, aw as SessionRecord, ax as SessionStore, ay as SettingSource, az as Skill, aA as SkillsResolver, aB as SkillsResolverContext, aC as SystemPromptContext, aD as SystemPromptMemoryFact, aE as SystemPromptSkillRef, aF as TelemetrySettings } from './cron-DY0uC1ng.js';
5
5
  import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-DFM1H2jW.js';
6
6
  export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-DFM1H2jW.js';
7
7
  import * as zod from 'zod';
package/dist/index.js CHANGED
@@ -13118,8 +13118,17 @@ var catalogModelSchema = z.object({
13118
13118
  }).loose();
13119
13119
 
13120
13120
  // src/internal/providers/registry.ts
13121
- var REGISTRY = /* @__PURE__ */ new Map();
13122
- var ALIASES = /* @__PURE__ */ new Map();
13121
+ function globalSingleton(key2, create) {
13122
+ const g = globalThis;
13123
+ const sym = Symbol.for(key2);
13124
+ if (g[sym] === void 0) g[sym] = create();
13125
+ return g[sym];
13126
+ }
13127
+ var REGISTRY = globalSingleton(
13128
+ "theokit-sdk.providers.registry",
13129
+ () => /* @__PURE__ */ new Map()
13130
+ );
13131
+ var ALIASES = globalSingleton("theokit-sdk.providers.aliases", () => /* @__PURE__ */ new Map());
13123
13132
  function registerProvider(profile) {
13124
13133
  if (REGISTRY.has(profile.name)) {
13125
13134
  process.stderr.write(`[theokit-sdk] Provider "${profile.name}" overridden by user plugin.
@@ -13147,18 +13156,43 @@ function listProviders() {
13147
13156
 
13148
13157
  // src/internal/providers/catalog-loader.ts
13149
13158
  var __dirname_resolved = dirname(fileURLToPath(import.meta.url));
13150
- var modelInfoIndex = /* @__PURE__ */ new Map();
13159
+ function globalSingleton2(key2, create) {
13160
+ const g = globalThis;
13161
+ const sym = Symbol.for(key2);
13162
+ if (g[sym] === void 0) g[sym] = create();
13163
+ return g[sym];
13164
+ }
13165
+ var modelInfoIndex = globalSingleton2(
13166
+ "theokit-sdk.providers.model-info-index",
13167
+ () => /* @__PURE__ */ new Map()
13168
+ );
13169
+ var patchedModelKeys = globalSingleton2(
13170
+ "theokit-sdk.providers.model-info-patched",
13171
+ () => /* @__PURE__ */ new Set()
13172
+ );
13173
+ var indexState = globalSingleton2("theokit-sdk.providers.model-info-loaded", () => ({
13174
+ loaded: false
13175
+ }));
13151
13176
  function getCatalogModelInfo(key2) {
13152
13177
  ensureModelIndexLoaded();
13153
13178
  return modelInfoIndex.get(key2);
13154
13179
  }
13155
- var _modelIndexLoaded = false;
13180
+ function isPatchedModelKey(key2) {
13181
+ return patchedModelKeys.has(key2);
13182
+ }
13156
13183
  function ensureModelIndexLoaded() {
13157
- if (_modelIndexLoaded) return;
13158
- _modelIndexLoaded = true;
13159
- const catalog = loadProviderCatalog();
13160
- for (const entry of Object.values(catalog)) {
13161
- indexEntryModels(entry);
13184
+ if (indexState.loaded) return;
13185
+ indexState.loaded = true;
13186
+ try {
13187
+ const catalog = loadProviderCatalog();
13188
+ for (const entry of Object.values(catalog)) {
13189
+ indexEntryModels(entry);
13190
+ }
13191
+ } catch (err) {
13192
+ process.stderr.write(
13193
+ `[theokit-sdk] WARN: provider catalog unavailable (${err.message}) \u2014 per-model data disabled
13194
+ `
13195
+ );
13162
13196
  }
13163
13197
  }
13164
13198
  function indexEntryModels(entry) {
@@ -13422,8 +13456,10 @@ function getPricingEntry(opts) {
13422
13456
  return void 0;
13423
13457
  }
13424
13458
  function catalogCostFallback(provider, cleanedModel) {
13425
- const keys = [`${provider}/${cleanedModel}`, cleanedModel];
13426
- for (const key2 of keys) {
13459
+ const stripped = stripDateSuffix(cleanedModel);
13460
+ const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
13461
+ if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
13462
+ for (const key2 of candidates) {
13427
13463
  const info = getCatalogModelInfo(key2);
13428
13464
  const cost = info?.cost;
13429
13465
  if (cost === void 0) continue;
@@ -13435,7 +13471,8 @@ function catalogCostFallback(provider, cleanedModel) {
13435
13471
  outputCostPerMillion: cost.output,
13436
13472
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
13437
13473
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
13438
- pricingVersion: "catalog-vendored"
13474
+ // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
13475
+ pricingVersion: isPatchedModelKey(key2) ? "catalog-models-dev" : "catalog-vendored"
13439
13476
  };
13440
13477
  }
13441
13478
  return void 0;
@@ -13963,7 +14000,13 @@ var ANTHROPIC = {
13963
14000
  baseUrl: "https://api.anthropic.com",
13964
14001
  modelsUrl: "https://api.anthropic.com/v1/models",
13965
14002
  hostname: "api.anthropic.com",
13966
- fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"]
14003
+ fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"],
14004
+ // M45 — the Anthropic beta-features header (interleaved thinking + fine-grained tool streaming). An
14005
+ // Anthropic API constant, adapted verbatim from OpenCode's anthropic plugin (MIT © 2025 opencode). The
14006
+ // SANCTIONED behavior delta of M45 (ADR D4) — consumed by the anthropic transport's extraHeaders wiring.
14007
+ extraHeaders: {
14008
+ "anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"
14009
+ }
13967
14010
  };
13968
14011
 
13969
14012
  // src/internal/providers/builtin/bedrock.ts
@@ -13998,6 +14041,101 @@ function resolveBedrockBaseUrl(modelId) {
13998
14041
  return `https://bedrock-runtime.${region}.amazonaws.com`;
13999
14042
  }
14000
14043
 
14044
+ // src/internal/providers/builtin/openai-compatible.ts
14045
+ function openAiCompatibleProfile(p) {
14046
+ return {
14047
+ apiMode: "chat_completions",
14048
+ authType: "api_key",
14049
+ fallbackModels: [],
14050
+ ...p
14051
+ };
14052
+ }
14053
+
14054
+ // src/internal/providers/builtin/cerebras.ts
14055
+ var CEREBRAS = openAiCompatibleProfile({
14056
+ name: "cerebras",
14057
+ baseUrl: "https://api.cerebras.ai/v1",
14058
+ envVars: ["CEREBRAS_API_KEY"],
14059
+ fallbackModels: ["gpt-oss-120b", "zai-glm-4.7"],
14060
+ extraHeaders: { "X-Cerebras-3rd-Party-Integration": "theokit" },
14061
+ hostname: "api.cerebras.ai"
14062
+ });
14063
+
14064
+ // src/internal/providers/builtin/cohere.ts
14065
+ var COHERE = openAiCompatibleProfile({
14066
+ name: "cohere",
14067
+ baseUrl: "https://api.cohere.ai/compatibility/v1",
14068
+ envVars: ["COHERE_API_KEY", "CO_API_KEY"],
14069
+ fallbackModels: ["command-a-03-2025"],
14070
+ hostname: "api.cohere.ai"
14071
+ });
14072
+
14073
+ // src/internal/providers/builtin/deepinfra.ts
14074
+ var DEEPINFRA = openAiCompatibleProfile({
14075
+ name: "deepinfra",
14076
+ baseUrl: "https://api.deepinfra.com/v1/openai",
14077
+ envVars: ["DEEPINFRA_API_KEY"],
14078
+ fallbackModels: ["Qwen/Qwen3-32B"],
14079
+ hostname: "api.deepinfra.com"
14080
+ });
14081
+
14082
+ // src/internal/providers/builtin/google.ts
14083
+ var GOOGLE = openAiCompatibleProfile({
14084
+ name: "google",
14085
+ baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
14086
+ envVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY"],
14087
+ fallbackModels: ["gemini-2.5-pro", "gemini-2.5-flash"],
14088
+ hostname: "generativelanguage.googleapis.com"
14089
+ });
14090
+
14091
+ // src/internal/providers/builtin/groq.ts
14092
+ var GROQ = openAiCompatibleProfile({
14093
+ name: "groq",
14094
+ baseUrl: "https://api.groq.com/openai/v1",
14095
+ envVars: ["GROQ_API_KEY"],
14096
+ fallbackModels: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant"],
14097
+ hostname: "api.groq.com"
14098
+ });
14099
+
14100
+ // src/internal/providers/builtin/mistral.ts
14101
+ var MISTRAL = openAiCompatibleProfile({
14102
+ name: "mistral",
14103
+ baseUrl: "https://api.mistral.ai/v1",
14104
+ envVars: ["MISTRAL_API_KEY"],
14105
+ fallbackModels: ["mistral-large-latest", "codestral-latest"],
14106
+ hostname: "api.mistral.ai"
14107
+ });
14108
+
14109
+ // src/internal/providers/builtin/perplexity.ts
14110
+ var PERPLEXITY = openAiCompatibleProfile({
14111
+ name: "perplexity",
14112
+ baseUrl: "https://api.perplexity.ai",
14113
+ chatCompletionsPath: "/chat/completions",
14114
+ envVars: ["PERPLEXITY_API_KEY"],
14115
+ fallbackModels: ["sonar-pro", "sonar"],
14116
+ hostname: "api.perplexity.ai"
14117
+ });
14118
+
14119
+ // src/internal/providers/builtin/together.ts
14120
+ var TOGETHER = openAiCompatibleProfile({
14121
+ name: "together",
14122
+ aliases: ["togetherai"],
14123
+ baseUrl: "https://api.together.xyz/v1",
14124
+ envVars: ["TOGETHER_API_KEY"],
14125
+ fallbackModels: ["Qwen/Qwen2.5-7B-Instruct-Turbo"],
14126
+ hostname: "api.together.xyz"
14127
+ });
14128
+
14129
+ // src/internal/providers/builtin/xai.ts
14130
+ var XAI = openAiCompatibleProfile({
14131
+ name: "xai",
14132
+ aliases: ["grok"],
14133
+ baseUrl: "https://api.x.ai/v1",
14134
+ envVars: ["XAI_API_KEY"],
14135
+ fallbackModels: ["grok-4.5", "grok-4.3"],
14136
+ hostname: "api.x.ai"
14137
+ });
14138
+
14001
14139
  // src/internal/providers/builtin/gemini.ts
14002
14140
  var GEMINI = {
14003
14141
  name: "gemini",
@@ -14422,7 +14560,11 @@ var OPENROUTER = {
14422
14560
  baseUrl: "https://openrouter.ai/api",
14423
14561
  modelsUrl: "https://openrouter.ai/api/v1/models",
14424
14562
  hostname: "openrouter.ai",
14425
- fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-3-haiku"]
14563
+ // M45 — models refreshed (claude-3-haiku retired upstream).
14564
+ fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
14565
+ // M45 — OpenRouter app-attribution headers (mechanism from OpenCode's openrouter plugin, MIT; VALUES are
14566
+ // theokit's own — copying another app's referer would misattribute traffic).
14567
+ extraHeaders: { "HTTP-Referer": "https://usetheo.dev", "X-Title": "theokit" }
14426
14568
  };
14427
14569
 
14428
14570
  // src/internal/providers/builtin/vertex.ts
@@ -14471,6 +14613,15 @@ function registerBuiltins() {
14471
14613
  registerProvider(LLAMACPP);
14472
14614
  registerProvider(BEDROCK);
14473
14615
  registerProvider(VERTEX);
14616
+ registerProvider(GOOGLE);
14617
+ registerProvider(MISTRAL);
14618
+ registerProvider(GROQ);
14619
+ registerProvider(COHERE);
14620
+ registerProvider(DEEPINFRA);
14621
+ registerProvider(TOGETHER);
14622
+ registerProvider(XAI);
14623
+ registerProvider(PERPLEXITY);
14624
+ registerProvider(CEREBRAS);
14474
14625
  registerCatalogProviders();
14475
14626
  }
14476
14627
 
@@ -14739,14 +14890,16 @@ var AnthropicClient = class {
14739
14890
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
14740
14891
  async *stream(request, signal) {
14741
14892
  const body = buildAnthropicBody(request);
14893
+ const headers = {
14894
+ "content-type": "application/json",
14895
+ "x-api-key": this.options.apiKey,
14896
+ "anthropic-version": this.options.version ?? "2023-06-01"
14897
+ };
14898
+ if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
14742
14899
  const response = await this.fetchImpl(`${this.baseUrl}/v1/messages`, {
14743
14900
  method: "POST",
14744
14901
  signal,
14745
- headers: {
14746
- "content-type": "application/json",
14747
- "x-api-key": this.options.apiKey,
14748
- "anthropic-version": this.options.version ?? "2023-06-01"
14749
- },
14902
+ headers,
14750
14903
  body: JSON.stringify(body)
14751
14904
  });
14752
14905
  if (!response.ok) {
@@ -15623,11 +15776,13 @@ var OpenAIClient = class {
15623
15776
  constructor(options) {
15624
15777
  this.options = options;
15625
15778
  this.baseUrl = options.baseUrl ?? "https://api.openai.com";
15779
+ this.chatPath = options.chatCompletionsPath ?? (/\/v\d+[a-z]*(\/|$)/.test(new URL(this.baseUrl).pathname) ? "/chat/completions" : "/v1/chat/completions");
15626
15780
  this.fetchImpl = options.fetch ?? fetch;
15627
15781
  }
15628
15782
  options;
15629
15783
  name = "openai";
15630
15784
  baseUrl;
15785
+ chatPath;
15631
15786
  fetchImpl;
15632
15787
  /**
15633
15788
  * Whether this client recovers leaked Hermes tool-call dialect from assistant
@@ -15650,7 +15805,7 @@ var OpenAIClient = class {
15650
15805
  const providerId = this.options.providerName ?? this.name;
15651
15806
  let response;
15652
15807
  try {
15653
- response = await this.fetchImpl(`${this.baseUrl}/v1/chat/completions`, {
15808
+ response = await this.fetchImpl(`${this.baseUrl}${this.chatPath}`, {
15654
15809
  method: "POST",
15655
15810
  signal,
15656
15811
  headers,
@@ -16747,6 +16902,9 @@ function selectTransport(profile, apiKey) {
16747
16902
  if (profile.extractToolCallsFromContent === true) {
16748
16903
  opts.extractToolCallsFromContent = true;
16749
16904
  }
16905
+ if (profile.chatCompletionsPath !== void 0) {
16906
+ opts.chatCompletionsPath = profile.chatCompletionsPath;
16907
+ }
16750
16908
  if (profile.name === "openai" && process.env.OPENAI_ORGANIZATION !== void 0) {
16751
16909
  opts.organization = process.env.OPENAI_ORGANIZATION;
16752
16910
  }
@@ -16766,6 +16924,11 @@ function selectTransport(profile, apiKey) {
16766
16924
  }
16767
16925
  const opts = { apiKey };
16768
16926
  opts.baseUrl = process.env.ANTHROPIC_API_BASE_URL ?? profile.baseUrl;
16927
+ const t = applyTransform();
16928
+ assertOAuthResolved(t);
16929
+ if (t.fetch !== void 0) opts.fetch = t.fetch;
16930
+ const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
16931
+ if (merged !== void 0) opts.extraHeaders = merged;
16769
16932
  return new AnthropicClient(opts);
16770
16933
  }
16771
16934
  if (profile.apiMode === "bedrock_anthropic") {