fix(settings): use the host's @deepseek-ai/schemastery so volatile prefs apply
Every side-card switch was dead: settings.update returned OK and cordis.patch.yml was written, yet the running plugin never saw the new value and nothing reported an error. Root cause: the plugin declared Config with the plain npm `schemastery` (3.18.0), which has no volatile support. The host resolves plugin config via `runtime.Config['~standard'].validate()` — i.e. the plugin's OWN schemastery — so `meta.volatile` nodes were never wrapped in cosmokit volatile references. `cordis-plugin-loader`'s `_commitVolatile()` bails out as soon as `volatileEntries(fiber.config)` is empty, so every volatile-only edit was silently dropped: no in-place update, no plugin restart. Fix: import z from '@deepseek-ai/schemastery' (peer provided by the host at mount; pinned 3.18.4 as a devDependency for the dev tree), matching the repo's existing pnpm-workspace convention for @deepseek-ai/* peers. Verified: probe reports tabsIsVolatile=true and revision climbing 0->6 across six writes, each read-back matching the written value (previously the value was frozen and revision stuck at 1). Also in this change: - apes tab ids lose their colon (apes:tasks -> apesTasks, ...): the host's settings projection dropped map keys containing a colon. - sidebar prefs ns follows the profile entry id (`better-sidebar`). - subagent rows degrade to summary rows when the root catalog never hydrates. - docs/feedback-0.2.0-rc2-contract-gaps.md: four host contract gaps, gap 4 documenting the silent volatile-write drop above. Gates: typecheck 0, lint 0, build 0, test 131 files / 1385 passed.
This commit is contained in:
+58
-4
@@ -5,7 +5,7 @@
|
||||
* @module dsh-apes-sidebar/config
|
||||
*/
|
||||
|
||||
import z from 'schemastery'
|
||||
import z from '@deepseek-ai/schemastery'
|
||||
import {
|
||||
TERMINAL_FONT_SIZE_DEFAULT,
|
||||
TERMINAL_FONT_SIZE_MAX,
|
||||
@@ -28,8 +28,20 @@ export {
|
||||
type SidebarPrefs,
|
||||
} from './prefs-shared.ts'
|
||||
|
||||
/** Tunable sidebar host limits (every field optional; defaults fill in). */
|
||||
export interface SidebarConfig {
|
||||
/**
|
||||
* Tunable sidebar host limits (every field optional; defaults fill in).
|
||||
*
|
||||
* Since 0.2.0-rc.2 the loader auto-registers the plugin's `Config` schema
|
||||
* under ns = package name, and the settings service's `update()` only accepts
|
||||
* patches to fields marked `volatile`. The user-facing side-card preferences
|
||||
* (formerly the dead `PrefsSchema` export) are therefore MERGED into this
|
||||
* schema with `extra('volatile', true)` so the settings routes can persist
|
||||
* them. The deployment fields above (readLimit/shell/…) are deliberately
|
||||
* NON-volatile: they are set from `cordis.patch.yml` / profile config, not
|
||||
* from the user's settings page, and must not be writable through
|
||||
* `settings.update`.
|
||||
*/
|
||||
export interface SidebarConfig extends Partial<SidebarPrefs> {
|
||||
/** Read cap of one text file (bytes); larger files return truncated. */
|
||||
readLimit?: number
|
||||
/** Media route cap (bytes); larger binaries are refused. */
|
||||
@@ -60,8 +72,9 @@ export interface SidebarConfig {
|
||||
shellArgs?: string[]
|
||||
}
|
||||
|
||||
/** Schemastery schema for the plugin configuration. */
|
||||
/** Schemastery schema for the plugin configuration (deployment + user prefs). */
|
||||
export const Config: z<SidebarConfig> = z.object({
|
||||
// ── Deployment fields (NON-volatile; set from cordis.patch.yml / profile) ──
|
||||
readLimit: z.number().step(1).min(1).default(512 * 1024),
|
||||
mediaLimit: z.number().step(1).min(1).default(20 * 1024 * 1024),
|
||||
uploadLimit: z.number().step(1).min(1).default(128 * 1024 * 1024),
|
||||
@@ -70,6 +83,47 @@ export const Config: z<SidebarConfig> = z.object({
|
||||
reconnectGraceMs: z.number().step(1).min(0).default(30_000),
|
||||
shell: z.string().default(''),
|
||||
shellArgs: z.array(z.string()).default([]),
|
||||
// ── User-facing side-card preferences (volatile; writable via settings.update) ──
|
||||
// 0.2.0-rc.2: the settings service's `update()` only accepts patches to fields
|
||||
// whose schema node (or an ancestor) is marked `volatile`. Every user-editable
|
||||
// preference below is tagged `extra('volatile', true)` so the /sidebar/settings
|
||||
// routes can persist them. These were formerly the dead `PrefsSchema` export;
|
||||
// merging them into `Config` (the schema the loader actually registers) is what
|
||||
// makes the settings page switches stick instead of 400 → optimistic rollback.
|
||||
autoOpenSubagent: z.boolean().default(true).extra('volatile', true),
|
||||
autoOpenJobs: z.boolean().default(true).extra('volatile', true),
|
||||
agentTerminalTools: z.boolean().default(false).extra('volatile', true),
|
||||
agentOpenTools: z.boolean().default(false).extra('volatile', true),
|
||||
bottomPanelAutoTerminal: z.boolean().default(true).extra('volatile', true),
|
||||
terminalFontFamily: z.string().default('').extra('volatile', true),
|
||||
terminalFontSize: z.number().step(1).min(TERMINAL_FONT_SIZE_MIN).max(TERMINAL_FONT_SIZE_MAX).default(TERMINAL_FONT_SIZE_DEFAULT).extra('volatile', true),
|
||||
editorExplorer: z.boolean().default(false).extra('volatile', true),
|
||||
workspaceFence: z.boolean().default(true).extra('volatile', true),
|
||||
terminalShell: z.string().default('').extra('volatile', true),
|
||||
terminalShellArgs: z.string().default('').extra('volatile', true),
|
||||
titleBarScheme: z.union([z.const('auto'), z.const('web'), z.const('preset'), z.const('custom')]).extra('volatile', true),
|
||||
titleBarPresetId: z.string().extra('volatile', true),
|
||||
customCss: z.string().extra('volatile', true),
|
||||
titleBarCompat: z.boolean().default(false).extra('volatile', true),
|
||||
titleBarStripPx: z.number().step(1).min(TITLE_BAR_STRIP_MIN).max(TITLE_BAR_STRIP_MAX).default(TITLE_BAR_STRIP_DEFAULT).extra('volatile', true),
|
||||
htmlViewerNoSandbox: z.boolean().default(false).extra('volatile', true),
|
||||
htmlViewerDefaultUnsafe: z.boolean().default(false).extra('volatile', true),
|
||||
browserNoSandbox: z.boolean().default(false).extra('volatile', true),
|
||||
browserInterceptLinks: z.boolean().default(true).extra('volatile', true),
|
||||
browserInterceptHttp: z.boolean().default(true).extra('volatile', true),
|
||||
browserInterceptHttps: z.boolean().default(false).extra('volatile', true),
|
||||
browserAllowedLoopback: z.string().default('').extra('volatile', true),
|
||||
// Per-feature enable switches are OPEN maps (any tab/viewer id, built-in or
|
||||
// external): an absent key means enabled, so old documents resolve to {}
|
||||
// (everything on) with no migration. Non-boolean values fail validation.
|
||||
// The whole dict node is volatile, so any key beneath it is writable.
|
||||
tabsEnabled: z.dict(z.boolean()).default({}).extra('volatile', true),
|
||||
viewersEnabled: z.dict(z.boolean()).default({}).extra('volatile', true),
|
||||
// Plugin-owned settings blobs (v0.12.0+) are an OPEN nested map: any
|
||||
// descriptor id may carry any JSON-serializable values. This is the
|
||||
// "settings seam" opening — without it the seam would drop third-party
|
||||
// keys as unknown schema fields.
|
||||
pluginSettings: z.dict(z.dict(z.any())).default({}).extra('volatile', true),
|
||||
})
|
||||
|
||||
/** Fully defaulted sidebar host settings. */
|
||||
|
||||
Reference in New Issue
Block a user