wave 2 (platform stream): settings storage & plumbing foundation (P2)
- src/core/settings.ts: versioned DELTA record schema + sanitizer (unknown keys preserved)
— general/chat/agent{models,tools,prompts}/appearance/graph sections
- src/core/settings-resolution.ts: pure resolveSettings (factory defaults → user delta),
extraction/graph-context channel predicates
- src/store/settings.ts + prompt-overrides.ts: SettingsStore/PromptOverrideStore adapters
wired through stores.ts (effectiveSettings() fresh per call); lazy migration of
default-settings.json into record.chat
- app/api/settings/** routes (record, section bodies, prompt overrides per segment)
- chat-handler: graph gates at trigger call-sites + toolToggles injection seam
- config.ts: SETTINGS_FILE + PROMPTS_OVERRIDE_DIR paths
587/587 tests; typecheck/lint/build clean
This commit is contained in:
@@ -6,14 +6,42 @@
|
||||
* file (and the adapter implementations in src/store/).
|
||||
*/
|
||||
|
||||
import { MODELS } from "../../config.ts";
|
||||
import { chatStore } from "../store/chats.ts";
|
||||
import { graphStore } from "../store/graph.ts";
|
||||
import { jobStore } from "../store/jobs.ts";
|
||||
import { settingsStore } from "../store/settings.ts";
|
||||
import { resolveSettings, type EffectiveSettings, type ModelRoleSpecs } from "../core/settings-resolution.ts";
|
||||
/** The wired adapters. Satisfies core/graph.ts's GraphDeps structurally. */
|
||||
export const stores = {
|
||||
chatStore,
|
||||
graphStore,
|
||||
jobStore,
|
||||
settingsStore,
|
||||
};
|
||||
|
||||
export type Stores = typeof stores;
|
||||
|
||||
/** config.ts's MODELS narrowed to the background roles — the compiled
|
||||
* factory layer the resolution reads. core stays pure (it takes this as a
|
||||
* parameter, never imports config at runtime); the prober/teacher pins
|
||||
* are chat-settings-controlled and deliberately absent here. Tests pin
|
||||
* that the role set matches core's BACKGROUND_MODEL_ROLES. */
|
||||
const BACKGROUND_MODEL_PINS: ModelRoleSpecs = {
|
||||
researcher: MODELS.researcher,
|
||||
demoBuilder: MODELS.demoBuilder,
|
||||
visualMaker: MODELS.visualMaker,
|
||||
extractor: MODELS.extractor,
|
||||
auditor: MODELS.auditor,
|
||||
labeler: MODELS.labeler,
|
||||
};
|
||||
|
||||
/**
|
||||
* The resolved view of the settings record (core/settings-resolution.ts):
|
||||
* every knob concrete, record overrides over config.ts factory pins. Read
|
||||
* fresh on every call — the record is a small file and turns are rare, so
|
||||
* no caching layer (stale toggles after a settings PUT would be worse).
|
||||
*/
|
||||
export function effectiveSettings(): EffectiveSettings {
|
||||
return resolveSettings(settingsStore.readSettings(), BACKGROUND_MODEL_PINS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user