"""Isolated round8 lifecycle and all inherited gates, no round7 rebinding."""
from pathlib import Path
import sys
import types

PROJECT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(PROJECT));sys.path.insert(0,str(PROJECT/'scripts'))
from pallet.mask_model_training_data import require

path=PROJECT/'scripts/serve_pallet_description_round7.py'
SOURCE=path.read_text().replace('round7','round8')
require(SOURCE.count(">=398")==1,'Regression gate anchor changed');SOURCE=SOURCE.replace('>=398','>=415')
implementation=types.ModuleType('_round8_service');implementation.__file__=__file__
exec(compile(SOURCE,str(path),'exec'),implementation.__dict__)
# The new proof binds both adapters and their inherited source implementations.
implementation.CODE=tuple(sorted(set(implementation.CODE)|{
    'pallet/pallet_description_round6_data.py','pallet/pallet_description_round5_mask.py','pallet/pallet_description_round5_vlm.py',
    'pallet/pallet_description_round7_release.py','scripts/serve_pallet_description_round7.py','scripts/check_pallet_description_round7_ui.py',
    'scripts/finalize_pallet_description_round7.py','scripts/check_pallet_description_round8_pointer.py','scripts/check_pallet_description_round7_pointer.py',
    'scripts/verify_pallet_description_round7_public.py','scripts/check_pallet_review_save_complete.py',
    'scripts/check_pallet_description_replace.py','scripts/check_pallet_review_filter_universal.py',
    'scripts/check_pallet_review_save_complete_pointer.py'}))
runtime=implementation.runtime;configure=implementation.configure;gallery=implementation.gallery;CODE=implementation.CODE
ReplaceHandler=implementation.ReplaceHandler;TriageHandler=implementation.TriageHandler;RELEASE=implementation.RELEASE;REVIEW_SETS=implementation.REVIEW_SETS


if __name__=='__main__':
    import argparse
    p=argparse.ArgumentParser();p.add_argument('mode',choices=REVIEW_SETS);p.add_argument('command',choices=('provision','app','run','start','status'));p.add_argument('--timeout',type=int,default=180);a=p.parse_args()
    if a.command=='provision':runtime.provision(a.mode)
    elif a.command=='app':implementation.app(a.mode)
    elif a.command=='run':runtime.supervise(a.mode)
    elif a.command=='start':runtime.start(a.mode,a.timeout)
    else:print(dict(healthy=runtime.healthy(a.mode),supervisor=runtime.running(a.mode)))
