teapot-coding-agent 0.37.204 → 0.37.206
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/agent.js +25 -1
- package/dist/agent/tool-catalog.js +2 -2
- package/package.json +1 -1
- package/public/assets/index-BRPAp-XG.js +191 -0
- package/public/assets/index-BRPAp-XG.js.map +1 -0
- package/public/assets/{index-DQ00J4Kn.css → index-D495Y40W.css} +1 -1
- package/public/index.html +2 -2
- package/public/assets/index-BENTVOfZ.js +0 -191
- package/public/assets/index-BENTVOfZ.js.map +0 -1
package/dist/agent/agent.js
CHANGED
|
@@ -3279,8 +3279,32 @@ export class Agent {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
return Math.ceil(ascii / 4 + wide * 1.2 + msgs.length * 8);
|
|
3281
3281
|
}
|
|
3282
|
+
/**
|
|
3283
|
+
* Never cut a call away from its result.
|
|
3284
|
+
*
|
|
3285
|
+
* A compaction keeps `messages[cut..]`, so a call whose RESULT has not arrived yet must not be summarised away: the tool
|
|
3286
|
+
* result is appended afterwards by the running loop, and an orphan `role:"tool"` message makes the next request invalid
|
|
3287
|
+
* ("tool message not directly after its assistant turn"). That used to be impossible — a compaction only ran at a turn
|
|
3288
|
+
* boundary — but `/compact` now runs WHILE the agent is parked on a tool (`wait_children`), so the pending call is exactly
|
|
3289
|
+
* the last assistant message at that moment.
|
|
3290
|
+
*/
|
|
3282
3291
|
safeCut(maxCut) {
|
|
3283
|
-
|
|
3292
|
+
const answered = new Set();
|
|
3293
|
+
for (const m of this.messages)
|
|
3294
|
+
if (m.role === "tool" && m.tool_call_id)
|
|
3295
|
+
answered.add(m.tool_call_id);
|
|
3296
|
+
let pendingAt = Number.POSITIVE_INFINITY;
|
|
3297
|
+
for (let i = 0; i < this.messages.length; i++) {
|
|
3298
|
+
const calls = this.messages[i].tool_calls;
|
|
3299
|
+
if (!calls?.length)
|
|
3300
|
+
continue;
|
|
3301
|
+
if (calls.some((c) => c.id && !answered.has(c.id))) {
|
|
3302
|
+
pendingAt = i;
|
|
3303
|
+
break;
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
const limit = Math.min(maxCut, this.messages.length - 1, pendingAt);
|
|
3307
|
+
for (let i = limit; i >= 1; i--) {
|
|
3284
3308
|
if (this.messages[i].role !== "tool")
|
|
3285
3309
|
return i;
|
|
3286
3310
|
}
|
|
@@ -277,8 +277,8 @@ function resolveEntry(entries, raw) {
|
|
|
277
277
|
return hit;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
// 2. the flat forms the registry already uses
|
|
281
|
-
for (const sep of ["__", "/", "::", ":"]) {
|
|
280
|
+
// 2. the flat forms the registry already uses — and the COMMA pair a model writes by habit
|
|
281
|
+
for (const sep of ["__", "/", "::", ":", ","]) {
|
|
282
282
|
const at = text.lastIndexOf(sep);
|
|
283
283
|
if (at <= 0)
|
|
284
284
|
continue;
|