2026-08-31 20:00:12 +03:00
|
|
|
/**
|
|
|
|
|
* THE COMPOSITION ROOT for storage — the single place concrete store
|
|
|
|
|
* adapters are wired. Everything else (core, services, agents) codes against
|
|
|
|
|
* the port types in core/ports.ts and receives instances through this
|
|
|
|
|
* module. Swapping the fs adapter for SQLite later changes exactly this
|
|
|
|
|
* file (and the adapter implementations in src/store/).
|
|
|
|
|
*/
|
|
|
|
|
|
2026-09-19 18:05:30 +03:00
|
|
|
import { MODELS } from "../../config.ts";
|
2026-08-31 20:00:12 +03:00
|
|
|
import { chatStore } from "../store/chats.ts";
|
|
|
|
|
import { graphStore } from "../store/graph.ts";
|
|
|
|
|
import { jobStore } from "../store/jobs.ts";
|
2026-09-19 18:05:30 +03:00
|
|
|
import { settingsStore } from "../store/settings.ts";
|
|
|
|
|
import { resolveSettings, type EffectiveSettings, type ModelRoleSpecs } from "../core/settings-resolution.ts";
|
2026-08-31 20:00:12 +03:00
|
|
|
/** The wired adapters. Satisfies core/graph.ts's GraphDeps structurally. */
|
|
|
|
|
export const stores = {
|
|
|
|
|
chatStore,
|
|
|
|
|
graphStore,
|
|
|
|
|
jobStore,
|
2026-09-19 18:05:30 +03:00
|
|
|
settingsStore,
|
2026-08-31 20:00:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type Stores = typeof stores;
|
2026-09-19 18:05:30 +03:00
|
|
|
|
2026-09-22 00:14:56 +03:00
|
|
|
/** config.ts's MODELS as the compiled factory layer the resolution reads —
|
|
|
|
|
* ALL NINE roles since the model-slots wave (2026-09-20): the strong
|
|
|
|
|
* slot's factory fallback IS the prober pin. core stays pure (it takes
|
|
|
|
|
* this as a parameter, never imports config at runtime). Per-role
|
|
|
|
|
* OVERRIDES stay background-only (the conversation pair is
|
|
|
|
|
* chat-settings-controlled) — that split lives in core's
|
|
|
|
|
* BACKGROUND_MODEL_ROLES, unchanged. */
|
|
|
|
|
const MODEL_PINS: ModelRoleSpecs = {
|
|
|
|
|
prober: MODELS.prober,
|
|
|
|
|
teacher: MODELS.teacher,
|
2026-09-19 18:05:30 +03:00
|
|
|
researcher: MODELS.researcher,
|
|
|
|
|
demoBuilder: MODELS.demoBuilder,
|
|
|
|
|
visualMaker: MODELS.visualMaker,
|
2026-09-22 00:14:56 +03:00
|
|
|
pdfReader: MODELS.pdfReader,
|
2026-09-19 18:05:30 +03:00
|
|
|
extractor: MODELS.extractor,
|
|
|
|
|
auditor: MODELS.auditor,
|
|
|
|
|
labeler: MODELS.labeler,
|
|
|
|
|
};
|
2026-09-22 00:14:56 +03:00
|
|
|
export { MODEL_PINS };
|
2026-09-19 18:05:30 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 {
|
2026-09-22 00:14:56 +03:00
|
|
|
return resolveSettings(settingsStore.readSettings(), MODEL_PINS);
|
2026-09-19 18:05:30 +03:00
|
|
|
}
|