compaction: the surface — settings row, two ruled dividers, summary dialog, send gate (round 14 slice 3)
- settings: compaction.thresholdTokens row on the Agent tab (owner pick)
in a Context group — CommitInput mirroring the graph budget row, hint
resolved through the SAME core resolver the trigger reads; PUT rejects
below the 32k floor with the anti-churn rationale; own section
(compaction) in SETTINGS_SECTIONS + the settings-signal union
- view fold: one marker → two dividers — the minimal MOMENT divider at
the marker (retrying-message register, no rule lines) and the longer
CUT divider emitted immediately before the first kept message
(phase-divider geometry, chip carries '· Nk tok'); both carry the full
summary payload; full history stays visible to the user
- components/compaction-divider.tsx: the dividers + summary dialog
(pure exported body for SSR pins, the delete-dialog pattern; Esc +
Close dismiss, backdrop does not)
- chat.tsx: compaction-changed SSE flips the running state — composer
canSend, onSend/doSend/doSteerOrSend, and both docks' submit + hint
('compacting session…') gate on it (the server's registry mutex is the
structural gate; this is the affordance); dialog mounts beside the
abort dialog
- pins: settings-body (4), view fold (2), divider SSR (4)
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
parseModelsSettingsBody,
|
||||
parseAppearanceSettingsBody,
|
||||
parseGeneralSettingsBody,
|
||||
parseCompactionSettingsBody,
|
||||
parseGraphSettingsBody,
|
||||
SETTINGS_SECTIONS,
|
||||
} from "../src/server/settings-body.ts";
|
||||
@@ -194,9 +195,41 @@ describe("parseGraphSettingsBody", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseCompactionSettingsBody (owner round 14)", () => {
|
||||
it("parses a threshold; absent = the empty section (factory default at resolution)", () => {
|
||||
const r = parseCompactionSettingsBody({ thresholdTokens: 120000 });
|
||||
assert.ok(r.ok);
|
||||
assert.deepEqual(r.settings, { thresholdTokens: 120000 });
|
||||
const none = parseCompactionSettingsBody({});
|
||||
assert.ok(none.ok);
|
||||
assert.deepEqual(none.settings, {});
|
||||
});
|
||||
it("floors to integers", () => {
|
||||
const r = parseCompactionSettingsBody({ thresholdTokens: 120000.9 });
|
||||
assert.ok(r.ok);
|
||||
assert.equal(r.settings.thresholdTokens, 120000);
|
||||
});
|
||||
it("rejects below the 32k floor with the anti-churn rationale", () => {
|
||||
const r = parseCompactionSettingsBody({ thresholdTokens: 20_000 });
|
||||
assert.ok(!r.ok);
|
||||
assert.match(r.error ?? "", /at least 32000/);
|
||||
assert.match(r.error ?? "", /churn/);
|
||||
});
|
||||
it("rejects non-numbers", () => {
|
||||
const r = parseCompactionSettingsBody({ thresholdTokens: "big" });
|
||||
assert.ok(!r.ok);
|
||||
assert.match(r.error ?? "", /must be a number/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("SETTINGS_SECTIONS (the route's section map)", () => {
|
||||
it("maps exactly the six record sections", () => {
|
||||
assert.deepEqual(Object.keys(SETTINGS_SECTIONS), ["general", "chat", "agent", "appearance", "graph", "models"]);
|
||||
it("maps exactly the seven record sections", () => {
|
||||
// compaction joined (owner round 14): its own section PUT — the
|
||||
// threshold is engine behavior, not an agent-section key.
|
||||
assert.deepEqual(
|
||||
Object.keys(SETTINGS_SECTIONS),
|
||||
["general", "chat", "agent", "appearance", "graph", "compaction", "models"],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user