feat: per-model max output tokens and a conversation-time thinking level backed by agent settings (#28)

Co-authored-by: Alice <alice@prismshadow.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-22 22:22:41 +08:00
committed by GitHub
parent 99f391f379
commit cabbab1c16
36 changed files with 797 additions and 42 deletions
+28
View File
@@ -279,6 +279,34 @@ describe("approvals and events", () => {
expect(items(m)).toHaveLength(0);
});
it("captures the session's thinking level from the main session_meta (read-only input-area tag)", () => {
const m = createStreamModel();
expect(m.thinkingLevel).toBeNull();
// The shared helper's meta carries thinking_level "default" (Agent config leaves it unset).
pushMessage(m, meta("session-x"));
expect(m.thinkingLevel).toBe("default");
const m2 = createStreamModel();
pushMessage(
m2,
sessionMeta({
session_id: "session-y",
model_id: "m",
provider: "custom",
model_context_window: 200000,
system_prompt: "",
tools: [],
thinking_level: "medium",
agent_state: "/a",
workspace: "/w",
}),
);
expect(m2.thinkingLevel).toBe("medium");
// An origin-tagged (sub-session) session_meta routes to the nested model and must not clobber the main session's level.
pushMessage(m2, withOrigin(meta("child"), "child"));
expect(m2.thinkingLevel).toBe("medium");
});
it("request_end final state timeout/malformed produces a retry notice item (with attempt number); request_begin marks it as resent", () => {
const m = createStreamModel();
pushMessage(m, requestBegin());