cascade-ai 0.2.12 → 0.3.0

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.cjs CHANGED
@@ -165,7 +165,7 @@ var require_keytar2 = __commonJS({
165
165
  });
166
166
 
167
167
  // src/constants.ts
168
- var CASCADE_VERSION = "0.2.12";
168
+ var CASCADE_VERSION = "0.3.0";
169
169
  var CASCADE_CONFIG_DIR = ".cascade";
170
170
  var CASCADE_MD_FILE = "CASCADE.md";
171
171
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -2036,7 +2036,7 @@ var BaseTier = class extends EventEmitter__default.default {
2036
2036
  getStatus() {
2037
2037
  return this.status;
2038
2038
  }
2039
- setStatus(status) {
2039
+ setStatus(status, output) {
2040
2040
  this.status = status;
2041
2041
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
2042
2042
  const event = {
@@ -2045,7 +2045,8 @@ var BaseTier = class extends EventEmitter__default.default {
2045
2045
  parentId: this.parentId,
2046
2046
  label: this.label,
2047
2047
  status,
2048
- timestamp
2048
+ timestamp,
2049
+ output
2049
2050
  };
2050
2051
  this.emit("status", event);
2051
2052
  this.emit("tier:status", event);
@@ -2071,7 +2072,8 @@ var BaseTier = class extends EventEmitter__default.default {
2071
2072
  status: this.status,
2072
2073
  currentAction: update.currentAction,
2073
2074
  progressPct: update.progressPct,
2074
- timestamp
2075
+ timestamp,
2076
+ output: update.output
2075
2077
  });
2076
2078
  }
2077
2079
  buildMessage(type, to, payload) {
@@ -2451,16 +2453,17 @@ Now execute your subtask using this context where relevant.`
2451
2453
  return this.buildResult("ESCALATED", output, { checksRun, passed, failed }, issues, correctionAttempts);
2452
2454
  }
2453
2455
  }
2454
- this.setStatus("COMPLETED");
2455
- this.sendStatusUpdate({ progressPct: 100, currentAction: "Subtask complete", status: "IN_PROGRESS" });
2456
+ this.setStatus("COMPLETED", output);
2457
+ this.sendStatusUpdate({ progressPct: 100, currentAction: "Subtask complete", status: "IN_PROGRESS", output });
2456
2458
  this.peerBus?.publish(this.id, assignment.subtaskId, output, "COMPLETED");
2457
2459
  return this.buildResult("COMPLETED", output, { checksRun, passed, failed }, issues, correctionAttempts);
2458
2460
  } catch (err) {
2459
2461
  const errMsg = err instanceof Error ? err.message : String(err);
2460
2462
  issues.push(`Execution error: ${errMsg}`);
2461
- this.setStatus("FAILED");
2462
- this.peerBus?.publish(this.id, assignment.subtaskId, errMsg, "FAILED");
2463
- return this.buildResult("ESCALATED", output || errMsg, { checksRun, passed, failed }, issues, correctionAttempts);
2463
+ const finalOutput = output || errMsg;
2464
+ this.setStatus("FAILED", finalOutput);
2465
+ this.peerBus?.publish(this.id, assignment.subtaskId, finalOutput, "FAILED");
2466
+ return this.buildResult("ESCALATED", finalOutput, { checksRun, passed, failed }, issues, correctionAttempts);
2464
2467
  }
2465
2468
  }
2466
2469
  sendToPeer(toId, content) {
@@ -3143,8 +3146,9 @@ var T2Manager = class extends BaseTier {
3143
3146
  const summary = await this.aggregateResults(assignment, t3Results);
3144
3147
  const issues = t3Results.filter((r) => r.status !== "COMPLETED").flatMap((r) => r.issues);
3145
3148
  const overallStatus = this.determineStatus(t3Results);
3146
- this.setStatus(overallStatus === "COMPLETED" ? "COMPLETED" : "FAILED");
3147
- this.sendStatusUpdate({ progressPct: 100, currentAction: "Section complete", status: "IN_PROGRESS" });
3149
+ const isOk = overallStatus === "COMPLETED" || overallStatus === "PARTIAL";
3150
+ this.setStatus(isOk ? "COMPLETED" : "FAILED", summary);
3151
+ this.sendStatusUpdate({ progressPct: 100, currentAction: "Section complete", status: "IN_PROGRESS", output: summary });
3148
3152
  const result = {
3149
3153
  sectionId: assignment.sectionId,
3150
3154
  sectionTitle: assignment.sectionTitle,
@@ -3157,7 +3161,7 @@ var T2Manager = class extends BaseTier {
3157
3161
  return result;
3158
3162
  } catch (err) {
3159
3163
  const errMsg = err instanceof Error ? err.message : String(err);
3160
- this.setStatus("FAILED");
3164
+ this.setStatus("FAILED", errMsg);
3161
3165
  const failedResult = {
3162
3166
  sectionId: assignment.sectionId,
3163
3167
  sectionTitle: assignment.sectionTitle,
@@ -3719,8 +3723,8 @@ Create a CORRECTION PLAN that contains only the new sections needed to fix the i
3719
3723
  status: "IN_PROGRESS"
3720
3724
  });
3721
3725
  const output = await this.compileFinalOutput(userPrompt, plan, allT2Results);
3722
- this.setStatus("COMPLETED");
3723
- this.sendStatusUpdate({ progressPct: 100, currentAction: "Task complete", status: "IN_PROGRESS" });
3726
+ this.setStatus("COMPLETED", output);
3727
+ this.sendStatusUpdate({ progressPct: 100, currentAction: "Task complete", status: "IN_PROGRESS", output });
3724
3728
  return { output, t2Results: allT2Results, taskId: this.taskId, complexity: plan.complexity };
3725
3729
  }
3726
3730
  getEscalations() {
@@ -6858,8 +6862,8 @@ Original error: ${err.message}`
6858
6862
  upsertRuntimeNode(node) {
6859
6863
  this.enqueueWrite(() => {
6860
6864
  this.db.prepare(`
6861
- INSERT INTO runtime_nodes (tier_id, session_id, parent_id, role, label, status, current_action, progress_pct, updated_at, workspace_path, is_global)
6862
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
6865
+ INSERT INTO runtime_nodes (tier_id, session_id, parent_id, role, label, status, current_action, progress_pct, updated_at, workspace_path, is_global, output)
6866
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
6863
6867
  ON CONFLICT(tier_id) DO UPDATE SET
6864
6868
  session_id = excluded.session_id,
6865
6869
  parent_id = excluded.parent_id,
@@ -6870,7 +6874,8 @@ Original error: ${err.message}`
6870
6874
  progress_pct = excluded.progress_pct,
6871
6875
  updated_at = excluded.updated_at,
6872
6876
  workspace_path = excluded.workspace_path,
6873
- is_global = excluded.is_global
6877
+ is_global = excluded.is_global,
6878
+ output = excluded.output
6874
6879
  `).run(
6875
6880
  node.tierId,
6876
6881
  node.sessionId,
@@ -6882,7 +6887,8 @@ Original error: ${err.message}`
6882
6887
  node.progressPct ?? null,
6883
6888
  node.updatedAt,
6884
6889
  node.workspacePath ?? null,
6885
- node.isGlobal ? 1 : 0
6890
+ node.isGlobal ? 1 : 0,
6891
+ node.output ?? null
6886
6892
  );
6887
6893
  });
6888
6894
  }
@@ -6903,14 +6909,15 @@ Original error: ${err.message}`
6903
6909
  progressPct: row.progress_pct ?? void 0,
6904
6910
  updatedAt: row.updated_at,
6905
6911
  workspacePath: row.workspace_path ?? void 0,
6906
- isGlobal: row.is_global === 1
6912
+ isGlobal: row.is_global === 1,
6913
+ output: row.output ?? void 0
6907
6914
  }));
6908
6915
  }
6909
6916
  addRuntimeNodeLog(log) {
6910
6917
  this.enqueueWrite(() => {
6911
6918
  this.db.prepare(`
6912
- INSERT INTO runtime_node_logs (id, session_id, tier_id, role, label, status, current_action, progress_pct, timestamp, workspace_path, is_global)
6913
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
6919
+ INSERT INTO runtime_node_logs (id, session_id, tier_id, role, label, status, current_action, progress_pct, timestamp, workspace_path, is_global, output)
6920
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
6914
6921
  `).run(
6915
6922
  log.id,
6916
6923
  log.sessionId,
@@ -6922,7 +6929,8 @@ Original error: ${err.message}`
6922
6929
  log.progressPct ?? null,
6923
6930
  log.timestamp,
6924
6931
  log.workspacePath ?? null,
6925
- log.isGlobal ? 1 : 0
6932
+ log.isGlobal ? 1 : 0,
6933
+ log.output ?? null
6926
6934
  );
6927
6935
  this.db.prepare(`
6928
6936
  DELETE FROM runtime_node_logs
@@ -6965,7 +6973,8 @@ Original error: ${err.message}`
6965
6973
  progressPct: row.progress_pct ?? void 0,
6966
6974
  timestamp: row.timestamp,
6967
6975
  workspacePath: row.workspace_path ?? void 0,
6968
- isGlobal: row.is_global === 1
6976
+ isGlobal: row.is_global === 1,
6977
+ output: row.output ?? void 0
6969
6978
  }));
