teapot-coding-agent 0.21.0 → 0.22.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.
@@ -1619,10 +1619,30 @@ export class Agent {
1619
1619
  await this.setGoalStatus("done");
1620
1620
  }
1621
1621
  }
1622
+ // Capture the last few conversation turns BEFORE the final marker so the
1623
+ // parent gets real substance (findings, file paths, numbers), not just
1624
+ // whatever the model typed into the finish() summary argument.
1625
+ const recent = [];
1626
+ for (let i = this.messages.length - 1; i >= 0 && recent.length < 6; i--) {
1627
+ const m = this.messages[i];
1628
+ if (m.role === "user")
1629
+ continue; // prompts/noise — keep agent output only
1630
+ if (m.role === "assistant" && !(m.content ?? "").trim())
1631
+ continue;
1632
+ const who = m.role === "tool" ? "tool" : m.role;
1633
+ let line = `[${who}] ${(m.content ?? "").trim()}`;
1634
+ if (m.role === "tool") {
1635
+ // tool results are prefixed "(failed)" by the logger when they fail —
1636
+ // the raw content is what matters here, and cap hard: these can be huge
1637
+ line = `[${who}] ${(m.content ?? "").trim().slice(0, 1200)}`;
1638
+ }
1639
+ recent.unshift(line.slice(0, 1500));
1640
+ }
1622
1641
  await this.log.append("message", this.currentSession, this.currentBranch, {
1623
1642
  role: "assistant",
1624
1643
  final: true,
1625
1644
  content: String(args.summary ?? ""),
1645
+ ...(recent.length ? { recentContext: recent } : {}),
1626
1646
  });
1627
1647
  }
1628
1648
  async maybeRequestProgress() {
package/dist/master.js CHANGED
@@ -666,8 +666,18 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
666
666
  return;
667
667
  // forward outcomes so the parent hears the result without polling
668
668
  if (e.type === "message" && e.data.final) {
669
- const summary = String(e.data.content ?? "").trim();
670
- parent.enqueuePrompt(`[harness] Sub-agent ${ac.id} finished. Final report:\n${summary.slice(0, 2000) || "(no summary)"}`, "harness");
669
+ const d = e.data;
670
+ const summary = String(d.content ?? "").trim();
671
+ // the finish() summary alone is often thin — the agent's last few real
672
+ // conversation turns (findings, paths, numbers) carry the substance.
673
+ // Include them so the parent can act without re-reading the child log.
674
+ let report = summary;
675
+ if (Array.isArray(d.recentContext) && d.recentContext.length) {
676
+ report +=
677
+ "\n\n[Last conversation turns before finishing]\n" +
678
+ d.recentContext.map((r) => r).join("\n\n");
679
+ }
680
+ parent.enqueuePrompt(`[harness] Sub-agent ${ac.id} finished. Final report:\n${report.slice(0, 6000) || "(no summary)"}`, "harness");
671
681
  }
672
682
  else if (e.type === "error") {
673
683
  parent.enqueuePrompt(`[harness] Sub-agent ${ac.id} hit an error: ${String(e.data.message ?? "").slice(0, 500)}`, "harness");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "A lightweight, always-on multi-agent harness for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",