Solution: integrated AI GameMaster vertical slice
Выбранный подход#
Strict TypeScript data contracts validated by Ajv, pure semantic validators and reducers, injected authoritative RNG, append-only in-memory event log, audience-specific projections, fake typed adapters and deterministic benchmark.
Архитектура и поток данных#
HostPreferences → proposed Adventure/Map → schema + semantic validation → initial state → player intent → typed proposal → schema → authorization → rules → server RNG → event append → pure reduce → projection → fake narration → telemetry → replay → state hash
Структура прототипа#
src/contracts.ts— domain types.src/schemas.ts— versioned JSON Schemas.src/validators.ts— schema/content/map validation.src/engine.ts— rules, authorization and reducer.src/event-log.ts— append/idempotency/replay.src/projection.ts— visibility enforcement.src/orchestrator.ts— adapter boundary.src/adversarial.ts— named threat corpus runner.src/property-harness.ts— generated invariant cases.src/long-session.ts— 1,000-event checkpoint proof.src/benchmark.ts— baseline/candidate harness.src/cli.ts— demo and benchmark commands.fixtures/— original host/content/map/corpus inputs.tests/— behavioral, adversarial and property checks.
Требования#
- macOS/Linux;
- Node.js 24.12+ (verified runtime 24.14.0);
- Bun 1.3.6 for the optional runtime smoke lane;
- npm 11.9.0;
- TypeScript 7.0.2;
- Ajv 8.20.0;
- fast-check 4.9.0;
- external services: none.
Установка#
npm ci
Запуск#
npm run technical:demo
npm run technical:benchmark
bun run RnD/technical/2026-07-25-ai-gm-vertical-slice/prototype/src/cli.ts demo
Тестирование#
npm run check
Конфигурация#
Нет environment variables, providers или secrets. Seed находится в fixture и выводе команды.
Ограничения и безопасность#
In-memory log, fake adapters и synthetic content нельзя переносить в production как persistence, model evaluation или finished adventure. Host input и generated contracts остаются недоверенными до validation.
Dedicated Adventure/Map studies define richer authoring contracts, while this slice uses separate minimal runtime contracts. Их interop не реализован и не входит в полученное доказательство.
Условия переноса в production#
Shared versioned authoring/runtime contract package или explicit compiler with cross-contract tests; затем durable transactional store, authentication, signed/audited event integrity, schema migrations, multi-process concurrency, provider benchmark, content moderation, observability/redaction, load/recovery tests и independent review.