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:
authored and GitHub committed 2026-07-22 22:22:41 +08:00
1 parent 99f391f379
commit cabbab1c16
36 files changed
+797 -42

No files matched your search

+15 -1
View File
@@ -241,6 +241,13 @@ export interface StreamModel {
items: ChatItem[];
/** A nested sub-session model (produces no stats row; its stats count toward the parent). */
nested: boolean;
/**
* The session's thinking level, captured from the main session's `session_meta` on history
* replay ("default" when the Agent config leaves it unset; null until a session_meta has been
* seen). llmConfig is assembled once per session, so this is fixed for the session's lifetime —
* shown read-only in the input area next to the locked model.
*/
thinkingLevel: string | null;
stats: TaskStatsTracker;
/** The currently open text/thinking fragment (opened by start, closed by stop). */
openText: AssistantTextItem | null;
@@ -318,6 +325,7 @@ function newModel(nested: boolean, localDecisions: Set<string>): StreamModel {
return {
items: [],
nested,
thinkingLevel: null,
stats: createTaskStatsTracker(),
openText: null,
openThinking: null,
@@ -392,7 +400,13 @@ export function pushMessage(
advanceLastTs(model, msg.timestamp);
return;
}
// session_meta (main session): not rendered.
// session_meta (main session): not rendered as an item, but its thinking level is captured
// for the input area's read-only display (fixed per session: llmConfig is assembled once at
// session creation, so a mid-conversation Agent-config change doesn't affect this session).
if (msg.type === "session_meta") {
const level = (msg.payload as { thinking_level?: unknown }).thinking_level;
if (typeof level === "string" && level) model.thinkingLevel = level;
}
}
/** ISO timestamp → milliseconds (returns undefined if invalid). */