cascade-ai 0.2.1 → 0.2.2

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.js CHANGED
@@ -82,7 +82,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
82
82
  var CASCADE_VERSION, CASCADE_CONFIG_FILE, CASCADE_DB_FILE, CASCADE_DASHBOARD_SECRET_FILE, GLOBAL_CONFIG_DIR, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, DEFAULT_DASHBOARD_PORT, DEFAULT_CONTEXT_LIMIT, DEFAULT_AUTO_SUMMARIZE_AT, MODELS, T1_MODEL_PRIORITY, T2_MODEL_PRIORITY, T3_MODEL_PRIORITY, VISION_MODEL_PRIORITY, COMPLEXITY_T2_COUNT, THEME_NAMES, DEFAULT_THEME, OLLAMA_BASE_URL, LM_STUDIO_BASE_URL, AZURE_BASE_URL_TEMPLATE, TOOL_NAMES, DEFAULT_APPROVAL_REQUIRED;
83
83
  var init_constants = __esm({
84
84
  "src/constants.ts"() {
85
- CASCADE_VERSION = "0.2.0";
85
+ CASCADE_VERSION = "0.2.2";
86
86
  CASCADE_CONFIG_FILE = ".cascade/config.json";
87
87
  CASCADE_DB_FILE = ".cascade/memory.db";
88
88
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -3807,14 +3807,13 @@ Now execute your subtask using this context where relevant.`
3807
3807
  await this.peerBus.barrier(this.id, barrierName, total);
3808
3808
  }
3809
3809
  receivePeerSync(fromId, content) {
3810
- const existing = this.peerSyncBuffer.find((p) => p.fromId === fromId);
3811
- if (existing) {
3812
- existing.content = content;
3813
- existing.timestamp = (/* @__PURE__ */ new Date()).toISOString();
3814
- } else {
3815
- this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
3816
- }
3810
+ this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
3817
3811
  this.emit("peer-sync-received", { fromId, content });
3812
+ this.context.addMessage({
3813
+ role: "user",
3814
+ content: `[SYSTEM_NOTIFICATION]: You received a new peer message from ${fromId}. Use the "peer_message" tool with action="receive" to read it.`
3815
+ }).catch(() => {
3816
+ });
3818
3817
  }
3819
3818
  // ── Private ──────────────────────────────────
3820
3819
  async runAgentLoop(systemPrompt, tools) {
@@ -3945,7 +3944,11 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
3945
3944
  sendPeerSync: (to, syncType, content) => {
3946
3945
  this.peerBus?.send(this.id, to, syncType, this.assignment?.subtaskId ?? "", content);
3947
3946
  },
3948
- getPeerMessages: () => [...this.peerSyncBuffer]
3947
+ getPeerMessages: () => {
3948
+ const msgs = [...this.peerSyncBuffer];
3949
+ this.peerSyncBuffer = [];
3950
+ return msgs;
3951
+ }
3949
3952
  });
3950
3953
  if (this.audit) {
3951
3954
  this.audit.toolCall(this.id, tc.name, tc.input);
@@ -4487,13 +4490,17 @@ var T2Manager = class extends BaseTier {
4487
4490
  }
4488
4491
  // ── Private ──────────────────────────────────
4489
4492
  async decomposeSection(assignment) {
4493
+ const peerPlans = this.peerSyncBuffer.filter((p) => p.content?.type === "T2_PLAN_ANNOUNCEMENT").map((p) => `[Peer ${p.fromId} Plan]: ${p.content.sectionTitle} - ${p.content.subtaskTitles?.join(", ")}`).join("\n");
4490
4494
  const prompt = `Decompose this section into 2-5 concrete subtasks for T3 workers.
4491
4495
 
4492
4496
  Section: ${assignment.sectionTitle}
4493
4497
  Description: ${assignment.description}
4494
4498
  Expected output: ${assignment.expectedOutput}
4495
4499
  Constraints: ${assignment.constraints.join("; ")}
4496
-
4500
+ ${peerPlans ? `
4501
+ Context from sibling T2 plans (use this to align execution and avoid overlaps):
4502
+ ${peerPlans}
4503
+ ` : ""}
4497
4504
  Return a JSON array of subtask objects, each with:
4498
4505
  - subtaskId: string (unique)
4499
4506
  - subtaskTitle: string
@@ -4707,9 +4714,14 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
4707
4714
  const completed = results.filter((r) => r.status === "COMPLETED");
4708
4715
  if (!completed.length) return `Section ${assignment.sectionTitle} failed \u2014 no T3 workers completed.`;
4709
4716
  const outputs = completed.map((r, i) => `[T3-${i + 1}]: ${r.output}`).join("\n\n");
4717
+ const peerOutputs = this.peerSyncBuffer.filter((p) => p.content?.type === "T2_SECTION_OUTPUT").map((p) => `[Peer ${p.fromId} Output]: ${p.content.output}`).join("\n\n");
4710
4718
  const prompt = `Summarize these T3 worker outputs for section "${assignment.sectionTitle}" in 2-3 sentences:
4711
4719
 
4712
- ${outputs}`;
4720
+ ${outputs}
4721
+ ${peerOutputs ? `
4722
+
4723
+ Context from sibling T2 completed sections (use this to ensure your summary aligns with the overall state):
4724
+ ${peerOutputs}` : ""}`;
4713
4725
  const messages = [{ role: "user", content: prompt }];
4714
4726
  try {
4715
4727
  const result = await this.router.generate("T2", {