更新 src/routes.ts

This commit is contained in:
QQ 2026-11-11 10:51:51 +08:00
parent a69a68c972
commit df19edd19e
1 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import type { SettingsView, SettingsStore, TokenView } from './store.ts'
import type { Reporter } from './reporter.ts' import type { Reporter } from './reporter.ts'
import { renderConfigPage } from './page.ts' import { renderConfigPage } from './page.ts'
import type { CloudMemoryWebRoute } from './context-types.ts' import type { CloudMemoryWebRoute } from './context-types.ts'
import type { SkillSyncStats } from './skill-sync.ts'
/** Route constants — kept in one place so the client half can reuse them. */ /** Route constants — kept in one place so the client half can reuse them. */
export const ROUTES = { export const ROUTES = {
@ -40,6 +41,8 @@ export interface RouteDeps {
store: SettingsStore store: SettingsStore
reporter: Reporter reporter: Reporter
client: () => CloudClient client: () => CloudClient
/** Latest skill-sync stats, when the engine is wired in. */
skills?: () => SkillSyncStats
} }
/** Collect a request body as UTF-8 text. */ /** Collect a request body as UTF-8 text. */
@ -102,8 +105,13 @@ function statusPayload(deps: RouteDeps): Record<string, unknown> {
defaultK: view.defaultK, defaultK: view.defaultK,
summaryEnabled: view.summaryEnabled, summaryEnabled: view.summaryEnabled,
summaryMaxChars: view.summaryMaxChars, summaryMaxChars: view.summaryMaxChars,
skillsSyncEnabled: view.skillsSyncEnabled,
skillsDir: view.skillsDir,
}
return {
ok: true, settings, tokens, settingsPath: view.statePath, reporter: deps.reporter.snapshot(),
...(deps.skills === undefined ? {} : { skills: deps.skills() }),
} }
return { ok: true, settings, tokens, settingsPath: view.statePath, reporter: deps.reporter.snapshot() }
} }
/** Serve the configuration page. */ /** Serve the configuration page. */