cascade-ai 0.12.3 → 0.12.4
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/dist/cli.cjs +183 -121
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +182 -120
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +36 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2258,7 +2258,7 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter__default.default {
|
|
|
2258
2258
|
}
|
|
2259
2259
|
for (const tier of ["T1", "T2", "T3"]) {
|
|
2260
2260
|
const override = tier === "T1" ? config.models.t1 : tier === "T2" ? config.models.t2 : config.models.t3;
|
|
2261
|
-
if (!override) continue;
|
|
2261
|
+
if (!override || override === "auto") continue;
|
|
2262
2262
|
const model = this.selector.selectForTier(tier, override);
|
|
2263
2263
|
if (!model) {
|
|
2264
2264
|
const knownProviders = ["anthropic", "openai", "gemini", "azure", "openai-compatible", "ollama"];
|
|
@@ -10608,6 +10608,11 @@ var DashboardSocket = class {
|
|
|
10608
10608
|
emitToSocket(socketId, event, data) {
|
|
10609
10609
|
this.io.sockets.sockets.get(socketId)?.emit(event, data);
|
|
10610
10610
|
}
|
|
10611
|
+
onConfigGet(callback) {
|
|
10612
|
+
this.io.on("connection", (socket) => {
|
|
10613
|
+
socket.on("config:get", () => callback(socket.id));
|
|
10614
|
+
});
|
|
10615
|
+
}
|
|
10611
10616
|
onCascadeRun(callback) {
|
|
10612
10617
|
this.io.on("connection", (socket) => {
|
|
10613
10618
|
socket.on("cascade:run", (payload) => {
|
|
@@ -10654,6 +10659,16 @@ var DashboardServer = class {
|
|
|
10654
10659
|
this.socket.onSessionRate((sessionId, rating) => {
|
|
10655
10660
|
this.activeSessions.get(sessionId)?.rateLastRun(rating);
|
|
10656
10661
|
});
|
|
10662
|
+
this.socket.onConfigGet((socketId) => {
|
|
10663
|
+
this.socket.emitToSocket(socketId, "config:current", {
|
|
10664
|
+
models: this.config.models ?? {},
|
|
10665
|
+
budget: {
|
|
10666
|
+
maxCostPerRun: this.config.budget?.maxCostPerRunUsd,
|
|
10667
|
+
autoBias: this.config.autoBias
|
|
10668
|
+
},
|
|
10669
|
+
providersWithKey: (this.config.providers ?? []).filter((p) => typeof p.apiKey === "string" && p.apiKey.length > 0).map((p) => p.type)
|
|
10670
|
+
});
|
|
10671
|
+
});
|
|
10657
10672
|
this.socket.onConfigUpdate((data) => {
|
|
10658
10673
|
if (data.keys) {
|
|
10659
10674
|
for (const [type, apiKey] of Object.entries(data.keys)) {
|
|
@@ -10664,7 +10679,11 @@ var DashboardServer = class {
|
|
|
10664
10679
|
}
|
|
10665
10680
|
}
|
|
10666
10681
|
if (data.models) {
|
|
10667
|
-
|
|
10682
|
+
const models = this.config.models;
|
|
10683
|
+
for (const [tier, val] of Object.entries(data.models)) {
|
|
10684
|
+
if (val && val !== "auto") models[tier] = val;
|
|
10685
|
+
else delete models[tier];
|
|
10686
|
+
}
|
|
10668
10687
|
}
|
|
10669
10688
|
if (data.budget) {
|
|
10670
10689
|
if (typeof data.budget.maxCostPerRun === "number") {
|
|
@@ -10674,6 +10693,7 @@ var DashboardServer = class {
|
|
|
10674
10693
|
this.config.autoBias = data.budget.autoBias;
|
|
10675
10694
|
}
|
|
10676
10695
|
}
|
|
10696
|
+
this.persistConfig();
|
|
10677
10697
|
});
|
|
10678
10698
|
this.socket.onCascadeRun(async (prompt, model, socketId) => {
|
|
10679
10699
|
const sessionId = crypto.randomUUID();
|
|
@@ -10750,6 +10770,20 @@ var DashboardServer = class {
|
|
|
10750
10770
|
getSocket() {
|
|
10751
10771
|
return this.socket;
|
|
10752
10772
|
}
|
|
10773
|
+
/**
|
|
10774
|
+
* Write the in-memory config back to the workspace config file so mutations
|
|
10775
|
+
* made over the socket (Settings → Save) persist across restarts. Best-effort:
|
|
10776
|
+
* a write failure is logged but never crashes the running dashboard.
|
|
10777
|
+
*/
|
|
10778
|
+
persistConfig() {
|
|
10779
|
+
try {
|
|
10780
|
+
const configPath = path18__default.default.join(this.workspacePath, CASCADE_CONFIG_FILE);
|
|
10781
|
+
fs17__default.default.mkdirSync(path18__default.default.dirname(configPath), { recursive: true });
|
|
10782
|
+
fs17__default.default.writeFileSync(configPath, JSON.stringify(this.config, null, 2), "utf-8");
|
|
10783
|
+
} catch (err) {
|
|
10784
|
+
console.warn(`[dashboard] Failed to persist config: ${err instanceof Error ? err.message : String(err)}`);
|
|
10785
|
+
}
|
|
10786
|
+
}
|
|
10753
10787
|
/**
|
|
10754
10788
|
* Produce a stable dashboard JWT signing secret.
|
|
10755
10789
|
*
|