6970
6979
  }
6971
6980
  // ── Messages ──────────────────────────────────
@@ -7292,7 +7301,8 @@ Original error: ${err.message}`
7292
7301
  progress_pct INTEGER,
7293
7302
  updated_at TEXT NOT NULL,
7294
7303
  workspace_path TEXT,
7295
- is_global INTEGER NOT NULL DEFAULT 0
7304
+ is_global INTEGER NOT NULL DEFAULT 0,
7305
+ output TEXT
7296
7306
  );
7297
7307
 
7298
7308
  CREATE INDEX IF NOT EXISTS idx_runtime_nodes_session ON runtime_nodes(session_id);
@@ -7309,7 +7319,8 @@ Original error: ${err.message}`
7309
7319
  progress_pct INTEGER,
7310
7320
  timestamp TEXT NOT NULL,
7311
7321
  workspace_path TEXT,
7312
- is_global INTEGER NOT NULL DEFAULT 0
7322
+ is_global INTEGER NOT NULL DEFAULT 0,
7323
+ output TEXT
7313
7324
  );
7314
7325
 
7315
7326
  CREATE TABLE IF NOT EXISTS model_cache (
@@ -7338,6 +7349,14 @@ Original error: ${err.message}`
7338
7349
 
7339
7350
  CREATE INDEX IF NOT EXISTS idx_file_snapshots_session ON file_snapshots(session_id);
7340
7351
  `);
