teapot-coding-agent 0.19.0 → 0.19.1

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.
@@ -1378,11 +1378,22 @@ export class Agent {
1378
1378
  // ledger stayed unsolved — it then re-sent a voluntary report_progress
1379
1379
  // right after, and the timeline showed every requested report TWICE.
1380
1380
  const res = await this.llmCall(this.buildMessages(), allToolSpecs());
1381
- let reported = false;
1382
- for (const call of res.message.tool_calls ?? []) {
1383
- if (call.function.name !== "report_progress")
1384
- continue;
1385
- await this.recordProgress(call.function.arguments);
1381
+ const calls = res.message.tool_calls ?? [];
1382
+ // the assistant turn MUST enter history before its tool answers, or the
1383
+ // sequence [user, tool] is invalid and every later request 400s
1384
+ this.messages.push(res.message);
1385
+ await this.log.append("message", this.currentSession, this.currentBranch, {
1386
+ role: "assistant",
1387
+ content: res.message.content ?? "",
1388
+ reasoning: res.reasoning,
1389
+ ...(calls.length ? { toolCalls: calls.map((c) => ({ id: c.id, name: c.function.name })) } : {}),
1390
+ progressEcho: true,
1391
+ });
1392
+ let reported = calls.some((c) => c.function.name === "report_progress");
1393
+ for (const call of calls) {
1394
+ if (call.function.name === "report_progress") {
1395
+ await this.recordProgress(call.function.arguments);
1396
+ }
1386
1397
  this.messages.push({ role: "tool", tool_call_id: call.id, content: "progress recorded" });
1387
1398
  // log both sides so restores replay the exact exchange (meta-style)
1388
1399
  await this.log.append("tool_call", this.currentSession, this.currentBranch, {
@@ -1398,21 +1409,11 @@ export class Agent {
1398
1409
  durationMs: 0,
1399
1410
  result: "progress recorded",
1400
1411
  });
1401
- reported = true;
1402
1412
  }
1403
- if (!reported && (res.message.content ?? "").trim()) {
1404
- // fallback: the model answered in prose anyway — record it as before.
1405
- // Its content is ALREADY shown by the progress embed; logging the plain
1406
- // message too used to duplicate rows, so mark it as an echo (the feed
1407
- // filters marked rows out).
1408
- await this.recordProgress(JSON.stringify({ freeform: res.message.content }));
1409
- await this.log.append("message", this.currentSession, this.currentBranch, {
1410
- role: "assistant",
1411
- content: res.message.content ?? "",
1412
- reasoning: res.reasoning,
1413
- progressEcho: true,
1414
- });
1415
- this.messages.push(res.message);
1413
+ if (!reported && !(res.message.content ?? "").trim()) {
1414
+ // degenerate: neither a tool call nor prose — record a stub so the
1415
+ // operator sees SOMETHING at the requested moment
1416
+ await this.recordProgress(JSON.stringify({ freeform: "(no report produced)" }));
1416
1417
  }
1417
1418
  }
1418
1419
  /* ---------- context compaction ---------- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
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",