@dexto/core 1.5.5 → 1.5.7

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 (146) hide show
  1. package/dist/agent/DextoAgent.cjs +94 -26
  2. package/dist/agent/DextoAgent.d.ts +17 -7
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +95 -27
  5. package/dist/agent/schemas.d.ts +417 -66
  6. package/dist/agent/schemas.d.ts.map +1 -1
  7. package/dist/context/utils.cjs +49 -3
  8. package/dist/context/utils.d.ts.map +1 -1
  9. package/dist/context/utils.js +49 -3
  10. package/dist/errors/types.cjs +2 -1
  11. package/dist/errors/types.d.ts +2 -1
  12. package/dist/errors/types.d.ts.map +1 -1
  13. package/dist/errors/types.js +2 -1
  14. package/dist/image/types.d.ts +15 -0
  15. package/dist/image/types.d.ts.map +1 -1
  16. package/dist/llm/error-codes.cjs +1 -0
  17. package/dist/llm/error-codes.d.ts +1 -0
  18. package/dist/llm/error-codes.d.ts.map +1 -1
  19. package/dist/llm/error-codes.js +1 -0
  20. package/dist/llm/errors.cjs +15 -0
  21. package/dist/llm/errors.d.ts +15 -8
  22. package/dist/llm/errors.d.ts.map +1 -1
  23. package/dist/llm/errors.js +15 -0
  24. package/dist/llm/executor/turn-executor.cjs +27 -0
  25. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  26. package/dist/llm/executor/turn-executor.js +27 -0
  27. package/dist/llm/registry.cjs +472 -28
  28. package/dist/llm/registry.d.ts +80 -4
  29. package/dist/llm/registry.d.ts.map +1 -1
  30. package/dist/llm/registry.js +464 -25
  31. package/dist/llm/resolver.cjs +13 -0
  32. package/dist/llm/resolver.d.ts.map +1 -1
  33. package/dist/llm/resolver.js +16 -1
  34. package/dist/llm/schemas.d.ts +59 -59
  35. package/dist/llm/services/factory.cjs +41 -25
  36. package/dist/llm/services/factory.d.ts +20 -1
  37. package/dist/llm/services/factory.d.ts.map +1 -1
  38. package/dist/llm/services/factory.js +42 -26
  39. package/dist/llm/services/test-utils.integration.cjs +5 -1
  40. package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
  41. package/dist/llm/services/test-utils.integration.js +5 -1
  42. package/dist/llm/types.cjs +5 -2
  43. package/dist/llm/types.d.ts +1 -1
  44. package/dist/llm/types.d.ts.map +1 -1
  45. package/dist/llm/types.js +5 -2
  46. package/dist/logger/logger.cjs +6 -7
  47. package/dist/logger/logger.d.ts +1 -0
  48. package/dist/logger/logger.d.ts.map +1 -1
  49. package/dist/logger/logger.js +6 -7
  50. package/dist/logger/v2/dexto-logger.cjs +4 -0
  51. package/dist/logger/v2/dexto-logger.d.ts +3 -0
  52. package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
  53. package/dist/logger/v2/dexto-logger.js +4 -0
  54. package/dist/logger/v2/types.d.ts +2 -0
  55. package/dist/logger/v2/types.d.ts.map +1 -1
  56. package/dist/mcp/error-codes.cjs +1 -0
  57. package/dist/mcp/error-codes.d.ts +1 -0
  58. package/dist/mcp/error-codes.d.ts.map +1 -1
  59. package/dist/mcp/error-codes.js +1 -0
  60. package/dist/mcp/errors.cjs +13 -0
  61. package/dist/mcp/errors.d.ts +7 -0
  62. package/dist/mcp/errors.d.ts.map +1 -1
  63. package/dist/mcp/errors.js +13 -0
  64. package/dist/mcp/manager.cjs +46 -4
  65. package/dist/mcp/manager.d.ts +10 -2
  66. package/dist/mcp/manager.d.ts.map +1 -1
  67. package/dist/mcp/manager.js +46 -4
  68. package/dist/mcp/mcp-client.cjs +89 -5
  69. package/dist/mcp/mcp-client.d.ts +5 -1
  70. package/dist/mcp/mcp-client.d.ts.map +1 -1
  71. package/dist/mcp/mcp-client.js +89 -5
  72. package/dist/mcp/schemas.cjs +6 -1
  73. package/dist/mcp/schemas.d.ts +1 -1
  74. package/dist/mcp/schemas.d.ts.map +1 -1
  75. package/dist/mcp/schemas.js +6 -1
  76. package/dist/mcp/types.d.ts +5 -0
  77. package/dist/mcp/types.d.ts.map +1 -1
  78. package/dist/prompts/index.d.ts +1 -1
  79. package/dist/prompts/index.d.ts.map +1 -1
  80. package/dist/prompts/prompt-manager.cjs +90 -4
  81. package/dist/prompts/prompt-manager.d.ts +16 -6
  82. package/dist/prompts/prompt-manager.d.ts.map +1 -1
  83. package/dist/prompts/prompt-manager.js +90 -4
  84. package/dist/prompts/providers/config-prompt-provider.cjs +104 -10
  85. package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
  86. package/dist/prompts/providers/config-prompt-provider.js +105 -11
  87. package/dist/prompts/providers/custom-prompt-provider.cjs +1 -0
  88. package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
  89. package/dist/prompts/providers/custom-prompt-provider.js +1 -0
  90. package/dist/prompts/providers/mcp-prompt-provider.cjs +1 -0
  91. package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
  92. package/dist/prompts/providers/mcp-prompt-provider.js +1 -0
  93. package/dist/prompts/schemas.cjs +28 -2
  94. package/dist/prompts/schemas.d.ts +130 -0
  95. package/dist/prompts/schemas.d.ts.map +1 -1
  96. package/dist/prompts/schemas.js +28 -2
  97. package/dist/prompts/types.d.ts +55 -3
  98. package/dist/prompts/types.d.ts.map +1 -1
  99. package/dist/session/chat-session.d.ts +1 -1
  100. package/dist/session/chat-session.d.ts.map +1 -1
  101. package/dist/session/index.d.ts +1 -1
  102. package/dist/session/index.d.ts.map +1 -1
  103. package/dist/session/session-manager.cjs +47 -3
  104. package/dist/session/session-manager.d.ts +10 -0
  105. package/dist/session/session-manager.d.ts.map +1 -1
  106. package/dist/session/session-manager.js +47 -3
  107. package/dist/systemPrompt/contributors.cjs +42 -0
  108. package/dist/systemPrompt/contributors.d.ts +13 -0
  109. package/dist/systemPrompt/contributors.d.ts.map +1 -1
  110. package/dist/systemPrompt/contributors.js +41 -0
  111. package/dist/tools/errors.cjs +7 -3
  112. package/dist/tools/errors.d.ts +5 -1
  113. package/dist/tools/errors.d.ts.map +1 -1
  114. package/dist/tools/errors.js +7 -3
  115. package/dist/tools/internal-tools/constants.cjs +2 -1
  116. package/dist/tools/internal-tools/constants.d.ts +1 -1
  117. package/dist/tools/internal-tools/constants.d.ts.map +1 -1
  118. package/dist/tools/internal-tools/constants.js +2 -1
  119. package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +140 -0
  120. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +24 -0
  121. package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +1 -0
  122. package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +117 -0
  123. package/dist/tools/internal-tools/provider.cjs +15 -0
  124. package/dist/tools/internal-tools/provider.d.ts +12 -0
  125. package/dist/tools/internal-tools/provider.d.ts.map +1 -1
  126. package/dist/tools/internal-tools/provider.js +15 -0
  127. package/dist/tools/internal-tools/registry.cjs +6 -0
  128. package/dist/tools/internal-tools/registry.d.ts +34 -0
  129. package/dist/tools/internal-tools/registry.d.ts.map +1 -1
  130. package/dist/tools/internal-tools/registry.js +6 -0
  131. package/dist/tools/schemas.cjs +2 -2
  132. package/dist/tools/schemas.d.ts +1 -1
  133. package/dist/tools/schemas.d.ts.map +1 -1
  134. package/dist/tools/schemas.js +2 -2
  135. package/dist/tools/tool-manager.cjs +230 -79
  136. package/dist/tools/tool-manager.d.ts +89 -8
  137. package/dist/tools/tool-manager.d.ts.map +1 -1
  138. package/dist/tools/tool-manager.js +231 -80
  139. package/dist/utils/api-key-resolver.cjs +5 -2
  140. package/dist/utils/api-key-resolver.d.ts.map +1 -1
  141. package/dist/utils/api-key-resolver.js +5 -2
  142. package/dist/utils/service-initializer.cjs +8 -2
  143. package/dist/utils/service-initializer.d.ts +5 -1
  144. package/dist/utils/service-initializer.d.ts.map +1 -1
  145. package/dist/utils/service-initializer.js +8 -2
  146. package/package.json +1 -1
