@theokit/sdk 4.13.1 → 4.14.1
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 +12 -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 +159 -21
- 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 +159 -21
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +159 -21
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +159 -21
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +162 -21
- 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 +162 -21
- package/dist/index.js.map +1 -1
- package/dist/internal/llm/openai.d.ts +29 -0
- package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
- package/dist/internal/providers/builtin/cohere.d.ts +8 -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 +124 -5
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +124 -5
- package/dist/models.js.map +1 -1
- 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
|
@@ -755,13 +755,13 @@ function setAgentFacade(facade) {
|
|
|
755
755
|
globalThis[FACADE_KEY] = facade;
|
|
756
756
|
}
|
|
757
757
|
function getAgentFacade() {
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
758
|
+
const registered2 = globalThis[FACADE_KEY];
|
|
759
|
+
if (registered2 === void 0) {
|
|
760
760
|
throw new Error(
|
|
761
761
|
"internal: Agent facade not registered. The `agent.ts` module must be loaded before internal subsystems (LocalAgent.runUntil/fork, eval, scorers, cron) invoke it."
|
|
762
762
|
);
|
|
763
763
|
}
|
|
764
|
-
return
|
|
764
|
+
return registered2;
|
|
765
765
|
}
|
|
766
766
|
var FACADE_KEY;
|
|
767
767
|
var init_agent_factory_registry = __esm({
|
|
@@ -13244,6 +13244,9 @@ function getCatalogCapabilities(providerId) {
|
|
|
13244
13244
|
_capabilitiesCache = {};
|
|
13245
13245
|
for (const entry of Object.values(catalog)) {
|
|
13246
13246
|
_capabilitiesCache[entry.id] = entry.capabilities;
|
|
13247
|
+
for (const alias of entry.aliases ?? []) {
|
|
13248
|
+
if (_capabilitiesCache[alias] === void 0) _capabilitiesCache[alias] = entry.capabilities;
|
|
13249
|
+
}
|
|
13247
13250
|
}
|
|
13248
13251
|
}
|
|
13249
13252
|
return _capabilitiesCache[providerId];
|
|
@@ -14000,7 +14003,13 @@ var ANTHROPIC = {
|
|
|
14000
14003
|
baseUrl: "https://api.anthropic.com",
|
|
14001
14004
|
modelsUrl: "https://api.anthropic.com/v1/models",
|
|
14002
14005
|
hostname: "api.anthropic.com",
|
|
14003
|
-
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"]
|
|
14006
|
+
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"],
|
|
14007
|
+
// M45 — the Anthropic beta-features header (interleaved thinking + fine-grained tool streaming). An
|
|
14008
|
+
// Anthropic API constant, adapted verbatim from OpenCode's anthropic plugin (MIT © 2025 opencode). The
|
|
14009
|
+
// SANCTIONED behavior delta of M45 (ADR D4) — consumed by the anthropic transport's extraHeaders wiring.
|
|
14010
|
+
extraHeaders: {
|
|
14011
|
+
"anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"
|
|
14012
|
+
}
|
|
14004
14013
|
};
|
|
14005
14014
|
|
|
14006
14015
|
// src/internal/providers/builtin/bedrock.ts
|
|
@@ -14035,6 +14044,44 @@ function resolveBedrockBaseUrl(modelId) {
|
|
|
14035
14044
|
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
14036
14045
|
}
|
|
14037
14046
|
|
|
14047
|
+
// src/internal/providers/builtin/openai-compatible.ts
|
|
14048
|
+
function openAiCompatibleProfile(p) {
|
|
14049
|
+
return {
|
|
14050
|
+
apiMode: "chat_completions",
|
|
14051
|
+
authType: "api_key",
|
|
14052
|
+
fallbackModels: [],
|
|
14053
|
+
...p
|
|
14054
|
+
};
|
|
14055
|
+
}
|
|
14056
|
+
|
|
14057
|
+
// src/internal/providers/builtin/cerebras.ts
|
|
14058
|
+
var CEREBRAS = openAiCompatibleProfile({
|
|
14059
|
+
name: "cerebras",
|
|
14060
|
+
baseUrl: "https://api.cerebras.ai/v1",
|
|
14061
|
+
envVars: ["CEREBRAS_API_KEY"],
|
|
14062
|
+
fallbackModels: ["gpt-oss-120b", "zai-glm-4.7"],
|
|
14063
|
+
extraHeaders: { "X-Cerebras-3rd-Party-Integration": "theokit" },
|
|
14064
|
+
hostname: "api.cerebras.ai"
|
|
14065
|
+
});
|
|
14066
|
+
|
|
14067
|
+
// src/internal/providers/builtin/cohere.ts
|
|
14068
|
+
var COHERE = openAiCompatibleProfile({
|
|
14069
|
+
name: "cohere",
|
|
14070
|
+
baseUrl: "https://api.cohere.ai/compatibility/v1",
|
|
14071
|
+
envVars: ["COHERE_API_KEY", "CO_API_KEY"],
|
|
14072
|
+
fallbackModels: ["command-a-03-2025"],
|
|
14073
|
+
hostname: "api.cohere.ai"
|
|
14074
|
+
});
|
|
14075
|
+
|
|
14076
|
+
// src/internal/providers/builtin/deepinfra.ts
|
|
14077
|
+
var DEEPINFRA = openAiCompatibleProfile({
|
|
14078
|
+
name: "deepinfra",
|
|
14079
|
+
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
14080
|
+
envVars: ["DEEPINFRA_API_KEY"],
|
|
14081
|
+
fallbackModels: ["Qwen/Qwen3-32B"],
|
|
14082
|
+
hostname: "api.deepinfra.com"
|
|
14083
|
+
});
|
|
14084
|
+
|
|
14038
14085
|
// src/internal/providers/builtin/gemini.ts
|
|
14039
14086
|
var GEMINI = {
|
|
14040
14087
|
name: "gemini",
|
|
@@ -14046,6 +14093,24 @@ var GEMINI = {
|
|
|
14046
14093
|
fallbackModels: ["google/gemini-2.0-flash-001"]
|
|
14047
14094
|
};
|
|
14048
14095
|
|
|
14096
|
+
// src/internal/providers/builtin/google.ts
|
|
14097
|
+
var GOOGLE = openAiCompatibleProfile({
|
|
14098
|
+
name: "google",
|
|
14099
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
14100
|
+
envVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
|
|
14101
|
+
fallbackModels: ["gemini-2.5-pro", "gemini-2.5-flash"],
|
|
14102
|
+
hostname: "generativelanguage.googleapis.com"
|
|
14103
|
+
});
|
|
14104
|
+
|
|
14105
|
+
// src/internal/providers/builtin/groq.ts
|
|
14106
|
+
var GROQ = openAiCompatibleProfile({
|
|
14107
|
+
name: "groq",
|
|
14108
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
14109
|
+
envVars: ["GROQ_API_KEY"],
|
|
14110
|
+
fallbackModels: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant"],
|
|
14111
|
+
hostname: "api.groq.com"
|
|
14112
|
+
});
|
|
14113
|
+
|
|
14049
14114
|
// src/internal/providers/builtin/llamacpp.ts
|
|
14050
14115
|
var LLAMACPP = {
|
|
14051
14116
|
name: "llamacpp",
|
|
@@ -14072,6 +14137,15 @@ var LMSTUDIO = {
|
|
|
14072
14137
|
fallbackModels: ["loaded-model"]
|
|
14073
14138
|
};
|
|
14074
14139
|
|
|
14140
|
+
// src/internal/providers/builtin/mistral.ts
|
|
14141
|
+
var MISTRAL = openAiCompatibleProfile({
|
|
14142
|
+
name: "mistral",
|
|
14143
|
+
baseUrl: "https://api.mistral.ai/v1",
|
|
14144
|
+
envVars: ["MISTRAL_API_KEY"],
|
|
14145
|
+
fallbackModels: ["mistral-large-latest", "codestral-latest"],
|
|
14146
|
+
hostname: "api.mistral.ai"
|
|
14147
|
+
});
|
|
14148
|
+
|
|
14075
14149
|
// src/internal/providers/builtin/ollama.ts
|
|
14076
14150
|
var OLLAMA = {
|
|
14077
14151
|
name: "ollama",
|
|
@@ -14459,9 +14533,33 @@ var OPENROUTER = {
|
|
|
14459
14533
|
baseUrl: "https://openrouter.ai/api",
|
|
14460
14534
|
modelsUrl: "https://openrouter.ai/api/v1/models",
|
|
14461
14535
|
hostname: "openrouter.ai",
|
|
14462
|
-
|
|
14536
|
+
// M45 — models refreshed (claude-3-haiku retired upstream).
|
|
14537
|
+
fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
|
|
14538
|
+
// M45 — OpenRouter app-attribution headers (mechanism from OpenCode's openrouter plugin, MIT; VALUES are
|
|
14539
|
+
// theokit's own — copying another app's referer would misattribute traffic).
|
|
14540
|
+
extraHeaders: { "HTTP-Referer": "https://usetheo.dev", "X-Title": "theokit" }
|
|
14463
14541
|
};
|
|
14464
14542
|
|
|
14543
|
+
// src/internal/providers/builtin/perplexity.ts
|
|
14544
|
+
var PERPLEXITY = openAiCompatibleProfile({
|
|
14545
|
+
name: "perplexity",
|
|
14546
|
+
baseUrl: "https://api.perplexity.ai",
|
|
14547
|
+
chatCompletionsPath: "/chat/completions",
|
|
14548
|
+
envVars: ["PERPLEXITY_API_KEY"],
|
|
14549
|
+
fallbackModels: ["sonar-pro", "sonar"],
|
|
14550
|
+
hostname: "api.perplexity.ai"
|
|
14551
|
+
});
|
|
14552
|
+
|
|
14553
|
+
// src/internal/providers/builtin/together.ts
|
|
14554
|
+
var TOGETHER = openAiCompatibleProfile({
|
|
14555
|
+
name: "together",
|
|
14556
|
+
aliases: ["togetherai"],
|
|
14557
|
+
baseUrl: "https://api.together.xyz/v1",
|
|
14558
|
+
envVars: ["TOGETHER_API_KEY"],
|
|
14559
|
+
fallbackModels: ["Qwen/Qwen2.5-7B-Instruct-Turbo"],
|
|
14560
|
+
hostname: "api.together.xyz"
|
|
14561
|
+
});
|
|
14562
|
+
|
|
14465
14563
|
// src/internal/providers/builtin/vertex.ts
|
|
14466
14564
|
var VERTEX = {
|
|
14467
14565
|
name: "vertex",
|
|
@@ -14493,11 +14591,26 @@ function stripVertexPrefix(modelId) {
|
|
|
14493
14591
|
return modelId.replace(/^vertex\/(anthropic|google)\//, "");
|
|
14494
14592
|
}
|
|
14495
14593
|
|
|
14594
|
+
// src/internal/providers/builtin/xai.ts
|
|
14595
|
+
var XAI = openAiCompatibleProfile({
|
|
14596
|
+
name: "xai",
|
|
14597
|
+
aliases: ["grok"],
|
|
14598
|
+
baseUrl: "https://api.x.ai/v1",
|
|
14599
|
+
envVars: ["XAI_API_KEY"],
|
|
14600
|
+
fallbackModels: ["grok-4.5", "grok-4.3"],
|
|
14601
|
+
hostname: "api.x.ai"
|
|
14602
|
+
});
|
|
14603
|
+
|
|
14496
14604
|
// src/internal/providers/builtin/index.ts
|
|
14497
|
-
var
|
|
14605
|
+
var _registeredState = (() => {
|
|
14606
|
+
const g = globalThis;
|
|
14607
|
+
const sym = /* @__PURE__ */ Symbol.for("theokit-sdk.providers.builtins-registered");
|
|
14608
|
+
if (g[sym] === void 0) g[sym] = { done: false };
|
|
14609
|
+
return g[sym];
|
|
14610
|
+
})();
|
|
14498
14611
|
function registerBuiltins() {
|
|
14499
|
-
if (
|
|
14500
|
-
|
|
14612
|
+
if (_registeredState.done) return;
|
|
14613
|
+
_registeredState.done = true;
|
|
14501
14614
|
registerProvider(ANTHROPIC);
|
|
14502
14615
|
registerProvider(OPENAI);
|
|
14503
14616
|
registerProvider(OPENAI_CHATGPT);
|
|
@@ -14508,6 +14621,15 @@ function registerBuiltins() {
|
|
|
14508
14621
|
registerProvider(LLAMACPP);
|
|
14509
14622
|
registerProvider(BEDROCK);
|
|
14510
14623
|
registerProvider(VERTEX);
|
|
14624
|
+
registerProvider(GOOGLE);
|
|
14625
|
+
registerProvider(MISTRAL);
|
|
14626
|
+
registerProvider(GROQ);
|
|
14627
|
+
registerProvider(COHERE);
|
|
14628
|
+
registerProvider(DEEPINFRA);
|
|
14629
|
+
registerProvider(TOGETHER);
|
|
14630
|
+
registerProvider(XAI);
|
|
14631
|
+
registerProvider(PERPLEXITY);
|
|
14632
|
+
registerProvider(CEREBRAS);
|
|
14511
14633
|
registerCatalogProviders();
|
|
14512
14634
|
}
|
|
14513
14635
|
|
|
@@ -14776,14 +14898,16 @@ var AnthropicClient = class {
|
|
|
14776
14898
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
|
|
14777
14899
|
async *stream(request, signal) {
|
|
14778
14900
|
const body = buildAnthropicBody(request);
|
|
14901
|
+
const headers = {
|
|
14902
|
+
"content-type": "application/json",
|
|
14903
|
+
"x-api-key": this.options.apiKey,
|
|
14904
|
+
"anthropic-version": this.options.version ?? "2023-06-01"
|
|
14905
|
+
};
|
|
14906
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
14779
14907
|
const response = await this.fetchImpl(`${this.baseUrl}/v1/messages`, {
|
|
14780
14908
|
method: "POST",
|
|
14781
14909
|
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
|
-
},
|
|
14910
|
+
headers,
|
|
14787
14911
|
body: JSON.stringify(body)
|
|
14788
14912
|
});
|
|
14789
14913
|
if (!response.ok) {
|
|
@@ -15656,15 +15780,24 @@ var StreamSuppressionBuffer = class {
|
|
|
15656
15780
|
};
|
|
15657
15781
|
|
|
15658
15782
|
// src/internal/llm/openai.ts
|
|
15783
|
+
function deriveChatPath(baseUrl) {
|
|
15784
|
+
try {
|
|
15785
|
+
return /\/v\d+[a-z]*(\/|$)/.test(new URL(baseUrl).pathname) ? "/chat/completions" : "/v1/chat/completions";
|
|
15786
|
+
} catch {
|
|
15787
|
+
return "/v1/chat/completions";
|
|
15788
|
+
}
|
|
15789
|
+
}
|
|
15659
15790
|
var OpenAIClient = class {
|
|
15660
15791
|
constructor(options) {
|
|
15661
15792
|
this.options = options;
|
|
15662
|
-
this.baseUrl = options.baseUrl ?? "https://api.openai.com";
|
|
15793
|
+
this.baseUrl = (options.baseUrl ?? "https://api.openai.com").replace(/\/+$/, "");
|
|
15794
|
+
this.chatPath = options.chatCompletionsPath ?? deriveChatPath(this.baseUrl);
|
|
15663
15795
|
this.fetchImpl = options.fetch ?? fetch;
|
|
15664
15796
|
}
|
|
15665
15797
|
options;
|
|
15666
15798
|
name = "openai";
|
|
15667
15799
|
baseUrl;
|
|
15800
|
+
chatPath;
|
|
15668
15801
|
fetchImpl;
|
|
15669
15802
|
/**
|
|
15670
15803
|
* Whether this client recovers leaked Hermes tool-call dialect from assistant
|
|
@@ -15687,7 +15820,7 @@ var OpenAIClient = class {
|
|
|
15687
15820
|
const providerId = this.options.providerName ?? this.name;
|
|
15688
15821
|
let response;
|
|
15689
15822
|
try {
|
|
15690
|
-
response = await this.fetchImpl(`${this.baseUrl}
|
|
15823
|
+
response = await this.fetchImpl(`${this.baseUrl}${this.chatPath}`, {
|
|
15691
15824
|
method: "POST",
|
|
15692
15825
|
signal,
|
|
15693
15826
|
headers,
|
|
@@ -16784,6 +16917,9 @@ function selectTransport(profile, apiKey) {
|
|
|
16784
16917
|
if (profile.extractToolCallsFromContent === true) {
|
|
16785
16918
|
opts.extractToolCallsFromContent = true;
|
|
16786
16919
|
}
|
|
16920
|
+
if (profile.chatCompletionsPath !== void 0) {
|
|
16921
|
+
opts.chatCompletionsPath = profile.chatCompletionsPath;
|
|
16922
|
+
}
|
|
16787
16923
|
if (profile.name === "openai" && process.env.OPENAI_ORGANIZATION !== void 0) {
|
|
16788
16924
|
opts.organization = process.env.OPENAI_ORGANIZATION;
|
|
16789
16925
|
}
|
|
@@ -16803,6 +16939,11 @@ function selectTransport(profile, apiKey) {
|
|
|
16803
16939
|
}
|
|
16804
16940
|
const opts = { apiKey };
|
|
16805
16941
|
opts.baseUrl = process.env.ANTHROPIC_API_BASE_URL ?? profile.baseUrl;
|
|
16942
|
+
const t = applyTransform();
|
|
16943
|
+
assertOAuthResolved(t);
|
|
16944
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
16945
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
16946
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
16806
16947
|
return new AnthropicClient(opts);
|
|
16807
16948
|
}
|
|
16808
16949
|
if (profile.apiMode === "bedrock_anthropic") {
|
|
@@ -17121,12 +17262,12 @@ function resolveMcpCwd(configCwd) {
|
|
|
17121
17262
|
|
|
17122
17263
|
// src/internal/providers/register-plugin-providers.ts
|
|
17123
17264
|
function registerPluginProviderProfiles(entries) {
|
|
17124
|
-
let
|
|
17265
|
+
let registered2 = 0;
|
|
17125
17266
|
for (const entry of entries) {
|
|
17126
17267
|
registerProvider(entry.profile);
|
|
17127
|
-
|
|
17268
|
+
registered2 += 1;
|
|
17128
17269
|
}
|
|
17129
|
-
return
|
|
17270
|
+
return registered2;
|
|
17130
17271
|
}
|
|
17131
17272
|
|
|
17132
17273
|
// src/internal/local-agent/real-local-run.ts
|
|
@@ -17451,12 +17592,12 @@ var pluginProvidersAnnounced = false;
|
|
|
17451
17592
|
function resolveRunProvider(options) {
|
|
17452
17593
|
registerBuiltins();
|
|
17453
17594
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
17454
|
-
const
|
|
17455
|
-
if (
|
|
17595
|
+
const registered2 = registerPluginProviderProfiles(profiles);
|
|
17596
|
+
if (registered2 > 0 && !pluginProvidersAnnounced) {
|
|
17456
17597
|
pluginProvidersAnnounced = true;
|
|
17457
17598
|
const names = profiles.map((e) => e.profile.name).join(", ");
|
|
17458
17599
|
process.stderr.write(
|
|
17459
|
-
`[theokit-sdk] registered ${
|
|
17600
|
+
`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
|
|
17460
17601
|
`
|
|
17461
17602
|
);
|
|
17462
17603
|
}
|