teapot-coding-agent 0.37.70 → 0.37.71

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/agent/llm.js CHANGED
@@ -194,7 +194,21 @@ function sanitize(messages) {
194
194
  const parts = m.content_parts.map((p) => p.type === "image_url"
195
195
  ? { type: "image_url", image_url: { url: p.image_url.url } }
196
196
  : { type: "text", text: p.text ?? "" });
197
- return { role: m.role, content: parts };
197
+ /**
198
+ * EVERY other field has to survive, not just `content`.
199
+ *
200
+ * This returned `{ role, content }` alone, so a TOOL message carrying an image lost its
201
+ * `tool_call_id` — and the API rejected the whole request: `400 Invalid input: expected string,
202
+ * received undefined`. MEASURED on v0.37.69 (`github-bug-research-1f48715f`): the `read_file`
203
+ * result rendered with its "the image itself is attached" text and the very next call 400'd.
204
+ *
205
+ * Spreading `m` first is what makes the multimodal path identical to the text path; a tool
206
+ * message without its id is not a message at all.
207
+ */
208
+ // `content_parts` is OUR field, carrying the parts into `content`; sending it upstream is an
209
+ // unknown property (a strict server rejects the request), so it is dropped here.
210
+ const { content_parts: _parts, ...rest } = m;
211
+ return { ...rest, content: parts };
198
212
  }
199
213
  if ((m.role === "user" || m.role === "assistant") && !m.content) {
200
214
  return { ...m, content: m.tool_calls?.length ? "(tool call)" : "(no content)" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.70",
3
+ "version": "0.37.71",
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",