@@ -81,6 +81,19 @@ async function resolveLLMConfig(previous, updates, logger) {
81
81
  context: { provider, model }
82
82
  });
83
83
  }
84
+ if ((0, import_registry.hasAllRegistryModelsSupport)(provider) && !model.includes("/")) {
85
+ try {
86
+ const originalProvider = (0, import_registry.getProviderFromModel)(model);
87
+ model = (0, import_registry.transformModelNameForProvider)(model, originalProvider, provider);
88
+ logger.debug(
89
+ `Transformed model for ${provider}: ${updates.model ?? previous.model} -> ${model}`
90
+ );
91
+ } catch {
92
+ logger.debug(
93
+ `Model '${model}' not in registry, passing through to ${provider} without transformation`
94
+ );
95
+ }
96
+ }
84
97
  const maxInputTokens = updates.maxInputTokens ?? (0, import_registry.getEffectiveMaxInputTokens)({ provider, model, apiKey: apiKey || previous.apiKey }, logger);
85
98
  let baseURL;
86
99
  if (updates.baseURL) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/llm/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiD,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAyB,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAexF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAM7D;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAUvD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAAE,CAAC,CAkKxE;AAGD,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,GACpC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CA0B9C"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/llm/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiD,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAyB,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAiBxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAM7D;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAUvD;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAA;CAAE,CAAC,CAoLxE;AAGD,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,GACpC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CA0B9C"}
