diff --git a/client/index.js b/client/index.js
index 400b6da..ea39855 100644
--- a/client/index.js
+++ b/client/index.js
@@ -119,6 +119,11 @@ window.__ModuleLoader__.load({
return fallback === undefined ? statusText(result.status) : fallback
}
+ // ---- settings-ui bundle (configuration surface) ----
+ // pickSettings + the SettingsCard draft/save/login/test/flush logic and the
+ // 连接与上报 tab belong to the settings-ui bundle; the skills/mcp tabs
+ // belong to their own bundles. The card only talks to the public HTTP API —
+ // it never touches SettingsStore/CloudClient/Reporter/SkillSync directly.
function pickSettings(settings) {
var source = settings === undefined || settings === null ? {} : settings
return {
@@ -130,6 +135,9 @@ window.__ModuleLoader__.load({
requestTimeoutMs: String(source.requestTimeoutMs === undefined ? 8000 : source.requestTimeoutMs),
defaultK: String(source.defaultK === undefined ? 10 : source.defaultK),
summaryEnabled: source.summaryEnabled === true,
+ activityEnabled: source.activityEnabled === true,
+ memoryEnabled: source.memoryEnabled === true,
+ skillsDir: String(source.skillsDir === undefined ? '' : source.skillsDir),
skillsSyncEnabled: source.skillsSyncEnabled === true,
}
}
@@ -1704,6 +1712,10 @@ window.__ModuleLoader__.load({
requestTimeoutMs: Number(draft.requestTimeoutMs),
defaultK: Number(draft.defaultK),
summaryEnabled: draft.summaryEnabled,
+ activityEnabled: draft.activityEnabled,
+ memoryEnabled: draft.memoryEnabled,
+ skillsSyncEnabled: draft.skillsSyncEnabled,
+ skillsDir: String(draft.skillsDir).trim(),
}
if (tokenDraft.activity.trim() !== '') payload.activityToken = tokenDraft.activity.trim()
if (tokenDraft.memory.trim() !== '') payload.memoryToken = tokenDraft.memory.trim()
@@ -2451,15 +2463,7 @@ window.__ModuleLoader__.load({
patchDraft({ requestTimeoutMs: value })
},
}),
- h(Field, {
- label: '单次搜索返回上限',
- type: 'number',
- value: draft.defaultK,
- hint: '只限制一次搜索返回多少条,不限制可搜索的历史范围。默认 10。',
- onChange: function (value) {
- patchDraft({ defaultK: value })
- },
- }),
+
),
h(
'div',
@@ -2487,6 +2491,19 @@ window.__ModuleLoader__.load({
}),
h('label', { htmlFor: 'dsh-brain-summary', style: styles.label }, '启用自动摘要(会把该轮对话文本上传为待确认提案;与上面的元数据上报是两件事)'),
),
+ h(
+ 'div',
+ { style: styles.checkboxRow },
+ h('input', {
+ type: 'checkbox',
+ checked: draft.activityEnabled,
+ id: 'dsh-brain-activity',
+ onChange: function (event) {
+ patchDraft({ activityEnabled: event.target.checked })
+ },
+ }),
+ h('label', { htmlFor: 'dsh-brain-activity', style: styles.label }, '启用活动上报(细粒度开关;未显式设置时跟随总开关)'),
+ ),
)
: h(
'div',
@@ -2495,6 +2512,72 @@ window.__ModuleLoader__.load({
),
),
+ h(
+ Section,
+ {
+ title: '记忆配置',
+ hint: '只影响记忆工具:开关未显式设置时跟随总开关,检索上限只限制单次返回条数。',
+ },
+
+ h('div', { style: styles.grid },
+ h(Field, {
+ label: '单次搜索返回上限(defaultK)',
+ type: 'number',
+ value: draft.defaultK,
+ hint: '只限制一次搜索返回多少条,不限制可搜索的历史范围。默认 10。',
+ onChange: function (value) {
+ patchDraft({ defaultK: value })
+ },
+ }),
+ ),
+ h('div', { style: styles.checkboxRow },
+ h('input', {
+ type: 'checkbox',
+ checked: draft.memoryEnabled,
+ id: 'dsh-brain-memory-enabled',
+ onChange: function (event) {
+ patchDraft({ memoryEnabled: event.target.checked })
+ },
+ }),
+ h('label', { htmlFor: 'dsh-brain-memory-enabled', style: styles.label }, '启用记忆工具(memory_search / memory_read / memory_add)'),
+ ),
+ ),
+
+ features.skillsSync === false
+ ? h('div', null)
+ : h(
+ 'div',
+ null,
+ h(
+ Section,
+ {
+ title: 'Skill 同步',
+ hint: '同步由后台定时执行,这里只保存开关与目录;目录留空使用默认位置。',
+ },
+
+ h(Field, {
+ label: '技能目录(skillsDir,可选)',
+ value: draft.skillsDir,
+ placeholder: '默认 $DSH_HOME/skills',
+ hint: '保存后下一次同步生效,无需重启。',
+ onChange: function (value) {
+ patchDraft({ skillsDir: value })
+ },
+ }),
+ h('div', { style: styles.checkboxRow },
+ h('input', {
+ type: 'checkbox',
+ checked: draft.skillsSyncEnabled,
+ id: 'dsh-brain-skills-sync',
+ onChange: function (event) {
+ patchDraft({ skillsSyncEnabled: event.target.checked })
+ },
+ }),
+ h('label', { htmlFor: 'dsh-brain-skills-sync', style: styles.label }, '启用云端技能同步(下载云端技能库、上传本机新技能)'),
+ ),
+ ),
+ ),
+
h(
Section,
{
diff --git a/lib/routes.js b/lib/routes.js
index a5d6c81..deb9cd6 100644
--- a/lib/routes.js
+++ b/lib/routes.js
@@ -1,4 +1,4 @@
-import { renderConfigPage } from "./page.js";
+import { createSettingsUiRoutes } from "./settings-ui/routes.js";
import { brainStatus, migrateLegacyFiles } from "./brain-migration.js";
import { mcpCapability } from "./mcp.js";
import { fail, json, readBody, sameOrigin } from "./http.js";
@@ -71,6 +71,8 @@ function statusPayload(deps) {
defaultK: view.defaultK,
summaryEnabled: view.summaryEnabled,
summaryMaxChars: view.summaryMaxChars,
+ activityEnabled: view.activityEnabled,
+ memoryEnabled: view.memoryEnabled,
skillsSyncEnabled: view.skillsSyncEnabled,
skillsDir: view.skillsDir,
};
@@ -85,23 +87,6 @@ function statusPayload(deps) {
...(deps.skills === undefined ? {} : { skills: deps.skills() }),
};
}
-/** Serve the configuration page. */
-function servePage(deps, req, res) {
- if (req.method !== 'GET' && req.method !== 'HEAD') {
- fail(res, 405, 'method-not-allowed', true);
- return;
- }
- const html = renderConfigPage({ version: deps.version, settingsPath: deps.store.path });
- res.writeHead(200, {
- 'content-type': 'text/html; charset=utf-8',
- 'cache-control': 'no-store',
- 'content-length': Buffer.byteLength(html),
- });
- if (req.method === 'HEAD')
- res.end();
- else
- res.end(html);
-}
/** `GET /dsh-brain/status`. */
function serveStatus(deps, req, res) {
if (req.method !== 'GET') {
@@ -183,17 +168,13 @@ export function createLegacyRoutes(deps) {
* Build the exact-route table registered with the host web server.
*
* Composition (m00001 §4): the root owns `/status` and `/capabilities`; the
- * cloud-sync bundle returns login/test/flush/sync; the skill bundle returns
- * skills/market/clients. No path shadows another, so the grouped registration
- * order is safe.
+ * settings-ui bundle returns the page; the cloud-sync bundle returns
+ * login/test/flush/sync; the skill bundle returns skills/market/clients. No
+ * path shadows another, so the grouped registration order is safe.
*/
export function createRoutes(deps) {
return [
- {
- kind: 'exact',
- path: ROUTES.page,
- handler: (req, res) => servePage(deps, req, res),
- },
+ ...createSettingsUiRoutes({ version: deps.version, store: deps.store }),
{
kind: 'exact',
path: ROUTES.status,
diff --git a/lib/page.js b/lib/settings-ui/page.js
similarity index 89%
rename from lib/page.js
rename to lib/settings-ui/page.js
index 103f241..a49e0be 100644
--- a/lib/page.js
+++ b/lib/settings-ui/page.js
@@ -1,11 +1,16 @@
/**
- * Standalone configuration page.
+ * Settings UI bundle — standalone configuration page.
*
* This profile runs with the native settings surface disabled
* (`ui-settings` is turned off in `cordis.patch.yml`), so the plugin ships its
* own HTML page at `/dsh-brain`. It is deliberately dependency-free: no
* bundler assets, no CDN, no fonts — one file the host web server can emit.
*
+ * The page is a pure view: every control reads and writes through the public
+ * HTTP API (`GET /status`, `PUT /config`, `POST login/test/flush`) and never
+ * touches SettingsStore, CloudClient, Reporter or SkillSync directly, so
+ * removing the settings-ui bundle only loses the page.
+ *
* The page renders tokens as masked values only; the plaintext never leaves
* `$DSH_HOME/dsh-brain.json`.
*/
@@ -229,10 +234,6 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
-
-
-
-
+
@@ -252,6 +258,43 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
+
+ 🧠
记忆配置
memory_* 工具
+
+
+
+
+
memory_search 未显式指定 k 时的返回上限(1–100)。
+
+
+
+
+
+
+
+
+ 🔄
Skill 同步
后台定时双向同步
+
+
+
+
+
留空使用默认目录;保存后下一次同步生效,无需重启。
+
+
+
+
+
+ 同步动作由后台定时执行(能力缺失时本卡片自动隐藏);这里只保存开关与目录。
+
+
🔑
账号登录
用账号一次性换取令牌,密码不保存
@@ -366,8 +409,14 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
el('requestTimeoutMs').value = settings.requestTimeoutMs || '';
el('defaultK').value = settings.defaultK || '';
el('enabled').checked = settings.enabled === true;
+ el('activityEnabled').checked = settings.activityEnabled === true;
el('summaryEnabled').checked = settings.summaryEnabled === true;
el('summaryMaxChars').value = settings.summaryMaxChars || '';
+ el('memoryEnabled').checked = settings.memoryEnabled === true;
+ el('skillsSyncEnabled').checked = settings.skillsSyncEnabled === true;
+ el('skillsDir').value = settings.skillsDir || '';
+ var features = (view.capabilities && view.capabilities.features) || {};
+ el('skillsCard').style.display = features.skillsSync === false ? 'none' : '';
el('activityTokenHint').innerHTML = '用于 POST /activity/turn。当前 ' +
(tokens.activity && tokens.activity.configured
@@ -441,8 +490,12 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
requestTimeoutMs: Number(el('requestTimeoutMs').value),
defaultK: Number(el('defaultK').value),
enabled: el('enabled').checked,
+ activityEnabled: el('activityEnabled').checked,
summaryEnabled: el('summaryEnabled').checked,
- summaryMaxChars: Number(el('summaryMaxChars').value)
+ summaryMaxChars: Number(el('summaryMaxChars').value),
+ memoryEnabled: el('memoryEnabled').checked,
+ skillsSyncEnabled: el('skillsSyncEnabled').checked,
+ skillsDir: el('skillsDir').value.trim()
};
var activity = el('activityToken').value.trim();
var memory = el('memoryToken').value.trim();
diff --git a/lib/settings-ui/routes.js b/lib/settings-ui/routes.js
new file mode 100644
index 0000000..1498b64
--- /dev/null
+++ b/lib/settings-ui/routes.js
@@ -0,0 +1,31 @@
+import { fail } from "../http.js";
+import { renderConfigPage } from "./page.js";
+/** Must match `ROUTES.page` in `src/routes.ts`. */
+const PAGE_PATH = '/dsh-brain';
+/** Serve the configuration page. */
+function servePage(deps, req, res) {
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
+ fail(res, 405, 'method-not-allowed', true);
+ return;
+ }
+ const html = renderConfigPage({ version: deps.version, settingsPath: deps.store.path });
+ res.writeHead(200, {
+ 'content-type': 'text/html; charset=utf-8',
+ 'cache-control': 'no-store',
+ 'content-length': Buffer.byteLength(html),
+ });
+ if (req.method === 'HEAD')
+ res.end();
+ else
+ res.end(html);
+}
+/** The exact route the root aggregator registers for the settings page. */
+export function createSettingsUiRoutes(deps) {
+ return [
+ {
+ kind: 'exact',
+ path: PAGE_PATH,
+ handler: (req, res) => servePage(deps, req, res),
+ },
+ ];
+}
diff --git a/lib/store.js b/lib/store.js
index 0160bf8..14a8ad1 100644
--- a/lib/store.js
+++ b/lib/store.js
@@ -84,10 +84,10 @@ function parseState(raw) {
const state = { version: 1 };
if (typeof source.enabled === 'boolean')
state.enabled = source.enabled;
- if (typeof source.activityEnabled === 'boolean')
- state.activityEnabled = source.activityEnabled;
- if (typeof source.memoryEnabled === 'boolean')
- state.memoryEnabled = source.memoryEnabled;
+ if (typeof source.skillsSyncEnabled === 'boolean')
+ state.skillsSyncEnabled = source.skillsSyncEnabled;
+ if (typeof source.skillsDir === 'string')
+ state.skillsDir = source.skillsDir;
const baseUrl = normalizeBaseUrl(source.baseUrl);
if (baseUrl !== undefined)
state.baseUrl = baseUrl;
@@ -188,6 +188,10 @@ export class SettingsStore {
resolved.summaryEnabled = this.state.summaryEnabled;
if (this.state.summaryMaxChars !== undefined)
resolved.summaryMaxChars = this.state.summaryMaxChars;
+ if (this.state.skillsSyncEnabled !== undefined)
+ resolved.skillsSyncEnabled = this.state.skillsSyncEnabled;
+ if (this.state.skillsDir !== undefined)
+ resolved.skillsDir = this.state.skillsDir;
// The split gates inherit `enabled` unless the config or the sidecar set
// them explicitly, so an old configuration keeps its exact behaviour.
if (this.state.activityEnabled === undefined && this.configExplicit.activityEnabled === undefined) {
@@ -302,6 +306,19 @@ export class SettingsStore {
return { ok: false, error: 'summaryMaxChars must be a number' };
next.summaryMaxChars = summaryMaxChars;
}
+ if (patch.skillsSyncEnabled !== undefined) {
+ if (typeof patch.skillsSyncEnabled !== 'boolean')
+ return { ok: false, error: 'skillsSyncEnabled must be a boolean' };
+ next.skillsSyncEnabled = patch.skillsSyncEnabled;
+ }
+ if (patch.skillsDir !== undefined) {
+ if (typeof patch.skillsDir !== 'string')
+ return { ok: false, error: 'skillsDir must be a string' };
+ const skillsDir = patch.skillsDir.trim();
+ if (skillsDir.length > 512)
+ return { ok: false, error: 'skillsDir too long' };
+ next.skillsDir = skillsDir;
+ }
const summaryToken = cleanString(patch.summaryToken);
if (summaryToken !== undefined) {
if (!summaryToken.startsWith('cmt_'))
diff --git a/src/routes.ts b/src/routes.ts
index ad7f3d4..db6581e 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -23,7 +23,7 @@ import type { IncomingMessage, ServerResponse } from 'node:http'
import type { CloudClient } from './api.ts'
import type { SettingsStore, SettingsView, TokenView } from './store.ts'
import type { Reporter } from './reporter.ts'
-import { renderConfigPage } from './page.ts'
+import { createSettingsUiRoutes } from './settings-ui/routes.ts'
import type { CloudMemoryWebRoute } from './context-types.ts'
import type { SkillSync, SkillSyncStats } from './skill-sync.ts'
import type { SkillAdmin } from './skill-admin.ts'
@@ -154,6 +154,8 @@ function statusPayload(deps: RouteDeps): Record {
defaultK: view.defaultK,
summaryEnabled: view.summaryEnabled,
summaryMaxChars: view.summaryMaxChars,
+ activityEnabled: view.activityEnabled,
+ memoryEnabled: view.memoryEnabled,
skillsSyncEnabled: view.skillsSyncEnabled,
skillsDir: view.skillsDir,
}
@@ -169,21 +171,6 @@ function statusPayload(deps: RouteDeps): Record {
}
}
-/** Serve the configuration page. */
-function servePage(deps: RouteDeps, req: IncomingMessage, res: ServerResponse): void {
- if (req.method !== 'GET' && req.method !== 'HEAD') {
- fail(res, 405, 'method-not-allowed', true)
- return
- }
- const html = renderConfigPage({ version: deps.version, settingsPath: deps.store.path })
- res.writeHead(200, {
- 'content-type': 'text/html; charset=utf-8',
- 'cache-control': 'no-store',
- 'content-length': Buffer.byteLength(html),
- })
- if (req.method === 'HEAD') res.end()
- else res.end(html)
-}
/** `GET /dsh-brain/status`. */
function serveStatus(deps: RouteDeps, req: IncomingMessage, res: ServerResponse): void {
@@ -262,17 +249,13 @@ export function createLegacyRoutes(deps: RouteDeps): CloudMemoryWebRoute[] {
* Build the exact-route table registered with the host web server.
*
* Composition (m00001 §4): the root owns `/status` and `/capabilities`; the
- * cloud-sync bundle returns login/test/flush/sync; the skill bundle returns
- * skills/market/clients. No path shadows another, so the grouped registration
- * order is safe.
+ * settings-ui bundle returns the page; the cloud-sync bundle returns
+ * login/test/flush/sync; the skill bundle returns skills/market/clients. No
+ * path shadows another, so the grouped registration order is safe.
*/
export function createRoutes(deps: RouteDeps): CloudMemoryWebRoute[] {
return [
- {
- kind: 'exact',
- path: ROUTES.page,
- handler: (req, res) => servePage(deps, req, res),
- },
+ ...createSettingsUiRoutes({ version: deps.version, store: deps.store }),
{
kind: 'exact',
path: ROUTES.status,
diff --git a/src/page.ts b/src/settings-ui/page.ts
similarity index 89%
rename from src/page.ts
rename to src/settings-ui/page.ts
index 9ab7897..b93405e 100644
--- a/src/page.ts
+++ b/src/settings-ui/page.ts
@@ -1,11 +1,16 @@
/**
- * Standalone configuration page.
+ * Settings UI bundle — standalone configuration page.
*
* This profile runs with the native settings surface disabled
* (`ui-settings` is turned off in `cordis.patch.yml`), so the plugin ships its
* own HTML page at `/dsh-brain`. It is deliberately dependency-free: no
* bundler assets, no CDN, no fonts — one file the host web server can emit.
*
+ * The page is a pure view: every control reads and writes through the public
+ * HTTP API (`GET /status`, `PUT /config`, `POST login/test/flush`) and never
+ * touches SettingsStore, CloudClient, Reporter or SkillSync directly, so
+ * removing the settings-ui bundle only loses the page.
+ *
* The page renders tokens as masked values only; the plaintext never leaves
* `$DSH_HOME/dsh-brain.json`.
*/
@@ -231,10 +236,6 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
-
-
-
-
+
@@ -254,6 +260,43 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
+
+ 🧠
记忆配置
memory_* 工具
+
+
+
+
+
memory_search 未显式指定 k 时的返回上限(1–100)。
+
+
+
+
+
+
+
+
+ 🔄
Skill 同步
后台定时双向同步
+
+
+
+
+
留空使用默认目录;保存后下一次同步生效,无需重启。
+
+
+
+
+
+ 同步动作由后台定时执行(能力缺失时本卡片自动隐藏);这里只保存开关与目录。
+
+
🔑
账号登录
用账号一次性换取令牌,密码不保存
@@ -368,8 +411,14 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
el('requestTimeoutMs').value = settings.requestTimeoutMs || '';
el('defaultK').value = settings.defaultK || '';
el('enabled').checked = settings.enabled === true;
+ el('activityEnabled').checked = settings.activityEnabled === true;
el('summaryEnabled').checked = settings.summaryEnabled === true;
el('summaryMaxChars').value = settings.summaryMaxChars || '';
+ el('memoryEnabled').checked = settings.memoryEnabled === true;
+ el('skillsSyncEnabled').checked = settings.skillsSyncEnabled === true;
+ el('skillsDir').value = settings.skillsDir || '';
+ var features = (view.capabilities && view.capabilities.features) || {};
+ el('skillsCard').style.display = features.skillsSync === false ? 'none' : '';
el('activityTokenHint').innerHTML = '用于 POST /activity/turn。当前 ' +
(tokens.activity && tokens.activity.configured
@@ -443,8 +492,12 @@ tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent)
requestTimeoutMs: Number(el('requestTimeoutMs').value),
defaultK: Number(el('defaultK').value),
enabled: el('enabled').checked,
+ activityEnabled: el('activityEnabled').checked,
summaryEnabled: el('summaryEnabled').checked,
- summaryMaxChars: Number(el('summaryMaxChars').value)
+ summaryMaxChars: Number(el('summaryMaxChars').value),
+ memoryEnabled: el('memoryEnabled').checked,
+ skillsSyncEnabled: el('skillsSyncEnabled').checked,
+ skillsDir: el('skillsDir').value.trim()
};
var activity = el('activityToken').value.trim();
var memory = el('memoryToken').value.trim();
diff --git a/src/settings-ui/routes.ts b/src/settings-ui/routes.ts
new file mode 100644
index 0000000..5fc601b
--- /dev/null
+++ b/src/settings-ui/routes.ts
@@ -0,0 +1,54 @@
+/**
+ * Settings UI bundle — page route.
+ *
+ * The bundle owns the two configuration views: the standalone HTML page and
+ * the 连接与上报 tab in the client card. It owns no business logic: the page
+ * only calls the public HTTP API, so removing this bundle loses the
+ * configuration page while memory tools, activity reporting and skill sync
+ * keep working.
+ *
+ * The path is kept in sync with `ROUTES.page` in `src/routes.ts` (the root
+ * owns the route table); the legacy `/cloud-memory` alias is derived from the
+ * root route list, so it follows automatically.
+ */
+import type { IncomingMessage, ServerResponse } from 'node:http'
+import type { SettingsStore } from '../store.ts'
+import { fail } from '../http.ts'
+import type { CloudMemoryWebRoute } from '../context-types.ts'
+import { renderConfigPage } from './page.ts'
+
+/** Must match `ROUTES.page` in `src/routes.ts`. */
+const PAGE_PATH = '/dsh-brain'
+
+/** Everything the page route needs from the plugin core. */
+export interface SettingsUiRouteDeps {
+ version: string
+ store: SettingsStore
+}
+
+/** Serve the configuration page. */
+function servePage(deps: SettingsUiRouteDeps, req: IncomingMessage, res: ServerResponse): void {
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
+ fail(res, 405, 'method-not-allowed', true)
+ return
+ }
+ const html = renderConfigPage({ version: deps.version, settingsPath: deps.store.path })
+ res.writeHead(200, {
+ 'content-type': 'text/html; charset=utf-8',
+ 'cache-control': 'no-store',
+ 'content-length': Buffer.byteLength(html),
+ })
+ if (req.method === 'HEAD') res.end()
+ else res.end(html)
+}
+
+/** The exact route the root aggregator registers for the settings page. */
+export function createSettingsUiRoutes(deps: SettingsUiRouteDeps): CloudMemoryWebRoute[] {
+ return [
+ {
+ kind: 'exact',
+ path: PAGE_PATH,
+ handler: (req, res) => servePage(deps, req, res),
+ },
+ ]
+}
diff --git a/src/store.ts b/src/store.ts
index fd7b28e..e86bb25 100644
--- a/src/store.ts
+++ b/src/store.ts
@@ -31,6 +31,8 @@ export interface PersistedState {
summaryEnabled?: boolean
summaryMaxChars?: number
summaryToken?: string
+ skillsSyncEnabled?: boolean
+ skillsDir?: string
}
/** Masked token view handed to the browser. */
@@ -119,8 +121,8 @@ function parseState(raw: string): PersistedState {
const source = value as Record
const state: PersistedState = { version: 1 }
if (typeof source.enabled === 'boolean') state.enabled = source.enabled
- if (typeof source.activityEnabled === 'boolean') state.activityEnabled = source.activityEnabled
- if (typeof source.memoryEnabled === 'boolean') state.memoryEnabled = source.memoryEnabled
+ if (typeof source.skillsSyncEnabled === 'boolean') state.skillsSyncEnabled = source.skillsSyncEnabled
+ if (typeof source.skillsDir === 'string') state.skillsDir = source.skillsDir
const baseUrl = normalizeBaseUrl(source.baseUrl)
if (baseUrl !== undefined) state.baseUrl = baseUrl
const clientId = cleanString(source.clientId)
@@ -205,6 +207,8 @@ export class SettingsStore {
if (this.state.defaultK !== undefined) resolved.defaultK = this.state.defaultK
if (this.state.summaryEnabled !== undefined) resolved.summaryEnabled = this.state.summaryEnabled
if (this.state.summaryMaxChars !== undefined) resolved.summaryMaxChars = this.state.summaryMaxChars
+ if (this.state.skillsSyncEnabled !== undefined) resolved.skillsSyncEnabled = this.state.skillsSyncEnabled
+ if (this.state.skillsDir !== undefined) resolved.skillsDir = this.state.skillsDir
// The split gates inherit `enabled` unless the config or the sidecar set
// them explicitly, so an old configuration keeps its exact behaviour.
if (this.state.activityEnabled === undefined && this.configExplicit.activityEnabled === undefined) {
@@ -313,6 +317,16 @@ export class SettingsStore {
if (summaryMaxChars === undefined) return { ok: false, error: 'summaryMaxChars must be a number' }
next.summaryMaxChars = summaryMaxChars
}
+ if (patch.skillsSyncEnabled !== undefined) {
+ if (typeof patch.skillsSyncEnabled !== 'boolean') return { ok: false, error: 'skillsSyncEnabled must be a boolean' }
+ next.skillsSyncEnabled = patch.skillsSyncEnabled
+ }
+ if (patch.skillsDir !== undefined) {
+ if (typeof patch.skillsDir !== 'string') return { ok: false, error: 'skillsDir must be a string' }
+ const skillsDir = patch.skillsDir.trim()
+ if (skillsDir.length > 512) return { ok: false, error: 'skillsDir too long' }
+ next.skillsDir = skillsDir
+ }
const summaryToken = cleanString(patch.summaryToken)
if (summaryToken !== undefined) {
if (!summaryToken.startsWith('cmt_')) return { ok: false, error: 'summary token must start with cmt_' }