UNPKG

endfield-mcp

Version:

MCP Server for Arknights: Endfield (TypeScript / stdio + Streamable HTTP)

38 lines (37 loc) • 1.69 kB
/** * Story reader core — store binding and catalog loading. * * This module is the shared spine of the story domain. It owns the JsonStore * reference and the two eager-loaded catalog caches (`index.json`, * `missions.json`). The chapter, scene, and search sub-modules import the * lazy loaders exported here so the catalog is parsed exactly once across * the whole domain. * * ## Loading strategy * * The catalog (index/missions) loads eagerly into memory at first access * (~2.4MB). Individual conv files load on-demand by conv key (each tens * of KB). This mirrors PRTS-MCP's ZipStore pattern and keeps memory * bounded — we never hold all 97MB of dialogue in memory at once. * * ## Cache lifecycle * * This module only owns the catalog caches. `clearStoryCatalogCaches()` * resets just those. The full-domain orchestrators (`bindStoryStore`, * `clearStoryCaches`) live in `./story.ts` (the barrel facade) so they * can clear sibling caches atomically without this module reaching into * its siblings (which would muddy the layering). */ import type { JsonStore } from "./stores.js"; import type { StoryEntry } from "./storyTypes.js"; /** * Wire the JsonStore. Called once at startup by the barrel's * `bindStoryStore` orchestrator, which also clears all sibling caches. */ export declare function setStoryStore(store: JsonStore): void; /** Reset only the catalog caches owned by this module. */ export declare function clearStoryCatalogCaches(): void; export declare function hasStoryData(): boolean; export declare function store(): JsonStore; export declare function entries(): StoryEntry[]; export declare function missionNames(): Record<string, string>;