7352
+ try {
7353
+ this.db.exec("ALTER TABLE runtime_nodes ADD COLUMN output TEXT");
7354
+ } catch {
7355
+ }
7356
+ try {
7357
+ this.db.exec("ALTER TABLE runtime_node_logs ADD COLUMN output TEXT");
7358
+ } catch {
7359
+ }
7341
7360
  }
7342
7361
  // ── Deserializers ─────────────────────────────
7343
7362
  deserializeSession(row, messages) {
@@ -8111,8 +8130,8 @@ var DashboardServer = class {
8111
8130
  void (async () => {
8112
8131
  const cascade = new Cascade(this.config, this.workspacePath, this.store);
8113
8132
  cascade.on("stream:token", (e) => {
8114
- this.socket.broadcast("stream:token", { sessionId, token: e.text });
8115
- this.socket.broadcastToRoom(`session:${sessionId}`, "stream:token", { sessionId, token: e.text });
8133
+ this.socket.broadcast("stream:token", { sessionId, tierId: e.tierId, text: e.text });
8134
+ this.socket.broadcastToRoom(`session:${sessionId}`, "stream:token", { sessionId, tierId: e.tierId, text: e.text });
8116
8135
  });
8117
8136
  cascade.on("tier:status", (e) => {
8118
8137
  this.socket.broadcast("tier:status", { sessionId, ...e });