Add Layer.t type, refactor generate.ml to eliminate duplication and state
Layer library:
- Add layer.ml/mli with Layer.t = { hash; dir } and helpers
(of_hash, exists, is_ok, fs, meta_path, log_path)
Doc generate.ml:
- Extract shared DAG construction into build_internal_plan
- Extract dispatch logic into make_dispatch
- run = build_internal_plan + Dag_executor.execute
- plan_doc_dag = resolve_tools + build_internal_plan + make_dispatch
- build_tools_and_run = resolve_tools + run
- Remove compile_results mutable hashtable — all state on disk
- Remove current_build_hash ref — pass odoc_tool explicitly
- Use Layer.is_ok instead of ad-hoc layer_ok helper
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>