@@ -10,7 +10,9 @@ import {
10
10
  isValidProviderModel,
11
11
  getEffectiveMaxInputTokens,
12
12
  supportsBaseURL,
13
- supportsCustomModels
13
+ supportsCustomModels,
14
+ hasAllRegistryModelsSupport,
15
+ transformModelNameForProvider
14
16
  } from "./registry.js";
15
17
  import {
16
18
  lookupOpenRouterModel,
@@ -68,6 +70,19 @@ async function resolveLLMConfig(previous, updates, logger) {
68
70
  context: { provider, model }
69
71
  });
70
72
  }
73
+ if (hasAllRegistryModelsSupport(provider) && !model.includes("/")) {
74
+ try {
75
+ const originalProvider = getProviderFromModel(model);
76
+ model = transformModelNameForProvider(model, originalProvider, provider);
77
+ logger.debug(
78
+ `Transformed model for ${provider}: ${updates.model ?? previous.model} -> ${model}`
79
+ );
80
+ } catch {
81
+ logger.debug(
82
+ `Model '${model}' not in registry, passing through to ${provider} without transformation`
83
+ );
84
+ }
85
+ }
71
86
  const maxInputTokens = updates.maxInputTokens ?? getEffectiveMaxInputTokens({ provider, model, apiKey: apiKey || previous.apiKey }, logger);
72
87
  let baseURL;
