cascade-ai 0.12.2 → 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.d.cts
CHANGED
|
@@ -2025,6 +2025,7 @@ declare class DashboardSocket {
|
|
|
2025
2025
|
};
|
|
2026
2026
|
}) => void): void;
|
|
2027
2027
|
emitToSocket(socketId: string, event: string, data: unknown): void;
|
|
2028
|
+
onConfigGet(callback: (socketId: string) => void): void;
|
|
2028
2029
|
onCascadeRun(callback: (prompt: string, model: string, socketId: string) => void): void;
|
|
2029
2030
|
close(): void;
|
|
2030
2031
|
}
|
|
@@ -2046,6 +2047,12 @@ declare class DashboardServer {
|
|
|
2046
2047
|
start(): Promise<void>;
|
|
2047
2048
|
stop(): Promise<void>;
|
|
2048
2049
|
getSocket(): DashboardSocket;
|
|
2050
|
+
/**
|
|
2051
|
+
* Write the in-memory config back to the workspace config file so mutations
|
|
2052
|
+
* made over the socket (Settings → Save) persist across restarts. Best-effort:
|
|
2053
|
+
* a write failure is logged but never crashes the running dashboard.
|
|
2054
|
+
*/
|
|
2055
|
+
private persistConfig;
|
|
2049
2056
|
/**
|
|
2050
2057
|
* Produce a stable dashboard JWT signing secret.
|
|
2051
2058
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -2025,6 +2025,7 @@ declare class DashboardSocket {
|
|
|
2025
2025
|
};
|
|
2026
2026
|
}) => void): void;
|
|
2027
2027
|
emitToSocket(socketId: string, event: string, data: unknown): void;
|
|
2028
|
+
onConfigGet(callback: (socketId: string) => void): void;
|
|
2028
2029
|
onCascadeRun(callback: (prompt: string, model: string, socketId: string) => void): void;
|
|
2029
2030
|
close(): void;
|
|
2030
2031
|
}
|
|
@@ -2046,6 +2047,12 @@ declare class DashboardServer {
|
|
|
2046
2047
|
start(): Promise<void>;
|
|
2047
2048
|
stop(): Promise<void>;
|
|
2048
2049
|
getSocket(): DashboardSocket;
|
|
2050
|
+
/**
|
|
2051
|
+
* Write the in-memory config back to the workspace config file so mutations
|
|
2052
|
+
* made over the socket (Settings → Save) persist across restarts. Best-effort:
|
|
2053
|
+
* a write failure is logged but never crashes the running dashboard.
|
|
2054
|
+
*/
|
|
2055
|
+
private persistConfig;
|
|
2049
2056
|
/**
|
|
2050
2057
|
* Produce a stable dashboard JWT signing secret.
|
|
2051
2058
|
*
|
package/dist/index.js
CHANGED
|
@@ -2216,7 +2216,7 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter {
|
|
|
2216
2216
|
}
|
|
2217
2217
|
for (const tier of ["T1", "T2", "T3"]) {
|
|
2218
2218
|
const override = tier === "T1" ? config.models.t1 : tier === "T2" ? config.models.t2 : config.models.t3;
|
|
2219
|
-
if (!override) continue;
|
|
2219
|
+
if (!override || override === "auto") continue;
|
|
2220
2220
|
const model = this.selector.selectForTier(tier, override);
|
|
2221
2221
|
if (!model) {
|
|
2222
2222
|
const knownProviders = ["anthropic", "openai", "gemini", "azure", "openai-compatible", "ollama"];
|
|
@@ -10566,6 +10566,11 @@ var DashboardSocket = class {
|
|
|
10566
10566
|
emitToSocket(socketId, event, data) {
|
|
10567
10567
|
this.io.sockets.sockets.get(socketId)?.emit(event, data);
|
|
10568
10568
|
}
|
|
10569
|
+
onConfigGet(callback) {
|
|
10570
|
+
this.io.on("connection", (socket) => {
|
|
10571
|
+
socket.on("config:get", () => callback(socket.id));
|
|
10572
|
+
});
|
|
10573
|
+
}
|
|
10569
10574
|
onCascadeRun(callback) {
|
|
10570
10575
|
this.io.on("connection", (socket) => {
|
|
10571
10576
|
socket.on("cascade:run", (payload) => {
|
|
@@ -10612,6 +10617,16 @@ var DashboardServer = class {
|
|
|
10612
10617
|
this.socket.onSessionRate((sessionId, rating) => {
|
|
10613
10618
|
this.activeSessions.get(sessionId)?.rateLastRun(rating);
|
|
10614
10619
|
});
|
|
10620
|
+
this.socket.onConfigGet((socketId) => {
|
|
10621
|
+
this.socket.emitToSocket(socketId, "config:current", {
|
|
10622
|
+
models: this.config.models ?? {},
|
|
10623
|
+
budget: {
|
|
10624
|
+
maxCostPerRun: this.config.budget?.maxCostPerRunUsd,
|
|
10625
|
+
autoBias: this.config.autoBias
|
|
10626
|
+
},
|
|
10627
|
+
providersWithKey: (this.config.providers ?? []).filter((p) => typeof p.apiKey === "string" && p.apiKey.length > 0).map((p) => p.type)
|
|
10628
|
+
});
|
|
10629
|
+
});
|
|
10615
10630
|
this.socket.onConfigUpdate((data) => {
|
|
10616
10631
|
if (data.keys) {
|
|
10617
10632
|
for (const [type, apiKey] of Object.entries(data.keys)) {
|
|
@@ -10622,7 +10637,11 @@ var DashboardServer = class {
|
|
|
10622
10637
|
}
|
|
10623
10638
|
}
|
|
10624
10639
|
if (data.models) {
|
|
10625
|
-
|
|
10640
|
+
const models = this.config.models;
|
|
10641
|
+
for (const [tier, val] of Object.entries(data.models)) {
|
|
10642
|
+
if (val && val !== "auto") models[tier] = val;
|
|
10643
|
+
else delete models[tier];
|
|
10644
|
+
}
|
|
10626
10645
|
}
|
|
10627
10646
|
if (data.budget) {
|
|
10628
10647
|
if (typeof data.budget.maxCostPerRun === "number") {
|
|
@@ -10632,6 +10651,7 @@ var DashboardServer = class {
|
|
|
10632
10651
|
this.config.autoBias = data.budget.autoBias;
|
|
10633
10652
|
}
|
|
10634
10653
|
}
|
|
10654
|
+
this.persistConfig();
|
|
10635
10655
|
});
|
|
10636
10656
|
this.socket.onCascadeRun(async (prompt, model, socketId) => {
|
|
10637
10657
|
const sessionId = randomUUID();
|
|
@@ -10708,6 +10728,20 @@ var DashboardServer = class {
|
|
|
10708
10728
|
getSocket() {
|
|
10709
10729
|
return this.socket;
|
|
10710
10730
|
}
|
|
10731
|
+
/**
|
|
10732
|
+
* Write the in-memory config back to the workspace config file so mutations
|
|
10733
|
+
* made over the socket (Settings → Save) persist across restarts. Best-effort:
|
|
10734
|
+
* a write failure is logged but never crashes the running dashboard.
|
|
10735
|
+
*/
|
|
10736
|
+
persistConfig() {
|
|
10737
|
+
try {
|
|
10738
|
+
const configPath = path18.join(this.workspacePath, CASCADE_CONFIG_FILE);
|
|
10739
|
+
fs17.mkdirSync(path18.dirname(configPath), { recursive: true });
|
|
10740
|
+
fs17.writeFileSync(configPath, JSON.stringify(this.config, null, 2), "utf-8");
|
|
10741
|
+
} catch (err) {
|
|
10742
|
+
console.warn(`[dashboard] Failed to persist config: ${err instanceof Error ? err.message : String(err)}`);
|
|
10743
|
+
}
|
|
10744
|
+
}
|
|
10711
10745
|
/**
|
|
10712
10746
|
* Produce a stable dashboard JWT signing secret.
|
|
10713
10747
|
*
|