mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
Merge #777: auto-compact and auto-clear from the statusLine context size
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
commit
6fa2dfa549
16 files changed
+579
-45
No files matched your search
@@ -1637,7 +1637,7 @@
|
||||
<span class="set-row-desc">Summarizes the context at the threshold while preserving key information.</span>
|
||||
</div>
|
||||
<div class="set-row-actions">
|
||||
<input type="number" id="modalAutoCompactThreshold" class="set-num set-num-wide" value="110000" min="10000" max="500000" step="10000" onchange="app.autoSaveAutoCompact()">
|
||||
<input type="number" id="modalAutoCompactThreshold" class="set-num set-num-wide" value="110000" min="10000" max="1000000" step="10000" onchange="app.autoSaveAutoCompact()">
|
||||
<span class="set-unit">tokens</span>
|
||||
<label class="switch switch-sm"><input type="checkbox" id="modalAutoCompactEnabled" onchange="app.autoSaveAutoCompact()"><span class="slider"></span></label>
|
||||
</div>
|
||||
@@ -1655,7 +1655,7 @@
|
||||
<span class="set-row-desc">Full context reset at the threshold. Keep it higher than auto-compact.</span>
|
||||
</div>
|
||||
<div class="set-row-actions">
|
||||
<input type="number" id="modalAutoClearThreshold" class="set-num set-num-wide" value="140000" min="10000" max="500000" step="10000" onchange="app.autoSaveAutoClear()">
|
||||
<input type="number" id="modalAutoClearThreshold" class="set-num set-num-wide" value="140000" min="10000" max="1000000" step="10000" onchange="app.autoSaveAutoClear()">
|
||||
<span class="set-unit">tokens</span>
|
||||
<label class="switch switch-sm"><input type="checkbox" id="modalAutoClearEnabled" onchange="app.autoSaveAutoClear()"><span class="slider"></span></label>
|
||||
</div>
|
||||
|
||||
@@ -2831,7 +2831,11 @@ Object.assign(CodemanApp.prototype, {
|
||||
// Populate respawn config from saved state
|
||||
this.loadSavedRespawnConfig(sessionId);
|
||||
|
||||
// Populate auto-compact/clear from session state
|
||||
// Populate auto-compact/clear from session state. A threshold above the model's window
|
||||
// can never fire, so the inputs stop there once the statusline has reported it.
|
||||
const maxThreshold = session.contextWindowSize ?? 1000000;
|
||||
document.getElementById('modalAutoCompactThreshold').max = maxThreshold;
|
||||
document.getElementById('modalAutoClearThreshold').max = maxThreshold;
|
||||
document.getElementById('modalAutoCompactEnabled').checked = session.autoCompactEnabled ?? false;
|
||||
document.getElementById('modalAutoCompactThreshold').value = session.autoCompactThreshold ?? 110000;
|
||||
document.getElementById('modalAutoCompactPrompt').value = session.autoCompactPrompt ?? '';
|
||||
|
||||
@@ -65,6 +65,13 @@ export function registerStatusTelemetryRoutes(app: FastifyInstance, ctx: Session
|
||||
session.noteReportedModel('statusline', payload?.model?.display_name);
|
||||
}
|
||||
|
||||
// The context size drives auto-compact and auto-clear. A render without one (the exporter
|
||||
// can post before the first API response) keeps the last report instead of wiping it.
|
||||
const status = reportsStatusLine ? parseSessionStatus(payload) : null;
|
||||
if (session && status?.inputTokens !== undefined) {
|
||||
session.noteContextReport({ tokens: status.inputTokens, windowSize: status.contextWindowSize });
|
||||
}
|
||||
|
||||
// Prompt-cache state of the main conversation (Claude Code v2.1.251+): kept on the
|
||||
// session for the Session Options readout and `toState()`, broadcast only when the
|
||||
// report changes (the statusline fires on every assistant message). The broadcast
|
||||
|
||||
@@ -733,6 +733,7 @@ export const StatusTelemetrySchema = z.object({
|
||||
used_percentage: z.number().nullish(),
|
||||
total_input_tokens: z.number().nullish(),
|
||||
total_output_tokens: z.number().nullish(),
|
||||
context_window_size: z.number().nullish(),
|
||||
})
|
||||
.nullish(),
|
||||
cost: z.object({ total_cost_usd: z.number().nullish() }).nullish(),
|
||||
|
||||
Reference in new issue
Block a user