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.cjs CHANGED
@@ -129,7 +129,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
129
129
  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;
130
130
  var init_constants = __esm({
131
131
  "src/constants.ts"() {
132
- CASCADE_VERSION = "0.2.0";
132
+ CASCADE_VERSION = "0.2.2";
133
133
  CASCADE_CONFIG_FILE = ".cascade/config.json";
134
134
  CASCADE_DB_FILE = ".cascade/memory.db";
135
135
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -3854,14 +3854,13 @@ Now execute your subtask using this context where relevant.`
3854
3854
  await this.peerBus.barrier(this.id, barrierName, total);
3855
3855
  }
3856
3856
  receivePeerSync(fromId, content) {
3857
- const existing = this.peerSyncBuffer.find((p) => p.fromId === fromId);
3858
- if (existing) {
3859
- existing.content = content;
3860
- existing.timestamp = (/* @__PURE__ */ new Date()).toISOString();
3861
- } else {
3862
- this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
3863
- }
3857
+ this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
3864
3858
  this.emit("peer-sync-received", { fromId, content });
3859
+ this.context.addMessage({
3860
+ role: "user",
3861
+ content: `[SYSTEM_NOTIFICATION]: You received a new peer message from ${fromId}. Use the "peer_message" tool with action="receive" to read it.`
3862
+ }).catch(() => {
3863
+ });
3865
3864
  }
3866
3865
  // ── Private ──────────────────────────────────
3867
3866
  async runAgentLoop(systemPrompt, tools) {
@@ -3992,7 +3991,11 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
3992
3991
  sendPeerSync: (to, syncType, content) => {
3993
3992
  this.peerBus?.send(this.id, to, syncType, this.assignment?.subtaskId ?? "", content);
3994
3993
  },
3995
- getPeerMessages: () => [...this.peerSyncBuffer]
3994
+ getPeerMessages: () => {
3995
+ const msgs = [...this.peerSyncBuffer];
3996
+ this.peerSyncBuffer = [];
3997
+ return msgs;
3998
+ }
3996
3999
  });
3997
4000
  if (this.audit) {
3998
4001
  this.audit.toolCall(this.id, tc.name, tc.input);
@@ -4534,13 +4537,17 @@ var T2Manager = class extends BaseTier {
4534
4537
  }
4535
4538
  // ── Private ──────────────────────────────────
4536
4539
  async decomposeSection(assignment) {
4540
+ 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");
4537
4541
  const prompt = `Decompose this section into 2-5 concrete subtasks for T3 workers.
4538
4542
 
4539
4543
  Section: ${assignment.sectionTitle}
4540
4544
  Description: ${assignment.description}
4541
4545
  Expected output: ${assignment.expectedOutput}
4542
4546
  Constraints: ${assignment.constraints.join("; ")}
4543
-
4547
+ ${peerPlans ? `
4548
+ Context from sibling T2 plans (use this to align execution and avoid overlaps):
4549
+ ${peerPlans}
4550
+ ` : ""}
4544
4551
  Return a JSON array of subtask objects, each with:
4545
4552
  - subtaskId: string (unique)
4546
4553
  - subtaskTitle: string
@@ -4754,9 +4761,14 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
4754
4761
  const completed = results.filter((r) => r.status === "COMPLETED");
4755
4762
  if (!completed.length) return `Section ${assignment.sectionTitle} failed \u2014 no T3 workers completed.`;
4756
4763
  const outputs = completed.map((r, i) => `[T3-${i + 1}]: ${r.output}`).join("\n\n");
4764
+ const peerOutputs = this.peerSyncBuffer.filter((p) => p.content?.type === "T2_SECTION_OUTPUT").map((p) => `[Peer ${p.fromId} Output]: ${p.content.output}`).join("\n\n");
4757
4765
  const prompt = `Summarize these T3 worker outputs for section "${assignment.sectionTitle}" in 2-3 sentences:
4758
4766
 
4759
- ${outputs}`;
4767
+ ${outputs}
4768
+ ${peerOutputs ? `
4769
+
4770
+ Context from sibling T2 completed sections (use this to ensure your summary aligns with the overall state):
4771
+ ${peerOutputs}` : ""}`;
4760
4772
  const messages = [{ role: "user", content: prompt }];
4761
4773
  try {
4762
4774
  const result = await this.router.generate("T2", {