NEXT temporary contract 3.8 — Boot debugger and preinstall calculator
01Temporary normative staging unit. Its body is the accepted architecture from refined plan revision 4, section 3.8. Before production code cites this law, promote the relevant clauses into permanent specifications. This file is consumed only after semantic coverage, implemented behavior and retained evidence are accepted. The task/retirement checker cannot perform semantic acceptance.
02D-006/D-007 требуют полноценную capability без imposed boot-size/token limits. First output — interactive visual inspector на существующем canonical representation плюс тот же machine API. Не закрывать эту цель одной таблицей bytes или CLI --json.
03Captured views: package/dependency/contribution/document/fragment tree; ordered static/dynamic/conditional/on-demand lanes; source positions и inclusion chains; direct/indirect/shared costs; diagnostics; recorded compilation stages; comparison двух snapshots. Selecting a fragment показывает source и почему он оказался в boot. Selecting package показывает собственный вклад и зависимости. Unsupported exact mapping после whole-lane transform маркируется unavailable/aggregate-only, не распределяется пропорционально без proof.
04Measures: exact raw/emitted bytes, Unicode scalar count, tokens с tokenizer identity/version и exact|estimated|unavailable, unique payload vs load occurrences, known/unknown session tail. Provider billing/cache hit не выводится из локальных bytes. Никаких high/low budget verdicts или automatic refusal по итоговому размеру; million-token boot допустим. Transport chunks/page size, streaming/tokenization и cancellation не ограничивают total допустимый boot.
05Preinstall/what-if: baseline selected world и candidate world с exact source captures/configuration сравниваются тем же resolver/compiler semantics. Отдельно static and dynamic hypothetical placement, только где legal loading contract; нелегальный сценарий explicit incompatible, не secretly меняет пакет. Candidate includes transitive/shared deps, choice selections, condition context и derivative bindings. Direct package bytes, inclusive dependency contribution и marginal delta могут различаться; нельзя складывать marginal deltas от независимых experiments. Dynamic result сообщает selected OS/context сценарий, condition list и conditional potential; exact total неизвестного future context не выдумывается.
06Purity/effects: inspect/explain/compare/get-section работают с retained snapshots. Explicit preview допускает pure builtin compilation в памяти на prepared captures и ничего не публикует. Missing source или stage requiring external/native execution → structured incomplete/needs-preparation. Fetch/hydrate/native stage допустимы только separate explicit admitted preparation operation, заранее показывающей effects; она создаёт immutable preview evidence, которое viewer потом читает. Инсталляция ещё не применена, project manifest/lock/slots/boot unchanged. Ни один обычный query не запускает provider исподтишка.
07Machine contract: versioned request and response unions для capture/read, tree/list, explain, costs, preview, compare, cancel/progress. Request содержит operation, selected context, snapshot/expected-world ID, filters/selection scenario; response — nodes/edges/source descriptors/mappings/measurements/completeness/diagnostics. Errors and progress events typed; request_id/sequence позволяют связать asynchronous progress с terminal result. Snapshot IDs content-derived; element IDs reproducible within same snapshot, surviving logical entities correlate across snapshots explicitly. Pagination/chunk handles bound to snapshot/filter; mixing versions returns stale, not plausible merged tree. Абсолютный filesystem root приходит из trusted surface, не из arbitrary MCP body.
08Одна library выдаёт значения CLI JSON input/output, MCP и локальному interactive tree/details/diff UI. IDE может использовать протокол независимо от UI. Exact visual frontend framework — implementation choice; протокол не зависит от него. Existing compiler observer/IR/owner-world APIs обеспечивают actual trace/provenance, не второй сборщик. Canonical compaction/status stripping/externalization — вне этого прохода: debugger first.