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/index.cjs CHANGED
@@ -164,7 +164,7 @@ var require_keytar2 = __commonJS({
164
164
  });
165
165
 
166
166
  // src/constants.ts
167
- var CASCADE_VERSION = "0.2.0";
167
+ var CASCADE_VERSION = "0.2.2";
168
168
  var CASCADE_CONFIG_DIR = ".cascade";
169
169
  var CASCADE_MD_FILE = "CASCADE.md";
170
170
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -2307,14 +2307,13 @@ Now execute your subtask using this context where relevant.`
2307
2307
  await this.peerBus.barrier(this.id, barrierName, total);
2308
2308
  }
2309
2309
  receivePeerSync(fromId, content) {
2310
- const existing = this.peerSyncBuffer.find((p) => p.fromId === fromId);
2311
- if (existing) {
2312
- existing.content = content;
2313
- existing.timestamp = (/* @__PURE__ */ new Date()).toISOString();
2314
- } else {
2315
- this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
2316
- }
2310
+ this.peerSyncBuffer.push({ fromId, content, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
2317
2311
  this.emit("peer-sync-received", { fromId, content });
2312
+ this.context.addMessage({
2313
+ role: "user",
2314
+ content: `[SYSTEM_NOTIFICATION]: You received a new peer message from ${fromId}. Use the "peer_message" tool with action="receive" to read it.`
2315
+ }).catch(() => {
2316
+ });
2318
2317
  }
2319
2318
  // ── Private ──────────────────────────────────
2320
2319
  async runAgentLoop(systemPrompt, tools) {
@@ -2445,7 +2444,11 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
2445
2444
  sendPeerSync: (to, syncType, content) => {
2446
2445
  this.peerBus?.send(this.id, to, syncType, this.assignment?.subtaskId ?? "", content);
2447
2446
  },
2448
- getPeerMessages: () => [...this.peerSyncBuffer]
2447
+ getPeerMessages: () => {
2448
+ const msgs = [...this.peerSyncBuffer];
2449
+ this.peerSyncBuffer = [];
2450
+ return msgs;
2451
+ }
2449
2452
  });
2450
2453
  if (this.audit) {
2451
2454
  this.audit.toolCall(this.id, tc.name, tc.input);
@@ -2987,13 +2990,17 @@ var T2Manager = class extends BaseTier {
2987
2990
  }
2988
2991
  // ── Private ──────────────────────────────────
2989
2992
  async decomposeSection(assignment) {
2993
+ 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");
2990
2994
  const prompt = `Decompose this section into 2-5 concrete subtasks for T3 workers.
2991
2995
 
2992
2996
  Section: ${assignment.sectionTitle}
2993
2997
  Description: ${assignment.description}
2994
2998
  Expected output: ${assignment.expectedOutput}
2995
2999
  Constraints: ${assignment.constraints.join("; ")}
2996
-
3000
+ ${peerPlans ? `
3001
+ Context from sibling T2 plans (use this to align execution and avoid overlaps):
3002
+ ${peerPlans}
3003
+ ` : ""}
2997
3004
  Return a JSON array of subtask objects, each with:
2998
3005
  - subtaskId: string (unique)
2999
3006
  - subtaskTitle: string
@@ -3207,9 +3214,14 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
3207
3214
  const completed = results.filter((r) => r.status === "COMPLETED");
3208
3215
  if (!completed.length) return `Section ${assignment.sectionTitle} failed \u2014 no T3 workers completed.`;
3209
3216
  const outputs = completed.map((r, i) => `[T3-${i + 1}]: ${r.output}`).join("\n\n");
3217
+ const peerOutputs = this.peerSyncBuffer.filter((p) => p.content?.type === "T2_SECTION_OUTPUT").map((p) => `[Peer ${p.fromId} Output]: ${p.content.output}`).join("\n\n");
3210
3218
  const prompt = `Summarize these T3 worker outputs for section "${assignment.sectionTitle}" in 2-3 sentences:
3211
3219
 
3212
- ${outputs}`;
3220
+ ${outputs}
3221
+ ${peerOutputs ? `
3222
+
3223
+ Context from sibling T2 completed sections (use this to ensure your summary aligns with the overall state):
3224
+ ${peerOutputs}` : ""}`;
3213
3225
  const messages = [{ role: "user", content: prompt }];
3214
3226
  try {
3215
3227
  const result = await this.router.generate("T2", {