@theokit/sdk 4.13.1 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/{cron-C7catiH8.d.ts → cron-DY0uC1ng.d.ts} +7 -0
- package/dist/{cron-DK1WVZnI.d.cts → cron-ElTj1cSH.d.cts} +7 -0
- package/dist/cron.cjs +134 -8
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +134 -8
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +134 -8
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +134 -8
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +134 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +134 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/openai.d.ts +1 -0
- package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
- package/dist/internal/providers/builtin/cohere.d.ts +6 -0
- package/dist/internal/providers/builtin/deepinfra.d.ts +2 -0
- package/dist/internal/providers/builtin/google.d.ts +6 -0
- package/dist/internal/providers/builtin/groq.d.ts +2 -0
- package/dist/internal/providers/builtin/mistral.d.ts +2 -0
- package/dist/internal/providers/builtin/openai-compatible.d.ts +1 -0
- package/dist/internal/providers/builtin/perplexity.d.ts +5 -0
- package/dist/internal/providers/builtin/together.d.ts +2 -0
- package/dist/internal/providers/builtin/xai.d.ts +2 -0
- package/dist/models.cjs +116 -2
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +116 -2
- package/dist/models.js.map +1 -1
- package/dist/provider-catalog.json +467 -143
- package/dist/types/provider-profile.d.ts +7 -0
- 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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
@@ -14000,7 +14000,13 @@ var ANTHROPIC = {
|
|
|
14000
14000
|
baseUrl: "https://api.anthropic.com",
|
|
14001
14001
|
modelsUrl: "https://api.anthropic.com/v1/models",
|
|
14002
14002
|
hostname: "api.anthropic.com",
|
|
14003
|
-
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
|
+
}
|
|
14004
14010
|
};
|
|
14005
14011
|
|
|
14006
14012
|
// src/internal/providers/builtin/bedrock.ts
|
|
@@ -14035,6 +14041,101 @@ function resolveBedrockBaseUrl(modelId) {
|
|
|
14035
14041
|
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
14036
14042
|
}
|
|
14037
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
|
+
|
|
14038
14139
|
// src/internal/providers/builtin/gemini.ts
|
|
14039
14140
|
var GEMINI = {
|
|
14040
14141
|
name: "gemini",
|
|
@@ -14459,7 +14560,11 @@ var OPENROUTER = {
|
|
|
14459
14560
|
baseUrl: "https://openrouter.ai/api",
|
|
14460
14561
|
modelsUrl: "https://openrouter.ai/api/v1/models",
|
|
14461
14562
|
hostname: "openrouter.ai",
|
|
14462
|
-
|
|
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" }
|
|
14463
14568
|
};
|
|
14464
14569
|
|
|
14465
14570
|
// src/internal/providers/builtin/vertex.ts
|
|
@@ -14508,6 +14613,15 @@ function registerBuiltins() {
|
|
|
14508
14613
|
registerProvider(LLAMACPP);
|
|
14509
14614
|
registerProvider(BEDROCK);
|
|
14510
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);
|
|
14511
14625
|
registerCatalogProviders();
|
|
14512
14626
|
}
|
|
14513
14627
|
|
|
@@ -14776,14 +14890,16 @@ var AnthropicClient = class {
|
|
|
14776
14890
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
|
|
14777
14891
|
async *stream(request, signal) {
|
|
14778
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);
|
|
14779
14899
|
const response = await this.fetchImpl(`${this.baseUrl}/v1/messages`, {
|
|
14780
14900
|
method: "POST",
|
|
14781
14901
|
signal,
|
|
14782
|
-
headers
|
|
14783
|
-
"content-type": "application/json",
|
|
14784
|
-
"x-api-key": this.options.apiKey,
|
|
14785
|
-
"anthropic-version": this.options.version ?? "2023-06-01"
|
|
14786
|
-
},
|
|
14902
|
+
headers,
|
|
14787
14903
|
body: JSON.stringify(body)
|
|
14788
14904
|
});
|
|
14789
14905
|
if (!response.ok) {
|
|
@@ -15660,11 +15776,13 @@ var OpenAIClient = class {
|
|
|
15660
15776
|
constructor(options) {
|
|
15661
15777
|
this.options = options;
|
|
15662
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");
|
|
15663
15780
|
this.fetchImpl = options.fetch ?? fetch;
|
|
15664
15781
|
}
|
|
15665
15782
|
options;
|
|
15666
15783
|
name = "openai";
|
|
15667
15784
|
baseUrl;
|
|
15785
|
+
chatPath;
|
|
15668
15786
|
fetchImpl;
|
|
15669
15787
|
/**
|
|
15670
15788
|
* Whether this client recovers leaked Hermes tool-call dialect from assistant
|
|
@@ -15687,7 +15805,7 @@ var OpenAIClient = class {
|
|
|
15687
15805
|
const providerId = this.options.providerName ?? this.name;
|
|
15688
15806
|
let response;
|
|
15689
15807
|
try {
|
|
15690
|
-
response = await this.fetchImpl(`${this.baseUrl}
|
|
15808
|
+
response = await this.fetchImpl(`${this.baseUrl}${this.chatPath}`, {
|
|
15691
15809
|
method: "POST",
|
|
15692
15810
|
signal,
|
|
15693
15811
|
headers,
|
|
@@ -16784,6 +16902,9 @@ function selectTransport(profile, apiKey) {
|
|
|
16784
16902
|
if (profile.extractToolCallsFromContent === true) {
|
|
16785
16903
|
opts.extractToolCallsFromContent = true;
|
|
16786
16904
|
}
|
|
16905
|
+
if (profile.chatCompletionsPath !== void 0) {
|
|
16906
|
+
opts.chatCompletionsPath = profile.chatCompletionsPath;
|
|
16907
|
+
}
|
|
16787
16908
|
if (profile.name === "openai" && process.env.OPENAI_ORGANIZATION !== void 0) {
|
|
16788
16909
|
opts.organization = process.env.OPENAI_ORGANIZATION;
|
|
16789
16910
|
}
|
|
@@ -16803,6 +16924,11 @@ function selectTransport(profile, apiKey) {
|
|
|
16803
16924
|
}
|
|
16804
16925
|
const opts = { apiKey };
|
|
16805
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;
|
|
16806
16932
|
return new AnthropicClient(opts);
|
|
16807
16933
|
}
|
|
16808
16934
|
if (profile.apiMode === "bedrock_anthropic") {
|