@burtson-labs/bandit-engine 2.0.36 → 2.0.38
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/README.md +3 -3
- package/dist/{aiProviderStore-UJRDUYOF.mjs → aiProviderStore-XN7GCBHJ.mjs} +2 -2
- package/dist/{chat-SZK3EBDO.mjs → chat-5QJNWB7I.mjs} +5 -5
- package/dist/chat-provider.js +29 -3
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +4 -4
- package/dist/{chunk-2ZZA2IFL.mjs → chunk-3A2527TE.mjs} +3 -3
- package/dist/{chunk-FJO5ZWYU.mjs → chunk-CDQYBO3Q.mjs} +26 -8
- package/dist/chunk-CDQYBO3Q.mjs.map +1 -0
- package/dist/{chunk-PLNFTIGX.mjs → chunk-ECRNIAG6.mjs} +4 -4
- package/dist/{chunk-S635Q6OQ.mjs → chunk-EOKIE5HZ.mjs} +24 -3
- package/dist/chunk-EOKIE5HZ.mjs.map +1 -0
- package/dist/{chunk-G4OXOTNJ.mjs → chunk-JRCDANLN.mjs} +154 -61
- package/dist/{chunk-G4OXOTNJ.mjs.map → chunk-JRCDANLN.mjs.map} +1 -1
- package/dist/{chunk-ZNNOTDRD.mjs → chunk-QU5S5QQP.mjs} +9 -4
- package/dist/chunk-QU5S5QQP.mjs.map +1 -0
- package/dist/{chunk-ED5NNDKO.mjs → chunk-QYH2T4L5.mjs} +3 -3
- package/dist/{chunk-ZAVV2AT5.mjs → chunk-WO5KFNNW.mjs} +4 -4
- package/dist/cli/cli.js +27 -7
- package/dist/cli/cli.js.map +1 -1
- package/dist/{gateway-Ckf_KusF.d.ts → gateway-B0LJ3-jT.d.mts} +3 -0
- package/dist/{gateway-Ckf_KusF.d.mts → gateway-B0LJ3-jT.d.ts} +3 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +196 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/management/management.js +196 -59
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +6 -6
- package/dist/modals/chat-modal/chat-modal.js +8 -3
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-FJO5ZWYU.mjs.map +0 -1
- package/dist/chunk-S635Q6OQ.mjs.map +0 -1
- package/dist/chunk-ZNNOTDRD.mjs.map +0 -1
- /package/dist/{aiProviderStore-UJRDUYOF.mjs.map → aiProviderStore-XN7GCBHJ.mjs.map} +0 -0
- /package/dist/{chat-SZK3EBDO.mjs.map → chat-5QJNWB7I.mjs.map} +0 -0
- /package/dist/{chunk-2ZZA2IFL.mjs.map → chunk-3A2527TE.mjs.map} +0 -0
- /package/dist/{chunk-PLNFTIGX.mjs.map → chunk-ECRNIAG6.mjs.map} +0 -0
- /package/dist/{chunk-ED5NNDKO.mjs.map → chunk-QYH2T4L5.mjs.map} +0 -0
- /package/dist/{chunk-ZAVV2AT5.mjs.map → chunk-WO5KFNNW.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Customize the output with options such as:
|
|
|
58
58
|
|
|
59
59
|
> 📦 The generated project installs directly from `https://registry.npmjs.org/` — no GitHub npm token is required once the package is public.
|
|
60
60
|
|
|
61
|
-
> ⚠️ The scaffolded gateway focuses on OpenAI/Ollama chat and model discovery. All advanced routes (file storage uploads, vector embedding, voice, MCP, etc.) are generated as `501` placeholders so you can wire them to your own infrastructure. Implement the contracts below before turning on those features in production.
|
|
61
|
+
> ⚠️ The scaffolded gateway focuses on OpenAI/xAI/Ollama chat and model discovery. All advanced routes (file storage uploads, vector embedding, voice, MCP, etc.) are generated as `501` placeholders so you can wire them to your own infrastructure. Implement the contracts below before turning on those features in production.
|
|
62
62
|
|
|
63
63
|
Check out the [CLI quick start guide](./docs/05_cli_quickstart.md) for the full walkthrough, option matrix, and project anatomy.
|
|
64
64
|
|
|
@@ -212,7 +212,7 @@ aiProvider: {
|
|
|
212
212
|
|
|
213
213
|
> **⚠️ Important:** The Bandit Engine automatically routes to provider-specific endpoints:
|
|
214
214
|
> - **Ollama** → `/api/ollama/chat` (native Ollama format)
|
|
215
|
-
> - **OpenAI/Azure/Anthropic** → `/api/{provider}/chat/completions` (OpenAI format)
|
|
215
|
+
> - **OpenAI/Azure/xAI/Anthropic** → `/api/{provider}/chat/completions` (OpenAI format)
|
|
216
216
|
> - **TTS/STT** → Technology-agnostic endpoints that work with any backend implementation
|
|
217
217
|
|
|
218
218
|
### Ollama .env Setup
|
|
@@ -765,7 +765,7 @@ The Bandit Engine provides comprehensive image support across all AI providers t
|
|
|
765
765
|
|
|
766
766
|
// The gateway provider automatically formats images correctly:
|
|
767
767
|
// - Ollama: base64 arrays in message.images
|
|
768
|
-
// - OpenAI/Azure/Anthropic: structured content with image_url objects
|
|
768
|
+
// - OpenAI/Azure/xAI/Anthropic: structured content with image_url objects
|
|
769
769
|
```
|
|
770
770
|
|
|
771
771
|
**Backend Requirements:**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAIProviderStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QU5S5QQP.mjs";
|
|
4
4
|
import "./chunk-KCI46M23.mjs";
|
|
5
5
|
import "./chunk-BJTO5JO5.mjs";
|
|
6
6
|
export {
|
|
7
7
|
useAIProviderStore
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=aiProviderStore-
|
|
9
|
+
//# sourceMappingURL=aiProviderStore-XN7GCBHJ.mjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chat_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WO5KFNNW.mjs";
|
|
4
4
|
import "./chunk-ONQMRE2G.mjs";
|
|
5
5
|
import "./chunk-RTQDQ6TC.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-QYH2T4L5.mjs";
|
|
7
|
+
import "./chunk-CDQYBO3Q.mjs";
|
|
8
8
|
import "./chunk-XUBYA5I7.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-QU5S5QQP.mjs";
|
|
10
10
|
import "./chunk-KCI46M23.mjs";
|
|
11
11
|
import "./chunk-BJTO5JO5.mjs";
|
|
12
12
|
export {
|
|
13
13
|
chat_default as default
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=chat-
|
|
15
|
+
//# sourceMappingURL=chat-5QJNWB7I.mjs.map
|
package/dist/chat-provider.js
CHANGED
|
@@ -1799,10 +1799,16 @@ var init_anthropic_provider = __esm({
|
|
|
1799
1799
|
AnthropicProvider = class {
|
|
1800
1800
|
config;
|
|
1801
1801
|
baseUrl;
|
|
1802
|
+
version;
|
|
1803
|
+
defaultMaxTokens;
|
|
1802
1804
|
constructor(config) {
|
|
1803
1805
|
deprecatedAnthropicProvider();
|
|
1804
1806
|
this.config = config;
|
|
1805
1807
|
this.baseUrl = config.baseUrl || "https://api.anthropic.com/v1";
|
|
1808
|
+
this.version = typeof config.anthropicVersion === "string" && config.anthropicVersion.trim() ? config.anthropicVersion.trim() : "2023-06-01";
|
|
1809
|
+
this.defaultMaxTokens = typeof config.anthropicMaxTokens === "number" && config.anthropicMaxTokens > 0 ? config.anthropicMaxTokens : 1024;
|
|
1810
|
+
this.config.anthropicVersion = this.version;
|
|
1811
|
+
this.config.anthropicMaxTokens = this.defaultMaxTokens;
|
|
1806
1812
|
}
|
|
1807
1813
|
chat(request) {
|
|
1808
1814
|
const url = `${this.baseUrl}/messages`;
|
|
@@ -1817,7 +1823,7 @@ var init_anthropic_provider = __esm({
|
|
|
1817
1823
|
system: systemMessage?.content,
|
|
1818
1824
|
stream: Boolean(request.stream),
|
|
1819
1825
|
temperature: request.temperature,
|
|
1820
|
-
max_tokens: request.maxTokens ??
|
|
1826
|
+
max_tokens: request.maxTokens ?? this.defaultMaxTokens
|
|
1821
1827
|
};
|
|
1822
1828
|
if (request.stream) {
|
|
1823
1829
|
return this.streamChatRequest(url, payload);
|
|
@@ -2054,7 +2060,7 @@ var init_anthropic_provider = __esm({
|
|
|
2054
2060
|
}
|
|
2055
2061
|
getHeaders() {
|
|
2056
2062
|
const headers = {
|
|
2057
|
-
"anthropic-version":
|
|
2063
|
+
"anthropic-version": this.version
|
|
2058
2064
|
};
|
|
2059
2065
|
if (this.config.apiKey) {
|
|
2060
2066
|
headers["x-api-key"] = this.config.apiKey;
|
|
@@ -3612,7 +3618,6 @@ var init_ai_provider_factory = __esm({
|
|
|
3612
3618
|
"ollama" /* OLLAMA */,
|
|
3613
3619
|
"openai" /* OPENAI */,
|
|
3614
3620
|
"azure-openai" /* AZURE_OPENAI */,
|
|
3615
|
-
"anthropic" /* ANTHROPIC */,
|
|
3616
3621
|
"xai" /* XAI */,
|
|
3617
3622
|
"gateway" /* GATEWAY */,
|
|
3618
3623
|
"playground" /* PLAYGROUND */
|
|
@@ -9355,6 +9360,9 @@ var AIProviderInitService = class _AIProviderInitService {
|
|
|
9355
9360
|
debugLogger.info("AI Provider Init: Found saved config in IndexedDB", { type: savedConfig.type });
|
|
9356
9361
|
const { id: _id, ...configWithoutId } = savedConfig;
|
|
9357
9362
|
providerConfig = { ...configWithoutId };
|
|
9363
|
+
if (providerConfig.type === "anthropic" /* ANTHROPIC */) {
|
|
9364
|
+
providerConfig = this.convertAnthropicConfig(providerConfig, settings?.gatewayApiUrl);
|
|
9365
|
+
}
|
|
9358
9366
|
if ((providerConfig.type === "ollama" /* OLLAMA */ || providerConfig.type === "gateway" /* GATEWAY */) && !providerConfig.tokenFactory) {
|
|
9359
9367
|
providerConfig.tokenFactory = () => {
|
|
9360
9368
|
let token = authenticationService.getToken();
|
|
@@ -9399,6 +9407,9 @@ var AIProviderInitService = class _AIProviderInitService {
|
|
|
9399
9407
|
}
|
|
9400
9408
|
if (settings.aiProvider) {
|
|
9401
9409
|
providerConfig = { ...settings.aiProvider };
|
|
9410
|
+
if (providerConfig.type === "anthropic" /* ANTHROPIC */) {
|
|
9411
|
+
providerConfig = this.convertAnthropicConfig(providerConfig, settings.gatewayApiUrl);
|
|
9412
|
+
}
|
|
9402
9413
|
if (providerConfig.type === "ollama" /* OLLAMA */ && !providerConfig.tokenFactory) {
|
|
9403
9414
|
providerConfig.tokenFactory = () => {
|
|
9404
9415
|
let token = authenticationService.getToken();
|
|
@@ -9552,6 +9563,21 @@ var AIProviderInitService = class _AIProviderInitService {
|
|
|
9552
9563
|
isProviderInitialized() {
|
|
9553
9564
|
return useAIProviderStore.getState().provider !== null;
|
|
9554
9565
|
}
|
|
9566
|
+
convertAnthropicConfig(config, gatewayUrl) {
|
|
9567
|
+
if (config.type !== "anthropic" /* ANTHROPIC */) {
|
|
9568
|
+
return config;
|
|
9569
|
+
}
|
|
9570
|
+
const defaultModel = typeof config.defaultModel === "string" && config.defaultModel.trim() ? config.defaultModel.trim() : "claude-3-5-sonnet-latest";
|
|
9571
|
+
const normalized = {
|
|
9572
|
+
type: "gateway" /* GATEWAY */,
|
|
9573
|
+
gatewayUrl: gatewayUrl || config.gatewayUrl || "",
|
|
9574
|
+
provider: "anthropic",
|
|
9575
|
+
defaultModel,
|
|
9576
|
+
tokenFactory: config.tokenFactory
|
|
9577
|
+
};
|
|
9578
|
+
debugLogger.info("AI Provider Init: Converted direct Anthropic provider to gateway configuration");
|
|
9579
|
+
return normalized;
|
|
9580
|
+
}
|
|
9555
9581
|
};
|
|
9556
9582
|
var aiProviderInitService = AIProviderInitService.getInstance();
|
|
9557
9583
|
|