<?php
declare(strict_types=1);
$main='/workspace/zhct/zhctproject/ai_api';$sources=[];foreach(['B','C'] as $lane){$e=json_decode(file_get_contents(__DIR__.'/infos-evidence-'.$lane.'.json'),true);foreach($e['final_boundary']['reflection'] as $f=>$v){if(hash_file('sha256',$main.'/'.$f)!==$v['sha256']||!$v['actual_private_path'])throw new RuntimeException('Current main/private final source differs '.$f);$sources[$f]=$v['sha256'];}$controller=$e['cases'][0]['controller_identity'];$f='app/terminal/controller/meal/Meal.php';if(!$controller['controller_private_path']||hash_file('sha256',$main.'/'.$f)!==$controller['controller_sha256'])throw new RuntimeException('Actual controller source differs');$sources[$f]=$controller['controller_sha256'];$r=json_decode(file_get_contents(__DIR__.'/infos-resource-cleanup-'.$lane.'.json'),true);if($r['business_DML']!==0||$r['cache_files']!==0||!$r['tokens_cache_reclaimed']||!$r['port_closed'])throw new RuntimeException('Resource gate incomplete');}
$files=[];foreach(new DirectoryIterator(__DIR__) as $f)if($f->isFile()&&!in_array($f->getFilename(),['manifest.json','MANIFEST.sha256'],true)){$name=$f->getFilename();$files[$name]=hash_file('sha256',$f->getPathname());if(strpos($name,'.apifox-cli.json')!==false){$c=json_decode(file_get_contents($f->getPathname()),true);foreach($c['item'][0]['item'] as $i){if(strpos($i['request']['url'],'staff_id={{staff_id}}')===false)throw new RuntimeException('Natural ID in public collection');foreach($i['request']['header'] as $h)if($h['key']==='Access-Token'&&$h['value']!=='{{terminal_token}}')throw new RuntimeException('Token in public collection');}}}ksort($files);$out=['task'=>'ZHCTPROMPT-20260928-SMART-CANTEEN-DUAL-DB-COMPAT-PLAN','module'=>'terminal meal.Meal/infos incremental GET','source_base'=>'bb530e9b78894faa0f83d0d92416a152a468b1c2','final_main_and_private_source_sha256'=>$sources,'actual_infos_native_HTTP'=>5,'existing_Analysis_dependency_C_native_HTTP'=>7,'new_unique_method'=>1,'files'=>$files,'parent_Analysis_sealed_assets'=>'unchanged; original source identities remain historical','root_writer_applied_candidates'=>true,'credentials_or_natural_raw_in_control'=>false,'master_handoff'=>'root retains task-level SSH master as instructed; private workers stopped'];file_put_contents(__DIR__.'/manifest.json',json_encode($out,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));$lines=[];foreach($files as $name=>$sha)$lines[]=$sha.'  '.$name;file_put_contents(__DIR__.'/MANIFEST.sha256',implode("\n",$lines)."\n");echo json_encode(['files'=>count($files),'actual_final_sources'=>count($sources),'workers_closed_and_secrets_reclaimed'=>true]),"\n";
