cascade-ai 0.12.3 → 0.12.5

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/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
  *
@@ -2218,7 +2225,7 @@ declare class Telemetry {
2218
2225
  shutdown(): Promise<void>;
2219
2226
  }
2220
2227
 
2221
- declare const CASCADE_VERSION = "0.9.6";
2228
+ declare const CASCADE_VERSION: string;
2222
2229
  declare const CASCADE_CONFIG_DIR = ".cascade";
2223
2230
  declare const CASCADE_MD_FILE = "CASCADE.md";
2224
2231
  declare const CASCADE_IGNORE_FILE = ".cascadeignore";
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
  *
@@ -2218,7 +2225,7 @@ declare class Telemetry {
2218
2225
  shutdown(): Promise<void>;
2219
2226
  }
2220
2227
 
2221
- declare const CASCADE_VERSION = "0.9.6";
2228
+ declare const CASCADE_VERSION: string;
2222
2229
  declare const CASCADE_CONFIG_DIR = ".cascade";
2223
2230
  declare const CASCADE_MD_FILE = "CASCADE.md";
2224
2231
  declare const CASCADE_IGNORE_FILE = ".cascadeignore";
package/dist/index.js CHANGED
@@ -32,100 +32,10 @@ import jwt from 'jsonwebtoken';
32
32
  import cron from 'node-cron';
33
33
 
34
34
  // Cascade AI — Multi-tier AI Orchestration System
35
- var __create = Object.create;
36
- var __defProp = Object.defineProperty;
37
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
38
- var __getOwnPropNames = Object.getOwnPropertyNames;
39
- var __getProtoOf = Object.getPrototypeOf;
40
- var __hasOwnProp = Object.prototype.hasOwnProperty;
41
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
42
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
43
- }) : x)(function(x) {
44
- if (typeof require !== "undefined") return require.apply(this, arguments);
45
- throw Error('Dynamic require of "' + x + '" is not supported');
46
- });
47
- var __esm = (fn, res) => function __init() {
48
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
49
- };
50
- var __commonJS = (cb, mod) => function __require2() {
51
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
52
- };
53
- var __copyProps = (to, from, except, desc) => {
54
- if (from && typeof from === "object" || typeof from === "function") {
55
- for (let key of __getOwnPropNames(from))
56
- if (!__hasOwnProp.call(to, key) && key !== except)
57
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
58
- }
59
- return to;
60
- };
61
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
62
- // If the importer is in node compatibility mode or this is not an ESM
63
- // file that has been converted to a CommonJS file using a Babel-
64
- // compatible transform (i.e. "__esModule" has not been set), then set
65
- // "default" to the CommonJS "module.exports" for node compatibility.
66
- __defProp(target, "default", { value: mod, enumerable: true }) ,
67
- mod
68
- ));
69
-
70
- // node_modules/keytar/build/Release/keytar.node
71
- var keytar_default;
72
- var init_keytar = __esm({
73
- "node_modules/keytar/build/Release/keytar.node"() {
74
- keytar_default = "./keytar-VMICNFEJ.node";
75
- }
76
- });
77
-
78
- // node-file:/home/runner/work/Cascade-AI/Cascade-AI/node_modules/keytar/build/Release/keytar.node
79
- var require_keytar = __commonJS({
80
- "node-file:/home/runner/work/Cascade-AI/Cascade-AI/node_modules/keytar/build/Release/keytar.node"(exports, module) {
81
- init_keytar();
82
- try {
83
- module.exports = __require(keytar_default);
84
- } catch {
85
- }
86
- }
87
- });
88
35
 
89
- // node_modules/keytar/lib/keytar.js
90
- var require_keytar2 = __commonJS({
91
- "node_modules/keytar/lib/keytar.js"(exports, module) {
92
- var keytar = require_keytar();
93
- function checkRequired(val, name) {
94
- if (!val || val.length <= 0) {
95
- throw new Error(name + " is required.");
96
- }
97
- }
98
- module.exports = {
99
- getPassword: function(service, account) {
100
- checkRequired(service, "Service");
101
- checkRequired(account, "Account");
102
- return keytar.getPassword(service, account);
103
- },
104
- setPassword: function(service, account, password) {
105
- checkRequired(service, "Service");
106
- checkRequired(account, "Account");
107
- checkRequired(password, "Password");
108
- return keytar.setPassword(service, account, password);
109
- },
110
- deletePassword: function(service, account) {
111
- checkRequired(service, "Service");
112
- checkRequired(account, "Account");
113
- return keytar.deletePassword(service, account);
114
- },
115
- findPassword: function(service) {
116
- checkRequired(service, "Service");
117
- return keytar.findPassword(service);
118
- },
119
- findCredentials: function(service) {
120
- checkRequired(service, "Service");
121
- return keytar.findCredentials(service);
122
- }
123
- };
124
- }
125
- });
126
36
 
127
37
  // src/constants.ts