73
88
  if (updates.baseURL) {
@@ -21,7 +21,7 @@ export interface LLMValidationOptions {
21
21
  }
22
22
  /** Business rules + compatibility checks */
23
23
  export declare const LLMConfigBaseSchema: z.ZodObject<{
24
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
24
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
25
25
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
26
26
  apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
27
27
  maxIterations: z.ZodOptional<z.ZodNumber>;
@@ -33,26 +33,26 @@ export declare const LLMConfigBaseSchema: z.ZodObject<{
33
33
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
34
34
  }, "strict", z.ZodTypeAny, {
35
35
  model: string;
36
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
36
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
37
37
  apiKey?: string | undefined;
38
+ maxInputTokens?: number | undefined;
38
39
  maxIterations?: number | undefined;
39
40
  baseURL?: string | undefined;
40
- maxInputTokens?: number | undefined;
41
41
  maxOutputTokens?: number | undefined;
42
42
  temperature?: number | undefined;
43
43
  allowedMediaTypes?: string[] | undefined;
44
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
44
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
45
45
  }, {
46
46
  model: string;
47
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
47
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
48
48
  apiKey?: string | undefined;
49
+ maxInputTokens?: number | undefined;
49
50
  maxIterations?: number | undefined;
50
51
  baseURL?: string | undefined;
51
- maxInputTokens?: number | undefined;
52
52
  maxOutputTokens?: number | undefined;
53
53
  temperature?: number | undefined;
54
54
  allowedMediaTypes?: string[] | undefined;
55
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
55
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
56
56
  }>;
57
57
  /**
58
58
  * Creates an LLM config schema with configurable validation strictness.
@@ -61,7 +61,7 @@ export declare const LLMConfigBaseSchema: z.ZodObject<{
61
61
  * When false, allows missing credentials for interactive configuration.
62
62
  */
63
63
  export declare function createLLMConfigSchema(options?: LLMValidationOptions): z.ZodBranded<z.ZodEffects<z.ZodObject<{
64
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
64
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
65
65
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
66
66
  apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
67
67
  maxIterations: z.ZodOptional<z.ZodNumber>;
@@ -73,55 +73,55 @@ export declare function createLLMConfigSchema(options?: LLMValidationOptions): z
73
73
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
74
74
  }, "strict", z.ZodTypeAny, {
75
75
  model: string;
76
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
76
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
77
77
  apiKey?: string | undefined;
78
+ maxInputTokens?: number | undefined;
78
79
  maxIterations?: number | undefined;
79
80
  baseURL?: string | undefined;
80
- maxInputTokens?: number | undefined;
81
81
  maxOutputTokens?: number | undefined;
82
82
  temperature?: number | undefined;
83
83
  allowedMediaTypes?: string[] | undefined;
84
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
84
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
85
85
  }, {
86
86
  model: string;
87
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
87
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
88
88
  apiKey?: string | undefined;
89
+ maxInputTokens?: number | undefined;
89
90
  maxIterations?: number | undefined;
90
91
  baseURL?: string | undefined;
91
- maxInputTokens?: number | undefined;
92
92
  maxOutputTokens?: number | undefined;
93
93
  temperature?: number | undefined;
94
94
  allowedMediaTypes?: string[] | undefined;
95
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
95
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
96
96
  }>, {
97
97
  model: string;
98
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
98
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
99
99
  apiKey?: string | undefined;
100
+ maxInputTokens?: number | undefined;
100
101
  maxIterations?: number | undefined;
101
102
  baseURL?: string | undefined;
102
- maxInputTokens?: number | undefined;
103
103
  maxOutputTokens?: number | undefined;
104
104
  temperature?: number | undefined;
105
105
  allowedMediaTypes?: string[] | undefined;
106
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
106
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
107
107
  }, {
108
108
  model: string;
109
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
109
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
110
110
  apiKey?: string | undefined;
111
+ maxInputTokens?: number | undefined;
111
112
  maxIterations?: number | undefined;
112
113
  baseURL?: string | undefined;
113
- maxInputTokens?: number | undefined;
114
114
  maxOutputTokens?: number | undefined;
115
115
  temperature?: number | undefined;
116
116
  allowedMediaTypes?: string[] | undefined;
117
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
117
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
118
118
  }>, "ValidatedLLMConfig">;
119
119
  /**
120
120
  * Default LLM config schema with strict validation (backwards compatible).
121
121
  * Use createLLMConfigSchema({ strict: false }) for relaxed validation.
122
122
  */
123
123
  export declare const LLMConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodObject<{
124
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
124
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
125
125
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
126
126
  apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
127
127
  maxIterations: z.ZodOptional<z.ZodNumber>;
@@ -133,55 +133,55 @@ export declare const LLMConfigSchema: z.ZodBranded<z.ZodEffects<z.ZodObject<{
133
133
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
134
134
  }, "strict", z.ZodTypeAny, {
135
135
  model: string;
136
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
136
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
137
137
  apiKey?: string | undefined;
138
+ maxInputTokens?: number | undefined;
138
139
  maxIterations?: number | undefined;
139
140
  baseURL?: string | undefined;
140
- maxInputTokens?: number | undefined;
141
141
  maxOutputTokens?: number | undefined;
142
142
  temperature?: number | undefined;
143
143
  allowedMediaTypes?: string[] | undefined;
144
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
144
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
145
145
  }, {
146
146
  model: string;
147
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
147
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
148
148
  apiKey?: string | undefined;
149
+ maxInputTokens?: number | undefined;
149
150
  maxIterations?: number | undefined;
150
151
  baseURL?: string | undefined;
151
- maxInputTokens?: number | undefined;
152
152
  maxOutputTokens?: number | undefined;
153
153
  temperature?: number | undefined;
154
154
  allowedMediaTypes?: string[] | undefined;
155
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
155
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
156
156
  }>, {
157
157
  model: string;
158
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
158
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
159
159
  apiKey?: string | undefined;
160
+ maxInputTokens?: number | undefined;
160
161
  maxIterations?: number | undefined;
161
162
  baseURL?: string | undefined;
162
- maxInputTokens?: number | undefined;
163
163
  maxOutputTokens?: number | undefined;
164
164
  temperature?: number | undefined;
165
165
  allowedMediaTypes?: string[] | undefined;
166
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
166
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
167
167
  }, {
168
168
  model: string;
169
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
169
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
170
170
  apiKey?: string | undefined;
171
+ maxInputTokens?: number | undefined;
171
172
  maxIterations?: number | undefined;
172
173
  baseURL?: string | undefined;
173
- maxInputTokens?: number | undefined;
174
174
  maxOutputTokens?: number | undefined;
175
175
  temperature?: number | undefined;
176
176
  allowedMediaTypes?: string[] | undefined;
177
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
177
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
178
178
  }>, "ValidatedLLMConfig">;
179
179
  /**
180
180
  * Relaxed LLM config schema that allows missing API keys and baseURLs.
181
181
  * Use this for interactive modes (CLI, WebUI) where users can configure later.
182
182
  */
183
183
  export declare const LLMConfigSchemaRelaxed: z.ZodBranded<z.ZodEffects<z.ZodObject<{
184
- provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>;
184
+ provider: z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>;
185
185
  model: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
186
186
  apiKey: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
187
187
  maxIterations: z.ZodOptional<z.ZodNumber>;
@@ -193,53 +193,53 @@ export declare const LLMConfigSchemaRelaxed: z.ZodBranded<z.ZodEffects<z.ZodObje
193
193
  reasoningEffort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>;
194
194
  }, "strict", z.ZodTypeAny, {
195
195
  model: string;
196
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
196
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
197
197
  apiKey?: string | undefined;
198
+ maxInputTokens?: number | undefined;
198
199
  maxIterations?: number | undefined;
199
200
  baseURL?: string | undefined;
200
- maxInputTokens?: number | undefined;
201
201
  maxOutputTokens?: number | undefined;
202
202
  temperature?: number | undefined;
203
203
  allowedMediaTypes?: string[] | undefined;
204
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
204
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
205
205
  }, {
206
206
  model: string;
207
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
207
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
208
208
  apiKey?: string | undefined;
209
+ maxInputTokens?: number | undefined;
209
210
  maxIterations?: number | undefined;
210
211
  baseURL?: string | undefined;
211
- maxInputTokens?: number | undefined;
212
212
  maxOutputTokens?: number | undefined;
213
213
  temperature?: number | undefined;
214
214
  allowedMediaTypes?: string[] | undefined;
215
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
215
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
216
216
  }>, {
217
217
  model: string;
218
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
218
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
219
219
  apiKey?: string | undefined;
220
+ maxInputTokens?: number | undefined;
220
221
  maxIterations?: number | undefined;
221
222
  baseURL?: string | undefined;
222
- maxInputTokens?: number | undefined;
223
223
  maxOutputTokens?: number | undefined;
224
224
  temperature?: number | undefined;
225
225
  allowedMediaTypes?: string[] | undefined;
226
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
226
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
227
227
  }, {
228
228
  model: string;
229
- provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama";
229
+ provider: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto";
230
230
  apiKey?: string | undefined;
231
+ maxInputTokens?: number | undefined;
231
232
  maxIterations?: number | undefined;
232
233
  baseURL?: string | undefined;
233
- maxInputTokens?: number | undefined;
234
234
  maxOutputTokens?: number | undefined;
235
235
  temperature?: number | undefined;
236
236
  allowedMediaTypes?: string[] | undefined;
237
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
237
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
238
238
  }>, "ValidatedLLMConfig">;
239
239
  export type LLMConfig = z.input<typeof LLMConfigSchema>;
240
240
  export type ValidatedLLMConfig = z.output<typeof LLMConfigSchema>;
241
241
  export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
242
- provider: z.ZodOptional<z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama"]>>;
242
+ provider: z.ZodOptional<z.ZodEnum<["openai", "openai-compatible", "anthropic", "google", "groq", "xai", "cohere", "minimax", "glm", "openrouter", "litellm", "glama", "vertex", "bedrock", "local", "ollama", "dexto"]>>;
243
243
  model: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
244
244
  apiKey: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
245
245
  maxIterations: z.ZodOptional<z.ZodNumber>;
@@ -251,48 +251,48 @@ export declare const LLMUpdatesSchema: z.ZodEffects<z.ZodObject<{
251
251
  reasoningEffort: z.ZodOptional<z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high", "xhigh"]>>>;
252
252
  }, "strip", z.ZodTypeAny, {
253
253
  model?: string | undefined;
254
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
254
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
255
255
  apiKey?: string | undefined;
256
+ maxInputTokens?: number | undefined;
256
257
  maxIterations?: number | undefined;
257
258
  baseURL?: string | undefined;
258
- maxInputTokens?: number | undefined;
259
259
  maxOutputTokens?: number | undefined;
260
260
  temperature?: number | undefined;
261
261
  allowedMediaTypes?: string[] | undefined;
262
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
262
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
263
263
  }, {
264
264
  model?: string | undefined;
265
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
265
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
266
266
  apiKey?: string | undefined;
267
+ maxInputTokens?: number | undefined;
267
268
  maxIterations?: number | undefined;
268
269
  baseURL?: string | undefined;
269
- maxInputTokens?: number | undefined;
270
270
  maxOutputTokens?: number | undefined;
271
271
  temperature?: number | undefined;
272
272
  allowedMediaTypes?: string[] | undefined;
273
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
273
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
274
274
  }>, {
275
275
  model?: string | undefined;
276
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
276
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
277
277
  apiKey?: string | undefined;
278
+ maxInputTokens?: number | undefined;
278
279
  maxIterations?: number | undefined;
279
280
  baseURL?: string | undefined;
280
- maxInputTokens?: number | undefined;
281
281
  maxOutputTokens?: number | undefined;
282
282
  temperature?: number | undefined;
283
283
  allowedMediaTypes?: string[] | undefined;
284
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
284
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
285
285
  }, {
286
286
  model?: string | undefined;
287
- provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | undefined;
287
+ provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto" | undefined;
288
288
  apiKey?: string | undefined;
289
+ maxInputTokens?: number | undefined;
289
290
  maxIterations?: number | undefined;
290
291
  baseURL?: string | undefined;
291
- maxInputTokens?: number | undefined;
292
292
  maxOutputTokens?: number | undefined;
293
293
  temperature?: number | undefined;
294
294
  allowedMediaTypes?: string[] | undefined;
295
- reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
295
+ reasoningEffort?: "low" | "none" | "minimal" | "medium" | "high" | "xhigh" | undefined;
296
296
  }>;
297
297
  export type LLMUpdates = z.input<typeof LLMUpdatesSchema>;
298
298
  export type { LLMUpdateContext } from '../llm/types.js';
@@ -36,10 +36,14 @@ var import_cohere = require("@ai-sdk/cohere");
36
36
  var import_ai_sdk_adapter = require("../providers/local/ai-sdk-adapter.js");
37
37
  var import_registry = require("../registry.js");
38
38
  var import_api_key_resolver = require("../../utils/api-key-resolver.js");
39
- function createVercelModel(llmConfig) {
40
- const provider = llmConfig.provider;
41
- const model = llmConfig.model;
42
- const apiKey = llmConfig.apiKey;
39
+ const DEXTO_GATEWAY_HEADERS = {
40
+ SESSION_ID: "X-Dexto-Session-ID",
41
+ CLIENT_SOURCE: "X-Dexto-Source",
42
+ CLIENT_VERSION: "X-Dexto-Version"
43
+ };
44
+ function createVercelModel(llmConfig, context) {
45
+ const { provider, model, baseURL } = llmConfig;
46
+ const apiKey = llmConfig.apiKey || (0, import_api_key_resolver.resolveApiKeyForProvider)(provider);
43
47
  if ((0, import_registry.requiresApiKey)(provider) && !apiKey?.trim()) {
44
48
  const envVar = (0, import_api_key_resolver.getPrimaryApiKeyEnvVar)(provider);
45
49
  throw import_errors.LLMError.apiKeyMissing(provider, envVar);
@@ -49,26 +53,48 @@ function createVercelModel(llmConfig) {
49
53
  return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "" })(model);
50
54
  }
51
55
  case "openai-compatible": {
52
- const baseURL = getOpenAICompatibleBaseURL(llmConfig);
53
- if (!baseURL) {
56
+ const compatibleBaseURL = baseURL?.replace(/\/$/, "") || process.env.OPENAI_BASE_URL?.replace(/\/$/, "");
57
+ if (!compatibleBaseURL) {
54
58
  throw import_errors.LLMError.baseUrlMissing("openai-compatible");
55
59
  }
56
- return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL }).chat(model);
60
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: compatibleBaseURL }).chat(model);
57
61
  }
58
62
  case "openrouter": {
59
- const baseURL = llmConfig.baseURL || "https://openrouter.ai/api/v1";
60
- return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL }).chat(model);
63
+ const orBaseURL = baseURL || "https://openrouter.ai/api/v1";
64
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: orBaseURL }).chat(model);
65
+ }
66
+ case "minimax": {
67
+ const minimaxBaseURL = baseURL || "https://api.minimax.chat/v1";
68
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: minimaxBaseURL }).chat(model);
69
+ }
70
+ case "glm": {
71
+ const glmBaseURL = baseURL || "https://open.bigmodel.cn/api/paas/v4";
72
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: glmBaseURL }).chat(model);
61
73
  }
