@0perator/operator 0.1.261 → 0.1.262
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/engine/agent.js +24 -4
- package/dist/router/models.js +1 -1
- package/package.json +1 -1
package/dist/engine/agent.js
CHANGED
|
@@ -144,6 +144,26 @@ function contentSignature(content) {
|
|
|
144
144
|
.trim()
|
|
145
145
|
.slice(0, 200);
|
|
146
146
|
}
|
|
147
|
+
// A single high-fanout round (e.g. 15 parallel web_search / fetch calls) can dump more tool output than the
|
|
148
|
+
// whole context window holds — which overflows the server (hard 400) AND defeats compaction, since compaction
|
|
149
|
+
// summarizes OLD history and preserves the RECENT turn where that bloat lives. Per-result caps (tools/registry)
|
|
150
|
+
// bound ONE result; this bounds the ROUND's TOTAL, so autonomous multi-tool work keeps running uninterrupted.
|
|
151
|
+
const TOOL_ROUND_CHAR_BUDGET = 80_000; // ~20K tokens max of tool output added per round, trimmed proportionally
|
|
152
|
+
/** Cap a round's total tool output to TOOL_ROUND_CHAR_BUDGET, trimming the largest results proportionally with
|
|
153
|
+
* a truncation note. Returns new Msg objects (originals are left intact for the verify/progress ledgers, which
|
|
154
|
+
* need the full results). A round at or under budget is returned unchanged. */
|
|
155
|
+
export function capToolRound(msgs) {
|
|
156
|
+
const total = msgs.reduce((n, m) => n + (m.content?.length ?? 0), 0);
|
|
157
|
+
if (total <= TOOL_ROUND_CHAR_BUDGET)
|
|
158
|
+
return msgs;
|
|
159
|
+
return msgs.map((m) => {
|
|
160
|
+
const c = m.content ?? "";
|
|
161
|
+
const share = Math.max(1200, Math.floor(TOOL_ROUND_CHAR_BUDGET * (c.length / total)));
|
|
162
|
+
if (c.length <= share)
|
|
163
|
+
return m;
|
|
164
|
+
return { ...m, content: `${c.slice(0, share)}\n…[tool result truncated to fit the round's context budget — ${c.length - share} more chars dropped; narrow the query, fetch fewer items, or request one at a time]` };
|
|
165
|
+
});
|
|
166
|
+
}
|
|
147
167
|
/** A tool batch "progressed" if any result shows the batch advanced the world. Gates BOTH the no-progress
|
|
148
168
|
* stall streak and the narration-loop guard, so a templated narration over PRODUCTIVE work is never
|
|
149
169
|
* mistaken for a loop. A result is a STALL sentinel only if it's empty, a FAILED silent command
|
|
@@ -841,8 +861,8 @@ export async function runTurn(userInput, conversation, opts) {
|
|
|
841
861
|
// Race the batch against the abort signal so esc breaks even a hung tool (a frozen child process) —
|
|
842
862
|
// the abandoned tool runs to its own timeout, but the turn is never wedged.
|
|
843
863
|
const toolMsgs = await abortable(runToolCalls(response.toolCalls, opts.tools, callCounts, opts.onToolBatch, onToolStartFx, onToolResultFx), opts.signal);
|
|
844
|
-
for (const tm of toolMsgs)
|
|
845
|
-
conversation.tool(tm.tool_call_id, tm.content);
|
|
864
|
+
for (const tm of capToolRound(toolMsgs))
|
|
865
|
+
conversation.tool(tm.tool_call_id, tm.content); // cap the ROUND's total tool output so a high-fanout round can't overflow the window / defeat compaction
|
|
846
866
|
observeVerify(verify, response.toolCalls, toolMsgs); // verify-before-done: record mutation / verify signal
|
|
847
867
|
toolCallTotal += response.toolCalls.length;
|
|
848
868
|
progressed = batchProgressed(toolMsgs);
|
|
@@ -859,8 +879,8 @@ export async function runTurn(userInput, conversation, opts) {
|
|
|
859
879
|
throwIfAborted(opts.signal);
|
|
860
880
|
conversation.assistant(recovered.cleanedContent, recovered.calls);
|
|
861
881
|
const toolMsgs = await abortable(runToolCalls(recovered.calls, opts.tools, callCounts, opts.onToolBatch, onToolStartFx, onToolResultFx), opts.signal);
|
|
862
|
-
for (const tm of toolMsgs)
|
|
863
|
-
conversation.tool(tm.tool_call_id, tm.content);
|
|
882
|
+
for (const tm of capToolRound(toolMsgs))
|
|
883
|
+
conversation.tool(tm.tool_call_id, tm.content); // cap the ROUND's total tool output so a high-fanout round can't overflow the window / defeat compaction
|
|
864
884
|
observeVerify(verify, recovered.calls, toolMsgs); // verify-before-done: record mutation / verify signal
|
|
865
885
|
toolCallTotal += recovered.calls.length;
|
|
866
886
|
progressed = batchProgressed(toolMsgs);
|
package/dist/router/models.js
CHANGED
|
@@ -36,7 +36,7 @@ export const BUILTIN_MODELS = [
|
|
|
36
36
|
// truncated a round at token 32767 (finish=length) mid-tool-call, and that cut call poisoned the session (0.1.259).
|
|
37
37
|
// 32000 sits just UNDER the real wall (margin) AND under LEAN_HARNESS_CTX so Cortana drops the heavy memory/handoff
|
|
38
38
|
// (which alone was ~16K = half the window) — persona + unrestricted layer kept. Raise ONLY if the server's --ctx-size does.
|
|
39
|
-
{ id: "cortana", label: "Cortana 35B", kind: "single", desc: "flagship — abliterated Qwen3.6-35B-A3B MoE (~3B active, ~40 tok/s), uncensored + vision (JL1:8112, llama.cpp,
|
|
39
|
+
{ id: "cortana", label: "Cortana 35B", kind: "single", desc: "flagship — abliterated Qwen3.6-35B-A3B MoE (~3B active, ~40 tok/s), uncensored + vision (JL1:8112, llama.cpp, 128K ctx)", endpoint: "http://192.168.1.103:8112/v1", model: "/Volumes/Ai Storage/jl1-local/models/aurorax/Huihui-Qwen3.6-35B-A3B-abliterated.Q4_K_M.gguf", ctx: 128000 },
|
|
40
40
|
// Qwen3-4B — fast LOCAL tier (stock qwen3-4b-mlx-q4, 2.26GB MLX 4-bit, ctx 40960) served via mlx_lm.server
|
|
41
41
|
// on JL1:8110. Qwen3 vocab (151936) — the same family as ghost-32b, so it's the review-recommended quick tier
|
|
42
42
|
// AND the vocab lineage for ghost spec-decode (the actual draft is Qwen3-0.6B, too small to list here). Runs
|