128
- var CASCADE_VERSION = "0.9.6";
38
+ var CASCADE_VERSION = "0.12.5";
129
39
  var CASCADE_CONFIG_DIR = ".cascade";
130
40
  var CASCADE_MD_FILE = "CASCADE.md";
131
41
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -2216,7 +2126,7 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter {
2216
2126
  }
2217
2127
  for (const tier of ["T1", "T2", "T3"]) {
2218
2128
  const override = tier === "T1" ? config.models.t1 : tier === "T2" ? config.models.t2 : config.models.t3;
2219
- if (!override) continue;
2129
+ if (!override || override === "auto") continue;
2220
2130
  const model = this.selector.selectForTier(tier, override);
2221
2131
  if (!model) {
2222
2132
  const knownProviders = ["anthropic", "openai", "gemini", "azure", "openai-compatible", "ollama"];
@@ -9264,7 +9174,7 @@ var PBKDF2_ITERATIONS = 1e5;
9264
9174
  var KEYTAR_SERVICE = "cascade-ai";
9265
9175
  async function loadKeytar() {
9266
9176
  try {
9267
- const mod = await Promise.resolve().then(() => __toESM(require_keytar2(), 1));
9177
+ const mod = await import('keytar');
9268
9178
  const candidate = mod.default ?? mod;
9269
9179
  if (typeof candidate.getPassword !== "function") return null;
9270
9180
  return candidate;
@@ -10566,6 +10476,11 @@ var DashboardSocket = class {
10566
10476
  emitToSocket(socketId, event, data) {
10567
10477
  this.io.sockets.sockets.get(socketId)?.emit(event, data);
10568
10478
  }
10479
+ onConfigGet(callback) {
10480
+ this.io.on("connection", (socket) => {
10481
+ socket.on("config:get", () => callback(socket.id));
10482
+ });
10483
+ }
10569
10484
  onCascadeRun(callback) {
10570
10485
  this.io.on("connection", (socket) => {
10571
10486
  socket.on("cascade:run", (payload) => {
@@ -10612,6 +10527,16 @@ var DashboardServer = class {
10612
10527
  this.socket.onSessionRate((sessionId, rating) => {
10613
10528
  this.activeSessions.get(sessionId)?.rateLastRun(rating);
10614
10529
  });
10530
+ this.socket.onConfigGet((socketId) => {
10531
+ this.socket.emitToSocket(socketId, "config:current", {
10532
+ models: this.config.models ?? {},
10533
+ budget: {
10534
+ maxCostPerRun: this.config.budget?.maxCostPerRunUsd,
10535
+ autoBias: this.config.autoBias
10536
+ },
10537
+ providersWithKey: (this.config.providers ?? []).filter((p) => typeof p.apiKey === "string" && p.apiKey.length > 0).map((p) => p.type)
10538
+ });
10539
+ });
10615
10540
  this.socket.onConfigUpdate((data) => {
10616
10541
  if (data.keys) {
10617
10542
  for (const [type, apiKey] of Object.entries(data.keys)) {
@@ -10622,7 +10547,11 @@ var DashboardServer = class {
10622
10547
  }
10623
10548
  }
10624
10549
  if (data.models) {
10625
- this.config.models = { ...this.config.models, ...data.models };
10550
+ const models = this.config.models;
10551
+ for (const [tier, val] of Object.entries(data.models)) {
10552
+ if (val && val !== "auto") models[tier] = val;
10553
+ else delete models[tier];
10554
+ }
10626
10555
  }
10627
10556
  if (data.budget) {
10628
10557
  if (typeof data.budget.maxCostPerRun === "number") {
@@ -10632,6 +10561,7 @@ var DashboardServer = class {
10632
10561
  this.config.autoBias = data.budget.autoBias;
10633
10562
  }
10634
10563
  }
10564
+ this.persistConfig();
10635
10565
  });
10636
10566
  this.socket.onCascadeRun(async (prompt, model, socketId) => {
10637
10567
  const sessionId = randomUUID();
@@ -10708,6 +10638,20 @@ var DashboardServer = class {
10708
10638
  getSocket() {
10709
10639
  return this.socket;
10710
10640
  }
10641
+ /**
10642
+ * Write the in-memory config back to the workspace config file so mutations
10643
+ * made over the socket (Settings → Save) persist across restarts. Best-effort:
10644
+ * a write failure is logged but never crashes the running dashboard.
10645
+ */
10646
+ persistConfig() {
10647
+ try {
10648
+ const configPath = path18.join(this.workspacePath, CASCADE_CONFIG_FILE);
10649
+ fs17.mkdirSync(path18.dirname(configPath), { recursive: true });
10650
+ fs17.writeFileSync(configPath, JSON.stringify(this.config, null, 2), "utf-8");
10651
+ } catch (err) {
10652
+ console.warn(`[dashboard] Failed to persist config: ${err instanceof Error ? err.message : String(err)}`);
10653
+ }
10654
+ }
10711
10655
  /**
10712
10656
  * Produce a stable dashboard JWT signing secret.
10713
10657
  *