62
74
  case "litellm": {
63
- const baseURL = llmConfig.baseURL;
64
75
  if (!baseURL) {
65
76
  throw import_errors.LLMError.baseUrlMissing("litellm");
66
77
  }
67
78
  return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL }).chat(model);
68
79
  }
69
80
  case "glama": {
70
- const baseURL = "https://glama.ai/api/gateway/openai/v1";
71
- return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL }).chat(model);
81
+ const glamaBaseURL = "https://glama.ai/api/gateway/openai/v1";
82
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: glamaBaseURL }).chat(model);
83
+ }
84
+ case "dexto": {
85
+ const dextoBaseURL = "https://api.dexto.ai/v1";
86
+ const headers = {
87
+ [DEXTO_GATEWAY_HEADERS.CLIENT_SOURCE]: context?.clientSource ?? "cli"
88
+ };
89
+ if (context?.sessionId) {
90
+ headers[DEXTO_GATEWAY_HEADERS.SESSION_ID] = context.sessionId;
91
+ }
92
+ if (process.env.DEXTO_CLI_VERSION) {
93
+ headers[DEXTO_GATEWAY_HEADERS.CLIENT_VERSION] = process.env.DEXTO_CLI_VERSION;
94
+ }
95
+ return (0, import_openai.createOpenAI)({ apiKey: apiKey ?? "", baseURL: dextoBaseURL, headers }).chat(
96
+ model
97
+ );
72
98
  }
