The other half-wired seam: Platform's settings 'agent.prompts' switches had no consumer in the agent layer, and their effectivePromptSegments mirrored the PRE-sources-v1 loader — the shared/ fragments dir (the learner-files doctrine) was invisible to it, so a naive delegation would have silently dropped the segment from both agents' prompts. - src/core/prompt-segments.ts (NEW, pure): the mirror-layout path grammar + segment types, defined exactly once; core stays zero-IO. - src/agent/prompt-segments.ts (NEW, the CANONICAL discovery): base + shared/ + per-agent fragments, override resolution, allSegmentPaths. Composition is an agent concern; the agent layer reads its own tree (the architecture law pins agent and store apart — the first direct refactor attempt tripped the enforced import/no-restricted-paths zone, hence the three-layer split). - src/store/prompt-overrides.ts: slimmed to the override-file CRUD behind the core port; shares the core grammar. Its doc no longer claims to be the canonical mirror. - teacher-agent: composeInstructions(kind, switches?) composes through effectivePromptSegments — a segment whose switch is ON and whose override file exists composes the override text. Switches-less calls use the cached pure-source composition (byte-identical to the old loader, pinned by test); AgentBuildOptions.promptSwitches threads effective.agent.prompts per turn, composing fresh so override-file writes flip the very next turn. - server barrel: re-exports the agent module's resolution for the settings routes (server→agent, the lawful direction). Tests: byte-identical source pin, override swap-in (on/off/file-absent), shared/ overridability in both agents, agent-construction threading, updated segment-list pins with shared/ in composition order. This file keeps owning PROMPTS_OVERRIDE_DIR (parallel-test discipline). Gates: 671/671, typecheck, lint, build.
47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
/**
|
|
* THE CORE PUBLIC API — the only module the shell (app/, components/) may
|
|
* import. Everything exported here is browser-safe: pure logic + types,
|
|
* no node builtins, no fs, no network.
|
|
*
|
|
* Server-side surfaces (chat streaming, store reads) live behind
|
|
* src/server's barrel instead — the import law (eslint.config.mjs):
|
|
*
|
|
* components/** → "@/src/core" (this barrel, ONLY)
|
|
* app/** → "@/src/core" + "@/src/server"
|
|
*
|
|
* Server-only core modules (core/graph.ts emission/derivation) are pure
|
|
* but need storage ports passed in by a server caller, so they are
|
|
* deliberately NOT re-exported here — the server imports them directly.
|
|
* The storage PORT TYPES are types-only and browser-safe, hence re-exported.
|
|
*/
|
|
|
|
export * from "./contracts.ts";
|
|
export * from "./ports.ts";
|
|
export * from "./render-settings.ts";
|
|
|
|
export * from "./question-core.ts";
|
|
// clusters.ts (Louvain) is deliberately NOT re-exported: nothing in the
|
|
// shell runs community detection — the snapshot carries the partition
|
|
// from the server. Keeping it out keeps the heavy clustering deps out of the
|
|
// client bundle (verified 2026-09-13: chunks contained it while this
|
|
// line existed). Same logic as layout-settle.ts below.
|
|
export * from "./layout.ts";
|
|
export * from "./plan-tree.ts";
|
|
export * from "./phases.ts";
|
|
export * from "./pending.ts";
|
|
export * from "./prompt-segments.ts";
|
|
export * from "./math-delims.ts";
|
|
export * from "./ui-message.ts";
|
|
export * from "./tool-parts.ts";
|
|
export * from "./prices.ts";
|
|
export * from "./fuzzy.ts";
|
|
// settings.ts + settings-resolution.ts (settings-storage wave, 2026-09-19):
|
|
// the user-settings record's shape/sanitizer (pure) and its fully-resolved
|
|
// view. Browser-safe — the Wave-4 panel imports these directly.
|
|
export * from "./settings.ts";
|
|
export * from "./settings-resolution.ts";
|
|
// keyboard.ts: the shortcut registry + binding normalization (pure, browser-safe).
|
|
export * from "./keyboard.ts";
|
|
export * from "./coverage.ts";
|
|
export * from "./graph-context.ts";
|