Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

The kernel update matches one hash per settings tab (#438)

Yaowei Zheng3cf1fdb974f2
diff --git a/changelog/unreleased/2026-08-24-kernel-tab-hashes.md b/changelog/unreleased/2026-08-24-kernel-tab-hashes.md
new file mode 100644
index 00000000..6e71d552
--- /dev/null
+++ b/changelog/unreleased/2026-08-24-kernel-tab-hashes.md
@@ -0,0 +1,30 @@
+# The kernel update matches one hash per settings tab
+
+- **Date:** 2026-08-24
+- **Type:** feature
+- **Scope:** `core`, `server`, `web`, `docs`
+- **PR:** [#438](https://github.com/Prism-Shadow/penguin-harness/pull/438)
+- **Breaking:** yes — a kernel update now keeps or advances a whole settings tab, so editing one field of a tab freezes the rest of that tab until the default configuration is restored.
+
+[中文版](2026-08-24-kernel-tab-hashes.zh.md)
+
+Changed the unit of the kernel update from a config leaf to an Agent settings **tab**. `KERNEL_HASH_HISTORY` — six generations of built-in defaults, each a full snapshot of all 21–29 kernel-managed leaves, 158 stored entries — became two flat tables keyed by tab: `KERNEL_DEFAULT_TAB_HASHES` (7 hashes, one per tab) and `KERNEL_SUPERSEDED_TAB_HASHES` (6 hashes, the tab values earlier kernels shipped). Per tab a kernel update now asks one question: absent from the config, hash-equal to the current default, hash-equal to a superseded default, or none of those — and rewrites, skips, rewrites or keeps the tab whole.
+
+## Details
+
+- Defined the managed tabs in `KERNEL_TABS`, mirroring the settings page's own tab order: `prompt` (`system_prompt`), `runtime` (`max_turns`, `model`, `compaction`), `tools` (`tools.builtin`), `skills`, `memory`, `vault`, `schedules`. The Overview tab and `tools.mcpServers` are owned by no tab, so name, description, the Agent State version and MCP Servers stay untouchable.
+- A tab hash covers everything the tab owns, so a key the user added anywhere inside it changes the hash and the tab is kept rather than overwritten. A tab the config lacks entirely hashes to nothing and is materialized from the defaults, which is how a config predating the prompt-injection sections still receives them.
+- Deleted what the leaf-wise rule needed and the tab-wise one does not: the per-tool merge of `tools.builtin`, the `addedIn` arrival dates and the `newInLatestGeneration` test they fed, and the leaf machinery `kernelLeafEntries` / `KernelLeaf` / `computeKernelHashes` / `historicalHashesFor`. A tools tab that advances is rewritten from the defaults, which brings tools added since; a tools tab that is kept is kept whole, which preserves a tool the user deleted.
+- Reported `advanced` / `kept` entries became tab keys instead of dotted leaf paths. The Web App renders them with the settings page's own tab labels, replacing the per-leaf display dictionary and its per-tool special case; the update's confirm and result copy now speaks of tabs in both languages.
+- Reworked the pinned-hash guard to compare `computeKernelTabHashes(defaultSystemConfig())` against `KERNEL_DEFAULT_TAB_HASHES`, with the failure message naming the tabs that moved and the edit each needs.
+- Carried the generation narrative over as prose on the record: the pre-[#257](https://github.com/Prism-Shadow/penguin-harness/pull/257) template with its hardcoded Vault and Skills sections, the toggles generation, `run_subagent` gaining `thinking_level` and then the widened `max` ladder, `compaction.max_context_length` rising to 256000, and the background-execution batch alongside the reworded memory prompt.
+- Derived the six superseded tab hashes from the built-in defaults as they stood at each recorded generation, and checked every reconstruction against the retired per-leaf table before writing the literals. Kept the pre-#257 reconstruction proof, retargeted to the prompt tab.
+- Updated the configuration guide's merge description and developer paragraph in both languages.
+
+## Compatibility
+
+The stored `system_config.yaml` is unchanged — same format, same fields, same `kernel_version` stamp — and no config on disk needs migrating.
+
+What changes is what an update does for an Agent whose settings were partly customized. Previously the merge ran field by field: editing one built-in tool kept that tool and let every other tool follow the new defaults. Now the Tools tab is kept whole, so that Agent stops receiving tool updates — new built-in tools included — until its configuration is refreshed. The same holds for every other tab: one edited field in Runtime keeps the whole Runtime tab. A tab whose fields are only partly present is likewise kept as written rather than having its missing fields filled in; those fields keep falling back to the built-in defaults at runtime, as they did before.
+
+The recourse is unchanged and sits next to the update on the settings overview: **restore the default configuration** overwrites the config with the current defaults, keeping only name, description and the State version. The kernel update's result lists every tab it kept, so the tabs that have fallen behind are named each time it runs.
diff --git a/changelog/unreleased/2026-08-24-kernel-tab-hashes.zh.md b/changelog/unreleased/2026-08-24-kernel-tab-hashes.zh.md
new file mode 100644
index 00000000..01e873a4
--- /dev/null
+++ b/changelog/unreleased/2026-08-24-kernel-tab-hashes.zh.md
@@ -0,0 +1,30 @@
+# 内核更新改为一个设置页一个哈希
+
+- **Date:** 2026-08-24
+- **Type:** feature
+- **Scope:** `core`, `server`, `web`, `docs`
+- **PR:** [#438](https://github.com/Prism-Shadow/penguin-harness/pull/438)
+- **Breaking:** yes — 内核更新现在以整个设置页为单位保留或跟进,因此只要改过某页的一个字段,该页其余内容就会停在原处,直到还原默认配置。
+
+[English](2026-08-24-kernel-tab-hashes.md)
+
+把内核更新的比对单位从配置叶子改为 Agent 设置页。原先的 `KERNEL_HASH_HISTORY` 是内置默认值的六代快照,每一代完整罗列 21–29 个 kernel 管理叶子、共 158 条记录;现在替换为两张按设置页展开的扁平表:`KERNEL_DEFAULT_TAB_HASHES`(7 条,每页一条)与 `KERNEL_SUPERSEDED_TAB_HASHES`(6 条,更早的 kernel 发布过的页面取值)。每个设置页只问一个问题:配置里整页缺失、哈希等于当前默认、哈希等于某个已记录的旧默认,还是都不是——对应整页重写、跳过、整页重写、整页保留。
+
+## 细节
+
+- 在 `KERNEL_TABS` 中定义受管设置页,顺序与设置页本身一致:`prompt`(`system_prompt`)、`runtime`(`max_turns`、`model`、`compaction`)、`tools`(`tools.builtin`)、`skills`、`memory`、`vault`、`schedules`。「概览」页与 `tools.mcpServers` 不属于任何受管页,因此名称、描述、Agent State 版本号与 MCP Server 依旧不可能被触碰。
+- 设置页哈希覆盖该页所拥有的全部内容,因此用户在页内任何位置新增的键都会改变哈希,该页随即被保留而非覆盖。配置中整页缺失时哈希为空,直接按默认值写入——早于提示词注入小节的配置正是借此拿到这些小节。
+- 删除了逐叶规则需要、而按页规则不再需要的部分:`tools.builtin` 的逐工具合并、`addedIn` 加入时间及其支撑的 `newInLatestGeneration` 判断,以及 `kernelLeafEntries` / `KernelLeaf` / `computeKernelHashes` / `historicalHashesFor` 这套叶子机制。跟进的工具页会按默认值整页重写,新增工具随之进入;被保留的工具页整页保留,用户删掉的工具因而留存。
+- 结果中的 `advanced` / `kept` 由点号叶子路径改为设置页键名。Web App 直接用设置页自己的标签渲染它们,原先的逐叶显示词典与逐工具特例一并移除;更新的确认文案与结果文案在中英文下都改为以设置页表述。
+- 重做 pinned-hash 守卫:改为用 `computeKernelTabHashes(defaultSystemConfig())` 与 `KERNEL_DEFAULT_TAB_HASHES` 比对,失败信息列出发生变化的设置页及各自需要的改动。
+- 把代际叙述改写为记录上的注释:[#257](https://github.com/Prism-Shadow/penguin-harness/pull/257) 之前带硬编码 Vault、Skills 段落的模板,开关那一代,`run_subagent` 先后获得 `thinking_level` 与加宽后的 `max` 档位,`compaction.max_context_length` 提升到 256000,以及后台执行那一批改动连同重写后的 memory prompt。
+- 六条旧设置页哈希取自各记录代际当时的内置默认值,写入字面量之前逐代与退役的逐叶表核对无误。保留了 #257 之前的重建证明,并改为针对 prompt 设置页。
+- 同步更新配置文档中英文版的合并说明与面向开发者的段落。
+
+## 兼容性
+
+磁盘上的 `system_config.yaml` 没有变化——格式、字段、`kernel_version` 盖章都一样,已有配置无需任何迁移。
+
+变化的是:对一个设置被部分自定义过的 Agent,更新会做什么。以前是逐字段合并,改了一个内置工具,只有那一个工具被保留,其余工具照常跟进新默认。现在整个「工具」页会被整体保留,于是该 Agent 不再收到工具更新——包括新增的内置工具——直到其配置被刷新。其他设置页同理:「运行参数」页改了一个字段,整页都会停住。某页字段只写了一部分时同样按原样保留,不再逐个补齐缺失字段;这些字段在运行时仍然回落到内置默认值,与此前一致。
+
+补救方式没有变化,并且就在设置页概览中与更新按钮相邻:**还原默认配置**会用当前默认值覆盖配置,仅保留名称、描述与 State 版本号。内核更新的结果会列出所有被保留的设置页,因此每次运行都会指名哪些页已经落后。
diff --git a/packages/core/src/state/kernel-history.ts b/packages/core/src/state/kernel-history.ts
index dde68eb2..0ce2cdbd 100644
--- a/packages/core/src/state/kernel-history.ts
+++ b/packages/core/src/state/kernel-history.ts
@@ -1,88 +1,79 @@
/**
* Agent config kernel versions: which generation of the built-in defaults a stored
- * `system_config.yaml` is based on, and the per-leaf hash history that lets the kernel
- * update (see kernel-update.ts) tell "still the old default" apart from "customized by
- * the user".
+ * `system_config.yaml` is based on, and the per-tab hash record that lets the kernel update
+ * (see kernel-update.ts) tell "still the old default" apart from "customized by the user".
*
* A kernel version is a date string (`YYYY-MM-DD`). It advances **manually** and only when
* the built-in defaults change substantively: the pinned-hash test in
- * `core/test/kernel-version.test.ts` recomputes every default leaf hash and fails the build
- * whenever `defaultSystemConfig()` drifts from the latest history entry — the failure message
- * tells the developer to bump `KERNEL_VERSION` and append a new entry here. Several changes
- * on the same day may revise that day's entry in place instead of appending (the entry is
- * only frozen once a later generation exists).
+ * `core/test/kernel-version.test.ts` recomputes every tab hash and fails the build whenever
+ * `defaultSystemConfig()` drifts from `KERNEL_HISTORY.current` — the failure message names
+ * the tabs that moved and spells out the edit each one needs. Several changes on the same day
+ * may reuse that day's version rather than taking a new one.
*
* The user's own edits never move a config between generations: matching is purely by value
- * hash, and a value that matches no recorded generation is conservatively treated as a user
- * customization (see kernel-update.ts).
+ * hash, and a tab that matches no recorded default is conservatively treated as customized.
*/
import { createHash } from "node:crypto";
-import type { SystemConfig } from "./default-config.js";
/**
* The current kernel version — the generation stamp `defaultSystemConfig()` carries in
* `kernel_version`, so newly created (and default-restored) configs record which generation
- * of defaults they materialized. Must equal the newest key of `KERNEL_HASH_HISTORY`; the
- * pinned-hash test enforces both directions (bump without new hashes, or changed defaults
- * without a bump, both fail).
+ * of defaults they materialized. The pinned-hash test fails the build whenever the defaults
+ * change without it moving. (The reverse — moving it with no default change — is inert rather
+ * than an error: nothing is keyed by version, so there is no table to fall out of sync with.)
*/
export const KERNEL_VERSION = "2026-08-21";
-/**
- * Identity / user-data fields excluded from kernel management: never hashed, never written
- * by a kernel update. `version` is the Agent State optimization counter (unrelated to the
- * kernel version); `kernel_version` is the stamp itself.
- */
-const EXCLUDED_TOP_LEVEL_KEYS = new Set(["name", "description", "version", "kernel_version"]);
-
-/** One kernel-managed leaf of the default config: a dotted path and the value at it. */
-export interface KernelLeaf {
- path: string;
- value: unknown;
-}
-
function isPlainObject(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === "object" && !Array.isArray(value);
}
/**
- * The kernel-managed leaves of a config, in stable traversal order: scalars and arrays are
- * atomic leaves; plain objects recurse. Two special cases:
- *
- * - `tools.builtin` is broken up **per tool name** (`tools.builtin.<name>`, each entry an
- * atomic leaf), so a user who customized one tool keeps only that one while the rest
- * follow a kernel update. Tool names allow no `.` (see assertValidId's character set), so
- * the dotted path stays unambiguous.
- * - `tools.mcpServers` is user data (like name/description/version) and is skipped entirely.
+ * The value a config carries at a dotted path, or `undefined` when any segment is missing or
+ * is not a plain object (a hand-edited `tools:` with no value parses as null and reads as
+ * missing here, exactly as it does on the write side).
*/
-export function kernelLeafEntries(config: SystemConfig): KernelLeaf[] {
- const leaves: KernelLeaf[] = [];
- const visit = (value: unknown, path: string[]): void => {
- if (value === undefined) return;
- if (path.length === 1 && EXCLUDED_TOP_LEVEL_KEYS.has(path[0]!)) return;
- if (path.length === 2 && path[0] === "tools") {
- if (path[1] === "mcpServers") return;
- if (path[1] === "builtin" && Array.isArray(value)) {
- for (const entry of value) {
- if (isPlainObject(entry) && typeof entry["name"] === "string") {
- leaves.push({ path: `tools.builtin.${entry["name"]}`, value: entry });
- }
- }
- return;
- }
- }
- if (isPlainObject(value)) {
- for (const key of Object.keys(value)) visit(value[key], [...path, key]);
- return;
- }
- leaves.push({ path: path.join("."), value });
- };
- for (const key of Object.keys(config)) {
- visit((config as unknown as Record<string, unknown>)[key], [key]);
+export function valueAtPath(root: unknown, path: readonly string[]): unknown {
+ let current: unknown = root;
+ for (const segment of path) {
+ if (!isPlainObject(current)) return undefined;
+ current = current[segment];
}
- return leaves;
+ return current;
}
+/**
+ * The unit of kernel management: one **settings tab** of the Web App's Agent settings page
+ * (`web/src/features/agents/agent-settings-page.tsx`), and the config paths it owns. A tab is
+ * matched, advanced and kept **whole** — the granularity is deliberately coarse, so a user who
+ * edits one field of a tab keeps that entire tab until they restore defaults.
+ *
+ * Two things the page shows are absent on purpose:
+ *
+ * - `overview` holds name / description / the Agent State version — identity and user data the
+ * kernel never writes, alongside the Kernel section itself.
+ * - the tools tab also hosts `tools.mcpServers`, which is user data; only `tools.builtin` is
+ * kernel-managed, so an MCP Server the user configured survives even a wholesale advance.
+ *
+ * The order is the page's own tab order, so a reported `advanced` / `kept` list reads in the
+ * order the tabs appear.
+ */
+export const KERNEL_TABS = {
+ prompt: ["system_prompt"],
+ runtime: ["max_turns", "model", "compaction"],
+ tools: ["tools.builtin"],
+ skills: ["skills"],
+ memory: ["memory"],
+ vault: ["vault"],
+ schedules: ["schedules"],
+} as const satisfies Readonly<Record<string, readonly string[]>>;
+
+/** A kernel-managed settings tab. */
+export type KernelTab = keyof typeof KERNEL_TABS;
+
+/** Every kernel-managed tab, in the settings page's tab order. */
+export const KERNEL_TAB_KEYS = Object.keys(KERNEL_TABS) as readonly KernelTab[];
+
/**
* Canonical JSON: object keys sorted recursively (arrays keep order, `undefined` properties
* dropped), so the hash is insensitive to key order — a YAML round-trip or a hand edit that
@@ -105,11 +96,32 @@ export function hashKernelValue(value: unknown): string {
return createHash("sha256").update(canonicalJson(value), "utf8").digest("hex");
}
-/** `{ leafPath: sha256 }` over a config's kernel-managed leaves (see kernelLeafEntries). */
-export function computeKernelHashes(config: SystemConfig): Record<string, string> {
- const hashes: Record<string, string> = {};
- for (const { path, value } of kernelLeafEntries(config)) {
- hashes[path] = hashKernelValue(value);
+/**
+ * A tab's hash over a config: sha256 of `{ ownedPath: value }` across the paths the tab owns
+ * that the config actually carries — so an extra key the user added anywhere inside the tab
+ * changes it, and the tab is then kept rather than overwritten.
+ *
+ * `null` when the config carries none of them: the tab is **absent** (a config predating the
+ * section, or one that never had it), and a kernel update materializes it from the defaults.
+ */
+export function kernelTabHash(config: unknown, tab: KernelTab): string | null {
+ const owned: Record<string, unknown> = {};
+ let present = false;
+ for (const path of KERNEL_TABS[tab]) {
+ const value = valueAtPath(config, path.split("."));
+ if (value === undefined) continue;
+ owned[path] = value;
+ present = true;
+ }
+ return present ? hashKernelValue(owned) : null;
+}
+
+/** `{ tab: sha256 }` over a config's kernel-managed tabs; a tab the config lacks is omitted. */
+export function computeKernelTabHashes(config: unknown): Partial<Record<KernelTab, string>> {
+ const hashes: Partial<Record<KernelTab, string>> = {};
+ for (const tab of KERNEL_TAB_KEYS) {
+ const hash = kernelTabHash(config, tab);
+ if (hash !== null) hashes[tab] = hash;
}
return hashes;
}
@@ -124,266 +136,92 @@ export function isKernelOutdated(kernelVersion: string | null | undefined): bool
}
/**
- * Per-generation pinned hashes of the built-in defaults: `{ kernelVersion: { leafPath:
- * sha256 } }`, oldest first. These are **literals, frozen once a later generation exists**
- * (only the newest entry may still be revised, on a same-day change) — they must keep
- * matching what old `system_config.yaml` files actually contain even as the current defaults
- * evolve, exactly like the LEGACY_* template constants in default-config.ts.
+ * Each tab's hash under today's built-in defaults — the **drift anchor**. The pinned-hash
+ * test compares this against `computeKernelTabHashes(defaultSystemConfig())` and fails the
+ * build on any difference, which is the mechanical definition of "the defaults changed
+ * substantively, bump the kernel". A kernel update never consults it as history: a stored tab
+ * equal to the current default short-circuits before any lookup.
+ *
+ * **Advancing the kernel** — what the pinned-hash test asks for when a default changes, and
+ * the whole of the appending workflow. Set `KERNEL_VERSION` to today's date (a second change
+ * the same day reuses it), then, per tab the test names, with the hashes from
+ * `computeKernelTabHashes(defaultSystemConfig())`: append the tab's **old** hash here to the
+ * end of its `KERNEL_SUPERSEDED_TAB_HASHES` entry (creating the entry if this is its first
+ * change), then write the new hash in. Then add a line to the generation list below saying
+ * what moved. Never edit a hash already superseded: it is a frozen record of what shipped.
*
- * Seeded generations:
+ * The generations behind the record, oldest first (the dates are kernel versions; matching is
+ * purely by hash, so a stored date never has to line up with anything):
*
- * - `"2026-08-10"` — the generation *before* the prompt-injection toggles (PR #257): no
- * `vault` / `skills` / `schedules` sections, and the default template carried the hardcoded
- * legacy # Vault / # Skills sections instead of the `{{VAULT}}` / `{{SKILLS}}` /
- * `{{SCHEDULES}}` placeholders. The date is a retroactive label (configs of that era carry
- * no stamp, so the key never has to match anything on disk; matching is purely by hash).
- * While the toggles generation was current, the test suite proved these hashes equal a
- * byte-exact reconstruction of that era's defaults from the frozen LEGACY_* constants;
- * that proof self-retired once the defaults evolved past the toggles generation.
- * - `"2026-08-11"` — the toggles generation.
- * - `"2026-08-18"` — `run_subagent` gained the optional `thinking_level` argument
- * (issue #306): only the `tools.builtin.run_subagent` leaf changed.
- * - `"2026-08-19"` — the `max` thinking level joined the ladder, widening `run_subagent`'s
- * `thinking_level` enum: again only the `tools.builtin.run_subagent` leaf changed.
- * - `"2026-08-20"` — the seeded `compaction.max_context_length` rose to 256000, with the
- * per-model `context_window` cap as its backstop: only the
- * `compaction.max_context_length` leaf changed.
- * - `"2026-08-21"` (current) — background execution: `exec_command` / `run_subagent` gained
+ * - `2026-08-10` — the generation *before* the prompt-injection toggles (PR #257): no `vault`
+ * / `skills` / `schedules` sections, and the default template carried the hardcoded legacy
+ * # Vault / # Skills sections instead of the `{{VAULT}}` / `{{SKILLS}}` / `{{SCHEDULES}}`
+ * placeholders. The date is a retroactive label (configs of that era carry no stamp). This
+ * is where the record starts; anything older cannot be reconstructed at all — those tabs
+ * match no recorded hash and are conservatively kept, with restore-default-config as the
+ * recourse. Only the prompt tab has a hash here: the three missing sections are absent
+ * rather than superseded, and the runtime / tools / memory tabs still shipped what the
+ * toggles generation shipped.
+ * - `2026-08-11` — the toggles generation: the `vault` / `skills` / `schedules` sections
+ * appeared and `system_prompt` took the placeholder template (prompt tab).
+ * - `2026-08-18` — `run_subagent` gained the optional `thinking_level` argument (issue #306):
+ * the tools tab moved.
+ * - `2026-08-19` — the `max` thinking level joined the ladder, widening `run_subagent`'s
+ * `thinking_level` enum: the tools tab moved again.
+ * - `2026-08-20` — the seeded `compaction.max_context_length` rose to 256000, with the
+ * per-model `context_window` cap as its backstop: the runtime tab moved.
+ * - `2026-08-21` (current) — background execution: `exec_command` / `run_subagent` gained
* `run_in_background`, `input_command`'s empty-poll default became 120000ms, and the
- * `kill_command` / `kill_subagent` tools joined the set (five `tools.builtin.*` leaves
- * changed or appeared).
+ * `kill_command` / `kill_subagent` tools joined the set, moving the tools tab; alongside
+ * them the memory prompt was reworded to name when a fact is worth saving (PR #397), moving
+ * the memory tab.
+ */
+export const KERNEL_DEFAULT_TAB_HASHES: Readonly<Record<KernelTab, string>> = {
+ prompt: "048198c37b8d7840352c225fdfcb15baf2679973c6eab4bf400d492daf6ce254",
+ runtime: "c952d44ecdd6790e17f02bc1b5056118b56ec7f0987dc2cbe950f6051fddbd20",
+ tools: "8bbd336ff1f3fc283c4e11e54d43dd2bfe4ba2458577bf9eb3b6e3d7be4f3cde",
+ skills: "7e343aa692e5eaeadfc8add6bb375fb50ac33ef81ebe460490fc219b0f3d707f",
+ memory: "53d190390829cc0132bb12e468a6891f2e0576ec0c4022a9b4a5d9233666900d",
+ vault: "19bd36a6d4ab442b66583c423450602b817990a9a79bafa21c9b6137fb6b47d8",
+ schedules: "79123643abd445c8540696c3e4395d9582cfa662bed2e5f879dd859fa09715f2",
+};
+
+/**
+ * Per tab, the hashes *earlier* kernels shipped, oldest first, the current default excluded.
+ * **The only hashes that can decide anything**: a stored tab hitting one is an old default the
+ * user never edited, so the whole tab advances instead of being kept.
*
- * Generations older than the seeded ones cannot be fully reconstructed; their values match
- * no recorded hash and are conservatively kept by a kernel update (restore-default-config is
- * the recourse for a full refresh).
+ * These are literals, **frozen once written** — they must keep matching what old
+ * `system_config.yaml` files actually contain even as the defaults evolve, exactly like the
+ * LEGACY_* template constants in default-config.ts. A tab whose defaults never changed does
+ * not appear here; nor does one that simply did not exist yet, since a config predating a
+ * section carries no such tab at all and is materialized on absence rather than matched.
*/
-export const KERNEL_HASH_HISTORY: Readonly<Record<string, Readonly<Record<string, string>>>> = {
- "2026-08-10": {
- system_prompt: "7c0dce1e6b4a7b94aaec5f09d4c7bc9bf104c46c9167fdca9543306b9e1ba595",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "8eda794b86cb709202a0023fd5273e3de6d24117b7e36b9bdb53c0238dac4785",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",
- "tools.builtin.input_command":
- "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",
- "tools.builtin.run_subagent":
- "c3f93add8da3032850fb2e1f484e2d6ddf97e57d73639d887549494ce9f15fb2",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
- "2026-08-11": {
- system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "8eda794b86cb709202a0023fd5273e3de6d24117b7e36b9bdb53c0238dac4785",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",
- "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",
- "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",
- "tools.builtin.input_command":
- "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",
- "tools.builtin.run_subagent":
- "c3f93add8da3032850fb2e1f484e2d6ddf97e57d73639d887549494ce9f15fb2",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
- "2026-08-18": {
- system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "8eda794b86cb709202a0023fd5273e3de6d24117b7e36b9bdb53c0238dac4785",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",
- "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",
- "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",
- "tools.builtin.input_command":
- "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",
- "tools.builtin.run_subagent":
- "be00af47c7098cde840a662c99f9f6d0cdf8358883e09974ce840b0c4683a9af",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
- "2026-08-19": {
- system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "8eda794b86cb709202a0023fd5273e3de6d24117b7e36b9bdb53c0238dac4785",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",
- "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",
- "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",
- "tools.builtin.input_command":
- "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",
- "tools.builtin.run_subagent":
- "f43ac4f9621032d554275be1d416f994f0d3cc0918537de99c974e436eb69316",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
- "2026-08-20": {
- system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "b412afcc00967650c9e51efd8cdc35ae59d3d6c30234331b7bf75b382d982ee9",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",
- "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",
- "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",
- "tools.builtin.input_command":
- "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",
- "tools.builtin.run_subagent":
- "f43ac4f9621032d554275be1d416f994f0d3cc0918537de99c974e436eb69316",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
- "2026-08-21": {
- system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",
- max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",
- "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",
- "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",
- "compaction.max_context_length":
- "b412afcc00967650c9e51efd8cdc35ae59d3d6c30234331b7bf75b382d982ee9",
- "compaction.max_session_turns":
- "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",
- "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",
- "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",
- "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "memory.prompt": "be1a8733b5d23afb11af3086b369105d42b7209edce6749eed31c4dbede9beff",
- "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",
- "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",
- "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",
- "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
- "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",
- "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",
- "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",
- "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",
- "tools.builtin.exec_command":
- "c7cf0639eb9434b2eecdd064aabeead52e22c966ddce348f987c744e93f9686f",
- "tools.builtin.input_command":
- "071daddb34cba05556cda2b6a87d18d5bd73fb863e6e3bd62f033626fbabf017",
- "tools.builtin.kill_command":
- "1d35d3be0408349c0bb099c442abfde3975c720e2c85cda3c2b749b359bef891",
- "tools.builtin.run_subagent":
- "6d890081b3dcd0405bab35590ee5d85c1ffa4815faf3b1b4de62b2617da77ec6",
- "tools.builtin.input_subagent":
- "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",
- "tools.builtin.kill_subagent":
- "8d8c11a1ae565b9b8334a498c5fc5b8903a2f657ac4e46d1c3dc9b7288e12ce4",
- "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",
- "tools.builtin.describe_image":
- "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",
- },
+export type KernelSupersededTabHashes = Readonly<Partial<Record<KernelTab, readonly string[]>>>;
+
+export const KERNEL_SUPERSEDED_TAB_HASHES: KernelSupersededTabHashes = {
+ // The pre-toggles template, with the hardcoded # Vault / # Skills sections (before #257).
+ prompt: ["99b8babb72d95c636a2c2893b657ac9c92d60c270a2e04e346b35b1fb720c932"],
+ // compaction.max_context_length was 128000, before the rise to 256000 in 2026-08-20.
+ runtime: ["808ae1d1b544f46daff4f59f1e62357b89a61f60803061e86b10635616e0102c"],
+ tools: [
+ "238440586ad2e075bde04948cf8dc9876301da538aafeb8926cd9c6a5738081b", // before run_subagent's `thinking_level` (#306)
+ "c719f2fe8a25bc5c644a4e1a78d26cf960dd0561efc453614af2e395000ed4de", // before `max` joined the ladder
+ "074248073c5fe89537ff257cc5d5662159288fc79ede7703eded6b440b4e38e9", // before background execution and the kill tools
+ ],
+ // The memory prompt's wording before #397 named when a fact is worth saving.
+ memory: ["c28acdda755552967cd0c99ba4ced407eddfa843b3dce228a965da4674676dc7"],
};
/**
- * Every hash any recorded generation gives for a leaf path — the "known default, any era"
- * test set of the kernel update. A path absent from an old generation (e.g. `vault.*` before
- * #257) simply contributes nothing there.
+ * Whether a stored tab hash is a *superseded* default — an old built-in tab the user never
+ * edited, which a kernel update rewrites from the current defaults. The current default is
+ * deliberately not a match: the update has already short-circuited on it by the time it asks.
*/
-export function historicalHashesFor(path: string): Set<string> {
- const hashes = new Set<string>();
- for (const generation of Object.values(KERNEL_HASH_HISTORY)) {
- const hash = generation[path];
- if (hash !== undefined) hashes.add(hash);
- }
- return hashes;
+export function isSupersededTab(
+ tab: KernelTab,
+ hash: string,
+ superseded: KernelSupersededTabHashes = KERNEL_SUPERSEDED_TAB_HASHES,
+): boolean {
+ return superseded[tab]?.includes(hash) ?? false;
}
diff --git a/packages/core/src/state/kernel-update.ts b/packages/core/src/state/kernel-update.ts
index a0866fb3..1a02a2b4 100644
--- a/packages/core/src/state/kernel-update.ts
+++ b/packages/core/src/state/kernel-update.ts
@@ -4,71 +4,59 @@
* `resetSystemConfigToDefaults` (which overwrites everything; the two actions sit side by
* side in the Web App).
*
- * Per kernel-managed leaf of the current defaults (see kernelLeafEntries):
+ * The unit is a **settings tab** (see KERNEL_TABS), matched and written whole:
*
- * - stored value missing → the effective value was already the built-in fallback, so the new
- * default is materialized (reported `advanced`);
- * - stored value equal to the new default → untouched, not reported;
- * - stored value hash-matching **any recorded defaults generation** (KERNEL_HASH_HISTORY) →
- * it is an old default the user never edited: replaced by the new default (`advanced`);
- * - anything else → a user customization or an unrecorded generation: conservatively kept
- * (`kept`). Old generations beyond the seeded ones cannot be reconstructed, so their
- * values also land here — restore-default-config remains the full-refresh recourse.
- *
- * `tools.builtin` merges per tool name: entries the user edited are kept individually while
- * the rest advance; entries the user added (names outside the defaults) are always kept and
- * never reported; a default-named entry the user *removed* from a present array stays
- * removed (`kept`) unless the tool is new in the latest generation — only then is it
- * genuinely new to this config and appended (`advanced`). If a default tool is ever removed
- * from the defaults, stale copies are conservatively kept the same way (they fall outside
- * the traversal base).
+ * - tab absent from the config → it predates the section, so the defaults are materialized
+ * (reported `advanced`);
+ * - tab hashing equal to the current default → untouched, not reported;
+ * - tab hashing equal to a **superseded default** (KERNEL_HISTORY.superseded) → an old default
+ * the user never edited: every path the tab owns is rewritten from the current defaults
+ * (`advanced`), which is also how tools added since reach the config;
+ * - anything else → the user edited something in that tab, or it comes from a generation too
+ * old to be recorded: the whole tab is conservatively kept (`kept`), edits, additions and
+ * deliberate deletions alike. Restore-default-config remains the full-refresh recourse.
*
* Never touched: `name`, `description`, `version` (the optimization counter) and
- * `tools.mcpServers` — identity and user-owned data. The file is edited via yaml
- * `parseDocument`, so comments and untouched content survive (same mechanism as the config
- * PUT); finally the config is stamped `kernel_version: KERNEL_VERSION`.
+ * `tools.mcpServers` — identity and user-owned data, none of them owned by a kernel tab. The
+ * file is edited via yaml `parseDocument`, so comments and untouched content survive (same
+ * mechanism as the config PUT); finally the config is stamped `kernel_version: KERNEL_VERSION`.
*/
import fs from "node:fs/promises";
import { parseDocument, parse as parseYaml } from "yaml";
import { defaultSystemConfig } from "./default-config.js";
import {
- KERNEL_HASH_HISTORY,
+ KERNEL_SUPERSEDED_TAB_HASHES,
+ KERNEL_TABS,
+ KERNEL_TAB_KEYS,
KERNEL_VERSION,
- hashKernelValue,
- kernelLeafEntries,
+ isSupersededTab,
+ kernelTabHash,
+ valueAtPath,
+ type KernelSupersededTabHashes,
+ type KernelTab,
} from "./kernel-history.js";
import { assertValidId } from "./agent-state.js";
import { systemConfigPath } from "./paths.js";
-/** Outcome of a kernel update, path lists in defaults-traversal order (dotted leaf paths, `tools.builtin.<name>` per tool). */
+/** Outcome of a kernel update, tab keys in the settings page's tab order (see KERNEL_TABS). */
export interface KernelUpdateResult {
- /** Leaves written to the new default (previously missing, or an untouched old default). */
- advanced: string[];
- /** Leaves left alone because the stored value matches no recorded defaults generation (user customizations — and unrecorded old generations, kept conservatively). */
- kept: string[];
+ /** Tabs written to the current defaults (previously absent, or an untouched old default). */
+ advanced: KernelTab[];
+ /** Tabs left alone because they match no recorded default (customized — and unrecorded old generations, kept conservatively). */
+ kept: KernelTab[];
/** The stamp written: always the current KERNEL_VERSION. */
kernelVersion: string;
}
-/** Test seam: an alternate hash history (same shape as KERNEL_HASH_HISTORY). Production callers never pass it. */
+/** Test seam: alternate superseded tab hashes (same shape as KERNEL_SUPERSEDED_TAB_HASHES). Production callers never pass it. */
export interface KernelUpdateOptions {
- history?: Readonly<Record<string, Readonly<Record<string, string>>>>;
+ supersededTabs?: KernelSupersededTabHashes;
}
function isPlainObject(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === "object" && !Array.isArray(value);
}
-/** The stored value at a dotted-path's segments, or undefined when any segment is missing. */
-function getAtPath(root: unknown, segments: string[]): unknown {
- let current: unknown = root;
- for (const segment of segments) {
- if (!isPlainObject(current)) return undefined;
- current = current[segment];
- }
- return current;
-}
-
export async function applyKernelUpdate(
root: string,
projectId: string,
@@ -89,32 +77,16 @@ export async function applyKernelUpdate(
const stored = isPlainObject(parsed) ? parsed : {};
const doc = parseDocument(raw);
- const history = options?.history ?? KERNEL_HASH_HISTORY;
- const latestGeneration = Object.keys(history).sort().at(-1);
- /** Hashes any recorded generation gives for a leaf path (an old generation without the path contributes nothing). */
- const historicalHashes = (path: string): Set<string> => {
- const hashes = new Set<string>();
- for (const generation of Object.values(history)) {
- const hash = generation[path];
- if (hash !== undefined) hashes.add(hash);
- }
- return hashes;
- };
- /** Whether a path is recorded only by the latest generation — i.e. new to the defaults in this generation. */
- const newInLatestGeneration = (path: string): boolean =>
- Object.entries(history).every(
- ([generation, hashes]) => generation === latestGeneration || hashes[path] === undefined,
- );
-
- const advanced: string[] = [];
- const kept: string[] = [];
+ const superseded = options?.supersededTabs ?? KERNEL_SUPERSEDED_TAB_HASHES;
+ const advanced: KernelTab[] = [];
+ const kept: KernelTab[] = [];
/**
* setIn that tolerates an invalid intermediate node — a hand-edited dangling `tools:` key
* parses as null, and `doc.setIn(["tools", …])` would throw "Expected YAML collection" on
- * it. Such a section is effectively missing on the read side (every leaf under it reads
- * undefined and gets materialized), so it is replaced by a map first — once, tracked so a
- * later leaf of the same section does not wipe the earlier one's write.
+ * it. Such a section is effectively missing on the read side (the tab reads absent and gets
+ * materialized), so it is replaced by a map first — once, tracked so a later write to the
+ * same section does not wipe the earlier one.
*/
const replacedSections = new Set<string>();
const setDeep = (segments: string[], value: unknown): void => {
@@ -122,7 +94,7 @@ export async function applyKernelUpdate(
const ancestor = segments.slice(0, i);
const key = ancestor.join(".");
if (replacedSections.has(key)) continue;
- const existing = getAtPath(stored, ancestor);
+ const existing = valueAtPath(stored, ancestor);
if (existing !== undefined && !isPlainObject(existing)) {
// createNode: a bare `{}` would be stored verbatim as a JS object, not a YAMLMap,
// and the child setIn below would still throw.
@@ -134,80 +106,25 @@ export async function applyKernelUpdate(
};
const defaults = defaultSystemConfig();
- const defaultTools = defaults.tools?.builtin ?? [];
- /** The merged tools.builtin array, built only when the stored config carries one (else the whole default array is materialized). */
- let mergedTools: unknown[] | null = null;
- let toolsChanged = false;
- const storedTools = getAtPath(stored, ["tools", "builtin"]);
- if (Array.isArray(storedTools)) {
- mergedTools = [...storedTools];
- }
- for (const { path, value: defaultValue } of kernelLeafEntries(defaults)) {
- const segments = path.split(".");
- const defaultHash = hashKernelValue(defaultValue);
-
- // Per-tool merge over a stored builtin array (a missing array falls through to the
- // scalar branch below via the `tools.builtin` group write).
- if (segments[0] === "tools" && segments[1] === "builtin" && mergedTools !== null) {
- const name = segments[2]!;
- const index = mergedTools.findIndex(
- (entry) => isPlainObject(entry) && entry["name"] === name,
- );
- if (index === -1) {
- // Absent from a present array: a deliberate removal is preserved; only a tool that
- // is new in the latest generation (so this config could never have carried it) is
- // appended.
- if (newInLatestGeneration(path)) {
- mergedTools.push(defaultValue);
- toolsChanged = true;
- advanced.push(path);
- } else {
- kept.push(path);
- }
+ for (const tab of KERNEL_TAB_KEYS) {
+ const storedHash = kernelTabHash(stored, tab);
+ if (storedHash !== null) {
+ if (storedHash === kernelTabHash(defaults, tab)) continue;
+ if (!isSupersededTab(tab, storedHash, superseded)) {
+ kept.push(tab);
continue;
}
- const storedHash = hashKernelValue(mergedTools[index]);
- if (storedHash === defaultHash) continue;
- if (historicalHashes(path).has(storedHash)) {
- mergedTools[index] = defaultValue;
- toolsChanged = true;
- advanced.push(path);
- } else {
- kept.push(path);
- }
- continue;
}
-
- const storedValue =
- segments[0] === "tools" && segments[1] === "builtin"
- ? undefined // no stored array: every default tool is materialized below
- : getAtPath(stored, segments);
- if (storedValue === undefined) {
- if (segments[0] === "tools" && segments[1] === "builtin") {
- // Materialize the whole default array once (per-tool reporting keeps the result
- // granular); repeated leaves only report, the single setIn happens after the loop.
- toolsChanged = true;
- advanced.push(path);
- continue;
- }
- setDeep(segments, defaultValue);
- advanced.push(path);
- continue;
- }
- const storedHash = hashKernelValue(storedValue);
- if (storedHash === defaultHash) continue;
- if (historicalHashes(path).has(storedHash)) {
- setDeep(segments, defaultValue);
- advanced.push(path);
- } else {
- kept.push(path);
+ // Absent, or an untouched old default: write every path the tab owns from the defaults.
+ for (const path of KERNEL_TABS[tab]) {
+ const segments = path.split(".");
+ const value = valueAtPath(defaults, segments);
+ if (value !== undefined) setDeep(segments, value);
}
+ advanced.push(tab);
}
- if (toolsChanged) {
- setDeep(["tools", "builtin"], mergedTools ?? defaultTools);
- }
doc.setIn(["kernel_version"], KERNEL_VERSION);
await fs.writeFile(configPath, doc.toString(), "utf8");
return { advanced, kept, kernelVersion: KERNEL_VERSION };
diff --git a/packages/core/test/kernel-version.test.ts b/packages/core/test/kernel-version.test.ts
index 538c0f9c..3d8c7b9b 100644
--- a/packages/core/test/kernel-version.test.ts
+++ b/packages/core/test/kernel-version.test.ts
@@ -1,9 +1,10 @@
/**
* Agent config kernel versions: the pinned-hash guard (the mechanical definition of "the
- * defaults changed substantively, bump the kernel version"), the seeded pre-#257 generation's
- * reconstruction proof, and the smart-merge semantics of applyKernelUpdate (untouched old
- * defaults advance, customizations and unknown generations are kept, identity fields and
- * user data are never touched, YAML comments survive, the config is re-stamped).
+ * defaults changed substantively, bump the kernel version"), the record's internal
+ * consistency, the pre-#257 generation's reconstruction proof, and the tab-wise merge
+ * semantics of applyKernelUpdate (an untouched old default tab advances whole, a tab with any
+ * customization is kept whole, identity fields and user data are never touched, YAML comments
+ * survive, the config is re-stamped).
*/
import fs from "node:fs/promises";
import os from "node:os";
@@ -13,7 +14,10 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
import {
DEFAULT_AGENT_ID,
DEFAULT_PROJECT_ID,
- KERNEL_HASH_HISTORY,
+ KERNEL_DEFAULT_TAB_HASHES,
+ KERNEL_SUPERSEDED_TAB_HASHES,
+ KERNEL_TABS,
+ KERNEL_TAB_KEYS,
KERNEL_VERSION,
LEGACY_SKILLS_SECTION,
LEGACY_VAULT_SECTION,
@@ -21,21 +25,18 @@ import {
SKILLS_PLACEHOLDER,
VAULT_PLACEHOLDER,
applyKernelUpdate,
- computeKernelHashes,
+ computeKernelTabHashes,
defaultSystemConfig,
- hashKernelValue,
isKernelOutdated,
- kernelLeafEntries,
+ kernelTabHash,
loadOrInitAgentState,
resetSystemConfigToDefaults,
systemConfigPath,
+ type KernelSupersededTabHashes,
+ type KernelTab,
type SystemConfig,
} from "../src/index.js";
-/** The two seeded generations (see KERNEL_HASH_HISTORY's doc comment). */
-const PRE_TOGGLES_GENERATION = "2026-08-10";
-const TOGGLES_GENERATION = "2026-08-11";
-
/** A mutable plain-object clone of a config, for seeding on-disk scenarios. */
function mutableConfig(config: SystemConfig): Record<string, unknown> {
return structuredClone(config) as unknown as Record<string, unknown>;
@@ -45,11 +46,10 @@ function mutableConfig(config: SystemConfig): Record<string, unknown> {
* Reconstructs a pre-#257 (pre-toggles) shaped config from the current defaults: the frozen
* LEGACY_* sections swapped back into the template in place of the section placeholders, no
* `{{SCHEDULES}}` line, and no vault/skills/schedules config sections (the recipe
- * prompt-sections.test.ts proves byte-exact for the template). Leaves outside the swap — the
- * tool entries — carry the *current* defaults, so the smart-merge tests below treat them as
- * already-current; the seeding exercises the old-template migration paths regardless. The
- * reconstruction proof below therefore speaks only for the leaves whose default has not
- * drifted since the toggles generation (see there).
+ * prompt-sections.test.ts proves byte-exact for the template). Everything outside the swap —
+ * the runtime, tools and memory tabs — carries the *current* defaults, so the merge tests
+ * below treat those tabs as already-current; the seeding exercises the old-template migration
+ * paths regardless.
*/
function preTogglesDefaultConfig(): SystemConfig {
const current = defaultSystemConfig();
@@ -72,69 +72,78 @@ function preTogglesDefaultConfig(): SystemConfig {
};
}
-describe("kernel hash history (pinned-hash guard)", () => {
- it("KERNEL_VERSION is a date and the newest history key", () => {
+describe("kernel tab hash record (pinned-hash guard)", () => {
+ it("KERNEL_VERSION is a date", () => {
expect(KERNEL_VERSION).toMatch(/^\d{4}-\d{2}-\d{2}$/);
- const keys = Object.keys(KERNEL_HASH_HISTORY);
- expect(keys.length).toBeGreaterThanOrEqual(2);
- for (const key of keys) expect(key).toMatch(/^\d{4}-\d{2}-\d{2}$/);
- expect([...keys].sort().at(-1)).toBe(KERNEL_VERSION);
+ });
+
+ it("the record covers every tab and lists nothing that could never fire", () => {
+ expect(Object.keys(KERNEL_DEFAULT_TAB_HASHES).sort()).toEqual([...KERNEL_TAB_KEYS].sort());
+ for (const [tab, hashes] of Object.entries(KERNEL_SUPERSEDED_TAB_HASHES)) {
+ expect(KERNEL_TAB_KEYS, `${tab} is not a kernel tab`).toContain(tab);
+ expect(hashes.length, tab).toBeGreaterThan(0);
+ expect(new Set(hashes).size, `${tab} repeats a superseded hash`).toBe(hashes.length);
+ // A kernel update short-circuits on the current default before consulting the record,
+ // so the current hash sitting in `superseded` would be dead weight.
+ expect(hashes, `${tab} lists its own current default`).not.toContain(
+ KERNEL_DEFAULT_TAB_HASHES[tab as KernelTab],
+ );
+ }
});
// THE guard: this failing means the built-in defaults changed substantively without a
// kernel bump (or vice versa). It is the mechanical definition of "substantive change".
- it("the current defaults hash exactly to the latest history entry — bump KERNEL_VERSION when this fails", () => {
- const recomputed = computeKernelHashes(defaultSystemConfig());
- const pinned = KERNEL_HASH_HISTORY[KERNEL_VERSION] ?? {};
- const paths = new Set([...Object.keys(recomputed), ...Object.keys(pinned)]);
- const mismatches = [...paths].filter((p) => recomputed[p] !== pinned[p]).sort();
+ it("the current defaults hash exactly to KERNEL_DEFAULT_TAB_HASHES — advance the kernel when this fails", () => {
+ const recomputed = computeKernelTabHashes(defaultSystemConfig());
+ const moved = KERNEL_TAB_KEYS.filter(
+ (tab) => recomputed[tab] !== KERNEL_DEFAULT_TAB_HASHES[tab],
+ );
expect(
- mismatches,
- "The built-in default config changed substantively (the listed leaf paths no longer " +
- "hash to the latest KERNEL_HASH_HISTORY entry). Advance the kernel: set " +
- "KERNEL_VERSION in core/src/state/kernel-history.ts to today's date and append a new " +
- "history entry with the recomputed hashes (computeKernelHashes(defaultSystemConfig())). " +
- "Several changes on the same day may revise that day's entry in place instead; never " +
- "edit an older generation's entry — those are frozen.",
+ moved,
+ "The built-in default config changed substantively (the listed settings tabs no longer " +
+ "hash to KERNEL_DEFAULT_TAB_HASHES). Advance the kernel in " +
+ "core/src/state/kernel-history.ts: set KERNEL_VERSION to today's date (several " +
+ "changes on the same day may reuse it), then, for each tab listed, append its OLD " +
+ "KERNEL_DEFAULT_TAB_HASHES hash to the end of KERNEL_SUPERSEDED_TAB_HASHES[tab] " +
+ "(creating the entry if this is its first change; never edit the hashes already " +
+ "there, they are frozen) and write the recomputed hash in — take it from " +
+ "computeKernelTabHashes(defaultSystemConfig()). Finally note what moved in the " +
+ "generation list above KERNEL_DEFAULT_TAB_HASHES.",
).toEqual([]);
});
- // Keeps the oldest seeded generation honest: its pinned hashes are the only record of what
- // a pre-#257 `system_config.yaml` actually contains, and nothing else can catch a typo in
- // them. The recipe reads the *current* defaults, so it can only speak for leaves whose
- // default has not drifted since the toggles generation — chiefly `system_prompt`, the leaf
- // the LEGACY_* swap is actually about. Retirement is therefore per leaf and automatic: a
- // generation that changes some other leaf (e.g. run_subagent's thinking_level in
- // "2026-08-18") drops just that leaf and leaves the proof standing.
- it("the pre-toggles generation's pinned hashes equal the LEGACY_* reconstruction", () => {
- const preToggles = KERNEL_HASH_HISTORY[PRE_TOGGLES_GENERATION]!;
- const toggles = KERNEL_HASH_HISTORY[TOGGLES_GENERATION]!;
- const current = computeKernelHashes(defaultSystemConfig());
- const reconstructed = computeKernelHashes(preTogglesDefaultConfig());
- const reconstructible = Object.keys(preToggles).filter((p) => current[p] === toggles[p]);
- // If the template itself ever moves, this proof has nothing left to say and must be
- // re-anchored (or retired) deliberately rather than quietly passing on leftovers.
- expect(reconstructible).toContain("system_prompt");
- expect(Object.fromEntries(reconstructible.map((p) => [p, reconstructed[p]]))).toEqual(
- Object.fromEntries(reconstructible.map((p) => [p, preToggles[p]])),
- );
- // The recipe's other half: an era config carries no vault/skills/schedules sections at all.
- expect(Object.keys(reconstructed).filter((p) => /^(vault|skills|schedules)\./.test(p))).toEqual(
- [],
- );
+ // Keeps the oldest recorded generation honest: its pinned hash is the only record of what a
+ // pre-#257 `system_config.yaml` actually contains, and nothing else can catch a typo in it.
+ // The recipe reads the *current* template, so the proof stands only while `system_prompt`
+ // has not drifted since the toggles generation. A change to it moves the prompt tab, fails
+ // this test, and the proof must then be re-anchored (or retired) deliberately rather than
+ // quietly passing on leftovers.
+ it("the pre-toggles prompt tab equals the LEGACY_* reconstruction", () => {
+ const reconstructed = preTogglesDefaultConfig();
+ expect(kernelTabHash(reconstructed, "prompt")).toBe(KERNEL_SUPERSEDED_TAB_HASHES.prompt?.[0]);
+ // The recipe's other half: an era config carries no vault/skills/schedules sections at all,
+ // which is why those tabs have no superseded hash — they are materialized on absence.
+ for (const tab of ["vault", "skills", "schedules"] as const) {
+ expect(kernelTabHash(reconstructed, tab), tab).toBeNull();
+ }
});
- it("excludes identity fields and mcpServers from the managed leaves", () => {
- const paths = kernelLeafEntries({
- ...defaultSystemConfig(),
- name: "n",
- description: "d",
- tools: { builtin: [], mcpServers: [{ name: "m", config: {} }] },
- }).map((leaf) => leaf.path);
- for (const excluded of ["name", "description", "version", "kernel_version"]) {
- expect(paths).not.toContain(excluded);
+ it("no kernel tab owns identity fields, the State version or MCP servers", () => {
+ const owned = KERNEL_TAB_KEYS.flatMap((tab) => [...KERNEL_TABS[tab]]);
+ for (const excluded of ["name", "description", "version", "kernel_version", "tools"]) {
+ expect(owned).not.toContain(excluded);
}
- expect(paths.some((p) => p.startsWith("tools.mcpServers"))).toBe(false);
+ // And writing user data into them moves no tab hash, so none of it can be clobbered.
+ const defaults = defaultSystemConfig();
+ expect(
+ computeKernelTabHashes({
+ ...defaults,
+ name: "n",
+ description: "d",
+ version: 7,
+ tools: { ...defaults.tools, mcpServers: [{ name: "m", config: {} }] },
+ }),
+ ).toEqual(computeKernelTabHashes(defaults));
});
});
@@ -191,15 +200,7 @@ describe("applyKernelUpdate", () => {
await seedConfig(mutableConfig(preTogglesDefaultConfig()));
const result = await update();
expect(result.kept).toEqual([]);
- expect(result.advanced).toEqual([
- "system_prompt",
- "vault.enabled",
- "vault.prompt",
- "skills.enabled",
- "skills.prompt",
- "schedules.enabled",
- "schedules.prompt",
- ]);
+ expect(result.advanced).toEqual(["prompt", "skills", "vault", "schedules"]);
const defaults = defaultSystemConfig();
const written = await readConfig();
expect(written.system_prompt).toBe(defaults.system_prompt);
@@ -211,34 +212,40 @@ describe("applyKernelUpdate", () => {
expect(await update()).toEqual({ advanced: [], kept: [], kernelVersion: KERNEL_VERSION });
});
- it("keeps customized fields (reported) while still stamping", async () => {
+ it("keeps a customized tab whole (reported) while its untouched siblings advance", async () => {
const config = mutableConfig(preTogglesDefaultConfig());
config.system_prompt = "MY CUSTOM PROMPT";
(config.memory as Record<string, unknown>).prompt = "my memory prompt";
await seedConfig(config);
const result = await update();
- expect(result.kept).toEqual(["system_prompt", "memory.prompt"]);
+ expect(result.kept).toEqual(["prompt", "memory"]);
+ expect(result.advanced).toEqual(["skills", "vault", "schedules"]);
const written = await readConfig();
expect(written.system_prompt).toBe("MY CUSTOM PROMPT");
expect(written.memory?.prompt).toBe("my memory prompt");
- // Untouched siblings of a kept leaf still advance independently.
+ // The rest of the kept tab is kept with it — nothing inside it is rewritten.
+ expect(written.memory?.workspace_prompt).toBe(
+ preTogglesDefaultConfig().memory?.workspace_prompt,
+ );
expect(written.vault).toEqual(defaultSystemConfig().vault);
expect(written.kernel_version).toBe(KERNEL_VERSION);
});
- it("keeps values from unknown (unseeded) generations conservatively", async () => {
+ it("keeps a tab from an unrecorded generation conservatively, missing fields included", async () => {
const config = mutableConfig(defaultSystemConfig());
delete config.kernel_version;
- // An ancient default wording we cannot reconstruct: it matches no recorded hash.
+ // An ancient compaction wording we cannot reconstruct, with the rest of the section gone:
+ // the runtime tab matches no recorded hash, so it is kept exactly as written.
config.compaction = { mode: "summarize", prompt: "Ancient compaction wording." };
await seedConfig(config);
const result = await update();
- expect(result.kept).toContain("compaction.prompt");
- // The section's *missing* leaves are materialized to the defaults alongside.
- expect(result.advanced).toContain("compaction.max_context_length");
+ expect(result.kept).toEqual(["runtime"]);
+ expect(result.advanced).toEqual([]);
const written = await readConfig();
expect(written.compaction?.prompt).toBe("Ancient compaction wording.");
- expect(written.compaction?.max_context_length).toBe(256000);
+ // The tab is kept whole: its absent fields stay absent and keep falling back to the
+ // built-in defaults at runtime, rather than being materialized field by field.
+ expect(written.compaction?.max_context_length).toBeUndefined();
});
it("never touches name, description, version or mcpServers", async () => {
@@ -250,9 +257,7 @@ describe("applyKernelUpdate", () => {
{ name: "custom-mcp", config: { command: "custom-server" } },
];
await seedConfig(config);
- const result = await update();
- expect(result.advanced).not.toContain("name");
- expect(result.kept).not.toContain("name");
+ await update();
const written = await readConfig();
expect(written.name).toBe("Custom Name");
expect(written.description).toBe("Custom description");
@@ -262,11 +267,10 @@ describe("applyKernelUpdate", () => {
]);
});
- it("merges tools.builtin per tool name: the edited one is kept, user-added entries survive, removals stay removed", async () => {
+ it("keeps the whole tools tab once any tool is edited, added or removed", async () => {
const config = mutableConfig(defaultSystemConfig());
delete config.kernel_version;
const tools = config.tools as { builtin: Array<Record<string, unknown>> };
- // Customize one default tool, remove another, append a user-defined one.
const readFile = tools.builtin.find((t) => t.name === "read_file")!;
readFile.description = "my own description";
tools.builtin = tools.builtin.filter((t) => t.name !== "edit_file");
@@ -274,51 +278,40 @@ describe("applyKernelUpdate", () => {
await seedConfig(config);
const result = await update();
- expect(result.kept).toEqual(["tools.builtin.read_file", "tools.builtin.edit_file"]);
+ expect(result.kept).toEqual(["tools"]);
expect(result.advanced).toEqual([]);
const written = await readConfig();
const names = (written.tools?.builtin ?? []).map((t) => t.name);
expect(names).not.toContain("edit_file"); // a deliberate removal is preserved
- expect(names).toContain("my_tool"); // user-added entries survive, unreported
- const writtenReadFile = written.tools?.builtin?.find((t) => t.name === "read_file");
- expect(writtenReadFile?.description).toBe("my own description");
- // The untouched rest still equals the defaults.
- const writtenExec = written.tools?.builtin?.find((t) => t.name === "exec_command");
- expect(writtenExec).toEqual(
- defaultSystemConfig().tools?.builtin?.find((t) => t.name === "exec_command"),
+ expect(names).toContain("my_tool"); // user-added entries survive
+ expect(written.tools?.builtin?.find((t) => t.name === "read_file")?.description).toBe(
+ "my own description",
);
});
- it("advances a stored tool entry that matches an older generation's hash", async () => {
- // The path every existing config takes when a tool's default schema changes (the first
- // such bump is run_subagent's thinking_level, "2026-08-18"): the stored entry is not the
- // current default, but it hash-matches a recorded generation, so it is an untouched old
- // default and must be replaced — not kept as if the user had edited it. Driven through
- // the history seam so the test cannot rot when the real generations move on.
- const defaults = defaultSystemConfig();
- const current = computeKernelHashes(defaults);
- const currentEntry = defaults.tools?.builtin?.find((t) => t.name === "run_subagent");
- const oldEntry = { ...currentEntry!, description: "the previous generation's wording" };
- const history = {
- "2000-01-01": { ...current, "tools.builtin.run_subagent": hashKernelValue(oldEntry) },
- [KERNEL_VERSION]: current,
- };
- const config = mutableConfig(defaults);
- config.kernel_version = "2000-01-01";
+ it("advances a tools tab that matches a superseded default, bringing tools added since", async () => {
+ // The path every existing config takes when the default toolset changes: the stored tab is
+ // not the current default, but it hash-matches a superseded one, so it is an untouched old
+ // default and the whole tab is rewritten — which is also how a tool added by a later
+ // kernel reaches the config. Driven through the seam so the test cannot rot when the real
+ // record moves on.
+ const config = mutableConfig(defaultSystemConfig());
+ delete config.kernel_version;
const tools = config.tools as { builtin: Array<Record<string, unknown>> };
- tools.builtin = tools.builtin.map((t) =>
- t.name === "run_subagent" ? (oldEntry as unknown as Record<string, unknown>) : t,
+ tools.builtin = tools.builtin.filter(
+ (t) => t.name !== "kill_command" && t.name !== "kill_subagent",
);
+ const supersededTabs: KernelSupersededTabHashes = { tools: [kernelTabHash(config, "tools")!] };
await seedConfig(config);
const result = await applyKernelUpdate(root, DEFAULT_PROJECT_ID, DEFAULT_AGENT_ID, {
- history,
+ supersededTabs,
});
- expect(result.advanced).toEqual(["tools.builtin.run_subagent"]);
+ expect(result.advanced).toEqual(["tools"]);
expect(result.kept).toEqual([]);
const written = await readConfig();
- expect(written.tools?.builtin?.find((t) => t.name === "run_subagent")).toEqual(currentEntry);
+ expect(written.tools?.builtin).toEqual(defaultSystemConfig().tools?.builtin);
expect(written.kernel_version).toBe(KERNEL_VERSION);
});
@@ -328,55 +321,29 @@ describe("applyKernelUpdate", () => {
delete config.tools;
await seedConfig(config);
const result = await update();
- const defaults = defaultSystemConfig();
- expect(result.advanced).toEqual(
- (defaults.tools?.builtin ?? []).map((t) => `tools.builtin.${t.name}`),
- );
- expect((await readConfig()).tools?.builtin).toEqual(defaults.tools?.builtin);
- });
-
- it("appends a tool only when it is new in the latest generation (history seam)", async () => {
- const defaults = defaultSystemConfig();
- const current = computeKernelHashes(defaults);
- // A fabricated older generation that already knew read_file but never edit_file: a
- // present array missing read_file is then a deliberate removal (kept), while the same
- // absence of edit_file means the config simply predates the tool (appended).
- const history = {
- "2000-01-01": { "tools.builtin.read_file": current["tools.builtin.read_file"]! },
- [KERNEL_VERSION]: current,
- };
- const config = mutableConfig(defaults);
- delete config.kernel_version;
- const tools = config.tools as { builtin: Array<Record<string, unknown>> };
- tools.builtin = tools.builtin.filter((t) => t.name !== "read_file" && t.name !== "edit_file");
- await seedConfig(config);
-
- const result = await applyKernelUpdate(root, DEFAULT_PROJECT_ID, DEFAULT_AGENT_ID, {
- history,
- });
- expect(result.kept).toContain("tools.builtin.read_file");
- expect(result.advanced).toContain("tools.builtin.edit_file");
- const names = ((await readConfig()).tools?.builtin ?? []).map((t) => t.name);
- expect(names).not.toContain("read_file");
- expect(names).toContain("edit_file");
+ expect(result.advanced).toEqual(["tools"]);
+ expect((await readConfig()).tools?.builtin).toEqual(defaultSystemConfig().tools?.builtin);
});
it("tolerates dangling/invalid section keys (a hand-edited `tools:` with no value parses as null)", async () => {
await loadOrInitAgentState({ root });
await fs.writeFile(
configPath(),
- // model is an invalid scalar, tools a dangling key: both sections read as missing and
- // must be materialized to the defaults instead of crashing setIn.
+ // `tools` is a dangling key: the whole tab reads absent and must be materialized instead
+ // of crashing setIn. `model: 3` leaves the runtime tab present but matching nothing, so
+ // that tab is kept exactly as the user left it.
"system_prompt: custom\nmodel: 3\ntools:\n",
"utf8",
);
const result = await update();
- expect(result.kept).toEqual(["system_prompt"]);
+ expect(result.kept).toEqual(["prompt", "runtime"]);
+ expect(result.advanced).toEqual(["tools", "skills", "memory", "vault", "schedules"]);
const defaults = defaultSystemConfig();
const written = await readConfig();
- expect(written.model).toEqual(defaults.model);
expect(written.tools?.builtin).toEqual(defaults.tools?.builtin);
+ expect(written.memory).toEqual(defaults.memory);
expect(written.system_prompt).toBe("custom");
+ expect(written.model as unknown).toBe(3);
expect(written.kernel_version).toBe(KERNEL_VERSION);
});
@@ -389,8 +356,8 @@ describe("applyKernelUpdate", () => {
"utf8",
);
const result = await update();
- // max_turns 5 is a customization (no generation ever defaulted to 5) — kept.
- expect(result.kept).toEqual(["max_turns"]);
+ // max_turns 5 is a customization (no generation ever defaulted to 5) — its tab is kept.
+ expect(result.kept).toEqual(["runtime"]);
const after = await fs.readFile(configPath(), "utf8");
expect(after).toContain("# my precious comment");
expect((await readConfig()).max_turns).toBe(5);
diff --git a/packages/docs/content/configuration.en.md b/packages/docs/content/configuration.en.md
index 2dd4174b..4df400a8 100644
--- a/packages/docs/content/configuration.en.md
+++ b/packages/docs/content/configuration.en.md
@@ -196,10 +196,10 @@ compaction:
An existing Agent always runs with its on-disk config verbatim — newer code defaults are never merged in automatically. When the built-in defaults change substantively, the config's `kernel_version` falls behind the current kernel and the settings page and agents list show an update hint. Two paths adopt the current defaults (side by side on the settings overview):
-- **Update kernel**: a lossless merge. Field by field: a missing field, or one still equal to a *recorded* generation's built-in default, follows the current default; a user-edited field stays unchanged and is listed in the result. `tools.builtin` merges per tool name — only the edited tool is kept, the rest follow, and user-added entries are untouched; `name`, `description`, `version` and `tools.mcpServers` are never touched. The config is then stamped with the current `kernel_version`. Matching is **conservative**: only values whose hash hits a recorded generation count as old defaults — generations too old to reconstruct are kept as if customized.
+- **Update kernel**: a lossless merge, **one settings tab at a time** (System Prompt, Runtime, Tools, Skills, Memory, Vault, Schedules). A tab the config lacks entirely, or one still hashing to a *recorded* generation's built-in default, is rewritten from the current defaults — that wholesale rewrite is also how tools added by a later version reach an existing Agent. A tab you have changed in any way stays unchanged **in full** and is listed in the result: edit one built-in tool and the entire Tools tab is kept, so tools you added and tools you deleted both survive, and the rest of that tab stops following new defaults until you restore defaults. `name`, `description`, `version` and `tools.mcpServers` belong to no tab and are never touched. The config is then stamped with the current `kernel_version`. Matching is **conservative**: only a tab whose hash hits a recorded generation counts as an old default — a tab from a generation too old to be recorded is kept as if customized.
- **Restore default configuration**: like a skill update, overwrites the existing configuration with the current defaults — custom system prompt, tool list, model/compaction settings and MCP Servers — keeping only `name`, `description` and `version`. The full-refresh fallback when the kernel update's conservative matching leaves fields behind.
-For developers: `kernel_version` advances manually, and only on a substantive change to the built-in defaults (using that day's date). The pinned-hash test in CI (`core/test/kernel-version.test.ts`) recomputes every default leaf hash against the latest `kernel-history.ts` entry and fails on drift, telling you to bump `KERNEL_VERSION` and append a new entry; several changes on the same day may revise that day's entry, while older entries are frozen forever — they are what identifies "still the old default".
+For developers: `kernel_version` advances manually, and only on a substantive change to the built-in defaults (using that day's date). The pinned-hash test in CI (`core/test/kernel-version.test.ts`) recomputes every tab hash against `KERNEL_DEFAULT_TAB_HASHES` in `kernel-history.ts` and fails on drift, naming each tab that moved and the edit it needs: bump `KERNEL_VERSION`, append the tab's previous hash to `KERNEL_SUPERSEDED_TAB_HASHES`, and write the recomputed hash in. Several changes on the same day may reuse that day's version. The superseded hashes are frozen forever — they are what identifies "still the old default".
### System prompt placeholders
diff --git a/packages/docs/content/configuration.zh.md b/packages/docs/content/configuration.zh.md
index c657df20..4e6b84f8 100644
--- a/packages/docs/content/configuration.zh.md
+++ b/packages/docs/content/configuration.zh.md
@@ -196,10 +196,10 @@ compaction:
既有 Agent 始终按其磁盘上的配置原样运行——更新后的代码默认值不会自动合并。内置默认发生实质变化时,配置的 `kernel_version` 落后于当前内核版本,详情页与智能体列表会给出更新提示。采用当前默认值有两条路径(同在设置页概览、相邻放置):
-- **更新内核**:无损合并。逐字段比对:字段缺失、或仍等于某一代已记录的内置默认,跟进当前默认;被用户改过的保持不变并在结果中列出。`tools.builtin` 按工具名逐个比对——只保留改过的那一个,其余照常跟进,用户自加的条目不受影响;`name`、`description`、`version` 与 `tools.mcpServers` 永不触碰。完成后盖章 `kernel_version`。比对是**保守**的:只有哈希命中已记录代际的值才被视为旧默认,太老而无法识别的代际一律按自定义保留。
+- **更新内核**:无损合并,**以设置页为单位**逐页比对(系统提示词、运行参数、工具、技能、记忆、密钥保险柜、定时任务)。配置中整页缺失、或整页哈希仍等于某一代已记录的内置默认,即按当前默认整页重写——后续版本新增的工具也正是借这次整页重写进入既有 Agent。只要该页被改动过,就**整页**保持不变并在结果中列出:改了一个内置工具,整个「工具」页都会被保留,因此自加的工具与删掉的工具都会留存,而该页其余内容在还原默认配置之前不再跟进新默认。`name`、`description`、`version` 与 `tools.mcpServers` 不属于任何设置页,永不触碰。完成后盖章 `kernel_version`。比对是**保守**的:只有整页哈希命中已记录代际才被视为旧默认,太老而无法识别的代际一律按自定义保留。
- **还原为默认配置**:与 Skill 更新同语义,用当前默认值覆盖现有配置——自定义系统提示词、工具列表、模型/压缩参数与 MCP Server——仅保留 `name`、`description` 与 `version`。更新内核因保守保留而没跟上时,这是全量刷新的兜底。
-面向开发者:`kernel_version` 只在对内置默认做出实质修改时手动前进(取当日日期)。CI 的 pinned-hash 测试(`core/test/kernel-version.test.ts`)重算全部默认字段哈希并与 `kernel-history.ts` 最新条目比对,不一致即失败并提示更新 `KERNEL_VERSION`、追加新条目;同日多次变更可修订当日条目,历史条目一经冻结不再改动——它们就是「仍是旧默认」的识别依据。
+面向开发者:`kernel_version` 只在对内置默认做出实质修改时手动前进(取当日日期)。CI 的 pinned-hash 测试(`core/test/kernel-version.test.ts`)重算各设置页哈希并与 `kernel-history.ts` 中的 `KERNEL_DEFAULT_TAB_HASHES` 比对,不一致即失败,并逐个列出变动的设置页及其对应改动:更新 `KERNEL_VERSION`、把该页旧哈希追加到 `KERNEL_SUPERSEDED_TAB_HASHES`、再写入新哈希。同日多次变更可复用当日版本号。已记录的旧哈希一经写入即冻结——它们就是「仍是旧默认」的识别依据。
### 系统提示词占位符
diff --git a/packages/server/src/api/types.ts b/packages/server/src/api/types.ts
index 0b7f25f5..aa60b96d 100644
--- a/packages/server/src/api/types.ts
+++ b/packages/server/src/api/types.ts
@@ -876,13 +876,13 @@ export interface AgentConfigResponse {
/**
* POST …/config/kernel-update result: the smart merge's outcome (core's applyKernelUpdate).
- * Paths are dotted config leaves (`system_prompt`, `memory.prompt`, `tools.builtin.<name>`…)
- * in defaults-traversal order; the client maps them to display names.
+ * The entries are Agent settings **tabs** (`prompt`, `runtime`, `tools`, `skills`, `memory`,
+ * `vault`, `schedules`) in the settings page's tab order; the client maps them to tab labels.
*/
export interface AgentKernelUpdateResponse {
- /** Leaves advanced to the new default (previously missing, or an untouched old default). */
+ /** Tabs advanced to the current defaults (previously absent, or an untouched old default). */
advanced: string[];
- /** Leaves kept because the stored value matches no recorded defaults generation (user customizations, kept conservatively). */
+ /** Tabs kept whole because they match no recorded default (customized, kept conservatively). */
kept: string[];
/** The kernel stamp written (the current defaults generation). */
kernelVersion: string;
diff --git a/packages/server/src/http/routes/agent-config.ts b/packages/server/src/http/routes/agent-config.ts
index a5025c09..b8c48981 100644
--- a/packages/server/src/http/routes/agent-config.ts
+++ b/packages/server/src/http/routes/agent-config.ts
@@ -129,7 +129,7 @@ export function agentConfigRoutes(deps: AppDeps): Hono<AppEnv> {
// Smart-merge the config up to the current defaults generation (see
// AgentConfigService.kernelUpdate): non-destructive sibling of /reset, same member-level
- // authorization as /reset and PUT. Responds with the merge report (advanced / kept paths +
+ // authorization as /reset and PUT. Responds with the merge report (advanced / kept tabs +
// the new stamp); the client re-GETs the config for the fresh values.
app.post("/kernel-update", async (c) => {
const projectId = requireValidId(c, "projectId");
diff --git a/packages/server/src/services/agent-config-service.ts b/packages/server/src/services/agent-config-service.ts
index 0cd87242..4e42257e 100644
--- a/packages/server/src/services/agent-config-service.ts
+++ b/packages/server/src/services/agent-config-service.ts
@@ -284,8 +284,9 @@ export class AgentConfigService {
/**
* Smart-merges the config up to the current defaults generation (core's applyKernelUpdate):
- * leaves still carrying a recorded generation's default follow the new defaults, user
- * customizations are kept and reported; the config is stamped with the new kernel version.
+ * a settings tab still carrying a recorded generation's default follows the new defaults,
+ * a tab the user changed is kept whole and reported; the config is stamped with the new
+ * kernel version.
* The destructive full-refresh alternative stays resetConfig.
*/
async kernelUpdate(projectId: string, agentId: string): Promise<AgentKernelUpdateResponse> {
diff --git a/packages/server/test/agent-kernel-update.test.ts b/packages/server/test/agent-kernel-update.test.ts
index 17f0bce7..941b1373 100644
--- a/packages/server/test/agent-kernel-update.test.ts
+++ b/packages/server/test/agent-kernel-update.test.ts
@@ -96,9 +96,10 @@ describe("POST agent config kernel-update", () => {
expect(res.status).toBe(200);
const body = (await res.json()) as AgentKernelUpdateResponse;
expect(body.kernelVersion).toBe(KERNEL_VERSION);
- expect(body.advanced).toContain("system_prompt");
- expect(body.advanced).toContain("vault.prompt");
- expect(body.kept).toEqual(["memory.prompt"]);
+ // Tab-wise: the prompt tab hash-matches the pre-toggles default and advances, the three
+ // missing sections are materialized, and the edited memory tab is kept whole.
+ expect(body.advanced).toEqual(["prompt", "skills", "vault", "schedules"]);
+ expect(body.kept).toEqual(["memory"]);
// Persisted: the template advanced, the customization survived, the stamp is current.
const after = (await (await alice.get(configUrl())).json()) as AgentConfigResponse;
diff --git a/packages/web/src/features/agents/agent-settings-page.tsx b/packages/web/src/features/agents/agent-settings-page.tsx
index ebb0f86e..76dfb479 100644
--- a/packages/web/src/features/agents/agent-settings-page.tsx
+++ b/packages/web/src/features/agents/agent-settings-page.tsx
@@ -40,7 +40,7 @@ import { Skeleton } from "../../components/ui/skeleton";
import { GlyphIcon } from "../../components/ui/glyph-icon";
import { SkillsTab } from "./skills-tab";
import { MemoryTab } from "./memory-tab";
-import { kernelFieldLabel } from "./kernel-labels";
+import { kernelTabLabel } from "./kernel-labels";
import { VaultTab } from "./vault-tab";
import { SchedulesTab } from "./schedules-tab";
import { McpServersSection } from "./mcp-servers-section";
@@ -551,7 +551,7 @@ function OverviewTab({
{kernelResult !== null && kernelResult.kept.length > 0 && (
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
{S.agent.kernelUpdateKeptIntro}
- {kernelResult.kept.map(kernelFieldLabel).join(S.agent.kernelListSeparator)}
+ {kernelResult.kept.map(kernelTabLabel).join(S.agent.kernelListSeparator)}
</p>
)}
</section>
diff --git a/packages/web/src/features/agents/kernel-labels.ts b/packages/web/src/features/agents/kernel-labels.ts
index af4ec6d0..d22acbb9 100644
--- a/packages/web/src/features/agents/kernel-labels.ts
+++ b/packages/web/src/features/agents/kernel-labels.ts
@@ -1,18 +1,21 @@
/**
- * Display names for kernel merge leaves (the dotted config paths a kernel update reports in
- * `advanced` / `kept`): fixed paths map through the dictionary, `tools.builtin.<name>`
- * renders per tool, and unknown paths (a future default the dictionary does not know yet)
- * fall back to the raw path — never hidden, never crashing.
+ * Display names for the settings tabs a kernel update reports in `advanced` / `kept`: a known
+ * tab key renders as that tab's own label, and an unknown key (a tab a newer server manages
+ * and this build does not know) falls back to the raw key — never hidden, never crashing.
+ *
+ * Built per call rather than at module scope: `S` is swapped on a language change.
*/
import { S } from "../../lib/strings";
-const TOOL_PATH_PREFIX = "tools.builtin.";
-
-export function kernelFieldLabel(path: string): string {
- const fixed = S.agent.kernelFields[path];
- if (fixed !== undefined) return fixed;
- if (path.startsWith(TOOL_PATH_PREFIX) && path.length > TOOL_PATH_PREFIX.length) {
- return S.agent.kernelFieldTool(path.slice(TOOL_PATH_PREFIX.length));
- }
- return path;
+export function kernelTabLabel(tab: string): string {
+ const labels: Record<string, string> = {
+ prompt: S.agent.tabPrompt,
+ runtime: S.agent.tabRuntime,
+ tools: S.agent.tabTools,
+ skills: S.agent.tabSkills,
+ memory: S.agent.tabMemory,
+ vault: S.agent.tabVault,
+ schedules: S.agent.tabSchedules,
+ };
+ return labels[tab] ?? tab;
}
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 6a492a60..acd79246 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -581,34 +581,13 @@ export const en: Strings = {
kernelLatest: "latest",
kernelUpdateAction: "Update kernel",
kernelUpdateConfirmBody:
- "Fields you have not customized will be updated to the current built-in defaults; customized fields stay unchanged and are listed in the result. Name, description, the State version and MCP servers are unaffected. Continue?",
+ "Settings tabs you have not customized will be updated to the current built-in defaults; a tab you have edited stays unchanged in full and is listed in the result. Name, description, the State version and MCP servers are unaffected. Continue?",
kernelUpdateDone: (version: string, advanced: number): string =>
advanced > 0
- ? `Kernel updated to ${version}; ${advanced} field(s) now follow the new defaults`
- : `Kernel updated to ${version}; every field was already current or kept as customized`,
- kernelUpdateKeptIntro: "Kept because customized:",
+ ? `Kernel updated to ${version}; ${advanced} tab(s) now follow the new defaults`
+ : `Kernel updated to ${version}; every tab was already current or kept as customized`,
+ kernelUpdateKeptIntro: "Kept whole because customized:",
kernelListSeparator: ", ",
- kernelFieldTool: (name: string): string => `tool ${name}`,
- kernelFields: {
- system_prompt: "system prompt template",
- max_turns: "max turns per task",
- "model.max_tokens": "model max output tokens",
- "model.thinking_level": "thinking level",
- "model.timeoutMs": "request timeout",
- "compaction.max_context_length": "compaction context threshold",
- "compaction.max_session_turns": "compaction session-turn threshold",
- "compaction.mode": "compaction mode",
- "compaction.prompt": "compaction prompt",
- "memory.enabled": "memory switch",
- "memory.prompt": "memory prompt",
- "memory.workspace_prompt": "workspace memory prompt",
- "vault.enabled": "Vault section switch",
- "vault.prompt": "Vault prompt",
- "skills.enabled": "Skills section switch",
- "skills.prompt": "Skills prompt",
- "schedules.enabled": "Schedules section switch",
- "schedules.prompt": "Schedules prompt",
- } as Record<string, string>,
},
models: {
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index cc514e18..afb62cca 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -546,36 +546,13 @@ export const zh = {
kernelLatest: "最新",
kernelUpdateAction: "更新内核",
kernelUpdateConfirmBody:
- "将把未自定义的字段更新为当前内置默认值;自定义过的字段保持不变并在结果中列出。名称、描述、版本号与 MCP Server 不受影响。确认继续?",
+ "将把未自定义的设置页更新为当前内置默认值;改动过的设置页整页保持不变,并在结果中列出。名称、描述、版本号与 MCP Server 不受影响。确认继续?",
kernelUpdateDone: (version: string, advanced: number): string =>
advanced > 0
- ? `内核已更新至 ${version},${advanced} 个字段跟进新默认`
- : `内核已更新至 ${version},字段均已是当前默认或保持自定义`,
- kernelUpdateKeptIntro: "以下字段因自定义被保留:",
+ ? `内核已更新至 ${version},${advanced} 个设置页跟进新默认`
+ : `内核已更新至 ${version},设置页均已是当前默认或保持自定义`,
+ kernelUpdateKeptIntro: "以下设置页因自定义被整体保留:",
kernelListSeparator: "、",
- /** Display name of a per-tool merge leaf (`tools.builtin.<name>`) in the kept/advanced lists. */
- kernelFieldTool: (name: string): string => `工具 ${name}`,
- /** Display names of the fixed kernel merge leaves (dotted config paths); unknown paths fall back to the raw path. */
- kernelFields: {
- system_prompt: "系统提示词模板",
- max_turns: "单任务最大轮数",
- "model.max_tokens": "模型最大输出 Token",
- "model.thinking_level": "思考力度",
- "model.timeoutMs": "请求超时",
- "compaction.max_context_length": "压缩上下文阈值",
- "compaction.max_session_turns": "压缩会话轮数阈值",
- "compaction.mode": "压缩模式",
- "compaction.prompt": "压缩提示词",
- "memory.enabled": "记忆开关",
- "memory.prompt": "记忆提示词",
- "memory.workspace_prompt": "工作区记忆提示词",
- "vault.enabled": "Vault 小节开关",
- "vault.prompt": "Vault 提示词",
- "skills.enabled": "技能小节开关",
- "skills.prompt": "技能提示词",
- "schedules.enabled": "定时任务小节开关",
- "schedules.prompt": "定时任务提示词",
- } as Record<string, string>,
},
models: {
diff --git a/packages/web/test/kernel-labels.test.ts b/packages/web/test/kernel-labels.test.ts
index 7fed682b..0821ac75 100644
--- a/packages/web/test/kernel-labels.test.ts
+++ b/packages/web/test/kernel-labels.test.ts
@@ -1,50 +1,43 @@
/**
- * kernelFieldLabel unit tests: the kernel merge report's path → display-name mapping — fixed
- * paths through the dictionary, per-tool paths rendered with the tool name, and unknown
- * (future) paths falling back to the raw path in both locales.
+ * kernelTabLabel unit tests: the kernel merge report's tab-key → display-name mapping — every
+ * managed tab renders as that tab's own label in both locales, and an unknown key (a tab a
+ * newer server manages) falls back to the raw key.
*/
import { afterEach, describe, expect, it } from "vitest";
-import { kernelFieldLabel } from "../src/features/agents/kernel-labels";
+import { kernelTabLabel } from "../src/features/agents/kernel-labels";
import { setActiveStrings, zh } from "../src/lib/strings";
import { en } from "../src/lib/strings-en";
+/** Every tab core's KERNEL_TABS manages, in the settings page's tab order. */
+const KERNEL_TABS = ["prompt", "runtime", "tools", "skills", "memory", "vault", "schedules"];
+
afterEach(() => setActiveStrings(zh));
-describe("kernelFieldLabel", () => {
- it("maps fixed paths through the active dictionary", () => {
+describe("kernelTabLabel", () => {
+ it("renders every managed tab as its own settings-page label, in both locales", () => {
for (const [locale, dict] of [
["zh", zh],
["en", en],
] as const) {
setActiveStrings(dict);
- for (const path of Object.keys(dict.agent.kernelFields)) {
- expect(kernelFieldLabel(path), `${locale} ${path}`).toBe(dict.agent.kernelFields[path]);
+ const expected: Record<string, string> = {
+ prompt: dict.agent.tabPrompt,
+ runtime: dict.agent.tabRuntime,
+ tools: dict.agent.tabTools,
+ skills: dict.agent.tabSkills,
+ memory: dict.agent.tabMemory,
+ vault: dict.agent.tabVault,
+ schedules: dict.agent.tabSchedules,
+ };
+ for (const tab of KERNEL_TABS) {
+ expect(kernelTabLabel(tab), `${locale} ${tab}`).toBe(expected[tab]);
+ // A label that fell through to the raw key would read as the bare tab key.
+ expect(kernelTabLabel(tab), `${locale} ${tab}`).not.toBe(tab);
}
}
});
- it("renders per-tool paths with the tool name", () => {
- for (const dict of [zh, en]) {
- setActiveStrings(dict);
- // The tool name is interpolated, not dropped, and the rest comes from the dictionary.
- expect(kernelFieldLabel("tools.builtin.read_file")).toBe(
- dict.agent.kernelFieldTool("read_file"),
- );
- expect(kernelFieldLabel("tools.builtin.read_file")).toContain("read_file");
- }
- });
-
- it("covers every fixed kernel merge leaf in both dictionaries (no raw-path fallbacks for known paths)", () => {
- // The dictionaries must agree on the covered paths — a path only one locale knows would
- // render raw in the other.
- expect(Object.keys(en.agent.kernelFields).sort()).toEqual(
- Object.keys(zh.agent.kernelFields).sort(),
- );
- });
-
- it("falls back to the raw path for unknown leaves (a future default the dictionary predates)", () => {
- expect(kernelFieldLabel("future.section.key")).toBe("future.section.key");
- // The bare prefix with no tool name is not a per-tool path either.
- expect(kernelFieldLabel("tools.builtin.")).toBe("tools.builtin.");
+ it("falls back to the raw key for an unknown tab (a newer server's)", () => {
+ expect(kernelTabLabel("future_tab")).toBe("future_tab");
});
});