73
99
  case "vertex": {
74
100
  const projectId = process.env.GOOGLE_VERTEX_PROJECT;
@@ -106,7 +132,6 @@ function createVercelModel(llmConfig) {
106
132
  }
107
133
  return (0, import_amazon_bedrock.createAmazonBedrock)({ region })(modelId);
108
134
  }
109
- // TODO: Add 'dexto' case (similar to openrouter, uses https://api.dexto.ai/v1)
110
135
  case "anthropic":
111
136
  return (0, import_anthropic.createAnthropic)({ apiKey: apiKey ?? "" })(model);
112
137
  case "google":
@@ -118,8 +143,8 @@ function createVercelModel(llmConfig) {
118
143
  case "cohere":
119
144
  return (0, import_cohere.createCohere)({ apiKey: apiKey ?? "" })(model);
120
145
  case "ollama": {
121
- const baseURL = llmConfig.baseURL || "http://localhost:11434/v1";
122
- return (0, import_openai.createOpenAI)({ apiKey: "ollama", baseURL }).chat(model);
146
+ const ollamaBaseURL = baseURL || "http://localhost:11434/v1";
147
+ return (0, import_openai.createOpenAI)({ apiKey: "ollama", baseURL: ollamaBaseURL }).chat(model);
123
148
  }
124
149
  case "local": {
125
150
  return (0, import_ai_sdk_adapter.createLocalLanguageModel)({
@@ -130,17 +155,8 @@ function createVercelModel(llmConfig) {
130
155
  throw import_errors.LLMError.unsupportedProvider(provider);
131
156
  }
132
157
  }
133
- function getOpenAICompatibleBaseURL(llmConfig) {
134
- if (llmConfig.baseURL) {
135
- return llmConfig.baseURL.replace(/\/$/, "");
136
- }
137
- if (process.env.OPENAI_BASE_URL) {
138
- return process.env.OPENAI_BASE_URL.replace(/\/$/, "");
139
- }
140
- return "";
141
- }
142
158
  function createLLMService(config, toolManager, systemPromptManager, historyProvider, sessionEventBus, sessionId, resourceManager, logger, compactionStrategy, compactionConfig) {
143
- const model = createVercelModel(config);
159
+ const model = createVercelModel(config, { sessionId });
144
160
  return new import_vercel.VercelLLMService(
145
161
  toolManager,
146
162
  model,
@@ -7,7 +7,26 @@ import type { IConversationHistoryProvider } from '../../session/history/types.j
7
7
  import type { SystemPromptManager } from '../../systemPrompt/manager.js';
8
8
  import type { IDextoLogger } from '../../logger/v2/types.js';
9
9
  import type { CompactionConfigInput } from '../../context/compaction/schemas.js';
10
- export declare function createVercelModel(llmConfig: ValidatedLLMConfig): LanguageModel;
10
+ /**
11
+ * Context for model creation, including session info for usage tracking.
12
+ */
13
+ export interface DextoProviderContext {
14
+ /** Session ID for usage tracking */
15
+ sessionId?: string;
16
+ /** Client source for usage attribution (cli, web, sdk) */
17
+ clientSource?: 'cli' | 'web' | 'sdk';
18
+ }
19
+ /**
20
+ * Create a Vercel AI SDK LanguageModel from config.
21
+ *
22
+ * With explicit providers, the config's provider field directly determines
23
+ * where requests go. No auth-dependent routing - what you configure is what runs.
24
+ *
25
+ * @param llmConfig - LLM configuration from agent config
26
+ * @param context - Optional context for usage tracking (session ID, etc.)
27
+ * @returns Vercel AI SDK LanguageModel instance
28
+ */
29
+ export declare function createVercelModel(llmConfig: ValidatedLLMConfig, context?: DextoProviderContext): LanguageModel;
11
30
  /**
12
31
  * Create an LLM service instance using the Vercel AI SDK.
13
32
  * All providers are routed through the unified Vercel service.
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAUnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEjF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,GAAG,aAAa,CAoJ9E;AAoBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,4BAA4B,EAC7C,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,YAAY,EACpB,kBAAkB,CAAC,EAAE,OAAO,mCAAmC,EAAE,mBAAmB,GAAG,IAAI,EAC3F,gBAAgB,CAAC,EAAE,qBAAqB,GACzC,gBAAgB,CAgBlB"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/llm/services/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAUnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AASjF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,kBAAkB,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC/B,aAAa,CAkLf;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,4BAA4B,EAC7C,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,0BAA0B,EAAE,eAAe,EACnE,MAAM,EAAE,YAAY,EACpB,kBAAkB,CAAC,EAAE,OAAO,mCAAmC,EAAE,mBAAmB,GAAG,IAAI,EAC3F,gBAAgB,CAAC,EAAE,qBAAqB,GACzC,gBAAgB,CAgBlB"}